⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc166.txt

📁 著名的RFC文档,其中有一些文档是已经翻译成中文的的.
💻 TXT
📖 第 1 页 / 共 3 页
字号:
   (It is expected that additional data types, such as floating point   and user-defined types, will be added as needed.)        Data Type         Meaning              Unit Length            B             Bit string              1 bit            O             Bit string              3 bits            X             Bit string              4 bits            E             EBCDIC character        8 bits            A             Network ASCII character 8 bits   The value expression is defined below.            valueexpression ::= value | <null>            value ::= literal | arithmeticexpression            literal ::= literaltype "string"            literaltype ::= B | O | X | E | A   The value expression is the nominal value of a term expressed in the   format indicated by the data type.  It is repeated according to the   replication expression.   A null value expression in the input stream defaults to the data   present in the input stream.  The data must comply with the datatype   attribute, however.   A null value expression generates padding according to Restrictions   and Interpretations of Term Functions.   The length expression is defined below.         lengthexpression ::= arithmeticexpression | <null>Anderson, et al.                                               [Page 14]RFC 166               Data Reconfiguration Service              May 1971   The length expression states the length of the field containing the   value expression.   If the length expression is less than or equal to zero, the term   succeeds but the appropriate stream pointer is not advanced.   Positive lengths cause the appropriate stream pointer to be advanced   if the term otherwise succeeds.   Control is defined under TERM AND RULE SEQUENCING.Term Format 3   Term format 3 is shown below.         descriptor   It is identical to term format 2 with the omission of the identifier.   Term format 3 is generally used in the output stream.  It is used in   the input stream where input data is to be passed over but not   retained for emission or later reference.Term Format 4   The fourth term format is shown below.         comparator    ::= (value connective value control) |                           (identifier *<=* value  control)         value         ::= literal | arithmeticexpression         literal       ::= literaltype "string"         literaltype   ::= B | O | X | E | A         string        ::= from 0 to 256 characters         connective    ::= .LE. | .LT. | .GE. | .GT. | .EQ. | .NE.   The fourth term format is used for assignment and comparison.   The assignment operator *<=* assigns the value to the identifier.   The connectives have their usual meaning.  Values to be compared must   have the same type and length attributes or an error condition arises   and the form fails.The Application of a Term   The elements of a term are applied by the following sequence of   steps.         1.  The data type, value expression, and length expression             together specify a unit value, call it x.Anderson, et al.                                               [Page 15]RFC 166               Data Reconfiguration Service              May 1971         2.  The replication expression specifies the number of times x             is to be repeated.  The value of the concatenated xs             becomes y of length L.         3.  If the term is an input stream term then the value of y of             length L is tested with the input value beginning at the             current input pointer position.         4.  If the input value satisfies the constraints of y over             length L then the input value of length L becomes the value             of the term.   In an output stream term, the procedure is the same except that the   source of input is the value of the term(s) named in the value   expression and the data is emitted in the output stream.   The above procedure is modified to include a one term look-ahead   where replicated values are of indefinite length because of the   arbitrary symbol, #.Restrictions and Interpretations of Term Functions   1.    Terms having indefinite lengths because their values are         repeated according to the # symbol, must be separated by some         type-specific data such as a literal.  (A literal isn't         specifically required, however.  An arbitrary number of ASCII         characters could be terminated by a non-ASCII character.)   2.    Truncation and padding is as follows:         a)  Character to character (A <-> E) conversion is left-             justified and truncated or padded on the right with blanks.         b)  Character to numeric and numeric to numeric conversions are             right-justified and truncated or padded on the left with             zeros.         c)  Numeric to character conversions is right-justified and             left-padded with blanks.   3.    The following are ignored in a form definition over the control         connection.         a)  TELNET control characters.         b)  Blanks except within quotes.         c)  /* string */ is treated as comments except within quotes.   4.    The following defaults prevail where the term part is omitted.         a)  The replication expression defaults to one.         b)  # in an output stream term defaults to one.         c)  The value expression of an input stream term defaults toAnderson, et al.                                               [Page 16]RFC 166               Data Reconfiguration Service              May 1971             the value found in the input stream, but the input stream             must conform to the data type and length expression.  The             value expression of an output stream term defaults to             padding only.         e)  The length expression defaults to the size of the quantity             determined by the data type and value expression.         f)  Control defaults to the next sequential term if a term is             successfully applied; else control defaults to the next             sequential rule.  If _where_ evaluates to an undefined             _label_ the form fails.   5.    Arithmetic expressions are evaluated left-to-right with no         precedence.   6.    The following limits prevail.         a)  Binary lengths are <= 32 bits         b)  Character strings are <= 256 8-bit characters         c)  Identifier names are <= 4 characters         d)  Maximum number of identifiers is <= 256         e)  Label integers are >= 0 and <= 9999   7.    Value and length operators product 32-bit binary integers.  The         value operator is currently intended for converting A or E type         decimal character strings to their binary correspondents.  For         example, the value of E'12' would be 0......01100.  The value         of E'AB' would cause the form to fail.TERM AND RULE SEQUENCING   Sequencing may be explicitly controlled by including control in a   term.        control ::=  :options | <null>        options ::=  S(where) | F(where) | U(where)                     S(where) , F(where) |                     F(where) , S(where)        where   ::=  arithmeticexpression | R(arithmeticexpression)   S, F, and U denote success, fail, and unconditional transfers,   respectively.  _Where_ evaluates to a _rule_ label, thus transfer can   be effected from within a rule (at the end of a term) to the   beginning of another rule.  R means terminate the form and return the   evaluated expression to the initiator over the control connection (if   still open).   If terms are not explicitly sequenced, the following defaults   prevail.Anderson, et al.                                               [Page 17]RFC 166               Data Reconfiguration Service              May 1971        1)  When a term fails go to the next sequential rule.        2)  When a term succeeds go to the next sequential            term within the rule.        3)  At the end of a rule, go to the next sequential            rule.   Note in the following example, the correlation between transfer of   control and movement of the input pointer.        1   XYZ(,B,,8:S(2),F(3)) : XYZ ;        2   . . . . . . .        3   . . . . . . .   The value of XYZ will never be emitted in the output stream since   control is transferred out of the rule upon either success or   failure.  If the term succeeds, the 8 bits of input will be assigned   as the value of XYZ and rule 2 will then be applied to the same input   stream data.  That is, since the complete left hand side of rule 1   was not successfully applied, the input stream pointer is not   advanced.                               IV.  EXAMPLESREMARKS   The following examples (forms and also single rules) are simple   representative uses of the Form Machine.  The examples are expressed   in a term-per-line format only to aid the explanation.  Typically, a   single rule might be written as a single line.FIELD INSERTION   To insert a field, separate the input into the two terms to allow the   inserted field between them.  For example, to do line numbering for a   121 character/line printer with a leading carriage control character,   use the following form.   (NUMB*<=*1);       /*initialize line number counter to one*/   1 CC(,E,,1:F(R(99))),  /*pick up control character and save                          as CC*/                          /*return a code of 99 upon exhaustion*/   LINE(,E,,121 : F(R(98)))  /*save text as LINE*/   :CC,               /*emit control character*/   (,E,NUMB,2),       /*emit counter in first two columns*/   (,E,E".",1),       /*emit period after line number*/   (,E,LINE,117),     /*emit text, truncated in 117 byte field*/   (NUMB*<=*NUMB+1:U(1));   /*increment line counter and go to                              rule one*/;;Anderson, et al.                                               [Page 18]RFC 166               Data Reconfiguration Service              May 1971DELETION   Data to be deleted should be isolated as separate terms on the left,   so they may be omitted (by not emitting them) on the right.   (,B,,8),           /*isolate 8 bits to ignore*/   SAVE(,A,,10)       /*extract 10 ASCII characters from                        input stream*/   :(,E,SAVE,);       /*emit the characters in SAVE as EBCDIC                        characters whose length defaults to the                        length of SAVE, i.e., 10, and advance to                        the next rule*/   In the above example, if either input stream term fails,   the next sequential rule is applied.VARIABLE LENGTH RECORDS   Some devices, terminals and programs generate variable   length records.  The following rule picks up variable length   EBCDIC records and translates them to ASCII.   CHAR(#,E,,1),      /*pick up all (an arbitrary number of)                        EBCDIC characters in the input stream*/   (,X,X"FF",2)       /*followed by a hexadecimal literal,                        FF (terminal signal)*/   :(,A,CHAR,),       /*emit them as ASCII*/   (,X,X"25",2);      /*emit an ASCII carriage return*/STRING LENGTH COMPUTATION   It is often necessary to prefix a length field to an arbitrarily long   character string.  The following rule prefixes an EBCDIC string with   a one-byte length field.   Q(#,E,,1),         /*pick up all EBCDIC characters*/   TS(,X,X"FF",2)     /*followed by a hexadecimal literal, FF*/   :(,B,L(Q)+2,8),    /*emit the length of the characters                        plus the length of the literal plus                        the length of the count field itself,                        in an 8-bit field*/   Q,                 /*emit the characters*/   TS,                /*emit the terminal*/Anderson, et al.                                               [Page 19]RFC 166               Data Reconfiguration Service              May 1971TRANSPOSITION   It is often desirable to reorder fields, such as the following   example.   Q(,E,,20), R(,E,,10) , S(,E,,15), T(,E,,5) : R, T, S, Q ;   The terms are emitted in a different order.CHARACTER PACKING AND UNPACKING   In systems such as HASP, repeated sequences of characters are packed   into a count followed by the character, for more efficient storage   and transmission.  The first form packs multiple characters and the   second unpacks them.   /*form to pack EBCDIC streams*/   /*returns 99 if OK, input exhausted*/   /*returns 98 if illegal EBCDIC*/   /*look for terminal signal FF which is not a legal EBCDIC*/   /*duplication count must be 0-254*/   1 (,X,X"FF",2 : S(R(99))) ;   /*pick up an EBCDIC char/*   CHAR(,E,,1) ;   /*get identical EBCDIC chars/*   LEN(#,E,CHAR,1)   /*emit the count and the char/*   : (,B,L(LEN)+1,8), CHAR, (:U(1));   /*end of form*/;;   /*form to unpack EBCDIC streams*/   /*look for terminal*/   1 (,X,X"FF",2 : S(R(99))) ;   /*emit character the number of times indicated*/   /*by the count, in a field the length indicated*/   /*by the counter contents*/   CNT(,B,,8), CHAR(,E,,1) : (CNT,E,CHAR,1:U(1));   /*failure of form*/   (:U(R(98))) ;;       [ This RFC was put into machine readable form for entry ]        [ into the online RFC archives by Simone Demmel 03/98 ]Anderson, et al.                                               [Page 20]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -