HalconCDefs.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. /*****************************************************************************
  2. * HalconCDefs.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/libhalcon
  6. * Description: Defines, types, and declarations for HALCON/C
  7. *
  8. * (c) 1996-2020 by MVTec Software GmbH
  9. * www.mvtec.com
  10. *
  11. ****************************************************************************/
  12. #ifndef HALCON_C_DEFS_H
  13. #define HALCON_C_DEFS_H
  14. #include "HParallel.h"
  15. #include "HIntDef.h"
  16. #include "HDeclSpec.h"
  17. #include "HErrorDef.h"
  18. #include "HConst.h"
  19. #include "HBase.h"
  20. #include "IPType.h"
  21. #include "HMacro.h"
  22. #include "HExtern.h"
  23. #include <string.h>
  24. #define UNDEF_TYPE (-1) /* Type after deleting a tuple */
  25. /* instead of STRING_PAR, INT_PAR, etc */
  26. /*
  27. * Data of type Hobject is a pointer into the HALCON object data base.
  28. * Thus it has to be treated as a magic number and must not be changed
  29. * by the user.
  30. */
  31. typedef Hkey Hobject; /* Pointer to HALCON iconic data */
  32. /*
  33. * The data structure Htuple is used to pass control data to the
  34. * HALCON operators and get various kinds to non iconic data back
  35. * to the application.
  36. * Creating, access and deletion must only be done with the
  37. * supplied procedures. For global, static initialization, the
  38. * HTUPLE_INITIALIZER macro is provided.
  39. */
  40. typedef Hctuple Htuple;
  41. #define HTUPLE_INITIALIZER HCTUPLE_INITIALIZER
  42. /*
  43. * Constants
  44. */
  45. #ifdef HC_LEGACY_PAR
  46. #define _ (Hlong*)0 /* anonyme Variable */
  47. #define _i (Hlong*)0 /* anonyme Variable (long) */
  48. #define _d (double*)0 /* anonyme Variable (double) */
  49. #define _s (char*)0 /* anonyme Variable (string) */
  50. #define _t (Htuple*)0 /* anonyme Variable (Tupel) */
  51. #endif
  52. #define HALCONC_HNULL ((Hphandle)0) /* undefined handle */
  53. #define NO_OBJECTS (Hobject)(1) /* leere Objektliste */
  54. #define EMPTY_REGION (Hobject)(2) /* Objekt mit leerer Region */
  55. #if 0
  56. #define FULL_REGION (Hobject)(3) /* Objekt mit maximaler Region*/
  57. #endif
  58. #if defined(__cplusplus)
  59. extern "C" {
  60. #endif
  61. LIntExport void SetHcInterfaceStringEncodingIsUtf8(int is_utf8);
  62. LIntExport int IsHcInterfaceStringEncodingUtf8();
  63. LIntExport void* CMalloc(size_t size, const char* file, INT4_8 line);
  64. LIntExport void CFree(void* mem, const char* file, INT4_8 line);
  65. /* HALCON/C interface utility functions */
  66. LIntExport void Mcreate_tuple(Htuple* t, Hlong l, char const* file, int line);
  67. LIntExport void Mcreate_tuple_type(Htuple* t, Hlong l, int type,
  68. char const* file, int line);
  69. LIntExport void Mcopy_tuple(Htuple const* input, Htuple* output,
  70. char const* file, int line);
  71. LIntExport void Mattach_tuple(Htuple* H_RESTRICT src, Htuple* H_RESTRICT dest,
  72. char const* file, int line);
  73. LIntExport void Mresize_tuple(Htuple* input, Hlong LEN, char const* file,
  74. int line);
  75. LIntExport void Mdestroy_tuple(Htuple* t, char const* file, int line);
  76. LIntExport Hlong Mlength_tuple(Htuple const* t, char const* file, int line);
  77. LIntExport void Mset_i(Htuple* t, Hlong v, Hlong i, char const* file,
  78. int line);
  79. LIntExport void Mset_d(Htuple* t, double v, Hlong i, char const* file,
  80. int line);
  81. LIntExport void Mset_s(Htuple* t, char const* v, Hlong i, const char* file,
  82. int line);
  83. LIntExport void Mset_s_from_utf8(Htuple* t, char const* v, Hlong i,
  84. const char* file, int line);
  85. LIntExport void Mset_s_from_local8bit(Htuple* t, char const* v, Hlong i,
  86. const char* file, int line);
  87. #ifdef _WIN32
  88. LIntExport void Mset_s_from_wcs(Htuple* t, wchar_t const* v, Hlong i,
  89. const char* file, int line);
  90. #endif
  91. LIntExport void Mset_s_len(Htuple* t, Hlong len, Hlong i, char const* file,
  92. int line);
  93. LIntExport void Mset_h(Htuple* t, Hphandle v, Hlong i, const char* file,
  94. int line);
  95. LIntExport Hlong Mget_i(Htuple const* t, Hlong i, char const* file, int line);
  96. LIntExport double Mget_d(Htuple const* t, Hlong i, char const* file, int line);
  97. LIntExport char const* Mget_s(Htuple const* t, Hlong i, char const* file,
  98. int line);
  99. LIntExport Hlong Mget_s_to_utf8(char* dest, Hlong dest_size, Htuple const* t,
  100. Hlong i, char const* file, int line);
  101. LIntExport Hlong Mget_s_to_local8bit(char* dest, Hlong dest_size,
  102. Htuple const* t, Hlong i,
  103. char const* file, int line);
  104. #ifdef _WIN32
  105. LIntExport Hlong Mget_s_to_wcs(wchar_t* dest, Hlong dest_size, Htuple const* t,
  106. Hlong i, char const* file, int line);
  107. #endif
  108. LIntExport Hphandle Mget_h(Htuple const* t, Hlong i, char const* file,
  109. int line);
  110. LIntExport int Mget_type(Htuple const* t, Hlong i, char const* file, int line);
  111. /* functions combining (re)creation and one value setting */
  112. LIntExport void Mcreate_tuple_i(Htuple* t, Hlong value, char const* file,
  113. int line);
  114. LIntExport void Mcreate_tuple_d(Htuple* t, double value, char const* file,
  115. int line);
  116. LIntExport void Mcreate_tuple_s(Htuple* t, char const* value, char const* file,
  117. int line);
  118. LIntExport void Mcreate_tuple_s_from_utf8(Htuple* t, char const* value,
  119. char const* file, int line);
  120. LIntExport void Mcreate_tuple_s_from_local8bit(Htuple* t, char const* value,
  121. char const* file, int line);
  122. #ifdef _WIN32
  123. LIntExport void Mcreate_tuple_s_from_wcs(Htuple* t, wchar_t const* value,
  124. char const* file, int line);
  125. #endif
  126. LIntExport void Mcreate_tuple_h(Htuple* t, Hphandle value, char const* file,
  127. int line);
  128. LIntExport void Mreuse_tuple_i(Htuple* t, Hlong value, char const* file,
  129. int line);
  130. LIntExport void Mreuse_tuple_d(Htuple* t, double value, char const* file,
  131. int line);
  132. LIntExport void Mreuse_tuple_s(Htuple* t, char const* value, char const* file,
  133. int line);
  134. LIntExport void Mreuse_tuple_s_from_utf8(Htuple* t, char const* value,
  135. char const* file, int line);
  136. LIntExport void Mreuse_tuple_s_from_local8bit(Htuple* t, char const* value,
  137. char const* file, int line);
  138. #ifdef _WIN32
  139. LIntExport void Mreuse_tuple_s_from_wcs(Htuple* t, wchar_t const* value,
  140. char const* file, int line);
  141. #endif
  142. LIntExport void Mreuse_tuple_h(Htuple* t, Hphandle value, char const* file,
  143. int line);
  144. LIntExport void F_create_tuple_type(Htuple* H_RESTRICT htuple, Hlong len,
  145. HINT type);
  146. LIntExport void F_create_tuple(Htuple* H_RESTRICT htuple, Hlong l);
  147. LIntExport void F_copy_tuple(Htuple const* H_RESTRICT in,
  148. Htuple* H_RESTRICT out);
  149. LIntExport void F_attach_tuple(Htuple* H_RESTRICT src,
  150. Htuple* H_RESTRICT dest);
  151. LIntExport void F_resize_tuple(Htuple* H_RESTRICT htuple, Hlong LEN);
  152. LIntExport void F_destroy_tuple(Htuple* H_RESTRICT htuple);
  153. LIntExport void F_set_i(Htuple* H_RESTRICT t, Hlong value, Hlong idx);
  154. LIntExport void F_set_d(Htuple* H_RESTRICT t, double value, Hlong idx);
  155. LIntExport void F_set_s(Htuple* H_RESTRICT t, char const* H_RESTRICT val,
  156. Hlong idx);
  157. LIntExport void F_set_s_from_utf8(Htuple* H_RESTRICT t,
  158. char const* H_RESTRICT val, Hlong idx);
  159. LIntExport void F_set_s_from_local8bit(Htuple* H_RESTRICT t,
  160. char const* H_RESTRICT val, Hlong idx);
  161. #ifdef _WIN32
  162. LIntExport void F_set_s_from_wcs(Htuple* H_RESTRICT t,
  163. wchar_t const* H_RESTRICT val, Hlong idx);
  164. #endif
  165. LIntExport void F_set_h(Htuple* H_RESTRICT t, Hphandle val, Hlong idx);
  166. LIntExport void F_init_i(Htuple* H_RESTRICT t, Hlong value, Hlong idx);
  167. LIntExport void F_init_d(Htuple* H_RESTRICT t, double value, Hlong idx);
  168. LIntExport void F_init_s(Htuple* H_RESTRICT t, char const* H_RESTRICT value,
  169. Hlong idx);
  170. LIntExport void F_init_s_from_utf8(Htuple* H_RESTRICT t,
  171. char const* H_RESTRICT value, Hlong idx);
  172. LIntExport void F_init_s_from_local8bit(Htuple* H_RESTRICT t,
  173. char const* H_RESTRICT value,
  174. Hlong idx);
  175. #ifdef _WIN32
  176. LIntExport void F_init_s_from_wcs(Htuple* H_RESTRICT t,
  177. wchar_t const* H_RESTRICT value, Hlong idx);
  178. #endif
  179. LIntExport void F_init_s_len(Htuple* H_RESTRICT t, Hlong len, Hlong idx);
  180. LIntExport void F_init_h(Htuple* H_RESTRICT t, Hphandle value, Hlong idx);
  181. LIntExport Hlong F_get_i(Htuple const* H_RESTRICT t, Hlong idx);
  182. LIntExport double F_get_d(Htuple const* H_RESTRICT t, Hlong idx);
  183. LIntExport char const* F_get_s(Htuple const* H_RESTRICT t, Hlong idx);
  184. LIntExport Hlong F_get_s_to_utf8(char* dest, Hlong dest_size,
  185. Htuple const* H_RESTRICT t, Hlong i);
  186. LIntExport Hlong F_get_s_to_local8bit(char* dest, Hlong dest_size,
  187. Htuple const* H_RESTRICT t, Hlong i);
  188. #ifdef _WIN32
  189. LIntExport Hlong F_get_s_to_wcs(wchar_t* dest, Hlong dest_size,
  190. Htuple const* H_RESTRICT t, Hlong i);
  191. #endif
  192. LIntExport Hphandle F_get_h(Htuple const* H_RESTRICT t, Hlong idx);
  193. /* functions combining (re)creation and one value setting */
  194. LIntExport void F_create_tuple_i(Htuple* H_RESTRICT t, Hlong val);
  195. LIntExport void F_create_tuple_d(Htuple* H_RESTRICT t, double val);
  196. LIntExport void F_create_tuple_s(Htuple* H_RESTRICT t, char const* val);
  197. LIntExport void F_create_tuple_s_from_utf8(Htuple* H_RESTRICT t,
  198. char const* val);
  199. LIntExport void F_create_tuple_s_from_local8bit(Htuple* H_RESTRICT t,
  200. char const* val);
  201. #ifdef _WIN32
  202. LIntExport void F_create_tuple_s_from_wcs(Htuple* H_RESTRICT t,
  203. wchar_t const* val);
  204. #endif
  205. LIntExport void F_create_tuple_h(Htuple* H_RESTRICT t, Hphandle val);
  206. LIntExport void F_reuse_tuple_i(Htuple* H_RESTRICT t, Hlong val);
  207. LIntExport void F_reuse_tuple_d(Htuple* H_RESTRICT t, double val);
  208. LIntExport void F_reuse_tuple_s(Htuple* H_RESTRICT t,
  209. char const* H_RESTRICT val);
  210. LIntExport void F_reuse_tuple_s_from_utf8(Htuple* H_RESTRICT t,
  211. char const* H_RESTRICT val);
  212. LIntExport void F_reuse_tuple_s_from_local8bit(Htuple* H_RESTRICT t,
  213. char const* H_RESTRICT val);
  214. #ifdef _WIN32
  215. LIntExport void F_reuse_tuple_s_from_wcs(Htuple* H_RESTRICT t,
  216. wchar_t const* H_RESTRICT val);
  217. #endif
  218. LIntExport void F_reuse_tuple_h(Htuple* H_RESTRICT t, Hphandle val);
  219. /* new generic HALCON operator call style:
  220. * - the operator is called by an id that is returned by get_operator_id;
  221. * attention: this id may differ for different HALCON versions
  222. * - the tuple arrays are passed directly to the call -> this method is
  223. * thread safe
  224. *---------------------------------------------------------------------------*/
  225. LIntExport int get_operator_id(char const* name);
  226. LIntExport Herror T_call_halcon_by_id(int id, Hobject const in_objs[],
  227. Hobject out_objs[],
  228. Htuple const in_ctrls[],
  229. Htuple out_ctrls[]);
  230. /* old generic HALCON operator call style (legacy)
  231. * the parameters are set befor calling T_call_halcon with set_*_[t|o]par
  232. * this approach is not thread safe without additional synchronisation
  233. *---------------------------------------------------------------------------*/
  234. LIntExport void set_in_tpar(Htuple* t, int i);
  235. LIntExport void set_out_tpar(Htuple* t, int i);
  236. LIntExport void set_in_opar(Hobject o, int i);
  237. LIntExport void set_out_opar(Hobject* o, int i);
  238. LIntExport Herror T_call_halcon(const char* n);
  239. /* obsolete method, kept inside for compatibility reasons, returns always 0
  240. *---------------------------------------------------------------------------*/
  241. LIntExport Hlong num_tuple(void);
  242. /*
  243. * The following functions can be used to emulate the behavior of
  244. * HDevelop graphics windows for HALCON graphics windows. They are primarily
  245. * intended for usage in C programs exported from HDevelop programs containing
  246. * HDevelop window operators (e.g. dev_set_window, dev_open_window,
  247. * dev_close_window...). On multithreaded systems, every thread has its own
  248. * graphics windows stack.
  249. *---------------------------------------------------------------------------*/
  250. LIntExport void hdev_window_stack_push(const Htuple win_handle);
  251. LIntExport void hdev_window_stack_pop(Htuple* win_handle);
  252. LIntExport void hdev_window_stack_get_active(Htuple* win_handle);
  253. LIntExport void hdev_window_stack_set_active(const Htuple win_handle);
  254. LIntExport int hdev_window_stack_is_open(void);
  255. LIntExport void hdev_window_stack_close_all(void);
  256. /*
  257. * The following functions are kept for downward compatibility only.
  258. * DO NOT USE !!!
  259. * Use the hdev_window_stack_... functions instead !
  260. *---------------------------------------------------------------------------*/
  261. LIntExport void window_stack_push(Hlong win_handle);
  262. LIntExport Hlong window_stack_pop(void);
  263. LIntExport Hlong window_stack_get_active(void);
  264. LIntExport void window_stack_set_active(Hlong win_handle);
  265. LIntExport int window_stack_is_open(void);
  266. LIntExport void window_stack_close_all(void);
  267. /* Used in C programs exported from HDevelop */
  268. LIntExport Herror replace_elements(Htuple* htuple, Htuple* index,
  269. Htuple const* replace_val);
  270. #if defined(__cplusplus)
  271. }
  272. #endif
  273. #if !defined(H_NO_INLINE) && !defined(H_INLINE)
  274. # define H_NO_INLINE
  275. #endif
  276. /*
  277. * Short versions for the tuple operators
  278. */
  279. #ifndef HC_HIDE_SHORT_VERSIONS
  280. #define CT(TUP,LEN) create_tuple(TUP,LEN)
  281. #define CPT(TUP,Out) copy_tuple(TUP,Out)
  282. #define RT(TUP,LEN) resize_tuple(TUP,LEN)
  283. #define DT(TUP) destroy_tuple(TUP)
  284. #define LT(TUP) length_tuple(TUP)
  285. #define SS(TUP,VAL,IDX) set_s(TUP,VAL,IDX)
  286. #define SS_U8(TUP,VAL,IDX) set_s_from_utf8(TUP,VAL,IDX)
  287. #define SS_LOC(TUP,VAL,IDX) set_s_from_local8bit(TUP,VAL,IDX)
  288. #ifdef _WIN32
  289. #define SS_W(TUP,VAL,IDX) set_s_from_wcs(TUP,VAL,IDX)
  290. #endif
  291. #define SI(TUP,VAL,IDX) set_i(TUP,VAL,IDX)
  292. #define SD(TUP,VAL,IDX) set_d(TUP,VAL,IDX)
  293. #define SH(TUP,VAL,IDX) set_h(TUP,VAL,IDX)
  294. #define GS(TUP,IDX) get_s(TUP,IDX)
  295. #define GS_U8(BUF,SIZE,TUP,IDX) get_s_to_utf8(BUF,SIZE,TUP,IDX)
  296. #define GS_LOC(BUF,SIZE,TUP,IDX) get_s_to_local8bit(BUF,SIZE,TUP,IDX)
  297. #ifdef _WIN32
  298. #define GS_W(BUF,SIZE,TUP,IDX) get_s_to_wcs(BUF,SIZE,TUP,IDX)
  299. #endif
  300. #define GI(TUP,IDX) get_i(TUP,IDX)
  301. #define GD(TUP,IDX) get_d(TUP,IDX)
  302. #define GH(TUP,IDX) get_h(TUP,IDX)
  303. #define GT(TUP,IDX) get_type(TUP,IDX)
  304. #define TC(PROC_NAME) T_call_halcon(PROC_NAME)
  305. #define IT(TUP,NUM) set_in_tpar(&(TUP),NUM)
  306. #define OT(TUP,NUM) set_out_tpar(TUP,NUM)
  307. #define IO(OBJ,NUM) set_in_opar(OBJ,NUM)
  308. #define OO(OBJ,NUM) set_out_opar(OBJ,NUM)
  309. #endif
  310. #ifdef HC_FAST /* Compiler option for tested programs */
  311. # define C_TUPLE_IDX_TYPE(PCTUPLE, IDX) \
  312. ((MIXED_PAR != (PCTUPLE)->type) \
  313. ? (PCTUPLE)->type \
  314. : (IDX < (PCTUPLE)->num) ? (PCTUPLE)->elem.cpar[IDX].type \
  315. : UNDEF_PAR)
  316. # define length_tuple(TUP) ((TUP).num)
  317. # define get_type(TUP, IDX) (C_TUPLE_IDX_TYPE(&(TUP), IDX))
  318. # define create_tuple(TUP, LEN) F_create_tuple(TUP, LEN)
  319. # define create_tuple_type(TUP, LEN, TYP) F_create_tuple_type(TUP, LEN, TYP)
  320. # define destroy_tuple(TUP) F_destroy_tuple(&(TUP))
  321. # define copy_tuple(TUP_I, TUP_O) F_copy_tuple(&(TUP_I), TUP_O)
  322. # define attach_tuple(TUP_S, TUP_D) F_attach_tuple(&(TUP_S), TUP_D)
  323. # define resize_tuple(TUP, LEN) F_resize_tuple(TUP, LEN)
  324. # define create_tuple_i(TUP, VAL) F_create_tuple_i(TUP, VAL)
  325. # define create_tuple_d(TUP, VAL) F_create_tuple_d(TUP, VAL)
  326. # define create_tuple_s(TUP, VAL) F_create_tuple_s(TUP, VAL)
  327. # define create_tuple_s_from_utf8(TUP, VAL) \
  328. F_create_tuple_s_from_utf8(TUP, VAL)
  329. # define create_tuple_s_from_local8bit(TUP, VAL) \
  330. F_create_tuple_s_from_local8bit(TUP, VAL)
  331. # ifdef _WIN32
  332. # define create_tuple_s_from_wcs(TUP, VAL) \
  333. F_create_tuple_s_from_wcs(TUP, VAL)
  334. # endif
  335. # define create_tuple_h(TUP, VAL) F_create_tuple_h(TUP, VAL)
  336. # define reuse_tuple_i(TUP, VAL) F_reuse_tuple_i(TUP, VAL)
  337. # define reuse_tuple_d(TUP, VAL) F_reuse_tuple_d(TUP, VAL)
  338. # define reuse_tuple_s(TUP, VAL) F_reuse_tuple_s(TUP, VAL)
  339. # define reuse_tuple_s_from_utf8(TUP, VAL) F_reuse_tuple_s_from_utf8(TUP, VAL)
  340. # define reuse_tuple_s_from_local8bit(TUP, VAL) \
  341. F_reuse_tuple_s_from_local8bit(TUP, VAL)
  342. # ifdef _WIN32
  343. # define reuse_tuple_s_from_wcs(TUP, VAL) F_reuse_tuple_s_from_wcs(TUP, VAL)
  344. # endif
  345. # define reuse_tuple_h(TUP, VAL) F_reuse_tuple_h(TUP, VAL)
  346. # define init_i(TUP, VAL, IDX) F_init_i(&(TUP), VAL, IDX)
  347. # define init_d(TUP, VAL, IDX) F_init_d(&(TUP), VAL, IDX)
  348. # define init_s(TUP, VAL, IDX) F_init_s(&(TUP), VAL, IDX)
  349. # define init_s_len(TUP, LEN, IDX) F_init_s_len(&(TUP), LEN, IDX)
  350. # define init_s_from_utf8(TUP, VAL, IDX) F_init_s_from_utf8(&(TUP), VAL, IDX)
  351. # define init_s_from_local8bit(TUP, VAL, IDX) \
  352. F_init_s_from_local8bit(&(TUP), VAL, IDX)
  353. # ifdef _WIN32
  354. # define init_s_from_wcs(TUP, VAL, IDX) F_init_s_from_wcs(&(TUP), VAL, IDX)
  355. # endif
  356. # define init_h(TUP, VAL, IDX) F_init_h(&(TUP), VAL, IDX)
  357. # define at_i(TUP, IDX) \
  358. ((LONG_PAR == (TUP).type) ? (TUP).elem.l[IDX] \
  359. : (TUP).elem.cpar[IDX].par.l /*MIXED_PAR*/)
  360. # define at_d(TUP, IDX) \
  361. ((DOUBLE_PAR == (TUP).type) ? (TUP).elem.f[IDX] \
  362. : (TUP).elem.cpar[IDX].par.f /*MIXED_PAR*/)
  363. # define at_s(TUP, IDX) \
  364. ((char const*const)((STRING_PAR == (TUP).type) \
  365. ? (TUP).elem.s[IDX] \
  366. : (TUP).elem.cpar[IDX].par.s /*MIXED_PAR*/)
  367. # define at_h(TUP, IDX) \
  368. ((char const*const)((HANDLE_PAR == (TUP).type) \
  369. ? (TUP).elem.h[IDX] \
  370. : (TUP).elem.cpar[IDX].par.h /*MIXED_PAR*/)
  371. # define set_i(TUP, VAL, IDX) F_set_i(&(TUP), VAL, IDX)
  372. # define set_d(TUP, VAL, IDX) F_set_d(&(TUP), VAL, IDX)
  373. # define set_s(TUP, VAL, IDX) F_set_s(&(TUP), VAL, IDX)
  374. # define set_s_from_utf8(TUP, VAL, IDX) F_set_s_from_utf8(&(TUP), VAL, IDX)
  375. # define set_s_from_local8bit(TUP, VAL, IDX) \
  376. F_set_s_from_local8bit(&(TUP), VAL, IDX)
  377. # ifdef _WIN32
  378. # define set_s_from_wcs(TUP, VAL, IDX) F_set_s_from_wcs(&(TUP), VAL, IDX)
  379. # endif
  380. # define set_h(TUP, VAL, IDX) F_set_h(&(TUP), VAL, IDX)
  381. # define get_i(TUP, IDX) F_get_i(&(TUP), IDX)
  382. # define get_d(TUP, IDX) F_get_d(&(TUP), IDX)
  383. # define get_s(TUP, IDX) F_get_s(&(TUP), IDX)
  384. # define get_s_to_utf8(BUF, SIZE, TUP, IDX) \
  385. F_get_s_to_utf8(BUF, SIZE, &(TUP), IDX)
  386. # define get_s_to_local8bit(BUF, SIZE, TUP, IDX) \
  387. F_get_s_to_local8bit(BUF, SIZE, &(TUP), IDX)
  388. # ifdef _WIN32
  389. # define get_s_to_wcs(BUF, SIZE, TUP, IDX) \
  390. F_get_to_wcs(BUF, SIZE, &(TUP), IDX)
  391. # endif
  392. # define get_h(TUP, IDX) F_get_h(&(TUP), IDX)
  393. #else /* := #ifndef HC_FAST -> paranoiac version */
  394. # define create_tuple(TUP, LEN) Mcreate_tuple(TUP, LEN, __FILE__, __LINE__)
  395. # define create_tuple_type(TUP, LEN, TYP) \
  396. Mcreate_tuple_type(TUP, LEN, TYP, __FILE__, __LINE__)
  397. # define destroy_tuple(TUP) Mdestroy_tuple(&(TUP), __FILE__, __LINE__)
  398. # define copy_tuple(TUP_I, TUP_O) \
  399. Mcopy_tuple(&(TUP_I), TUP_O, __FILE__, __LINE__)
  400. # define attach_tuple(TUP_S, TUP_D) \
  401. Mattach_tuple(&(TUP_S), TUP_D, __FILE__, __LINE__)
  402. # define resize_tuple(TUP, LEN) Mresize_tuple(TUP, LEN, __FILE__, __LINE__)
  403. # define length_tuple(TUP) Mlength_tuple(&(TUP), __FILE__, __LINE__)
  404. # define get_type(TUP, IDX) Mget_type(&(TUP), IDX, __FILE__, __LINE__)
  405. # define init_i(TUP, VAL, IDX) Mset_i(&(TUP), VAL, IDX, __FILE__, __LINE__)
  406. # define init_d(TUP, VAL, IDX) Mset_d(&(TUP), VAL, IDX, __FILE__, __LINE__)
  407. # define init_s(TUP, VAL, IDX) Mset_s(&(TUP), VAL, IDX, __FILE__, __LINE__)
  408. # define init_s_len(TUP, LEN, IDX) \
  409. Mset_s_len(&(TUP), LEN, IDX, __FILE__, __LINE__)
  410. # define init_s_from_utf8(TUP, VAL, IDX) \
  411. Minit_s_from_utf8(&(TUP), VAL, IDX, __FILE__, __LINE__)
  412. # define init_s_from_local8bit(TUP, VAL, IDX) \
  413. Minit_s_from_local8bit(&(TUP), VAL, IDX, __FILE__, __LINE__)
  414. # ifdef _WIN32
  415. # define init_s_from_wcs(TUP, VAL, IDX) \
  416. Minit_s_from_wcs(&(TUP), VAL, IDX, __FILE__, __LINE__)
  417. # endif
  418. # define init_h(TUP, VAL, IDX) Mset_h(&(TUP), VAL, IDX, __FILE__, __LINE__)
  419. # define set_i(TUP, VAL, IDX) Mset_i(&(TUP), VAL, IDX, __FILE__, __LINE__)
  420. # define set_d(TUP, VAL, IDX) Mset_d(&(TUP), VAL, IDX, __FILE__, __LINE__)
  421. # define set_s(TUP, VAL, IDX) Mset_s(&(TUP), VAL, IDX, __FILE__, __LINE__)
  422. # define set_s_from_utf8(TUP, VAL, IDX) \
  423. Mset_s_from_utf8(&(TUP), VAL, IDX, __FILE__, __LINE__)
  424. # define set_s_from_local8bit(TUP, VAL, IDX) \
  425. Mset_s_from_local8bit(&(TUP), VAL, IDX, __FILE__, __LINE__)
  426. # ifdef _WIN32
  427. # define set_s_from_wcs(TUP, VAL, IDX) \
  428. Mset_s_from_wcs(&(TUP), VAL, IDX, __FILE__, __LINE__)
  429. # endif
  430. # define set_h(TUP, VAL, IDX) Mset_h(&(TUP), VAL, IDX, __FILE__, __LINE__)
  431. # define get_i(TUP, IDX) Mget_i(&(TUP), IDX, __FILE__, __LINE__)
  432. # define get_d(TUP, IDX) Mget_d(&(TUP), IDX, __FILE__, __LINE__)
  433. # define get_s(TUP, IDX) Mget_s(&(TUP), IDX, __FILE__, __LINE__)
  434. # define get_h(TUP, IDX) Mget_h(&(TUP), IDX, __FILE__, __LINE__)
  435. # define get_s_to_utf8(BUF, SIZE, TUP, IDX) \
  436. Mget_s_to_utf8(BUF, SIZE, &(TUP), IDX, __FILE__, __LINE__)
  437. # define get_s_to_local8bit(BUF, SIZE, TUP, IDX) \
  438. Mget_s_to_local8bit(BUF, SIZE, &(TUP), IDX, __FILE__, __LINE__)
  439. # ifdef _WIN32
  440. # define get_s_to_wcs(BUF, SIZE, TUP, IDX) \
  441. Mget_s_to_wcs(BUF, SIZE, &(TUP), IDX, __FILE__, __LINE__)
  442. # endif
  443. # define at_i(TUP, IDX) Mget_i(&(TUP), IDX, __FILE__, __LINE__)
  444. # define at_d(TUP, IDX) Mget_d(&(TUP), IDX, __FILE__, __LINE__)
  445. # define at_s(TUP, IDX) Mget_s(&(TUP), IDX, __FILE__, __LINE__)
  446. # define at_h(TUP, IDX) Mget_h(&(TUP), IDX, __FILE__, __LINE__)
  447. # define create_tuple_i(TUP, VAL) \
  448. Mcreate_tuple_i(TUP, VAL, __FILE__, __LINE__)
  449. # define create_tuple_d(TUP, VAL) \
  450. Mcreate_tuple_d(TUP, VAL, __FILE__, __LINE__)
  451. # define create_tuple_s(TUP, VAL) \
  452. Mcreate_tuple_s(TUP, VAL, __FILE__, __LINE__)
  453. # define create_tuple_h(TUP, VAL) \
  454. Mcreate_tuple_h(TUP, VAL, __FILE__, __LINE__)
  455. # define create_tuple_s_from_utf8(TUP, VAL) \
  456. Mcreate_tuple_s_from_utf8(TUP, VAL, __FILE__, __LINE__)
  457. # define create_tuple_s_from_local8bit(TUP, VAL) \
  458. Mcreate_tuple_s_from_local8bit(TUP, VAL, __FILE__, __LINE__)
  459. # ifdef _WIN32
  460. # define create_tuple_s_from_wcs(TUP, VAL) \
  461. Mcreate_tuple_s_from_wcs(TUP, VAL, __FILE__, __LINE__)
  462. # endif
  463. # define reuse_tuple_i(TUP, VAL) Mreuse_tuple_i(TUP, VAL, __FILE__, __LINE__)
  464. # define reuse_tuple_d(TUP, VAL) Mreuse_tuple_d(TUP, VAL, __FILE__, __LINE__)
  465. # define reuse_tuple_s(TUP, VAL) Mreuse_tuple_s(TUP, VAL, __FILE__, __LINE__)
  466. # define reuse_tuple_h(TUP, VAL) Mreuse_tuple_h(TUP, VAL, __FILE__, __LINE__)
  467. # define reuse_tuple_s_from_utf8(TUP, VAL) \
  468. Mreuse_tuple_s_from_utf8(TUP, VAL, __FILE__, __LINE__)
  469. # define reuse_tuple_s_from_local8bit(TUP, VAL) \
  470. Mreuse_tuple_s_from_local8bit(TUP, VAL, __FILE__, __LINE__)
  471. # ifdef _WIN32
  472. # define reuse_tuple_s_from_wcs(TUP, VAL) \
  473. Mreuse_tuple_s_from_wcs(TUP, VAL, __FILE__, __LINE__)
  474. # endif
  475. #endif /* ifdef HC_FAST .. else */
  476. #endif