home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / rexxmd11.zip / rexx-doc.el next >
Lisp/Scheme  |  1994-07-22  |  19KB  |  390 lines

  1. ;;; rexx-doc.el --- REXX completion and documentation for use with rexx-mode.el
  2. ;; Copyright (C) 1994 Free Software Foundation, Inc.
  3.  
  4. ;; Maintainer: Scott Maxwell - scottmax@netcom.com
  5. ;; Keywords: rexx
  6.  
  7.  
  8. ;; If you would like to make a file of additional documentation for
  9. ;; a package of external function calls, you should make a file in
  10. ;; the following format and distribute it with your package.  If you
  11. ;; have rexx-os2.el, you can use this as a template.
  12. ;;
  13. ;;(setq rexx-external-function-table
  14. ;;      (append '(
  15. ;;          ("name1" . info)
  16. ;;          ("name2" . info))
  17. ;;            rexx-external-function-table))
  18. ;;
  19. ;;********************* IMPORTANT ******************************
  20. ;; The first element must be the function name in all lowercase.
  21. ;;********************* IMPORTANT ******************************
  22. ;;
  23. ;; The info element can be either nil or a list.
  24. ;; If it is a list, it can have up to five elements.  These are:
  25. ;;   1) Pretty name.  For instance "BitAnd".  If this is present
  26. ;;    rexx-mode will use it instead of capitalizing.
  27. ;;
  28. ;;   2) Type/package.  This is usually just the name of the
  29. ;;    function package i.e. "RexxUtil".  In this case, the
  30. ;;    documentation string would describe the function as:
  31. ;;      "an external function from the RexxUtil package"
  32. ;;
  33. ;;    Alternatively, you can put a different description here.
  34. ;;    If there are any spaces in the type/package field, rexx-mode
  35. ;;    will automatically print just the field.  For instance:
  36. ;;      ("aack" . (nil "an function for modifying Bill"))
  37. ;;    specifies a function called "aack" that uses default
  38. ;;    capitalization, and is described by rexx-function-help as:
  39. ;;      "aack: an function for modifying Bill"
  40. ;;
  41. ;;   3) Documentation string.  This can be multiple lines.  For instance:
  42. ;;      ("accept" . (nil "\"VX-Rexx method for DDEClient" "Syntax:
  43. ;;ok=VRMethod( object, \"Accept\", [conversation])
  44. ;;
  45. ;;Description:
  46. ;;  Establishes a conversation with a DDE server."))
  47. ;;
  48. ;;    Note that additional lines should start at the left edge and
  49. ;;    all quotes must be specified as \".
  50. ;;
  51. ;;   4) Set to t if this is not actually a function and should only
  52. ;;    follow a quote character, for instance:
  53. ;;      ("addfield" . ("AddField" "VX-Rexx method" nil t))
  54. ;;    specifies a method called "addfield" which will be converted
  55. ;;    to the pretty name of "AddField" if rexx-function-auto-capitilize
  56. ;;    is non-nil and will only appear immediately following " or '.
  57. ;;    It will be described as:
  58. ;;      "AddField: VX-Rexx method"
  59. ;;   5) Specifies a function to run every time this element is capitalized
  60. ;;    by hitting space or open paren at the end of a line.  This can be
  61. ;;    used for further automating complex function completion.  For more
  62. ;;    information, look at the doc for rexx-do-super-completion.  Also,
  63. ;;    look at    RxFuncAdd in rexx-os2.el for an example of how this works.
  64. ;;    Rexx-mode provides rexx-complete-external for doing mini-buffer
  65. ;;    completion on external function names.
  66. ;;    NOTE: This extra expansion will not kick in unless the user defines
  67. ;;          rexx-super-completion-mode as t.
  68.  
  69. ;;
  70. ;; You should also instruct your users to add a group of lines that
  71. ;; looks something like this to their .emacs file:
  72. ;;    (setq rexx-additional-doc-files '("rexx-os2"
  73.                       "vxrexx-doc"
  74. ;;                      "myfuncs-doc"))
  75. ;; Then they will need to kill and reload Emacs.
  76.  
  77.  
  78. (setq rexx-command-table
  79.       '(
  80.     ("abbrev" . (nil "function" "is=Abbrev(string,abbrev,[len]\n
  81. Returns 1 if string starts with abbrev."))
  82.     ("abs" . (nil "function" "a=Abs(number)\n
  83. Returns the absolute value of number."))
  84.     ("address" . (nil "command and function" "Command  form: ADDRESS environment [expression]
  85. Function form: env=Address()
  86.  
  87. The command form changes the environment.  If an expression is specified,
  88. the environment automatically reverts back after the expression is evaluated.
  89. Otherwise, the environment is changed until the next ADDRESS command is
  90. encountered.
  91.  
  92. The function form simply returns the name of the current environment."))
  93.     ("arg" . (nil "command and function" "Command  form: ARG template
  94. Function form: a=Arg([n],[option])
  95.  
  96. The command form is shorthand for PARSE UPPER ARG and is used to parse
  97. command-line or procedure parameters.
  98.  
  99. The function for returns the nth parameter passed to the procedure or
  100. program.  If the 'E'xists or 'O'mitted option is specified, the function
  101. returns 1 if the condition is true for the nth parameter.
  102. If neither n nor option is specified, Arg returns the number of parameters.
  103. Note: The first parameter is 1."))
  104.     ("b2x" . (nil "function" "x=B2X(binary_string)\n
  105. Returns ASCII hex representation of the ASCII binary string."))
  106.     ("beep" . (nil "function" "call beep [frequency],[duration]\n
  107. Frequency specifies Hertz and duration specifies milliseconds.
  108. Often both parameters are omitted and the default beep is used."))
  109.     ("bitand" . ("BitAnd" "function" "ba=BitAnd(string1,string2,[pad])"))
  110.     ("bitor" . ("BitOr" "function" "bo=BitOr(string1,string2,[pad])"))
  111.     ("bitxor" . ("BitXor" "function" "bx=BitXor(string1,string2,[pad])"))
  112.     ("by" . (nil "do sub-command"))
  113.     ("c2d" . ("C2D" "function" "d=C2D(string,[n])\n
  114. Converts a single character or pair of characters to a decimal number.
  115. If n is not specified, an unsigned number is returned.  If n is 0,
  116. 0 is returned.  If n is not 0, a signed 16bit number is returned.
  117.  
  118. Example:
  119.   C2D('A') -> 65"))
  120.     ("c2x" . ("C2X" "function" "hx=C2X(string)\n
  121. Returns the hexidecimal representation of a string."))
  122.     ("call" . (nil "command" "CALL name [expressions]
  123. CALL OFF ERROR|FAILURE|HALT|NOTREADY
  124. CALL ON ERROR|FAILURE|HALT|NOTREADY [NAME trap-name]"))
  125.     ("center" . (nil "function" "c=Center(string,length,[pad])"))
  126.     ("centre" . (nil "function" "c=Centre(string,length,[pad])"))
  127.     ("charin" . ("CharIn" "function" "c=CharIn([filename],[start],[length])\n
  128. If filename is not specified, it defaults to STDIN.
  129. If start is not specified, it defaults to the next character.
  130. A value of 1 specifies the beginning of the file.
  131. If length is not specified, it defaults to 1."))
  132.     ("charout" . ("CharOut" "function" "c=CharOut([filename],[string],[start])\n
  133. If filename is not specified, it defaults to STDOUT.
  134. If start is not specified, it defaults to the next character.
  135. A value of 1 specifies the beginning of the file.
  136. If neither string nor start is specified, the file is closed.
  137.  
  138. Returns the number of characters written."))
  139.     ("chars" . (nil "function" "c=Chars([filename])\n
  140. Returns the number of characters remaining to be read in the stream
  141. or STDIN if no filename is specified."))
  142.     ("compare" . (nil "function" "c=Compare(string1,string2,[pad])\n
  143. Returns 0 if both strings are identical otherwise returns the character
  144. number where they first differ.  Pad defaults to space and is used to
  145. extend the shorter string."))
  146.     ("condition" . (nil "function" "c=Condition([option])\n
  147. Returns requested information about the current error trap.
  148. Options are:  'C'ondition name
  149.           'D'escription (this is the default)
  150.           'I'nstruction
  151.           'S'tatus (i.e. ON or OFF)"))
  152.     ("copies" . (nil "function" "c=Copies(string,n)\n
  153. Returns a string with n copies of string."))
  154.     ("d2c" . ("D2C" "function" "c=D2C(wholenumber,[n])\n
  155. Returns the character representation of wholenumber. n specifies the length.
  156. If it is greater than 1, the string will be padded with spaces on the left."))
  157.     ("d2x" . ("D2X" "function" "x=D2X(wholenumber,[n])\n
  158. Returns the hexidecimal representation of wholenumber.
  159. n specifies the length, padding the string with zeros."))
  160.     ("datatype" . ("DataType" "function" "d=DataType(string,[type])\n
  161. If type is not specified, DataType returns either NUM or CHAR.
  162. Otherwise, DataType returns 1 if the string is of the specified type.
  163. Valid types are:
  164.   'A'lphanumeric    (A-Z, a-z, 0-9
  165.   'B'its        (0 or 1)
  166.   'C'            (mixed SBCS/DBCS string)
  167.   'D'bcs        (pure DBCS string)
  168.   'L'owercase
  169.   'M'ixed case
  170.   'N'umber
  171.   'S'ymbol        (character valid in REXX symbols including A-Z, a-z)
  172.   'U'ppercase
  173.   'W'hole number
  174.   he'X'adecimal        (0-9, A-F, a-f, space)"))
  175.     ("date" . (nil "function" "d=Date([option])\n
  176. With no option, return dd mon yyyy (i.e. 12 Jul 1994).
  177. Options include:
  178.   'B'asedate    Number of days since January 1, 0001
  179.   'D'ays    Number of days so far this year.
  180.   'E'uropean    dd/mm/yy
  181.   'L'anguage    Returns dd Month yyyy in the local language format
  182.   'M'onth    Full English name for month
  183.   'N'ormal    As default
  184.   'O'rdered    yy/mm/dd (good for sorting)
  185.   'S'orted    yyyymmdd (maybe even better for sorting)
  186.   'W'eekday    Full English name for the day of the Week"))
  187.     ("delstr" . ("DelStr" "function" "d=DelStr(string,n,[length])"))
  188.     ("delword" . ("DelWord" "function" "d=DelWord(string,n,[length])"))
  189.     ("digits" . (nil "function" "d=Digits()\n
  190. Returns current setting of NUMERIC DIGITS."))
  191.     ("directory" . (nil "function" "d=Directory([name])\n
  192. If name is not specified, returns current directory.
  193. If specified, changes to name, returning name or success, null or failure.
  194. NOTE: Name cannot end with '\' unless it is the root directory."))
  195.     ("do" . (nil "command" "Start a DO construct."))
  196.     ("drop" . (nil "command" "DROP var1 [var2] [var3]\n
  197. Uninitializes variables."))
  198.     ("else" . (nil "command" "Used in IF/ELSE construct."))
  199.     ("end" . (nil "command" "End a DO or SELECT block."))
  200.     ("endlocal" . ("EndLocal" "function" "Call EndLocal\n
  201. Resets drive, directory and environment saved in last SetLocal."))
  202.     ("errortext" . ("ErrorText" "function" "e=ErrorText(n)\n
  203. Returns error message associated with n (0-99)."))
  204.     ("exit" . (nil "command" "EXIT [expression]\n
  205. Leaves program returning expression."))
  206.         ("expose" . (nil "procedure sub-command" "label: PROCEDURE EXPOSE varlist\n
  207. Used to allow variables to remain visible inside a procedure.
  208. Varlist can be any number of space delimited variable names.
  209. If a variable name is enclosed in parenthesis, all variables listed
  210. in the text of that variable are also exposed."))
  211.     ("filespec" . ("FileSpec" "function" "f=FileSpec(option,filespec)\n
  212. Option can be:
  213.   'D'rive    Drive letter with ':'
  214.   'P'ath    Path with trailing '\'
  215.   'N'ame    Name part of the filespec"))
  216.     ("for" . (nil "do sub-command"))
  217.     ("forever" . (nil "do sub-command"))
  218.     ("form" . (nil "function" "f=Form()"))
  219.     ("format" . (nil "function" "f=Format(number,[before],[after],[expp],[expt])"))
  220.     ("fuzz" . (nil "function" "f=Fuzz()"))
  221.     ("if" . (nil "command"))
  222.     ("insert" . (nil "function" "f=Insert(new,target,[n],[length],[pad])\n
  223. Inserts new string into target at n or beginning."))
  224.     ("interpret" . (nil "command" "INTERPRET expression"))
  225.     ("iterate" . (nil "command" "ITERATE\n
  226. Go back to top of DO loop.  Like 'continue' in C."))
  227.     ("lastpos" . ("LastPos" "function" "l=LastPos(search,string,[start])"))
  228.     ("leave" . (nil "command" "LEAVE\n
  229. Breaks out of DO loop.  Like 'break' in C."))
  230.     ("left" . (nil "function" "l=Left(string,length,[pad])"))
  231.     ("length" . (nil "function" "l=Length(string)"))
  232.     ("linein" . ("LineIn" "function" "l=LineIn([filename],[line],[count])\n
  233. Reads count lines from filename.  If filename is not specified, STDIN is used.
  234. In OS/2, the only legal value for line if specified is 1, start of file.
  235. Legal values for count are 0 and 1."))
  236.     ("lineout" . ("LineOut" "function" "l=LineOut([filename],[string],[line])\n
  237. Write string to filename, returning 0 if successful, 1 if not.
  238. If filename is not specified, STDOUT is used.
  239. If line is specified, it must be 1 in OS/2, start of file."))
  240.     ("lines" . (nil "function" "l=Lines([filename])\n
  241. Returns lines remaining to be read from filename.
  242. If filename is not specified STDOUT is assumed."))
  243.     ("max" . (nil "function" "m=Max(num,[num2],[num3],..)"))
  244.     ("min" . (nil "function" "m=Min(num,[num2],[num3],..)"))
  245.     ("nop" . (nil "command" "Does nothing.  Most often used after OTHERWISE, THEN and ELSE."))
  246.     ("numeric" . (nil "command"))
  247.     ("off" . (nil "call/signal sub-command"))
  248.     ("on" . (nil "call/signal sub-command"))
  249.     ("options" . (nil "command"))
  250.     ("otherwise" . (nil "command" "Used with SELECT."))
  251.     ("overlay" . (nil "function" "o=Overlay(new,target,[n],[length],[pad])"))
  252.     ("parse" . (nil "command" "
  253. PARSE [UPPER]    ARG    template    parses program/function parameters
  254.         PULL    template    parses input from queue or STDIN
  255.         SOURCE    template    get system info (OS/2 4OS2 C:\TEST.CMD)
  256.         VALUE expression WITH template
  257.         VAR name template    parse variable contents
  258.         VERSION template    REXX version info
  259.         LINEIN    template    parse next line from STDIN"))
  260.     ("pos" . (nil "function" "l=LastPos(search,string,[start])"))
  261.     ("procedure" . (nil "command" "label: PROCEDURE\n
  262. Starts a new procedure.  Any variable not exposed becomes local and
  263. undefined.  See EXPOSE."))
  264.     ("pull" . (nil "command" "PULL template\n
  265. Short form for PARSE UPPER PULL."))
  266.     ("push" . (nil "command" "PUSH expression\n
  267. Pushes the results of the expression onto the head of the active QUEUE."))
  268.     ("queue" . (nil "command" "QUEUE expression\n
  269. Pushes the results of the expression onto the tail of the active QUEUE.")) 
  270.     ("queued" . (nil "function" "q=Queued()\n
  271. Count of lines remaining on the active queue."))
  272.     ("random" . (nil "function" "
  273. r=Random()            return random number between 0 and 999
  274. r=Random(max)            return random number between 0 and max
  275. r=Random([min],[max],[seed])    return random number between min and max"))
  276.     ("return" . (nil "command" "RETURN [expression]\n
  277. Return from program or procedure with expression."))
  278.     ("reverse" . (nil "function" "r=Reverse(string)"))
  279.     ("right" . (nil "function" "r=Right(string,length,[pad])"))
  280.     ("rxqueue" . ("RxQueue" "function" "newq=RxQueue(command,[queuename])\n
  281. Command can be:
  282.  \"Create\"    Creates queue with specified or default name.  Returns name.
  283.  \"Delete\"    Deletes named queue.  Returns 0 if successful.
  284.  \"Get\"        Returns the name of the current queue.
  285.  \"Set\"        Sets the name of the current queue and returns previous."))
  286.     ("say" . (nil "command" "SAY [expression]"))
  287.     ("select" . (nil "command" "
  288. SELECT
  289.  WHEN expression THEN
  290.    expression
  291.  WHEN expression THEN
  292.    expression
  293.  OTHERWISE
  294.    NOP
  295. END"))
  296.     ("setlocal" . ("SetLocal" "function" "CALL SetLocal\n
  297. Saves current drive, directory and environment until next GetLocal."))
  298.     ("sign" . (nil "function" "s=Sign(number)\n
  299. Returns -1, 0, or 1 depending on sign of number."))
  300.     ("signal" . (nil "command" "SIGNAL labelname
  301. SIGNAL OFF ERROR|FAILURE|HALT|NOTREADY
  302. SIGNAL ON ERROR|FAILURE|HALT|NOTREADY [NAME trap-name]\n
  303. Signal does a hard goto.  It also aborts all DO, IF, INTERPRET and SELECT
  304. statements.  It should NOT generally be used like goto in other languages."))
  305.     ("source" . (nil "parse sub-command"))
  306.     ("sourceline" . ("SourceLine" "function" "s=SourceLine([n])\n
  307. If n is not specified, returns total number of lines in source file.
  308. Otherwise returns nth line of sourcefile."))
  309.     ("space" . (nil "function" "s=Space(string,[n],[pad])\n
  310. Replaces blanks between words with n pad characters.  Defaults to 1 space."))
  311.     ("stream" . (nil "function" "s=Stream(name,[option],[command])\n
  312. Returns state of string or result of command.  Options are:
  313.   'C'ommand      Commands include:
  314.             'OPEN'
  315.             'CLOSE'
  316.             'SEEK' offset     Offset can be:
  317.                         =num    from start (default)
  318.                         <num    from end
  319.                         +num    forward from current
  320.                         -num    backward from current
  321.             'QUERY EXISTS'     Returns pathname if exists
  322.             'QUERY SIZE'     Returns size in bytes
  323.             'QUERY DATETIME' Returns date and time stamps
  324.   'D'escription      Extended stream state info
  325.   'S'tate      Basic stream state info.  This is the default."))
  326.     ("strip" . (nil "function" "s=Strip(string,[option],[char])\n
  327. Strips spaces or char from string.  Options are:
  328.   'B'oth    Leading and trailing.  This is the default.
  329.   'L'eading
  330.   'T'railing"))
  331.     ("substr" . ("SubStr" "function" "s=SubStr(string,n,[length],[pad])\n
  332. Returns substring of string starting at n."))
  333.     ("subword" . ("SubWord" "function" "s=SubWord(string,n,[length])"))
  334.     ("symbol" . (nil "function" "s=Symbol(name)\n
  335. Returns state of symbol name.  Return values are VAR, LIT and BAD."))
  336.     ("then" . (nil "command" "Used with IF and WHEN."))
  337.     ("time" . (nil "function" "t=Time([option])\n
  338. Returns 24-hour time by default, i.e. 16:31:50.  Options are:
  339.  'C'ivil    hh:mmxx where xx is either am or pm
  340.  'E'lapsed    sssssssss.uu0000  Number of seconds and tenths since 'R'eset
  341.  'H'ours    hh
  342.  'L'ong        hh:mm:ss.uu0000
  343.  'M'inutes    mmmm  Minutes since midnight
  344.  'N'ormal    as default
  345.  'R'eset    like 'E'lapsed but also resets."))
  346.     ("to" . (nil "do sub-command"))
  347.     ("trace" . (nil "command and function"))
  348.     ("translate" . (nil "function" "t=Translate(string,[outtab],[intab],[pad])\n
  349. If outtab and intab are unspecified, returns uppercase of string.
  350. If specified, translates all intab characters to corresponding
  351. outtab characters."))
  352.     ("trunc" . (nil "function" "t=Trunc(number,[n])\n
  353. Returns number with 0 or n digits after decimal."))
  354.     ("until". (nil "do sub-command"))
  355.     ("upper" . (nil "parse sub-command"))
  356.     ("value" . (nil "function and parse/signal/trace sub-command" "v=Value(expression,[newval],[selector])\n
  357. Returns value of variable in expression, i.e. v=Value('aack') would
  358. return the value of aack.  If newval is specified, the variable is set
  359. to newval.  If selector is specified in OS/2, it must be 'OS2ENVIRONMENT'.
  360. This allows you to manipulate environment strings instead of REXX strings."))
  361.     ("var" . (nil "parse sub-command"))
  362.     ("verify" . (nil "function" "v=Verify(string,reference,[option],[start])\n
  363. Option may be 'M'atch or 'N'omatch, nomatch being the default.
  364. If it is nomatch, the position of the first character in string not contained
  365. in reference is returned or 0 if all match.  If it is match, the position of
  366. the first character in string also found in reference is returned or 0 if none."))
  367.     ("version" . (nil "parse sub-command"))
  368.     ("when" . (nil "command" "Used with SELECT."))
  369.     ("while" . (nil "do sub-command"))
  370.     ("with" . (nil "value sub-command"))
  371.     ("word" . (nil "function" "w=Word(string,n)\n
  372. Returns nth word of string."))
  373.     ("wordindex" . ("WordIndex" "function" "w=WordIndex(string,n)\n
  374. Returns position of start of nth word in string."))
  375.     ("wordlength" . ("WordLength" "function" "w=WordLength(string,n)\n
  376. Returns the length of the nth word in string."))
  377.     ("wordpos" . ("WordPos" "function" "w=WordPos(phrase,string,[start])\n
  378. Returns the word number of phrase in string."))
  379.     ("words" . (nil "function" "w=Words(string)\n
  380. Returns number of words in string."))
  381.     ("x2b" . ("X2B" "function" "b=X2B(hexstring)\n
  382. Returns ASCII binary representation of hexstring."))
  383.     ("x2c" . ("X2C" "function" "c=X2C(hexstring)\n
  384. Converts hexstring to a string of characters."))
  385.     ("x2d" . ("X2D" "function" "d=X2D(hexstring)
  386. Converts hexstring to decimal."))
  387.     ("xrange" . ("XRange" "function" "x=XRange([start],[end])\n
  388. Returns a string containing all characters between start and end.
  389. Start and end default to '00'x and 'FF'x respectively."))))
  390.