Debian Codegraph @

test/assets/cproc-trace/4.17-vint

raw
1 /* ---------------------------------------------------------------------- */
2
3 #define ns__aproc0 "::aproc"
4
5 #ifndef CRITCL_variadic_int
6 #define CRITCL_variadic_int
7
8 /* NOTE: Array 'v' is allocated on the heap. The argument
9 // release code is used to free it after the worker
10 // function returned. Depending on type and what is done
11 // by the worker it may have to make copies of the data.
12 */
13
14 typedef struct critcl_variadic_int {
15 Tcl_Obj** o; /* Original object array */
16 int c; /* Element count */
17 int* v; /* Allocated array of the elements */
18 } critcl_variadic_int;
19
20 static int
21 _critcl_variadic_int_item (Tcl_Interp* interp, Tcl_Obj* src, int* dst) {
22 {
23 if (Tcl_GetIntFromObj(interp, src, dst) != TCL_OK) return TCL_ERROR; }
24 return TCL_OK;
25 }
26
27 #endif /* CRITCL_variadic_int _________ */
28
29 static void c__aproc0(critcl_variadic_int args)
30 {
31
32 }
33
34 static int
35 tcl__aproc0(ClientData cd, Tcl_Interp *interp, Tcl_Size oc, Tcl_Obj *CONST ov[])
36 {
37 critcl_variadic_int _args;
38
39 critcl_trace_cmd_args (ns__aproc0, oc, ov);
40 /* (int args, ...) - - -- --- ----- -------- */
41 {
42 int src, dst, leftovers = (oc-1);
43 _args.c = leftovers;
44 _args.v = (int*) ((!leftovers) ? 0 : ckalloc (leftovers * sizeof (int)));
45 _args.o = (Tcl_Obj**) &ov[1];
46 for (src = 1, dst = 0; leftovers > 0; dst++, src++, leftovers--) {
47 if (_critcl_variadic_int_item (interp, ov[src], &(_args.v[dst])) != TCL_OK) {
48 ckfree ((char*) _args.v); /* Cleanup partial work */
49 return critcl_trace_cmd_result (TCL_ERROR, interp);
50 }
51 } }
52
53 /* Call - - -- --- ----- -------- */
54 c__aproc0(_args);
55
56 /* (Release: int args, ...) - - -- --- ----- -------- */
57 if (_args.c) { ckfree ((char*) _args.v); }
58
59 /* (void return) - - -- --- ----- -------- */
60 return critcl_trace_cmd_result (TCL_OK, interp);
61 }