#include <perms.h>
extern _imp_string255 Cliparam(void);
extern void Prompt(_imp_string255 *S);
typedef struct Fhdr {
  int Dataend;
  int Datastart;
  int Filesize;
  int Filetype;
} Fhdr;
typedef struct Chdr {
  int Conad;
  int Filetype;
  int Datastart;
  int Dataend;
} Chdr;
const int Maxopt = 16;
const int Numopt = 3;
typedef struct Pformat {
  unsigned char Tab[21 /*0:20*/];
} Pformat;
extern _imp_string255 Itos(int I);
extern void Connect(_imp_string255 *Name, int Mode, int Hole, int Prot,
                    /*C_TYPE_RECORD_FORMAT*/ Chdr *Rec, int *Eflag);
extern void Trim(_imp_string255 File, int *Eflag);
extern void Setfname(_imp_string255 File);
extern _imp_string255 Nexttemp(void);
extern void Sendfile(_imp_string255 File, _imp_string255 Device,
                     _imp_string255 Header, int Copies, int Form, int *Eflag);
extern int Devcode(_imp_string255 Name);
extern void Disconnect(_imp_string255 *Filename, int *Eflag);
extern _imp_string255 Failuremessage(int Type);
extern void Changefilesize(_imp_string255 *Filename, int Filesize, int *Eflag);
extern void Newgen(_imp_string255 *Filename, _imp_string255 *Newfilename,
                   int *Eflag);
extern void Outfile(_imp_string255 *Filename, int Size, int Hole, int Prot,
                    int *Conad, int *Eflag);
int _imp_mainep(int _imp_argc, char **_imp_argv) {
  _imp_string255 S;
  int Ptr;
  int Dataend;
  int Inptr;
  int Z;
  int In;
  int Obp;
  int Eflag;
  int Writeaddress;
  int Wa0;
  int Filesize;
  int Conad;
  int Errors;
  int Line;
  int Erptr;
  int Startline;
  int Stream;
  int Filesizeptr;
  int Ssalt;
  int Strdelimiter;
  int Str;
  int Semicolon;
  int Colon;
  int Maxptr;
  int Maxitem;
  int Level;
  int Stop;
  int Increm;
  int Inlabel;
  int Charsin;
  int Ersave;
  int Inconst;
  int Bheading;
  int Inline;
  _imp_string255 Outf;
  _imp_string255 Workfile;
  _imp_string255 Infile;
  _imp_string255 Percentc;
  Pformat P;
  Chdr Rec;
  Chdr Rr;
  Fhdr *Outrec;
  const int Ccsize = 16384;
  short Outbuf[16585 /*0:16584*/];
  unsigned char Sc[16385 /*0:16384*/];
  const _imp_string255 Optname[16 /*1:16*/] = {
      _imp_str_literal("LINE"),    _imp_str_literal("ICONTIN"),
      _imp_str_literal("POSCOM"),  _imp_str_literal("MOVECOM"),
      _imp_str_literal("UCKEY"),   _imp_str_literal("SEPKEY"),
      _imp_str_literal("EXPKEY"),  _imp_str_literal("LCASNAM"),
      _imp_str_literal("SPACNAM"), _imp_str_literal("SPACASS"),
      _imp_str_literal("SPACOP"),  _imp_str_literal("LCLIST"),
      _imp_str_literal("IBLOCK"),  _imp_str_literal("ISTAT"),
      _imp_str_literal("SEPLAB"),  _imp_str_literal("SPCOMMA")};
  const _imp_string255 Optmess[2 /*0:1*/][16 /*1:16*/] = {
      _imp_str_literal("Line length zero (!!!)"),
      _imp_str_literal("Maximum line length"),
      _imp_str_literal("Continued lines not indented"),
      _imp_str_literal("Indentation of continued lines"),
      _imp_str_literal("Right hand comments not positioned"),
      _imp_str_literal("Right hand comment position"),
      _imp_str_literal("Whole line comments indented normally"),
      _imp_str_literal("Whole line comments moved to POSCOM"),
      _imp_str_literal("Keywords output in lower case"),
      _imp_str_literal("Keywords output in upper case"),
      _imp_str_literal("Keywords not split"),
      _imp_str_literal("Keywords split"),
      _imp_str_literal("%FN, %CONST, %ELSE not expanded"),
      _imp_str_literal("%FN, %CONST, (sometimes) %ELSE expanded"),
      _imp_str_literal("Case of names controlled by UCKEY"),
      _imp_str_literal("Case of names left alone"),
      _imp_str_literal("Spaces removed from names"),
      _imp_str_literal("Spaces preserved within names"),
      _imp_str_literal("No spaces round assignment operators"),
      _imp_str_literal("Spaces added round assignment operators"),
      _imp_str_literal("No spaces round operators"),
      _imp_str_literal("Spaces added round operators"),
      _imp_str_literal("Constant lists formatted"),
      _imp_str_literal("Constant lists left alone"),
      _imp_str_literal("Block not indented w.r.t. block heading"),
      _imp_str_literal("Block indented w.r.t. block heading"),
      _imp_str_literal("Statements aligned with declarations"),
      _imp_str_literal("Statements indented w.r.t. declarations"),
      _imp_str_literal("Labels not on lines by themselves"),
      _imp_str_literal("Labels on lines by themselves"),
      _imp_str_literal("No space character after commas"),
      _imp_str_literal("Space character after commas")};
  const int Charfile = 3;
  const int Underline = 128;
  const int Instring = 256;
  const int Incurly = 512;
  const int Bpoint = 1024;
  const int Bpoint2 = 2048;
  const int Terminal = 1;
  const int File = 2;
  const int Samefile = 3;
  const int Device = 4;
  const int True = 255;
  const int False = 0;
  const int Nl = 10;
  const int Dquotes = 34;
  const int Squotes = 39;
  const int Rs = 30;
  const int Rem = 0b00000001;
  const int Constart = 0b00000010;
  const int Quotes = 0b00000100;
  const int Endst = 0b00001000;
  const int Number = 0b00010000;
  const int Letter = 0b00100000;
  const unsigned char Constfirst = 0b01000000;
  const int Constcont = 0b10000000;
  const unsigned char Onecase[128 /*0:127*/] = {
      0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11,  12,  13,  14,  15,
      16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,  28,  29,  30,  31,
      32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,  44,  45,  46,  47,
      48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,  60,  61,  62,  63,
      64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,  76,  77,  78,  79,
      80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,  92,  93,  94,  95,
      96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,  76,  77,  78,  79,
      80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 127};
  const unsigned char Chartype[256 /*0:255*/] = {0b00000001,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00001000,
                                                 [11 ... 32] = 0b00000000,
                                                 0b00000001,
                                                 0b00000100,
                                                 0b01000000,
                                                 0b00000000,
                                                 0b00000001,
                                                 0b00000000,
                                                 0b00000100,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b11000000,
                                                 0b00000000,
                                                 [48 ... 57] = 0b11010000,
                                                 0b00000000,
                                                 0b00001000,
                                                 0b01000000,
                                                 0b01000000,
                                                 0b01000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00100000,
                                                 0b00100010,
                                                 0b00100010,
                                                 0b00100010,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100010,
                                                 0b00100000,
                                                 0b00100010,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100010,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00100000,
                                                 [86 ... 87] = 0b00100000,
                                                 0b00100010,
                                                 0b00100000,
                                                 0b00100000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00100000,
                                                 0b00100010,
                                                 0b00100010,
                                                 0b00100010,
                                                 [101 ... 106] = 0b00100000,
                                                 0b00100010,
                                                 0b00100000,
                                                 0b00100010,
                                                 [110 ... 113] = 0b00100000,
                                                 0b00100010,
                                                 [115 ... 119] = 0b00100000,
                                                 0b00100010,
                                                 [121 ... 122] = 0b00100000,
                                                 0b00000000,
                                                 0b00000001,
                                                 0b00000000,
                                                 0b00000000,
                                                 0b00000000,
                                                 [128 ... 194] = 0b0,
                                                 0b00000001,
                                                 [196 ... 255] = 0b0};
  const unsigned char Keycom[8 /*0:7*/] = {'%', 'C', 'O', 'M',
                                           'M', 'E', 'N', 'T'};
  const int Fstable[3 /*1:3*/] = {4096, 16384, 65536};
  const int Offile = 133;
  const int Ofprogram = 123;
  const int Equals = 38;
  const int Comma = 10;
  const int If = 12;
  const int Unless = 15;
  const int While = 22;
  const int Until = 28;
  const int Else = 227;
  const int Then = 222;
  const int And = 158;
  const int Or = 162;
  const int Const = 204;
  const int Constant = 195;
  const int Fn = 96;
  const int Function = 103;
  const _imp_string255 Snl = _imp_str_literal("\n");
  const _imp_string255 Fault[4 /*1:4*/] = {
      _imp_str_literal("Statement is too long and could not be compiled."),
      _imp_str_literal(
          "End of file reached before end of program terminator found."),
      _imp_str_literal(
          "%END found, but could not match it to a start of routine."),
      _imp_str_literal("Disaster *** Indentation too near line length limit.")};
  void Fail(int Type, int Action);
  void Opt(_imp_string255 Parm, /*C_TYPE_RECORD_FORMAT*/ Pformat * P);
  const unsigned char Clett[435 /*0:434*/] = {
      1,   43,  1,   45,  1,   40,  1,   41,  1,   42,  1,   44,  2,   201, 198,
      6,   213, 206, 204, 197, 211, 211, 5,   215, 200, 201, 204, 197, 5,   213,
      206, 212, 201, 204, 3,   198, 207, 210, 1,   61,  5,   193, 204, 201, 193,
      211, 7,   201, 206, 212, 197, 199, 197, 210, 4,   210, 197, 193, 204, 4,
      204, 207, 206, 199, 4,   194, 217, 212, 197, 6,   211, 212, 210, 201, 206,
      199, 4,   200, 193, 204, 198, 6,   210, 197, 195, 207, 210, 196, 7,   210,
      207, 213, 212, 201, 206, 197, 2,   198, 206, 3,   205, 193, 208, 8,   198,
      213, 206, 195, 212, 201, 207, 206, 4,   206, 193, 205, 197, 5,   193, 210,
      210, 193, 217, 9,   207, 198, 208, 210, 207, 199, 210, 193, 205, 6,   207,
      198, 198, 201, 204, 197, 6,   207, 198, 204, 201, 211, 212, 6,   198, 207,
      210, 205, 193, 212, 3,   206, 207, 212, 3,   193, 206, 196, 2,   207, 210,
      1,   58,  4,   211, 208, 197, 195, 3,   207, 215, 206, 8,   197, 216, 212,
      197, 210, 206, 193, 204, 9,   197, 216, 212, 210, 201, 206, 211, 201, 195,
      8,   195, 207, 206, 211, 212, 193, 206, 212, 5,   195, 207, 206, 211, 212,
      5,   197, 214, 197, 206, 212, 5,   211, 212, 193, 210, 212, 4,   212, 200,
      197, 206, 4,   197, 204, 211, 197, 1,   95,  6,   211, 217, 211, 212, 197,
      205, 7,   196, 217, 206, 193, 205, 201, 195, 4,   80,  85,  84,  95,  5,
      67,  78,  79,  80,  95,  2,   204, 61,  1,   60,  1,   62,  4,   40,  196,
      210, 43,  2,   196, 210, 1,   194, 3,   212, 207, 211, 3,   204, 206, 194,
      3,   216, 206, 194, 2,   208, 195, 3,   195, 212, 194, 2,   45,  62,  6,
      210, 197, 212, 213, 210, 206, 6,   210, 197, 211, 213, 204, 212, 7,   205,
      207, 206, 201, 212, 207, 210, 4,   211, 212, 207, 208, 6,   211, 201, 199,
      206, 193, 204, 4,   197, 216, 201, 212, 8,   195, 207, 206, 212, 201, 206,
      213, 197, 6,   198, 201, 206, 201, 211, 200, 5,   195, 217, 195, 204, 197,
      6,   210, 197, 208, 197, 193, 212, 3,   197, 206, 196, 7,   201, 206, 195,
      204, 213, 196, 197, 5,   194, 197, 199, 201, 206, 2,   207, 206, 6,   211,
      215, 201, 212, 195, 200, 4,   204, 201, 211, 212, 14,  212, 210, 213, 211,
      212, 197, 196, 208, 210, 207, 199, 210, 193, 205, 6,   205, 193, 201, 206,
      197, 208, 7,   195, 207, 206, 212, 210, 207, 204, 4,   40,  42,  41,  58};
  const int Symbol[868 /*1300:2167*/] = {
      1307, 1303, 0,    1305, 2,    1307, 1000, 1319, 1312, 1001, 1366, 1786,
      1315, 1003, 1020, 1319, 4,    1345, 6,    1329, 1323, 1001, 1014, 1325,
      1003, 1329, 4,    1329, 6,    1336, 1336, 1010, 1028, 1319, 1011, 1359,
      1345, 1343, 1010, 1028, 1319, 1011, 1359, 1345, 8,    1352, 1352, 1010,
      1028, 1307, 1011, 1352, 1359, 1357, 1026, 1307, 999,  1359, 1000, 1366,
      1364, 1026, 1319, 999,  1366, 1000, 1374, 1372, 4,    1345, 1374, 6,
      1374, 1000, 1381, 1379, 10,   1345, 999,  1381, 1000, 1386, 1384, 12,
      1386, 15,   1410, 1393, 22,   1010, 1536, 1556, 1011, 1399, 28,   1010,
      1536, 1556, 1011, 1410, 34,   1010, 1001, 38,   1345, 10,   1345, 10,
      1345, 1011, 1416, 1414, 40,   1013, 1416, 1000, 1423, 1421, 10,   1001,
      999,  1423, 1000, 1428, 1426, 46,   1428, 1000, 1436, 1431, 54,   1433,
      46,   1436, 59,   54,   1458, 1439, 46,   1441, 54,   1444, 59,   1428,
      1447, 64,   1423, 1450, 69,   1689, 1453, 76,   1423, 1458, 81,   4,
      1848, 6,    1465, 1461, 88,   1465, 1004, 1436, 1465, 1472, 1468, 96,
      1470, 99,   1472, 103,  1488, 1478, 1436, 1493, 1001, 1416, 1484, 1458,
      1488, 1001, 1416, 1501, 1488, 112,  1001, 1416, 1493, 1491, 112,  1493,
      1000, 1501, 1497, 117,  112,  1499, 112,  1501, 1000, 1511, 1509, 4,
      1010, 1472, 1011, 1511, 6,    1511, 1000, 1520, 1518, 1030, 1010, 1472,
      1011, 999,  1520, 1000, 1531, 1524, 123,  1016, 1526, 133,  1529, 140,
      1018, 1531, 1016, 1536, 1534, 147,  1536, 1000, 1550, 1542, 1345, 1032,
      1345, 1550, 1547, 4,    1536, 1556, 6,    1550, 154,  1536, 1556, 1554,
      1037, 1345, 1556, 1000, 1567, 1561, 158,  1536, 1567, 1565, 162,  1536,
      1574, 1567, 1000, 1574, 1572, 158,  1536, 999,  1574, 1000, 1581, 1579,
      162,  1536, 999,  1581, 1000, 1589, 1585, 1033, 1345, 1587, 165,  1589,
      1000, 1595, 1593, 167,  1008, 1595, 1015, 1599, 1598, 167,  1599, 1608,
      1606, 10,   1345, 165,  1345, 1599, 1608, 1000, 1617, 1613, 1493, 1001,
      1416, 1617, 117,  1531, 1617, 1623, 1623, 1001, 1416, 1794, 1623, 1629,
      1627, 10,   1617, 1629, 1000, 1646, 1639, 1493, 1595, 1010, 1001, 1410,
      1802, 1011, 1646, 1646, 117,  1531, 1595, 1001, 1794, 1668, 1657, 1655,
      10,   1010, 1001, 1410, 1802, 1011, 1646, 1657, 1000, 1668, 1660, 172,
      1662, 176,  1664, 185,  1666, 195,  1668, 204,  1679, 1677, 38,   1012,
      1028, 1319, 1359, 1689, 1679, 1679, 1000, 1689, 1687, 10,   1028, 1319,
      1359, 1689, 999,  1689, 1000, 1696, 1694, 4,    1336, 6,    1696, 1000,
      1703, 1701, 10,   1329, 999,  1703, 1000, 1708, 1706, 210,  1708, 1000,
      1714, 1712, 10,   1345, 1714, 1000, 1727, 1725, 10,   1001, 1416, 4,
      1345, 165,  1345, 6,    999,  1727, 1000, 1734, 1732, 28,   1536, 1556,
      1734, 1000, 1747, 1737, 1019, 1739, 1006, 1744, 1381, 1536, 1556, 1006,
      1747, 1386, 1006, 1761, 1751, 216,  1034, 1755, 222,  216,  1034, 1761,
      222,  1010, 2008, 1011, 1767, 1767, 1765, 158,  2008, 1767, 1000, 1773,
      1771, 227,  1773, 1773, 1000, 1786, 1777, 216,  1034, 1784, 1381, 1010,
      1536, 1556, 1011, 1747, 1786, 2008, 1794, 1792, 232,  1001, 1366, 1786,
      1794, 1000, 1802, 1802, 4,    1345, 165,  1345, 1599, 6,    1810, 1808,
      38,   1028, 1319, 1359, 1810, 1000, 1819, 1813, 234,  1815, 176,  1817,
      241,  1819, 1000, 1830, 1828, 1001, 38,   1345, 10,   1345, 10,   1345,
      1830, 1000, 1837, 1835, 10,   1855, 999,  1837, 1000, 1848, 1841, 167,
      1001, 1848, 1001, 4,    1855, 1830, 1873, 6,    1855, 1851, 1001, 1855,
      1855, 1830, 1873, 1865, 1859, 1436, 1865, 1865, 4,    1855, 1830, 1873,
      6,    1873, 1870, 1493, 1001, 1416, 1873, 117,  1617, 1881, 1879, 162,
      1855, 1830, 999,  1881, 1000, 1898, 1886, 249,  1002, 1006, 1890, 1022,
      1898, 1006, 1896, 254,  1009, 10,   1009, 1006, 1898, 1031, 1912, 1902,
      1023, 1912, 1907, 1024, 260,  1951, 1956, 1912, 1025, 1005, 10,   1935,
      1935, 1917, 263,  1001, 265,  1919, 1984, 1924, 4,    1984, 1973, 6,
      1928, 267,  1984, 6,    1933, 4,    272,  1973, 6,    1935, 275,  1951,
      1940, 263,  1001, 265,  1942, 1984, 1947, 4,    272,  1973, 6,    1951,
      267,  1005, 6,    1956, 1954, 272,  1956, 1005, 1964, 1962, 10,   1005,
      10,   1005, 1964, 1000, 1973, 1968, 0,    1005, 1971, 2,    1005, 1973,
      1000, 1979, 1977, 0,    275,  1979, 1000, 1984, 1982, 38,   1984, 1000,
      1999, 1989, 1979, 1300, 1003, 1992, 1001, 1964, 1997, 4,    1999, 1964,
      6,    1999, 277,  2008, 2002, 281,  2004, 285,  2006, 289,  2008, 292,
      2041, 2017, 1010, 1001, 1366, 1786, 1011, 1581, 1761, 2021, 296,  1001,
      1366, 2023, 299,  2027, 306,  1033, 1345, 2030, 313,  1761, 2032, 321,
      2037, 326,  1703, 1329, 1708, 2039, 333,  2041, 338,  2168, 2048, 1027,
      1010, 2008, 1011, 1734, 2050, 1007, 2058, 1381, 1010, 1536, 1556, 1011,
      1747, 1006, 2063, 347,  1035, 1767, 1006, 2068, 354,  1029, 1819, 1006,
      2073, 360,  1036, 1727, 1006, 2078, 1386, 354,  1029, 1006, 2086, 1004,
      1008, 1010, 1436, 1011, 1608, 1006, 2090, 367,  1520, 1006, 2095, 81,
      147,  1837, 1006, 2105, 1010, 1810, 1458, 1011, 1589, 1001, 1410, 1501,
      1006, 2110, 1657, 1436, 1629, 1006, 2114, 371,  1003, 1038, 2118, 379,
      1015, 1006, 2127, 385,  1021, 1703, 1329, 1696, 216,  1034, 1006, 2138,
      388,  1001, 1416, 4,    1345, 165,  1345, 6,    1714, 1006, 2142, 395,
      1006, 1017, 2148, 227,  1035, 1039, 1034, 1006, 2151, 8,    1881, 2154,
      400,  1006, 2158, 415,  1001, 1006, 2162, 422,  1003, 1006, 2166, 1001,
      430,  1019, 2168, 1006};
  const int Ss = 2041;
  const int Comment = 2;
  const int Ownalt = 12;
  const int Eisss = 0x00017F00;
  const int Opc[128 /*0:127*/] = {
      0,      ' JCC', ' JAT', ' JAF', [4 ... 7] = 0, ' VAL', ' CYD', 'INCA',
      'MODD', 'PRCL', '   J', ' JLK', 'CALL',        ' ADB', ' SBB', 'DEBJ',
      ' CPB', ' SIG', ' MYB', ' VMY', 'CPIB',        ' LCT', 'MPSR', 'CPSR',
      'STCT', 'EXIT', 'ESEX', ' OUT', ' ACT',        '  SL', 'SLSS', 'SLSD',
      'SLSQ', '  ST', 'STUH', 'STXN', 'IDLE',        ' SLD', ' SLB', 'TDEC',
      'INCT', ' STD', ' STB', 'STLN', 'STSF',        '   L', ' LSS', ' LSD',
      ' LSQ', 'RRTC', ' LUH', 'RALN', ' ASF',        'LDRL', ' LDA', 'LDTB',
      ' LDB', '  LD', '  LB', ' LLN', ' LXN',        ' TCH', 'ANDS', ' ORS',
      'NEQS', 'EXPA', ' AND', '  OR', ' NEQ',        '  PK', ' INS', 'SUPK',
      ' EXP', 'COMA', ' DDV', 'DRDV', 'DMDV',        'SWEQ', 'SWNE', ' CPS',
      ' TTR', ' FLT', ' IDV', 'IRDV', 'IMDV',        ' MVL', '  MV', 'CHOV',
      ' COM', ' FIX', ' RDV', 'RRDV', 'RDVD',        ' UAD', ' USB', 'URSB',
      ' UCP', ' USH', ' ROT', ' SHS', ' SHZ',        ' DAD', ' DSB', 'DRSB',
      ' DCP', ' DSH', ' DMY', 'DMYD', 'CBIN',        ' IAD', ' ISB', 'IRSB',
      ' ICP', ' ISH', ' IMY', 'IMYD', 'CDEC',        ' RAD', ' RSB', 'RRSB',
      ' RCP', ' RSC', ' RMY', 'RMYD', ' PUT'};
  void Cnptf(void) {
    if (Filesizeptr < 3) {
      Filesizeptr = Filesizeptr + 1;
      Filesize = Fstable(Filesizeptr);
    } else
      Filesize = Filesize + Fstable(3);
    Changefilesize(Workfile, Filesize, Eflag);
    if (Eflag == 261) {
      Disconnect(Workfile, Eflag);
      if (Eflag != 0) Fail(Eflag, 5);
      Changefilesize(Workfile, Filesize, Eflag);
      if (Eflag == 0) {
        Writeaddress = Writeaddress - Conad;
        Connect(Workfile, 3, 0, 0, Rr, Eflag);
        if (Eflag != 0) Fail(Eflag, 5);
        Conad = Rr.Conad;
        Writeaddress = Writeaddress + Conad;
        Outrec = Record(Conad);
      }
    }
    if (Eflag != 0) Fail(Eflag, 5);
    Outrec->Filesize = Filesize;
  }
  void Transfer(int From, int To) {
    int I;
    int Ch;
    int Last;
    if (Stream != Terminal) {
      Last = To - From + 1 + Writeaddress - Conad;
      if (Last > Filesize) Cnptf();
      Outrec->Dataend = Last;
    }
    for (I = From; I <= To; I++) {
      Ch = Outbuf(I) & 0x7F;
      if ((Ch & 127) == Rs) continue;
      if (Ch == Nl) {
        Charsin = 0;
        Line = Line + 1;
        if (Stream != Terminal)
          while (Writeaddress > Wa0 && *Byteinteger(Writeaddress - 1) == ' ')
            Writeaddress = Writeaddress - 1;
      } else
        Charsin = Charsin + 1;
      if (Stream == Terminal)
        Printch(Ch);
      else {
        *Byteinteger(Writeaddress) = Ch;
        Writeaddress = Writeaddress + 1;
      }
    }
  }
  void Outstring(_imp_string255 Text) {
    int I;
    int Ch;
    int Last;
    if (Stream != Terminal) {
      Last = *Length(Text) + Writeaddress - Conad;
      if (Last > Filesize) Cnptf();
      Outrec->Dataend = Last;
    }
    for (I = 1; I <= *Length(Text); I++) {
      Ch = *Charno(Text, I);
      if (Ch == Nl) {
        Charsin = 0;
        Line = Line + 1;
      } else
        Charsin = Charsin + 1;
      if (Stream == Terminal)
        Printch(Ch);
      else {
        *Byteinteger(Writeaddress) = Ch;
        Writeaddress = Writeaddress + 1;
      }
    }
  }
  void Dupl(int Char, int Times) {
    int I;
    int Last;
    if (Times <= 0) return;
    Charsin = Charsin + Times;
    if (Stream != Terminal) {
      Last = Times + Writeaddress - Conad;
      if (Last > Filesize) Cnptf();
      Outrec->Dataend = Last;
    }
    for (I = 1; I <= Times; I++)
      if (Stream == Terminal)
        Printch(Char);
      else {
        *Byteinteger(Writeaddress) = Char;
        Writeaddress = Writeaddress + 1;
      }
  }
  void Insert(int Chars, int Lsflag, int Rsflag) {
    if (Lsflag == True && True != Inconst) {
      Outbuf(Obp) = ' ';
      Obp = Obp + 1;
    }
    do {
      Outbuf(Obp) = Chars & 0xFF;
      Chars = Chars >> 8;
      Obp = Obp + 1;
    } while (Chars != 0);
    if (Rsflag == True && True != Inconst) {
      Outbuf(Obp) = ' ';
      Obp = Obp + 1;
    }
  }
  void Closedown(int Success) {
    if (Success == True)
      Printstring(_imp_join(
          Itos(Line),
          _imp_join(_imp_str_literal(" lines have been processed"), Snl)));
    else {
      Printstring(
          _imp_join(_imp_str_literal("Soap80 fails :- "), Itos(Errors)));
      if (Errors == 1)
        Printstring(_imp_join(_imp_str_literal(" error."), Snl));
      else
        Printstring(_imp_join(_imp_str_literal(" errors."), Snl));
    }
    if (Stream != Terminal) {
      Outrec->Dataend = Writeaddress - Conad;
      Trim(Workfile, Eflag);
      Disconnect(Workfile, Eflag);
      if (Stream == Samefile)
        if (Errors > 0)
          Printstring(_imp_join(
              _imp_str_literal("Output stored in "),
              _imp_join(Workfile,
                        _imp_join(_imp_str_literal(", since "),
                                  _imp_join(Infile,
                                            _imp_join(_imp_str_literal(
                                                          " contains errors."),
                                                      Snl))))));
        else {
          Newgen(Workfile, Outf, Eflag);
          if (Eflag != 0) {
            Printstring(_imp_join(
                _imp_str_literal("Attempt to create "),
                _imp_join(Outf,
                          _imp_join(_imp_str_literal(" failed because "),
                                    _imp_join(Failuremessage(Eflag), Snl)))));
            Printstring(_imp_join(
                _imp_str_literal("Output stored in "),
                _imp_join(Workfile, _imp_join(_imp_str_literal("."), Snl))));
          }
        }
      else if (Stream == Device) {
        if (*Length(Infile) > 8) *Length(Infile) = 8;
        Sendfile(Workfile, Outf,
                 _imp_join(_imp_str_literal("Soap80: "), Infile), 1, 0, Eflag);
        if (Eflag != 0) Fail(Eflag, 5);
      }
    }
    Pprofile();
    exit(0);
  }
  void Punch(void) {
    int Lst;
    int Bk;
    int I;
    int Ubp;
    int Lbp;
    int Bbp;
    int Tp;
    int Inn;
    int Ch;
    int Curlend;
    Inn = In;
    if ((1 << Ssalt & Eisss) == 0 && P.Istat == True) Inn = Inn + 1;
    if (Ssalt != Comment && Semicolon == False) Dupl(' ', P.Tab(Inn) - Charsin);
    if (Outbuf(Obp - 1) == ';')
      Semicolon = True;
    else
      Semicolon = False;
    if (Semicolon == True && P.Line - 20 < Charsin + Obp) {
      Semicolon = False;
      Outbuf(Obp - 1) = Nl;
    }
    if (Semicolon == True) {
      Outbuf(Obp) = ' ';
      Obp = Obp + 1;
    }
    if (Increm == True) {
      Increm = False;
      if (P.Tab(In + 1) + 20 > P.Line)
        Fail(4, 2);
      else
        In = In + 1;
    }
    Lst = 1;
    if (Ssalt == Comment)
      for (;;) {
        if ((Chartype(Sc(1)) & Rem) == 0 || Semicolon == True)
          if ((Semicolon | Colon) == False && P.Movecom == False)
            Dupl(' ', P.Tab(Inn) - Charsin);
          else
            Dupl(' ', P.Poscom - Charsin);
        I = Lst;
        while (I < Obp && (Outbuf(I) & 127) != Rs) I = I + 1;
        if (I == Obp) goto Finalpart;
        Transfer(Lst, I - 1);
        if ((Outbuf(I - 1) & 127) == ',')
          Outstring(Snl);
        else
          Outstring(_imp_join(Percentc, Snl));
        do
          I = I + 1;
        while (I != Obp && Outbuf(I) == ' ');
        Lst = I;
      }
    for (;;) {
      Ubp = P.Line + Lst - Charsin - 4;
      Lbp = (Ubp + Lst) / 2;
      Bbp = (Ubp + 3 * Lst) / 4;
      Curlend = 0;
      for (Bk = Lst; Bk <= Ubp + 3; Bk++) {
        if (Bk >= Obp) break;
        Ch = Outbuf(Bk);
        if ((Ch & 127) == Nl ||
            ((Ch & 127) == Rs && Ssalt == Ownalt && P.Lclist == True))
          goto Printpart;
      }
      if (Obp < Ubp + 3) break;
      for (Bk = Ubp; Bk >= Bbp; Bk--)
        if ((Outbuf(Bk) & Bpoint) != 0) {
          while (Outbuf(Bk + 1) == ' ') Bk = Bk + 1;
          goto Printpart;
        }
      for (Bk = Ubp; Bk >= Bbp; Bk--)
        if ((Outbuf(Bk) & Bpoint2) != 0) {
          while (Outbuf(Bk + 1) == ' ') Bk = Bk + 1;
          goto Printpart;
        }
      for (Bk = Ubp; Bk >= Bbp; Bk--)
        if (Outbuf(Bk) == ',') goto Printpart;
      if ((Outbuf(Ubp) & Incurly) != 0) {
        Curlend = 1;
        for (Bk = Ubp; Bk <= Obp - 2; Bk++)
          if ((Outbuf(Bk) & Incurly) == 0) {
            Curlend = 0;
            break;
          }
        for (Bk = Ubp; Bk >= Bbp; Bk--)
          if ((Outbuf(Bk) & Incurly) == 0) {
            Bk = Bk - 1;
            goto Printpart;
          }
        if (Curlend == 1) goto Finalpart;
        for (Bk = Ubp; Bk <= Obp - 2; Bk++)
          if ((Outbuf(Bk) & Incurly) == 0) goto Printpart;
      }
      for (Bk = Ubp + 1; Bk >= Lbp; Bk--)
        if (Outbuf(Bk) == ' ' && (Outbuf(Bk - 1) & Underline) != 0)
          goto Printpart;
      if (P.Spacnam == False)
        for (Bk = Ubp + 1; Bk >= Lbp; Bk--)
          if (Outbuf(Bk) == ' ') goto Printpart;
      for (Bk = Ubp; Bk >= Lbp; Bk--)
        if (Outbuf(Bk) == '%') {
          Bk = Bk - 1;
          goto Printpart;
        }
      for (Bk = Ubp; Bk >= Lbp; Bk--) {
        if (Outbuf(Bk) == '.' || Outbuf(Bk) == ')') goto Printpart;
        if (Outbuf(Bk) == '(') {
          Bk = Bk - 1;
          goto Printpart;
        }
      }
      if ((Outbuf(Ubp) & Instring) != 0) {
        for (Bk = Ubp; Bk >= Bbp; Bk--)
          if (Outbuf(Bk) == ',' || Outbuf(Bk) == '.' || Outbuf(Bk) == '=')
            goto Printpart;
        for (I = Ubp; I >= Lst + 3; I--)
          if (Outbuf(I) == Dquotes) {
            Bk = I - 1;
            goto Printpart;
          }
        for (I = Bk; I >= Lst; I--)
          if (Outbuf(I) == Squotes) {
            if ((Chartype(Outbuf(I - 1)) & Constart) == 0)
              Bk = I - 1;
            else
              Bk = I - 2;
            goto Printpart;
          }
        Printstring(
            _imp_join(_imp_str_literal("Line:"),
                      _imp_join(Itos(Line), _imp_str_literal(" problem:"))));
        for (I = Lst; I <= Ubp; I++) Printsymbol(Outbuf(I));
        Printstring(Snl);
        Tp = Ubp - 1;
        Transfer(Lst, Tp);
        Outstring(_imp_join(_imp_str_literal("\"."), _imp_join(Percentc, Snl)));
        Dupl(' ', P.Tab(Inn) + P.Icontin);
        Outstring(_imp_str_literal("\""));
        Lst = Tp + 1;
        continue;
      } else
        Bk = Ubp;
      Printstring(
          _imp_join(_imp_str_literal("Line:"),
                    _imp_join(Itos(Line), _imp_str_literal(" problem:"))));
      for (I = Lst; I <= Ubp; I++) Printsymbol(Outbuf(I));
      Printstring(Snl);
    Printpart:;
      I = Bk;
      while (Outbuf(I) == ' ' || (Outbuf(I) & 127) == Rs) I = I - 1;
      Transfer(Lst, I);
      if (I < Lst || (Outbuf(I) & 127) != Nl) {
        if ((Outbuf(I) & 127) != ',' && Outbuf(Bk) != (Rs | 128) &&
            Curlend == 0)
          Outstring(_imp_join(_imp_str_literal(" "), Percentc));
        Outstring(Snl);
        if (Inconst == False) Dupl(' ', P.Tab(Inn) + P.Icontin);
        if ((Outbuf(Bk + 1) & Underline) != 0 && Outbuf(Bk + 1) != (Rs | 128))
          Outstring(_imp_str_literal("%"));
      }
      Lst = Bk + 1;
    }
  Finalpart:;
    Transfer(Lst, Obp - 1);
    Obp = 1;
  }
  int Nextnonsp(int Print) {
    int Ch;
    for (;;) {
      Ch = Sc(Ptr);
      if (Ch == '{') {
        if (Obp > 1 && Print == False) {
          Outbuf(Obp) = ' ';
          Obp = Obp + 1;
        }
        Outbuf(Obp) = '{';
        Obp = Obp + 1;
        Ptr = Ptr + 1;
        do {
          Ch = Sc(Ptr);
          Outbuf(Obp) = Ch | Incurly;
          Obp = Obp + 1;
          Ptr = Ptr + 1;
        } while (Ch == '}');
        continue;
      }
      if (Ch != ' ' && Ch != '%' && (Ch & 127) != Rs) break;
      if (Print == True) {
        Outbuf(Obp) = Ch;
        Obp = Obp + 1;
      }
      Ptr = Ptr + 1;
    }
    return (Ch);
  }
  void Getline(int Initptr) {
    const unsigned char Itoi[256 /*0:255*/] = {[0 ... 9] = 32,
                                               10,
                                               [11 ... 24] = 32,
                                               25,
                                               26,
                                               [27 ... 31] = 32,
                                               32,
                                               33,
                                               34,
                                               35,
                                               36,
                                               37,
                                               38,
                                               39,
                                               40,
                                               41,
                                               42,
                                               43,
                                               44,
                                               45,
                                               46,
                                               47,
                                               48,
                                               49,
                                               50,
                                               51,
                                               52,
                                               53,
                                               54,
                                               55,
                                               56,
                                               57,
                                               58,
                                               59,
                                               60,
                                               61,
                                               62,
                                               63,
                                               64,
                                               65,
                                               66,
                                               67,
                                               68,
                                               69,
                                               70,
                                               71,
                                               72,
                                               73,
                                               74,
                                               75,
                                               76,
                                               77,
                                               78,
                                               79,
                                               80,
                                               81,
                                               82,
                                               83,
                                               84,
                                               85,
                                               86,
                                               87,
                                               88,
                                               89,
                                               90,
                                               91,
                                               92,
                                               93,
                                               94,
                                               95,
                                               96,
                                               97,
                                               98,
                                               99,
                                               100,
                                               101,
                                               102,
                                               103,
                                               104,
                                               105,
                                               106,
                                               107,
                                               108,
                                               109,
                                               110,
                                               111,
                                               112,
                                               113,
                                               114,
                                               115,
                                               116,
                                               117,
                                               118,
                                               119,
                                               120,
                                               121,
                                               122,
                                               123,
                                               124,
                                               125,
                                               126,
                                               32,
                                               [128 ... 132] = 26,
                                               10,
                                               [134 ... 143] = 26,
                                               [144 ... 159] = 26,
                                               [160 ... 173] = 26,
                                               92,
                                               38,
                                               [176 ... 186] = 26,
                                               35,
                                               [188 ... 191] = 26,
                                               [192 ... 207] = 26,
                                               [208 ... 216] = 26,
                                               35,
                                               [218 ... 222] = 26,
                                               94,
                                               [224 ... 255] = 26};
    short Scurl[20 /*1:20*/];
    short Ecurl[20 /*1:20*/];
    int Inkeyword;
    int Char;
    int P;
    int Ncurl;
    static int Strdelimiter;
    if (Initptr == 1) Startline = Inptr;
    Ptr = Initptr;
    for (;;) {
      Inkeyword = False;
      Ncurl = 0;
      for (;;) {
        if (Ptr > Ccsize) {
          Fail(1, 1);
          break;
        }
        if (Inptr > Dataend) Fail(2, 1);
        Char = Itoi(*Byteinteger(Inptr));
        Inptr = Inptr + 1;
        if (Char == Nl) {
          Inline = Inline + 1;
          Sc(Ptr) = Nl;
          Ptr = Ptr + 1;
          break;
        }
        if (Str == True) {
          Sc(Ptr) = Char;
          Ptr = Ptr + 1;
          if (Char == Strdelimiter) Str = False;
          continue;
        }
        if ((Chartype(Char) & Endst) != 0) {
          Sc(Ptr) = Char;
          Ptr = Ptr + 1;
          break;
        }
        if (Char == '{') {
          Ncurl = Ncurl + 1;
          Scurl(Ncurl) = Ptr;
          Sc(Ptr) = Char;
          Ptr = Ptr + 1;
          for (;;) {
            Char = Itoi(*Byteinteger(Inptr));
            if (Char == Nl)
              Char = '}';
            else
              Inptr = Inptr + 1;
            if (Char == '}') break;
            Sc(Ptr) = Char;
            Ptr = Ptr + 1;
          }
          Ecurl(Ncurl) = Ptr;
        }
        if (Inkeyword == True)
          if ((Chartype(Char) & Letter) == 0)
            Inkeyword = False;
          else {
            Sc(Ptr) = Onecase(Char) | Underline;
            Ptr = Ptr + 1;
            continue;
          }
        if (Char == '%') Inkeyword = True;
        if (Char == Squotes || Char == Dquotes) {
          Str = True;
          Strdelimiter = Char;
        }
        Sc(Ptr) = Char;
        Ptr = Ptr + 1;
      }
      if (Char == Nl) {
        while (Ptr > 2 && Sc(Ptr - 2) == ' ') Ptr = Ptr - 1;
        Sc(Ptr - 1) = Nl;
        if (Str == False) {
          P = Ptr - 2;
          while (Ncurl > 0 && Ecurl(Ncurl) == P) {
            P = Scurl(Ncurl) - 1;
            Ncurl = Ncurl - 1;
            while (P > 0 && Sc(P) == ' ') P = P - 1;
          }
          if (P > 0) {
            Char = Sc(P);
            if (Char == ',') {
              Sc(Ptr - 1) = Rs | 128;
              continue;
            }
            if (Char == 'C' + Underline) {
              if (P > 1 && Sc(P - 1) == '%') Sc(P - 1) = ' ';
              Sc(P) = ' ';
              Sc(Ptr - 1) = Rs;
              continue;
            }
            if ((Char & 127) == Rs) {
              Sc(Ptr - 1) = Rs | 128;
              continue;
            }
          }
        }
      }
      break;
    }
    Ptr = Initptr;
  }
  int Compare(int Test) {
    int I;
    int Ch;
    int Key;
    int J;
    for (I = 1; I <= Clett(Test); I++) {
      Ch = Nextnonsp(Inconst);
      if (Ch != Clett(I + Test)) return (False);
      Ptr = Ptr + 1;
    }
    if (Test == Offile || Test == Ofprogram) Stop = True;
    if (Test == Comma) {
      Insert(',', False, P.Spcomma);
      return (True);
    }
    if (Test == Equals) {
      if (Ssalt == Ownalt) Inconst = P.Lclist;
      Insert('=', P.Spacass, P.Spacass);
      return (True);
    }
    if (P.Expkey == True) {
      if (Test == Fn) Test = Function;
      if (Test == Const) Test = Constant;
    }
    if (Obp == 1 ||
        ((Outbuf(Obp - 1) & Underline) == 0 && (Outbuf(Obp - 1) & 127) != '%'))
      Key = False;
    else
      Key = True;
    for (I = 1; I <= Clett(Test); I++) {
      Ch = Clett(Test + I);
      if (Ch < Underline && Key == True) {
        Outbuf(Obp) = ' ';
        Obp = Obp + 1;
        Key = False;
      } else if (Ch > Underline)
        if (Key == False) {
          if (Obp > 1 && '(' != Outbuf(Obp - 1) && Outbuf(Obp - 1) != ' ') {
            Outbuf(Obp) = ' ';
            Obp = Obp + 1;
          }
          Outbuf(Obp) = '%';
          Obp = Obp + 1;
          Key = True;
        } else if (I == 1 && P.Sepkey == True) {
          Outbuf(Obp) = ' ';
          Outbuf(Obp + 1) = '%';
          Obp = Obp + 2;
        }
      if ((Ch & Underline) != 0 && P.Uckey == False && Ch != (Rs | 128))
        Ch = Ch | 32;
      Outbuf(Obp) = Ch;
      Obp = Obp + 1;
    }
    if ((Test == Offile || Test == Ofprogram) && P.Sepkey == True) {
      if (Test == Offile)
        J = 4;
      else
        J = 7;
      Obp = Obp + 2;
      for (I = 1; I <= J; I++) Outbuf(Obp - I) = Outbuf(Obp - I - 2);
      Outbuf(Obp - J - 2) = ' ';
      Outbuf(Obp - J - 1) = '%';
    }
    if (Test == If || Test == Unless || Test == While || Test == Until ||
        Test == Else || Test == Then)
      Outbuf(Obp - 1) = Ch | Bpoint;
    if (Test == And || Test == Or) Outbuf(Obp - 1) = Ch | Bpoint2;
    return (True);
  }
  int Check(int Pos) {
    int Defend;
    int Subdefend;
    int Subdefstart;
    int Res;
    int Item;
    int Rsptr;
    int Z;
    int Strdelimiter;
    int Ch;
    int Rsobj;
    int Alt;
    int I;
    int J;
    static _imp_string255 Fes = _imp_str_literal("FINISH %ELSE %START");
    static int Uci;
    static int Depth = 0;
    static int Bip_sw;
    static void *Bip[41 /*999:1039*/] = {
        &&Bip_999,  &&Bip_1000, &&Bip_1001, &&Bip_1002, &&Bip_1003, &&Bip_1004,
        &&Bip_1005, &&Bip_1006, &&Bip_1007, &&Bip_1008, &&Bip_1009, &&Bip_1010,
        &&Bip_1011, &&Bip_1012, &&Bip_1013, &&Bip_1014, &&Bip_1015, &&Bip_1016,
        &&Bip_1017, &&Bip_1018, &&Bip_1019, &&Bip_1020, &&Bip_1021, &&Bip_1022,
        &&Bip_1023, &&Bip_1024, &&Bip_1025, &&Bip_1026, &&Bip_1027, &&Bip_1028,
        &&Bip_1029, &&Bip_1030, &&Bip_1031, &&Bip_1032, &&Bip_1033, &&Bip_1034,
        &&Bip_1035, &&Bip_1036, &&Bip_1037, &&Bip_1038, &&Bip_1039,
    };
    Alt = 0;
    Depth = Depth + 1;
    if (Depth == 1) Ssalt = 0;
    Rsptr = Ptr;
    Rsobj = Obp;
    Defend = Symbol(Pos);
    Pos = Pos + 1;
    while (Pos < Defend) {
      Alt = Alt + 1;
      if (Depth == 1) {
        Ssalt = Ssalt + 1;
        Inconst = False;
      }
      Subdefend = Symbol(Pos);
      Pos = Pos + 1;
      Res = True;
      Subdefstart = Pos;
      while (Pos < Subdefend) {
        Item = Symbol(Pos);
        if (999 <= Item && Item < 1300) goto *Bip[Bip_sw = (Item)-999];
        if (Item < 999) Res = Compare(Item);
        if (Item >= 1300) Res = Check(Item);
        Pos = Pos + 1;
        goto Bypass;
      Bip_999:;
        Pos = Subdefstart;
        Rsptr = Ptr;
        Rsobj = Obp;
        goto Bypass;
      Bip_1000:;
        Depth = Depth - 1;
        return (True);
      Bip_1001:;
        Ch = Nextnonsp(Inconst);
        J = Ptr;
        Ptr = Ptr + 1;
        I = Obp;
        if ((Chartype(Ch) & Letter) == 0) {
          Res = False;
          goto Inc;
        }
        if ((Chartype(Ch) & Constart) != 0 &&
            Nextnonsp(Inconst | P.Spacnam) == Squotes) {
          Res = False;
          goto Inc;
        }
        Ptr = J;
        Obp = I;
        J = Outbuf(Obp - 1);
        if (J > 128 || (Chartype(J) & Letter) != 0 || J == ')') {
          Outbuf(Obp) = ' ';
          Obp = Obp + 1;
        }
        while ((Chartype(Ch) & (Letter | Number)) != 0) {
          if ((Chartype(Ch) & Letter) != 0 && P.Lcasnam == False)
            if (P.Uckey == True)
              Ch = Ch & (~32);
            else
              Ch = Ch | 32;
          Outbuf(Obp) = Ch;
          Obp = Obp + 1;
          J = Obp;
          Ptr = Ptr + 1;
          Ch = Nextnonsp(Inconst | P.Spacnam);
        }
        if (P.Spacnam == True && Inconst == False && J < Obp) {
          I = J;
          for (;;) {
            while (I < Obp && (Outbuf(I) & 127) != '{') I = I + 1;
            if (I == Obp) break;
            if (J < I) {
              Outbuf(J) = ' ';
              do {
                J = J + 1;
                Outbuf(J) = Outbuf(I);
                I = I + 1;
              } while ((Outbuf(J) & 127) == '}');
            } else {
              do
                J = J + 1;
              while ((Outbuf(J) & 127) != '}');
              I = J + 1;
            }
            J = J + 1;
          }
          Obp = J;
        }
        goto Inc;
      Bip_1005:;
        Ch = Nextnonsp(Inconst);
        if ((Chartype(Ch) & Number) == 0) {
          Res = False;
          goto Inc;
        }
      Bip_1002:;
      Bip_1003:;
        Ch = Nextnonsp(Inconst);
        Ptr = Ptr + 1;
        if ((Chartype(Ch) & (Quotes | Constfirst)) == 0 &&
            ((Chartype(Ch) & Constart) == 0 || Nextnonsp(Inconst) != Squotes)) {
          Res = False;
          goto Inc;
        }
        if (Outbuf(Obp - 1) > 128 ||
            (Chartype(Outbuf(Obp - 1)) & Letter) != 0) {
          Outbuf(Obp) = ' ';
          Obp = Obp + 1;
        }
        if ((Chartype(Ch) & Constfirst) == 0) {
          if ((Chartype(Ch) & Constart) != 0) {
            Outbuf(Obp) = Ch;
            Obp = Obp + 1;
            Strdelimiter = Nextnonsp(Inconst);
            Ptr = Ptr + 1;
          } else
            Strdelimiter = Ch;
          Outbuf(Obp) = Strdelimiter;
          Obp = Obp + 1;
          for (;;)
            if (Sc(Ptr) == Strdelimiter) {
              Outbuf(Obp) = Strdelimiter | Instring;
              if (Sc(Ptr + 1) != Strdelimiter) break;
              Outbuf(Obp + 1) = Strdelimiter | Instring;
              Obp = Obp + 2;
              Ptr = Ptr + 2;
            } else {
              Ch = Sc(Ptr);
              Outbuf(Obp) = Ch | Instring;
              Obp = Obp + 1;
              Ptr = Ptr + 1;
              if (Ch == Nl) Getline(Ptr);
            }
          Ptr = Ptr + 1;
          Obp = Obp + 1;
        } else {
          Ptr = Ptr - 1;
          for (;;) {
            for (;;) {
              if ((Chartype(Ch) & Constcont) == 0) break;
              Outbuf(Obp) = Ch;
              Obp = Obp + 1;
              Ptr = Ptr + 1;
              Ch = Nextnonsp(Inconst);
            }
            if ('_' != Ch && Ch != '@') break;
            if (Ch == '@')
              J = Number;
            else
              J = Number | Letter;
            do {
              Outbuf(Obp) = Ch;
              Obp = Obp + 1;
              Ptr = Ptr + 1;
              Ch = Nextnonsp(Inconst);
            } while ((Chartype(Ch) & J) != 0);
          }
        }
        goto Inc;
      Bip_1004:;
        Ch = Nextnonsp(Inconst);
        if (Ch <= Underline || (0x80000000 >> (Ch & 31) & 0x20C83000) == 0)
          Res = False;
        goto Inc;
      Bip_1038:;
      Bip_1006:;
        Ch = Nextnonsp(Inconst);
        if ((Chartype(Ch) & Endst) == 0) {
          Res = False;
          goto Inc;
        }
        while (Obp > 1 && Outbuf(Obp - 1) == ' ') Obp = Obp - 1;
        Outbuf(Obp) = Ch;
        Obp = Obp + 1;
        goto Inc;
      Bip_1007:;
        Ch = Nextnonsp(Inconst);
        if ((Chartype(Ch) & Rem) == 0) {
          Res = False;
          goto Inc;
        }
        if ((Ch & Underline) != 0 && ((Outbuf(Obp - 1) & Underline) == 0)) {
          Outbuf(Obp) = '%';
          Obp = Obp + 1;
        }
        Outbuf(Obp) = Ch;
        Obp = Obp + 1;
        Ptr = Ptr + 1;
        if (Ch == 'C' + Underline) {
          if (P.Uckey == False) Outbuf(Obp - 1) = Ch | 32;
          for (I = 2; I <= 7; I++) {
            Ch = Nextnonsp(Inconst);
            if (Ch != Keycom(I) + Underline) {
              Res = False;
              goto Inc;
            }
            if (P.Uckey == False) Ch = Ch | 32;
            Outbuf(Obp) = Ch;
            Obp = Obp + 1;
            Ptr = Ptr + 1;
          }
        }
        Str = False;
        for (;;) {
          while (Sc(Ptr) != Nl && (Str == True || Sc(Ptr) != ';')) {
            Ch = Sc(Ptr);
            if (Ch == Squotes || Ch == Dquotes)
              if (Str == False) {
                Strdelimiter = Ch;
                Str = True;
              } else if (Ch == Strdelimiter)
                Str = False;
            if ((Ch & Underline) != 0 && P.Uckey == False && Ch != (Rs | 128))
              Ch = Ch | 32;
            Outbuf(Obp) = Ch;
            Obp = Obp + 1;
            Ptr = Ptr + 1;
          }
          Outbuf(Obp) = Sc(Ptr);
          Obp = Obp + 1;
          Ptr = Ptr + 1;
          if (Outbuf(Obp - 1) == Nl) break;
          Getline(1);
        }
        Str = False;
        goto Inc;
      Bip_1009:;
        Ch = Nextnonsp(Inconst);
        if ('0' > Ch || Ch > '9') {
          Res = False;
          goto Inc;
        }
        Z = 0;
        while ('0' <= Ch && Ch <= '9') {
          Z = Z * 10 + Ch - '0';
          Outbuf(Obp) = Ch;
          Obp = Obp + 1;
          Ptr = Ptr + 1;
          Ch = Nextnonsp(Inconst);
        }
        if (Z > 255) Res = False;
        goto Inc;
      Bip_1012:;
        Ch = Nextnonsp(Inconst);
        if (Ch == Nl) {
          Outbuf(Obp) = Nl;
          Obp = Obp + 1;
          Sc(Ptr) = Rs | 128;
          Getline(Ptr + 1);
        }
        goto Inc;
      Bip_1015:;
        Level = Level + 1;
        Bheading = True;
        if (P.Iblock == True) Increm = True;
        goto Inc;
      Bip_1016:;
        Level = Level - 1;
        Bheading = True;
        if (P.Iblock == True && In > 0) In = In - 1;
        goto Inc;
      Bip_1019:;
        if (Sc(Ptr - 1) != ':') {
          Res = False;
          goto Inc;
        }
        if (Charsin > 0) Outstring(Snl);
        Ch = Nextnonsp(Inconst);
        Transfer(1, Obp - 1);
        Obp = 1;
        if (P.Seplab == True && Ch != Nl) Outstring(Snl);
        Inlabel = True;
        goto Inc;
      Bip_1022:;
        Ch = Nextnonsp(Inconst);
        Z = '    ';
        while ((Chartype(Ch) & Letter) != 0) {
          Z = Z << 8 | Onecase(Ch);
          Outbuf(Obp) = Ch;
          Obp = Obp + 1;
          Ptr = Ptr + 1;
          Ch = Nextnonsp(Inconst);
        }
        if (Ch != '_' || Z == '    ') {
          Res = False;
          goto Inc;
        }
        Outbuf(Obp) = '_';
        Obp = Obp + 1;
        Uci = Z;
        Ptr = Ptr + 1;
        goto Inc;
      Bip_1023:;
        for (I = 7; I <= 127; I++)
          if (Opc(I) == Uci) goto Pfnd;
        Res = False;
        goto Inc;
      Pfnd:;
        if (8 <= I >> 3 && I >> 3 <= 11 && (I & 7) <= 3) Res = False;
        goto Inc;
      Bip_1024:;
        for (I = 64; I <= 88; I += 8)
          for (J = 0; J <= 3; J++)
            if (Opc(I + J) == Uci) goto Inc;
        Res = False;
        goto Inc;
      Bip_1025:;
        for (I = 3; I >= 1; I--)
          if (Opc(I) == Uci) goto Inc;
        Res = False;
        goto Inc;
      Bip_1026:;
        Ch = Nextnonsp(Inconst);
        Ptr = Ptr + 1;
        if (32 >= Ch || Ch >= 127 ||
            (0x80000000 >> (Ch & 31) & 0x4237000A) == 0) {
          Res = False;
          goto Inc;
        }
        if (Ch == '&' || Ch == '+' || Ch == '-') {
          Insert(Ch, P.Spacop, P.Spacop);
          goto Inc;
        }
        if (Ch == '*') {
          if (Ch != Nextnonsp(Inconst)) {
            Insert('*', P.Spacop, P.Spacop);
            goto Inc;
          }
          Ptr = Ptr + 1;
          J = Ptr;
          Ch = Nextnonsp(Inconst);
          Ptr = Ptr + 1;
          if ('*' == Ch && Ch == Nextnonsp(Inconst)) {
            Insert('****', P.Spacop, P.Spacop);
            Ptr = Ptr + 1;
            goto Inc;
          }
          Insert('**', P.Spacop, P.Spacop);
          Ptr = J;
          goto Inc;
        }
        if (Ch == '/') {
          if (Ch != Nextnonsp(Inconst)) {
            Insert('/', P.Spacop, P.Spacop);
            goto Inc;
          }
          Insert('//', P.Spacop, P.Spacop);
          Ptr = Ptr + 1;
          goto Inc;
        }
        if (Ch == '!') {
          if (Ch != Nextnonsp(Inconst)) {
            Insert('!', P.Spacop, P.Spacop);
            goto Inc;
          }
          Insert('!!', P.Spacop, P.Spacop);
          Ptr = Ptr + 1;
          goto Inc;
        }
        if (Ch == '.') {
          Outbuf(Obp) = '.';
          Obp = Obp + 1;
          goto Inc;
        }
        if (Ch == Nextnonsp(Inconst) && Nextnonsp(Inconst) == '>') {
          Insert('>>', P.Spacop, P.Spacop);
          Ptr = Ptr + 1;
          goto Inc;
        }
        if (Ch == Nextnonsp(Inconst) && Nextnonsp(Inconst) == '<') {
          Insert('<<', P.Spacop, P.Spacop);
          Ptr = Ptr + 1;
          goto Inc;
        }
        if (Ch == '\\') {
          if (Ch != Nextnonsp(Inconst)) {
            Insert('\\', P.Spacop, P.Spacop);
            goto Inc;
          }
          Insert('\\', P.Spacop, P.Spacop);
          Ptr = Ptr + 1;
          goto Inc;
        }
        Res = False;
        goto Inc;
      Bip_1027:;
        Ch = Nextnonsp(Inconst);
        if ((Chartype(Ch) & Letter) == 0 && Ch != '-' &&
            (0x80000000 >> (Ch & 31) & 0x14043000) == 0)
          Res = False;
        goto Inc;
      Bip_1028:;
        Ch = Nextnonsp(Inconst);
        if (Ch == '+' || Ch == '-' || Ch == '\\' || Ch == 0x7E) {
          Insert(Ch, P.Spacop, P.Spacop);
          Ptr = Ptr + 1;
        }
        goto Inc;
      Bip_1031:;
        for (;;) {
          Ch = Nextnonsp(Inconst);
          Outbuf(Obp) = Ch;
          Obp = Obp + 1;
          if ((Chartype(Ch) & Endst) != 0) goto Inc;
          Ptr = Ptr + 1;
        }
      Bip_1030:;
        Ch = Nextnonsp(Inconst);
        if (Ch == ')') Res = False;
        if (Res == True) Insert(',', False, P.Spcomma);
        if (Ch == ',') Ptr = Ptr + 1;
        goto Inc;
      Bip_1032:;
      Bip_1037:;
        Ch = Nextnonsp(Inconst);
        Ptr = Ptr + 1;
        if (32 >= Ch || Ch > 92 ||
            (0x80000000 >> (Ch & 31) & 0x1004000E) == 0) {
          Res = False;
          goto Inc;
        }
        if (Ch == '=') {
          if (Nextnonsp(Inconst) == Ch) {
            Ptr = Ptr + 1;
            Insert('==', P.Spacop, P.Spacop);
            goto Inc;
          }
          Insert('=', P.Spacop, P.Spacop);
          goto Inc;
        }
        if (Ch == '#') {
          if (Nextnonsp(Inconst) == Ch) {
            Ptr = Ptr + 1;
            Insert('##', P.Spacop, P.Spacop);
            goto Inc;
          }
          Insert('#', P.Spacop, P.Spacop);
          goto Inc;
        }
        if (Ch == '\\' && Nextnonsp(Inconst) == '=') {
          Ptr = Ptr + 1;
          if (Nextnonsp(Inconst) == '=') {
            Ptr = Ptr + 1;Insert('==\',P.Spacop,P.Spacop);goto Inc;
          } Insert('=\',P.Spacop,P.Spacop);goto Inc;
        }
        if (Ch == '>') {
          if (Nextnonsp(Inconst) == '=') {
            Ptr = Ptr + 1;
            Insert('=>', P.Spacop, P.Spacop);
            goto Inc;
          }
          Insert('>', P.Spacop, P.Spacop);
          goto Inc;
        }
        if (Ch == '<') {
          if (Nextnonsp(Inconst) == '=') {
            Ptr = Ptr + 1;
            Insert('=<', P.Spacop, P.Spacop);
            goto Inc;
          }
          if (Nextnonsp(Inconst) == '>') {
            Ptr = Ptr + 1;
            Insert('><', P.Spacop, P.Spacop);
            goto Inc;
          }
          Insert('<', P.Spacop, P.Spacop);
          goto Inc;
        }
        if (Ch == '-' && Nextnonsp(Inconst) == '>') {
          Ptr = Ptr + 1;
          Insert('>-', P.Spacop, P.Spacop);
          goto Inc;
        }
        Res = False;
        goto Inc;
      Bip_1033:;
        Ch = Nextnonsp(Inconst);
        Ptr = Ptr + 1;
        if (Ch == '=') {
          if (Nextnonsp(Inconst) == '=') {
            Ptr = Ptr + 1;
            Insert('==', P.Spacass, P.Spacass);
            goto Inc;
          }
          Insert('=', P.Spacass, P.Spacass);
          goto Inc;
        }
        if (Ch == '<' && Nextnonsp(Inconst) == '-') {
          Ptr = Ptr + 1;
          Insert('-<', P.Spacass, P.Spacass);
          goto Inc;
        }
        if (Ch == '-' && Nextnonsp(Inconst) == '>') {
          Ptr = Ptr + 1;
          Insert('>-', P.Spacass, P.Spacass);
          goto Inc;
        }
        Res = False;
      Bip_1008:;
        goto Inc;
      Bip_1010:;
      Bip_1011:;
        goto Inc;
      Bip_1013:;
        Ch = Nextnonsp(Inconst);
        Ptr = Ptr + 1;
        if (Ch != '"') {
          Res = False;
          goto Inc;
        }
        Outbuf(Obp) = ' ';
        Obp = Obp + 1;
        Outbuf(Obp) = '"';
        Obp = Obp + 1;
        for (;;)
          if (Sc(Ptr) == '"') {
            Outbuf(Obp) = '"' | Instring;
            if (Sc(Ptr + 1) != '"') break;
            Outbuf(Obp + 1) = '"' | Instring;
            Obp = Obp + 2;
            Ptr = Ptr + 2;
          } else {
            Ch = Sc(Ptr);
            Outbuf(Obp) = Ch | Instring;
            Obp = Obp + 1;
            Ptr = Ptr + 1;
            if (Ch == Nl) Getline(Ptr);
          }
        Ptr = Ptr + 1;
        Obp = Obp + 1;
        goto Inc;
      Bip_1014:;
      Bip_1017:;
      Bip_1018:;
      Bip_1020:;
      Bip_1021:;
        goto Inc;
      Bip_1039:;
        if (P.Expkey == True) {
          Obp = Obp - 4;
          for (I = 1; I <= 19; I++) {
            J = *Charno(Fes, I);
            if (P.Sepkey == False && (J == ' ' || J == '%')) continue;
            if (P.Uckey == False && 'A' <= J && J <= 'Z') J = J | 32;
            Outbuf(Obp) = J;
            Obp = Obp + 1;
          }
        }
      Bip_1029:;
      Bip_1034:;
        Increm = True;
        goto Inc;
      Bip_1035:;
      Bip_1036:;
        if (In > 0) In = In - 1;
        goto Inc;
      Inc:;
        Pos = Pos + 1;
      Bypass:;
        if (Res == False) {
          Pos = Subdefend;
          Obp = Rsobj;
          if (Ptr > Maxptr) {
            Maxptr = Ptr;
            Maxitem = Item;
          }
          Ptr = Rsptr;
        }
      }
      if (Res == True) {
        Depth = Depth - 1;
        return (True);
      }
    }
    Ptr = Rsptr;
    Obp = Rsobj;
    Depth = Depth - 1;
    return (False);
  }
  S = _imp_str_literal("test.imp,.out,SPCOMMA=Y,EXPKEY=Y");
  Opt(S, P);
  Connect(Infile, 0, 0, 0, Rec, Eflag);
  if (Eflag != 0) Fail(Eflag, 5);
  if (Rec.Filetype != Charfile) {
    Setfname(Infile);
    Fail(267, 5);
  }
  Inptr = Rec.Conad + Rec.Datastart;
  Dataend = Rec.Conad + Rec.Dataend;
  if (Outf == _imp_str_literal(".OUT"))
    Stream = Terminal;
  else if (Infile == Outf)
    Stream = Samefile;
  else if (*Charno(Outf, 1) == '.')
    if (Devcode(Outf) <= 0) {
      Setfname(Outf);
      Fail(264, 5);
    } else
      Stream = Device;
  else
    Stream = File;
  if (Stream == Samefile || Stream == Device)
    Workfile = _imp_join(_imp_str_literal("T#"), Nexttemp);
  else
    Workfile = Outf;
  if (Stream != Terminal) {
    Filesizeptr = 1;
    Filesize = Fstable(Filesizeptr);
    Outfile(Workfile, Filesize, 0, 0, Conad, Eflag);
    if (Eflag != 0) Fail(Eflag, 5);
    Outrec = Record(Conad);
    Writeaddress = Conad + Outrec->Datastart;
    Wa0 = Writeaddress;
    Outrec->Filetype = Charfile;
  }
  Outbuf(0) = 0;
  Sc(0) = 0;
  Level = 0;
  Obp = 1;
  In = 0;
  Inline = 1;
  Line = 0;
  Errors = 0;
  Erptr = 0;
  Charsin = 0;
  Str = False;
  Stop = False;
  Semicolon = False;
  Increm = False;
  Inlabel = False;
  Ersave = False;
  if (P.Uckey == True)
    Percentc = _imp_str_literal("%C");
  else
    Percentc = _imp_str_literal("%c");
  for (;;) {
    Bheading = False;
    Maxptr = 0;
    Colon = Inlabel;
    if (Inlabel == False)
      Getline(1);
    else
      Inlabel = False;
    if (Check(Ss) == False) {
      Printstring(_imp_join(
          Snl,
          _imp_join(_imp_str_literal("Syntax analysis fails on input line "),
                    Itos(Inline - 1))));
      Printstring(_imp_join(
          _imp_str_literal(" (output line "),
          _imp_join(Itos(Line + 1), _imp_join(_imp_str_literal(")"), Snl))));
      Z = 1;
      while ((Chartype(Sc(Z)) & Endst) == 0) {
        if ((Sc(Z) & 127) == Rs)
          Printstring(Snl);
        else
          Printch(Sc(Z) & 127);
        Z = Z + 1;
      }
      if (Sc(Z) == ';') Printch(';');
      Printstring(Snl);
      Spaces(Maxptr - 1);
      Printch('!');
      Printstring(Snl);
      while (*Byteinteger(Startline) == ' ') Startline = Startline + 1;
      if (Stream != Terminal) {
        Obp = 1;
        Z = *Byteinteger(Startline);
        while ((Chartype(Z) & Endst) == 0) {
          if ((Chartype(Z) & Quotes) != 0) {
            Strdelimiter = Z;
            Outbuf(Obp) = Strdelimiter;
            Obp = Obp + 1;
            Startline = Startline + 1;
            Z = *Byteinteger(Startline);
            while (Z != Strdelimiter) {
              Outbuf(Obp) = Z;
              Obp = Obp + 1;
              Startline = Startline + 1;
              Z = *Byteinteger(Startline);
            }
          }
          Outbuf(Obp) = Z;
          Obp = Obp + 1;
          Startline = Startline + 1;
          Z = *Byteinteger(Startline);
        }
        Outbuf(Obp) = Z;
        Obp = Obp + 1;
        Punch();
      }
      Str = False;
      Errors = Errors + 1;
    } else if (Inlabel == False)
      Punch();
    if (Stop == True)
      if (Errors == 0)
        Closedown(True);
      else
        Closedown(False);
  }
  void Fail(int Type, int Action) {
    if (Action != 5)
      if ((Action & 2) == 0) {
        Printstring(_imp_join(Snl, _imp_str_literal("*** Error: ")));
        Errors = Errors + 1;
      } else
        Printstring(_imp_join(Snl, _imp_str_literal("*** Warning: ")));
    if ((Action & 4) == 0) {
      Printstring(_imp_join(Fault(Type), Snl));
      Printstring(_imp_join(
          _imp_str_literal("*** In input line "),
          _imp_join(
              Itos(Inline),
              _imp_join(_imp_str_literal(" (output line "),
                        _imp_join(Itos(Line),
                                  _imp_join(_imp_str_literal(")"), Snl))))));
    } else {
      Printstring(_imp_join(_imp_str_literal("*** Soap80 fails -"),
                            Failuremessage(Type)));
      exit(0);
    }
    if ((Action & 1) == 1) Closedown(False);
  }
  void Opt(_imp_string255 Parm, /*C_TYPE_RECORD_FORMAT*/ Pformat * P) {
    void Readline(void);
    void Setline(void);
    int Stoi(_imp_string255 * Snum);
    void Ask(int Optno);
    int I;
    int J;
    int Temp;
    int Flag;
    int Profvsn;
    _imp_string255 Line;
    _imp_string255 Option;
    _imp_string255 Value;
    _imp_string255 Filename;
    const int Progvsn = 3;
    static int Prof_sw;
    static void *Prof[4 /*0:3*/] = {
        &&Prof_0,
        &&Prof_1,
        &&Prof_2,
        &&Prof_3,
    };
    extern void Readprofile(_imp_string255 Key,
                            /*C_TYPE_RECORD_FORMAT*/ Pformat * Info,
                            int *Version, int *Uflag);
    extern void Writeprofile(_imp_string255 * Key,
                             /*C_TYPE_RECORD_FORMAT*/ Pformat * Info,
                             int *Version, int *Uflag);
    Profvsn = 0;
    Flag = 5;
    if (Flag > 4)
      Printstring(_imp_join(
          _imp_str_literal(
              "Failed to read file SS#PROFILE.  Defaults options assumed."),
          Snl));
    goto *Prof[Prof_sw = Profvsn];
  Prof_0:;
    P.A(1) = 80;
    P.A(2) = 2;
    P.A(3) = 41;
    P.A(4) = False;
    P.A(5) = False;
    P.A(6) = True;
    P.A(7) = False;
    P.A(8) = True;
    P.A(9) = True;
    P.A(10) = False;
    P.A(11) = True;
    P.A(12) = True;
    P.A(13) = False;
    P.A(14) = False;
    for (I = 0; I <= 10; I++) P.A(I + 15) = 3 * I;
    for (I = 11; I <= 20; I++) P.A(I + 15) = 5 * I - 20;
  Prof_1:;
    for (I = 36; I >= 16; I--) P.A(I) = P.A(I - 1);
    Printstring(
        _imp_join(_imp_str_literal("**New parameter available: SPCOMMA"), Snl));
    Printstring(
        _imp_join(_imp_str_literal(
                      "      Y : One space character inserted after commas."),
                  Snl));
    Printstring(_imp_join(
        _imp_str_literal(
            "      N : No space character inserted after commas (default)."),
        _imp_join(Snl, Snl)));
    P.A(15) = False;
  Prof_2:;
    {
      unsigned char Tab[21 /*0:20*/];
      for (I = 0; I <= 20; I++) Tab(I) = P.A(I + 16);
      for (I = 1; I <= 6; I++) P.A(I + 21) = P.A(I);
      for (I = 7; I <= 15; I++) P.A(I + 22) = P.A(I);
      for (I = 0; I <= 20; I++) P.A(I + 1) = Tab(I);
    }
    Printstring(
        _imp_join(_imp_str_literal("**New parameter available: EXPKEY"), Snl));
    Printstring(_imp_join(
        _imp_str_literal(
            "      Y : Keywords %FN, %CONST and (sometimes) %ELSE expanded."),
        Snl));
    Printstring(
        _imp_join(_imp_str_literal(
                      "      N : %FN, %CONST and %ELSE left alone (default)."),
                  _imp_join(Snl, Snl)));
    P.A(28) = False;
    Profvsn = Progvsn;
    {
      _imp_string255 Key;
      Key = _imp_str_literal("Soap80key");
      Writeprofile(Key, P, Profvsn, Flag);
    }
  Prof_3:;
    if (_imp_cond_resolve(Parm, Filename, _imp_str_literal(","), Outf))
      if (!_imp_cond_resolve(Outf, Outf, _imp_str_literal(","), Parm))
        Parm = _imp_str_literal("");
      else {
        Filename = Parm;
        Outf = Parm;
        Parm = _imp_str_literal("");
      }
    Infile = Filename;
    if (Outf == _imp_str_literal("")) Outf = Filename;
    if (Parm == _imp_str_literal("")) return;
    Temp = *Charno(Parm, *Length(Parm));
    if (Temp != '*' && Temp != '?')
      Parm = _imp_join(Parm, _imp_str_literal(",END"));
    for (;;) {
      if (Parm == _imp_str_literal("")) {
        {
          _imp_string255 S;
          S = _imp_str_literal("Soap80: ");
          Prompt(S);
        }
        Readline();
      } else
        Setline();
      if (Line == _imp_str_literal("END") || Line == _imp_str_literal(".END"))
        return;
      if (Line == _imp_str_literal("GO") || Line == _imp_str_literal(".GO"))
        return;
      if (Line == _imp_str_literal("STOP") || Line == _imp_str_literal(".STOP"))
        exit(0);
      if (Line == _imp_str_literal("SAVE") ||
          Line == _imp_str_literal(".SAVE")) {
        {
          _imp_string255 Key;
          Key = _imp_str_literal("Soap80key");
          Writeprofile(Key, P, Profvsn, Flag);
        }
        if (Flag == 1)
          Printstring(
              _imp_join(_imp_str_literal(
                            "Profile file SS#PROFILE created and cherished."),
                        Snl));
      } else if (Line == _imp_str_literal("?")) {
        Printstring(_imp_join(
            _imp_str_literal(
                "Option name:{current setting}Meaning of current setting"),
            Snl));
        for (I = 1; I <= Maxopt; I++) {
          Printstring(Optname(I));
          Spaces(7 - *Length(Optname(I)));
          Printstring(_imp_str_literal(":{"));
          J = P.Optarr(I);
          if (J == False)
            Printsymbol('N');
          else if (J == True)
            Printsymbol('Y');
          else
            Printstring(Itos(J));
          if (J > 0) J = 1;
          Printstring(
              _imp_join(_imp_str_literal("}"), _imp_join(Optmess(J, I), Snl)));
        }
        Printstring(_imp_str_literal("TAB    :{"));
        for (I = 1; I <= 20; I++) {
          Printstring(Itos(P.Tab(I)));
          if (I != 20) Printsymbol(':');
        }
        Printsymbol('}');
        Printstring(Snl);
        Printstring(
            _imp_join(_imp_str_literal("        Indenting values"), Snl));
        Printstring(_imp_join(
            _imp_str_literal(
                "SAVE     : Save current option settings, for defaults "
                "henceforth.\nGO or END: Cause SOAP80 to start processing the "
                "input.\nSTOP     : Cause SOAP80 to stop immediately."),
            Snl));
      } else if (_imp_cond_resolve(Line, Option, _imp_str_literal("="),
                                   Value) &&
                 Value != _imp_str_literal("")) {
        Flag = 0;
        for (I = 1; I <= Maxopt; I++) {
          if (Option != Optname(I)) continue;
          Flag = 1;
          if (Value == _imp_str_literal("?")) {
            Printstring(Optname(I));
            Spaces(7 - *Length(Optname(I)));
            Printstring(_imp_str_literal(":{"));
            J = P.Optarr(I);
            if (J == False)
              Printsymbol('N');
            else if (J == True)
              Printsymbol('Y');
            else
              Printstring(Itos(J));
            if (J > 0) J = 1;
            Printstring(_imp_join(_imp_str_literal("}"),
                                  _imp_join(Optmess(J, I), Snl)));
          } else if (I <= Numopt) {
            Temp = Stoi(Value);
            if (Option == _imp_str_literal("LINE") &&
                (Temp < 30 || Temp > 160)) {
              Printstring(_imp_join(
                  _imp_str_literal("Bad line length - Only from 30 to 160"),
                  Snl));
              break;
            }
            if (Temp > 255) Temp = -1;
            if (Temp == -1)
              Printstring(_imp_join(Value, _imp_join(_imp_str_literal(" - "),
                                                     Failuremessage(320))));
            else
              P.Optarr(I) = Temp;
          } else
            Ask(I);
          break;
        }
        if (Flag == 1) continue;
        if (Option == _imp_str_literal("TAB")) {
          if (Value == _imp_str_literal("?")) {
            Printstring(_imp_str_literal("TAB    :{"));
            for (I = 1; I <= 20; I++) {
              Printstring(Itos(P.Tab(I)));
              if (I != 20) Printsymbol(':');
            }
            Printsymbol('}');
            Printstring(Snl);
            Printstring(
                _imp_join(_imp_str_literal("        Indenting values"), Snl));
          } else {
            I = 1;
            while (I <= 20 && Value != _imp_str_literal("")) {
              Temp = Stoi(Value);
              if (Temp == -1) {
                Printstring(_imp_join(Value, _imp_join(_imp_str_literal(" - "),
                                                       Failuremessage(320))));
                break;
              }
              P.Tab(I) = Temp;
              if (*Length(Value) == 0) {
                I = I + 1;
                break;
              }
              if (*Charno(Value, 1) != ':') {
                Printstring(_imp_join(Value, _imp_join(_imp_str_literal(" - "),
                                                       Failuremessage(320))));
                I = 21;
              } else
                Value = Substring(Value, 2, *Length(Value));
              I = I + 1;
            }
            for (J = I; J <= 20; J++) {
              P.Tab(J) = 2 * P.Tab(J - 1) - P.Tab(J - 2);
              if (P.Tab(J) > P.Line) P.Tab(J) = P.Line;
            }
          }
          continue;
        }
        Printstring(_imp_join(
            Option, _imp_join(_imp_str_literal(" - "), Failuremessage(322))));
      } else
        Printstring(_imp_join(
            Line,
            _imp_join(
                _imp_str_literal(
                    " -  invalid: format should be\n      'keyword = value'    "
                    "  or     'keyword = ?'     or    '?'    or\n      'SAVE'  "
                    "  or    'END'     or    'GO'     or     'STOP'"),
                Snl)));
    }
    return;
    void Readline(void) {
      int Ch;
      for (;;) {
        Line = _imp_str_literal("");
        for (;;) {
          Readsymbol(Ch);
          if (Ch == Nl) break;
          if (Ch == ' ') continue;
          Line = _imp_join(Line, Tostring(Onecase(Ch)));
        }
        if (*Length(Line) > 0) return;
      }
    }
    void Setline(void) {
      if (!_imp_cond_resolve(Parm, Line, _imp_str_literal(","), Parm)) {
        if (*Charno(Parm, *Length(Parm)) == '*')
          Readline();
        else
          Line = Parm;
        Parm = _imp_str_literal("");
      }
    }
    void Ask(int I) {
      int S;
      S = *Charno(Value, 1);
      if (S == 'Y')
        P.Optarr(I) = True;
      else if (S == 'N')
        P.Optarr(I) = False;
      else
        Printstring(_imp_join(_imp_str_literal("Answer Yes or No or ?"), Snl));
    }
    int Stoi(_imp_string255 * Snum) {
      int I;
      int Inum;
      if ('0' > *Charno(Snum, 1) || *Charno(Snum, 1) > '9') return (-1);
      I = 1;
      Inum = 0;
      while ('0' <= *Charno(Snum, I) && *Charno(Snum, I) <= '9') {
        Inum = Inum * 10 + *Charno(Snum, I) - '0';
        I = I + 1;
        if (I > *Length(Snum)) break;
      }
      if (I >= *Length(Snum))
        Snum = _imp_str_literal("");
      else
        Snum = Substring(Snum, I, *Length(Snum));
      return (Inum);
    }
  }
  exit(0);
  return (1);
}
