Nife version Beta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

643 lines
17 KiB

  1. /* Copyright (C) 2011-2013 Patrick H. E. Foubet - S.E.R.I.A.N.E.
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 3 of the License, or any
  5. later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>
  12. *******************************************************************/
  13. #include "conf.h"
  14. /* lib.c librairie de base */
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include "nife.h"
  19. #include "mth.h"
  20. #include "err.h"
  21. #include "histo.h"
  22. #include "foncs.h"
  23. #include "tasks.h"
  24. #include "stackN.h"
  25. #include "stackL.h"
  26. #include "stackC.h"
  27. #include "stackF.h"
  28. #include "stackV.h"
  29. #include "libmath.h"
  30. #include "help.h"
  31. #include "dev.h"
  32. #include "net.h"
  33. #include "gplot.h"
  34. #include "debug.h"
  35. /* familles des fonctions */
  36. #define F_CORE 1 /* Core */
  37. #define F_MATH 2 /* Mathematiques */
  38. #define F_PROG 4 /* Programmation, variables, tasks, ... */
  39. #define F_TOOL 8 /* External Tools Graphical or others */
  40. #define F_DEV 16 /* devices, comedi interfaces, ... */
  41. #define F_NET 32 /* networking functions */
  42. #define F_USR 64 /* user system functions */
  43. struct fonction {
  44. char * nam;
  45. void (* fct)(void);
  46. short typ; /* 0 fct, 1 instruction, 2 externe, 3 usr fct */
  47. short fam; /* cf F_xxx ci-dessus */
  48. };
  49. #define NBFONC 400
  50. #define NBCMOY 12 /* nb de car. en moyenne */
  51. static char Libelles[NBFONC*NBCMOY], *pLibs=Libelles;
  52. static struct fonction Fonctions[NBFONC];
  53. static int NBFonc=0;
  54. int InstallOn=0;
  55. static void IF_INSTALL(void) { InstallOn=1; }
  56. static void IF_INSTALLF(void) { InstallOn=2; }
  57. static void IF_INSTALLV(void) { InstallOn=3; }
  58. /* for dynamic functions */
  59. static void IF_DF_INIT(void) { InstallOn=8; }
  60. static void IF_DF_START(void) { InstallOn=9; }
  61. static void IF_DF_STOP(void) { InstallOn=10; }
  62. static void addFoncT(char *l, void (*f)(void), short T, short F)
  63. {
  64. char *LMax;
  65. if (NBFonc >= NBFONC) stopErr("addFonc : NBFONC !",NULL);
  66. LMax = Libelles + (NBFONC*NBCMOY);
  67. if (pLibs + strlen(l) + 1 >= LMax) stopErr("addFonc : Libelles !",NULL);
  68. Fonctions[NBFonc].nam = pLibs;
  69. Fonctions[NBFonc].typ = T;
  70. Fonctions[NBFonc].fam = F;
  71. Fonctions[NBFonc++].fct = f;
  72. strcpy(pLibs,l);
  73. pLibs += strlen(l);
  74. *pLibs++ = '\0';
  75. }
  76. static void addFonc(char *l, void (*f)(void))
  77. {
  78. addFoncT(l,f,0,F_CORE);
  79. }
  80. static void addFonM(char *l, void (*f)(void))
  81. {
  82. addFoncT(l,f,0,F_MATH);
  83. }
  84. static void addFonP(char *l, void (*f)(void))
  85. {
  86. addFoncT(l,f,0,F_PROG);
  87. }
  88. static void addFonG(char *l, void (*f)(void))
  89. {
  90. addFoncT(l,f,0,F_TOOL);
  91. }
  92. static void addFonD(char *l, void (*f)(void))
  93. {
  94. addFoncT(l,f,0,F_DEV);
  95. }
  96. static void addFonN(char *l, void (*f)(void))
  97. {
  98. addFoncT(l,f,0,F_NET);
  99. }
  100. void addFonU(char *l, void *A)
  101. {
  102. PFV f;
  103. f = (PFV)A;
  104. addFoncT(l,f,0,F_USR);
  105. }
  106. static void addFonE(char *l, void (*f)(void), short F) /* External functions */
  107. { /* not beetween : and ;*/
  108. addFoncT(l,f,2,F);
  109. }
  110. static void addInst(char *l, void (*f)(void))
  111. {
  112. addFoncT(l,f,1,F_PROG);
  113. }
  114. static char **ListFonc = (char**)NULL;
  115. static void Show_library(int NbF)
  116. {
  117. int i,j=0;
  118. for (i=0;i<NbF;i++) {
  119. /* printf("%-13s",Fonctions[i].nam);*/
  120. printf("%-13s",ListFonc[i]);
  121. j++;
  122. if (j == 6) {
  123. j=0;
  124. printf("\n");
  125. }
  126. }
  127. if (j) printf("\n");
  128. }
  129. static int triList(short F)
  130. {
  131. void * M;
  132. char * T;
  133. int i,j, NbF;
  134. if (ListFonc != (char**)NULL) free((void*)ListFonc);
  135. if ((M = malloc(sizeof(char*)* NBFonc)) == NULL) stopErr("triList","malloc");
  136. ListFonc = (char**)M;
  137. j=0;
  138. for(i=0;i<NBFonc;i++) {
  139. if (Fonctions[i].fam & F) ListFonc[j++]=Fonctions[i].nam;
  140. }
  141. NbF = j;
  142. for(i=0; i<NbF-1; i++) /* avant NbF-2 */
  143. for(j=i+1; j<NbF; j++)
  144. if(strcmp(ListFonc[j],ListFonc[i]) < 0) {
  145. T=ListFonc[i]; ListFonc[i]=ListFonc[j]; ListFonc[j]=T;
  146. }
  147. return NbF;
  148. }
  149. void listLibBegin(char * b)
  150. {
  151. int i,j=0,l,n;
  152. l=strlen(b);
  153. n=triList(0xFF);
  154. for(i=0;i<n;i++) {
  155. if (strncmp(ListFonc[i],b,l)==0){
  156. printf("%-13s",ListFonc[i]);
  157. j++;
  158. if (j == 6) {
  159. j=0;
  160. printf("\n");
  161. }
  162. } else
  163. if (strncmp(ListFonc[i],b,l)>0) break;
  164. }
  165. if (j) printf("\n");
  166. }
  167. char * getLibBegin(char * b)
  168. {
  169. int i,l;
  170. l=strlen(b);
  171. for(i=0;i<NBFonc;i++) {
  172. if (strncmp(Fonctions[i].nam,b,l)==0) break;
  173. }
  174. if (i==NBFonc) return NULL;
  175. return Fonctions[i].nam;
  176. }
  177. static char Rac[20]; /* longueur maxi d'une commande */
  178. int nbLibBegin(char * b, char ** r)
  179. {
  180. int i,n, first=1;
  181. unsigned int j, l,t=0;
  182. n=triList(0xFF);
  183. l=strlen(b);
  184. *Rac='\0';
  185. for (i=0;i<n;i++) {
  186. if (strncmp(ListFonc[i],b,l)>0) break;
  187. if (strncmp(ListFonc[i],b,l)==0) {
  188. t++;
  189. if (first) {
  190. strcpy(Rac,ListFonc[i]);
  191. first=0;
  192. } else {
  193. if (strlen(Rac) > l) {
  194. for(j=l;j<strlen(Rac);j++)
  195. if (strncmp(Rac,ListFonc[i],j) != 0) break;
  196. if (j!=strlen(Rac)) Rac[j-1]='\0';
  197. else
  198. if (Rac[j-1] != ListFonc[i][j-1]) Rac[j-1]='\0';
  199. }
  200. }
  201. }
  202. }
  203. if (strlen(Rac) > l) *r = Rac;
  204. else *r = NULL;
  205. return(t);
  206. }
  207. void IF_show_liball(void)
  208. {
  209. Show_library(triList(0xFF));
  210. }
  211. void IF_show_libstd(void)
  212. {
  213. Show_library(triList(F_CORE));
  214. }
  215. void IF_show_libmath(void)
  216. {
  217. Show_library(triList(F_MATH));
  218. }
  219. void IF_show_libprog(void)
  220. {
  221. Show_library(triList(F_PROG));
  222. }
  223. void IF_show_libtools(void)
  224. {
  225. Show_library(triList(F_TOOL));
  226. }
  227. void IF_show_libdev(void)
  228. {
  229. Show_library(triList(F_DEV));
  230. }
  231. void IF_show_libnet(void)
  232. {
  233. Show_library(triList(F_NET));
  234. }
  235. void IF_show_libusr(void)
  236. {
  237. Show_library(triList(F_USR));
  238. }
  239. void initLib(void)
  240. {
  241. addFonc(".",IF_point);
  242. addFonc("+",IF_plus);
  243. addFonc("-",IF_moins);
  244. addFonc("=",IF_Legal);
  245. addFonc("<>",IF_Ldiff);
  246. addFonc(">",IF_Lsup);
  247. addFonc("<",IF_Linf);
  248. addFonc(">=",IF_Lsupeg);
  249. addFonc("<=",IF_Linfeg);
  250. addFonc("*",IF_mult);
  251. addFonc("/",IF_div);
  252. addFonc("neg",IF_neg);
  253. addFonc("min",IF_min);
  254. addFonc("max",IF_max);
  255. addFonc("modulo",IF_modulo);
  256. addFonc("**",IF_puiss);
  257. addFonc("[]-sub",IF_subTab);
  258. addFonc("[]sub",IF_subTabR);
  259. addFonc("*[]-sub",IF_NsubTab);
  260. addFonc("*[]sub",IF_NsubTabR);
  261. addFonc("[]rev",IF_TabRev);
  262. addFonc("*[]rev",IF_NTabRev);
  263. addFonc("[]crot",IF_TabTransp);
  264. addFonc("[]transp",IF_TabTranspN);
  265. addFonc("[]trot",IF_TabTranspT);
  266. addFonc("[]>>",IF_TNShiftR);
  267. addFonc("[]<<",IF_TNShiftL);
  268. addFonc("*[]>>",IF_NTNShiftR);
  269. addFonc("*[]<<",IF_NTNShiftL);
  270. addFonc("[]>",IF_TShiftR);
  271. addFonc("[]<",IF_TShiftL);
  272. addFonc("*[]>",IF_NTShiftR);
  273. addFonc("*[]<",IF_NTShiftL);
  274. addFonc("[]min",IF_TABMin);
  275. addFonc("[]max",IF_TABMax);
  276. addFonc("[]sum",IF_TABSum);
  277. addFonc("[]prod",IF_TABProd);
  278. addFonc("[]min/max",IF_TABMinMax);
  279. addFonc(">array",IF_toArray);
  280. addFonc(">scalar",IF_toScalar);
  281. addFonc(">-scalar",IF_toScalarR);
  282. addFonc("\"",IF_debString);
  283. addFonc("\"drop",IF_dropC);
  284. addFonc("\"dup",IF_dupC);
  285. addFonc("\"over",IF_overC);
  286. addFonc("\"swap",IF_swapC);
  287. addFonc("\"type",IF_typeC);
  288. addFonc("\"cat",IF_catC);
  289. addFonc("\"cats",IF_catsC);
  290. addFonc("cr",IF_crC);
  291. addFonc("\"time",IF_timeC);
  292. addFonc("\"date",IF_dateC);
  293. addFonc("sleep",IF_sleep);
  294. addFonc("sh",IF_sh);
  295. addFonc("?drop",IF_dropL);
  296. addFonc("?dup",IF_dupL);
  297. addFonc("?swap",IF_swapL);
  298. addFonc("?over",IF_overL);
  299. addFonc("?t/f",IF_typeL);
  300. addFonc("and",IF_andL);
  301. addFonc("or",IF_orL);
  302. addFonc("xor",IF_xorL);
  303. addFonP("fdrop",rmLastFct);
  304. addFonE("del_func",IF_delFct, F_PROG);
  305. addFonE("del_afunc",IF_delAFct, F_PROG);
  306. addFonE("del_ofunc",IF_delOFct, F_PROG);
  307. addFonE("fscan",IF_scanFct, F_PROG);
  308. addFonc("?cs",IF_show_stackC);
  309. addFonP("?f",IF_show_stackF);
  310. /* addFonP("?l",IF_showFD); for debugging */
  311. addFonP("?v",IF_show_stackV);
  312. addFonE("del_var",IF_delVar,F_PROG);
  313. addFonP("vdrop",rmLastVar);
  314. addFonP("reset_var",IF_setVarI);
  315. addFonP(">v",IF_setVarN);
  316. addFonP("?>v",IF_setVarB);
  317. addFonP("\">v",IF_setVarC);
  318. addFonP("in",IF_setVarLF);
  319. addFonP("install",IF_INSTALL);
  320. addFonP("install_f",IF_INSTALLF);
  321. addFonP("install_v",IF_INSTALLV);
  322. addFonP("df_init",IF_DF_INIT);
  323. addFonP("df_start",IF_DF_START);
  324. addFonP("df_stop",IF_DF_STOP);
  325. addFonc("?ls",IF_show_stackL);
  326. addFonc("?s",IF_show_stack);
  327. addFonc("?libs",IF_show_liball);
  328. addFonc("?lib",IF_show_libstd);
  329. addFonc("?libM",IF_show_libmath);
  330. addFonc("?libT",IF_show_libtools);
  331. addFonc("?libP",IF_show_libprog);
  332. addFonc("?libD",IF_show_libdev);
  333. addFonc("?libN",IF_show_libnet);
  334. addFonc("?libU",IF_show_libusr);
  335. addFonc("?lasterr",IF_showError);
  336. addFonc("?err",IF_IsError);
  337. addFonc("noerr",IF_NoError);
  338. addFonc("messerr",IF_LibError);
  339. addFonc("ls_clear",IF_stackL_clear);
  340. addFonc("cs_clear",IF_stackC_clear);
  341. addFonc("REAL",IF_REAL);
  342. addFonc("INTEGER",IF_INTEGER);
  343. addFonc("echo_on",IF_ECHOON);
  344. addFonc("echo_off",IF_ECHOFF);
  345. addFonc("DEBUG_I/O",D_Update);
  346. addFonc("NBTAB",IF_NBTAB);
  347. addFonc("NBLIG",IF_NBLIG);
  348. addFonE("Var",IF_debVar, F_PROG);
  349. addFonc("\"Var",IF_debVarCS);
  350. addFonP("var_off",IF_VAROFF);
  351. addFonP("var_up",IF_VARUP);
  352. addFonP("var_down",IF_VARDOWN);
  353. addFonc("?vars",IF_vars);
  354. addFonc("drop",IF_drop);
  355. addFonc("dup",IF_dup);
  356. addFonc("swap",IF_swap);
  357. addFonc("over",IF_over);
  358. addFonc("pick",IF_pick);
  359. addFonc("rot",IF_rot);
  360. addFonc("unrot",IF_unrot);
  361. addFonc("roll",IF_roll);
  362. addFonc("unroll",IF_unroll);
  363. addFonc("*drop",IF_Ndrop);
  364. addFonc("*dup",IF_Ndup);
  365. addFonc("depth",IF_depth);
  366. addFonc("exit",IF_exit);
  367. addFonc("false",IF_false);
  368. addFonc("not",negBool);
  369. addFonc("ramp",IF_ramp);
  370. addFonc("dramp",IF_dramp);
  371. addFonc("rusage",IF_resUsage);
  372. addFonc("s_clear",IF_stack_clear);
  373. addFonM("inv",IF_inv);
  374. addFonM("sqrt",IF_sqrt);
  375. addFonM("cbrt",IF_cbrt);
  376. addFonM("round",IF_round);
  377. addFonM("floor",IF_floor);
  378. addFonM("ceil",IF_ceil);
  379. addFonM("sgn",IF_sgn);
  380. addFonM("abs",IF_abs);
  381. addFonM("pi",IF_pi);
  382. addFonM("sin",IF_sin);
  383. addFonM("cos",IF_cos);
  384. addFonM("tan",IF_tan);
  385. addFonM("asin",IF_asin);
  386. addFonM("acos",IF_acos);
  387. addFonM("atan",IF_atan);
  388. addFonM("sinh",IF_sinh);
  389. addFonM("cosh",IF_cosh);
  390. addFonM("tanh",IF_tanh);
  391. addFonM("asinh",IF_asinh);
  392. addFonM("acosh",IF_acosh);
  393. addFonM("atanh",IF_atanh);
  394. addFonM("ln",IF_ln);
  395. addFonM("log",IF_log);
  396. addFonM("exp",IF_exp);
  397. addFonM("j0",IF_j0);
  398. addFonM("j1",IF_j1);
  399. addFonM("y0",IF_y0);
  400. addFonM("y1",IF_y1);
  401. addFonc("time",IF_time);
  402. addFonc("true",IF_true);
  403. addFonc("about",IF_about);
  404. addFonc("vers",IF_vers);
  405. addFonE("load",IF_Load, F_PROG);
  406. addFonP("\"load",IF_LoadCS);
  407. addFonP("\"exec",IF_ExecCS);
  408. addFonP("\"execf",IF_ExecCSf);
  409. addInst("\"execk",IF_EXEK);
  410. addFonG(">csv",IF_toCsv);
  411. addFonG("y_xgraph",IF_yXgraph);
  412. addFonG("yt_xgraph",IF_ytXgraph);
  413. addFonG("xy_xgraph",IF_xyXgraph);
  414. addFonG("xyt_xgraph",IF_xytXgraph);
  415. addFonG("?gp",IF_show_stackGP);
  416. addFonG("gplot",IF_gplot_new);
  417. addFonG("gplotM",IF_gplot_newM);
  418. addFonG("gplotRaz",IF_delAllGP);
  419. addFonG("gplotCmd",IF_gplot_commapp);
  420. addFonG("gplotAdd",IF_gplot_append);
  421. addFonG("gplotRepl",IF_gplot_replace);
  422. addFonG("del_gplot",IF_gplot_del);
  423. addFonG("gplotClear",IF_gplot_clear);
  424. addFonP(":",IF_debFct);
  425. addFonP(":!",IF_debFctS);
  426. addFonP("Task",IF_NewTask);
  427. addFonP("?t",IF_show_Tasks);
  428. addFonP("?task_run",IF_statusTask);
  429. addFonP("del_task",IF_delTask);
  430. addFonP("\"f",IF_execCS);
  431. addFonP("\"v",IF_execCSv);
  432. addFonP("\"f?",IF_execCSl);
  433. addFonP("\"v?",IF_execCSvl);
  434. addFonP("stop_task",IF_stopTask);
  435. addFonP("?console",IF_showCons);
  436. addInst(";",IF_finFct);
  437. addInst("'",IF_debBackC);
  438. addInst("`",IF_debBackC1);
  439. addInst("return",IF_RET);
  440. addInst("if",IF_IF);
  441. addInst("else",IF_ELSE);
  442. addInst("then",IF_THEN);
  443. addInst("begin",IF_BEGIN);
  444. addInst("again",IF_AGAIN);
  445. addInst("until",IF_UNTIL);
  446. addInst("while",IF_WHILE);
  447. addInst("repeat",IF_REPEAT);
  448. addInst("do",IF_DO);
  449. addFonc("do_leave",IF_DO_Leave);
  450. addFonc("*do_leave",IF_DO_MLeave);
  451. addFonc("do_next",IF_DO_Next);
  452. /* addFonc("?do",IF_DO_Show); for debugging */
  453. addFonc("ndo",IF_nDO);
  454. addInst("loop",IF_LOOP);
  455. addInst("+loop",IF_PLOOP);
  456. addInst("I",IF_I_DO);
  457. addInst("J",IF_J_DO);
  458. addInst("K",IF_K_DO);
  459. addInst("break",IF_BREAK);
  460. addInst("myself",IF_MYSELF);
  461. addInst("onerr:",IF_ONERR);
  462. addInst("end:",IF_END);
  463. addInst("goto_end",IF_JEND);
  464. addFonE("help",IF_help, F_CORE);
  465. addFonD("?dev",IF_listDev);
  466. addFonD("dev_info",IF_showDev);
  467. addFonD("dev_read",IF_devRead);
  468. addFonD("dev_write",IF_devWrite);
  469. addFonD("dev_dflt",IF_devDflt);
  470. addFonD("?dev_dflt",IF_devShowDflt);
  471. addFonD("dev_dflW",IF_devDflW);
  472. addFonD("dev_dflR",IF_devDflR);
  473. addFonN("?n",IF_netList);
  474. addFonN("netOn",IF_netOn);
  475. addFonN("netOff",IF_netOff);
  476. addFonN("netDt>",IF_netDt);
  477. addFonN("netExec",IF_netExec);
  478. addFonN("netCompile",IF_netCompile);
  479. addFonN("ndepth",IF_netDepth);
  480. addFonN("stopServer",IF_netStopS);
  481. addFonN("NetServer",IF_NetServer);
  482. addFonN("srusage",IF_netRusage);
  483. addFonN("NetKey",IF_NetKey);
  484. addFonN("NetErr",IF_NetErrVal);
  485. addFonN("Me",IF_Me);
  486. addFonN("?ns",IF_netStackList);
  487. addFonN(">net",IF_netU2S);
  488. addFonN("net>",IF_netS2U);
  489. addFonN("ndrop",IF_netDropS);
  490. /* triList(); */
  491. }
  492. void * libByName(char * L)
  493. {
  494. int i;
  495. for (i=0;i<NBFonc;i++) {
  496. if (strcmp(L,Fonctions[i].nam) == 0) {
  497. if (Fonctions[i].typ) break;
  498. else return((void*)Fonctions[i].fct);
  499. }
  500. }
  501. return VIDE;
  502. }
  503. int execLibNrpc(char *C)
  504. {
  505. int i;
  506. if (sigsetjmp(ENV_INT,1)) {
  507. return 0;
  508. }
  509. if (IF_execFct(C)) return 1;
  510. for (i=0;i<NBFonc;i++) {
  511. if (strcmp(C,Fonctions[i].nam) == 0) {
  512. switch (Fonctions[i].typ) {
  513. case 1:
  514. case 3: /* usr fct */
  515. return 0;
  516. break;
  517. default: /* typ = 0 et 2 */
  518. Fonctions[i].fct();
  519. break;
  520. }
  521. return 1;
  522. }
  523. }
  524. if (IF_execVar(C)) return 1; /* VARS DOWN */
  525. return 0;
  526. }
  527. int execLib(char *C)
  528. {
  529. int i;
  530. void * A;
  531. short T=0;
  532. InExec = C;
  533. D_Trace(C);
  534. if (sigsetjmp(ENV_INT,1)) {
  535. interInfos("execLib",C);
  536. return 1;
  537. }
  538. if (InstallOn) {
  539. switch (InstallOn) {
  540. case 1 : /* lib first */
  541. A=libByName(C);
  542. if (A==VIDE) {
  543. A=fctByName(C);
  544. if (A!=VIDE) T=2;
  545. } else T=1;
  546. break;
  547. case 2 : /* user functions first */
  548. A=fctByName(C);
  549. if (A==VIDE) {
  550. A=libByName(C);
  551. if (A!=VIDE) T=1;
  552. } else T=2;
  553. break;
  554. case 3 : /* variables only */
  555. A=varByName(C);
  556. if (A!=VIDE) T=3;
  557. break;
  558. case 8 : /* df_init */
  559. A=fctByName(C);
  560. updDynFct(A,0);
  561. break;
  562. case 9 : /* df_start */
  563. A=fctByName(C);
  564. updDynFct(A,1);
  565. break;
  566. case 10 : /* df_stop */
  567. A=fctByName(C);
  568. updDynFct(A,2);
  569. break;
  570. default :
  571. break;
  572. }
  573. _MODIF_FCT_INST_(A);
  574. _MODIF_FCT_TYP_(T);
  575. InstallOn=0;
  576. return 1;
  577. }
  578. if ((VARS==2) && (IF_execVar(C))) return 1; /* VARS UP */
  579. if (IF_execFct(C)) return 1;
  580. for (i=0;i<NBFonc;i++) {
  581. /* printf("execLib : teste %s !\n", Fonctions[i].nam); */
  582. if (strcmp(C,Fonctions[i].nam) == 0) {
  583. switch (Fonctions[i].typ) {
  584. case 1:
  585. if (fctEnCours) Fonctions[i].fct();
  586. else messErr(13);
  587. break;
  588. case 2:
  589. if (fctEnCours) messErr(25);
  590. else Fonctions[i].fct();
  591. break;
  592. case 3: /* usr fct */
  593. break;
  594. default: /* typ = 0 */
  595. if (fctEnCours) {
  596. if (strcmp(C,":") == 0) messErr(15);
  597. else {
  598. if (strcmp(C,"\"") == 0) Fonctions[i].fct();
  599. else makeFct(T_LIB,(void*)Fonctions[i].fct);
  600. }
  601. } else Fonctions[i].fct();
  602. break;
  603. }
  604. return 1;
  605. }
  606. }
  607. if ((VARS==1) && (IF_execVar(C))) return 1; /* VARS DOWN */
  608. /* printf("execLib : appel putVal(%s)\n",C); */
  609. return(putVal(C));
  610. }
  611. char * libByAddr(void *A)
  612. {
  613. PFC f;
  614. int i;
  615. f = (PFC)A;
  616. for (i=0;i<NBFonc;i++) {
  617. if (f == (PFC)(Fonctions[i].fct)) return Fonctions[i].nam;
  618. }
  619. return NULL;
  620. }