updated on Wed Jan 25 16:08:47 UTC 2012
[aur-mirror.git] / ldislin / ldislin.c
blobe59f695471910cb6b996034600814fe8c5b36fcc
1 /* ldislin.c
2 * Lua wrapper for DISLIN
3 * created October 17, 2006 by e
5 * Copyright (c) 2006-7 Doug Currie, Londonderry, NH
6 * All rights reserved.
7 *
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 ************************************************************************/
29 #include "lua.h"
30 #include "lauxlib.h"
32 #include <stdlib.h>
33 #include "dislin.h"
35 #include "version.h"
37 #define DN_VERSION "Lua dislin version " SVN_REVS " for " LUA_VERSION " with DISLIN 9.1"
39 /* TO DO (maybe)
40 optimization:
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.
47 argument checking:
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 */
55 int top;
56 lua_Integer i;
57 size_t k;
58 double *r;
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 */
63 for (i=1; i<=k; i++)
65 lua_pushinteger (L, i);
66 lua_gettable (L, n);
67 r[i-1] = luaL_checknumber (L, top);
68 lua_pop (L, 1);
70 return r;
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 */
82 int top;
83 lua_Integer i;
84 size_t k;
85 int *r;
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 */
90 for (i=1; i<=k; i++)
92 lua_pushinteger (L, i);
93 lua_gettable (L, n);
94 r[i-1] = luaL_checkint (L, top);
95 lua_pop (L, 1);
97 return r;
100 static long *magic_longstar_function (lua_State *L, int n)
102 int top;
103 lua_Integer i;
104 size_t k;
105 long *r;
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 */
110 for (i=1; i<=k; i++)
112 lua_pushinteger (L, i);
113 lua_gettable (L, n);
114 r[i-1] = luaL_checklong (L, top);
115 lua_pop (L, 1);
117 return r;
120 #if 0
121 static short *magic_shortstar_function (lua_State *L, int n)
123 luaL_error (L, "magic_shortstar_function not implemented yet!");
124 return NULL;
126 static short *magic_voidstar_function (lua_State *L, int n)
128 luaL_error (L, "magic_voidstar_function not implemented yet!");
129 return NULL;
131 static void magic_push_voidstar (lua_State *L, double *R)
133 luaL_error (L, "magic_push_voidstar not implemented yet!");
135 #endif
137 static void push_double_array_as_table (lua_State *L, double *ray, int n)
139 int i;
140 lua_createtable (L, n, 0);
141 for (i = 0; i < n; )
143 lua_pushnumber (L, (lua_Number )ray[i]);
144 i += 1;
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)
152 int i;
153 lua_createtable (L, n, 0);
154 for (i = 0; i < n; )
156 lua_pushinteger (L, (lua_Integer )ray[i]);
157 i += 1;
158 lua_rawseti (L, -2, i);
160 // returns table on Lua stack
163 /* autogenerated code pasted here... "ldislin.txt.c" */
165 /* ************************************************************************************ */
167 #define C_KK(nm) \
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); \
173 free (r); \
174 return 1; \
176 #define C_KKK(nm) \
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); \
183 free (r); \
184 return 1; \
186 #define C_Ki(nm) \
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); \
192 free (r); \
193 return 1; \
195 #define K_K(nm) \
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); \
200 return 1; \
202 #define K_v(nm) \
203 static int l_ ## nm (lua_State *L) { \
204 char *r = nm (); \
205 lua_pushstring (L, r); \
206 return 1; \
208 #define d_d(nm) \
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); \
213 return 1; \
215 #define d_dd(nm) \
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); \
221 return 1; \
223 #define d_ddd(nm) \
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); \
230 return 1; \
232 #define d_i(nm) \
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); \
237 return 1; \
239 #define d_v(nm) \
240 static int l_ ## nm (lua_State *L) { \
241 double r = nm (); \
242 lua_pushnumber (L, r); \
243 return 1; \
245 #define i_JJ(nm) \
246 static int l_ ## nm (lua_State *L) { \
247 lua_Integer a1; \
248 lua_Integer a2; \
249 int r = nm (&a1,&a2); \
250 lua_pushinteger (L, r); \
251 lua_pushinteger (L, a1); \
252 lua_pushinteger (L, a2); \
253 return 3; \
255 #define i_K(nm) \
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); \
260 return 1; \
262 #define i_KAA(nm) \
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); \
271 return 3; \
273 #define i_KKi(nm) \
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); \
280 return 1; \
282 #define i_Ki(nm) \
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); \
288 return 1; \
290 #define i_d(nm) \
291 static int l_ ## nm (lua_State *L) { \
292 lua_Number a1 = luaL_checknumber (L, 1); \
293 int r = nm (a1); \
294 lua_pushinteger (L, r); \
295 return 1; \
297 #define i_ddd(nm) \
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); \
304 return 1; \
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); \
316 return 1; \
318 #define i_di(nm) \
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); \
324 return 1; \
326 #define i_i(nm) \
327 static int l_ ## nm (lua_State *L) { \
328 lua_Integer a1 = luaL_checkinteger (L, 1); \
329 int r = nm (a1); \
330 lua_pushinteger (L, r); \
331 return 1; \
333 #define i_iK(nm) \
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); \
339 return 1; \
341 #define i_iKK(nm) \
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); \
348 return 1; \
350 #define i_iKKK(nm) \
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); \
358 return 1; \
360 #define i_iKKi(nm) \
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); \
368 return 1; \
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); \
380 return 1; \
382 #define i_iKi(nm) \
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); \
389 return 1; \
391 #define i_iii(nm) \
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); \
398 return 1; \
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); \
409 return 1; \
411 #define i_v(nm) \
412 static int l_ ## nm (lua_State *L) { \
413 int r = nm (); \
414 lua_pushinteger (L, r); \
415 return 1; \
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); \
426 return 1; \
428 #define v_DD(nm) \
429 static int l_ ## nm (lua_State *L) { \
430 double *a1 = magic_doublestar_function (L, 1); \
431 double *a2 = magic_doublestar_function (L, 2); \
432 nm (a1,a2); \
433 return 0; \
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); \
446 return 0; \
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); \
456 return 0; \
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); \
467 return 0; \
469 #define v_DDDI(nm) \
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); \
475 nm (a1,a2,a3,a4); \
476 return 0; \
478 #define v_DDDi(nm) \
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); \
484 nm (a1,a2,a3,a4); \
485 return 0; \
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); \
498 return 0; \
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); \
513 return 0; \
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); \
527 return 0; \
529 #define v_DDi(nm) \
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); \
534 nm (a1,a2,a3); \
535 return 0; \
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); \
546 return 0; \
548 #define v_DDid(nm) \
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); \
554 nm (a1,a2,a3,a4); \
555 return 0; \
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); \
565 return 0; \
567 #define v_DdDi(nm) \
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); \
573 nm (a1,a2,a3,a4); \
574 return 0; \
576 #define v_Di(nm) \
577 static int l_ ## nm (lua_State *L) { \
578 double *a1 = magic_doublestar_function (L, 1); \
579 lua_Integer a2 = luaL_checkinteger (L, 2); \
580 nm (a1,a2); \
581 return 0; \
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); \
591 return 0; \
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); \
603 return 0; \
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); \
614 return 0; \
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); \
627 return 0; \
629 #define v_DiK(nm) \
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); \
635 return 0; \
637 #define v_Dii(nm) \
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); \
642 nm (a1,a2,a3); \
643 return 0; \
645 #define v_Diid(nm) \
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); \
651 nm (a1,a2,a3,a4); \
652 return 0; \
654 #define v_Diii(nm) \
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); \
660 nm (a1,a2,a3,a4); \
661 return 0; \
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); \
671 return 0; \
673 #define v_IIi(nm) \
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); \
678 nm (a1,a2,a3); \
679 return 0; \
681 #define v_ILIi(nm) \
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); \
687 nm (a1,a2,a3,a4); \
688 return 0; \
690 #define v_Ii(nm) \
691 static int l_ ## nm (lua_State *L) { \
692 int *a1 = magic_intstar_function (L, 1); \
693 lua_Integer a2 = luaL_checkinteger (L, 2); \
694 nm (a1,a2); \
695 return 0; \
697 #define v_JJ(nm) \
698 static int l_ ## nm (lua_State *L) { \
699 lua_Integer a1; \
700 lua_Integer a2; \
701 nm (&a1,&a2); \
702 lua_pushinteger (L, a1); \
703 lua_pushinteger (L, a2); \
704 return 2; \
706 #define v_JJJ(nm) \
707 static int l_ ## nm (lua_State *L) { \
708 lua_Integer a1; \
709 lua_Integer a2; \
710 lua_Integer a3; \
711 nm (&a1,&a2,&a3); \
712 lua_pushinteger (L, a1); \
713 lua_pushinteger (L, a2); \
714 lua_pushinteger (L, a3); \
715 return 3; \
717 #define v_JJJJ(nm) \
718 static int l_ ## nm (lua_State *L) { \
719 lua_Integer a1; \
720 lua_Integer a2; \
721 lua_Integer a3; \
722 lua_Integer a4; \
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); \
728 return 4; \
730 #define v_K(nm) \
731 static int l_ ## nm (lua_State *L) { \
732 const char *a1 = luaL_checkstring(L, 1); \
733 nm ((char *)a1); \
734 return 0; \
736 #define v_KK(nm) \
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); \
741 return 0; \
743 #define v_KKK(nm) \
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); \
749 return 0; \
751 #define v_KKKK(nm) \
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); \
758 return 0; \
760 #define v_KKKi(nm) \
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); \
767 return 0; \
769 #define v_KKii(nm) \
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); \
776 return 0; \
778 #define v_Kdd(nm) \
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); \
784 return 0; \
786 #define v_KdiK(nm) \
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); \
793 return 0; \
795 #define v_Ki(nm) \
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); \
800 return 0; \
802 #define v_KiK(nm) \
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); \
808 return 0; \
810 #define v_Kii(nm) \
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); \
816 return 0; \
818 #define v_Kiii(nm) \
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); \
825 return 0; \
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); \
835 return 0; \
837 #define v_RRR(nm) \
838 static int l_ ## nm (lua_State *L) { \
839 double a1; \
840 double a2; \
841 double a3; \
842 nm (&a1,&a2,&a3); \
843 lua_pushnumber (L, a1); \
844 lua_pushnumber (L, a2); \
845 lua_pushnumber (L, a3); \
846 return 3; \
848 #define v_RRRRK(nm) \
849 static int l_ ## nm (lua_State *L) { \
850 double a1; \
851 double a2; \
852 double a3; \
853 double a4; \
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); \
860 return 4; \
862 #define v_d(nm) \
863 static int l_ ## nm (lua_State *L) { \
864 lua_Number a1 = luaL_checknumber (L, 1); \
865 nm (a1); \
866 return 0; \
868 #define v_dDDi(nm) \
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); \
874 nm (a1,a2,a3,a4); \
875 return 0; \
877 #define v_dK(nm) \
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); \
882 return 0; \
884 #define v_dd(nm) \
885 static int l_ ## nm (lua_State *L) { \
886 lua_Number a1 = luaL_checknumber (L, 1); \
887 lua_Number a2 = luaL_checknumber (L, 2); \
888 nm (a1,a2); \
889 return 0; \
891 #define v_ddRR(nm) \
892 static int l_ ## nm (lua_State *L) { \
893 lua_Number a1 = luaL_checknumber (L, 1); \
894 lua_Number a2 = luaL_checknumber (L, 2); \
895 double a3; \
896 double a4; \
897 nm (a1,a2,&a3,&a4); \
898 lua_pushnumber (L, a3); \
899 lua_pushnumber (L, a4); \
900 return 2; \
902 #define v_ddd(nm) \
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); \
907 nm (a1,a2,a3); \
908 return 0; \
910 #define v_dddK(nm) \
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); \
917 return 0; \
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); \
924 double a4; \
925 double a5; \
926 nm (a1,a2,a3,&a4,&a5); \
927 lua_pushnumber (L, a4); \
928 lua_pushnumber (L, a5); \
929 return 2; \
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); \
936 double a4; \
937 double a5; \
938 double a6; \
939 nm (a1,a2,a3,&a4,&a5,&a6); \
940 lua_pushnumber (L, a4); \
941 lua_pushnumber (L, a5); \
942 lua_pushnumber (L, a6); \
943 return 3; \
945 #define v_dddd(nm) \
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); \
951 nm (a1,a2,a3,a4); \
952 return 0; \
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); \
964 return 0; \
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); \
974 return 0; \
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); \
985 return 0; \
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); \
995 double a7; \
996 double a8; \
997 double a9; \
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); \
1002 return 3; \
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); \
1014 return 0; \
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); \
1027 return 0; \
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); \
1041 return 0; \
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); \
1058 return 0; \
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); \
1070 return 0; \
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); \
1080 return 0; \
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); \
1094 return 0; \
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); \
1109 return 0; \
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); \
1120 return 0; \
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); \
1130 return 0; \
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); \
1140 return 0; \
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); \
1148 nm (a1,a2,a3,a4); \
1149 return 0; \
1151 #define v_dii(nm) \
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); \
1156 nm (a1,a2,a3); \
1157 return 0; \
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); \
1165 nm (a1,a2,a3,a4); \
1166 return 0; \
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); \
1176 return 0; \
1178 #define v_i(nm) \
1179 static int l_ ## nm (lua_State *L) { \
1180 lua_Integer a1 = luaL_checkinteger (L, 1); \
1181 nm (a1); \
1182 return 0; \
1184 #define v_iJJJ(nm) \
1185 static int l_ ## nm (lua_State *L) { \
1186 lua_Integer a1 = luaL_checkinteger (L, 1); \
1187 lua_Integer a2; \
1188 lua_Integer a3; \
1189 lua_Integer a4; \
1190 nm (a1,&a2,&a3,&a4); \
1191 lua_pushinteger (L, a2); \
1192 lua_pushinteger (L, a3); \
1193 lua_pushinteger (L, a4); \
1194 return 3; \
1196 #define v_iK(nm) \
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); \
1201 return 0; \
1203 #define v_iKK(nm) \
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); \
1209 return 0; \
1211 #define v_iRRR(nm) \
1212 static int l_ ## nm (lua_State *L) { \
1213 lua_Integer a1 = luaL_checkinteger (L, 1); \
1214 double a2; \
1215 double a3; \
1216 double a4; \
1217 nm (a1,&a2,&a3,&a4); \
1218 lua_pushnumber (L, a2); \
1219 lua_pushnumber (L, a3); \
1220 lua_pushnumber (L, a4); \
1221 return 3; \
1223 #define v_id(nm) \
1224 static int l_ ## nm (lua_State *L) { \
1225 lua_Integer a1 = luaL_checkinteger (L, 1); \
1226 lua_Number a2 = luaL_checknumber (L, 2); \
1227 nm (a1,a2); \
1228 return 0; \
1230 #define v_idK(nm) \
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); \
1236 return 0; \
1238 #define v_idd(nm) \
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); \
1243 nm (a1,a2,a3); \
1244 return 0; \
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); \
1252 nm (a1,a2,a3,a4); \
1253 return 0; \
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); \
1263 return 0; \
1265 #define v_ii(nm) \
1266 static int l_ ## nm (lua_State *L) { \
1267 lua_Integer a1 = luaL_checkinteger (L, 1); \
1268 lua_Integer a2 = luaL_checkinteger (L, 2); \
1269 nm (a1,a2); \
1270 return 0; \
1272 #define v_iiJ(nm) \
1273 static int l_ ## nm (lua_State *L) { \
1274 lua_Integer a1 = luaL_checkinteger (L, 1); \
1275 lua_Integer a2 = luaL_checkinteger (L, 2); \
1276 lua_Integer a3; \
1277 nm (a1,a2,&a3); \
1278 lua_pushinteger (L, a3); \
1279 return 1; \
1281 #define v_iiK(nm) \
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); \
1287 return 0; \
1289 #define v_iid(nm) \
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); \
1294 nm (a1,a2,a3); \
1295 return 0; \
1297 #define v_iii(nm) \
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); \
1302 nm (a1,a2,a3); \
1303 return 0; \
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); \
1312 return 0; \
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); \
1322 return 0; \
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); \
1330 nm (a1,a2,a3,a4); \
1331 return 0; \
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); \
1341 return 0; \
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); \
1353 return 0; \
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); \
1365 return 0; \
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); \
1375 return 0; \
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); \
1386 return 0; \
1388 #define v_v(nm) \
1389 static int l_ ## nm (lua_State *L) { \
1390 nm (); \
1391 return 0; \
1394 #define CUSTOM(nm) static int l_ ## nm (lua_State *L); /* custom impl */
1396 v_dddRR(abs3pt)
1397 v_KdiK(addlab)
1398 v_i(angle)
1399 v_iiiiddd(arcell)
1400 v_IIi(areaf)
1401 v_ii(autres)
1402 v_v(ax2grf)
1403 v_iii(ax3len)
1404 v_iKK(axclrs)
1405 v_KK(axends)
1406 v_v(axgit)
1407 v_ddd(axis3d)
1408 v_i(axsbgd)
1409 v_ii(axslen)
1410 v_ii(axsorg)
1411 v_ii(axspos)
1412 v_KK(axsscl)
1413 v_K(axstyp)
1414 v_i(barbor)
1415 v_iii(barclr)
1416 v_id(bargrp)
1417 v_KK(barmod)
1418 v_dd(baropt)
1419 v_K(barpos)
1420 CUSTOM(bars)
1421 v_DDDDDDIi(bars3d)
1422 v_K(bartyp)
1423 v_d(barwth)
1424 v_K(basalf)
1425 v_iii(basdat)
1426 CUSTOM(bezier)
1427 s_isisi(bitsi2)
1428 i_iiiii(bitsi4)
1429 v_K(bmpfnt)
1430 v_v(box2d)
1431 v_v(box3d)
1432 v_v(center)
1433 v_ddd(cgmbgd)
1434 v_K(cgmpic)
1435 v_i(cgmver)
1436 v_d(chaang)
1437 v_K(chacod)
1438 v_d(chaspc)
1439 v_d(chawth)
1440 v_v(chnatt)
1441 v_K(chnbar)
1442 v_K(chncrv)
1443 v_v(chndot)
1444 v_v(chndsh)
1445 v_K(chnpie)
1446 v_ddddddRRR(circ3p)
1447 v_iii(circle)
1448 v_i(circsp)
1449 v_K(clip3d)
1450 v_K(clpbor)
1451 v_K(clpmod)
1452 v_iiii(clpwin)
1453 v_ii(clrcyc)
1454 v_K(clrmod)
1455 v_i(clswin)
1456 v_K(color)
1457 v_ii(colran)
1458 CUSTOM(colray)
1459 v_v(complx)
1460 v_Ii(conclr)
1461 v_DDid(concrv)
1462 v_DDDiIIIiDi(confll)
1463 v_d(congap)
1464 v_K(conlab)
1465 v_Diid(conmat)
1466 v_dd(conmod)
1467 v_ddd(conn3d)
1468 v_dd(connpt)
1469 CUSTOM(conpts)
1470 v_DiDiDDi(conshd)
1471 v_DDDiIIIid(contri)
1472 v_DiDiDd(contur)
1473 v_v(cross)
1474 v_Diiii(crvmat)
1475 v_DDDiIIIi(crvtri)
1476 v_KK(csrmod)
1477 i_JJ(csrpos)
1478 v_JJ(csrpt1)
1479 v_K(csrtyp)
1480 v_K(csruni)
1481 v_DDDi(curv3d)
1482 v_DDi(curve)
1483 v_DDDi(curve3)
1484 v_DDi(curvmp)
1485 v_DdDi(curvx3)
1486 v_dDDi(curvy3)
1487 v_v(dash)
1488 v_v(dashl)
1489 v_v(dashm)
1490 v_v(delglb)
1491 v_v(disalf)
1492 v_v(disfin)
1493 CUSTOM(disini)
1494 v_v(dot)
1495 v_v(dotl)
1496 v_v(duplx)
1497 i_Ki(dwgbut)
1498 C_KKK(dwgfil)
1499 i_KKi(dwglis)
1500 v_K(dwgmsg)
1501 C_KK(dwgtxt)
1502 v_iiii(ellips)
1503 v_v(endgrf)
1504 v_v(erase)
1505 v_DDDDi(errbar)
1506 v_K(errdev)
1507 v_K(errfil)
1508 v_KK(errmod)
1509 v_KK(eushft)
1510 v_K(expzlb)
1511 v_DDDDii(field)
1512 v_iiii(filbox)
1513 v_K(filclr)
1514 v_K(filmod)
1515 v_d(fixspc)
1516 v_v(flab3d)
1517 i_di(flen)
1518 v_i(frame)
1519 v_i(frmclr)
1520 v_i(frmess)
1521 v_d(gapcrv)
1522 K_v(getalf)
1523 i_v(getang)
1524 i_v(getbpp)
1525 v_JJJJ(getclp)
1526 i_v(getclr)
1527 v_JJJ(getdig)
1528 K_v(getdsp)
1529 K_v(getfil)
1530 v_RRRRK(getgrf)
1531 i_v(gethgt)
1532 i_v(gethnm)
1533 v_iRRR(getind)
1534 CUSTOM(getlab)
1535 v_JJJ(getlen)
1536 i_v(getlev)
1537 i_v(getlin)
1538 i_dddddd(getlit)
1539 CUSTOM(getmat)
1540 K_v(getmfl)
1541 K_K(getmix)
1542 v_JJ(getor)
1543 v_JJ(getpag)
1544 i_v(getpat)
1545 i_v(getplv)
1546 v_JJ(getpos)
1547 v_JJ(getran)
1548 v_JJ(getres)
1549 v_RRR(getrgb)
1550 v_JJJ(getscl)
1551 v_JJ(getscr)
1552 K_K(getshf)
1553 v_JJJ(getsp1)
1554 v_JJJ(getsp2)
1555 v_JJ(getsym)
1556 v_JJ(gettcl)
1557 v_JJJ(gettic)
1558 i_v(gettyp)
1559 d_v(getver)
1560 v_JJJ(getvk)
1561 K_v(getvlt)
1562 i_v(getwid)
1563 v_JJJJ(getwin)
1564 i_K(getxid)
1565 v_KK(gifmod)
1566 i_KAA(gmxalf)
1567 v_v(gothic)
1568 v_i(grace)
1569 v_dddddddd(graf)
1570 v_dddddddddddd(graf3)
1571 v_dddddddddddd(graf3d)
1572 v_dddddddd(grafmp)
1573 v_ii(grdpol)
1574 v_v(grffin)
1575 v_ddddddddd(grfini)
1576 v_ii(grid)
1577 v_iiK(grid3d)
1578 v_ii(gridmp)
1579 i_iK(gwgatt)
1580 i_i(gwgbox)
1581 i_i(gwgbut)
1582 CUSTOM(gwgfil)
1583 i_i(gwglis)
1584 d_i(gwgscl)
1585 CUSTOM(gwgtxt)
1586 i_i(gwgxid)
1587 v_i(height)
1588 v_v(helve)
1589 v_v(helves)
1590 CUSTOM(histog)
1591 v_i(hname)
1592 v_dddRRR(hsvrgb)
1593 v_i(hsymbl)
1594 v_i(htitle)
1595 v_v(hwfont)
1596 v_ii(hworig)
1597 v_ii(hwpage)
1598 v_iiii(imgbox)
1599 v_iiii(imgclp)
1600 v_v(imgfin)
1601 v_K(imgfmt)
1602 v_v(imgini)
1603 v_K(imgmod)
1604 v_ii(imgsiz)
1605 v_i(inccrv)
1606 i_iii(incdat)
1607 v_K(incfil)
1608 v_i(incmrk)
1609 i_ddd(indrgb)
1610 v_v(intax)
1611 i_i(intlen)
1612 i_ddd(intrgb)
1613 i_K(itmcnt)
1614 C_Ki(itmstr)
1615 v_iK(labclr)
1616 v_iK(labdig)
1617 v_iK(labdis)
1618 v_KK(labels)
1619 v_KK(labjus)
1620 v_K(labl3d)
1621 v_KKK(labmod)
1622 v_KK(labpos)
1623 v_KK(labtyp)
1624 v_v(legclr)
1625 CUSTOM(legend)
1626 CUSTOM(legini)
1627 CUSTOM(leglin)
1628 v_ddd(legopt)
1629 v_iiiiii(legpat)
1630 v_ii(legpos)
1631 v_K(legtit)
1632 v_v(lfttit)
1633 v_K(light)
1634 v_ii(lincyc)
1635 v_iiii(line)
1636 v_d(linesp)
1637 v_i(lintyp)
1638 v_i(linwid)
1639 v_iK(litmod)
1640 v_idddK(litop3)
1641 v_idK(litopt)
1642 v_idddK(litpos)
1643 v_K(lncap)
1644 v_K(lnjoin)
1645 v_d(lnmlt)
1646 v_K(logtic)
1647 v_K(mapbas)
1648 v_KK(mapfil)
1649 v_K(maplev)
1650 v_K(mapmod)
1651 v_dd(mappol)
1652 v_dd(mapref)
1653 v_d(mapsph)
1654 v_i(marker)
1655 v_dddK(matop3)
1656 v_dK(matopt)
1657 v_iid(mdfmat)
1658 v_Kii(messag)
1659 v_K(metafl)
1660 v_v(mixalf)
1661 v_v(mixleg)
1662 v_i(mpaepl)
1663 v_d(mplang)
1664 v_ii(mplclr)
1665 v_ii(mplpos)
1666 v_i(mplsiz)
1667 v_iiiK(mpslogo)
1668 v_K(msgbox)
1669 v_i(mshclr)
1670 v_KiK(mylab)
1671 v_Ii(myline)
1672 v_iiii(mypat)
1673 v_DDiii(mysymb)
1674 v_DDDi(myvlt)
1675 v_iK(namdis)
1676 v_KK(name)
1677 v_KK(namjus)
1678 v_d(neglog)
1679 v_v(newmix)
1680 v_v(newpag)
1681 i_K(nlmess)
1682 i_di(nlnumb)
1683 v_v(noarln)
1684 v_v(nobar)
1685 v_v(nobgd)
1686 v_v(nochek)
1687 v_v(noclip)
1688 v_v(nofill)
1689 v_v(nograf)
1690 v_v(nohide)
1691 v_K(noline)
1692 v_diii(number)
1693 v_K(numfmt)
1694 v_KKKK(numode)
1695 i_iii(nwkday)
1696 CUSTOM(nxlegn)
1697 i_d(nxposn)
1698 CUSTOM(nylegn)
1699 i_d(nyposn)
1700 i_d(nzposn)
1701 v_i(opnwin)
1702 v_ii(origin)
1703 v_ii(page)
1704 v_v(pagera)
1705 v_i(pagfll)
1706 v_KKii(paghdr)
1707 v_K(pagmod)
1708 v_K(pagorg)
1709 v_ii(patcyc)
1710 CUSTOM(pdfbuf)
1711 v_KK(pdfmod)
1712 v_KK(pdfmrk)
1713 v_d(penwid)
1714 v_iiidd(pie)
1715 v_i(piebor)
1716 v_IIi(pieclr)
1717 v_v(pieexp)
1718 CUSTOM(piegrf)
1719 v_KK(pielab)
1720 v_dd(pieopt)
1721 v_K(pietyp)
1722 v_iK(pievec)
1723 v_KK(pngmod)
1724 v_iiiii(point)
1725 v_ddddd(polar)
1726 v_K(polcrv)
1727 v_KK(polmod)
1728 v_ddRR(pos2pt)
1729 v_dddRRR(pos3pt)
1730 v_K(projct)
1731 v_K(psfont)
1732 v_K(psmode)
1733 v_Di(qplbar)
1734 v_Dii(qplclr)
1735 v_Diii(qplcon)
1736 v_DDi(qplot)
1737 v_Di(qplpie)
1738 v_DDi(qplsca)
1739 v_Dii(qplsur)
1740 CUSTOM(rbfpng)
1741 v_K(rbmp)
1742 v_v(reawgt)
1743 v_iiiii(recfll)
1744 v_iiii(rectan)
1745 v_dddRR(rel3pt)
1746 v_v(resatt)
1747 v_K(reset)
1748 v_v(revscr)
1749 v_dddRRR(rgbhsv)
1750 v_K(rgif)
1751 v_v(rgtlab)
1752 v_K(rimage)
1753 v_ddddddd(rlarc)
1754 v_DDi(rlarea)
1755 v_ddd(rlcirc)
1756 v_dd(rlconn)
1757 v_dddd(rlell)
1758 v_dddd(rline)
1759 v_Kdd(rlmess)
1760 v_didd(rlnumb)
1761 v_ddddd(rlpie)
1762 v_ddiii(rlpoin)
1763 v_dddd(rlrec)
1764 v_ddddi(rlrnd)
1765 v_ddddddi(rlsec)
1766 v_dd(rlstrt)
1767 v_idd(rlsymb)
1768 v_ddddi(rlvec)
1769 v_dddid(rlwind)
1770 v_iiiii(rndrec)
1771 v_iiJ(rpixel)
1772 v_K(rpng)
1773 v_K(rppm)
1774 v_K(rtiff)
1775 v_v(rvynam)
1776 v_d(sclfac)
1777 v_K(sclmod)
1778 v_K(scrmod)
1779 v_iiiiddi(sector)
1780 v_i(selwin)
1781 v_v(sendbf)
1782 v_v(sendmb)
1783 v_v(sendok)
1784 v_v(serif)
1785 v_d(setbas)
1786 CUSTOM(setcbk)
1787 v_i(setclr)
1788 v_K(setcsr)
1789 v_d(setexp)
1790 v_K(setfil)
1791 v_KKKK(setgrf)
1792 v_iddd(setind)
1793 v_KK(setmix)
1794 v_K(setpag)
1795 v_ii(setres)
1796 v_ddd(setrgb)
1797 v_DiK(setscl)
1798 v_K(setvlt)
1799 v_iK(setxid)
1800 v_ILIi(shdafr)
1801 v_v(shdcha)
1802 v_DDiDDi(shdcrv)
1803 v_ILIi(shdeur)
1804 v_K(shdmap)
1805 v_KK(shdmod)
1806 v_i(shdpat)
1807 v_ILIi(shdusa)
1808 v_KK(shield)
1809 v_iii(shlcir)
1810 v_i(shldel)
1811 v_iiiid(shlell)
1812 i_v(shlind)
1813 v_iiidd(shlpie)
1814 v_IIi(shlpol)
1815 v_iiiid(shlrct)
1816 v_iiii(shlrec)
1817 v_i(shlres)
1818 v_v(shlsur)
1819 v_iK(shlvis)
1820 v_v(simplx)
1821 v_KKKi(smxalf)
1822 v_v(solid)
1823 CUSTOM(sortr1)
1824 CUSTOM(sortr2)
1825 v_ddddii(sphe3d)
1826 CUSTOM(spline)
1827 CUSTOM(splmod)
1828 v_ddd(strt3d)
1829 v_dd(strtpt)
1830 v_ii(surclr)
1831 v_DiDiD(surfce)
1832 CUSTOM(surfcp)
1833 CUSTOM(surfun)
1834 v_DiDiDiDd(suriso)
1835 v_Diiii(surmat)
1836 v_K(surmsh)
1837 v_K(suropt)
1838 v_DiDiD(surshd)
1839 v_dddd(sursze)
1840 v_DDDiIIIi(surtri)
1841 v_K(survis)
1842 v_iKK(swgatt)
1843 v_ii(swgbox)
1844 v_ii(swgbut)
1845 CUSTOM(swgcbk)
1846 v_dddK(swgclr)
1847 v_d(swgdrw)
1848 v_iK(swgfil)
1849 v_Ki(swgfnt)
1850 v_i(swgfoc)
1851 v_K(swghlp)
1852 v_KK(swgjus)
1853 v_ii(swglis)
1854 v_KK(swgmix)
1855 v_iK(swgmrg)
1856 v_ii(swgoff)
1857 v_KK(swgopt)
1858 v_K(swgpop)
1859 v_ii(swgpos)
1860 v_id(swgscl)
1861 v_ii(swgsiz)
1862 v_dd(swgspc)
1863 v_d(swgstp)
1864 v_K(swgtit)
1865 v_iK(swgtxt)
1866 v_KK(swgtyp)
1867 v_iiii(swgwin)
1868 v_i(swgwth)
1869 v_iii(symbol)
1870 v_KK(symfil)
1871 v_d(symrot)
1872 v_K(texmod)
1873 v_KK(texopt)
1874 v_dK(texval)
1875 v_i(thkcrv)
1876 v_v(thrfin)
1877 v_i(thrini)
1878 v_iK(ticks)
1879 v_ii(ticlen)
1880 v_KK(ticmod)
1881 v_KK(ticpos)
1882 v_iKK(tifmod)
1883 v_ii(tiforg)
1884 v_iiii(tifwin)
1885 v_v(timopt)
1886 v_K(titjus)
1887 v_v(title)
1888 v_Ki(titlin)
1889 v_K(titpos)
1890 CUSTOM(trfco1)
1891 CUSTOM(trfco2)
1892 CUSTOM(trfco3)
1893 v_iJJJ(trfdat)
1894 CUSTOM(trfmat)
1895 CUSTOM(trfrel)
1896 v_v(trfres)
1897 v_dii(trfrot)
1898 v_dd(trfscl)
1899 v_ii(trfshf)
1900 CUSTOM(triang)
1901 v_DD(trifll)
1902 v_v(triplx)
1903 CUSTOM(tripts)
1904 i_K(trmlen)
1905 v_K(txtjus)
1906 CUSTOM(unit)
1907 v_K(units)
1908 v_d(vang3d)
1909 v_dd(vclp3d)
1910 v_iiiii(vector)
1911 v_ddddddi(vectr3)
1912 v_dddK(vfoc3d)
1913 v_dddK(view3d)
1914 v_i(vkxbar)
1915 v_i(vkybar)
1916 v_i(vkytit)
1917 v_KK(vltfil)
1918 v_d(vup3d)
1919 i_iK(wgapp)
1920 i_iK(wgbas)
1921 i_iKi(wgbox)
1922 i_iKi(wgbut)
1923 i_iKK(wgcmd)
1924 i_iKi(wgdlis)
1925 i_i(wgdraw)
1926 i_iKKK(wgfil)
1927 v_v(wgfin)
1928 i_K(wgini)
1929 i_iK(wglab)
1930 i_iKi(wglis)
1931 i_iKKi(wgltxt)
1932 i_i(wgok)
1933 i_iK(wgpbut)
1934 i_iK(wgpop)
1935 i_i(wgquit)
1936 i_iKdddi(wgscl)
1937 i_iii(wgstxt)
1938 i_iK(wgtxt)
1939 v_i(widbar)
1940 v_K(wimage)
1941 v_K(winapp)
1942 v_diiid(windbr)
1943 v_iiii(window)
1944 v_K(winfnt)
1945 i_v(winid)
1946 v_K(winkey)
1947 v_K(winmod)
1948 v_iK(winopt)
1949 v_ii(winsiz)
1950 v_K(wintit)
1951 v_KK(wmfmod)
1952 v_v(world)
1953 v_iii(wpixel)
1954 v_Kiiii(wpixls)
1955 v_Kiii(wpxrow)
1956 v_K(wtiff)
1957 v_KK(x11fnt)
1958 v_K(x11mod)
1959 d_dd(x2dpos)
1960 d_ddd(x3dabs)
1961 d_ddd(x3dpos)
1962 d_ddd(x3drel)
1963 v_v(xaxgit)
1964 v_ddddiKiii(xaxis)
1965 v_ddddiKiii(xaxlg)
1966 v_ddddKii(xaxmap)
1967 v_v(xcross)
1968 v_dd(xdraw)
1969 d_i(xinvrs)
1970 v_dd(xmove)
1971 d_d(xposn)
1972 d_dd(y2dpos)
1973 d_ddd(y3dabs)
1974 d_ddd(y3dpos)
1975 d_ddd(y3drel)
1976 v_v(yaxgit)
1977 v_ddddiKiii(yaxis)
1978 v_ddddiKiii(yaxlg)
1979 v_ddddKii(yaxmap)
1980 v_v(ycross)
1981 d_i(yinvrs)
1982 d_d(yposn)
1983 d_ddd(z3dpos)
1984 v_ddddiKiiii(zaxis)
1985 v_ddddiKiiii(zaxlg)
1986 v_v(zbffin)
1987 i_v(zbfini)
1988 v_dddddd(zbflin)
1989 v_DDDI(zbftri)
1990 v_dd(zscale)
1992 static const luaL_reg ldislin_lib[] =
1994 {"abs3pt", l_abs3pt},
1995 {"addlab", l_addlab},
1996 {"angle", l_angle},
1997 {"arcell", l_arcell},
1998 {"areaf", l_areaf},
1999 {"autres", l_autres},
2000 {"ax2grf", l_ax2grf},
2001 {"ax3len", l_ax3len},
2002 {"axclrs", l_axclrs},
2003 {"axends", l_axends},
2004 {"axgit", l_axgit},
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},
2018 {"bars", l_bars},
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},
2028 {"box2d", l_box2d},
2029 {"box3d", l_box3d},
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},
2054 {"color", l_color},
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},
2071 {"cross", l_cross},
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},
2080 {"curve", l_curve},
2081 {"curve3", l_curve3},
2082 {"curvmp", l_curvmp},
2083 {"curvx3", l_curvx3},
2084 {"curvy3", l_curvy3},
2085 {"dash", l_dash},
2086 {"dashl", l_dashl},
2087 {"dashm", l_dashm},
2088 {"delglb", l_delglb},
2089 {"disalf", l_disalf},
2090 {"disfin", l_disfin},
2091 {"disini", l_disini},
2092 {"dot", l_dot},
2093 {"dotl", l_dotl},
2094 {"duplx", l_duplx},
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},
2102 {"erase", l_erase},
2103 {"errbar", l_errbar},
2104 {"errdev", l_errdev},
2105 {"errfil", l_errfil},
2106 {"errmod", l_errmod},
2107 {"eushft", l_eushft},
2108 {"expzlb", l_expzlb},
2109 {"field", l_field},
2110 {"filbox", l_filbox},
2111 {"filclr", l_filclr},
2112 {"filmod", l_filmod},
2113 {"fixspc", l_fixspc},
2114 {"flab3d", l_flab3d},
2115 {"flen", l_flen},
2116 {"frame", l_frame},
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},
2140 {"getor", l_getor},
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},
2158 {"getvk", l_getvk},
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},
2166 {"grace", l_grace},
2167 {"graf", l_graf},
2168 {"graf3", l_graf3},
2169 {"graf3d", l_graf3d},
2170 {"grafmp", l_grafmp},
2171 {"grdpol", l_grdpol},
2172 {"grffin", l_grffin},
2173 {"grfini", l_grfini},
2174 {"grid", l_grid},
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},
2186 {"helve", l_helve},
2187 {"helves", l_helves},
2188 {"histog", l_histog},
2189 {"hname", l_hname},
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},
2208 {"intax", l_intax},
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},
2231 {"light", l_light},
2232 {"lincyc", l_lincyc},
2233 {"line", l_line},
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},
2241 {"lncap", l_lncap},
2242 {"lnjoin", l_lnjoin},
2243 {"lnmlt", l_lnmlt},
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},
2268 {"mylab", l_mylab},
2269 {"myline", l_myline},
2270 {"mypat", l_mypat},
2271 {"mysymb", l_mysymb},
2272 {"myvlt", l_myvlt},
2273 {"namdis", l_namdis},
2274 {"name", l_name},
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},
2282 {"nobar", l_nobar},
2283 {"nobgd", l_nobgd},
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},
2301 {"page", l_page},
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},
2312 {"pie", l_pie},
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},
2322 {"point", l_point},
2323 {"polar", l_polar},
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},
2334 {"qplot", l_qplot},
2335 {"qplpie", l_qplpie},
2336 {"qplsca", l_qplsca},
2337 {"qplsur", l_qplsur},
2338 {"rbfpng", l_rbfpng},
2339 {"rbmp", l_rbmp},
2340 {"reawgt", l_reawgt},
2341 {"recfll", l_recfll},
2342 {"rectan", l_rectan},
2343 {"rel3pt", l_rel3pt},
2344 {"resatt", l_resatt},
2345 {"reset", l_reset},
2346 {"revscr", l_revscr},
2347 {"rgbhsv", l_rgbhsv},
2348 {"rgif", l_rgif},
2349 {"rgtlab", l_rgtlab},
2350 {"rimage", l_rimage},
2351 {"rlarc", l_rlarc},
2352 {"rlarea", l_rlarea},
2353 {"rlcirc", l_rlcirc},
2354 {"rlconn", l_rlconn},
2355 {"rlell", l_rlell},
2356 {"rline", l_rline},
2357 {"rlmess", l_rlmess},
2358 {"rlnumb", l_rlnumb},
2359 {"rlpie", l_rlpie},
2360 {"rlpoin", l_rlpoin},
2361 {"rlrec", l_rlrec},
2362 {"rlrnd", l_rlrnd},
2363 {"rlsec", l_rlsec},
2364 {"rlstrt", l_rlstrt},
2365 {"rlsymb", l_rlsymb},
2366 {"rlvec", l_rlvec},
2367 {"rlwind", l_rlwind},
2368 {"rndrec", l_rndrec},
2369 {"rpixel", l_rpixel},
2370 {"rpng", l_rpng},
2371 {"rppm", l_rppm},
2372 {"rtiff", l_rtiff},
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},
2382 {"serif", l_serif},
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},
2420 {"solid", l_solid},
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},
2476 {"ticks", l_ticks},
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},
2485 {"title", l_title},
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},
2504 {"unit", l_unit},
2505 {"units", l_units},
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},
2516 {"vup3d", l_vup3d},
2517 {"wgapp", l_wgapp},
2518 {"wgbas", l_wgbas},
2519 {"wgbox", l_wgbox},
2520 {"wgbut", l_wgbut},
2521 {"wgcmd", l_wgcmd},
2522 {"wgdlis", l_wgdlis},
2523 {"wgdraw", l_wgdraw},
2524 {"wgfil", l_wgfil},
2525 {"wgfin", l_wgfin},
2526 {"wgini", l_wgini},
2527 {"wglab", l_wglab},
2528 {"wglis", l_wglis},
2529 {"wgltxt", l_wgltxt},
2530 {"wgok", l_wgok},
2531 {"wgpbut", l_wgpbut},
2532 {"wgpop", l_wgpop},
2533 {"wgquit", l_wgquit},
2534 {"wgscl", l_wgscl},
2535 {"wgstxt", l_wgstxt},
2536 {"wgtxt", l_wgtxt},
2537 {"widbar", l_widbar},
2538 {"wimage", l_wimage},
2539 {"winapp", l_winapp},
2540 {"windbr", l_windbr},
2541 {"window", l_window},
2542 {"winfnt", l_winfnt},
2543 {"winid", l_winid},
2544 {"winkey", l_winkey},
2545 {"winmod", l_winmod},
2546 {"winopt", l_winopt},
2547 {"winsiz", l_winsiz},
2548 {"wintit", l_wintit},
2549 {"wmfmod", l_wmfmod},
2550 {"world", l_world},
2551 {"wpixel", l_wpixel},
2552 {"wpixls", l_wpixls},
2553 {"wpxrow", l_wpxrow},
2554 {"wtiff", l_wtiff},
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},
2562 {"xaxis", l_xaxis},
2563 {"xaxlg", l_xaxlg},
2564 {"xaxmap", l_xaxmap},
2565 {"xcross", l_xcross},
2566 {"xdraw", l_xdraw},
2567 {"xinvrs", l_xinvrs},
2568 {"xmove", l_xmove},
2569 {"xposn", l_xposn},
2570 {"y2dpos", l_y2dpos},
2571 {"y3dabs", l_y3dabs},
2572 {"y3dpos", l_y3dpos},
2573 {"y3drel", l_y3drel},
2574 {"yaxgit", l_yaxgit},
2575 {"yaxis", l_yaxis},
2576 {"yaxlg", l_yaxlg},
2577 {"yaxmap", l_yaxmap},
2578 {"ycross", l_ycross},
2579 {"yinvrs", l_yinvrs},
2580 {"yposn", l_yposn},
2581 {"z3dpos", l_z3dpos},
2582 {"zaxis", l_zaxis},
2583 {"zaxlg", l_zaxlg},
2584 {"zbffin", l_zbffin},
2585 {"zbfini", l_zbfini},
2586 {"zbflin", l_zbflin},
2587 {"zbftri", l_zbftri},
2588 {"zscale", l_zscale},
2589 {NULL, NULL}
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)
2662 double dr;
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);
2670 return dr;
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);
2685 return 0;
2688 static double l_surfun_callback (double x, double y)
2690 double dr;
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);
2697 return dr;
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);
2710 return 0;
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);
2733 return 0;
2736 static void l_prjfun_callback (double *x, double *y)
2738 // get function ptr
2739 lua_pushboolean (l_surfcp_L, 1); /* key is: true */
2740 lua_rawget (l_surfcp_L, LUA_ENVIRONINDEX);
2741 // get args
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);
2745 // return results
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);
2763 return 0;
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) {
2772 disini ();
2773 spline_npts = 200;
2774 return 0;
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);
2781 splmod (a1,a2);
2782 spline_npts = a2;
2783 return 0;
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];
2794 int nspl;
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);
2798 return 2;
2801 // ***************** LEGINI legend userdata functions *****************
2803 typedef struct l_legend_t
2805 int qlines;
2806 int lnsize;
2807 char lines[]; // qlines * qlines chars
2808 } l_legend_t;
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)
2830 l_legend_t *leg;
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;
2838 leg->lines[0] = 0;
2839 legini (leg->lines, qlines, lnsize);
2840 return 1;
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);
2852 return 0;
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);
2861 return 0;
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);
2872 return 0;
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);
2881 return 1;
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);
2890 return 1;
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},
2900 {NULL, NULL}
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);
2909 char r[260];
2910 gwgfil (i,r);
2911 lua_pushstring (L, r);
2912 return 1;
2915 // void gwgtxt (int id, char *ctext);
2916 static int l_gwgtxt (lua_State *L)
2918 lua_Integer i = luaL_checkinteger (L, 1);
2919 char r[260];
2920 gwgtxt (i,r);
2921 lua_pushstring (L, r);
2922 return 1;
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)
2929 char cx[68];
2930 char cy[68];
2931 char cz[68];
2932 getlab (cx,cy,cz);
2933 lua_pushstring (L, cx);
2934 lua_pushstring (L, cy);
2935 lua_pushstring (L, cz);
2936 return 3;
2939 // ***************** out bufs *****************
2941 // int rbfpng (char *cbuf, int nmax);
2942 static int l_rbfpng (lua_State *L)
2944 lua_Integer r;
2945 lua_Integer n = luaL_checkinteger (L, 1);
2946 char *buf = NULL;
2947 if (n != 0)
2949 buf = (char *) malloc (n);
2950 if (buf == NULL)
2952 lua_pushnil (L);
2953 lua_pushinteger (L, -1);
2954 return 2;
2957 r = rbfpng (buf, n);
2958 if (n == 0 || r < 0)
2959 lua_pushnil (L);
2960 else
2961 lua_pushlstring (L, buf, r);
2962 lua_pushinteger (L, r);
2963 return 2;
2966 // int pdfbuf (char *cbuf, int nmax);
2967 static int l_pdfbuf (lua_State *L)
2969 lua_Integer r;
2970 lua_Integer n = luaL_checkinteger (L, 1);
2971 char *buf = NULL;
2972 if (n != 0)
2974 buf = (char *) malloc (n);
2975 if (buf == NULL)
2977 lua_pushnil (L);
2978 lua_pushinteger (L, -1);
2979 return 2;
2982 r = pdfbuf (buf, n);
2983 if (n == 0 || r < 0)
2984 lua_pushnil (L);
2985 else
2986 lua_pushlstring (L, buf, r);
2987 lua_pushinteger (L, r);
2988 return 2;
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 */
3001 double *y = &x[n];
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);
3005 return 2;
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);
3016 return 1;
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);
3020 //v_DiDiDdEEiNiJ
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);
3031 int nlins;
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++)
3038 maxpts += nray[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);
3043 return 3;
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);
3047 //v_DDDiIIIidEEiNiJ
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);
3061 int nlins;
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++)
3068 maxpts += nray[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);
3073 return 3;
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);
3086 int zz = nx * ny;
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);
3093 if (rv)
3095 push_int_array_as_table (L, imat, zz);
3096 return 2;
3098 return 1;
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];
3108 int a5;
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);
3113 return 3;
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);
3122 sortr1 (a1,a2,a3);
3123 push_double_array_as_table (L, a1, a2);
3124 return 1;
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);
3137 return 2;
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);
3155 return 4;
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);
3167 return 1;
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);
3181 return 2;
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);
3197 return 3;
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);
3212 return 1;
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);
3221 trfrel (a1,a2,a3);
3222 push_double_array_as_table (L, a1, a3);
3223 push_double_array_as_table (L, a2, a3);
3224 return 2;
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));
3240 bars (a1,a2,a3,a4);
3241 if (rv)
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);
3246 return 3;
3248 return 0;
3251 // ***************** oddball *****************
3253 // void unit (void *fp);
3254 static int l_unit (lua_State *L)
3256 lua_Integer n = luaL_checkinteger (L, 1);
3257 if (n != 0)
3258 luaL_error (L, "Only UNIT(0) is supported");
3259 unit (0);
3260 return 0;
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);
3282 /** version */
3283 lua_pushliteral (L,"version");
3284 lua_pushliteral (L, DN_VERSION);
3285 lua_settable (L, -3);
3286 return 1;