1 line
22 KiB
C
1 line
22 KiB
C
|
/* Copyright (c) 2017, Computer History Museum
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to
the limitations in the disclaimer below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. */
#include "lex822.h"
#define FILE_NUM 54
/* Copyright (c) 1993 by QUALCOMM Incorporated */
/************************************************************************
* lexical analysis of RFC 822 headers (Blech)
************************************************************************/
#pragma segment Lex822
Boolean Fix1342(UPtr chars,long *len);
Boolean Translate1342(PStr text,PStr charset,Byte encoding);
/*
* this enum names the various character classes
*/
typedef enum
{
ALPHA822, DIGIT822, CTL822, CR822, LF822,
SPACE822, HTAB822, QUOTE822, RPAR822, LPAR822,
AT822, COMMA822, SEM822, COLON822, BSLSH822,
DOT822, LSQU822, RSQU822, CHAR822, EQUAL822,
SLASH822, QMARK822,
CHARTYPE_LIMIT
} Char822Enum;
/*
* When the analyzer is in CollectLine, this table tells it what state to
* enter based on character class
*/
Byte LineTable[CHARTYPE_LIMIT] =
{
CollectAtom, CollectAtom, CollectSpecial, CollectSpecial, CollectSpecial,
CollectLWSP, CollectLWSP, CollectQText, CollectComment, CollectSpecial,
CollectSpecial, CollectSpecial, CollectSpecial, CollectSpecial, CollectSpecial,
CollectSpecial, CollectDL, CollectSpecial, CollectAtom, CollectSpecial,
CollectSpecial, CollectSpecial
};
/*
* classify characters.
*/
Byte Class822[256] = {
/* 0 (.) */ CTL822,/* 1 (.) */ CTL822,/* 2 (.) */ CTL822,
/* 3 (.) */ CTL822,/* 4 (.) */ CTL822,/* 5 (.) */ CTL822,
/* 6 (.) */ CTL822,/* 7 (.) */ CTL822,/* 8 (.) */ CTL822,
/* 9 (.) */ HTAB822,/* 10 (.) */ LF822,/* 11 (.) */ CTL822,
/* 12 (.) */ CTL822,/* 13 (.) */ CR822,/* 14 (.) */ CTL822,
/* 15 (.) */ CTL822,/* 16 (.) */ CTL822,/* 17 (.) */ CTL822,
/* 18 (.) */ CTL822,/* 19 (.) */ CTL822,/* 20 (.) */ CTL822,
/* 21 (.) */ CTL822,/* 22 (.) */ CTL822,/* 23 (.) */ CTL822,
/* 24 (.) */ CTL822,/* 25 (.) */ CTL822,/* 26 (.) */ CTL822,
/* 27 (.) */ CTL822,/* 28 (.) */ CTL822,/* 29 (.) */ CTL822,
/* 30 (.) */ CTL822,/* 31 (.) */ CTL822,/* 32 ( ) */ SPACE822,
/* 33 (!) */ CHAR822,/* 34 (") */ QUOTE822,/* 35 (#) */ CHAR822,
/* 36 ($) */ CHAR822,/* 37 (%) */ CHAR822,
/* 38 (&) */ CHAR822,/* 39 (') */ CHAR822,/* 40 (() */ LPAR822,
/* 41 ()) */ RPAR822,/* 42 (*) */ CHAR822,/* 43 (+) */ CHAR822,
/* 44 (,) */ COMMA822,/* 45 (-) */ CHAR822,/* 46 (.) */ DOT822,
/* 47 (/) */ SLASH822,/* 48 (0) */ DIGIT822,/* 49 (1) */ DIGIT822,
/* 50 (2) */ DIGIT822,/* 51 (3) */ DIGIT822,/* 52 (4) */ DIGIT822,
/* 53 (5
|