aboutsummaryrefslogtreecommitdiff
path: root/sys/fmtio/doc
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/fmtio/doc
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/fmtio/doc')
-rw-r--r--sys/fmtio/doc/evexpr.hlp147
-rw-r--r--sys/fmtio/doc/fmtio.hd77
-rw-r--r--sys/fmtio/doc/fmtio.men59
-rw-r--r--sys/fmtio/doc/lexnum.hlp303
4 files changed, 586 insertions, 0 deletions
diff --git a/sys/fmtio/doc/evexpr.hlp b/sys/fmtio/doc/evexpr.hlp
new file mode 100644
index 00000000..386baf91
--- /dev/null
+++ b/sys/fmtio/doc/evexpr.hlp
@@ -0,0 +1,147 @@
+ EVEXPR
+ Evaluating Algebraic Expressions in SPP Programs
+ dct 17 April 1985
+
+
+
+1. Introduction
+
+ EVEXPR is a function which takes an algebraic expression as input,
+evaluates the expression, and returns the value of the expression as the
+function value. The input expression (a character string) is parsed and
+reduced to a single value. The operands to the expression may be either
+constants or identifiers (foreign strings). If an identifier is encountered
+the user supplied get operand procedure is called to return the value of
+the operand. Operands are described by the operand structure, and operands
+are passed about by a pointer to such a structure. The value of the
+expression is returned as the function value and is a pointer to an operand
+structure. Operands of different datatypes may be mixed in an expression
+with the usual automatic type coercion rules. All SPP datatypes are
+supported plus the string datatype. All SPP operators and intrinsic
+functions are recognized.
+
+
+2. Procedures
+
+ op = evexpr (expr, locpr(getop), locpr(ufcn))
+ getop (identifier, op)
+ ufcn (fcn, args, nargs, op)
+
+where
+
+ evexpr The main entry point.
+ expr A character string, the expression to be evaluated.
+ getop A user supplied procedure which returns the value
+ of a nonconstant operand given the NAME of the operand
+ (a character string) as input. If locpr(getop) is
+ NULL only constant operands are permitted in the
+ expression.
+ ufcn A user supplied procedure which returns the value of
+ a user defined function given the name of the function
+ as the first argument (a string). If locpr(ufcn) is
+ NULL only the standard functions are permitted.
+ fcn Name of the function to be evaluated.
+ args Array of pointers to operands (the arguments to the function).
+ nargs Number of arguments to function.
+ op A pointer to an operand structure
+
+
+A a simple example, consider the following statement which evaluates a
+constant expression and prints the value on the standard output.
+
+
+ include <evexpr.h>
+ pointer o, evexpr()
+
+ o = evexpr ("sin(.5)**2 + cos(.5)**2)", NULL, NULL)
+ switch (O_TYPE(o)) {
+ case TY_INT:
+ call printf ("result = %d\n")
+ call pargi (O_VALI(o))
+ case TY_REAL:
+ call printf ("result = %g\n")
+ call pargr (O_VALR(o))
+ case TY_CHAR:
+ call printf ("result = %s\n")
+ call pargstr (O_VALC(o))
+ }
+
+
+If a syntax error occurs while parsing the expression EVEXPR will take the
+error action "syntax error". The NULL arguments could be replaced by the
+LOCPR addresses of get operand and/or user function procedures if required
+by the application.
+
+
+3. Lexical Form
+
+ The lexical form of the input expression is the same as that of SPP and
+the CL for all numeric, character, and string constants and operators.
+Any other sequence of characters is considered an identifier and will be
+passed to the user supplied get operand function to be turned into an operand.
+
+
+4. Syntax
+
+ Parsing and evaluating of the input expression is carried out by an SPP/Yacc
+parser. The grammar recognized by the parser is given below.
+
+
+expr : CONST # numeric or string constant
+ | IDENT # external operand (getop)
+ | '-' expr %prec UMINUS
+ | expr '+' expr
+ | expr '-' expr
+ | expr '*' expr
+ | expr '/' expr
+ | expr '**' expr
+ | expr '//' expr
+ | '!' expr
+ | expr '<' expr
+ | expr '<=' expr
+ | expr '>' expr
+ | expr '>=' expr
+ | expr '==' expr
+ | expr '!=' expr
+ | expr '&&' expr
+ | expr '||' expr
+ | IDENT '(' arglist ')' # function call
+ | '?' expr ':' expr # conditional expression
+ | '(' expr ')'
+ ;
+
+arglist : # Empty.
+ | arglist ',' expr
+ ;
+
+
+2. Data Structures
+
+ The operand structure (size 3 su) is used to represent all operands in
+expressions and on the parser stack. Operands are passed to and from the
+outside world by means of a pointer to an operand structure. The caller
+is responsible for string storage of string operands passed to EVEXPR.
+EVEXPR manages string storage for temporary string operands created during
+expression evaluation, as well as storage for the final string value if
+the expression is string valued. In the latter case the value string should
+be used before EVEXPR is again called.
+
+
+ struct operand {
+ int type # operand datatype
+ union {
+ bool v_b # boolean value
+ int v_i # integer value
+ real v_r # real value
+ char *v_s # string value
+ } v
+ }
+
+
+SPP equivalent (<evexpr.h>)
+
+ O_TYPE(o) # operand datatype
+ O_VALB(o) # boolean value
+ O_VALI(o) # integer value (or string ptr)
+ O_VALR(o) # real value
+ O_VALC(o) # string value
diff --git a/sys/fmtio/doc/fmtio.hd b/sys/fmtio/doc/fmtio.hd
new file mode 100644
index 00000000..525911dc
--- /dev/null
+++ b/sys/fmtio/doc/fmtio.hd
@@ -0,0 +1,77 @@
+# Help directory for the FMTIO (formatted i/o) package.
+
+$fmtio = "sys$fmtio/"
+
+cctoc hlp = xtoc.hlp, src = fmtio$cctoc.x
+chdeposit hlp = chdeposit.hlp, src = fmtio$chdeposit.x
+chfetch hlp = chfetch.hlp, src = fmtio$chfetch.x
+chrlwr hlp = chrlwr.hlp, src = fmtio$chrlwr.x
+chrupr hlp = chrupr.hlp, src = fmtio$chrupr.x
+clprintf hlp = printf.hlp, src = fmtio$clprintf.x
+clscan hlp = scan.hlp, src = fmtio$clscan.x
+ctocc hlp = ctox.hlp, src = fmtio$ctocc.x
+ctod hlp = ctox.hlp, src = fmtio$ctod.x
+ctoi hlp = ctox.hlp, src = fmtio$ctoi.x
+ctol hlp = ctox.hlp, src = fmtio$ctol.x
+ctor hlp = ctox.hlp, src = fmtio$ctor.x
+ctotok hlp = ctox.hlp, src = fmtio$ctotok.x
+ctowrd hlp = ctox.hlp, src = fmtio$ctowrd.x
+ctox hlp = ctox.hlp, src = fmtio$ctox.x
+dtoc hlp = xtoc.hlp, src = fmtio$dtoc.x
+eprintf hlp = printf.hlp, src = fmtio$eprintf.x
+fprintf hlp = printf.hlp, src = fmtio$fprintf.x
+fscan hlp = scan.hlp, src = fmtio$fscan.x
+gargb hlp = garg.hlp, src = fmtio$gargb.x
+gargc hlp = garg.hlp, src = fmtio$gargc.x
+gargd hlp = garg.hlp, src = fmtio$gargd.x
+gargi hlp = garg.hlp, src = fmtio$gargi.x
+gargl hlp = garg.hlp, src = fmtio$gargl.x
+gargr hlp = garg.hlp, src = fmtio$gargr.x
+gargrad hlp = garg.hlp, src = fmtio$gargrad.x
+gargs hlp = garg.hlp, src = fmtio$gargs.x
+gargstr hlp = garg.hlp, src = fmtio$gargstr.x
+gargtok hlp = garg.hlp, src = fmtio$gargtok.x
+gargwrd hlp = garg.hlp, src = fmtio$gargwrd.x
+gargx hlp = garg.hlp, src = fmtio$gargx.x
+gctod hlp = ctox.hlp, src = fmtio$gctod.x
+gctol hlp = ctox.hlp, src = fmtio$gctol.x
+gltoc hlp = xtoc.hlp, src = fmtio$gltoc.x
+gstrcat hlp = gstrcat.hlp, src = fmtio$gstrcat.x
+gstrcpy hlp = gstrcpy.hlp, src = fmtio$gstrcpy.x
+itoc hlp = xtoc.hlp, src = fmtio$itoc.x
+lexnum hlp = lexnum.hlp, src = fmtio$lexnum.x
+ltoc hlp = xtoc.hlp, src = fmtio$ltoc.x
+nscan hlp = scan.hlp, src = fmtio$nscan.x
+pargb hlp = parg.hlp, src = fmtio$pargb.x
+pargc hlp = parg.hlp, src = fmtio$parg.x
+pargs hlp = parg.hlp, src = fmtio$parg.x
+pargi hlp = parg.hlp, src = fmtio$parg.x
+pargl hlp = parg.hlp, src = fmtio$parg.x
+pargr hlp = parg.hlp, src = fmtio$parg.x
+pargd hlp = parg.hlp, src = fmtio$parg.x
+pargx hlp = parg.hlp, src = fmtio$parg.x
+pargstr hlp = parg.hlp, src = fmtio$pargstr.x
+patmatch hlp = patmatch.hlp, src = fmtio$patmatch.x
+printf hlp = printf.hlp, src = fmtio$printf.x
+scanc hlp = scan.hlp, src = fmtio$scanc.x
+sprintf hlp = printf.hlp, src = fmtio$sprintf.x
+sscan hlp = scan.hlp, src = fmtio$sscan.x
+strcat hlp = strcat.hlp, src = fmtio$strcat.x
+strcpy hlp = strcpy.hlp, src = fmtio$strcpy.x
+strdic hlp = strdic.hlp, src = fmtio$strdic.x
+streq hlp = streq.hlp, src = fmtio$streq.x
+strge hlp = strge.hlp, src = fmtio$strge.x
+strgt hlp = strgt.hlp, src = fmtio$strgt.x
+stridx hlp = stridx.hlp, src = fmtio$stridx.x
+strldx hlp = strldx.hlp, src = fmtio$strldx.x
+strle hlp = strle.hlp, src = fmtio$strle.x
+strlen hlp = strlen.hlp, src = fmtio$strlen.x
+strlt hlp = strlt.hlp, src = fmtio$strlt.x
+strlwr hlp = strlwr.hlp, src = fmtio$strlwr.x
+strmatch hlp = strmatch.hlp, src = fmtio$strmatch.x
+strncmp hlp = strncmp.hlp, src = fmtio$strncmp.x
+strne hlp = strne.hlp, src = fmtio$strne.x
+strsearch hlp = strsearch.hlp, src = fmtio$strsearch.x
+strtbl hlp = strtbl.hlp, src = fmtio$strtbl.x
+strupr hlp = strupr.hlp, src = fmtio$strupr.x
+xtoc hlp = xtoc.hlp, src = fmtio$xtoc.x
diff --git a/sys/fmtio/doc/fmtio.men b/sys/fmtio/doc/fmtio.men
new file mode 100644
index 00000000..897a8139
--- /dev/null
+++ b/sys/fmtio/doc/fmtio.men
@@ -0,0 +1,59 @@
+ cctoc - Character constant to char
+ chdeposit - Deposit a character in a string with overflow protection
+ chfetch - Fetch a character from a string
+ chrlwr - Convert a character to lower case
+ chrupr - Convert a character to upper case
+ clprintf - Formatted print to a CL parameter
+ clscan - Scan a CL parameter
+ ctocc - Char to character constant
+ ctod - Character to double
+ ctoi - Character to integer
+ ctol - Character to long
+ ctor - Character to real
+ ctox - Character to complex
+ ctotok - Character to lexical token
+ ctowrd - Character to whitespace delimited word
+ dtoc - Double to character
+ eprintf - Formatted print to STDERR
+ fprintf - Formatted print to any file
+ fscan - Scan a file
+ garg[bcsilrdx] - Get scan argument
+ gargrad - Get scan argument in any numerical radix
+ gargstr - Get scan argument of type string
+ gargtok - Get scan argument of type token
+ gargwrd - Get scan argument of type word
+ gctod - General character to double
+ gctol - General character to long (any radix)
+ gltoc - General long to character (any radix)
+ gstrcat - String concatenation returning length of output string
+ gstrcpy - String copy returning length of output string
+ itoc - Integer to character
+ lexnum - Lexically analyze a string to determine if it is a number
+ ltoc - Long to character
+ nscan - Get number of arguments successfully converted in last scan
+ parg[bcsilrdx] - Pass an argument to a printf
+ pargstr - Pass a string type argument to a printf
+ patmatch - General pattern matching
+ printf - Formatted print to STDOUT
+ scanc - Get the next character from a scan
+ sprintf - Formatted print to a string buffer
+ sscan - Scan a string buffer
+ strcat - String concatenation
+ strcpy - String copy
+ strdic - Look a string up in a dictionary
+ streq - Compare strings for equality
+ strge - Is string A greater than or equal to string B
+ strgt - Is string A greater than string B
+ stridx - First occurrence of a character in a string
+ strldx - Last occurrence of a character in a string
+ strle - Is string A less than or equal to string B
+ strlen - Length of a string
+ strlt - Is string A less than string B
+ strlwr - Convert string to lower case
+ strmatch - Search a string for a pattern
+ strncmp - Compare the first N characters of two strings
+ strne - Is string A not equal to string B
+ strsearch - Fast string search, no metacharacters
+ strtbl - Print a list of strings in a table
+ strupr - Convert a string to upper case
+ xtoc - Complex to character
diff --git a/sys/fmtio/doc/lexnum.hlp b/sys/fmtio/doc/lexnum.hlp
new file mode 100644
index 00000000..647654b1
--- /dev/null
+++ b/sys/fmtio/doc/lexnum.hlp
@@ -0,0 +1,303 @@
+
+.help lexnum 2 "string utilities"
+.ih _________________________________________________________________________
+NAME
+lexnum -- Determine if string is a number
+.ih
+USAGE
+token_type = lexnum (str, ip, nchars)
+
+.ih
+PARAMETERS
+.ls str
+String to be scanned.
+.le
+.ls ip
+Index within the string as which scanning is to start. Not modified.
+.le
+.ls nchars
+On output, the number of characters in the number, not including any
+leading whitespace.
+.le
+.ih
+DESCRIPTION
+The character string is scanned to determine if the next token is a
+legal number, and if so, the type of number. The function value identifies
+the type of number. The possible return values, defined in <lexnum.h>,
+as as follows:
+
+.nf
+ LEX_OCTAL (+|-)?[0-7]+[bB]
+ LEX_DECIMAL (+|-)?[0-9]+
+ LEX_HEX (+|-)?[0-9a-fA-F]+[xX]
+ LEX_REAL floating, exponential [eEdD], sexagesimal
+ LEX_NONNUM not a number
+.fi
+.ih
+IMPLEMENTATION
+Numtype is implemented as a finite state automaton. Additional documentation
+is provided with the source code.
+.ih
+SEE ALSO
+gctod(2), ctotok(2).
+.endhelp ___________________________________________________________________
+
+
+
+.help states 2 "States of the LEXNUM Finite State Automaton"
+.fi
+
+
+.ks
+.nf
+start: (1)
+ +- shift unop_or_number
+ 0-7 shift odhr
+ 8-9 shift dhr
+ acf reduce not_a_number
+ ed reduce not_a_number
+ : shift maybe_real_number
+ . shift maybe_real_fraction
+ x reduce not_a_number
+ b reduce not_a_number
+ other reduce not_a_number
+.fi
+.ke
+
+
+.ks
+.nf
+unop_or_number: (+|-) (2)
+ +- revert
+ 0-7 shift odhr
+ 8-9 shift dhr
+ acf revert
+ ed revert
+ : revert
+ . shift maybe_real_fraction
+ x revert
+ b revert
+ other revert
+.fi
+.ke
+
+
+.ks
+.nf
+odhr: (+|-)?[0-7] (3)
+ +- reduce decimal_number
+ 0-7 accept
+ 8-9 shift dhr
+ acf shift h
+ ed shift maybe_hex_or_rexp
+ : shift maybe_real_number
+ . shift real_fraction
+ x reduce hex_number
+ b shift octal_or_hex_number
+ other reduce decimal_number
+.fi
+.ke
+
+
+.ks
+.nf
+dhr: (+|-)?[0-9]+ (4)
+ +- reduce decimal_number
+ 0-7 accept
+ 8-9 accept
+ acf shift h
+ ed shift maybe_hex_or_rexp
+ : shift maybe_real_number
+ . shift real_fraction
+ x reduce hex_number
+ b shift h
+ other reduce decimal_number
+.fi
+.ke
+
+
+.ks
+.nf
+maybe_real_fraction: (+|-)?"." (5)
+ +- revert
+ 0-7 shift real_fraction
+ 8-9 shift real_fraction
+ acf revert
+ ed revert
+ : revert
+ . revert
+ x revert
+ b revert
+ other revert
+.fi
+.ke
+
+
+.ks
+.nf
+h: (+|-)?[0-9]*[a-f] (6)
+ +- revert
+ 0-7 accept
+ 8-9 accept
+ acf accept
+ ed accept
+ : revert
+ . revert
+ x reduce hex_number
+ b accept
+ other revert
+.fi
+.ke
+
+
+.ks
+.nf
+maybe_hex_or_rexp: (+|-)?[0-9]+[ed] (7)
+ +- shift maybe_rexp
+ 0-7 shift hex_or_rexp
+ 8-9 shift hex_or_rexp
+ acf shift h
+ ed shift h
+ : revert
+ . revert
+ x reduce hex_number
+ b shift h
+ other revert
+.fi
+.ke
+
+
+.ks
+.nf
+maybe_real_number: (+|-)?[0-9]*":" (8)
+ +- revert
+ 0-7 shift r
+ 8-9 shift r
+ acf revert
+ ed revert
+ : accept
+ . revert
+ x revert
+ b revert
+ other revert
+.fi
+.ke
+
+
+.ks
+.nf
+octal_or_hex_number: (+|-)?[0-7]"b" (9)
+ +- reduce octal_number
+ 0-7 shift h
+ 8-9 shift h
+ acf shift h
+ ed shift h
+ : reduce octal_number
+ . reduce octal_number
+ x reduce hex_number
+ b shift h
+ other reduce octal_number
+.fi
+.ke
+
+
+.ks
+.nf
+real_fraction: (+|-)?"."[0-9] (10)
+ +- reduce real_number
+ 0-7 accept
+ 8-9 accept
+ acf reduce real_number
+ ed shift rfr_or_rexp
+ : reduce real_number
+ . reduce real_number
+ x reduce real_number
+ b reduce real_number
+ other reduce real_number
+.fi
+.ke
+
+
+.ks
+.nf
+rfr_or_rexp: (+|-)?"."[0-9]+[ed] (11)
+ +- shift maybe_rexp
+ 0-7 shift rexp
+ 8-9 shift rexp
+ acf revert
+ ed revert
+ : revert
+ . revert
+ x revert
+ b revert
+ other revert
+.fi
+.ke
+
+
+.ks
+.nf
+maybe_rexp: (+|-)?[0-9]+[ed](+|-) (12)
+ +- revert
+ 0-7 shift rexp
+ 8-9 shift rexp
+ acf revert
+ ed revert
+ : revert
+ . revert
+ x revert
+ b revert
+ other revert
+.fi
+.ke
+
+
+.ks
+.nf
+hex_or_rexp: (+|-)?[0-9]+[ed][0-9] (13)
+ +- reduce real_number
+ 0-7 accept
+ 8-9 accept
+ acf shift h
+ ed shift h
+ : reduce real_number
+ . reduce real_number
+ x reduce hex_number
+ b reduce real_number
+ other reduce real_number
+.fi
+.ke
+
+
+.ks
+.nf
+r: (+|-)?[0-9]*":"[0-9] (14)
+ +- reduce real_number
+ 0-7 accept
+ 8-9 accept
+ acf reduce real_number
+ ed shift maybe_rexp
+ : accept
+ . shift maybe_real_fraction
+ x reduce real_number
+ b reduce real_number
+ other reduce real_number
+.fi
+.ke
+
+
+.ks
+.nf
+rexp: (+|-)?[0-9]+[ed](+|-)[0-9] (15)
+ +- reduce real_number
+ 0-7 accept
+ 8-9 accept
+ acf reduce real_number
+ ed reduce real_number
+ : reduce real_number
+ . reduce real_number
+ x reduce real_number
+ b reduce real_number
+ other reduce real_number
+.fi
+.ke