Jsctypes/api: Difference between revisions

Jump to navigation Jump to search
72 bytes removed ,  24 September 2009
(add jorendorff stuff, partly compatible)
Line 105: Line 105:


'''ctypes.bool, short, unsigned_short, int, unsigned, unsigned_int, long, unsigned_long, float, double''' - Types that behave like the corresponding C types. Some or all of these might be aliases for the primitive types listed above. As in C, ''unsigned'' is always an alias for ''unsigned_int''.
'''ctypes.bool, short, unsigned_short, int, unsigned, unsigned_int, long, unsigned_long, float, double''' - Types that behave like the corresponding C types. Some or all of these might be aliases for the primitive types listed above. As in C, ''unsigned'' is always an alias for ''unsigned_int''.
''(Note: I think <code>int</code> might be reserved in JS, sigh.)''


''(TBD: Do we want char types? how should they behave?)''  
''(TBD: Do we want char types? how should they behave?)''  
Line 122: Line 120:
Examples:
Examples:


  const DWORD = ctypes.uint32_t;
const DWORD = ctypes.uint32_t;
  const HANDLE = new ctypes.PointerType("HANDLE");
const HANDLE = new ctypes.PointerType("HANDLE");
 
  const FILE = new ctypes.PointerType("FILE *");
const FILE = new ctypes.PointerType("FILE *");
  const IOBuf = new ctypes.ArrayType(ctypes.uint8_t, 4096);
const IOBuf = new ctypes.ArrayType(ctypes.uint8_t, 4096);
 
  const struct_tm = new ctypes.Struct('tm', [[ctypes.int, 'tm_sec'], ...]);
const struct_tm = new ctypes.Struct('tm', [[ctypes.int, 'tm_sec'], ...]);


== Calling types ==
== Calling types ==
638

edits

Navigation menu