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.
 
 
 
 

725 lines
32 KiB

  1. Try "help help" to learn more about Nife.
  2. " { -- string }
  3. begins a string wich is terminated by itself. The first blank is a separator.
  4. The character \ masks the character " as end of string.
  5. ' : { string -- }
  6. begins, into a function (between : and ;), a string which represents a name of
  7. a user function, or a variable. This string will be interpreted and executed
  8. during the function execution.
  9. There is no verification : if the name does not exist, it does nothing.
  10. ` : { string -- }
  11. begins, into a function (between : and ;), a string which represents a name of
  12. a user function, or a variable. This string will be interpreted and executed
  13. during the function execution. At the first time the code is updated if the
  14. function or the variable is found.
  15. There is no verification : if the name does not exist, it does nothing.
  16. "cat : { str1 str2 -- 'str1str2' }
  17. catenates the two elements on the top string stack entry.
  18. "cats : { str1 str2 -- 'str1 str2' }
  19. catenates the two elements on the top string stack entry with a space between.
  20. "date : { -- date_string }
  21. puts the date string (JJ/MM/AAAA) on the top string stack entry.
  22. "drop : { str1 -- }
  23. removes the top string stack entry.
  24. "dup : { str1 -- str1 str1 }
  25. duplicates the top string stack entry.
  26. "over : { str2 str1 -- str2 str1 str2 }
  27. duplicates the second string stack entry onto the top of the stack.
  28. "swap : { str2 str1 -- str1 str2 }
  29. exchanges the top two string stack entries.
  30. "time : { -- time_string }
  31. put the time string (hh:mm:ss) on the top string stack entry.
  32. "type : { str1 -- }
  33. displays and removes the top string stack entry.
  34. "f : { fname -- }
  35. executes the function fname. An error occurs if the function does not exist.
  36. "v : { vname -- }
  37. executes the variable vname. An error occurs if the variable does not exist.
  38. "f? : { fname -- } ( -- T/F )
  39. executes the function fname. In succes TRUE is putting on the logical stack, if
  40. not FALSE.
  41. "v? : { vname -- } ( -- T/F )
  42. executes the variable vname. In succes TRUE is putting on the logical stack, if
  43. not FALSE.
  44. "exec : { "code" -- }
  45. executes the code in a string on the top of the character stack.
  46. Does nothing if the string is empty.
  47. "execf : { "code" -- }
  48. executes the code in a string on the top of the character stack as the content
  49. of a function. At each time the function is dynamicaly compiled and executed.
  50. Does nothing if the string is empty.
  51. "execk : { "code" -- }
  52. compiles the code in a string on the top of the character stack as the content
  53. of a function. At the first time the function is dynamicaly compiled, keep as
  54. a user function and executed. On other times the string is removed and the user
  55. function is simply executed.
  56. Does nothing if the string is empty.
  57. * : [ e1 e2 -- result ]
  58. calculates the multiplication : e1 * e2.
  59. If e1 and e2 are arrays, they must have the same dimension and the result will
  60. be an array of this dimension with result[i] = e1[i] * e2[i].
  61. If e1 or e2 is an array the function adapts itself.
  62. As this operation is commutative the result will be the same if the array is in
  63. first or second position.
  64. ** : [ e1 e2 -- result ]
  65. calculates the power : e1 ** e2.
  66. If e1 and e2 are arrays, they must have the same dimension and the result will
  67. be an array of this dimension with result[i] = e1[i] ** e2[i].
  68. If e1 or e2 is an array the function adapts itself.
  69. WARNING : As this operation is NOT commutative the result will NOT be the same
  70. if the array is in first or second position.
  71. *[]< : [ tab1 tab2 ... tabn n -- tab1 tab2 ... tabn ]
  72. left shift n arrays. The same as []< with n tabs.
  73. *[]<< : [ tab1 tab2 ... tabn n i -- tab1 tab2 ... tabn ]
  74. left shift of i elements on n array. The same as []<< with n tabs.
  75. *[]> : [ tab1 tab2 ... tabn n -- tab1 tab2 ... tabn ]
  76. right shift n arrays. The same as []> with n tabs.
  77. *[]>> : [ tab1 tab2 ... tabn n i -- tab1 tab2 ... tabn ]
  78. right shift of i elements on n array. The same as []>> with n tabs.
  79. *[]rev : [ tab1 tab2 ... tabn n -- tab1 tab2 ... tabn ]
  80. reverse n arrays. The same as []rev with n tabs.
  81. *drop : [ En+1 En ... E1 n -- En+1 ]
  82. removes the top n number stack entries from the stack.
  83. *dup : [ En ... E1 n -- En ... E1 En ... E1 ]
  84. duplicates the top n entries on the number stack.
  85. + : [ e1 e2 -- result ]
  86. calculates the addition : e1 + e2.
  87. If e1 and e2 are arrays, they must have the same dimension and the result will
  88. be an array of this dimension with result[i] = e1[i] + e2[i].
  89. If e1 or e2 is an array the function adapts itself.
  90. As this operation is commutative the result will be the same if the array is in
  91. first or second position.
  92. - : [ e1 e2 -- result ]
  93. calculates the soustraction : e1 - e2.
  94. If e1 and e2 are arrays, they must have the same dimension and the result will
  95. be an array of this dimension with result[i] = e1[i] - e2[i].
  96. If e1 or e2 is an array the function adapts itself.
  97. WARNING : As this operation is NOT commutative the result will NOT be the same
  98. if the array is in first or second position.
  99. . : [ e -- ]
  100. displays and removes the top number stack entry.
  101. / : [ e1 e2 -- result ]
  102. calculates the division : e1 / e2.
  103. If e1 and e2 are arrays, they must have the same dimension and the result will
  104. be an array of this dimension with result[i] = e1[i] / e2[i].
  105. If e1 or e2 is an array the function adapts itself.
  106. WARNING : As this operation is NOT commutative the result will NOT be the same
  107. if the array is in first or second position.
  108. < : [ e1 e2 -- ] ( -- bool )
  109. evaluates the less than test and put the result, true or false, on the logical
  110. stack.
  111. If e1 and e2 are arrays, they must have the same dimension and the result will
  112. be a AND of the comparison of each elements : e1[i] < e2[i].
  113. If e1 or e2 is an array the function adapts itself.
  114. WARNING : As this operation is NOT commutative the result will NOT be the same
  115. if the array is in first or second position.
  116. <= : [ e1 e2 -- ] ( -- bool )
  117. evaluates the less or equal than test and put the result, true or false, on the
  118. logical stack.
  119. If e1 and e2 are arrays, they must have the same dimension and the result will
  120. be a AND of the comparison of each elements : e1[i] < e2[i].
  121. If e1 or e2 is an array the function adapts itself.
  122. WARNING : As this operation is NOT commutative the result will NOT be the same
  123. if the array is in first or second position.
  124. <> : [ e1 e2 -- ] ( -- bool )
  125. evaluates the not equal test and put the result, true or false, on the logical
  126. stack.
  127. If e1 and e2 are arrays, they must have the same dimension and the result will
  128. be a AND of the comparison of each elements : e1[i] < e2[i].
  129. If e1 or e2 is an array the function adapts itself.
  130. WARNING : As this operation is NOT commutative the result will NOT be the same
  131. if the array is in first or second position.
  132. = : [ e1 e2 -- ] ( -- bool )
  133. evaluates the equal test and put the result on the logical stack.
  134. If e1 and e2 are arrays, they must have the same dimension and the result will
  135. be a AND of the comparison of each elements : e1[i] < e2[i].
  136. If e1 or e2 is an array the function adapts itself.
  137. As this operation is commutative the result will be the same if the array is in
  138. first or second position.
  139. > : [ e1 e2 -- ] ( -- bool )
  140. evaluates the greater than test and put the result on the logical stack.
  141. If e1 and e2 are arrays, they must have the same dimension and the result will
  142. be a AND of the comparison of each elements : e1[i] < e2[i].
  143. If e1 or e2 is an array the function adapts itself.
  144. WARNING : As this operation is NOT commutative the result will NOT be the same
  145. if the array is in first or second position.
  146. >-scalar : [ [v1, ... ,vn] -- vn ... v2 v1 ]
  147. transforms the array, on the top of the stack, with n elements, in n scalars.
  148. The first value of the array will be the scalar on the top.
  149. >= : [ e1 e2 -- ] ( -- bool )
  150. evaluates the greater or equal than test and put the result, true or false, on
  151. the logical stack.
  152. If e1 and e2 are arrays, they must have the same dimension and the result will
  153. be a AND of the comparison of each elements : e1[i] < e2[i].
  154. If e1 or e2 is an array the function adapts itself.
  155. WARNING : As this operation is NOT commutative the result will NOT be the same
  156. if the array is in first or second position.
  157. >array : [ e1 e2 .... eN n -- array ]
  158. take n elements to make an array. Each element ei may be an array.
  159. >scalar : [ [v1, ... ,vn] -- v1 v2 ... vn ]
  160. transforms the array, on the top of the stack, with n elements, in n scalars.
  161. The last value of the array will be the scalar on the top.
  162. ?cs :
  163. displays the character (string) stack.
  164. ?drop : ( bool1 -- )
  165. removes the top logical stack entry.
  166. ?dup : ( bool1 -- bool1 bool1 )
  167. duplicates the top logical stack entry.
  168. ?lib :
  169. displays the names of base library functions.
  170. ?libD :
  171. displays the names of devices library functions.
  172. ?libN :
  173. displays the names of network library functions.
  174. ?libT :
  175. displays the names of tools library functions. Theses tools are built on extern
  176. Linux tools (gnuplot, xgraph, ...).
  177. ?libM :
  178. displays the names of math library functions.
  179. ?libP :
  180. displays the names of programming library functions.
  181. ?libU :
  182. displays the names of user system functions.
  183. ?libs :
  184. displays the names of all libraries functions.
  185. ?ls :
  186. displays the logical stack.
  187. ?over : ( bool2 bool1 -- bool2 bool1 bool2 )
  188. duplicates the second logical stack entry onto the top of the stack.
  189. ?s :
  190. display the number stack.
  191. ?swap : ( bool2 bool1 -- bool1 bool2 )
  192. exchanges the top two logical stack entries.
  193. ?t/f : ( bool -- )
  194. displays and removes the top logical stack entry.
  195. ?vars :
  196. displays the list of constants of the system environment.
  197. DEBUG_I/O :
  198. toggle to set debug mode on or off. All debug functions begin whith '_'.
  199. See ?libP list to get all the functions.
  200. In an X11 environment, it is possible to display debug terminals in the same
  201. time than the main one.
  202. To activate or refresh displays of the log files press the "home" key.
  203. Pressing the "end" key will close all of them.
  204. You can also :
  205. 1°) open a shell with 'sh' command,
  206. 2°) execute 'ex/NifeDebugTerms -r' to start display terminals,
  207. 3°) type 'exit' to return to Nife !
  208. After the end of Nife, type 'ex/NifeDebugTerms -s' to close the displays.
  209. The script NifeDebugTerms have been made for the Gnome window-manager. But
  210. it's easy to adapt for others environments.
  211. DEC :
  212. sets the default print mode for integers to decimal.
  213. HEX :
  214. sets the default print mode for integers to hexadecimal.
  215. OCT :
  216. sets the default print mode for integers to octal.
  217. BIN :
  218. sets the default print mode for integers to binary.
  219. INTEGER :
  220. sets the default type to INTEGER.
  221. NBLIG : [ n -- ]
  222. sets the variable NBLIG to n.
  223. NBLIG is used to limit the display of the stack.
  224. NBTAB : [ n -- ]
  225. sets the variable NBTAB to n.
  226. NBTAB is used to limit the display of the stack.
  227. REAL :
  228. sets the default type to REAL.
  229. []< : [ [v1,v2,...vn] -- [v2, ... ,vn,v1] ]
  230. left shift of 1 element on an array.
  231. []<< : [ [v1,v2,...vn] i -- [vi+1, ... ,vn,v1,v2 ... vi] ]
  232. left shift of i elements on an array.
  233. []> : [ [v1,v2,...vn] -- [vn,v1,v2, ... ,vn-1] ]
  234. right shift of 1 element on an array.
  235. []>> : [ [vn,vn-1,...,v2,v1] i -- [vi, ... ,v2,v1,vn ... vi+1] ]
  236. right shift of i elements on an array.
  237. []crot : [ tab1 tab2 ... tabN n -- Ntab1 ... NtabP ]
  238. clock rotation on n arrays of P elements. Ntab1 will be composed with the lasts
  239. elements of tab1 ... tabN and NtabP with firsts elements of tab1 ... tabN.
  240. []max : [ [v1,v2,...vn] -- vMax ]
  241. replace the array on the top of the stack by the maximum value.
  242. []min : [ [v1,v2,...vn] -- vMin ]
  243. replace the array on the top of the stack by the minimum value.
  244. []min/max : [ [v1,v2,...vn] -- vMin vMax ]
  245. replace the array on the top of the stack by the minimum and maximum values.
  246. []prod : [ [v1,v2,...vn] -- v1*v2*...*vn ]
  247. replace the array on the top of the stack by the product of all values.
  248. []rev : [ [v1,v2,...vn] -- [vn ... v2,v1] ]
  249. reverse an array.
  250. []sum : [ [v1,v2,...vn] -- v1+v2+...+vn ]
  251. replace the array on the top of the stack by the sum of all values.
  252. []trot : [ tab1 tab2 ... tabN n -- Ntab1 ... NtabP ]
  253. trigonometric rotation with n arrays of P elements. Ntab1 will be composed with
  254. the firsts elements of tabN ... tab1 and NtabP with firsts elements of tabN ...
  255. tab1.
  256. []transp : [ tab1 tab2 ... tabN n -- Ntab1 ... NtabP ]
  257. computes the transpose of the matrix composed with n arrays of P elements.
  258. Ntab1 will be composed by the last line of this matrix and NtabP with the first
  259. line.
  260. about :
  261. displays the name of the system and the version.
  262. and : ( A B -- AandB )
  263. replaces the two booleans on the top of logical stack by the AND.
  264. cr :
  265. displays carriage-return (new line).
  266. depth : [ -- Stack_Depth ]
  267. returns the number of entries on the current number stack to the number stack.
  268. dramp : [ n -- [-n, ...,-1,0,1,2, ...,n] ]
  269. builds an array with 2n+1 elements and initialize it with a ramp (-n to n). It is in fact a double ramp.
  270. drop : [ E -- ]
  271. removes the top number stack entry.
  272. dup : [ E -- E E ]
  273. duplicates the top number stack entry.
  274. echo_off :
  275. sets the echo mode off.
  276. echo_on :
  277. sets the echo mode off.
  278. exit :
  279. terminates the program.
  280. false : ( -- false )
  281. puts false on the top of the logical stack.
  282. help :
  283. this help !! Need a word following.
  284. All the words available in Nife are listed with "?libs" command.
  285. See also "?lib", "?libP", ... for more details.
  286. For each instruction this help tell you exactly what happens on the stacks :
  287. [ -- ] for numeric values,
  288. { -- } for strings or character alone,
  289. ( -- ) for booleans.
  290. The "--" represents the execution. So before it, what it's necessary for the
  291. function (used during execution), and after it what the function products.
  292. If a stack is not used there is nothing about it. Here, the "help" function
  293. don't use any stack.
  294. ls_clear : ( bool1 bool2 ... boolN -- )
  295. clears the logical stack.
  296. cs_clear : { str1 ... strn -- }
  297. clears the character stack.
  298. max : [ e1 e2 -- result ]
  299. calculates the maximun of e1 and e2.
  300. If e1 and e2 are arrays, they must have the same dimension and the result will
  301. be an array of this dimension with result[i] = max(e1[i], e2[i]).
  302. If e1 or e2 is an array the function adapts itself.
  303. As this operation is commutative the result will be the same if the array is in
  304. first or second position.
  305. min : [ e1 e2 -- result ]
  306. calculates the minimun of e1 and e2.
  307. If e1 and e2 are arrays, they must have the same dimension and the result will
  308. be an array of this dimension with result[i] = min(e1[i], e2[i]).
  309. If e1 or e2 is an array the function adapts itself.
  310. As this operation is commutative the result will be the same if the array is in
  311. first or second position.
  312. modulo : [ e1 e2 -- result ]
  313. calculates the rest of the division : e1 / e2.
  314. If e1 and e2 are arrays, they must have the same dimension and the result will
  315. be an array of this dimension with result[i] = e1[i] modulo e2[i].
  316. If e1 or e2 is an array the function adapts itself.
  317. WARNING : As this operation is NOT commutative the result will NOT be the same
  318. if the array is in first or second position.
  319. abs : [ v -- |v| ]
  320. take absolute value of the value on the top of the stack.
  321. neg : [ v -- -v ]
  322. negates the value on the top of the stack. Equivalent to "-1 *".
  323. not : ( A -- notA )
  324. replaces the boolean on the top of logical stack by his negation.
  325. or : ( A B -- AorB )
  326. replaces the two booleans on the top of logical stack by the OR.
  327. over : [ E2 E1 -- E2 E1 E2 ]
  328. duplicates the second number stack entry onto the top of the stack.
  329. pick : [ En ... E1 n -- En ... E1 En ]
  330. copies the n-th number stack entry onto the top of the stack.
  331. ramp : [ n -- [1,2, ...,n] ]
  332. builds an array with n elements and initialize it with a ramp (1 to n).
  333. roll : [ En En-1 ... E1 n -- En-1 ... E1 En ]
  334. moves the n-th number stack entry to the top of the stack.
  335. rot : [ E3 E2 E1 -- E2 E1 E3 ]
  336. rotates the third number stack entry to the top of the stack.
  337. rusage :
  338. display a board of ressources usage.
  339. s_clear : [ e1 ... en -- ]
  340. clears the number stack.
  341. sh :
  342. puts nife in background and open a shell. To come back in the program just exit
  343. the shell.
  344. sleep : [ n -- ]
  345. sleep during n seconds.
  346. swap : [ E2 E1 -- E1 E2 ]
  347. exchanges the top two number stack entries.
  348. time : [ -- N ]
  349. puts the time in microseconds on the top of the stack.
  350. true : ( -- true )
  351. puts true on the top of the logical stack.
  352. unroll : [ En-1 ... E2 E1 n -- E1 En-1 ... E2 ]
  353. moves the top number stack entry to the n-th position on the stack.
  354. unrot : [ E3 E2 E1 -- E1 E3 E2 ]
  355. rotates the top number stack entry to the third position on the stack. This is
  356. the reverse effect of "rot".
  357. xor : ( A B -- AxorB )
  358. replaces the two booleans on the top of logical stack by the XOR.
  359. vers : [ -- version ]
  360. puts the version value on the top of the stack.
  361. ">v : { string -- }
  362. initializes a variable with the top character stack entry.
  363. The name of the variable must follow this instruction. His previous content is
  364. lost.
  365. : :
  366. begins a function definition which the name is the first word following it. The end is indicate by ;.
  367. :! :
  368. begins a system function definition which the name is the first word following
  369. it. The end is indicate by ;. A such function take place in the User System
  370. functions list and cannot be removed.
  371. ; :
  372. ends a function definition that was begin by :.
  373. >v : [ E -- ]
  374. initializes a variable with the top stack entry.
  375. The name of the variable must follow this instruction. His previous content is
  376. lost.
  377. ?>v : ( boolean -- )
  378. initializes a variable with the top logical stack entry.
  379. The name of the variable must follow this instruction. His previous content is
  380. lost.
  381. ?console : [ n -- ]
  382. displays the background console of task number n.
  383. ?f :
  384. displays the function stack.
  385. ?t :
  386. displays the task stack.
  387. ?task_run : [ n -- ] ( -- true/false )
  388. tests if the task number n is running and put a boolean on the logical stack.
  389. ?v :
  390. displays the variable stack.
  391. Task : [ -- no_task ]
  392. creates a task from a function. The name of the function must following it.
  393. The avaibles names are thoses giving by ?f. In success, the task number is on
  394. the numerical stack.
  395. Var :
  396. creates an empty global variable which the name is the first word following it.
  397. The variables are multiforms and can content scalar, array, boolean, string or
  398. a function name. In this case, it is an executable variable.
  399. "Var :
  400. creates an empty global variable which the name is on the character stack.
  401. The variables are multiforms and can content scalar, array, boolean, string or
  402. a function name. In this case, it is an executable variable.
  403. again :
  404. use in function programmation to create an infinite loop. For example :
  405. : f1 ... begin ... again ... ;
  406. This must be done into a function (between : and ;).
  407. begin :
  408. use in function programmation to create a loop. For example :
  409. : f1 ... begin ... [condition] while ... repeat ... ;
  410. : f2 ... begin ... [condition] until ... ;
  411. or infinite loop :
  412. : f3 ... begin ... again ... ;
  413. This must be done into a function (between : and ;).
  414. break :
  415. use in function programmation to exit a loop. For example :
  416. : f1 ... begin ... [condition] if ... break then ... again ... ;
  417. This must be done into a function (between : and ;).
  418. del_func :
  419. delete the more recent version of a function.
  420. The name of the function must follow this instruction.
  421. del_afunc :
  422. delete all functions beginning by a prefix.
  423. The prefix of the function must follow this instruction.
  424. del_ofunc :
  425. delete the oldest version of a function.
  426. The name of the function must follow this instruction.
  427. del_task : [ n -- ]
  428. delete the task number n.
  429. del_var :
  430. delete a variable. The name of the variable must follow this instruction.
  431. else :
  432. use to make a test. For example :
  433. toto 1 > if 12 else -7 then
  434. At execution time, if toto is greater than 1 12 is put on the stack else -7 is
  435. put. Then dup is executed.
  436. This must be done into a function (between : and ;).
  437. fdrop :
  438. removes the top function stack entry. In fact, the last function created.
  439. fscan :
  440. display the result of reverse engineering scanner for a function.
  441. The name of the function must follow this instruction.
  442. if :
  443. use to make a test. For example :
  444. toto 1 > if 12 else -7 then
  445. At execution time, if toto is greater than 1 12 is put on the stack else -7 is
  446. put. Then dup is executed.
  447. This must be done into a function (between : and ;).
  448. in :
  449. used to complete the install commands.
  450. Example : install f1 in var
  451. install :
  452. installs a function in a variable. The name must follow this instruction.
  453. This name will be search first in libraries and after in user functions.
  454. Example : install drop in var
  455. install_f :
  456. installs a function in a variable. The name must follow this instruction.
  457. This name will be search first in user functions and after in libraries.
  458. Example : install_f f1 in var
  459. install_v :
  460. installs the content of a variable in another variable. The source name must
  461. follow this instruction.
  462. This name will be search only in variables list.
  463. Example : install_v v1 in v2
  464. load :
  465. loads a source file. The name of the file must follow this instruction.
  466. "load : { "filename" -- }
  467. loads a source file taking the name of the file on the top of character stack.
  468. myself :
  469. use in a function definition to call the function herself (recursive case).
  470. This must be done into a function (between : and ;).
  471. repeat :
  472. use in function programmation to create a loop. For example :
  473. : fonction ... begin ... [condition] while ... repeat ... ;
  474. This must be done into a function (between : and ;).
  475. reset_var :
  476. resets a variable. The name of the variable must follow this instruction.
  477. return :
  478. ends the execution into a function.
  479. stop_task : [ n -- ]
  480. stop the task number n.
  481. then :
  482. use to make a test. For example :
  483. toto 1 > if 12 else -7 then
  484. At execution time, if toto is greater than 1 12 is put on the stack else -7 is
  485. put. Then dup is executed.
  486. This must be done into a function (between : and ;).
  487. until :
  488. use in function programmation to create a loop. For example :
  489. : f1 ... begin ... [condition] until ... ;
  490. This must be done into a function (between : and ;).
  491. var_down :
  492. set DOWN execution of variables.
  493. To execute an instruction seach first in user functions, and then in system
  494. libraries, and finaly in variables.
  495. var_off :
  496. set OFF execution of variables.
  497. To execute an instruction seach first in user functions and then in system
  498. libraries. No seach in variables.
  499. var_up :
  500. set UP execution of variables.
  501. To execute an instruction seach first in variables, then in user functions and
  502. finaly in system libraries.
  503. while :
  504. use in function programmation to create a loop. For example :
  505. : fonction ... begin ... [condition] while ... repeat ... ;
  506. This must be done into a function (between : and ;).
  507. vdrop :
  508. removes the top variable stack entry. In fact, the last variable created.
  509. >csv [ tab1 tab2 ... tabn n -- ] { "filename;libtabn; ... ;libtab1" -- }
  510. create a file filename.csv with the n arrays on the top of the stack. The title of each line can be present after the filename without ".csv", separate by ';'.
  511. >net : [ E1 E2 ... En n -- ]
  512. transfert the n elements from local stack to Net stack using NetKey.
  513. ?n :
  514. displays the Net informations.
  515. ?ns :
  516. displays the Net stack using NetKey.
  517. ndepth : [ -- Net_Stack_Depth ]
  518. returns the number of entries on the Net stack using NetKey.
  519. NetKey : [ key -- ]
  520. changes the value of NetKey. It is a 32 bits INTEGER.
  521. NetErr : [ -- err_value ]
  522. puts the Net Error value on the top of the stack. It is the negative of NetKey!
  523. NetServer : { "ServerName" -- }
  524. changes the default NetServer (localhost).
  525. ndrop :
  526. drops the elements on the Net stack using NetKey.
  527. net> : [ -- E1 E2 ... En ]
  528. transfert all elements from Net stack to local stack using NetKey.
  529. netDt> : [ -- dt ]
  530. get the dt value. It represents the difference between the clock of the network
  531. and the local clock.
  532. This value must be used before sending time value to the net stack, or after
  533. getting time value from the net stack. For examples :
  534. On system A :
  535. time netDt> + 1 >net # transform the local time in network scale and send it.
  536. On system B :
  537. net> netDt> - # get the time of A and translate it in local scale.
  538. netOff :
  539. disconnect from Nife network.
  540. netOn : { "UserName" -- }
  541. connect to Nife network using the NetServer variable. The UserName is memorized
  542. and can be get by Me.
  543. Me : { -- "UserName" }
  544. put on the top of character stack the username. It is the name given with the
  545. last netOn command, or, if absent, the content of environment variables, in
  546. order : NIFENAME, LOGNAME, USERNAME, USER or "Nobody" if variables are absent.
  547. netExec : { "func_name" "UserName" -- }
  548. send a Nife RPC call to execute the function func_name on the system Username.
  549. The result will be send on the network using the current NetKey. If UserName is
  550. not existant, an error occurs. But if func_name does not exist, or fails in the
  551. execution, the negative value of NetKey (NetErr) is returned on the net stack.
  552. netCompile : { "source_file" "UserName" -- }
  553. send a Nife source file to compile it (like load) on the system Username.
  554. If source file does not exist, or UserName is absent an error occurs. If the
  555. file containts function call, the result will be send on the network using
  556. the current NetKey.
  557. If an error occurs during the compilation or the execution, the negative value
  558. of NetKey (NetErr) is returned on the net stack.
  559. srusage :
  560. display a board of NetServer ressources usage.
  561. stopServer :
  562. Tell the NetServer to stop after netOff if no other user is present.
  563. []-sub : [ [v1,v2,...,vl,...,vn] l -- [v1,v2,...,vl] ]
  564. extract a left sub-array from an array. If l > n fill zeros on left side.
  565. []sub : [ [vn,...,vl,...,v2,v1] l -- [vl,...,v2,v1] ]
  566. extract a right sub-array from an array. If l > n fill zeros on right side.
  567. *[]-sub : [ tab1 tab2 ... tabN N l -- tabl1 tabl2 ... tablN ]
  568. extract a left sub-array like sub[] from N arrays. The N arrays have l elements after execution.
  569. *[]sub : [ tab1 tab2 ... tabN N l -- tabl1 tabl2 ... tablN ]
  570. extract a right sub-array like []sub from N arrays. All arrays have l elements after execution.
  571. do : [ limit val -- ]
  572. use in function programmation to create a loop with an index going from val to
  573. limit. Use loop for auto-convergent loop. For examples :
  574. : f1 5 0 do ... loop ... ;
  575. a loop with an index going from 0 to 4 incremented by 1 (i = 0,1,2,3,4).
  576. : f 0 5 do ... loop ... ;
  577. a loop with an index going from 5 to 1 decremented by 1 (i = 5,4,3,2,1).
  578. : f2 15 1 do ... 3 +loop ... ;
  579. a loop with an index going from 1 to 15 incremented by 3 (i = 1,4,7,10,13).
  580. This must be done into a function (between : and ;).
  581. loop :
  582. use in function programmation to create an auto-convergent loop with do using
  583. the default 1 by 1 progression. For example :
  584. : f 5 0 do ... loop ... ;
  585. a loop with an index going from 0 to 4 incremented by 1 (i = 0,1,2,3,4).
  586. : f 0 5 do ... loop ... ;
  587. a loop with an index going from 5 to 1 decremented by 1 (i = 5,4,3,2,1).
  588. This must be done into a function (between : and ;).
  589. +loop : [ inc -- ]
  590. use in function programmation to create a loop with do using the value inc for
  591. incrementation. For example :
  592. : f 15 1 do ... 3 +loop ... ;
  593. a loop with an index going from 1 to 15 incremented by 3 (i = 1,4,7,10,13).
  594. This must be done into a function (between : and ;).
  595. ndo : [ n -- ]
  596. returns the number of do-loop in the running context.
  597. It's usefull before using the indexes I J or K.
  598. I : [ -- val ]
  599. returns the value of the index of the current do-loop.
  600. This must be done into a function (between : and ;).
  601. J : [ -- val ]
  602. returns the value of the index of the do-loop containing the current one.
  603. This must be done into a function (between : and ;).
  604. K : [ -- val ]
  605. returns the value of the index of the second level do-loop containing the
  606. current one.
  607. This must be done into a function (between : and ;).
  608. do_next : [ -- ]
  609. free-context instruction to bypass the end of a loop and go to the next step.
  610. do_leave : [ -- ]
  611. free-context instruction to finish the current loop.
  612. *do_leave : [ n -- ]
  613. free-context instruction to finish the n currents loops.
  614. ?gp :
  615. display the gplot stack.
  616. del_gplot : [ n -- ]
  617. delete the gplot number n. The file is deleted but the screen is keeped.
  618. gplot : { "filename" "title" -- }
  619. create a gplot for one plot having as title "title" and working with the file
  620. filename.
  621. gplotM : [ n -- ] { "filename" "title" -- }
  622. create a gplot for n (Multiple) plots having as title "title" and working with
  623. the file filename.
  624. gplotCmd : [ n -- ] { "options" -- }
  625. updating the string command option of gplot number n.
  626. gplotClear : [ n -- ]
  627. clear the file of the gplot number n.
  628. gplotAdd : [ tab n -- ]
  629. add at the end of the file of gplot number n, a line with data of tab.
  630. gplotRepl : [ tab n -- ]
  631. remove the first line and add at the end of the file of gplot number n, a line
  632. with data of tab.
  633. gplotRaz :
  634. remove all gplots. The files are deleted but the screens are keeped.
  635. ?dev :
  636. lists all the devices available. The DID is at the beginning of the lines.
  637. dev_dflt : [ DID SID CID -- ]
  638. defines default values in order Device ID, Subdevice ID and Channel ID.
  639. ?dev_dflt :
  640. shows informations about the default values device (DID, SID, CID).
  641. dev_dflR : [ -- VAL ]
  642. read the device using the default values DID, SID and CID.
  643. dev_dflW : [ VAL -- ]
  644. write the value VAL on the device using the default values DID, SID and CID.
  645. dev_info : [ DID -- ]
  646. shows informations about device DID.
  647. dev_read : [ DID SID CID -- VAL ]
  648. read the device DID, sub-device SID and channel CID, and put the value on the
  649. numeric stack.
  650. dev_write : [ VAL DID SID CID -- ]
  651. write the value VAL on the device DID, subdevice SID and channel CID.
  652. cos : [ v -- cos(v) ]
  653. compute the cosinus of the value on the top of the stack.
  654. sin : [ v -- sin(v) ]
  655. compute the sinus of the value on the top of the stack.
  656. onerr: :
  657. defines, into a function (between : and ;), a label for programming an errors
  658. treatment in case of an error occurs.
  659. end: :
  660. defines, into a function (between : and ;), a label for programming a end
  661. treatment. In case of an error occurs, theses instructions will be executed if
  662. this label is AFTER the onerr: label.
  663. goto_end :
  664. instruction, into a function (between : and ;), to go to the end: label.
  665. ?err : ( -- T/F )
  666. tests if an error have occured and put true or false, on the logical stack.
  667. ?lasterr :
  668. displays the elements of last error catched by an onerr: label.
  669. messerr : [ n -- ] { -- "error message" }
  670. puts on the character stack the error message number n.
  671. noerr : [ -- n ]
  672. gives the number of last error.
  673. ?i2c :
  674. lists all the I2C buses available. The I2C-ID is at the beginning of the lines.
  675. i2c_info : [ I2C-ID -- ]
  676. shows informations (matrix) about the I2C-ID interface.
  677. i2c_write : [ Value Offset Address I2C-ID -- ]
  678. write Value at data-address Offset for chip-address Address of I2C interface
  679. I2C-ID.
  680. i2c_read : [ Offset Address I2C-ID -- Value ]
  681. read at data-address Offset for chip-address Address of I2C interface I2C-ID.
  682. If Offset equal -1, the read is done directly at Address.
  683. dump :
  684. dumps all things in Nife. The name of the file must follow this instruction.
  685. The contents is not in Nife code, but in Nife Binary Linkable Format (NBLF).
  686. So, the extension ".nblf" will be add automatically to the file name.
  687. This format depends on Scs key and the version of Nife. That's mean that a such
  688. file can be used in an environment with same Scs and same Nife version. It does
  689. not depend on architecture (Intel, ARM, ...) or processor size (32 or 64 bits).
  690. restore :
  691. restores a dumped file. The name of the file must follow this instruction.
  692. The extension ".nblf" will be add automatically to the file name.
  693. See dump for more details.
  694. "saveLog : { "filename" -- }
  695. saves the log and debug file as filename, in the current directory.
  696. [ :
  697. increment the numerical meta-stack. This operation leave the current stack in
  698. his state and create a new one, or reuse it if previously initialised.
  699. ] :
  700. decrement the numerical meta-stack. This operation leave the current stack in
  701. his state and use the previous. All data on the previous stack are retrieved.
  702. { :
  703. increment the character meta-stack. This operation leave the current stack in
  704. his state and create a new one, or reuse it if previously initialised.
  705. } :
  706. decrement the character meta-stack. This operation leave the current stack in
  707. his state and use the previous. All data on the previous stack are retrieved.
  708. ( :
  709. increment the logical meta-stack. This operation leave the current stack in
  710. his state and create a new one, or reuse it if previously initialised.
  711. ) :
  712. decrement the logical meta-stack. This operation leave the current stack in
  713. his state and use the previous. All data on the previous stack are retrieved.
  714. [* :
  715. increment the all data meta-stacks (numerical, character and logical). This
  716. operation leave the currents stacks in their state and create three new one, or
  717. reuse if previously initialised.
  718. ]* :
  719. increment the all data meta-stacks (numerical, character and logical). This
  720. operation leave the currents stacks in their state and use the previous. All
  721. data on the previous stacks are retrieved.
  722. ?ms :
  723. display the indices of meta-stacks. The first is 1.