call2.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /**
  2. * @file call2.c
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. Neither the name of the author nor the
  15. * names of its contributors may be used to endorse or promote products
  16. * derived from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  19. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  22. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  27. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *
  29. * @section DESCRIPTION
  30. *
  31. *
  32. * Synopsis:
  33. * call(string template, list args)
  34. *
  35. * Description:
  36. * Calls a process template. The 'template' argument is the name of the process
  37. * template to call, and the 'list' argument is a list of arguments for the
  38. * process template. Calling a process template is roughly equivalent to placing
  39. * the statements within that template into the place of call(), except for the
  40. * points presented next. The 'template' argument can be a special value "<none>",
  41. * which makes call() a no-op.
  42. *
  43. * The process created from the called template will be able to access the arguments
  44. * that were given in the 'args' argument to call() via the '_argN' predefined\
  45. * objects (e.g. _arg0 for the first argumens), and also via '_args' for the entire
  46. * argument list.
  47. *
  48. * The called process also will be able to access objects within the calling
  49. * process as seen by the call() statement. However such any access needs to happen
  50. * via a special '_caller' predefined object. For example, if there is a statement
  51. * 'var("a") x;' somewhere above the call() statement, the called process can access
  52. * it as '_caller.x'.
  53. *
  54. * Note that call() preserves backtracking semantics, i.e. when a statement within
  55. * the called process goes down after having gone up, the behaviour really is as
  56. * if the call() statement was replaced with the statements in the called template,
  57. * (disregarding variable resolution).
  58. *
  59. * Because the template name is an argument, call() can be used for branching.
  60. * For example, if we have an object 'x' with the value "true" or "false", a
  61. * branch can be performed by defining two process templates, 'branch_true'
  62. * and 'branch_false', and branching with the following code:
  63. *
  64. * concat("branch_", x) name;
  65. * call(name, {});
  66. *
  67. *
  68. * Synopsis:
  69. * call_with_caller_target(string template, list args, string caller_target)
  70. *
  71. * Description:
  72. * Like call(), except that the target of the '_caller' predefined object is
  73. * specified by the 'caller_target' argument. This is indented to be used from
  74. * generic code for user-specified callbacks, allowing the user to easily refer to
  75. * his own objects from inside the callback.
  76. *
  77. * The 'caller_target' must be a non-empty string referring to an actual object;
  78. * there is no choice of 'caller_target' that would make call_with_caller_target()
  79. * equivalent to call().
  80. *
  81. *
  82. * Synopsis:
  83. * embcall2_multif(string cond1, string template1, ..., [string else_template])
  84. *
  85. * Description:
  86. * This is an internal command used to implement the 'If' clause. The arguments
  87. * are pairs of (cond, template), where 'cond' is a condition in form of a string,
  88. * and 'template' is the name of the process template for this condition. The
  89. * template corresponding to the first condition equal to "true" is called; if
  90. * there is no true condition, either the template 'else_template' is called,
  91. * if it is provided, or nothing is performed, if 'else_template' is not provided.
  92. *
  93. *
  94. * Synopsis:
  95. * inline_code(string template)
  96. * inline_code::call(list args)
  97. *
  98. * Description:
  99. * The inline_code() acts as a proxy object for calling the specified template.
  100. * The inline_code::call calls the template of the corresponding inline_code
  101. * instance, in a manner similar to a simple "call". The called template will
  102. * have access to the following resources:
  103. * - The arguments will be available in the usual fashion.
  104. * - The scope of the inline_code::call instance will be available as "_caller".
  105. * - The scope of the inline_code instance will be directly available.
  106. * - The scope of the inline_code instance will also be available as "_scope".
  107. * This is useful to access shadowed names, e.g. "_caller" and the arguments
  108. * stuff (_argN, _args).
  109. */
  110. #include <stdlib.h>
  111. #include <string.h>
  112. #include <misc/debug.h>
  113. #include <misc/offset.h>
  114. #include <structure/LinkedList0.h>
  115. #include <ncd/module_common.h>
  116. #include <generated/blog_channel_ncd_call2.h>
  117. #define STATE_WORKING 1
  118. #define STATE_UP 2
  119. #define STATE_WAITING 3
  120. #define STATE_TERMINATING 4
  121. #define STATE_NONE 5
  122. #define NUM_STATIC_NAMES 4
  123. struct instance;
  124. typedef void (*call_extra_free_cb) (struct instance *o);
  125. struct instance {
  126. NCDModuleInst *i;
  127. call_extra_free_cb extra_free_cb;
  128. NCDModuleProcess process;
  129. int state;
  130. };
  131. struct instance_with_caller_target {
  132. struct instance base;
  133. NCD_string_id_t *dynamic_names;
  134. size_t num_names;
  135. NCD_string_id_t static_names[NUM_STATIC_NAMES];
  136. };
  137. struct inline_code {
  138. NCDModuleInst *i;
  139. NCDValRef template_name;
  140. LinkedList0 calls_list;
  141. };
  142. struct inline_code_call {
  143. struct instance base;
  144. struct inline_code *ic;
  145. LinkedList0Node ic_node;
  146. };
  147. #define NAMES_PARAM_NAME CallNames
  148. #define NAMES_PARAM_TYPE struct instance_with_caller_target
  149. #define NAMES_PARAM_MEMBER_DYNAMIC_NAMES dynamic_names
  150. #define NAMES_PARAM_MEMBER_STATIC_NAMES static_names
  151. #define NAMES_PARAM_MEMBER_NUM_NAMES num_names
  152. #define NAMES_PARAM_NUM_STATIC_NAMES NUM_STATIC_NAMES
  153. #include <ncd/extra/make_fast_names.h>
  154. static void process_handler_event (NCDModuleProcess *process, int event);
  155. static int process_func_getspecialobj_embed (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object);
  156. static int process_func_getspecialobj_noembed (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object);
  157. static int process_func_getspecialobj_with_caller_target (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object);
  158. static int caller_obj_func_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object);
  159. static int caller_obj_func_getobj_with_caller_target (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object);
  160. static void func_new_templ (void *vo, NCDModuleInst *i, NCDValRef template_name, NCDValRef args, NCDModuleProcess_func_getspecialobj func_getspecialobj, call_extra_free_cb extra_free_cb);
  161. static void instance_free (struct instance *o);
  162. static void call_with_caller_target_extra_free (struct instance *bo);
  163. static void inline_code_extra_free (struct instance *bo);
  164. static int inline_code_call_process_getspecialobj (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object);
  165. static int inline_code_scope_obj_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object);
  166. static void process_handler_event (NCDModuleProcess *process, int event)
  167. {
  168. struct instance *o = UPPER_OBJECT(process, struct instance, process);
  169. switch (event) {
  170. case NCDMODULEPROCESS_EVENT_UP: {
  171. ASSERT(o->state == STATE_WORKING)
  172. // signal up
  173. NCDModuleInst_Backend_Up(o->i);
  174. // set state up
  175. o->state = STATE_UP;
  176. } break;
  177. case NCDMODULEPROCESS_EVENT_DOWN: {
  178. ASSERT(o->state == STATE_UP)
  179. // signal down
  180. NCDModuleInst_Backend_Down(o->i);
  181. // set state waiting
  182. o->state = STATE_WAITING;
  183. } break;
  184. case NCDMODULEPROCESS_EVENT_TERMINATED: {
  185. ASSERT(o->state == STATE_TERMINATING)
  186. // die finally
  187. instance_free(o);
  188. return;
  189. } break;
  190. default: ASSERT(0);
  191. }
  192. }
  193. static int process_func_getspecialobj_embed (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object)
  194. {
  195. struct instance *o = UPPER_OBJECT(process, struct instance, process);
  196. return NCDModuleInst_Backend_GetObj(o->i, name, out_object);
  197. }
  198. static int process_func_getspecialobj_noembed (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object)
  199. {
  200. struct instance *o = UPPER_OBJECT(process, struct instance, process);
  201. if (name == NCD_STRING_CALLER) {
  202. *out_object = NCDObject_Build(-1, o, NCDObject_no_getvar, caller_obj_func_getobj);
  203. return 1;
  204. }
  205. return 0;
  206. }
  207. static int process_func_getspecialobj_with_caller_target (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object)
  208. {
  209. struct instance *o = UPPER_OBJECT(process, struct instance, process);
  210. if (name == NCD_STRING_CALLER) {
  211. *out_object = NCDObject_Build(-1, o, NCDObject_no_getvar, caller_obj_func_getobj_with_caller_target);
  212. return 1;
  213. }
  214. return 0;
  215. }
  216. static int caller_obj_func_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object)
  217. {
  218. struct instance *o = NCDObject_DataPtr(obj);
  219. return NCDModuleInst_Backend_GetObj(o->i, name, out_object);
  220. }
  221. static int caller_obj_func_getobj_with_caller_target (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object)
  222. {
  223. struct instance_with_caller_target *o_ch = NCDObject_DataPtr(obj);
  224. ASSERT(o_ch->num_names > 0)
  225. NCD_string_id_t *names = CallNames_GetNames(o_ch);
  226. NCDObject object;
  227. if (!NCDModuleInst_Backend_GetObj(o_ch->base.i, names[0], &object)) {
  228. return 0;
  229. }
  230. NCDObject obj2;
  231. if (!NCDObject_ResolveObjExprCompact(&object, names + 1, o_ch->num_names - 1, &obj2)) {
  232. return 0;
  233. }
  234. if (name == NCD_STRING_EMPTY) {
  235. *out_object = obj2;
  236. return 1;
  237. }
  238. return NCDObject_GetObj(&obj2, name, out_object);
  239. }
  240. static void func_new_templ (void *vo, NCDModuleInst *i, NCDValRef template_name, NCDValRef args, NCDModuleProcess_func_getspecialobj func_getspecialobj, call_extra_free_cb extra_free_cb)
  241. {
  242. ASSERT(NCDVal_IsInvalid(template_name) || NCDVal_IsString(template_name))
  243. ASSERT(NCDVal_IsInvalid(args) || NCDVal_IsList(args))
  244. ASSERT(func_getspecialobj)
  245. struct instance *o = vo;
  246. o->i = i;
  247. o->extra_free_cb = extra_free_cb;
  248. if (NCDVal_IsInvalid(template_name) || ncd_is_none(template_name)) {
  249. // signal up
  250. NCDModuleInst_Backend_Up(o->i);
  251. // set state none
  252. o->state = STATE_NONE;
  253. } else {
  254. // create process
  255. if (!NCDModuleProcess_InitValue(&o->process, o->i, template_name, args, process_handler_event)) {
  256. ModuleLog(o->i, BLOG_ERROR, "NCDModuleProcess_Init failed");
  257. goto fail1;
  258. }
  259. // set special functions
  260. NCDModuleProcess_SetSpecialFuncs(&o->process, func_getspecialobj);
  261. // set state working
  262. o->state = STATE_WORKING;
  263. }
  264. return;
  265. fail1:
  266. if (o->extra_free_cb) {
  267. o->extra_free_cb(o);
  268. }
  269. NCDModuleInst_Backend_DeadError(i);
  270. }
  271. static void instance_free (struct instance *o)
  272. {
  273. if (o->extra_free_cb) {
  274. o->extra_free_cb(o);
  275. }
  276. // free process
  277. if (o->state != STATE_NONE) {
  278. NCDModuleProcess_Free(&o->process);
  279. }
  280. NCDModuleInst_Backend_Dead(o->i);
  281. }
  282. static void func_new_call (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
  283. {
  284. NCDValRef template_arg;
  285. NCDValRef args_arg;
  286. if (!NCDVal_ListRead(params->args, 2, &template_arg, &args_arg)) {
  287. ModuleLog(i, BLOG_ERROR, "wrong arity");
  288. goto fail0;
  289. }
  290. if (!NCDVal_IsString(template_arg) || !NCDVal_IsList(args_arg)) {
  291. ModuleLog(i, BLOG_ERROR, "wrong type");
  292. goto fail0;
  293. }
  294. func_new_templ(vo, i, template_arg, args_arg, process_func_getspecialobj_noembed, NULL);
  295. return;
  296. fail0:
  297. NCDModuleInst_Backend_DeadError(i);
  298. }
  299. static void func_new_call_with_caller_target (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
  300. {
  301. NCDValRef template_arg;
  302. NCDValRef args_arg;
  303. NCDValRef caller_target_arg;
  304. if (!NCDVal_ListRead(params->args, 3, &template_arg, &args_arg, &caller_target_arg)) {
  305. ModuleLog(i, BLOG_ERROR, "wrong arity");
  306. goto fail0;
  307. }
  308. if (!NCDVal_IsString(template_arg) || !NCDVal_IsList(args_arg) || !NCDVal_IsString(caller_target_arg)) {
  309. ModuleLog(i, BLOG_ERROR, "wrong type");
  310. goto fail0;
  311. }
  312. NCDValContString cts;
  313. if (!NCDVal_StringContinuize(caller_target_arg, &cts)) {
  314. ModuleLog(i, BLOG_ERROR, "NCDVal_StringContinuize failed");
  315. goto fail0;
  316. }
  317. struct instance_with_caller_target *o = vo;
  318. int res = CallNames_InitNames(o, i->params->iparams->string_index, cts.data, NCDVal_StringLength(caller_target_arg));
  319. NCDValContString_Free(&cts);
  320. if (!res) {
  321. ModuleLog(i, BLOG_ERROR, "CallerNames_InitNames failed");
  322. goto fail0;
  323. }
  324. func_new_templ(vo, i, template_arg, args_arg, process_func_getspecialobj_with_caller_target, call_with_caller_target_extra_free);
  325. return;
  326. fail0:
  327. NCDModuleInst_Backend_DeadError(i);
  328. }
  329. static void call_with_caller_target_extra_free (struct instance *bo)
  330. {
  331. struct instance_with_caller_target *o = (void *)bo;
  332. CallNames_FreeNames(o);
  333. }
  334. static void func_new_embcall_multif (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
  335. {
  336. NCDValRef args = params->args;
  337. NCDValRef template_value = NCDVal_NewInvalid();
  338. size_t count = NCDVal_ListCount(args);
  339. size_t j = 0;
  340. while (j < count) {
  341. NCDValRef arg = NCDVal_ListGet(args, j);
  342. if (j == count - 1) {
  343. if (!NCDVal_IsString(arg)) {
  344. ModuleLog(i, BLOG_ERROR, "bad arguments");
  345. goto fail0;
  346. }
  347. template_value = arg;
  348. break;
  349. }
  350. NCDValRef arg2 = NCDVal_ListGet(args, j + 1);
  351. int arg_val;
  352. if (!ncd_read_boolean(arg, &arg_val) || !NCDVal_IsString(arg2)) {
  353. ModuleLog(i, BLOG_ERROR, "bad arguments");
  354. goto fail0;
  355. }
  356. if (arg_val) {
  357. template_value = arg2;
  358. break;
  359. }
  360. j += 2;
  361. }
  362. func_new_templ(vo, i, template_value, NCDVal_NewInvalid(), process_func_getspecialobj_embed, NULL);
  363. return;
  364. fail0:
  365. NCDModuleInst_Backend_DeadError(i);
  366. }
  367. static void func_die (void *vo)
  368. {
  369. struct instance *o = vo;
  370. ASSERT(o->state != STATE_TERMINATING)
  371. // if none, die now
  372. if (o->state == STATE_NONE) {
  373. instance_free(o);
  374. return;
  375. }
  376. // request process to terminate
  377. NCDModuleProcess_Terminate(&o->process);
  378. // set state terminating
  379. o->state = STATE_TERMINATING;
  380. }
  381. static void func_clean (void *vo)
  382. {
  383. struct instance *o = vo;
  384. if (o->state != STATE_WAITING) {
  385. return;
  386. }
  387. // allow process to continue
  388. NCDModuleProcess_Continue(&o->process);
  389. // set state working
  390. o->state = STATE_WORKING;
  391. }
  392. static int func_getobj (void *vo, NCD_string_id_t name, NCDObject *out_object)
  393. {
  394. struct instance *o = vo;
  395. if (o->state == STATE_NONE) {
  396. return 0;
  397. }
  398. return NCDModuleProcess_GetObj(&o->process, name, out_object);
  399. }
  400. static void inline_code_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
  401. {
  402. NCDValRef template_arg;
  403. if (!NCDVal_ListRead(params->args, 1, &template_arg)) {
  404. ModuleLog(i, BLOG_ERROR, "wrong arity");
  405. goto fail0;
  406. }
  407. if (!NCDVal_IsString(template_arg)) {
  408. ModuleLog(i, BLOG_ERROR, "wrong type");
  409. goto fail0;
  410. }
  411. struct inline_code *o = vo;
  412. o->i = i;
  413. o->template_name = template_arg;
  414. LinkedList0_Init(&o->calls_list);
  415. NCDModuleInst_Backend_Up(i);
  416. return;
  417. fail0:
  418. NCDModuleInst_Backend_DeadError(i);
  419. }
  420. static void inline_code_die (void *vo)
  421. {
  422. struct inline_code *o = vo;
  423. for (LinkedList0Node *ln = LinkedList0_GetFirst(&o->calls_list); ln; ln = LinkedList0Node_Next(ln)) {
  424. struct inline_code_call *call = UPPER_OBJECT(ln, struct inline_code_call, ic_node);
  425. ASSERT(call->ic == o)
  426. call->ic = NULL;
  427. }
  428. NCDModuleInst_Backend_Dead(o->i);
  429. }
  430. static void inline_code_call_new (void *vo, NCDModuleInst *i, const struct NCDModuleInst_new_params *params)
  431. {
  432. NCDValRef args_arg;
  433. if (!NCDVal_ListRead(params->args, 1, &args_arg)) {
  434. ModuleLog(i, BLOG_ERROR, "wrong arity");
  435. goto fail0;
  436. }
  437. if (!NCDVal_IsList(args_arg)) {
  438. ModuleLog(i, BLOG_ERROR, "wrong type");
  439. goto fail0;
  440. }
  441. struct inline_code_call *o = vo;
  442. o->ic = NCDModuleInst_Backend_GetUser((NCDModuleInst *)params->method_user);
  443. LinkedList0_Prepend(&o->ic->calls_list, &o->ic_node);
  444. func_new_templ(vo, i, o->ic->template_name, args_arg, inline_code_call_process_getspecialobj, inline_code_extra_free);
  445. return;
  446. fail0:
  447. NCDModuleInst_Backend_DeadError(i);
  448. }
  449. static void inline_code_extra_free (struct instance *bo)
  450. {
  451. struct inline_code_call *o = (void *)bo;
  452. if (o->ic) {
  453. LinkedList0_Remove(&o->ic->calls_list, &o->ic_node);
  454. }
  455. }
  456. static int inline_code_call_process_getspecialobj (NCDModuleProcess *process, NCD_string_id_t name, NCDObject *out_object)
  457. {
  458. struct inline_code_call *o = UPPER_OBJECT(process, struct inline_code_call, base.process);
  459. if (name == NCD_STRING_CALLER) {
  460. *out_object = NCDObject_Build(-1, o, NCDObject_no_getvar, caller_obj_func_getobj);
  461. return 1;
  462. }
  463. if (!o->ic) {
  464. ModuleLog(o->base.i, BLOG_ERROR, "inline_code object is gone");
  465. return 0;
  466. }
  467. if (name == NCD_STRING_SCOPE) {
  468. *out_object = NCDObject_Build(-1, o->ic, NCDObject_no_getvar, inline_code_scope_obj_getobj);
  469. return 1;
  470. }
  471. return NCDModuleInst_Backend_GetObj(o->ic->i, name, out_object);
  472. }
  473. static int inline_code_scope_obj_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object)
  474. {
  475. struct inline_code *ic = NCDObject_DataPtr(obj);
  476. return NCDModuleInst_Backend_GetObj(ic->i, name, out_object);
  477. }
  478. static struct NCDModule modules[] = {
  479. {
  480. .type = "call",
  481. .func_new2 = func_new_call,
  482. .func_die = func_die,
  483. .func_clean = func_clean,
  484. .func_getobj = func_getobj,
  485. .flags = NCDMODULE_FLAG_CAN_RESOLVE_WHEN_DOWN|NCDMODULE_FLAG_ACCEPT_NON_CONTINUOUS_STRINGS,
  486. .alloc_size = sizeof(struct instance)
  487. }, {
  488. .type = "call_with_caller_target",
  489. .func_new2 = func_new_call_with_caller_target,
  490. .func_die = func_die,
  491. .func_clean = func_clean,
  492. .func_getobj = func_getobj,
  493. .flags = NCDMODULE_FLAG_CAN_RESOLVE_WHEN_DOWN|NCDMODULE_FLAG_ACCEPT_NON_CONTINUOUS_STRINGS,
  494. .alloc_size = sizeof(struct instance_with_caller_target)
  495. }, {
  496. .type = "embcall2_multif",
  497. .func_new2 = func_new_embcall_multif,
  498. .func_die = func_die,
  499. .func_clean = func_clean,
  500. .func_getobj = func_getobj,
  501. .flags = NCDMODULE_FLAG_CAN_RESOLVE_WHEN_DOWN|NCDMODULE_FLAG_ACCEPT_NON_CONTINUOUS_STRINGS,
  502. .alloc_size = sizeof(struct instance)
  503. }, {
  504. .type = "inline_code",
  505. .func_new2 = inline_code_new,
  506. .func_die = inline_code_die,
  507. .alloc_size = sizeof(struct inline_code)
  508. }, {
  509. .type = "inline_code::call",
  510. .func_new2 = inline_code_call_new,
  511. .func_die = func_die,
  512. .func_clean = func_clean,
  513. .func_getobj = func_getobj,
  514. .flags = NCDMODULE_FLAG_CAN_RESOLVE_WHEN_DOWN|NCDMODULE_FLAG_ACCEPT_NON_CONTINUOUS_STRINGS,
  515. .alloc_size = sizeof(struct inline_code_call)
  516. }, {
  517. .type = NULL
  518. }
  519. };
  520. const struct NCDModuleGroup ncdmodule_call2 = {
  521. .modules = modules
  522. };