2 * Lua wrapper for DISLIN
3 * created October 17, 2006 by e
5 * Copyright (c) 2006-7 Doug Currie, Londonderry, NH
8 Permission is hereby granted, free of charge, to any person obtaining a
9 copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, and/or sell copies of the Software, and to permit persons
13 to whom the Software is furnished to do so, provided that the above
14 copyright notice(s) and this permission notice appear in all copies of
15 the Software and that both the above copyright notice(s) and this
16 permission notice appear in supporting documentation.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
21 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22 HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
23 INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
24 FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
25 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
26 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 ************************************************************************/
37 #define DN_VERSION "Lua dislin version " SVN_REVS " for " LUA_VERSION " with DISLIN 9.1"
41 Have l_triang return a userdata with nrti and the three iNrays;
42 then confll, contri, crvtri, and surtri take that userdata as an arg
43 instead of the four separate args; this avoids marshall/unmarshall
44 of the three arrays to/from tables and the extra mallocs.
45 What this loses is the freedom for the user to write TRIANG replacements
46 in Lua, so both version would be needed. So, punt for now.
48 leglin -- check in range
51 static double *magic_doublestar_function_ (lua_State
*L
, int n
, int extra
)
53 /* lua_newuserdata is used so we can just let Lua gc the data
54 // and not worry about freeing it, e.g., in cases of check errors */
59 luaL_checktype (L
, n
, LUA_TTABLE
);
60 k
= lua_objlen (L
, n
);
61 r
= lua_newuserdata (L
, (k
+ extra
) * sizeof(double)); /* will throw error if fails */
62 top
= lua_gettop (L
) + 1; /* + 1 for pushinteger&gettable */
65 lua_pushinteger (L
, i
);
67 r
[i
-1] = luaL_checknumber (L
, top
);
73 static double *magic_doublestar_function (lua_State
*L
, int n
)
75 return magic_doublestar_function_ (L
, n
, 0);
78 static int *magic_intstar_function (lua_State
*L
, int n
)
80 /* lua_newuserdata is used so we can just let Lua gc the data
81 // and not worry about freeing it, e.g., in cases of check errors */
86 luaL_checktype (L
, n
, LUA_TTABLE
);
87 k
= lua_objlen (L
, n
);
88 r
= lua_newuserdata (L
, k
* sizeof(int)); /* will throw error if fails */
89 top
= lua_gettop (L
) + 1; /* + 1 for pushinteger&gettable */
92 lua_pushinteger (L
, i
);
94 r
[i
-1] = luaL_checkint (L
, top
);
100 static long *magic_longstar_function (lua_State
*L
, int n
)
106 luaL_checktype (L
, n
, LUA_TTABLE
);
107 k
= lua_objlen (L
, n
);
108 r
= lua_newuserdata (L
, k
* sizeof(long)); /* will throw error if fails */
109 top
= lua_gettop (L
) + 1; /* + 1 for pushinteger&gettable */
112 lua_pushinteger (L
, i
);
114 r
[i
-1] = luaL_checklong (L
, top
);
121 static short *magic_shortstar_function (lua_State
*L
, int n
)
123 luaL_error (L
, "magic_shortstar_function not implemented yet!");
126 static short *magic_voidstar_function (lua_State
*L
, int n
)
128 luaL_error (L
, "magic_voidstar_function not implemented yet!");
131 static void magic_push_voidstar (lua_State
*L
, double *R
)
133 luaL_error (L
, "magic_push_voidstar not implemented yet!");
137 static void push_double_array_as_table (lua_State
*L
, double *ray
, int n
)
140 lua_createtable (L
, n
, 0);
143 lua_pushnumber (L
, (lua_Number
)ray
[i
]);
145 lua_rawseti (L
, -2, i
);
147 // returns table on Lua stack
150 static void push_int_array_as_table (lua_State
*L
, int *ray
, int n
)
153 lua_createtable (L
, n
, 0);
156 lua_pushinteger (L
, (lua_Integer
)ray
[i
]);
158 lua_rawseti (L
, -2, i
);
160 // returns table on Lua stack
163 /* autogenerated code pasted here... "ldislin.txt.c" */
165 /* ************************************************************************************ */
168 static int l_ ## nm (lua_State *L) { \
169 const char *a1 = luaL_checkstring(L, 1); \
170 const char *a2 = luaL_checkstring(L, 2); \
171 char *r = nm ((char *)a1,(char *)a2); \
172 lua_pushstring (L, r); \
177 static int l_ ## nm (lua_State *L) { \
178 const char *a1 = luaL_checkstring(L, 1); \
179 const char *a2 = luaL_checkstring(L, 2); \
180 const char *a3 = luaL_checkstring(L, 3); \
181 char *r = nm ((char *)a1,(char *)a2,(char *)a3); \
182 lua_pushstring (L, r); \
187 static int l_ ## nm (lua_State *L) { \
188 const char *a1 = luaL_checkstring(L, 1); \
189 lua_Integer a2 = luaL_checkinteger (L, 2); \
190 char *r = nm ((char *)a1,a2); \
191 lua_pushstring (L, r); \
196 static int l_ ## nm (lua_State *L) { \
197 const char *a1 = luaL_checkstring(L, 1); \
198 char *r = nm ((char *)a1); \
199 lua_pushstring (L, r); \
203 static int l_ ## nm (lua_State *L) { \
205 lua_pushstring (L, r); \
209 static int l_ ## nm (lua_State *L) { \
210 lua_Number a1 = luaL_checknumber (L, 1); \
211 double r = nm (a1); \
212 lua_pushnumber (L, r); \
216 static int l_ ## nm (lua_State *L) { \
217 lua_Number a1 = luaL_checknumber (L, 1); \
218 lua_Number a2 = luaL_checknumber (L, 2); \
219 double r = nm (a1,a2); \
220 lua_pushnumber (L, r); \
224 static int l_ ## nm (lua_State *L) { \
225 lua_Number a1 = luaL_checknumber (L, 1); \
226 lua_Number a2 = luaL_checknumber (L, 2); \
227 lua_Number a3 = luaL_checknumber (L, 3); \
228 double r = nm (a1,a2,a3); \
229 lua_pushnumber (L, r); \
233 static int l_ ## nm (lua_State *L) { \
234 lua_Integer a1 = luaL_checkinteger (L, 1); \
235 double r = nm (a1); \
236 lua_pushnumber (L, r); \
240 static int l_ ## nm (lua_State *L) { \
242 lua_pushnumber (L, r); \
246 static int l_ ## nm (lua_State *L) { \
249 int r = nm (&a1,&a2); \
250 lua_pushinteger (L, r); \
251 lua_pushinteger (L, a1); \
252 lua_pushinteger (L, a2); \
256 static int l_ ## nm (lua_State *L) { \
257 const char *a1 = luaL_checkstring(L, 1); \
258 int r = nm ((char *)a1); \
259 lua_pushinteger (L, r); \
263 static int l_ ## nm (lua_State *L) { \
264 const char *a1 = luaL_checkstring(L, 1); \
265 char a2[4] = {0,0,0,0}; \
266 char a3[4] = {0,0,0,0}; \
267 int r = nm ((char *)a1,a2,a3); \
268 lua_pushinteger (L, r); \
269 lua_pushstring (L, a2); \
270 lua_pushstring (L, a3); \
274 static int l_ ## nm (lua_State *L) { \
275 const char *a1 = luaL_checkstring(L, 1); \
276 const char *a2 = luaL_checkstring(L, 2); \
277 lua_Integer a3 = luaL_checkinteger (L, 3); \
278 int r = nm ((char *)a1,(char *)a2,a3); \
279 lua_pushinteger (L, r); \
283 static int l_ ## nm (lua_State *L) { \
284 const char *a1 = luaL_checkstring(L, 1); \
285 lua_Integer a2 = luaL_checkinteger (L, 2); \
286 int r = nm ((char *)a1,a2); \
287 lua_pushinteger (L, r); \
291 static int l_ ## nm (lua_State *L) { \
292 lua_Number a1 = luaL_checknumber (L, 1); \
294 lua_pushinteger (L, r); \
298 static int l_ ## nm (lua_State *L) { \
299 lua_Number a1 = luaL_checknumber (L, 1); \
300 lua_Number a2 = luaL_checknumber (L, 2); \
301 lua_Number a3 = luaL_checknumber (L, 3); \
302 int r = nm (a1,a2,a3); \
303 lua_pushinteger (L, r); \
306 #define i_dddddd(nm) \
307 static int l_ ## nm (lua_State *L) { \
308 lua_Number a1 = luaL_checknumber (L, 1); \
309 lua_Number a2 = luaL_checknumber (L, 2); \
310 lua_Number a3 = luaL_checknumber (L, 3); \
311 lua_Number a4 = luaL_checknumber (L, 4); \
312 lua_Number a5 = luaL_checknumber (L, 5); \
313 lua_Number a6 = luaL_checknumber (L, 6); \
314 int r = nm (a1,a2,a3,a4,a5,a6); \
315 lua_pushinteger (L, r); \
319 static int l_ ## nm (lua_State *L) { \
320 lua_Number a1 = luaL_checknumber (L, 1); \
321 lua_Integer a2 = luaL_checkinteger (L, 2); \
322 int r = nm (a1,a2); \
323 lua_pushinteger (L, r); \
327 static int l_ ## nm (lua_State *L) { \
328 lua_Integer a1 = luaL_checkinteger (L, 1); \
330 lua_pushinteger (L, r); \
334 static int l_ ## nm (lua_State *L) { \
335 lua_Integer a1 = luaL_checkinteger (L, 1); \
336 const char *a2 = luaL_checkstring(L, 2); \
337 int r = nm (a1,(char *)a2); \
338 lua_pushinteger (L, r); \
342 static int l_ ## nm (lua_State *L) { \
343 lua_Integer a1 = luaL_checkinteger (L, 1); \
344 const char *a2 = luaL_checkstring(L, 2); \
345 const char *a3 = luaL_checkstring(L, 3); \
346 int r = nm (a1,(char *)a2,(char *)a3); \
347 lua_pushinteger (L, r); \
351 static int l_ ## nm (lua_State *L) { \
352 lua_Integer a1 = luaL_checkinteger (L, 1); \
353 const char *a2 = luaL_checkstring(L, 2); \
354 const char *a3 = luaL_checkstring(L, 3); \
355 const char *a4 = luaL_checkstring(L, 4); \
356 int r = nm (a1,(char *)a2,(char *)a3,(char *)a4); \
357 lua_pushinteger (L, r); \
361 static int l_ ## nm (lua_State *L) { \
362 lua_Integer a1 = luaL_checkinteger (L, 1); \
363 const char *a2 = luaL_checkstring(L, 2); \
364 const char *a3 = luaL_checkstring(L, 3); \
365 lua_Integer a4 = luaL_checkinteger (L, 4); \
366 int r = nm (a1,(char *)a2,(char *)a3,a4); \
367 lua_pushinteger (L, r); \
370 #define i_iKdddi(nm) \
371 static int l_ ## nm (lua_State *L) { \
372 lua_Integer a1 = luaL_checkinteger (L, 1); \
373 const char *a2 = luaL_checkstring(L, 2); \
374 lua_Number a3 = luaL_checknumber (L, 3); \
375 lua_Number a4 = luaL_checknumber (L, 4); \
376 lua_Number a5 = luaL_checknumber (L, 5); \
377 lua_Integer a6 = luaL_checkinteger (L, 6); \
378 int r = nm (a1,(char *)a2,a3,a4,a5,a6); \
379 lua_pushinteger (L, r); \
383 static int l_ ## nm (lua_State *L) { \
384 lua_Integer a1 = luaL_checkinteger (L, 1); \
385 const char *a2 = luaL_checkstring(L, 2); \
386 lua_Integer a3 = luaL_checkinteger (L, 3); \
387 int r = nm (a1,(char *)a2,a3); \
388 lua_pushinteger (L, r); \
392 static int l_ ## nm (lua_State *L) { \
393 lua_Integer a1 = luaL_checkinteger (L, 1); \
394 lua_Integer a2 = luaL_checkinteger (L, 2); \
395 lua_Integer a3 = luaL_checkinteger (L, 3); \
396 int r = nm (a1,a2,a3); \
397 lua_pushinteger (L, r); \
400 #define i_iiiii(nm) \
401 static int l_ ## nm (lua_State *L) { \
402 lua_Integer a1 = luaL_checkinteger (L, 1); \
403 lua_Integer a2 = luaL_checkinteger (L, 2); \
404 lua_Integer a3 = luaL_checkinteger (L, 3); \
405 lua_Integer a4 = luaL_checkinteger (L, 4); \
406 lua_Integer a5 = luaL_checkinteger (L, 5); \
407 int r = nm (a1,a2,a3,a4,a5); \
408 lua_pushinteger (L, r); \
412 static int l_ ## nm (lua_State *L) { \
414 lua_pushinteger (L, r); \
417 #define s_isisi(nm) \
418 static int l_ ## nm (lua_State *L) { \
419 lua_Integer a1 = luaL_checkinteger (L, 1); \
420 lua_Integer a2 = luaL_checkinteger (L, 2); \
421 lua_Integer a3 = luaL_checkinteger (L, 3); \
422 lua_Integer a4 = luaL_checkinteger (L, 4); \
423 lua_Integer a5 = luaL_checkinteger (L, 5); \
424 int r = nm (a1,a2,a3,a4,a5); \
425 lua_pushinteger (L, r); \
429 static int l_ ## nm (lua_State *L) { \
430 double *a1 = magic_doublestar_function (L, 1); \
431 double *a2 = magic_doublestar_function (L, 2); \
435 #define v_DDDDDDIi(nm) \
436 static int l_ ## nm (lua_State *L) { \
437 double *a1 = magic_doublestar_function (L, 1); \
438 double *a2 = magic_doublestar_function (L, 2); \
439 double *a3 = magic_doublestar_function (L, 3); \
440 double *a4 = magic_doublestar_function (L, 4); \
441 double *a5 = magic_doublestar_function (L, 5); \
442 double *a6 = magic_doublestar_function (L, 6); \
443 int *a7 = magic_intstar_function (L, 7); \
444 lua_Integer a8 = luaL_checkinteger (L, 8); \
445 nm (a1,a2,a3,a4,a5,a6,a7,a8); \
448 #define v_DDDDi(nm) \
449 static int l_ ## nm (lua_State *L) { \
450 double *a1 = magic_doublestar_function (L, 1); \
451 double *a2 = magic_doublestar_function (L, 2); \
452 double *a3 = magic_doublestar_function (L, 3); \
453 double *a4 = magic_doublestar_function (L, 4); \
454 lua_Integer a5 = luaL_checkinteger (L, 5); \
455 nm (a1,a2,a3,a4,a5); \
458 #define v_DDDDii(nm) \
459 static int l_ ## nm (lua_State *L) { \
460 double *a1 = magic_doublestar_function (L, 1); \
461 double *a2 = magic_doublestar_function (L, 2); \
462 double *a3 = magic_doublestar_function (L, 3); \
463 double *a4 = magic_doublestar_function (L, 4); \
464 lua_Integer a5 = luaL_checkinteger (L, 5); \
465 lua_Integer a6 = luaL_checkinteger (L, 6); \
466 nm (a1,a2,a3,a4,a5,a6); \
470 static int l_ ## nm (lua_State *L) { \
471 double *a1 = magic_doublestar_function (L, 1); \
472 double *a2 = magic_doublestar_function (L, 2); \
473 double *a3 = magic_doublestar_function (L, 3); \
474 int *a4 = magic_intstar_function (L, 4); \
479 static int l_ ## nm (lua_State *L) { \
480 double *a1 = magic_doublestar_function (L, 1); \
481 double *a2 = magic_doublestar_function (L, 2); \
482 double *a3 = magic_doublestar_function (L, 3); \
483 lua_Integer a4 = luaL_checkinteger (L, 4); \
487 #define v_DDDiIIIi(nm) \
488 static int l_ ## nm (lua_State *L) { \
489 double *a1 = magic_doublestar_function (L, 1); \
490 double *a2 = magic_doublestar_function (L, 2); \
491 double *a3 = magic_doublestar_function (L, 3); \
492 lua_Integer a4 = luaL_checkinteger (L, 4); \
493 int *a5 = magic_intstar_function (L, 5); \
494 int *a6 = magic_intstar_function (L, 6); \
495 int *a7 = magic_intstar_function (L, 7); \
496 lua_Integer a8 = luaL_checkinteger (L, 8); \
497 nm (a1,a2,a3,a4,a5,a6,a7,a8); \
500 #define v_DDDiIIIiDi(nm) \
501 static int l_ ## nm (lua_State *L) { \
502 double *a1 = magic_doublestar_function (L, 1); \
503 double *a2 = magic_doublestar_function (L, 2); \
504 double *a3 = magic_doublestar_function (L, 3); \
505 lua_Integer a4 = luaL_checkinteger (L, 4); \
506 int *a5 = magic_intstar_function (L, 5); \
507 int *a6 = magic_intstar_function (L, 6); \
508 int *a7 = magic_intstar_function (L, 7); \
509 lua_Integer a8 = luaL_checkinteger (L, 8); \
510 double *a9 = magic_doublestar_function (L, 9); \
511 lua_Integer a10 = luaL_checkinteger (L, 10); \
512 nm (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); \
515 #define v_DDDiIIIid(nm) \
516 static int l_ ## nm (lua_State *L) { \
517 double *a1 = magic_doublestar_function (L, 1); \
518 double *a2 = magic_doublestar_function (L, 2); \
519 double *a3 = magic_doublestar_function (L, 3); \
520 lua_Integer a4 = luaL_checkinteger (L, 4); \
521 int *a5 = magic_intstar_function (L, 5); \
522 int *a6 = magic_intstar_function (L, 6); \
523 int *a7 = magic_intstar_function (L, 7); \
524 lua_Integer a8 = luaL_checkinteger (L, 8); \
525 lua_Number a9 = luaL_checknumber (L, 9); \
526 nm (a1,a2,a3,a4,a5,a6,a7,a8,a9); \
530 static int l_ ## nm (lua_State *L) { \
531 double *a1 = magic_doublestar_function (L, 1); \
532 double *a2 = magic_doublestar_function (L, 2); \
533 lua_Integer a3 = luaL_checkinteger (L, 3); \
537 #define v_DDiDDi(nm) \
538 static int l_ ## nm (lua_State *L) { \
539 double *a1 = magic_doublestar_function (L, 1); \
540 double *a2 = magic_doublestar_function (L, 2); \
541 lua_Integer a3 = luaL_checkinteger (L, 3); \
542 double *a4 = magic_doublestar_function (L, 4); \
543 double *a5 = magic_doublestar_function (L, 5); \
544 lua_Integer a6 = luaL_checkinteger (L, 6); \
545 nm (a1,a2,a3,a4,a5,a6); \
549 static int l_ ## nm (lua_State *L) { \
550 double *a1 = magic_doublestar_function (L, 1); \
551 double *a2 = magic_doublestar_function (L, 2); \
552 lua_Integer a3 = luaL_checkinteger (L, 3); \
553 lua_Number a4 = luaL_checknumber (L, 4); \
557 #define v_DDiii(nm) \
558 static int l_ ## nm (lua_State *L) { \
559 double *a1 = magic_doublestar_function (L, 1); \
560 double *a2 = magic_doublestar_function (L, 2); \
561 lua_Integer a3 = luaL_checkinteger (L, 3); \
562 lua_Integer a4 = luaL_checkinteger (L, 4); \
563 lua_Integer a5 = luaL_checkinteger (L, 5); \
564 nm (a1,a2,a3,a4,a5); \
568 static int l_ ## nm (lua_State *L) { \
569 double *a1 = magic_doublestar_function (L, 1); \
570 lua_Number a2 = luaL_checknumber (L, 2); \
571 double *a3 = magic_doublestar_function (L, 3); \
572 lua_Integer a4 = luaL_checkinteger (L, 4); \
577 static int l_ ## nm (lua_State *L) { \
578 double *a1 = magic_doublestar_function (L, 1); \
579 lua_Integer a2 = luaL_checkinteger (L, 2); \
583 #define v_DiDiD(nm) \
584 static int l_ ## nm (lua_State *L) { \
585 double *a1 = magic_doublestar_function (L, 1); \
586 lua_Integer a2 = luaL_checkinteger (L, 2); \
587 double *a3 = magic_doublestar_function (L, 3); \
588 lua_Integer a4 = luaL_checkinteger (L, 4); \
589 double *a5 = magic_doublestar_function (L, 5); \
590 nm (a1,a2,a3,a4,a5); \
593 #define v_DiDiDDi(nm) \
594 static int l_ ## nm (lua_State *L) { \
595 double *a1 = magic_doublestar_function (L, 1); \
596 lua_Integer a2 = luaL_checkinteger (L, 2); \
597 double *a3 = magic_doublestar_function (L, 3); \
598 lua_Integer a4 = luaL_checkinteger (L, 4); \
599 double *a5 = magic_doublestar_function (L, 5); \
600 double *a6 = magic_doublestar_function (L, 6); \
601 lua_Integer a7 = luaL_checkinteger (L, 7); \
602 nm (a1,a2,a3,a4,a5,a6,a7); \
605 #define v_DiDiDd(nm) \
606 static int l_ ## nm (lua_State *L) { \
607 double *a1 = magic_doublestar_function (L, 1); \
608 lua_Integer a2 = luaL_checkinteger (L, 2); \
609 double *a3 = magic_doublestar_function (L, 3); \
610 lua_Integer a4 = luaL_checkinteger (L, 4); \
611 double *a5 = magic_doublestar_function (L, 5); \
612 lua_Number a6 = luaL_checknumber (L, 6); \
613 nm (a1,a2,a3,a4,a5,a6); \
616 #define v_DiDiDiDd(nm) \
617 static int l_ ## nm (lua_State *L) { \
618 double *a1 = magic_doublestar_function (L, 1); \
619 lua_Integer a2 = luaL_checkinteger (L, 2); \
620 double *a3 = magic_doublestar_function (L, 3); \
621 lua_Integer a4 = luaL_checkinteger (L, 4); \
622 double *a5 = magic_doublestar_function (L, 5); \
623 lua_Integer a6 = luaL_checkinteger (L, 6); \
624 double *a7 = magic_doublestar_function (L, 7); \
625 lua_Number a8 = luaL_checknumber (L, 8); \
626 nm (a1,a2,a3,a4,a5,a6,a7,a8); \
630 static int l_ ## nm (lua_State *L) { \
631 double *a1 = magic_doublestar_function (L, 1); \
632 lua_Integer a2 = luaL_checkinteger (L, 2); \
633 const char *a3 = luaL_checkstring(L, 3); \
634 nm (a1,a2,(char *)a3); \
638 static int l_ ## nm (lua_State *L) { \
639 double *a1 = magic_doublestar_function (L, 1); \
640 lua_Integer a2 = luaL_checkinteger (L, 2); \
641 lua_Integer a3 = luaL_checkinteger (L, 3); \
646 static int l_ ## nm (lua_State *L) { \
647 double *a1 = magic_doublestar_function (L, 1); \
648 lua_Integer a2 = luaL_checkinteger (L, 2); \
649 lua_Integer a3 = luaL_checkinteger (L, 3); \
650 lua_Number a4 = luaL_checknumber (L, 4); \
655 static int l_ ## nm (lua_State *L) { \
656 double *a1 = magic_doublestar_function (L, 1); \
657 lua_Integer a2 = luaL_checkinteger (L, 2); \
658 lua_Integer a3 = luaL_checkinteger (L, 3); \
659 lua_Integer a4 = luaL_checkinteger (L, 4); \
663 #define v_Diiii(nm) \
664 static int l_ ## nm (lua_State *L) { \
665 double *a1 = magic_doublestar_function (L, 1); \
666 lua_Integer a2 = luaL_checkinteger (L, 2); \
667 lua_Integer a3 = luaL_checkinteger (L, 3); \
668 lua_Integer a4 = luaL_checkinteger (L, 4); \
669 lua_Integer a5 = luaL_checkinteger (L, 5); \
670 nm (a1,a2,a3,a4,a5); \
674 static int l_ ## nm (lua_State *L) { \
675 int *a1 = magic_intstar_function (L, 1); \
676 int *a2 = magic_intstar_function (L, 2); \
677 lua_Integer a3 = luaL_checkinteger (L, 3); \
682 static int l_ ## nm (lua_State *L) { \
683 int *a1 = magic_intstar_function (L, 1); \
684 long *a2 = magic_longstar_function (L, 2); \
685 int *a3 = magic_intstar_function (L, 3); \
686 lua_Integer a4 = luaL_checkinteger (L, 4); \
691 static int l_ ## nm (lua_State *L) { \
692 int *a1 = magic_intstar_function (L, 1); \
693 lua_Integer a2 = luaL_checkinteger (L, 2); \
698 static int l_ ## nm (lua_State *L) { \
702 lua_pushinteger (L, a1); \
703 lua_pushinteger (L, a2); \
707 static int l_ ## nm (lua_State *L) { \
712 lua_pushinteger (L, a1); \
713 lua_pushinteger (L, a2); \
714 lua_pushinteger (L, a3); \
718 static int l_ ## nm (lua_State *L) { \
723 nm (&a1,&a2,&a3,&a4); \
724 lua_pushinteger (L, a1); \
725 lua_pushinteger (L, a2); \
726 lua_pushinteger (L, a3); \
727 lua_pushinteger (L, a4); \
731 static int l_ ## nm (lua_State *L) { \
732 const char *a1 = luaL_checkstring(L, 1); \
737 static int l_ ## nm (lua_State *L) { \
738 const char *a1 = luaL_checkstring(L, 1); \
739 const char *a2 = luaL_checkstring(L, 2); \
740 nm ((char *)a1,(char *)a2); \
744 static int l_ ## nm (lua_State *L) { \
745 const char *a1 = luaL_checkstring(L, 1); \
746 const char *a2 = luaL_checkstring(L, 2); \
747 const char *a3 = luaL_checkstring(L, 3); \
748 nm ((char *)a1,(char *)a2,(char *)a3); \
752 static int l_ ## nm (lua_State *L) { \
753 const char *a1 = luaL_checkstring(L, 1); \
754 const char *a2 = luaL_checkstring(L, 2); \
755 const char *a3 = luaL_checkstring(L, 3); \
756 const char *a4 = luaL_checkstring(L, 4); \
757 nm ((char *)a1,(char *)a2,(char *)a3,(char *)a4); \
761 static int l_ ## nm (lua_State *L) { \
762 const char *a1 = luaL_checkstring(L, 1); \
763 const char *a2 = luaL_checkstring(L, 2); \
764 const char *a3 = luaL_checkstring(L, 3); \
765 lua_Integer a4 = luaL_checkinteger (L, 4); \
766 nm ((char *)a1,(char *)a2,(char *)a3,a4); \
770 static int l_ ## nm (lua_State *L) { \
771 const char *a1 = luaL_checkstring(L, 1); \
772 const char *a2 = luaL_checkstring(L, 2); \
773 lua_Integer a3 = luaL_checkinteger (L, 3); \
774 lua_Integer a4 = luaL_checkinteger (L, 4); \
775 nm ((char *)a1,(char *)a2,a3,a4); \
779 static int l_ ## nm (lua_State *L) { \
780 const char *a1 = luaL_checkstring(L, 1); \
781 lua_Number a2 = luaL_checknumber (L, 2); \
782 lua_Number a3 = luaL_checknumber (L, 3); \
783 nm ((char *)a1,a2,a3); \
787 static int l_ ## nm (lua_State *L) { \
788 const char *a1 = luaL_checkstring(L, 1); \
789 lua_Number a2 = luaL_checknumber (L, 2); \
790 lua_Integer a3 = luaL_checkinteger (L, 3); \
791 const char *a4 = luaL_checkstring(L, 4); \
792 nm ((char *)a1,a2,a3,(char *)a4); \
796 static int l_ ## nm (lua_State *L) { \
797 const char *a1 = luaL_checkstring(L, 1); \
798 lua_Integer a2 = luaL_checkinteger (L, 2); \
799 nm ((char *)a1,a2); \
803 static int l_ ## nm (lua_State *L) { \
804 const char *a1 = luaL_checkstring(L, 1); \
805 lua_Integer a2 = luaL_checkinteger (L, 2); \
806 const char *a3 = luaL_checkstring(L, 3); \
807 nm ((char *)a1,a2,(char *)a3); \
811 static int l_ ## nm (lua_State *L) { \
812 const char *a1 = luaL_checkstring(L, 1); \
813 lua_Integer a2 = luaL_checkinteger (L, 2); \
814 lua_Integer a3 = luaL_checkinteger (L, 3); \
815 nm ((char *)a1,a2,a3); \
819 static int l_ ## nm (lua_State *L) { \
820 const char *a1 = luaL_checkstring(L, 1); \
821 lua_Integer a2 = luaL_checkinteger (L, 2); \
822 lua_Integer a3 = luaL_checkinteger (L, 3); \
823 lua_Integer a4 = luaL_checkinteger (L, 4); \
824 nm ((char *)a1,a2,a3,a4); \
827 #define v_Kiiii(nm) \
828 static int l_ ## nm (lua_State *L) { \
829 const char *a1 = luaL_checkstring(L, 1); \
830 lua_Integer a2 = luaL_checkinteger (L, 2); \
831 lua_Integer a3 = luaL_checkinteger (L, 3); \
832 lua_Integer a4 = luaL_checkinteger (L, 4); \
833 lua_Integer a5 = luaL_checkinteger (L, 5); \
834 nm ((char *)a1,a2,a3,a4,a5); \
838 static int l_ ## nm (lua_State *L) { \
843 lua_pushnumber (L, a1); \
844 lua_pushnumber (L, a2); \
845 lua_pushnumber (L, a3); \
848 #define v_RRRRK(nm) \
849 static int l_ ## nm (lua_State *L) { \
854 const char *a5 = luaL_checkstring(L, 5); \
855 nm (&a1,&a2,&a3,&a4,(char *)a5); \
856 lua_pushnumber (L, a1); \
857 lua_pushnumber (L, a2); \
858 lua_pushnumber (L, a3); \
859 lua_pushnumber (L, a4); \
863 static int l_ ## nm (lua_State *L) { \
864 lua_Number a1 = luaL_checknumber (L, 1); \
869 static int l_ ## nm (lua_State *L) { \
870 lua_Number a1 = luaL_checknumber (L, 1); \
871 double *a2 = magic_doublestar_function (L, 2); \
872 double *a3 = magic_doublestar_function (L, 3); \
873 lua_Integer a4 = luaL_checkinteger (L, 4); \
878 static int l_ ## nm (lua_State *L) { \
879 lua_Number a1 = luaL_checknumber (L, 1); \
880 const char *a2 = luaL_checkstring(L, 2); \
881 nm (a1,(char *)a2); \
885 static int l_ ## nm (lua_State *L) { \
886 lua_Number a1 = luaL_checknumber (L, 1); \
887 lua_Number a2 = luaL_checknumber (L, 2); \
892 static int l_ ## nm (lua_State *L) { \
893 lua_Number a1 = luaL_checknumber (L, 1); \
894 lua_Number a2 = luaL_checknumber (L, 2); \
897 nm (a1,a2,&a3,&a4); \
898 lua_pushnumber (L, a3); \
899 lua_pushnumber (L, a4); \
903 static int l_ ## nm (lua_State *L) { \
904 lua_Number a1 = luaL_checknumber (L, 1); \
905 lua_Number a2 = luaL_checknumber (L, 2); \
906 lua_Number a3 = luaL_checknumber (L, 3); \
911 static int l_ ## nm (lua_State *L) { \
912 lua_Number a1 = luaL_checknumber (L, 1); \
913 lua_Number a2 = luaL_checknumber (L, 2); \
914 lua_Number a3 = luaL_checknumber (L, 3); \
915 const char *a4 = luaL_checkstring(L, 4); \
916 nm (a1,a2,a3,(char *)a4); \
919 #define v_dddRR(nm) \
920 static int l_ ## nm (lua_State *L) { \
921 lua_Number a1 = luaL_checknumber (L, 1); \
922 lua_Number a2 = luaL_checknumber (L, 2); \
923 lua_Number a3 = luaL_checknumber (L, 3); \
926 nm (a1,a2,a3,&a4,&a5); \
927 lua_pushnumber (L, a4); \
928 lua_pushnumber (L, a5); \
931 #define v_dddRRR(nm) \
932 static int l_ ## nm (lua_State *L) { \
933 lua_Number a1 = luaL_checknumber (L, 1); \
934 lua_Number a2 = luaL_checknumber (L, 2); \
935 lua_Number a3 = luaL_checknumber (L, 3); \
939 nm (a1,a2,a3,&a4,&a5,&a6); \
940 lua_pushnumber (L, a4); \
941 lua_pushnumber (L, a5); \
942 lua_pushnumber (L, a6); \
946 static int l_ ## nm (lua_State *L) { \
947 lua_Number a1 = luaL_checknumber (L, 1); \
948 lua_Number a2 = luaL_checknumber (L, 2); \
949 lua_Number a3 = luaL_checknumber (L, 3); \
950 lua_Number a4 = luaL_checknumber (L, 4); \
954 #define v_ddddKii(nm) \
955 static int l_ ## nm (lua_State *L) { \
956 lua_Number a1 = luaL_checknumber (L, 1); \
957 lua_Number a2 = luaL_checknumber (L, 2); \
958 lua_Number a3 = luaL_checknumber (L, 3); \
959 lua_Number a4 = luaL_checknumber (L, 4); \
960 const char *a5 = luaL_checkstring(L, 5); \
961 lua_Integer a6 = luaL_checkinteger (L, 6); \
962 lua_Integer a7 = luaL_checkinteger (L, 7); \
963 nm (a1,a2,a3,a4,(char *)a5,a6,a7); \
966 #define v_ddddd(nm) \
967 static int l_ ## nm (lua_State *L) { \
968 lua_Number a1 = luaL_checknumber (L, 1); \
969 lua_Number a2 = luaL_checknumber (L, 2); \
970 lua_Number a3 = luaL_checknumber (L, 3); \
971 lua_Number a4 = luaL_checknumber (L, 4); \
972 lua_Number a5 = luaL_checknumber (L, 5); \
973 nm (a1,a2,a3,a4,a5); \
976 #define v_dddddd(nm) \
977 static int l_ ## nm (lua_State *L) { \
978 lua_Number a1 = luaL_checknumber (L, 1); \
979 lua_Number a2 = luaL_checknumber (L, 2); \
980 lua_Number a3 = luaL_checknumber (L, 3); \
981 lua_Number a4 = luaL_checknumber (L, 4); \
982 lua_Number a5 = luaL_checknumber (L, 5); \
983 lua_Number a6 = luaL_checknumber (L, 6); \
984 nm (a1,a2,a3,a4,a5,a6); \
987 #define v_ddddddRRR(nm) \
988 static int l_ ## nm (lua_State *L) { \
989 lua_Number a1 = luaL_checknumber (L, 1); \
990 lua_Number a2 = luaL_checknumber (L, 2); \
991 lua_Number a3 = luaL_checknumber (L, 3); \
992 lua_Number a4 = luaL_checknumber (L, 4); \
993 lua_Number a5 = luaL_checknumber (L, 5); \
994 lua_Number a6 = luaL_checknumber (L, 6); \
998 nm (a1,a2,a3,a4,a5,a6,&a7,&a8,&a9); \
999 lua_pushnumber (L, a7); \
1000 lua_pushnumber (L, a8); \
1001 lua_pushnumber (L, a9); \
1004 #define v_ddddddd(nm) \
1005 static int l_ ## nm (lua_State *L) { \
1006 lua_Number a1 = luaL_checknumber (L, 1); \
1007 lua_Number a2 = luaL_checknumber (L, 2); \
1008 lua_Number a3 = luaL_checknumber (L, 3); \
1009 lua_Number a4 = luaL_checknumber (L, 4); \
1010 lua_Number a5 = luaL_checknumber (L, 5); \
1011 lua_Number a6 = luaL_checknumber (L, 6); \
1012 lua_Number a7 = luaL_checknumber (L, 7); \
1013 nm (a1,a2,a3,a4,a5,a6,a7); \
1016 #define v_dddddddd(nm) \
1017 static int l_ ## nm (lua_State *L) { \
1018 lua_Number a1 = luaL_checknumber (L, 1); \
1019 lua_Number a2 = luaL_checknumber (L, 2); \
1020 lua_Number a3 = luaL_checknumber (L, 3); \
1021 lua_Number a4 = luaL_checknumber (L, 4); \
1022 lua_Number a5 = luaL_checknumber (L, 5); \
1023 lua_Number a6 = luaL_checknumber (L, 6); \
1024 lua_Number a7 = luaL_checknumber (L, 7); \
1025 lua_Number a8 = luaL_checknumber (L, 8); \
1026 nm (a1,a2,a3,a4,a5,a6,a7,a8); \
1029 #define v_ddddddddd(nm) \
1030 static int l_ ## nm (lua_State *L) { \
1031 lua_Number a1 = luaL_checknumber (L, 1); \
1032 lua_Number a2 = luaL_checknumber (L, 2); \
1033 lua_Number a3 = luaL_checknumber (L, 3); \
1034 lua_Number a4 = luaL_checknumber (L, 4); \
1035 lua_Number a5 = luaL_checknumber (L, 5); \
1036 lua_Number a6 = luaL_checknumber (L, 6); \
1037 lua_Number a7 = luaL_checknumber (L, 7); \
1038 lua_Number a8 = luaL_checknumber (L, 8); \
1039 lua_Number a9 = luaL_checknumber (L, 9); \
1040 nm (a1,a2,a3,a4,a5,a6,a7,a8,a9); \
1043 #define v_dddddddddddd(nm) \
1044 static int l_ ## nm (lua_State *L) { \
1045 lua_Number a1 = luaL_checknumber (L, 1); \
1046 lua_Number a2 = luaL_checknumber (L, 2); \
1047 lua_Number a3 = luaL_checknumber (L, 3); \
1048 lua_Number a4 = luaL_checknumber (L, 4); \
1049 lua_Number a5 = luaL_checknumber (L, 5); \
1050 lua_Number a6 = luaL_checknumber (L, 6); \
1051 lua_Number a7 = luaL_checknumber (L, 7); \
1052 lua_Number a8 = luaL_checknumber (L, 8); \
1053 lua_Number a9 = luaL_checknumber (L, 9); \
1054 lua_Number a10 = luaL_checknumber (L, 10); \
1055 lua_Number a11 = luaL_checknumber (L, 11); \
1056 lua_Number a12 = luaL_checknumber (L, 12); \
1057 nm (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); \
1060 #define v_ddddddi(nm) \
1061 static int l_ ## nm (lua_State *L) { \
1062 lua_Number a1 = luaL_checknumber (L, 1); \
1063 lua_Number a2 = luaL_checknumber (L, 2); \
1064 lua_Number a3 = luaL_checknumber (L, 3); \
1065 lua_Number a4 = luaL_checknumber (L, 4); \
1066 lua_Number a5 = luaL_checknumber (L, 5); \
1067 lua_Number a6 = luaL_checknumber (L, 6); \
1068 lua_Integer a7 = luaL_checkinteger (L, 7); \
1069 nm (a1,a2,a3,a4,a5,a6,a7); \
1072 #define v_ddddi(nm) \
1073 static int l_ ## nm (lua_State *L) { \
1074 lua_Number a1 = luaL_checknumber (L, 1); \
1075 lua_Number a2 = luaL_checknumber (L, 2); \
1076 lua_Number a3 = luaL_checknumber (L, 3); \
1077 lua_Number a4 = luaL_checknumber (L, 4); \
1078 lua_Integer a5 = luaL_checkinteger (L, 5); \
1079 nm (a1,a2,a3,a4,a5); \
1082 #define v_ddddiKiii(nm) \
1083 static int l_ ## nm (lua_State *L) { \
1084 lua_Number a1 = luaL_checknumber (L, 1); \
1085 lua_Number a2 = luaL_checknumber (L, 2); \
1086 lua_Number a3 = luaL_checknumber (L, 3); \
1087 lua_Number a4 = luaL_checknumber (L, 4); \
1088 lua_Integer a5 = luaL_checkinteger (L, 5); \
1089 const char *a6 = luaL_checkstring(L, 6); \
1090 lua_Integer a7 = luaL_checkinteger (L, 7); \
1091 lua_Integer a8 = luaL_checkinteger (L, 8); \
1092 lua_Integer a9 = luaL_checkinteger (L, 9); \
1093 nm (a1,a2,a3,a4,a5,(char *)a6,a7,a8,a9); \
1096 #define v_ddddiKiiii(nm) \
1097 static int l_ ## nm (lua_State *L) { \
1098 lua_Number a1 = luaL_checknumber (L, 1); \
1099 lua_Number a2 = luaL_checknumber (L, 2); \
1100 lua_Number a3 = luaL_checknumber (L, 3); \
1101 lua_Number a4 = luaL_checknumber (L, 4); \
1102 lua_Integer a5 = luaL_checkinteger (L, 5); \
1103 const char *a6 = luaL_checkstring(L, 6); \
1104 lua_Integer a7 = luaL_checkinteger (L, 7); \
1105 lua_Integer a8 = luaL_checkinteger (L, 8); \
1106 lua_Integer a9 = luaL_checkinteger (L, 9); \
1107 lua_Integer a10 = luaL_checkinteger (L, 10); \
1108 nm (a1,a2,a3,a4,a5,(char *)a6,a7,a8,a9,a10); \
1111 #define v_ddddii(nm) \
1112 static int l_ ## nm (lua_State *L) { \
1113 lua_Number a1 = luaL_checknumber (L, 1); \
1114 lua_Number a2 = luaL_checknumber (L, 2); \
1115 lua_Number a3 = luaL_checknumber (L, 3); \
1116 lua_Number a4 = luaL_checknumber (L, 4); \
1117 lua_Integer a5 = luaL_checkinteger (L, 5); \
1118 lua_Integer a6 = luaL_checkinteger (L, 6); \
1119 nm (a1,a2,a3,a4,a5,a6); \
1122 #define v_dddid(nm) \
1123 static int l_ ## nm (lua_State *L) { \
1124 lua_Number a1 = luaL_checknumber (L, 1); \
1125 lua_Number a2 = luaL_checknumber (L, 2); \
1126 lua_Number a3 = luaL_checknumber (L, 3); \
1127 lua_Integer a4 = luaL_checkinteger (L, 4); \
1128 lua_Number a5 = luaL_checknumber (L, 5); \
1129 nm (a1,a2,a3,a4,a5); \
1132 #define v_ddiii(nm) \
1133 static int l_ ## nm (lua_State *L) { \
1134 lua_Number a1 = luaL_checknumber (L, 1); \
1135 lua_Number a2 = luaL_checknumber (L, 2); \
1136 lua_Integer a3 = luaL_checkinteger (L, 3); \
1137 lua_Integer a4 = luaL_checkinteger (L, 4); \
1138 lua_Integer a5 = luaL_checkinteger (L, 5); \
1139 nm (a1,a2,a3,a4,a5); \
1142 #define v_didd(nm) \
1143 static int l_ ## nm (lua_State *L) { \
1144 lua_Number a1 = luaL_checknumber (L, 1); \
1145 lua_Integer a2 = luaL_checkinteger (L, 2); \
1146 lua_Number a3 = luaL_checknumber (L, 3); \
1147 lua_Number a4 = luaL_checknumber (L, 4); \
1152 static int l_ ## nm (lua_State *L) { \
1153 lua_Number a1 = luaL_checknumber (L, 1); \
1154 lua_Integer a2 = luaL_checkinteger (L, 2); \
1155 lua_Integer a3 = luaL_checkinteger (L, 3); \
1159 #define v_diii(nm) \
1160 static int l_ ## nm (lua_State *L) { \
1161 lua_Number a1 = luaL_checknumber (L, 1); \
1162 lua_Integer a2 = luaL_checkinteger (L, 2); \
1163 lua_Integer a3 = luaL_checkinteger (L, 3); \
1164 lua_Integer a4 = luaL_checkinteger (L, 4); \
1168 #define v_diiid(nm) \
1169 static int l_ ## nm (lua_State *L) { \
1170 lua_Number a1 = luaL_checknumber (L, 1); \
1171 lua_Integer a2 = luaL_checkinteger (L, 2); \
1172 lua_Integer a3 = luaL_checkinteger (L, 3); \
1173 lua_Integer a4 = luaL_checkinteger (L, 4); \
1174 lua_Number a5 = luaL_checknumber (L, 5); \
1175 nm (a1,a2,a3,a4,a5); \
1179 static int l_ ## nm (lua_State *L) { \
1180 lua_Integer a1 = luaL_checkinteger (L, 1); \
1184 #define v_iJJJ(nm) \
1185 static int l_ ## nm (lua_State *L) { \
1186 lua_Integer a1 = luaL_checkinteger (L, 1); \
1190 nm (a1,&a2,&a3,&a4); \
1191 lua_pushinteger (L, a2); \
1192 lua_pushinteger (L, a3); \
1193 lua_pushinteger (L, a4); \
1197 static int l_ ## nm (lua_State *L) { \
1198 lua_Integer a1 = luaL_checkinteger (L, 1); \
1199 const char *a2 = luaL_checkstring(L, 2); \
1200 nm (a1,(char *)a2); \
1204 static int l_ ## nm (lua_State *L) { \
1205 lua_Integer a1 = luaL_checkinteger (L, 1); \
1206 const char *a2 = luaL_checkstring(L, 2); \
1207 const char *a3 = luaL_checkstring(L, 3); \
1208 nm (a1,(char *)a2,(char *)a3); \
1211 #define v_iRRR(nm) \
1212 static int l_ ## nm (lua_State *L) { \
1213 lua_Integer a1 = luaL_checkinteger (L, 1); \
1217 nm (a1,&a2,&a3,&a4); \
1218 lua_pushnumber (L, a2); \
1219 lua_pushnumber (L, a3); \
1220 lua_pushnumber (L, a4); \
1224 static int l_ ## nm (lua_State *L) { \
1225 lua_Integer a1 = luaL_checkinteger (L, 1); \
1226 lua_Number a2 = luaL_checknumber (L, 2); \
1231 static int l_ ## nm (lua_State *L) { \
1232 lua_Integer a1 = luaL_checkinteger (L, 1); \
1233 lua_Number a2 = luaL_checknumber (L, 2); \
1234 const char *a3 = luaL_checkstring(L, 3); \
1235 nm (a1,a2,(char *)a3); \
1239 static int l_ ## nm (lua_State *L) { \
1240 lua_Integer a1 = luaL_checkinteger (L, 1); \
1241 lua_Number a2 = luaL_checknumber (L, 2); \
1242 lua_Number a3 = luaL_checknumber (L, 3); \
1246 #define v_iddd(nm) \
1247 static int l_ ## nm (lua_State *L) { \
1248 lua_Integer a1 = luaL_checkinteger (L, 1); \
1249 lua_Number a2 = luaL_checknumber (L, 2); \
1250 lua_Number a3 = luaL_checknumber (L, 3); \
1251 lua_Number a4 = luaL_checknumber (L, 4); \
1255 #define v_idddK(nm) \
1256 static int l_ ## nm (lua_State *L) { \
1257 lua_Integer a1 = luaL_checkinteger (L, 1); \
1258 lua_Number a2 = luaL_checknumber (L, 2); \
1259 lua_Number a3 = luaL_checknumber (L, 3); \
1260 lua_Number a4 = luaL_checknumber (L, 4); \
1261 const char *a5 = luaL_checkstring(L, 5); \
1262 nm (a1,a2,a3,a4,(char *)a5); \
1266 static int l_ ## nm (lua_State *L) { \
1267 lua_Integer a1 = luaL_checkinteger (L, 1); \
1268 lua_Integer a2 = luaL_checkinteger (L, 2); \
1273 static int l_ ## nm (lua_State *L) { \
1274 lua_Integer a1 = luaL_checkinteger (L, 1); \
1275 lua_Integer a2 = luaL_checkinteger (L, 2); \
1278 lua_pushinteger (L, a3); \
1282 static int l_ ## nm (lua_State *L) { \
1283 lua_Integer a1 = luaL_checkinteger (L, 1); \
1284 lua_Integer a2 = luaL_checkinteger (L, 2); \
1285 const char *a3 = luaL_checkstring(L, 3); \
1286 nm (a1,a2,(char *)a3); \
1290 static int l_ ## nm (lua_State *L) { \
1291 lua_Integer a1 = luaL_checkinteger (L, 1); \
1292 lua_Integer a2 = luaL_checkinteger (L, 2); \
1293 lua_Number a3 = luaL_checknumber (L, 3); \
1298 static int l_ ## nm (lua_State *L) { \
1299 lua_Integer a1 = luaL_checkinteger (L, 1); \
1300 lua_Integer a2 = luaL_checkinteger (L, 2); \
1301 lua_Integer a3 = luaL_checkinteger (L, 3); \
1305 #define v_iiiK(nm) \
1306 static int l_ ## nm (lua_State *L) { \
1307 lua_Integer a1 = luaL_checkinteger (L, 1); \
1308 lua_Integer a2 = luaL_checkinteger (L, 2); \
1309 lua_Integer a3 = luaL_checkinteger (L, 3); \
1310 const char *a4 = luaL_checkstring(L, 4); \
1311 nm (a1,a2,a3,(char *)a4); \
1314 #define v_iiidd(nm) \
1315 static int l_ ## nm (lua_State *L) { \
1316 lua_Integer a1 = luaL_checkinteger (L, 1); \
1317 lua_Integer a2 = luaL_checkinteger (L, 2); \
1318 lua_Integer a3 = luaL_checkinteger (L, 3); \
1319 lua_Number a4 = luaL_checknumber (L, 4); \
1320 lua_Number a5 = luaL_checknumber (L, 5); \
1321 nm (a1,a2,a3,a4,a5); \
1324 #define v_iiii(nm) \
1325 static int l_ ## nm (lua_State *L) { \
1326 lua_Integer a1 = luaL_checkinteger (L, 1); \
1327 lua_Integer a2 = luaL_checkinteger (L, 2); \
1328 lua_Integer a3 = luaL_checkinteger (L, 3); \
1329 lua_Integer a4 = luaL_checkinteger (L, 4); \
1333 #define v_iiiid(nm) \
1334 static int l_ ## nm (lua_State *L) { \
1335 lua_Integer a1 = luaL_checkinteger (L, 1); \
1336 lua_Integer a2 = luaL_checkinteger (L, 2); \
1337 lua_Integer a3 = luaL_checkinteger (L, 3); \
1338 lua_Integer a4 = luaL_checkinteger (L, 4); \
1339 lua_Number a5 = luaL_checknumber (L, 5); \
1340 nm (a1,a2,a3,a4,a5); \
1343 #define v_iiiiddd(nm) \
1344 static int l_ ## nm (lua_State *L) { \
1345 lua_Integer a1 = luaL_checkinteger (L, 1); \
1346 lua_Integer a2 = luaL_checkinteger (L, 2); \
1347 lua_Integer a3 = luaL_checkinteger (L, 3); \
1348 lua_Integer a4 = luaL_checkinteger (L, 4); \
1349 lua_Number a5 = luaL_checknumber (L, 5); \
1350 lua_Number a6 = luaL_checknumber (L, 6); \
1351 lua_Number a7 = luaL_checknumber (L, 7); \
1352 nm (a1,a2,a3,a4,a5,a6,a7); \
1355 #define v_iiiiddi(nm) \
1356 static int l_ ## nm (lua_State *L) { \
1357 lua_Integer a1 = luaL_checkinteger (L, 1); \
1358 lua_Integer a2 = luaL_checkinteger (L, 2); \
1359 lua_Integer a3 = luaL_checkinteger (L, 3); \
1360 lua_Integer a4 = luaL_checkinteger (L, 4); \
1361 lua_Number a5 = luaL_checknumber (L, 5); \
1362 lua_Number a6 = luaL_checknumber (L, 6); \
1363 lua_Integer a7 = luaL_checkinteger (L, 7); \
1364 nm (a1,a2,a3,a4,a5,a6,a7); \
1367 #define v_iiiii(nm) \
1368 static int l_ ## nm (lua_State *L) { \
1369 lua_Integer a1 = luaL_checkinteger (L, 1); \
1370 lua_Integer a2 = luaL_checkinteger (L, 2); \
1371 lua_Integer a3 = luaL_checkinteger (L, 3); \
1372 lua_Integer a4 = luaL_checkinteger (L, 4); \
1373 lua_Integer a5 = luaL_checkinteger (L, 5); \
1374 nm (a1,a2,a3,a4,a5); \
1377 #define v_iiiiii(nm) \
1378 static int l_ ## nm (lua_State *L) { \
1379 lua_Integer a1 = luaL_checkinteger (L, 1); \
1380 lua_Integer a2 = luaL_checkinteger (L, 2); \
1381 lua_Integer a3 = luaL_checkinteger (L, 3); \
1382 lua_Integer a4 = luaL_checkinteger (L, 4); \
1383 lua_Integer a5 = luaL_checkinteger (L, 5); \
1384 lua_Integer a6 = luaL_checkinteger (L, 6); \
1385 nm (a1,a2,a3,a4,a5,a6); \
1389 static int l_ ## nm (lua_State *L) { \
1394 #define CUSTOM(nm) static int l_ ## nm (lua_State *L); /* custom impl */
1462 v_DDDiIIIiDi(confll
)
1570 v_dddddddddddd(graf3
)
1571 v_dddddddddddd(graf3d
)
1992 static const luaL_reg ldislin_lib
[] =
1994 {"abs3pt", l_abs3pt
},
1995 {"addlab", l_addlab
},
1997 {"arcell", l_arcell
},
1999 {"autres", l_autres
},
2000 {"ax2grf", l_ax2grf
},
2001 {"ax3len", l_ax3len
},
2002 {"axclrs", l_axclrs
},
2003 {"axends", l_axends
},
2005 {"axis3d", l_axis3d
},
2006 {"axsbgd", l_axsbgd
},
2007 {"axslen", l_axslen
},
2008 {"axsorg", l_axsorg
},
2009 {"axspos", l_axspos
},
2010 {"axsscl", l_axsscl
},
2011 {"axstyp", l_axstyp
},
2012 {"barbor", l_barbor
},
2013 {"barclr", l_barclr
},
2014 {"bargrp", l_bargrp
},
2015 {"barmod", l_barmod
},
2016 {"baropt", l_baropt
},
2017 {"barpos", l_barpos
},
2019 {"bars3d", l_bars3d
},
2020 {"bartyp", l_bartyp
},
2021 {"barwth", l_barwth
},
2022 {"basalf", l_basalf
},
2023 {"basdat", l_basdat
},
2024 {"bezier", l_bezier
},
2025 {"bitsi2", l_bitsi2
},
2026 {"bitsi4", l_bitsi4
},
2027 {"bmpfnt", l_bmpfnt
},
2030 {"center", l_center
},
2031 {"cgmbgd", l_cgmbgd
},
2032 {"cgmpic", l_cgmpic
},
2033 {"cgmver", l_cgmver
},
2034 {"chaang", l_chaang
},
2035 {"chacod", l_chacod
},
2036 {"chaspc", l_chaspc
},
2037 {"chawth", l_chawth
},
2038 {"chnatt", l_chnatt
},
2039 {"chnbar", l_chnbar
},
2040 {"chncrv", l_chncrv
},
2041 {"chndot", l_chndot
},
2042 {"chndsh", l_chndsh
},
2043 {"chnpie", l_chnpie
},
2044 {"circ3p", l_circ3p
},
2045 {"circle", l_circle
},
2046 {"circsp", l_circsp
},
2047 {"clip3d", l_clip3d
},
2048 {"clpbor", l_clpbor
},
2049 {"clpmod", l_clpmod
},
2050 {"clpwin", l_clpwin
},
2051 {"clrcyc", l_clrcyc
},
2052 {"clrmod", l_clrmod
},
2053 {"clswin", l_clswin
},
2055 {"colran", l_colran
},
2056 {"colray", l_colray
},
2057 {"complx", l_complx
},
2058 {"conclr", l_conclr
},
2059 {"concrv", l_concrv
},
2060 {"confll", l_confll
},
2061 {"congap", l_congap
},
2062 {"conlab", l_conlab
},
2063 {"conmat", l_conmat
},
2064 {"conmod", l_conmod
},
2065 {"conn3d", l_conn3d
},
2066 {"connpt", l_connpt
},
2067 {"conpts", l_conpts
},
2068 {"conshd", l_conshd
},
2069 {"contri", l_contri
},
2070 {"contur", l_contur
},
2072 {"crvmat", l_crvmat
},
2073 {"crvtri", l_crvtri
},
2074 {"csrmod", l_csrmod
},
2075 {"csrpos", l_csrpos
},
2076 {"csrpt1", l_csrpt1
},
2077 {"csrtyp", l_csrtyp
},
2078 {"csruni", l_csruni
},
2079 {"curv3d", l_curv3d
},
2081 {"curve3", l_curve3
},
2082 {"curvmp", l_curvmp
},
2083 {"curvx3", l_curvx3
},
2084 {"curvy3", l_curvy3
},
2088 {"delglb", l_delglb
},
2089 {"disalf", l_disalf
},
2090 {"disfin", l_disfin
},
2091 {"disini", l_disini
},
2095 {"dwgbut", l_dwgbut
},
2096 {"dwgfil", l_dwgfil
},
2097 {"dwglis", l_dwglis
},
2098 {"dwgmsg", l_dwgmsg
},
2099 {"dwgtxt", l_dwgtxt
},
2100 {"ellips", l_ellips
},
2101 {"endgrf", l_endgrf
},
2103 {"errbar", l_errbar
},
2104 {"errdev", l_errdev
},
2105 {"errfil", l_errfil
},
2106 {"errmod", l_errmod
},
2107 {"eushft", l_eushft
},
2108 {"expzlb", l_expzlb
},
2110 {"filbox", l_filbox
},
2111 {"filclr", l_filclr
},
2112 {"filmod", l_filmod
},
2113 {"fixspc", l_fixspc
},
2114 {"flab3d", l_flab3d
},
2117 {"frmclr", l_frmclr
},
2118 {"frmess", l_frmess
},
2119 {"gapcrv", l_gapcrv
},
2120 {"getalf", l_getalf
},
2121 {"getang", l_getang
},
2122 {"getbpp", l_getbpp
},
2123 {"getclp", l_getclp
},
2124 {"getclr", l_getclr
},
2125 {"getdig", l_getdig
},
2126 {"getdsp", l_getdsp
},
2127 {"getfil", l_getfil
},
2128 {"getgrf", l_getgrf
},
2129 {"gethgt", l_gethgt
},
2130 {"gethnm", l_gethnm
},
2131 {"getind", l_getind
},
2132 {"getlab", l_getlab
},
2133 {"getlen", l_getlen
},
2134 {"getlev", l_getlev
},
2135 {"getlin", l_getlin
},
2136 {"getlit", l_getlit
},
2137 {"getmat", l_getmat
},
2138 {"getmfl", l_getmfl
},
2139 {"getmix", l_getmix
},
2141 {"getpag", l_getpag
},
2142 {"getpat", l_getpat
},
2143 {"getplv", l_getplv
},
2144 {"getpos", l_getpos
},
2145 {"getran", l_getran
},
2146 {"getres", l_getres
},
2147 {"getrgb", l_getrgb
},
2148 {"getscl", l_getscl
},
2149 {"getscr", l_getscr
},
2150 {"getshf", l_getshf
},
2151 {"getsp1", l_getsp1
},
2152 {"getsp2", l_getsp2
},
2153 {"getsym", l_getsym
},
2154 {"gettcl", l_gettcl
},
2155 {"gettic", l_gettic
},
2156 {"gettyp", l_gettyp
},
2157 {"getver", l_getver
},
2159 {"getvlt", l_getvlt
},
2160 {"getwid", l_getwid
},
2161 {"getwin", l_getwin
},
2162 {"getxid", l_getxid
},
2163 {"gifmod", l_gifmod
},
2164 {"gmxalf", l_gmxalf
},
2165 {"gothic", l_gothic
},
2169 {"graf3d", l_graf3d
},
2170 {"grafmp", l_grafmp
},
2171 {"grdpol", l_grdpol
},
2172 {"grffin", l_grffin
},
2173 {"grfini", l_grfini
},
2175 {"grid3d", l_grid3d
},
2176 {"gridmp", l_gridmp
},
2177 {"gwgatt", l_gwgatt
},
2178 {"gwgbox", l_gwgbox
},
2179 {"gwgbut", l_gwgbut
},
2180 {"gwgfil", l_gwgfil
},
2181 {"gwglis", l_gwglis
},
2182 {"gwgscl", l_gwgscl
},
2183 {"gwgtxt", l_gwgtxt
},
2184 {"gwgxid", l_gwgxid
},
2185 {"height", l_height
},
2187 {"helves", l_helves
},
2188 {"histog", l_histog
},
2190 {"hsvrgb", l_hsvrgb
},
2191 {"hsymbl", l_hsymbl
},
2192 {"htitle", l_htitle
},
2193 {"hwfont", l_hwfont
},
2194 {"hworig", l_hworig
},
2195 {"hwpage", l_hwpage
},
2196 {"imgbox", l_imgbox
},
2197 {"imgclp", l_imgclp
},
2198 {"imgfin", l_imgfin
},
2199 {"imgfmt", l_imgfmt
},
2200 {"imgini", l_imgini
},
2201 {"imgmod", l_imgmod
},
2202 {"imgsiz", l_imgsiz
},
2203 {"inccrv", l_inccrv
},
2204 {"incdat", l_incdat
},
2205 {"incfil", l_incfil
},
2206 {"incmrk", l_incmrk
},
2207 {"indrgb", l_indrgb
},
2209 {"intlen", l_intlen
},
2210 {"intrgb", l_intrgb
},
2211 {"itmcnt", l_itmcnt
},
2212 {"itmstr", l_itmstr
},
2213 {"labclr", l_labclr
},
2214 {"labdig", l_labdig
},
2215 {"labdis", l_labdis
},
2216 {"labels", l_labels
},
2217 {"labjus", l_labjus
},
2218 {"labl3d", l_labl3d
},
2219 {"labmod", l_labmod
},
2220 {"labpos", l_labpos
},
2221 {"labtyp", l_labtyp
},
2222 {"legclr", l_legclr
},
2223 {"legend", l_legend
},
2224 {"legini", l_legini
},
2225 {"leglin", l_leglin
},
2226 {"legopt", l_legopt
},
2227 {"legpat", l_legpat
},
2228 {"legpos", l_legpos
},
2229 {"legtit", l_legtit
},
2230 {"lfttit", l_lfttit
},
2232 {"lincyc", l_lincyc
},
2234 {"linesp", l_linesp
},
2235 {"lintyp", l_lintyp
},
2236 {"linwid", l_linwid
},
2237 {"litmod", l_litmod
},
2238 {"litop3", l_litop3
},
2239 {"litopt", l_litopt
},
2240 {"litpos", l_litpos
},
2242 {"lnjoin", l_lnjoin
},
2244 {"logtic", l_logtic
},
2245 {"mapbas", l_mapbas
},
2246 {"mapfil", l_mapfil
},
2247 {"maplev", l_maplev
},
2248 {"mapmod", l_mapmod
},
2249 {"mappol", l_mappol
},
2250 {"mapref", l_mapref
},
2251 {"mapsph", l_mapsph
},
2252 {"marker", l_marker
},
2253 {"matop3", l_matop3
},
2254 {"matopt", l_matopt
},
2255 {"mdfmat", l_mdfmat
},
2256 {"messag", l_messag
},
2257 {"metafl", l_metafl
},
2258 {"mixalf", l_mixalf
},
2259 {"mixleg", l_mixleg
},
2260 {"mpaepl", l_mpaepl
},
2261 {"mplang", l_mplang
},
2262 {"mplclr", l_mplclr
},
2263 {"mplpos", l_mplpos
},
2264 {"mplsiz", l_mplsiz
},
2265 {"mpslogo", l_mpslogo
},
2266 {"msgbox", l_msgbox
},
2267 {"mshclr", l_mshclr
},
2269 {"myline", l_myline
},
2271 {"mysymb", l_mysymb
},
2273 {"namdis", l_namdis
},
2275 {"namjus", l_namjus
},
2276 {"neglog", l_neglog
},
2277 {"newmix", l_newmix
},
2278 {"newpag", l_newpag
},
2279 {"nlmess", l_nlmess
},
2280 {"nlnumb", l_nlnumb
},
2281 {"noarln", l_noarln
},
2284 {"nochek", l_nochek
},
2285 {"noclip", l_noclip
},
2286 {"nofill", l_nofill
},
2287 {"nograf", l_nograf
},
2288 {"nohide", l_nohide
},
2289 {"noline", l_noline
},
2290 {"number", l_number
},
2291 {"numfmt", l_numfmt
},
2292 {"numode", l_numode
},
2293 {"nwkday", l_nwkday
},
2294 {"nxlegn", l_nxlegn
},
2295 {"nxposn", l_nxposn
},
2296 {"nylegn", l_nylegn
},
2297 {"nyposn", l_nyposn
},
2298 {"nzposn", l_nzposn
},
2299 {"opnwin", l_opnwin
},
2300 {"origin", l_origin
},
2302 {"pagera", l_pagera
},
2303 {"pagfll", l_pagfll
},
2304 {"paghdr", l_paghdr
},
2305 {"pagmod", l_pagmod
},
2306 {"pagorg", l_pagorg
},
2307 {"patcyc", l_patcyc
},
2308 {"pdfbuf", l_pdfbuf
},
2309 {"pdfmod", l_pdfmod
},
2310 {"pdfmrk", l_pdfmrk
},
2311 {"penwid", l_penwid
},
2313 {"piebor", l_piebor
},
2314 {"pieclr", l_pieclr
},
2315 {"pieexp", l_pieexp
},
2316 {"piegrf", l_piegrf
},
2317 {"pielab", l_pielab
},
2318 {"pieopt", l_pieopt
},
2319 {"pietyp", l_pietyp
},
2320 {"pievec", l_pievec
},
2321 {"pngmod", l_pngmod
},
2324 {"polcrv", l_polcrv
},
2325 {"polmod", l_polmod
},
2326 {"pos2pt", l_pos2pt
},
2327 {"pos3pt", l_pos3pt
},
2328 {"projct", l_projct
},
2329 {"psfont", l_psfont
},
2330 {"psmode", l_psmode
},
2331 {"qplbar", l_qplbar
},
2332 {"qplclr", l_qplclr
},
2333 {"qplcon", l_qplcon
},
2335 {"qplpie", l_qplpie
},
2336 {"qplsca", l_qplsca
},
2337 {"qplsur", l_qplsur
},
2338 {"rbfpng", l_rbfpng
},
2340 {"reawgt", l_reawgt
},
2341 {"recfll", l_recfll
},
2342 {"rectan", l_rectan
},
2343 {"rel3pt", l_rel3pt
},
2344 {"resatt", l_resatt
},
2346 {"revscr", l_revscr
},
2347 {"rgbhsv", l_rgbhsv
},
2349 {"rgtlab", l_rgtlab
},
2350 {"rimage", l_rimage
},
2352 {"rlarea", l_rlarea
},
2353 {"rlcirc", l_rlcirc
},
2354 {"rlconn", l_rlconn
},
2357 {"rlmess", l_rlmess
},
2358 {"rlnumb", l_rlnumb
},
2360 {"rlpoin", l_rlpoin
},
2364 {"rlstrt", l_rlstrt
},
2365 {"rlsymb", l_rlsymb
},
2367 {"rlwind", l_rlwind
},
2368 {"rndrec", l_rndrec
},
2369 {"rpixel", l_rpixel
},
2373 {"rvynam", l_rvynam
},
2374 {"sclfac", l_sclfac
},
2375 {"sclmod", l_sclmod
},
2376 {"scrmod", l_scrmod
},
2377 {"sector", l_sector
},
2378 {"selwin", l_selwin
},
2379 {"sendbf", l_sendbf
},
2380 {"sendmb", l_sendmb
},
2381 {"sendok", l_sendok
},
2383 {"setbas", l_setbas
},
2384 {"setcbk", l_setcbk
},
2385 {"setclr", l_setclr
},
2386 {"setcsr", l_setcsr
},
2387 {"setexp", l_setexp
},
2388 {"setfil", l_setfil
},
2389 {"setgrf", l_setgrf
},
2390 {"setind", l_setind
},
2391 {"setmix", l_setmix
},
2392 {"setpag", l_setpag
},
2393 {"setres", l_setres
},
2394 {"setrgb", l_setrgb
},
2395 {"setscl", l_setscl
},
2396 {"setvlt", l_setvlt
},
2397 {"setxid", l_setxid
},
2398 {"shdafr", l_shdafr
},
2399 {"shdcha", l_shdcha
},
2400 {"shdcrv", l_shdcrv
},
2401 {"shdeur", l_shdeur
},
2402 {"shdmap", l_shdmap
},
2403 {"shdmod", l_shdmod
},
2404 {"shdpat", l_shdpat
},
2405 {"shdusa", l_shdusa
},
2406 {"shield", l_shield
},
2407 {"shlcir", l_shlcir
},
2408 {"shldel", l_shldel
},
2409 {"shlell", l_shlell
},
2410 {"shlind", l_shlind
},
2411 {"shlpie", l_shlpie
},
2412 {"shlpol", l_shlpol
},
2413 {"shlrct", l_shlrct
},
2414 {"shlrec", l_shlrec
},
2415 {"shlres", l_shlres
},
2416 {"shlsur", l_shlsur
},
2417 {"shlvis", l_shlvis
},
2418 {"simplx", l_simplx
},
2419 {"smxalf", l_smxalf
},
2421 {"sortr1", l_sortr1
},
2422 {"sortr2", l_sortr2
},
2423 {"sphe3d", l_sphe3d
},
2424 {"spline", l_spline
},
2425 {"splmod", l_splmod
},
2426 {"strt3d", l_strt3d
},
2427 {"strtpt", l_strtpt
},
2428 {"surclr", l_surclr
},
2429 {"surfce", l_surfce
},
2430 {"surfcp", l_surfcp
},
2431 {"surfun", l_surfun
},
2432 {"suriso", l_suriso
},
2433 {"surmat", l_surmat
},
2434 {"surmsh", l_surmsh
},
2435 {"suropt", l_suropt
},
2436 {"surshd", l_surshd
},
2437 {"sursze", l_sursze
},
2438 {"surtri", l_surtri
},
2439 {"survis", l_survis
},
2440 {"swgatt", l_swgatt
},
2441 {"swgbox", l_swgbox
},
2442 {"swgbut", l_swgbut
},
2443 {"swgcbk", l_swgcbk
},
2444 {"swgclr", l_swgclr
},
2445 {"swgdrw", l_swgdrw
},
2446 {"swgfil", l_swgfil
},
2447 {"swgfnt", l_swgfnt
},
2448 {"swgfoc", l_swgfoc
},
2449 {"swghlp", l_swghlp
},
2450 {"swgjus", l_swgjus
},
2451 {"swglis", l_swglis
},
2452 {"swgmix", l_swgmix
},
2453 {"swgmrg", l_swgmrg
},
2454 {"swgoff", l_swgoff
},
2455 {"swgopt", l_swgopt
},
2456 {"swgpop", l_swgpop
},
2457 {"swgpos", l_swgpos
},
2458 {"swgscl", l_swgscl
},
2459 {"swgsiz", l_swgsiz
},
2460 {"swgspc", l_swgspc
},
2461 {"swgstp", l_swgstp
},
2462 {"swgtit", l_swgtit
},
2463 {"swgtxt", l_swgtxt
},
2464 {"swgtyp", l_swgtyp
},
2465 {"swgwin", l_swgwin
},
2466 {"swgwth", l_swgwth
},
2467 {"symbol", l_symbol
},
2468 {"symfil", l_symfil
},
2469 {"symrot", l_symrot
},
2470 {"texmod", l_texmod
},
2471 {"texopt", l_texopt
},
2472 {"texval", l_texval
},
2473 {"thkcrv", l_thkcrv
},
2474 {"thrfin", l_thrfin
},
2475 {"thrini", l_thrini
},
2477 {"ticlen", l_ticlen
},
2478 {"ticmod", l_ticmod
},
2479 {"ticpos", l_ticpos
},
2480 {"tifmod", l_tifmod
},
2481 {"tiforg", l_tiforg
},
2482 {"tifwin", l_tifwin
},
2483 {"timopt", l_timopt
},
2484 {"titjus", l_titjus
},
2486 {"titlin", l_titlin
},
2487 {"titpos", l_titpos
},
2488 {"trfco1", l_trfco1
},
2489 {"trfco2", l_trfco2
},
2490 {"trfco3", l_trfco3
},
2491 {"trfdat", l_trfdat
},
2492 {"trfmat", l_trfmat
},
2493 {"trfrel", l_trfrel
},
2494 {"trfres", l_trfres
},
2495 {"trfrot", l_trfrot
},
2496 {"trfscl", l_trfscl
},
2497 {"trfshf", l_trfshf
},
2498 {"triang", l_triang
},
2499 {"trifll", l_trifll
},
2500 {"triplx", l_triplx
},
2501 {"tripts", l_tripts
},
2502 {"trmlen", l_trmlen
},
2503 {"txtjus", l_txtjus
},
2506 {"vang3d", l_vang3d
},
2507 {"vclp3d", l_vclp3d
},
2508 {"vector", l_vector
},
2509 {"vectr3", l_vectr3
},
2510 {"vfoc3d", l_vfoc3d
},
2511 {"view3d", l_view3d
},
2512 {"vkxbar", l_vkxbar
},
2513 {"vkybar", l_vkybar
},
2514 {"vkytit", l_vkytit
},
2515 {"vltfil", l_vltfil
},
2522 {"wgdlis", l_wgdlis
},
2523 {"wgdraw", l_wgdraw
},
2529 {"wgltxt", l_wgltxt
},
2531 {"wgpbut", l_wgpbut
},
2533 {"wgquit", l_wgquit
},
2535 {"wgstxt", l_wgstxt
},
2537 {"widbar", l_widbar
},
2538 {"wimage", l_wimage
},
2539 {"winapp", l_winapp
},
2540 {"windbr", l_windbr
},
2541 {"window", l_window
},
2542 {"winfnt", l_winfnt
},
2544 {"winkey", l_winkey
},
2545 {"winmod", l_winmod
},
2546 {"winopt", l_winopt
},
2547 {"winsiz", l_winsiz
},
2548 {"wintit", l_wintit
},
2549 {"wmfmod", l_wmfmod
},
2551 {"wpixel", l_wpixel
},
2552 {"wpixls", l_wpixls
},
2553 {"wpxrow", l_wpxrow
},
2555 {"x11fnt", l_x11fnt
},
2556 {"x11mod", l_x11mod
},
2557 {"x2dpos", l_x2dpos
},
2558 {"x3dabs", l_x3dabs
},
2559 {"x3dpos", l_x3dpos
},
2560 {"x3drel", l_x3drel
},
2561 {"xaxgit", l_xaxgit
},
2564 {"xaxmap", l_xaxmap
},
2565 {"xcross", l_xcross
},
2567 {"xinvrs", l_xinvrs
},
2570 {"y2dpos", l_y2dpos
},
2571 {"y3dabs", l_y3dabs
},
2572 {"y3dpos", l_y3dpos
},
2573 {"y3drel", l_y3drel
},
2574 {"yaxgit", l_yaxgit
},
2577 {"yaxmap", l_yaxmap
},
2578 {"ycross", l_ycross
},
2579 {"yinvrs", l_yinvrs
},
2581 {"z3dpos", l_z3dpos
},
2584 {"zbffin", l_zbffin
},
2585 {"zbfini", l_zbfini
},
2586 {"zbflin", l_zbflin
},
2587 {"zbftri", l_zbftri
},
2588 {"zscale", l_zscale
},
2592 /* **** 20 excluded functions ****
2593 ** **** int closfl (int nu);
2594 ** **** void csrpts (int *ix, int *iy, int nmax, int *n, int *iret);
2595 ** **** void csrmov (int *ix, int *iy, int nmax, int *n, int *iret);
2596 ** **** void digits (int ndig, const char *cax);
2597 ** **** int fcha (double x, int ndig, char *cstr);
2598 ** **** void *getuni (void);
2599 ** **** int intcha (int nx, char *cstr);
2600 ** **** void itmcat (char *clis, const char *cstr);
2601 ** **** int openfl (const char *cfil, int nu, int irw);
2602 ** **** int posifl (int nu, int nbyte);
2603 ** **** int readfl (int nu, unsigned char *cbuf, int nbyte);
2604 ** **** void rpixls (unsigned char *iray, int ix, int iy, int nw, int nh);
2605 ** **** void rpxrow (unsigned char *iray, int ix, int iy, int n);
2606 ** **** void scale (const char *cscl, const char *cax);
2607 ** **** int skipfl (int nu, int nbyte);
2608 ** **** void swapi2 (short *iray, int n);
2609 ** **** void swapi4 (int *iray, int n);
2610 ** **** int tellfl (int nu);
2611 ** **** void upstr (char *cstr);
2612 ** **** int writfl (int nu, const unsigned char *cbuf, int nbyte);
2613 ** **** ******************* ****
2616 /* **** 34 custom functions ****
2617 ** **** void bars (double *xray, double *y1ray, double *y2ray, int n);
2618 ** **** void bezier (const double *xray, const double *yray, int nray, double *x, double *y, int n);
2619 ** **** void colray (const double *zray, int *nray, int n);
2620 ** **** void conpts (const double *xray, int n, const double *yray, int m, const double *zmat, double zlev, double *xpts, double *ypts, int maxpts, int *nray, int maxray, int *nlins);
2621 ** **** void disini (void);
2622 ** **** void getlab (char *cx, char *cy, char *cz);
2623 ** **** void getmat (const double *xray, const double *yray, const double *zray, int n,double *zmat, int nx, int ny, double zval, int *imat, double *wmat);
2624 ** **** void gwgfil (int id, char *cfile);
2625 ** **** void gwgtxt (int id, char *ctext);
2626 ** **** void histog (const double *xray, int n, double *x, double *y, int *m);
2627 ** **** void legend (const char *cbuf, int ncor);
2628 ** **** void legini (char *cbuf, int nlin, int nmaxln);
2629 ** **** void leglin (char *cbuf, const char *cstr, int ilin);
2630 ** **** int nxlegn (const char *cbuf);
2631 ** **** int nylegn (const char *cbuf);
2632 ** **** int pdfbuf (char *cbuf, int nmax);
2633 ** **** void piegrf (const char *cbuf, int nlin, const double *xray, int nseg);
2634 ** **** int rbfpng (char *cbuf, int nmax);
2635 ** **** void setcbk (void (*callbck) (double *x, double *y), const char *copt);
2636 ** **** void sortr1 (double *xray, int n, const char *copt);
2637 ** **** void sortr2 (double *xray, double *yray, int n, const char *copt);
2638 ** **** void spline (const double *xray, const double *yray, int n,double *xsray, double *ysray, int *nspl);
2639 ** **** void splmod (int ngrad, int npts);
2640 ** **** void surfcp (double (*zfun)(double x, double y, int i), double a1, double a2, double astp,double b1, double b2, double bstp);
2641 ** **** void surfun (double (*zfun)(double x, double y), int ixpts, double xdel, int iypts, double ydel);
2642 ** **** void swgcbk (int id, void (*callbck) (int i));
2643 ** **** void trfco1 (double *xray, int n, const char *cfrom, const char *cto);
2644 ** **** void trfco2 (double *xray, double *yray, int n, const char *cfrom, const char *cto);
2645 ** **** void trfco3 (double *xray, double *yray, double *zray, int n, const char *cfrom, const char *cto);
2646 ** **** void trfmat (const double *zmat, int nx, int ny, double *zmat2, int nx2, int ny2);
2647 ** **** void trfrel (double *xray, double *yray, int n);
2648 ** **** int triang (const double *xray, const double *yray, int n, int *i1ray, int *i2ray, int *i3ray, int nmax);
2649 ** **** void tripts (const double *xray, const double *yray, const double *zray, int n, const int *i1ray, const int *i2ray, const int *i3ray, int ntri,double zlev, double *xpts, double *ypts, int maxpts, int *nptray, int maxray, int *nlins);
2650 ** **** void unit (void *fp);
2651 ** **** ******************* ****
2654 /* ************************************************************************************ */
2656 // ***************** callbacks *****************
2658 static lua_State
*l_surfcp_L
;
2660 static double l_surfcp_callback (double x
, double y
, int i
)
2663 lua_pushvalue (l_surfcp_L
, 1); // the Lua function
2664 lua_pushnumber (l_surfcp_L
, (lua_Number
)x
);
2665 lua_pushnumber (l_surfcp_L
, (lua_Number
)y
);
2666 lua_pushnumber (l_surfcp_L
, (lua_Number
)i
);
2667 lua_call (l_surfcp_L
, 3, 1);
2668 dr
= (double )lua_tonumber (l_surfcp_L
, -1);
2669 lua_pop (l_surfcp_L
, 1);
2673 // void surfcp (double (*zfun)(double x, double y, int i), double a1, double a2, double astp, double b1, double b2, double bstp);
2674 static int l_surfcp (lua_State
*L
)
2676 lua_Number a2
= luaL_checknumber (L
, 2);
2677 lua_Number a3
= luaL_checknumber (L
, 3);
2678 lua_Number a4
= luaL_checknumber (L
, 4);
2679 lua_Number a5
= luaL_checknumber (L
, 5);
2680 lua_Number a6
= luaL_checknumber (L
, 6);
2681 lua_Number a7
= luaL_checknumber (L
, 7);
2682 luaL_checktype (L
, 1, LUA_TFUNCTION
);
2683 l_surfcp_L
= L
; // what a hack; well, DISLIN isn't reentrant anyway
2684 surfcp (l_surfcp_callback
, a2
,a3
,a4
,a5
,a6
,a7
);
2688 static double l_surfun_callback (double x
, double y
)
2691 lua_pushvalue (l_surfcp_L
, 1); // the Lua function
2692 lua_pushnumber (l_surfcp_L
, (lua_Number
)x
);
2693 lua_pushnumber (l_surfcp_L
, (lua_Number
)y
);
2694 lua_call (l_surfcp_L
, 2, 1);
2695 dr
= (double )lua_tonumber (l_surfcp_L
, -1);
2696 lua_pop (l_surfcp_L
, 1);
2700 // void surfun (double (*zfun)(double x, double y), int ixpts, double xdel, int iypts, double ydel);
2701 static int l_surfun (lua_State
*L
)
2703 lua_Number a2
= luaL_checknumber (L
, 2);
2704 lua_Number a3
= luaL_checknumber (L
, 3);
2705 lua_Number a4
= luaL_checknumber (L
, 4);
2706 lua_Number a5
= luaL_checknumber (L
, 5);
2707 luaL_checktype (L
, 1, LUA_TFUNCTION
);
2708 l_surfcp_L
= L
; // what a hack; well, DISLIN isn't reentrant anyway
2709 surfun (l_surfun_callback
, a2
,a3
,a4
,a5
);
2713 static void l_swgcbk_callback (int id
)
2715 lua_pushinteger (l_surfcp_L
, id
); /* key is ID */
2716 lua_rawget (l_surfcp_L
, LUA_ENVIRONINDEX
);
2717 lua_pushinteger (l_surfcp_L
, id
); // arg
2718 lua_call (l_surfcp_L
, 1, 0);
2721 // void swgcbk (int id, void (*callbck) (int i));
2722 static int l_swgcbk (lua_State
*L
)
2724 lua_Integer a1
= luaL_checkinteger (L
, 1);
2725 luaL_checktype (L
, 2, LUA_TFUNCTION
);
2726 l_surfcp_L
= L
; // what a hack; well, DISLIN isn't reentrant anyway
2727 // remember the function in our environment
2728 lua_pushinteger (L
, a1
); /* key is ID */
2729 lua_pushvalue (L
, 2); /* value is function */
2730 lua_rawset (L
, LUA_ENVIRONINDEX
);
2731 // register it with DISLIN
2732 swgcbk (a1
,l_swgcbk_callback
);
2736 static void l_prjfun_callback (double *x
, double *y
)
2739 lua_pushboolean (l_surfcp_L
, 1); /* key is: true */
2740 lua_rawget (l_surfcp_L
, LUA_ENVIRONINDEX
);
2742 lua_pushnumber (l_surfcp_L
, (lua_Number
)*x
);
2743 lua_pushnumber (l_surfcp_L
, (lua_Number
)*y
);
2744 lua_call (l_surfcp_L
, 2, 2);
2746 *x
= (double )lua_tonumber (l_surfcp_L
, -2);
2747 *y
= (double )lua_tonumber (l_surfcp_L
, -1);
2748 lua_pop (l_surfcp_L
, 2);
2751 // void setcbk (void (*callbck) (double *x, double *y), const char *copt);
2752 static int l_setcbk (lua_State
*L
)
2754 const char *copt
= luaL_checkstring (L
, 2);
2755 luaL_checktype (L
, 1, LUA_TFUNCTION
);
2756 l_surfcp_L
= L
; // what a hack; well, DISLIN isn't reentrant anyway
2757 // remember the function in our environment
2758 lua_pushboolean (l_surfcp_L
, 1); /* key is: true */
2759 lua_pushvalue (L
, 1); /* value is function */
2760 lua_rawset (L
, LUA_ENVIRONINDEX
);
2761 // register it with DISLIN
2762 setcbk (l_prjfun_callback
, copt
);
2766 // ************** SPLINE functions need tracking of npts **************
2768 static int spline_npts
= 200; // default number of interpolated points
2770 // void disini (void);
2771 static int l_disini (lua_State
*L
) {
2777 // void splmod (int ngrad, int npts);
2778 static int l_splmod (lua_State
*L
) {
2779 lua_Integer a1
= luaL_checkinteger (L
, 1);
2780 lua_Integer a2
= luaL_checkinteger (L
, 2);
2786 // void spline (const double *xray, const double *yray, int n, double *xsray, double *ysray, int *nspl);
2787 static int l_spline (lua_State
*L
)
2789 double *xray
= magic_doublestar_function (L
, 1);
2790 double *yray
= magic_doublestar_function (L
, 2);
2791 lua_Integer n
= luaL_checkinteger (L
, 3);
2792 double *x
= lua_newuserdata (L
, (spline_npts
+1) * 2 * sizeof(double)); /* will throw error if fails */
2793 double *y
= &x
[spline_npts
+1];
2795 spline (xray
,yray
,n
,x
,y
,&nspl
);
2796 push_double_array_as_table (L
, x
, nspl
);
2797 push_double_array_as_table (L
, y
, nspl
);
2801 // ***************** LEGINI legend userdata functions *****************
2803 typedef struct l_legend_t
2807 char lines
[]; // qlines * qlines chars
2810 const char *dn_legini_meta
= " dislin_LEGINI_MeTA";
2812 static l_legend_t
*ldn_check_legend (lua_State
*L
, int index
)
2814 l_legend_t
*leg
= (l_legend_t
*)luaL_checkudata (L
, index
, dn_legini_meta
);
2815 if (leg
== NULL
) luaL_argerror (L
, index
, "dislin bad legend_t");
2816 return leg
; /* leaves legend_t on Lua stack */
2819 static l_legend_t
*ldn_make_legend (lua_State
*L
, int n
)
2821 l_legend_t
*leg
= (l_legend_t
*)lua_newuserdata(L
, sizeof(l_legend_t
) + n
);
2822 luaL_getmetatable (L
, dn_legini_meta
);
2823 lua_setmetatable (L
, -2); /* set metatable */
2824 return leg
; /* leaves legend_t on Lua stack */
2827 // void legini (char *cbuf, int nlin, int nmaxln);
2828 static int l_legini (lua_State
*L
)
2831 lua_Integer qlines
= luaL_checkinteger (L
, 1);
2832 lua_Integer lnsize
= luaL_checkinteger (L
, 2);
2833 if (qlines
<= 0 || lnsize
<= 0 || qlines
> 100 || lnsize
> 256)
2834 luaL_error (L
, "l_legini bad arg!");
2835 leg
= ldn_make_legend (L
, qlines
* (lnsize
+1));
2836 leg
->qlines
= qlines
;
2837 leg
->lnsize
= lnsize
;
2839 legini (leg
->lines
, qlines
, lnsize
);
2843 // void piegrf (char *cbuf, int nlin, double *xray, int nseg);
2844 static int l_piegrf (lua_State
*L
)
2846 l_legend_t
*leg
= ldn_check_legend (L
, 1);
2847 lua_Integer qlines
= luaL_checkinteger (L
, 2);
2848 double *xray
= magic_doublestar_function (L
, 3);
2849 lua_Integer nseg
= luaL_checkinteger (L
, 4);
2850 // TO DO -- check qlines is in range?
2851 piegrf (leg
->lines
, qlines
, xray
, nseg
);
2855 // void legend (char *cbuf, int ncor);
2856 static int l_legend (lua_State
*L
)
2858 l_legend_t
*leg
= ldn_check_legend (L
, 1);
2859 lua_Integer ncor
= luaL_checkinteger (L
, 2);
2860 legend (leg
->lines
, ncor
);
2864 // void leglin (char *cbuf, char *cstr, int ilin);
2865 static int l_leglin (lua_State
*L
)
2867 l_legend_t
*leg
= ldn_check_legend (L
, 1);
2868 const char *cstr
= luaL_checkstring(L
, 2);
2869 lua_Integer ilin
= luaL_checkinteger (L
, 3);
2870 // TO DO -- check ilin is in range?
2871 leglin (leg
->lines
, (char *)cstr
, ilin
);
2875 // int nxlegn (char *cbuf);
2876 static int l_nxlegn (lua_State
*L
)
2878 l_legend_t
*leg
= ldn_check_legend (L
, 1);
2879 int x
= nxlegn (leg
->lines
);
2880 lua_pushinteger (L
, x
);
2884 // int nylegn (char *cbuf);
2885 static int l_nylegn (lua_State
*L
)
2887 l_legend_t
*leg
= ldn_check_legend (L
, 1);
2888 int y
= nylegn (leg
->lines
);
2889 lua_pushinteger (L
, y
);
2893 static const luaL_reg dn_legini_meta_lib
[] =
2895 {"piegrf", l_piegrf
},
2896 {"legend", l_legend
},
2897 {"leglin", l_leglin
},
2898 {"nxlegn", l_nxlegn
},
2899 {"nylegn", l_nylegn
},
2903 // ***************** res bufs *****************
2905 // void gwgfil (int id, char *cfile);
2906 static int l_gwgfil (lua_State
*L
)
2908 lua_Integer i
= luaL_checkinteger (L
, 1);
2911 lua_pushstring (L
, r
);
2915 // void gwgtxt (int id, char *ctext);
2916 static int l_gwgtxt (lua_State
*L
)
2918 lua_Integer i
= luaL_checkinteger (L
, 1);
2921 lua_pushstring (L
, r
);
2925 // void getlab (char *cx, char *cy, char *cz);
2926 // labels must be "<= 32 characters" per LABEL and MYLAB doco
2927 static int l_getlab (lua_State
*L
)
2933 lua_pushstring (L
, cx
);
2934 lua_pushstring (L
, cy
);
2935 lua_pushstring (L
, cz
);
2939 // ***************** out bufs *****************
2941 // int rbfpng (char *cbuf, int nmax);
2942 static int l_rbfpng (lua_State
*L
)
2945 lua_Integer n
= luaL_checkinteger (L
, 1);
2949 buf
= (char *) malloc (n
);
2953 lua_pushinteger (L
, -1);
2957 r
= rbfpng (buf
, n
);
2958 if (n
== 0 || r
< 0)
2961 lua_pushlstring (L
, buf
, r
);
2962 lua_pushinteger (L
, r
);
2966 // int pdfbuf (char *cbuf, int nmax);
2967 static int l_pdfbuf (lua_State
*L
)
2970 lua_Integer n
= luaL_checkinteger (L
, 1);
2974 buf
= (char *) malloc (n
);
2978 lua_pushinteger (L
, -1);
2982 r
= pdfbuf (buf
, n
);
2983 if (n
== 0 || r
< 0)
2986 lua_pushlstring (L
, buf
, r
);
2987 lua_pushinteger (L
, r
);
2991 // ***************** out rays *****************
2993 // void bezier (const double *xray, const double *yray, int nray, double *x, double *y, int n);
2994 static int l_bezier (lua_State
*L
)
2996 double *xray
= magic_doublestar_function (L
, 1);
2997 double *yray
= magic_doublestar_function (L
, 2);
2998 lua_Integer nray
= luaL_checkinteger (L
, 3);
2999 lua_Integer n
= luaL_checkinteger (L
, 4);
3000 double *x
= lua_newuserdata (L
, n
* 2 * sizeof(double)); /* will throw error if fails */
3002 bezier (xray
,yray
,nray
,x
,y
,n
);
3003 push_double_array_as_table (L
, x
, n
);
3004 push_double_array_as_table (L
, y
, n
);
3008 // void colray (const double *zray, int *nray, int n);
3009 static int l_colray (lua_State
*L
)
3011 double *zray
= magic_doublestar_function (L
, 1);
3012 lua_Integer n
= luaL_checkinteger (L
, 2);
3013 int *nray
= lua_newuserdata (L
, n
* sizeof(int)); /* will throw error if fails */
3014 colray (zray
,nray
,n
);
3015 push_int_array_as_table (L
, nray
, n
);
3019 // void conpts (const double *xray, int n, const double *yray, int m, const double *zmat, double zlev, double *xpts, double *ypts, int maxpts, int *nray, int maxray, int *nlins);
3021 static int l_conpts (lua_State
*L
)
3023 double *xray
= magic_doublestar_function (L
, 1);
3024 lua_Integer n
= luaL_checkinteger (L
, 2);
3025 double *yray
= magic_doublestar_function (L
, 3);
3026 lua_Integer m
= luaL_checkinteger (L
, 4);
3027 double *zmat
= magic_doublestar_function (L
, 5);
3028 lua_Number zlev
= luaL_checknumber (L
, 6);
3029 lua_Integer maxpts
= luaL_checkinteger (L
, 7);
3030 lua_Integer maxray
= luaL_checkinteger (L
, 8);
3032 double *xpts
= lua_newuserdata (L
, maxpts
* 2 * sizeof(double)); /* will throw error if fails */
3033 double *ypts
= &xpts
[maxpts
];
3034 int *nray
= lua_newuserdata (L
, maxray
* sizeof(int)); /* will throw error if fails */
3035 conpts (xray
,n
,yray
,m
,zmat
,zlev
,xpts
,ypts
,maxpts
,nray
,maxray
,&nlins
);
3036 for (maxpts
=0,n
=0; n
< nlins
; n
++)
3040 push_double_array_as_table (L
, xpts
, maxpts
);
3041 push_double_array_as_table (L
, ypts
, maxpts
);
3042 push_int_array_as_table (L
, nray
, nlins
);
3046 // void tripts (const double *xray, const double *yray, const double *zray, int n, const int *i1ray, const int *i2ray, const int *i3ray, int ntri,double zlev, double *xpts, double *ypts, int maxpts, int *nptray, int maxray, int *nlins);
3048 static int l_tripts (lua_State
*L
)
3050 double *xray
= magic_doublestar_function (L
, 1);
3051 double *yray
= magic_doublestar_function (L
, 2);
3052 double *zray
= magic_doublestar_function (L
, 3);
3053 lua_Integer n
= luaL_checkinteger (L
, 4);
3054 int *i1ray
= magic_intstar_function (L
, 5);
3055 int *i2ray
= magic_intstar_function (L
, 6);
3056 int *i3ray
= magic_intstar_function (L
, 7);
3057 lua_Integer ntri
= luaL_checkinteger (L
, 8);
3058 lua_Number zlev
= luaL_checknumber (L
, 9);
3059 lua_Integer maxpts
= luaL_checkinteger (L
, 10);
3060 lua_Integer maxray
= luaL_checkinteger (L
, 11);
3062 double *xpts
= lua_newuserdata (L
, maxpts
* 2 * sizeof(double)); /* will throw error if fails */
3063 double *ypts
= &xpts
[maxpts
];
3064 int *nray
= lua_newuserdata (L
, maxray
* sizeof(int)); /* will throw error if fails */
3065 tripts (xray
,yray
,zray
,n
,i1ray
,i2ray
,i3ray
,ntri
,zlev
,xpts
,ypts
,maxpts
,nray
,maxray
,&nlins
);
3066 for (maxpts
=0,n
=0; n
< nlins
; n
++)
3070 push_double_array_as_table (L
, xpts
, maxpts
);
3071 push_double_array_as_table (L
, ypts
, maxpts
);
3072 push_int_array_as_table (L
, nray
, nlins
);
3076 // void getmat (const double *xray, const double *yray, const double *zray, int n,double *zmat, int nx, int ny, double zval, int *imat, double *wmat);
3077 static int l_getmat (lua_State
*L
)
3079 double *xray
= magic_doublestar_function (L
, 1);
3080 double *yray
= magic_doublestar_function (L
, 2);
3081 double *zray
= magic_doublestar_function (L
, 3);
3082 lua_Integer n
= luaL_checkinteger (L
, 4);
3083 lua_Integer nx
= luaL_checkinteger (L
, 5);
3084 lua_Integer ny
= luaL_checkinteger (L
, 6);
3085 lua_Number zval
= luaL_checknumber (L
, 7);
3087 double *zmat
= lua_newuserdata (L
, zz
* 2 * sizeof(double)); /* will throw error if fails */
3088 double *wmat
= &zmat
[zz
];
3089 int *imat
= lua_newuserdata (L
, zz
* sizeof(int)); /* will throw error if fails */
3090 int rv
= (lua_gettop (L
) > 7 && lua_toboolean (L
,8)); /* optionally return imat */
3091 getmat (xray
,yray
,zray
,n
,zmat
,nx
,ny
,zval
,imat
,wmat
);
3092 push_double_array_as_table (L
, zmat
, zz
);
3095 push_int_array_as_table (L
, imat
, zz
);
3101 // void histog (const double *xray, int n, double *x, double *y, int *m);
3102 static int l_histog (lua_State
*L
)
3104 double *a1
= magic_doublestar_function (L
, 1);
3105 lua_Integer a2
= luaL_checkinteger (L
, 2);
3106 double *a3
= lua_newuserdata (L
, a2
* 2 * sizeof(double)); /* will throw error if fails */
3107 double *a4
= &a3
[a2
];
3109 histog (a1
,a2
,a3
,a4
,&a5
);
3110 push_double_array_as_table (L
, a3
, a5
);
3111 push_double_array_as_table (L
, a4
, a5
);
3112 lua_pushinteger (L
, a5
);
3116 // void sortr1 (double *xray, int n, const char *copt);
3117 static int l_sortr1 (lua_State
*L
)
3119 double *a1
= magic_doublestar_function (L
, 1);
3120 lua_Integer a2
= luaL_checkinteger (L
, 2);
3121 const char *a3
= luaL_checkstring(L
, 3);
3123 push_double_array_as_table (L
, a1
, a2
);
3127 // void sortr2 (double *xray, double *yray, int n, const char *copt);
3128 static int l_sortr2 (lua_State
*L
)
3130 double *a1
= magic_doublestar_function (L
, 1);
3131 double *a2
= magic_doublestar_function (L
, 2);
3132 lua_Integer a3
= luaL_checkinteger (L
, 3);
3133 const char *a4
= luaL_checkstring(L
, 4);
3134 sortr2 (a1
,a2
,a3
,a4
);
3135 push_double_array_as_table (L
, a1
, a3
);
3136 push_double_array_as_table (L
, a2
, a3
);
3140 // int triang (const double *xray, const double *yray, int n, int *i1ray, int *i2ray, int *i3ray, int nmax);
3141 static int l_triang (lua_State
*L
)
3143 double *x
= magic_doublestar_function_ (L
, 1, 3);
3144 double *y
= magic_doublestar_function_ (L
, 2, 3);
3145 lua_Integer n
= luaL_checkinteger (L
, 3);
3146 int nmax
= n
+ n
+ 1;
3147 int *i1ray
= lua_newuserdata (L
, nmax
* 3 * sizeof(int)); /* will throw error if fails */
3148 int *i2ray
= &i1ray
[nmax
];
3149 int *i3ray
= &i2ray
[nmax
];
3150 int ntri
= triang (x
,y
,n
,i1ray
,i2ray
,i3ray
,nmax
);
3151 push_int_array_as_table (L
, i1ray
, ntri
);
3152 push_int_array_as_table (L
, i2ray
, ntri
);
3153 push_int_array_as_table (L
, i3ray
, ntri
);
3154 lua_pushinteger (L
, ntri
);
3158 // void trfco1 (double *xray, int n, const char *cfrom, const char *cto);
3159 static int l_trfco1 (lua_State
*L
)
3161 double *a1
= magic_doublestar_function (L
, 1);
3162 lua_Integer a2
= luaL_checkinteger (L
, 2);
3163 const char *a3
= luaL_checkstring(L
, 3);
3164 const char *a4
= luaL_checkstring(L
, 4);
3165 trfco1 (a1
,a2
,a3
,a4
);
3166 push_double_array_as_table (L
, a1
, a2
);
3170 // void trfco2 (double *xray, double *yray, int n, const char *cfrom, const char *cto);
3171 static int l_trfco2 (lua_State
*L
)
3173 double *a1
= magic_doublestar_function (L
, 1);
3174 double *a2
= magic_doublestar_function (L
, 2);
3175 lua_Integer a3
= luaL_checkinteger (L
, 3);
3176 const char *a4
= luaL_checkstring(L
, 4);
3177 const char *a5
= luaL_checkstring(L
, 5);
3178 trfco2 (a1
,a2
,a3
,a4
,a5
);
3179 push_double_array_as_table (L
, a1
, a3
);
3180 push_double_array_as_table (L
, a2
, a3
);
3184 // void trfco3 (double *xray, double *yray, double *zray, int n, const char *cfrom, const char *cto);
3185 static int l_trfco3 (lua_State
*L
)
3187 double *a1
= magic_doublestar_function (L
, 1);
3188 double *a2
= magic_doublestar_function (L
, 2);
3189 double *a3
= magic_doublestar_function (L
, 3);
3190 lua_Integer a4
= luaL_checkinteger (L
, 4);
3191 const char *a5
= luaL_checkstring(L
, 5);
3192 const char *a6
= luaL_checkstring(L
, 6);
3193 trfco3 (a1
,a2
,a3
,a4
,a5
,a6
);
3194 push_double_array_as_table (L
, a1
, a4
);
3195 push_double_array_as_table (L
, a2
, a4
);
3196 push_double_array_as_table (L
, a3
, a4
);
3200 // void trfmat (const double *zmat, int nx, int ny, double *zmat2, int nx2, int ny2);
3201 static int l_trfmat (lua_State
*L
)
3203 double *zmat
= magic_doublestar_function (L
, 1);
3204 lua_Integer nx
= luaL_checkinteger (L
, 2);
3205 lua_Integer ny
= luaL_checkinteger (L
, 3);
3206 lua_Integer nx2
= luaL_checkinteger (L
, 4);
3207 lua_Integer ny2
= luaL_checkinteger (L
, 5);
3208 int z2sz
= nx2
* ny2
;
3209 double *zmat2
= lua_newuserdata (L
, z2sz
* sizeof(double)); /* will throw error if fails */
3210 trfmat (zmat
, nx
, ny
, zmat2
, nx2
, ny2
);
3211 push_double_array_as_table (L
, zmat2
, z2sz
);
3215 // void trfrel (double *xray, double *yray, int n);
3216 static int l_trfrel (lua_State
*L
)
3218 double *a1
= magic_doublestar_function (L
, 1);
3219 double *a2
= magic_doublestar_function (L
, 2);
3220 lua_Integer a3
= luaL_checkinteger (L
, 3);
3222 push_double_array_as_table (L
, a1
, a3
);
3223 push_double_array_as_table (L
, a2
, a3
);
3227 // void bars (double *xray, double *y1ray, double *y2ray, int n);
3228 // bars is odd because normally there are no return values, but:
3229 // [per Helmut:] bars can return values calculated by Dislin if
3230 // a special option is set with barpos
3231 // So, we take an optional fifth argument, which is non-nil non-false
3232 // causes the argument arrays to be returned.
3233 static int l_bars (lua_State
*L
)
3235 double *a1
= magic_doublestar_function (L
, 1);
3236 double *a2
= magic_doublestar_function (L
, 2);
3237 double *a3
= magic_doublestar_function (L
, 3);
3238 lua_Integer a4
= luaL_checkinteger (L
, 4);
3239 int rv
= (lua_gettop (L
) > 4 && lua_toboolean (L
,4));
3243 push_double_array_as_table (L
, a1
, a4
);
3244 push_double_array_as_table (L
, a2
, a4
);
3245 push_double_array_as_table (L
, a3
, a4
);
3251 // ***************** oddball *****************
3253 // void unit (void *fp);
3254 static int l_unit (lua_State
*L
)
3256 lua_Integer n
= luaL_checkinteger (L
, 1);
3258 luaL_error (L
, "Only UNIT(0) is supported");
3263 static void mkmeta (lua_State
*L
, const char *tname
, const luaL_reg
*reg
)
3265 luaL_newmetatable (L
, tname
); /* internal checkudata name */
3266 luaL_register (L
, NULL
, reg
); /* register metatable functions */
3267 lua_pushstring (L
, "__index");
3268 lua_pushvalue (L
, -2); /* push metatable */
3269 lua_rawset (L
, -3); /* metatable.__index = metatable */
3270 lua_pop(L
, 1); /* remove metatable from stack */
3273 LUALIB_API
int luaopen_ldislin (lua_State
*L
)
3275 /* create a shared environment for the DISLIN functions */
3276 lua_createtable (L
, 0, 5);
3277 lua_replace(L
, LUA_ENVIRONINDEX
);
3278 /* make any metatables */
3279 mkmeta (L
, dn_legini_meta
, dn_legini_meta_lib
);
3280 /* register the functions */
3281 luaL_register (L
, "dislin", ldislin_lib
);
3283 lua_pushliteral (L
,"version");
3284 lua_pushliteral (L
, DN_VERSION
);
3285 lua_settable (L
, -3);