HalconCDefs.h 26 KB

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