home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / a / armbob / doc / Ref / Built_in next >
Encoding:
Text File  |  1994-07-14  |  10.1 KB  |  275 lines

  1. ArmBob v.1.02 Reference                                GCW 06/06/94
  2.  
  3.        ----------------- BUILT IN NAMES ---------------
  4.  
  5. The following functions are built into Bob:
  6.  
  7. getarg(i)      string      Returns the i-th argument on the
  8.                            command line.
  9.  
  10. gc()           nil         Force a garbage collection.
  11.  
  12. newvector(n)   vector      Create a vector of n nils in the heap.
  13.  
  14. newstring(n)   string      Create a string of n ASCII nul codes in 
  15.                            the heap.
  16.  
  17. oscli(s)       nil         Sends a string s to the command line
  18.                            interpreter. This was called 'system' in
  19.                            Bob.
  20.  
  21. sizeof(x)      integer     Returns the size of a string x or the
  22.                            number of components of a vector x.
  23.  
  24. typeof(x)      integer     x can be anything. See below for the
  25.                            synonyms for the type codes.
  26.  
  27. ArmBob also has the following functions:
  28.  
  29. input()        string      Gets an input string. Leading spaces are 
  30.                            not removed. This uses OS_ReadLine.
  31.  
  32. quit(s)        nil         Causes the program to exit with a message
  33.                            string s to stderr. See ref.LowLevel for
  34.                            behaviour of this function in wimp
  35.                            programs.
  36.  
  37. rnd()          integer     Returns a random positive integer.
  38.  
  39. seed(n)        nil         Seeds the random number generator with
  40.                            the integer n.
  41.  
  42. sysvar(s)      string      Gets the value of a string system variable
  43.                            named by the string s.
  44.  
  45. time()         integer     Gets the first 32 bits of the time in 
  46.                            centiseconds since the beginning of the 
  47.                            century.
  48.  
  49. val(s)         integer     Converts as many characters of the string
  50.                            s to an integer as it can. Decimal or
  51.                            hexadecimal numbers (prefixed by &) are
  52.                            recognized.
  53.  
  54. start_task(s)  integer     Takes a command in the string s to start
  55.                            up a child task, and returns its task
  56.                            handle. This works both from BobFiles
  57.                            (i.e. from a command window) or from
  58.                            BobTasks (i.e. from a taskwindow). This
  59.                            function should only be used outside
  60.                            wimp programs (i.e. before wimp_init
  61.                            or after wimp_closedown). There are
  62.                            other means of starting a child task from
  63.                            within a wimp program.
  64.  
  65.  
  66. See also ref.types for the iostream functions
  67.  
  68.         fclose, getc, fopen, putc, print
  69.  
  70. and for the built in iostreams stdin, stdout, stderr.
  71.  
  72. See also ref.LowLevel for built-in wimp functions.
  73.  
  74. Operators
  75. ---------
  76.  
  77. Ternary:
  78.  
  79.    c?yes:no     c an integer. If c is nonzero, evaluates to yes (no
  80.                 is not evaluated), otherwise it evaluates to no (yes
  81.                 is not evaluated).
  82.  
  83. Binary:
  84.  
  85.     x || y      x, y integers. If x is nonzero, evaluates to 1,
  86.                 without evaluating y. Otherwise it returns 0 if y
  87.                 is zero and -1 otherwise.
  88.  
  89.     x && y      x, y integers. If x is zero it returns 0 without
  90.                 evaluating y. Otherwise it returns 0 if y is zero
  91.                 and 1 otherwise.
  92.  
  93.     x | y       x, y integers. Returns the bitwise OR of x and y.
  94.  
  95.     x ^ y       x, y integers. Returns the bitwise XOR of x and y.
  96.  
  97.     x & y       x, y integers. Returns the bitwise AND of x and y.
  98.  
  99.     x == y      x, y both integers or both strings. It returns 0
  100.                 if they are different and 1 if they are equal.
  101.  
  102.     x != y      x, y both integers or both strings. It returns 1
  103.                 if they are different and 0 if they are equal.
  104.  
  105.     x < y       x, y both integers or both strings. It returns 1
  106.                 if x strictly precedes y or else 0.
  107.  
  108.     x <= y      x, y both integers or both strings. It returns 1
  109.                 x precedes or equals y or else 0.
  110.  
  111.     x >= y      x, y both integers or both strings. It returns 1
  112.                 if y precedes or equals x or else 0.
  113.  
  114.     x > y       x, y both integers or both strings. It returns 1 if
  115.                 if y strictly precedes x or else 0.
  116.  
  117.     x >> y      x, y both integers. It returns x arithmetically shifted
  118.                 right by y bits.
  119.  
  120.     x << y      If x, y are both integers it returns x shifted left by
  121.                 y bits. If x is an iostream and y a string, it outputs
  122.                 y to x and returns the result x.
  123.  
  124.     x + y       If x, y are both integers it returns their sum. If x, y
  125.                 are both strings it returns their concatenation. If
  126.                 either x or y is a string and the other argument is an
  127.                 integer, the other argument is converted to the string
  128.                 consisting of the single character given by the ASCII
  129.                 code of the bottom 8 bits and the result is the
  130.                 concatenation of the two strings.
  131.  
  132.     x - y       x, y both integers. The difference is returned.
  133.  
  134.     x * y       x, y both integers. The product is returned.
  135.  
  136.     x % y       x, y both integers. The remainder is returned.
  137.  
  138.     x / y       x, y both integers. The quotient is returned.
  139.  
  140. Unary:
  141.  
  142.     -x          x integer. Minus x.
  143.  
  144.     !x          x integer. Returns 0 if x is nonzero and 1 otherwise.
  145.  
  146.     ~x          x integer. Returns the bitwise NOT of x.
  147.  
  148. Binary assignment:
  149.  
  150.     x = y       Assign y to x, and return y.
  151.  
  152.     x += y      Assign x+y to x, and return y.
  153.  
  154.     x -= y      Assign x-y to x, and return y.
  155.  
  156.     x *= y      Assign x*y to x, and return y.
  157.  
  158.     x /= y      Assign x/y to x, and return y.
  159.  
  160.     x %= y      Assign x%y to x, and return y.
  161.  
  162.     x &= y      Assign x&y to x, and return y.
  163.  
  164.     x |= y      Assign x|y to x, and return y.
  165.  
  166.     x ^= y      Assign x^y to x, and return y.
  167.  
  168.     x >>= y     Assign x>>y to x, and return y.
  169.  
  170.     x <<= y     Assign x<<y to x, and return y.
  171.  
  172. Unary assignment:
  173.  
  174.     x++         Evaluate x in current expression, and then assign
  175.                 x+1 to x.
  176.  
  177.     x--         Evaluate x in current expression, and then assign
  178.                 x-1 to x.
  179.  
  180.     ++x         Assign x+1 to x before further evaluation.
  181.  
  182.     --x         Assign x-1 to x before further evaluation.
  183.  
  184. Numerical Synonyms
  185. ------------------
  186. The following C source file describes the built-in numerical
  187. constants:
  188.  
  189. /* Built in constants */
  190. /*
  191.       G.C.Wraith  26/1/94
  192. */
  193. struct {char *const_keyword; int constant; } constab[] = {
  194. { "TRUE",                            1    },
  195. { "FALSE",                           0    },
  196. { "EOF",                            -1    },
  197. { "NIL",                             0    },
  198. { "CLASS",                           1    },
  199. { "OBJECT",                          2    },
  200. { "VECTOR",                          3    },
  201. { "INTEGER",                         4    },
  202. { "STRING",                          5    },
  203. { "BYTECODE",                        6    },
  204. { "CODE",                            7    },
  205. { "DICTIONARY",                      8    },
  206. { "VARIABLE",                        9    },
  207. { "IOSTREAM",                       10    },
  208. { "Null_Reason_Code",                0    },
  209. { "Redraw_Window_Request",           1    },
  210. { "Open_Window_Request",             2    },
  211. { "Close_Window_Request",            3    },
  212. { "Pointer_Leaving_Window",          4    },
  213. { "Pointer_Entering_Window",         5    },
  214. { "Mouse_Click",                     6    },
  215. { "User_Drag_Box",                   7    },
  216. { "Key_Pressed",                     8    },
  217. { "Menu_Selection",                  9    },
  218. { "Scroll_Request",                 10    },
  219. { "Lose_Caret",                     11    },
  220. { "Gain_Caret",                     12    },
  221. { "Poll_word",                      13    },
  222. { "User_Message",                   17    },
  223. { "User_Message_Recorded",          18    },
  224. { "User_Message_Acknowledge",       19    },
  225. { "Message_Quit",                    0    },
  226. { "Message_DataSave",                1    },
  227. { "Message_DataSaveAck",             2    },
  228. { "Message_DataLoad",                3    },
  229. { "Message_DataLoadAck",             4    },
  230. { "Message_DataOpen",                5    },
  231. { "Message_RAMFetch",                6    },
  232. { "Message_RAMTransmit",             7    },
  233. { "Message_PreQuit",                 8    },
  234. { "Message_PaletteChange",           9    },
  235. { "Message_SaveDesktop",            10    },
  236. { "Message_DeviceClaim",            11    },
  237. { "Message_DeviceInUse",            12    },
  238. { "Message_DataSaved",              13    },
  239. { "Message_ShutDown",               14    },
  240. { "Message_FilerOpenDir",        0x400    },
  241. { "Message_FilerCloseDir",       0x401    },
  242. { "Message_FilerOpenDirAt",      0x402    },
  243. { "Message_FilerSelectionDirectory", 0x403 },
  244. { "Message_FilerAddSelection",   0x404    },
  245. { "Message_FilerAction",         0x405    },
  246. { "Message_FilerControlAction",  0x406    },
  247. { "Message_FilerSelection",      0x407    },
  248. { "Message_AlarmSet",            0x500    },
  249. { "Message_AlarmGoneOff",        0x501    },
  250. { "Message_HelpRequest",         0x502    },
  251. { "Message_HelpReply",           0x503    },
  252. { "Message_MenuWarning",       0x400c0    },
  253. { "Message_ModeChange",        0x400c1    },
  254. { "Message_TaskInitialise",    0x400c2    },
  255. { "Message_TaskCloseDown",     0x400c3    },
  256. { "Message_SlotSize",          0x400c4    },
  257. { "Message_SetSlot",           0x400c5    },
  258. { "Message_TaskNameRq",        0x400c6    },
  259. { "Message_TaskNameIs",        0x400c7    },
  260. { "Message_TaskStarted",       0x400c8    },
  261. { "Message_MenusDeleted",      0x400c9    },
  262. { "Message_Iconize",           0x400ca    },
  263. { "Message_WindowClosed",      0x400cb    },
  264. { "Message_WindowInf",         0x400cc    },
  265. { "TaskWindow_Input",          0x808c0    },
  266. { "TaskWindow_Output",         0x808c1    },
  267. { "TaskWindow_Ego",            0x808c2    },
  268. { "TaskWindow_Morior",         0x808c3    },
  269. { "TaskWindow_Morire",         0x808c4    },
  270. { "TaskWindow_NewTask",        0x808c5    },
  271. { "TaskWindow_Suspend",        0x808c6    },
  272. { "TaskWindow_Resume",         0x808c7    },     
  273. {    0,                              0    }};
  274.  
  275.                ------------- END -------------------