goapi.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef _GOAPI_H_
  2. #define _GOAPI_H_
  3. #include <stdlib.h>
  4. enum GoType {
  5. GT_Invalid ,
  6. GT_Bool ,
  7. GT_Int ,
  8. GT_Int8 ,
  9. GT_Int16 ,
  10. GT_Int32 ,
  11. GT_Int64 ,
  12. GT_Uint ,
  13. GT_Uint8 ,
  14. GT_Uint16 ,
  15. GT_Uint32 ,
  16. GT_Uint64 ,
  17. GT_Uintptr ,
  18. GT_Float32 ,
  19. GT_Float64 ,
  20. GT_Complex64 ,
  21. GT_Complex128 ,
  22. GT_Array ,
  23. GT_Chan ,
  24. GT_Func ,
  25. GT_Interface ,
  26. GT_Map ,
  27. GT_Ptr ,
  28. GT_Slice ,
  29. GT_String ,
  30. GT_Struct ,
  31. GT_UnsafePointer,
  32. };
  33. /* Start of boilerplate cgo prologue. */
  34. #ifndef GO_CGO_PROLOGUE_H
  35. #define GO_CGO_PROLOGUE_H
  36. typedef signed char GoInt8;
  37. typedef unsigned char GoUint8;
  38. typedef short GoInt16;
  39. typedef unsigned short GoUint16;
  40. typedef int GoInt32;
  41. typedef unsigned int GoUint32;
  42. typedef long long GoInt64;
  43. typedef unsigned long long GoUint64;
  44. typedef GoInt64 GoInt;
  45. typedef GoUint64 GoUint;
  46. typedef __SIZE_TYPE__ GoUintptr;
  47. typedef float GoFloat32;
  48. typedef double GoFloat64;
  49. typedef __complex float GoComplex64;
  50. typedef __complex double GoComplex128;
  51. // static assertion to make sure the file is being used on architecture
  52. // at least with matching size of GoInt.
  53. typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
  54. typedef struct { char *p; GoInt n; } GoString;
  55. typedef void *GoMap;
  56. typedef void *GoChan;
  57. typedef struct { void *t; void *v; } GoInterface;
  58. typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
  59. #endif
  60. /* End of boilerplate cgo prologue. */
  61. ///////////
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65. //// put goapi.go's export function here
  66. extern void goapi_array_new(GoInt p0, void** p1);
  67. extern void goapi_array_push(void* p0, void* p1, void** p2);
  68. extern void goapi_map_new(void** p0);
  69. extern void goapi_map_add(void* p0, void* p1, void* p2);
  70. extern void goapi_map_get(void* p0, void* p1, void** p2);
  71. extern void goapi_map_del(void* p0, void* p1);
  72. extern GoUint8 goapi_map_has(void* p0, void* p1);
  73. extern void goapi_chan_new(GoInt p0, GoInt p1, void** p2);
  74. extern void goapi_chan_read(void* p0, void** p1);
  75. extern void goapi_chan_write(void* p0, void* p1);
  76. extern void goapi_chan_close(void* p0);
  77. extern void goapi_type(GoInt p0, void** p1);
  78. extern void goapi_typeof(void* p0, void** p1);
  79. extern GoInt goapi_typeid(void* p0);
  80. extern void goapi_new(GoInt p0, void** p1);
  81. extern void goapi_new_value(GoInt p0, GoUintptr p1, void** p2);
  82. extern void goapi_set_value(void* p0, GoUintptr p1, void** p2);
  83. extern void goapi_set_php_array(void* p0, void** p1);
  84. extern GoUintptr goapi_get_value(void* p0, void* p1);
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88. #endif