Have a typemap for uint8_t*
This commit is contained in:
parent
cbdff5fbc0
commit
a219ffc45d
2 changed files with 39 additions and 7 deletions
|
|
@ -12,7 +12,8 @@ dotnetenv.Append(CCFLAGS=["-fpic", '-DSWIG', '-Wno-all',
|
||||||
LIBPATH=["../.."],
|
LIBPATH=["../.."],
|
||||||
SWIGFLAGS=["-DHAMMER_INTERNAL__NO_STDARG_H",
|
SWIGFLAGS=["-DHAMMER_INTERNAL__NO_STDARG_H",
|
||||||
"-Isrc/", "-csharp",
|
"-Isrc/", "-csharp",
|
||||||
"-dllimport","hammer_dotnet"])
|
"-dllimport","hammer_dotnet",
|
||||||
|
"-namespace", "Hammer.Internal"])
|
||||||
import os
|
import os
|
||||||
|
|
||||||
swig = ['hammer.i']
|
swig = ['hammer.i']
|
||||||
|
|
@ -25,23 +26,25 @@ csfiles = os.path.join(thisdir, "*.cs")
|
||||||
# This also generates a bunch of .cs files, which we'll just use this
|
# This also generates a bunch of .cs files, which we'll just use this
|
||||||
# target to stand in for.
|
# target to stand in for.
|
||||||
hammer_wrap = AlwaysBuild(dotnetenv.Command(['hammer_wrap.c'], swig,
|
hammer_wrap = AlwaysBuild(dotnetenv.Command(['hammer_wrap.c'], swig,
|
||||||
["rm %s/*.cs" % (thisdir,),
|
["rm %s/*.cs || true" % (thisdir,),
|
||||||
"swig $SWIGFLAGS $SOURCE"]))
|
"swig $SWIGFLAGS $SOURCE"]))
|
||||||
libhammer_dotnet = dotnetenv.SharedLibrary(['hammer_dotnet'], hammer_wrap)
|
libhammer_dotnet = dotnetenv.SharedLibrary(['hammer_dotnet'], hammer_wrap)
|
||||||
hammer_dll = AlwaysBuild(dotnetenv.Command(['hammer.dll'], hammer_wrap,
|
hammer_dll = AlwaysBuild(dotnetenv.Command(['hammer.dll'], Glob('ext/*.cs'),
|
||||||
'$CSC -t:library -out:$TARGET %s/*.cs' %(thisdir,)))
|
'$CSC -t:library -unsafe -out:$TARGET %s/*.cs $SOURCE' %(thisdir,)))
|
||||||
Depends(hammer_dll, hammer_wrap)
|
|
||||||
#hammer_dll = dotnetenv.CLILibrary('hammer.dll', dotnetenv.Glob('*.cs'))
|
|
||||||
Depends(hammer_dll, hammer_wrap)
|
Depends(hammer_dll, hammer_wrap)
|
||||||
|
#hammer_dll = dotnetenv.CLILibrary('hammer.dll', hammer.cs)
|
||||||
Default(libhammer_dotnet, hammer_dll)
|
Default(libhammer_dotnet, hammer_dll)
|
||||||
|
|
||||||
dotnettestenv = dotnetenv.Clone()
|
dotnettestenv = dotnetenv.Clone()
|
||||||
|
|
||||||
#dotnettestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
|
#dotnettestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
|
||||||
#dotnettests = ['t/hammer.t']
|
#dotnettests = ['t/hammer.t']
|
||||||
|
dotnettestenv.Append(CILLIBS=['/usr/lib/cli/nunit.core-2.6/nunit.core.dll','/usr/lib/cli/nunit.util-2.6/nunit.util.dll','/usr/lib/cli/nunit.framework-2.6/nunit.framework.dll','/usr/lib/cli/nunit.core.interfaces-2.6/nunit.core.interfaces.dll',str(hammer_dll[0])])
|
||||||
|
dotnettestlib = dotnettestenv.CLILibrary('hammer_test.dll', Glob('test/*.cs'))
|
||||||
#dotnettestexec = dotnettestenv.Command(None, dotnettests + libhammer_dotnet + libhammer_shared, "make test -C " + targetdir)
|
#dotnettestexec = dotnettestenv.Command(None, dotnettests + libhammer_dotnet + libhammer_shared, "make test -C " + targetdir)
|
||||||
#dotnettest = Alias("testdotnet", [dotnettestexec], dotnettestexec)
|
#dotnettest = Alias("testdotnet", [dotnettestexec], dotnettestexec)
|
||||||
#AlwaysBuild(dotnettestexec)
|
#AlwaysBuild(dotnettestexec)
|
||||||
#testruns.append(dotnettest)
|
testruns.append(dotnettestlib)
|
||||||
|
|
||||||
#dotnetinstallexec = dotnetenv.Command(None, libhammer_dotnet, "make install -C " + targetdir)
|
#dotnetinstallexec = dotnetenv.Command(None, libhammer_dotnet, "make install -C " + targetdir)
|
||||||
#dotnetinstall = Alias("installdotnet", [dotnetinstallexec], dotnetinstallexec)
|
#dotnetinstall = Alias("installdotnet", [dotnetinstallexec], dotnetinstallexec)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,32 @@
|
||||||
%module hammer;
|
%module hammer;
|
||||||
|
|
||||||
|
%include "stdint.i"
|
||||||
|
|
||||||
|
// Special attention needs to be paid to:
|
||||||
|
// h_parse
|
||||||
|
// h_token
|
||||||
|
// h_in
|
||||||
|
// h_not_in
|
||||||
|
|
||||||
|
//%typemap(cstype) uint8_t* "byte[]"
|
||||||
|
%typemap(imtype) uint8_t* "IntPtr"
|
||||||
|
//%typemap(csin, pre="unsafe { fixed(byte* temp$csinput = &$csinput[0]) {", terminator="}}") uint8_t* "(IntPtr)temp$csinput"
|
||||||
|
//%typemap(csvarin) uint8_t
|
||||||
|
%typemap(cstype) uint8_t* "IntPtr"
|
||||||
|
%typemap(csin) uint8_t* "$csinput"
|
||||||
|
%typemap(csvarout) uint8_t* %{
|
||||||
|
get {
|
||||||
|
return $imcall;
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%ignore h_bit_writer_get_buffer;
|
||||||
|
%apply (char *STRING, size_t LENGTH) {(uint8_t* str, size_t len)};
|
||||||
|
%apply (uint8_t* str, size_t len) {(const uint8_t* input, size_t length)}
|
||||||
|
%apply (uint8_t* str, size_t len) {(const uint8_t* str, const size_t len)}
|
||||||
|
%apply (uint8_t* str, size_t len) {(const uint8_t* charset, size_t length)}
|
||||||
|
|
||||||
|
%typemap(csclassmodifiers) SWIGTYPE "internal class";
|
||||||
|
%csmethodmodifiers "internal";
|
||||||
|
|
||||||
%include "../swig/hammer.i";
|
%include "../swig/hammer.i";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue