home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / AZTEC-C / COMND004.ARK / COMND.R < prev    next >
Text File  |  1986-06-17  |  28KB  |  704 lines

  1. .ff 1
  2. .dm Pp
  3. .sp 1
  4. .ti +5
  5. .ne 10
  6. .em
  7. ..
  8. .dm Bb
  9. .sp 1
  10. .in +3
  11. .em
  12. ..
  13. .dm Bi
  14. .sp 1
  15. .ti -2
  16. .em
  17. ..
  18. .dm Be
  19. .sp 1
  20. .in -3
  21. .em
  22. ..
  23. .pl 60
  24. .in 8
  25. .rm 72
  26. .ce 1
  27. C O M N D
  28. .sp 1
  29. .ce 2
  30. A TOPS-20 style command parsing library
  31. for personal computers
  32. .sp 3
  33. .fi
  34. .Pp
  35. Documentation and source code Copyright (C) 1985 by Mark E. Mallett;
  36. permission is granted to distribute this document and the code
  37. indiscriminately.  Please leave credits in place, and add your own
  38. as appropriate.
  39. .sp 2
  40. .ce 1
  41. A Disclaimer
  42. .sp 2
  43. .Pp
  44. The code which implements this library takes up about 12Kb of space on
  45. my CP/M system using Manx's AZTEC CII Z80 compiler (10Kb with the date/time
  46. support stubbed out).  I don't claim that the coding is very efficient
  47. nor do I make any other claims about the code in general.  I do believe
  48. that the definition of the call interface is reasonable, and for me,
  49. this has made it quite usable.
  50. .bp
  51. .sp3
  52. .ce 1
  53. This Document
  54. .sp 2
  55. .Pp
  56. This document contains the following sections:
  57. .Bb
  58. .Bi
  59. Document overview (this here section)
  60. .Bi
  61. Introduction and history
  62. .Bi
  63. Functional overview
  64. .Bi
  65. How to write programs using the subroutine library
  66. .Bi
  67. How to make the library work on your system
  68. .Be
  69. .bp
  70. .sp 3
  71. .ce 1
  72. Introduction and History
  73. .sp 2
  74. .Pp
  75. This document describes the COMND subroutine package for C programmers.
  76. COMND is a subroutine library to effect consistent parsing of user
  77. input, and in general is well suited for verb-argument style command
  78. interfaces.  The library provides a consistent user interface as well
  79. as a program interface which, I believe, could well remain unchanged if
  80. the parsing library were re-written to support different interface
  81. requirements (such as menu interaction).
  82. .Pp
  83. The COMND interface is based on the TOPS-20 model.  TOPS-20 is an operating
  84. system which is/was used by Digital Equipment Corporation on their
  85. PDP-20 computer.  TOPS-20 was based on TENEX, written by BBN (I think,
  86. I think).  TOPS-20 COMND is much more robust and consistent than the
  87. library which this document describes; this library being intended for
  88. small computer applications, it provides the most commonly used functions.
  89. .Pp
  90. This library was written on a Z-80 system running Digital Research
  91. Corporation's CP/M operating system version 3.0 (CPM+).  I have also
  92. compiled and tried it on a VAX 11/780 running VMS.  It is completely
  93. written in the C language, and contains only a few operating system
  94. specific elements.
  95. .Pp
  96. The COMND JSYS section of the TOPS-20 Monitor Calls manual is probably
  97. a good thing to read.
  98. .Pp
  99. Please note: while there are a few unimplemented sections of this
  100. library, I felt that it was nevertheless worthwhile to submit it to
  101. public domain since it is usable for almost all general command parsing
  102. and since the call interface is well defined.  I have used this library
  103. extensively since sometime in 1984.
  104. .bp
  105. .sp 2
  106. .ce 1
  107. Functional Overview
  108. .sp 3
  109. .Pp
  110. The COMND subroutine library provides a command-oriented user interface
  111. which is consistent at the programmer level and at the user level.
  112. At the program level, it gives an algorithmically controlled parsing
  113. flow, where a call to the library exists for each field or choice
  114. of fields to be parsed.
  115. .Pp
  116. At the user level, the interface provides:
  117. .Bb
  118. .Bi
  119. Command prompting.
  120. .Bi
  121. Consistent command line editing.  The user may use editing keys to erase
  122. the last character or word, and to echo the current input line and
  123. prompt.
  124. .Bi
  125. Input abbreviation and defaulting.  The user may type abbreviations of
  126. keywords, or may type nothing to have defaults applied.
  127. .Bi
  128. Incremental help.  By pressing a known key (usually a question mark),
  129. the user can find out what choices s/he has.
  130. .Bi
  131. Guide strings.  Parenthesized guide words are shown at the users option.
  132. .Bi
  133. Command completion.  Where the subroutine library can judge what the
  134. succesful completion of a portion of user input will be, the user can
  135. elect to have this input completed and shown automatically.
  136. .Be
  137. .bp
  138. .sp 2
  139. .ce 1
  140. Using the COMND Library
  141. .sp 2
  142. .Pp
  143. While you read this part of the document, you might want to look at the
  144. sample program named TEST.C which has been included with this package.
  145. It is an over-commented guide to the use of the COMND library.
  146. .Pp
  147. Any module which makes use of this library shall include the definition
  148. file named "comnd.h".  This file contains definitions which are necessary
  149. to the caller-library interface.  Mnemonics (structures and constants)
  150. mentioned in relation to this interface are defined in this file.
  151. .Pp
  152. The philosophy of parsing with the COMND library is that a command line
  153. is typed, the program inspects it, then the program acts on the directions
  154. given in that line.  This process is repeated until the program finishes.
  155. The COMND library assists the user in typing the command line and the
  156. program in inspecting it.  Acting on it is left up to the calling program.
  157. .Pp
  158. The typing and parsing of fields in the command line go essentially
  159. hand-in-hand with this library.
  160. The single subroutine COMND() is used to effect all parsing.  This routine
  161. is called for each field of the input line to be parsed.  Parsing is
  162. done according to a current parse state, which is maintained in a
  163. parameter block passed between caller and library.  The state block
  164. contains the following sort of information (described in detail later):
  165. .Bb
  166. .Bi
  167. What to use for a prompt string.
  168. .Bi
  169. Addresses of scratch buffers for user input and atom storage.
  170. .Bi
  171. How much the user has entered.
  172. .Bi
  173. How much of the line the program has parsed.
  174. .Be
  175. .Pp
  176. An important thing to note is that the indexes (how much entered
  177. and parsed) are both variable.  The program begins parsing of the
  178. input line upon a break signal by the user (such as the typing of
  179. a carriage return, question mark, etc).  The user may then resume
  180. typing and erase characters back to a point BEFORE that already parsed.
  181. It is very important that the program does not take any action on
  182. what has been parsed until the line has been completely processed,
  183. otherwise that action could be undesired.
  184. .Pp
  185. Since the user may back up the command input to a point before that
  186. already processed by the application program, a mechanism must be
  187. provided to backup the program to the correct point.  Rather than
  188. going to the point backed up to, the COMND library expects the application
  189. program to return to the beginning of the line, and start again.  The
  190. user's input has remained in the command line buffer,
  191. and the library will take care of
  192. buffering the rest of the input when that parse point is again reached.
  193. However, this means that there must be
  194. a method of communicating to the calling program
  195. that this "reparse" is necessary.  Actually there
  196. are two methods provided, as follows:
  197. .Bb
  198. .Bi
  199. Each call to the command parsing routine COMND() yields a result code.
  200. The result may indicate that a reparse has to take place.  The program
  201. shall then back up to the point where the parse of the line began, and
  202. start again.
  203. .Bi
  204. The application program may specify the address of a setjmp buffer
  205. which identifies the reparse point.
  206. (Note setjmp is a facility provided as part of most standard C libraries.
  207. It allows you to mark a point in the procedure flow [call frame, registers,
  208. and whatever else is involved in a context], and return to that point
  209. from another part of the program as if control had never proceeded.  If
  210. you are unfamiliar with this facility, you might want to find a description
  211. in your C manual.)
  212. It is up
  213. to the caller to setup the setjmp environment at the reparse point.
  214. .Be
  215. .Pp
  216. In either case, the reparse point (the point at which the parse will be
  217. restarted if necessary) is the point at which the first element of the
  218. command line is parsed.  This is after the initialization call which
  219. starts every parse.
  220. .sp 2
  221. .Pp
  222. Every call to the COMND() subroutine involves two arguments: a command
  223. state block, in which is kept track of the parse state, and a command
  224. function block, which describes what sort of thing to parse next.
  225. The command state block is given a structure called "CSBs", and a
  226. typedef called "CSB".  Each element of the structure is named with a
  227. form "CSB_xxx", where "xxx" is representative of the element's purpose.
  228. The following are the elements of the command state block, in the order
  229. that they appear in the structure.
  230. .Bb
  231. .Bi
  232. CSB_PFL is a BYTE.  This contains flags which are set by the caller
  233. to indicate specifics of the command processing.  These flags are:
  234. .Bb
  235. .Bi
  236. _CFNEC: Do not echo user input.
  237. .Bi
  238. _CFRAI: Convert lowercase input to uppercase.
  239. .Be
  240. .Bi
  241. CSB_RFL, a BYTE value, contains flags which are kept by the library in
  242. the performance of the parse.
  243. Generally, these flags are of no interest to the caller since their
  244. information can be gleaned from the result code of the COMND() call.
  245. However, they are:
  246. .Bb
  247. .Bi
  248. _CFNOP: No parse.  Nothing matched, i.e., an error occured.
  249. .Bi
  250. _CFESC: Field terminated by escape.
  251. .Bi
  252. _CFEOC: Field terminated by CR.
  253. .Bi
  254. _CFRPT: Reparse required.
  255. .Bi
  256. _CRSWT: Switch ended with colon.
  257. .Bi
  258. _CFPFE: Previous field terminated with escape.
  259. .Be
  260. .Bi
  261. CSB_RSB is the address of a setjmp buffer describing the environment at
  262. the reparse point.  If this value is non-NULL, then if a reparse is
  263. required, a longjmp() operation is performed using this setjmp buffer.
  264. .Bi
  265. CSB_INP is the address of the input-character routine to use.  If this
  266. value is non-NULL, then this routine is called to get each character of
  267. input.  No line editing or special interactive characters are recognized
  268. in this mode, since it is assumed that this will be used for file input.
  269. Note especially: this facility is not yet implemented, however the
  270. definition is provided for future expansion.  Thou shalt always leave
  271. this NULL, or write the facility thyself.
  272. .Bi
  273. CSB_OUT is the inverse correspondent to the previous element (CSB_INP).
  274. It is the address of a routine to process output from the command library.
  275. Please see the warning in the CSB_INP description about not being implemented.
  276. .Bi
  277. CSB_PMT is the address of the prompt string to use for command parsing.
  278. The command library takes care of prompting, so make sure this is filled
  279. in.
  280. .Bi
  281. CSB_BUF is the address of the buffer to put user input into as s/he is
  282. typing it in.
  283. .Bi
  284. CSB_BSZ, an int, is the number of bytes which can be stored in CSB_BUF;
  285. i.e., it is the buffer size.
  286. .Bi
  287. CSB_ABF is the address of an atom buffer.  Some (if not all) parsing functions
  288. involve extracting some number of characters from the input buffer and
  289. interpreting or simply returning this extracted string.  This buffer is
  290. necessary for those operations.  It should probably be as large as the
  291. input buffer (CSB_BUF), but it is really up to you.
  292. .Bi
  293. CSB_ASZ, an int, is the number of characters which can be stored in CSB_ABF;
  294. i.e., it is the size of that buffer.
  295. .sp 1
  296. ** Note ** CSB elements from here to the end do not have to be initialized
  297. by the calling program.  They are used to store state information and are
  298. initialized as required by the library.
  299. .Bi
  300. CSB_PRS, an int, contains the parse index.  This is the point in the command
  301. buffer up to which parsing has been achieved.
  302. .Bi
  303. CSB_FLN, an int, is the filled length of the command buffer.  This is the
  304. number of characters which have been typed by the user.
  305. .Bi
  306. CSB_RCD, an int, is a result code of the parse.  This is the same value
  307. which is returned as the result of the COMND() procedure call.
  308. .Bi
  309. CSB_RVL is a union which is used to contain either an int or an address
  310. value.  The names of the union elements are: _INT for int, _ADR for
  311. address (note that a typecast should be used for proper address assignment).
  312. This element contains a value returned from some parse functions which return
  313. values which are single values.
  314. For example, if an integer is parsed, its value
  315. is returned here.
  316. .Bi
  317. CSB_CFB is the address of a command function block for which a parse was
  318. successful.  This is significant in cases where there are alternative
  319. possible interpretations of the next command line field.
  320. .Be
  321. .sp 3
  322. The parse of each element in a command line involves, as well as the
  323. Command State Block just described, a Command Function Block which
  324. identifies the sort of thing to be parsed.  This block is defined
  325. in a structure named "CFBs", which has a corresponding typedef
  326. named "CFB".  Elements of the CFB, named "CFB_xxx", are as follows
  327. (in the order they appear in the structure):
  328. .sp 1
  329. .Bb
  330. .Bi
  331. CFB_FNC, a BYTE, is the function code.  This defines the function to
  332. be performed.  The function codes are listed, and their actions
  333. described, a little later.
  334. .Bi
  335. CFB_FLG, a BYTE, contains flags which the caller specifies to the
  336. library.  These are very significant, and in most cases affect the
  337. presentation to the user.  The flag bits are:
  338. .Bb
  339. .Bi
  340. _CFHPP: A help string has been supplied and should be given when the
  341. user types the help character ("?").
  342. .Bi
  343. _CFDPP: A default string has been supplied, and shall be used if the
  344. user does not type anything at this point (typing nothing means typing
  345. a return or requesting command completion).  Note that this flag (and
  346. the default string) is ONLY significant for the CFB passed in the call
  347. to the COMND() routine, and not for any others referenced as alternatives
  348. by that CFB.  Note further that a default specified by the first CFB
  349. is applied to the input stream, and not to the parsing function.  That
  350. means that the default is subject to interpretation by alternate CFBs,
  351. and in fact, does not even have to be appropriate for the CFB which
  352. contains it.
  353. .Bi
  354. _CFSDH: The default help message should be supressed if the user types
  355. the help character ("?").  This is normally used in conjunction with the
  356. _CFHPP flag.  However, if this flag is present and the _CFHPP is not
  357. selected, then the help operation is inhibited, and the help character
  358. becomes insignificant (just like any other character).
  359. .Bi
  360. _CFCC: A character characteristic table has been provided.  A CC table
  361. identifies which characters may be part of the element being recognized.
  362. Not all functions support this table (for example, it does not make sense
  363. to re-specify which characters may compose decimal numbers).  This
  364. table also specifies which characters are break characters, causing the
  365. parser to "wake up" the calling program when one of them is typed.
  366. If this bit is not set (as is usually the case), a default table is
  367. associated according to the function code.
  368. .Bi
  369. _CFDTD: For parsing date and time, specifies that the date should be parsed.
  370. .Bi
  371. _CFDTT: For parsing date and time, specifies that the time should be parsed.
  372. .Be
  373. .Bi
  374. CFB_CFB is the address of another CFB which may be invoked if the user input
  375. does not satisfy this CFB.  CFBs may be chained in this manner at will.
  376. Recognize, however, that the ORDER of the chain plays an important part
  377. in how input is handled, particularly in disambiguation of input.  Note also
  378. that only the first CFB of the chain is used for specifying a default
  379. string and CC table for command wake-up.
  380. .sp 1
  381. CFB chaining is a very important part of parsing with this library.
  382. .Bi
  383. CFB_DAT is defined as a long, since it is used to contain address or int
  384. values.  It should be referenced via typecast.  It is not defined as a
  385. union because it is inconvenient or impossible to initialize unions at
  386. compile time with most (all?) C compilers, and initialization of these
  387. blocks at compile time is very desirable.
  388. This element contains data used in parsing of a field in the command line.
  389. For instance, in
  390. parsing an integer, the caller specifies the default radix of the integer
  391. here.
  392. .Bi
  393. CFB_HLP is the address of a caller-supplied help string.  This is only
  394. significant if the flag bit _CFHPP is set in the CFB_FLG byte.
  395. .Bi
  396. CFB_DEF is the address of a caller-supplied default string.  This is
  397. only significant if the flag bit _CFDPP is set in the CFB_FLG byte, and
  398. only for the first CFB in the CFB chain.
  399. .Bi
  400. CFB_CC is the address of a character characteristics table.  This is only
  401. significant if the flag bit _CFCC is set in the CFB_FLG byte.  This is
  402. the address of a 16-word table, each word containing 16 bits which are
  403. interpreted as 8 2-bit characteristic entries.  The most significant bits
  404. correspond to the lower ASCII values, etc.  The 2-bit binary value has the
  405. following meaning, per character:
  406. .Bb
  407. .Bi
  408. 00: Character may not be part of the element being parsed.
  409. .Bi
  410. 01: Character may be part of the element only if it is not the first
  411. character of that element.
  412. .Bi
  413. 10: Character may be part of the element.
  414. .Bi
  415. 11: Character may not be part of the element; furthermore, when it is typed,
  416. it will case parsing to begin immediately (a wake-up character).
  417. Note: wake-up via this mechanism is not implemented.
  418. .Be
  419. .sp 1
  420. .Pp
  421. Don't hesitate to use CC tables; they only take up 16 bytes apiece.
  422. .Be
  423. .sp 2
  424. .Pp
  425. The function code in the CFB_FC element of the command function block
  426. specifies the operation to be performed on behalf of that function block.
  427. Functions are described now.
  428. .sp 2
  429. .ne 15
  430. .sp 1
  431. CFB function _CMINI: Initialize
  432. .Pp
  433. Every parse of a command line must begin with
  434. an initialization call.  This tells the command library to reset its
  435. indexes, that the user must be prompted, etc.  There may be NO other
  436. CFBs chained to this one, because if they are, they are ignored.
  437. .Pp
  438. The reparse point is the point right after this call.  If the setjmp
  439. method is used, then the setjmp environment should be defined here.
  440. After the reparse point, any variables etc which may be the victims of
  441. parsing side-effects should be initialized.
  442. .sp 2
  443. .ne 15
  444. .sp 1
  445. CFB function _CMKEY: Keyword parse
  446. .Pp
  447. _CMKEY parses a keyword from a given list.  The CFB_DAT element of the
  448. function block should point to a table of string pointers, ending with
  449. a NULL pointer.  The user may type any unique abbreviation of a keyword,
  450. and may use completion to fill out the rest of a known match.  The
  451. address of the pointer to the matching string is returned in the CSB_RVL
  452. element of the command state block.  The value is returned this way so
  453. that the index can be easily calculated, and because it is consistent
  454. with the general keyword parsing mechanism (_CMGSK).
  455. .Pp
  456. The incremental help associated with keyword parsing is somewhat special.
  457. The default help string is "Keyword, one of:" followed by a list of
  458. keywords which match anything already typed.  If a help string has been
  459. supplied (indicated by _CFHPP) and no suppression of the default help is
  460. specified, then the initial part ("Keyword, ") is replaced with the
  461. supplied help string and the help is otherwise the same.  If a help string
  462. has been supplied and the default has been supressed, then the given help
  463. string is presented unaltered.
  464. .sp 2
  465. .ne 15
  466. .sp 1
  467. CFB function _CMNUM: number
  468. .Pp
  469. This parses a number.  The caller supplies a radix in the CFB_DAT
  470. element of the function block.  The number parsed is returned
  471. (as an int) in the CSB_RVL element of the state block.
  472. .sp 2
  473. .ne 15
  474. .sp 1
  475. CFB function _CMNOI: guide word string
  476. .Pp
  477. This function parses a guide word string (noise words).  Guide words
  478. appear between significant parts of the command line, if they are in
  479. parentheses.  They do not have to be typed, but if they are, they must
  480. match what is expected.  If the previous field ended with command
  481. completion, then the guide words are shown automatically by the parser.
  482. .Pp
  483. An interesting use of guide word strings is to provide alternate sets
  484. with the command chaining feature.  The parse (and program) flow can be
  485. altered depending on which string was matched.
  486. .sp 2
  487. .ne 15
  488. .sp 1
  489. CFB function _CMCFM: confirmation
  490. .Pp
  491. A confirmation is a carriage return.  The caller should parse a confirmation
  492. as the last thing before processing what was parsed.  Since carriage return
  493. is by default a wake-up character, requiring a confirmation will (if you don't
  494. change this wake-up attribute) require that the parse be completed with no
  495. extra characters typed.  A parse with this function code returns only a
  496. status.
  497. .sp 2
  498. .ne 15
  499. .sp 1
  500. CFB function _CMGSK: General storage keyword
  501. .Pp
  502. This call provides for parsing of one of a set of keywords which are not
  503. arranged in a table.  Often, keywords are actually stored in a file or
  504. in a linked list.  The caller fills in the CFB_DAT element of the command
  505. function block with the address of a structure named CGKs (typedef CGK),
  506. which contains the following elements:
  507. .Bb
  508. .Bi
  509. CGK_BAS: A base address to give to the fetch routine.  Does not matter what
  510. this is, as long as the fetch routine understands it.
  511. .Bi
  512. CFK_CFR: The address of a keyword fetch routine.  The routine is called
  513. with the CGK_BAS value, and the address of the pointer to the previous
  514. keyword.  It is expected to return the address of the pointer to the
  515. next keyword, or with the first one if the passed value for the previous
  516. pointer is NULL.
  517. .Pp
  518. When this function completes successfully, it returns the address of the
  519. pointer to the string in the CSB_RVL element in the command state block;
  520. otherwise (for unsuccessful completion), it must return NULL.
  521. Please see the description of the _CMKEY function code for a description
  522. of help and other processing.
  523. .Pp
  524. Note: the General Keyword facility can be used to do special pre-processing
  525. of candidate strings, such as hiding keywords which are not appropriate for
  526. the program state, user, access, etc.
  527. .Be
  528. .sp 2
  529. .ne 15
  530. .sp 1
  531. CFB function _CMSWI: Parse a switch.
  532. .Pp
  533. This is intended to perform switch matching, but it currently is not
  534. implemented and will return a result code _CRIFC (invalid function code)
  535. if you try it.  Basically it is a placeholder for an unimplemented function.
  536. .sp 2
  537. .ne 15
  538. .sp 1
  539. CFB function _CMTXT: Rest of line
  540. .Pp
  541. This function parses the text to the end of the line.  Note that this does
  542. not parse the trailing break character (i.e. the carriage return).
  543. The text is returned in the atom buffer which is defined (by the caller)
  544. by the CSB_ABF and CSB_ASZ elements of the command state block.
  545. .sp 2
  546. .ne 15
  547. .sp 1
  548. CFB function _CMTOK: token
  549. .Pp
  550. This function will parse an exact match of a particular token.  A token
  551. is a string of characters, whose address is supplied by the caller in
  552. the CFB_DAT element of the command function block.  This function is
  553. mainly useful for parsing such things as commas and other separators,
  554. especially where it is one of several alternative parse functions.
  555. It returns no value other than its status.
  556. .sp 2
  557. .ne 15
  558. .sp 1
  559. CFB function _CMUQS: unquoted string
  560. .Pp
  561. This function parses an unquoted string, consisting of any characters
  562. other than spaces, tabs, slashes, or commas.  This set may of course
  563. be changed by supplying a CC table.  The unquoted string is returned
  564. in the atom buffer associated with the command state block.
  565. .sp 2
  566. .ne 15
  567. .sp 1
  568. CFB function _CMDAT: parse date/time
  569. .Pp
  570. This function parses a date and/or time.  The caller specifies, via
  571. flag bits in the CFB_FLG byte of the command function block (as identified
  572. above) which of date, time, or both, are to be parsed.  The date and
  573. time are returned as the first two ints in the atom buffer which is
  574. associated with the command state block.  Note that both date and time
  575. are returned, regardless of which were requested.
  576. .Pp
  577. Note further that the _CMDAT function is not fully implemented as of this
  578. writing.
  579. .sp 4
  580. .ce 1
  581. Calling the COMND library
  582. .sp 1
  583. .Pp
  584. All that you need to know to use the above information is how to call
  585. the command library.  Basically, there is one support routine: COMND().
  586. It is used like this:
  587. .sp 1
  588. .nf
  589.          status = COMND (csbp, cfbp);
  590. .fi
  591. .Pp
  592. Here, "csbp" is the address of the command state block, and "cfbp" is the
  593. address of the command function block.
  594. The COMND() routine returns an int status value, which is one of the
  595. following:
  596. .Bb
  597. .Bi
  598. _CROK: The call succeeded; a requested function was performed.  The address
  599. of the matching function block is returned in the CSB_CFB element of the
  600. command state block, and other information is returned as described above.
  601. .Bi
  602. _CRNOP: The call did not succeed; nothing matched.
  603. .Bi
  604. _CRRPT: The call did not succeed because the user took back some of what
  605. had already been parsed.  In other words, a reparse is required, and your
  606. program must back up to the reparse point.  Note that if you specify a
  607. setjmp buffer address in the CSB_RSB element of the command state block,
  608. you will never see this value because the COMND library will execute a
  609. longjmp() operation using that setjmp buffer.
  610. .Bi
  611. _CRIFC: The call failed because you provided an invalid function code in
  612. the command function block (or in one which is chained to it).  One of us
  613. has made a programming error.
  614. .Bi
  615. _CRBOF: Buffer overflow.  The atom buffer is too small to contain the
  616. parsed field.
  617. .Bi
  618. _CRBAS: Invalid radix for number parse.
  619. .Bi
  620. _CRAGN: You should not see this code.  It is reserved for a support-mode
  621. call to the subroutine library.
  622. .Be
  623. .sp 2
  624. .Pp
  625. When you use the setjmp method of command reparsing, it is usually enough
  626. to check the result against _CROK only, everything else being treated the
  627. same (error in input).
  628. .bp
  629. .sp 2
  630. .ce 1
  631. Installing the COMND library
  632. .sp 2
  633. .Pp
  634. This part of the document describes the modules which come with the
  635. COMND library kit, and what you might have to look at if the code does
  636. not instantly work on your system (which will probably be the case if
  637. your system is not the same kind as the one which you got it from).
  638. .Pp
  639. The files which come in the COMND kit are as follows:
  640. .Bb
  641. .Bi
  642. COMND.R - Source for this document, in a form suitable for the public
  643. domain formatting program called "roff4".
  644. .Bi
  645. COMND.DOC - This document.
  646. .Bi
  647. COMND.EDT - Edit history for the subroutine library.
  648. .Bi
  649. MEM.H - A file of my (Mark Mallett) definitions which are used by the
  650. code in the command subroutine library.
  651. .Bi
  652. COMND.H - Command library interface definitions.
  653. .Bi
  654. COMNDI.H - Command library implementation definitions.
  655. .Bi
  656. COMND.C - Primary module of the COMND library.  Contains user input
  657. buffering and various library support routines.
  658. .Bi
  659. CMDPF1.C - First module of parse function processing routines.
  660. .Bi
  661. CMDPF2.C - Second module of parse function processing routines.
  662. .Bi
  663. CMDPFD.C - Contains the date/time parse function routines.  This is
  664. included in a separate module so that it can be replaced with a stub, since
  665. few programs (that I have written, anyway) use this function, and it does
  666. take up a bit of code.
  667. .Bi
  668. CMDPSD.C - A stub for the date/time parsing functions.  This can be linked
  669. with programs which do not actually use the date/time parse function.
  670. .Bi
  671. CMDOSS.CPM - Operating system specific code which works for CP/M.  This
  672. is provided as a model for the routines which you will have to write for
  673. your system.
  674. .Bi
  675. DATE.CPM - Date/time support routines for version 3.0 of CP/M.
  676. This is a module containing routines to get the date and time from the
  677. operating system, and to encode/decode these values to and from internal
  678. form.  This is provided as a model; you will probably have to rewrite them
  679. for your system.  Note, you don't need these routines if you don't use
  680. the date and time parsing function (if you use the stub instead).
  681. .Be
  682. .bp
  683. .sp 2
  684. .ce 1
  685. Your Improvements
  686. .sp 2
  687. .Pp
  688. If you improve this library or make it work on a new operating system, I'd
  689. appreciate hearing about it so that I can maintain a proper version.  Also
  690. please maintain the edit/version history in the file COMND.EDT.
  691. .sp 2
  692. .nf
  693.                                         Mark E. Mallett
  694.                                         c/o M-TEK
  695.                                         P.O. box 6357
  696.                                         Nashua NH 03114
  697.  
  698.                                         voice: 603 424 8129
  699.                                         data:  603 424 8124
  700.                                            (1200 baud, allow system
  701.                                             time to boot)
  702. .fi
  703.