lib_glue.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. #include <squirrel.h>
  2. #include <sqstdblob.h>
  3. #include "n2DLib/n2DLib.h"
  4. SQInteger register_global_func(HSQUIRRELVM v,SQFUNCTION f,const char *fname)
  5. {
  6. sq_pushroottable(v);
  7. sq_pushstring(v,fname,-1);
  8. sq_newclosure(v,f,0); //create a new function
  9. sq_newslot(v,-3, SQFalse);
  10. sq_pop(v,1); //pops the root table
  11. return 0;
  12. }
  13. SQRESULT register_lib(HSQUIRRELVM v, const SQChar *lib_name, const SQRegFunction *reg)
  14. {
  15. SQInteger top = sq_gettop(v);
  16. sq_pushstring(v,lib_name,-1);
  17. sq_newtable(v);
  18. int i = 0;
  19. while(reg[i].name != NULL) {
  20. const SQRegFunction* fun = &reg[i];
  21. sq_pushstring(v, fun->name, -1);
  22. sq_newclosure(v, fun->f, 0);
  23. sq_setparamscheck(v, fun->nparamscheck, fun->typemask);
  24. sq_setnativeclosurename(v, -1, fun->name);
  25. sq_newslot(v, -3, SQFalse);
  26. i++;
  27. }
  28. sq_newslot(v, -3, SQFalse);
  29. sq_settop(v,top);
  30. return SQ_ERROR;
  31. }
  32. //////////////////
  33. // n2DLib glue. //
  34. //////////////////
  35. // Key glue data
  36. #define GLUE_KEY(x) &KEY_NSPIRE_ ## x,
  37. static const t_key const * key_array[] = {
  38. #include "n2dlib_keys.xmacro"
  39. };
  40. #undef GLUE_KEY
  41. #define GLUE_KEY(x) "NK_"#x ,
  42. static const char * key_array_names[] = {
  43. #include "n2dlib_keys.xmacro"
  44. };
  45. #undef GLUE_KEY
  46. // Utilities
  47. SQInteger n2d_itofix (HSQUIRRELVM v)
  48. {
  49. int i;
  50. sq_getinteger(v, 2, &i);
  51. sq_pushinteger(v, itofix(i));
  52. return 1;
  53. }
  54. SQInteger n2d_fixtoi (HSQUIRRELVM v)
  55. {
  56. Fixed f;
  57. sq_getinteger(v, 2, &f);
  58. sq_pushinteger(v, fixtoi(f));
  59. return 1;
  60. }
  61. SQInteger n2d_fixdiv (HSQUIRRELVM v)
  62. {
  63. Fixed x, y;
  64. sq_getinteger(v, 2, &x);
  65. sq_getinteger(v, 3, &y);
  66. sq_pushinteger(v, fixdiv(x, y));
  67. }
  68. SQInteger n2d_fixmul (HSQUIRRELVM v)
  69. {
  70. Fixed x, y;
  71. sq_getinteger(v, 2, &x);
  72. sq_getinteger(v, 3, &y);
  73. sq_pushinteger(v, fixmul(x, y));
  74. return 1;
  75. }
  76. SQInteger n2d_fixcos (HSQUIRRELVM v)
  77. {
  78. Fixed angle;
  79. sq_getinteger(v, 2, &angle);
  80. sq_pushinteger(v, fixcos(angle));
  81. return 1;
  82. }
  83. SQInteger n2d_fixsin (HSQUIRRELVM v)
  84. {
  85. Fixed angle;
  86. sq_getinteger(v, 2, &angle);
  87. sq_pushinteger(v, fixsin(angle));
  88. return 1;
  89. }
  90. // Drawing routines
  91. SQInteger n2d_initBuffering (HSQUIRRELVM v)
  92. {
  93. initBuffering();
  94. return 0;
  95. }
  96. SQInteger n2d_updateScreen (HSQUIRRELVM v)
  97. {
  98. updateScreen();
  99. return 0;
  100. }
  101. SQInteger n2d_deinitBuffering (HSQUIRRELVM v)
  102. {
  103. deinitBuffering();
  104. return 0;
  105. }
  106. SQInteger n2d_clearBuffer (HSQUIRRELVM v)
  107. {
  108. unsigned int color;
  109. sq_getinteger(v, 2, &color);
  110. clearBuffer((unsigned short) color);
  111. return 0;
  112. }
  113. SQInteger n2d_clearBufferB (HSQUIRRELVM v)
  114. {
  115. clearBufferB();
  116. return 0;
  117. }
  118. SQInteger n2d_clearBufferW (HSQUIRRELVM v)
  119. {
  120. clearBufferW();
  121. return 0;
  122. }
  123. SQInteger n2d_getPixel (HSQUIRRELVM v)
  124. {
  125. SQUserPointer image;
  126. unsigned int x, y;
  127. sqstd_getblob(v, 2, &image);
  128. sq_getinteger(v, 3, &x);
  129. sq_getinteger(v, 4, &y);
  130. unsigned int value = getPixel((unsigned short*) image, x, y);
  131. sq_pushinteger(v, value);
  132. return 1;
  133. }
  134. SQInteger n2d_setPixelUnsafe (HSQUIRRELVM v)
  135. {
  136. unsigned int x, y, color;
  137. sq_getinteger(v, 2, &x);
  138. sq_getinteger(v, 3, &y);
  139. sq_getinteger(v, 4, &color);
  140. setPixelUnsafe(x, y, (unsigned short)color);
  141. return 0;
  142. }
  143. SQInteger n2d_setPixel (HSQUIRRELVM v)
  144. {
  145. unsigned int x, y, color;
  146. sq_getinteger(v, 2, &x);
  147. sq_getinteger(v, 3, &y);
  148. sq_getinteger(v, 4, &color);
  149. setPixel(x, y, (unsigned short)color);
  150. return 0;
  151. }
  152. SQInteger n2d_setPixelRGB (HSQUIRRELVM v)
  153. {
  154. unsigned int x, y, r, g, b;
  155. sq_getinteger(v, 2, &x);
  156. sq_getinteger(v, 3, &y);
  157. sq_getinteger(v, 4, &r);
  158. sq_getinteger(v, 5, &g);
  159. sq_getinteger(v, 6, &b);
  160. setPixelRGB(x, y, (unsigned char)r, (unsigned char)g, (unsigned char)b);
  161. return 0;
  162. }
  163. SQInteger n2d_drawHLine (HSQUIRRELVM v)
  164. {
  165. int y, x1, x2;
  166. unsigned int color;
  167. sq_getinteger(v, 2, &y);
  168. sq_getinteger(v, 3, &x1);
  169. sq_getinteger(v, 4, &x2);
  170. sq_getinteger(v, 5, &color);
  171. drawHLine(y, x1, x2, color);
  172. return 0;
  173. }
  174. SQInteger n2d_drawVLine (HSQUIRRELVM v)
  175. {
  176. int x, y1, y2;
  177. unsigned int color;
  178. sq_getinteger(v, 2, &x);
  179. sq_getinteger(v, 3, &y1);
  180. sq_getinteger(v, 4, &y2);
  181. sq_getinteger(v, 5, &color);
  182. drawVLine(x, y1, y2, color);
  183. return 0;
  184. }
  185. SQInteger n2d_fillRect (HSQUIRRELVM v)
  186. {
  187. int x, y, w, h, color;
  188. sq_getinteger(v, 2, &x);
  189. sq_getinteger(v, 3, &y);
  190. sq_getinteger(v, 4, &w);
  191. sq_getinteger(v, 5, &h);
  192. sq_getinteger(v, 6, &color);
  193. fillRect(x, y, w, h, color);
  194. }
  195. SQInteger n2d_drawSprite (HSQUIRRELVM v)
  196. {
  197. SQUserPointer image;
  198. unsigned x, y, flash;
  199. unsigned int flash_color;
  200. sqstd_getblob(v, 2, &image);
  201. sq_getinteger(v, 3, &x);
  202. sq_getinteger(v, 4, &y);
  203. sq_getinteger(v, 5, &flash);
  204. sq_getinteger(v, 6, &flash_color);
  205. drawSprite((const unsigned short*)image, x, y, flash, (unsigned short) flash_color);
  206. return 0;
  207. }
  208. SQInteger n2d_drawSpritePart (HSQUIRRELVM v)
  209. {
  210. SQUserPointer image;
  211. unsigned x, y, flash;
  212. unsigned xp, yp, wp, hp;
  213. unsigned int flash_color;
  214. sqstd_getblob(v, 2, &image);
  215. sq_getinteger(v, 3, &x);
  216. sq_getinteger(v, 4, &y);
  217. sq_getinteger(v, 5, &xp);
  218. sq_getinteger(v, 6, &yp);
  219. sq_getinteger(v, 7, &wp);
  220. sq_getinteger(v, 8, &hp);
  221. sq_getinteger(v, 9, &flash);
  222. sq_getinteger(v, 10, &flash_color);
  223. Rect r = {x, y, wp, hp};
  224. drawSpritePart((const unsigned short*)image, x, y, &r, flash, (unsigned short) flash_color);
  225. return 0;
  226. }
  227. SQInteger n2d_drawSpriteScaled (HSQUIRRELVM v)
  228. {
  229. SQUserPointer image;
  230. int xs, ys, ws, hs, flash;
  231. unsigned int flash_color;
  232. sqstd_getblob(v, 2, &image);
  233. sq_getinteger(v, 3, &xs);
  234. sq_getinteger(v, 4, &ys);
  235. sq_getinteger(v, 5, &hs);
  236. sq_getinteger(v, 6, &ws);
  237. sq_getinteger(v, 7, &flash);
  238. sq_getinteger(v, 8, &flash_color);
  239. Rect r = {xs, ys, ws, hs};
  240. drawSpriteScaled((const unsigned short*)image, &r, flash, (unsigned short) flash_color);
  241. return 0;
  242. }
  243. SQInteger n2d_drawSpriteRotated (HSQUIRRELVM v)
  244. {
  245. SQUserPointer image;
  246. int xsr, ysr, wsr, hsr;
  247. int xrc, yrc, wrc, hrc;
  248. int angle, flash;
  249. unsigned int flash_color;
  250. sqstd_getblob(v, 2, &image);
  251. sq_getinteger(v, 3, &xsr);
  252. sq_getinteger(v, 4, &ysr);
  253. sq_getinteger(v, 5, &wsr);
  254. sq_getinteger(v, 6, &hsr);
  255. sq_getinteger(v, 7, &xrc);
  256. sq_getinteger(v, 8, &yrc);
  257. sq_getinteger(v, 9, &angle);
  258. sq_getinteger(v, 10, &flash);
  259. sq_getinteger(v, 11, &flash_color);
  260. Rect sr = {xsr, ysr, wsr, hsr};
  261. Rect rc = {xrc, yrc, 0, 0};
  262. drawSpriteRotated((const unsigned short*)image, &sr, &rc, (Fixed)angle, flash, flash_color);
  263. return 0;
  264. }
  265. SQInteger n2d_drawLine (HSQUIRRELVM v)
  266. {
  267. int x1, x2, y1, y2;
  268. unsigned int color;
  269. sq_getinteger(v, 2, &x1);
  270. sq_getinteger(v, 3, &y1);
  271. sq_getinteger(v, 4, &x2);
  272. sq_getinteger(v, 5, &y2);
  273. sq_getinteger(v, 6, &color);
  274. drawLine(x1, y1, x2, y2, color);
  275. return 0;
  276. }
  277. SQInteger n2d_fillCircle (HSQUIRRELVM v)
  278. {
  279. int x, y, r, color;
  280. sq_getinteger(v, 2, &x);
  281. sq_getinteger(v, 3, &y);
  282. sq_getinteger(v, 4, &r);
  283. sq_getinteger(v, 5, &color);
  284. fillCircle(x, y, r, color);
  285. return 0;
  286. }
  287. SQInteger n2d_fillEllipse (HSQUIRRELVM v)
  288. {
  289. int x, y, r, R, color;
  290. sq_getinteger(v, 2, &x);
  291. sq_getinteger(v, 3, &y);
  292. sq_getinteger(v, 4, &r);
  293. sq_getinteger(v, 5, &R);
  294. sq_getinteger(v, 6, &color);
  295. fillEllipse(x, y, r, R, color);
  296. return 0;
  297. }
  298. SQInteger n2d_drawString (HSQUIRRELVM v)
  299. {
  300. int x, y, margin;
  301. SQChar* str;
  302. unsigned int fc, olc;
  303. sq_getinteger(v, 2, &x);
  304. sq_getinteger(v, 3, &y);
  305. sq_getinteger(v, 4, &margin);
  306. sq_getstring(v, 5, (const SQChar**)&str);
  307. sq_getinteger(v, 6, &fc);
  308. sq_getinteger(v, 7, &olc);
  309. drawString(&x, &y, margin, (char*)str, fc, olc);
  310. // pushing new X/Y values.
  311. sq_newarray(v, 2);
  312. sq_pushinteger(v, x);
  313. sq_set(v, -2);
  314. sq_pushinteger(v, y);
  315. sq_set(v, -2);
  316. return 1;
  317. }
  318. SQInteger n2d_drawDecimal (HSQUIRRELVM v)
  319. {
  320. int x, y, n;
  321. unsigned int fc, olc;
  322. sq_getinteger(v, 2, &x);
  323. sq_getinteger(v, 3, &y);
  324. sq_getinteger(v, 4, &n);
  325. sq_getinteger(v, 5, &fc);
  326. sq_getinteger(v, 6, &olc);
  327. drawDecimal(&x, &y, n, (unsigned short)fc, (unsigned short)olc);
  328. // pushing new X/Y values.
  329. sq_newarray(v, 2);
  330. sq_pushinteger(v, x);
  331. sq_set(v, -2);
  332. sq_pushinteger(v, y);
  333. sq_set(v, -2);
  334. return 1;
  335. }
  336. SQInteger n2d_drawChar (HSQUIRRELVM v)
  337. {
  338. int x, y, margin, ch;
  339. unsigned int fc, olc;
  340. sq_getinteger(v, 2, &x);
  341. sq_getinteger(v, 3, &y);
  342. sq_getinteger(v, 4, &margin);
  343. sq_getinteger(v, 5, &ch);
  344. sq_getinteger(v, 6, &fc);
  345. sq_getinteger(v, 7, &olc);
  346. drawChar(&x, &y, margin, ch, fc, olc);
  347. // pushing new X/Y values.
  348. sq_newarray(v, 2);
  349. sq_pushinteger(v, x);
  350. sq_set(v, -2);
  351. sq_pushinteger(v, y);
  352. sq_set(v, -2);
  353. return 1;
  354. }
  355. SQInteger n2d_numberWidth (HSQUIRRELVM v)
  356. {
  357. int n;
  358. sq_getinteger(v, 2, &n);
  359. sq_pushinteger(v, numberWidth(n));
  360. return 1;
  361. }
  362. SQInteger n2d_stringWidth (HSQUIRRELVM v)
  363. {
  364. SQChar* str;
  365. sq_getstring(v, 2, (const SQChar**)&str);
  366. sq_pushinteger(v, stringWidth((const char*)str));
  367. return 1;
  368. }
  369. SQInteger n2d_getKeyPressed (HSQUIRRELVM v)
  370. {
  371. t_key collect;
  372. int result = get_key_pressed(&collect);
  373. if(result)
  374. {
  375. sq_newtable(v);
  376. sq_pushstring(v, "row", -1);
  377. sq_pushinteger(v, collect.row);
  378. sq_newslot(v, -3, SQFalse);
  379. sq_pushstring(v, "col", -1);
  380. sq_pushinteger(v, collect.col);
  381. sq_newslot(v, -3, SQFalse);
  382. sq_pushstring(v, "tpad_row", -1);
  383. sq_pushinteger(v, collect.tpad_row);
  384. sq_newslot(v, -3, SQFalse);
  385. sq_pushstring(v, "tpad_col", -1);
  386. sq_pushinteger(v, collect.tpad_col);
  387. sq_newslot(v, -3, SQFalse);
  388. sq_pushstring(v, "tpad_arrow", -1);
  389. sq_pushinteger(v, collect.tpad_arrow);
  390. sq_newslot(v, -3, SQFalse);
  391. }
  392. else
  393. {
  394. sq_newtable(v);
  395. sq_pushstring(v, "row", -1);
  396. sq_pushinteger(v, _KEY_DUMMY_ROW);
  397. sq_newslot(v, -3, SQFalse);
  398. sq_pushstring(v, "col", -1);
  399. sq_pushinteger(v, _KEY_DUMMY_COL);
  400. sq_newslot(v, -3, SQFalse);
  401. sq_pushstring(v, "tpad_row", -1);
  402. sq_pushinteger(v, _KEY_DUMMY_ROW);
  403. sq_newslot(v, -3, SQFalse);
  404. sq_pushstring(v, "tpad_col", -1);
  405. sq_pushinteger(v,_KEY_DUMMY_COL);
  406. sq_newslot(v, -3, SQFalse);
  407. sq_pushstring(v, "tpad_arrow", -1);
  408. sq_pushinteger(v, TPAD_ARROW_NONE);
  409. sq_newslot(v, -3, SQFalse);
  410. }
  411. return 1;
  412. }
  413. SQInteger n2d_isKey (HSQUIRRELVM v)
  414. {
  415. t_key collect;
  416. int arrow;
  417. int key_index;
  418. sq_getinteger(v, 3, &key_index);
  419. sq_pushstring(v, "row", -1);
  420. sq_get(v, 2);
  421. sq_getinteger(v, -1, &collect.row);
  422. sq_pushstring(v, "col", -1);
  423. sq_get(v, 2);
  424. sq_getinteger(v, -1, &collect.col);
  425. sq_pushstring(v, "tpad_row", -1);
  426. sq_get(v, 2);
  427. sq_getinteger(v, -1, &collect.tpad_row);
  428. sq_pushstring(v, "tpad_col", -1);
  429. sq_get(v, 2);
  430. sq_getinteger(v, -1, &collect.tpad_col);
  431. sq_pushstring(v, "tpad_arrow", -1);
  432. sq_get(v, 2);
  433. sq_getinteger(v, -1, &arrow);
  434. collect.tpad_arrow = arrow;
  435. if((key_index>=0) && (key_index < sizeof(key_array)/sizeof(t_key*)))
  436. {
  437. t_key* ref = key_array[key_index];
  438. sq_pushbool(v, isKey(collect, *ref));
  439. }
  440. else
  441. sq_pushbool(v, false);
  442. return 1;
  443. }
  444. SQInteger n2d_loadBMP (HSQUIRRELVM v)
  445. {
  446. SQChar *path;
  447. unsigned int transparency_color;
  448. sq_getstring(v, 2, (const SQChar**)&path);
  449. sq_getinteger(v, 3, &transparency_color);
  450. unsigned short *bmp = loadBMP((const char*)path, (unsigned short)transparency_color);
  451. if(bmp == NULL)
  452. {
  453. sq_pushnull(v);
  454. return 1;
  455. }
  456. int bmp_length = sizeof(unsigned short) * (bmp[0] * bmp[1] + 3);
  457. SQUserPointer blob = sqstd_createblob(v, bmp_length);
  458. memcpy(blob, bmp, bmp_length);
  459. free(bmp);
  460. return 1;
  461. }
  462. #define _DECL_GLOBALIO_FUNC(name,nparams,typecheck) {_SC(#name),n2d_##name,nparams,typecheck}
  463. static const SQRegFunction n2d_funcs[]={
  464. _DECL_GLOBALIO_FUNC(itofix,2,_SC(".i")),
  465. _DECL_GLOBALIO_FUNC(fixtoi,2,_SC(".i")),
  466. _DECL_GLOBALIO_FUNC(fixdiv,2,_SC(".ii")),
  467. _DECL_GLOBALIO_FUNC(fixmul,2,_SC(".ii")),
  468. _DECL_GLOBALIO_FUNC(fixsin,2,_SC(".i")),
  469. _DECL_GLOBALIO_FUNC(fixcos,2,_SC(".i")),
  470. _DECL_GLOBALIO_FUNC(initBuffering,1,_SC(".")),
  471. _DECL_GLOBALIO_FUNC(deinitBuffering,1,_SC(".")),
  472. _DECL_GLOBALIO_FUNC(updateScreen,1,_SC(".")),
  473. _DECL_GLOBALIO_FUNC(clearBuffer,2,_SC(".i")),
  474. _DECL_GLOBALIO_FUNC(clearBufferB,1,_SC(".")),
  475. _DECL_GLOBALIO_FUNC(clearBufferW,1,_SC(".")),
  476. _DECL_GLOBALIO_FUNC(getPixel,4,_SC(".sii")),
  477. _DECL_GLOBALIO_FUNC(setPixelUnsafe,4,_SC(".iii")),
  478. _DECL_GLOBALIO_FUNC(setPixel,4,_SC(".iii")),
  479. _DECL_GLOBALIO_FUNC(setPixelRGB,6,_SC(".iiiii")),
  480. _DECL_GLOBALIO_FUNC(drawHLine,5,_SC(".iiii")),
  481. _DECL_GLOBALIO_FUNC(drawVLine,5,_SC(".iiii")),
  482. _DECL_GLOBALIO_FUNC(fillRect,6,_SC(".iiiii")),
  483. _DECL_GLOBALIO_FUNC(drawSprite,6,_SC(".xiiii")),
  484. _DECL_GLOBALIO_FUNC(drawSpritePart,10,_SC(".xiiiiiiii")),
  485. _DECL_GLOBALIO_FUNC(drawSpriteScaled,8,_SC(".xiiiiiiii")),
  486. _DECL_GLOBALIO_FUNC(drawSpriteRotated,11,_SC(".xiiiiiiiii")),
  487. _DECL_GLOBALIO_FUNC(drawLine,6,_SC(".iiiii")),
  488. _DECL_GLOBALIO_FUNC(fillRect,6,_SC(".iiiii")),
  489. _DECL_GLOBALIO_FUNC(fillCircle,5,_SC(".iiii")),
  490. _DECL_GLOBALIO_FUNC(fillEllipse,5,_SC(".iiiii")),
  491. _DECL_GLOBALIO_FUNC(drawString,7,_SC(".iiisii")),
  492. _DECL_GLOBALIO_FUNC(drawDecimal,6,_SC(".iiiii")),
  493. _DECL_GLOBALIO_FUNC(drawChar,7,_SC(".iiiiiii")),
  494. _DECL_GLOBALIO_FUNC(numberWidth,2,_SC(".i")),
  495. _DECL_GLOBALIO_FUNC(stringWidth,2,_SC(".s")),
  496. _DECL_GLOBALIO_FUNC(getKeyPressed,1,_SC(".")),
  497. _DECL_GLOBALIO_FUNC(isKey,3,_SC(".ti")),
  498. _DECL_GLOBALIO_FUNC(loadBMP,3,_SC(".si")),
  499. {NULL,(SQFUNCTION)0,0,NULL}
  500. };
  501. SQRESULT register_keys (HSQUIRRELVM v)
  502. {
  503. SQInteger top = sq_gettop(v);
  504. SQObject enumeration_table;
  505. // Get const table
  506. sq_pushconsttable(v);
  507. // push new enum's name
  508. sq_pushstring(v,"n2dk",-1);
  509. // Create enum tale
  510. sq_newtable(v);
  511. // For each value, push it in the enum.
  512. for(int i = 0; i < sizeof(key_array)/sizeof(t_key*); i++)
  513. {
  514. // table.i = index;
  515. sq_pushstring(v, (SQChar*)key_array_names[i], -1);
  516. sq_pushinteger(v, i);
  517. sq_newslot(v, -3, false);
  518. }
  519. // Adding it to the const table
  520. sq_newslot(v, -3, SQFalse);
  521. // Popping the const table.
  522. sq_settop(v,top);
  523. }
  524. SQRESULT register_n2dlib (HSQUIRRELVM v)
  525. {
  526. register_keys(v);
  527. register_lib(v, _SC("n2d"), n2d_funcs);
  528. }
  529. #undef _DECL_GLOBALIO_FUNC