mirror of
https://github.com/icewind1991/ivory.git
synced 2026-06-03 18:54:07 +02:00
cleanup
This commit is contained in:
parent
d8f9ab3ac8
commit
67b59ff421
2 changed files with 9 additions and 19 deletions
|
|
@ -2,18 +2,11 @@
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
use core::fmt::Debug;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
use proc_macro2::{Span, TokenStream, TokenTree};
|
use proc_macro2::{Span, TokenStream, TokenTree};
|
||||||
use proc_macro2::token_stream::IntoIter;
|
use quote::quote;
|
||||||
use quote::{quote, quote_spanned};
|
use syn::{AttributeArgs, Expr, FieldValue, FnArg, Ident, Item, ItemFn, LitStr, parse2, parse_macro_input, Pat, Type};
|
||||||
use syn::{Attribute, AttributeArgs, Data, Expr, ExprStruct, Fields, FieldValue, FnArg, Ident, Item, ItemFn, Lit, LitStr, Meta, parse2, parse_macro_input, parse_quote, parse_str, Pat, Path, Type};
|
|
||||||
use syn::parse_quote::parse;
|
|
||||||
use syn::punctuated::Punctuated;
|
use syn::punctuated::Punctuated;
|
||||||
use syn::spanned::Spanned;
|
use syn::spanned::Spanned;
|
||||||
use syn::token::Comma;
|
|
||||||
|
|
||||||
/// See the [crate documentation](index.html) for details
|
/// See the [crate documentation](index.html) for details
|
||||||
#[proc_macro_attribute]
|
#[proc_macro_attribute]
|
||||||
|
|
@ -23,8 +16,8 @@ pub fn ivory_export(attr: proc_macro::TokenStream, input: proc_macro::TokenStrea
|
||||||
let _attr = parse_macro_input!(attr as AttributeArgs);
|
let _attr = parse_macro_input!(attr as AttributeArgs);
|
||||||
|
|
||||||
let output = match item {
|
let output = match item {
|
||||||
Item::Fn(itemFn) => {
|
Item::Fn(item_fn) => {
|
||||||
export_fn(itemFn).into()
|
export_fn(item_fn).into()
|
||||||
}
|
}
|
||||||
_ => unimplemented!()
|
_ => unimplemented!()
|
||||||
};
|
};
|
||||||
|
|
@ -174,8 +167,8 @@ fn into_c_str(input: TokenStream) -> TokenStream {
|
||||||
let mut tokens = TokenStream::new();
|
let mut tokens = TokenStream::new();
|
||||||
tokens.extend(vec![token.clone()]);
|
tokens.extend(vec![token.clone()]);
|
||||||
match syn::parse2::<LitStr>(tokens) {
|
match syn::parse2::<LitStr>(tokens) {
|
||||||
Ok(litStr) => {
|
Ok(lit_str) => {
|
||||||
let val = litStr.value();
|
let val = lit_str.value();
|
||||||
let tokens = quote! {
|
let tokens = quote! {
|
||||||
{ concat!(#val, "\0").as_ptr() as *const ::libc::c_char }
|
{ concat!(#val, "\0").as_ptr() as *const ::libc::c_char }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ use std::mem::size_of;
|
||||||
use std::os::raw::c_char;
|
use std::os::raw::c_char;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use crate::externs::printf;
|
|
||||||
use crate::zend::bindings::zend_string;
|
use crate::zend::bindings::zend_string;
|
||||||
|
|
||||||
use super::bindings::{zend_execute_data, zval};
|
use super::bindings::{zend_execute_data, zval};
|
||||||
|
|
@ -26,11 +25,9 @@ impl ExecuteData {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn get_arg(&self, i: u32) -> &ZVal {
|
pub unsafe fn get_arg(&self, i: u32) -> &ZVal {
|
||||||
unsafe {
|
let base = self.get_arg_base();
|
||||||
let base = self.get_arg_base();
|
let val_ptr = base.add(i as usize);
|
||||||
let val_ptr = base.add(i as usize);
|
&*val_ptr
|
||||||
&*val_ptr
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn args(&self) -> IntoArgIterator {
|
pub fn args(&self) -> IntoArgIterator {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue