1 /* BEGIN INCLUDE FILE ..... ted_support.incl.pl1 ..... 03/16/81 */ 2 3 /* more information may be found in ted_support.gi.info */ 4 5 dcl ted_support_p ptr; 6 dcl ted_support_version_2 fixed bin int static init(2); 7 dcl 1 ted_support based(ted_support_p), 8 2 version fixed bin, /* 1 */ 9 2 addr_ct fixed bin, /* number of addresses given: 0,1,2 (IN) */ 10 2 checkpoint entry ( /* routine to update "safe" status (IN) */ 11 fixed bin(21), /* amount of input used up */ 12 fixed bin(21)), /* amount of output used up */ 13 14 2 inp, /***** input string parameters */ 15 /* The input data may NOT be modified. */ 16 3 pt ptr, /* pointer to base of data string (IN) */ 17 3 sb fixed bin(21), /* index of addressed string begin (IN) */ 18 3 lno fixed bin(21), /* linenumber in data string of sb (IN) */ 19 3 se fixed bin(21), /* index of addressed string end (IN/OUT) */ 20 3 de fixed bin(21), /* index of data end (IN) */ 21 22 2 out, /***** output string parameters */ 23 3 pt ptr, /* pointer to base of output string (IN) */ 24 3 de fixed bin(21), /* index of data end (already copied) (IN/OUT) */ 25 3 ml fixed bin(21), /* max length of output string (IN) */ 26 27 2 req, /***** request string parameters */ 28 3 pt ptr, /* pointer to base of request string (IN) */ 29 3 cc fixed bin(21), /* index of current character (IN) */ 30 3 nc fixed bin(21), /* index of next character (IN/OUT) */ 31 3 de fixed bin(21), /* index of data end (IN/OUT) */ 32 3 ml fixed bin(21), /* max length of requsest buffer (IN) */ 33 34 /* req.nc is initialized to req.de, i.e. request line used-up. A routine */ 35 /* can set req.nc to 1, put some data into req and set req.de */ 36 /* appropriately. The data will be the next ted requests executed after */ 37 /* the routine returns. */ 38 39 /* Or if req.nc is set equal to req.cc then the rest of the request line */ 40 /* will be executed after return. */ 41 42 2 string_mode bit(1), /* 0- line mode, 1- string mode (IN) */ 43 2 current fixed bin(21), /* current location (IN/OUT) */ 44 /* current is initialized to "undefined" */ 45 2 get_req entry (), /* fill the request string with the next line */ 46 /* from ted's input stream. req.de will be */ 47 /* updated to reflect the new length. */ 48 /* req.cc and req.nc are not changed. */ 49 2 proc_expr entry /* process the expression for global execution */ 50 (ptr, /* -> ted_support structure [IN] */ 51 char (168) var, /* message text [OUT] */ 52 fixed bin (35)), /* completion code [OUT] */ 53 2 do_global entry /* globally execute some action */ 54 (entry (), /* worker procedure [IN] */ 55 char (1), /* which action, "g" or "v" [IN] */ 56 ptr, /* -> ted_support structure [IN] */ 57 char (168) var, /* message text [OUT] */ 58 fixed bin (35)), /* completion code [OUT] */ 59 2 reg_exp_p ptr, /* -> the remembered regular expression area */ 60 2 bcb_p ptr; /* -> buffer control block */ 61 /* _________________________________________________________________________ */ 62 /* ENTRY CONDITIONS */ 63 /* _________________________________________________________________________ */ 64 /* Upon entering, three substructures describe the environment in which the */ 65 /* request is to operate. (Refer to the INPUT diagram) Note that the */ 66 /* "normal" operational steps are: */ 67 /* 1) ted copies the string from 1:inp.sb-1 to the output string */ 68 /* 2) ted_xyz_ takes care of the data from inp.sb:inp.se */ 69 /* 3) ted copies the string from inp.se+1:inp.de to the output string */ 70 /* 4) ted sets "." as (possibly) specified by xyz */ 71 72 /* The following 3 diagrams represent conditions upon entering ted_xyz_: */ 73 /* _________________________________________________________________________ */ 74 /* req.pt (\ represents NL) */ 75 /* | */ 76 /* [REQUEST] x 2,3|req /farfle/ 1,$P\....................... */ 77 /* | | | */ 78 /* req.cc req.de req.ml */ 79 /* req.nc */ 80 /* _________________________________________________________________________ */ 81 /* inp.pt (\ represents NL) */ 82 /* | */ 83 /* [INPUT] now is\the time\for all\good men\to come.\..... */ 84 /* | | | */ 85 /* inp.sb inp.se inp.de */ 86 /* The request may make no modifications to the input string. It may make no */ 87 /* assumptions about its location, i.e. that it occupies a segment all by */ 88 /* itself. */ 89 /* _________________________________________________________________________ */ 90 /* out.pt (\ represents NL) */ 91 /* | */ 92 /* [OUTPUT] ? now is\........................................ */ 93 /* | | | */ 94 /* current out.de out.ml */ 95 /* _________________________________________________________________________ */ 96 97 /* _________________________________________________________________________ */ 98 /* EXIT CONDITIONS */ 99 /* _________________________________________________________________________ */ 100 /* Assume a request replaces each addressed line with the string following */ 101 /* it, (in this case "farfle") and leaves "." at the beginning of the range. */ 102 /* out.pt (\ represents NL) */ 103 /* | */ 104 /* [OUTPUT] now is\farfle\farfle\.......................... */ 105 /* | | | */ 106 /* current out.de out.ml */ 107 108 /* _________________________________________________________________________ */ 109 /* 1) If the data after the string are to be treated as more ted requests, */ 110 /* the request data would be left like this. */ 111 /* req.pt (\ represents NL) */ 112 /* | */ 113 /* [REQUEST] x 2,3|req /farfle/ 1,$P\....................... */ 114 /* | | | */ 115 /* req.nc req.de req.ml */ 116 /* _________________________________________________________________________ */ 117 /* 2) If the request is going to return a string to be executed, the request */ 118 /* data (and buffer) would be left like this: */ 119 /* req.pt (\ represents NL) */ 120 /* | */ 121 /* [REQUEST] -1,.1p w\ /farfle/ 1,$P\....................... */ 122 /* | | | */ 123 /* req.nc req.de req.ml */ 124 125 /* These are special return codes relating to ted: */ 126 dcl (tederror_table_$Copy_Set,/* copy rest of input to output, and set "." */ 127 /* from current. "rest of input" is the */ 128 /* string which begins at char inp.se+1 and */ 129 /* extends to inp.de. If the input has all */ 130 /* been processed, then inp.se should be set */ 131 /* to inp.de+1. */ 132 tederror_table_$NoChange,/* dont copy, dont set current */ 133 tederror_table_$Set, /* dont copy, set current (in input buffer) */ 134 tederror_table_$Error_Msg,/* msg is being returned. */ 135 /* no copy or set is done */ 136 tederror_table_$No_Delim1,/* missing 1st delimiter */ 137 tederror_table_$No_Delim2,/* missing 2nd delimiter */ 138 tederror_table_$No_Delim3)/* missing 3nd delimiter */ 139 fixed bin(35)ext static; 140 /* Any other codes returned must be standard system codes. */ 141 dcl error_table_$unimplemented_version fixed bin(35) ext static; 142 143 dcl istr char(inp.de) based(inp.pt); /* the input string */ 144 dcl ichr(inp.de) char(1) based(inp.pt); 145 dcl ostr char(out.ml) based(out.pt); /* the output string */ 146 dcl ochr(out.ml) char(1) based(out.pt); 147 dcl rstr char(req.ml) based(req.pt); /* the request string */ 148 dcl rchr(req.ml) char(1) based(req.pt); 149 150 /* These declarations are used if the expression search is needed by the */ 151 /* request. There are 2 parts to getting an expression search done: */ 152 /* 1) compiling 2) searching */ 153 /* If a function uses the remembered expression, it does this: */ 154 /* call tedsrch_$search (ted_support.reg_exp_p, */ 155 /* ted_support.bcbp, string_begin, string_end, match_begin, */ 156 /* match_end, search_end, msg, code); */ 157 158 /* If a function utilizes an expression the user supplies, it must first be */ 159 /* compiled: 160 /* if (expression_length > 0) */ 161 /* then call tedsrch_$compile (addr (ichr (expression_begin)), */ 162 /* expression_length, ted_support.reg_exp_p, */ 163 /* ted_support.string_mode, ""b, msg, code); */ 164 /* This results in the remembered expression being changed to the one just */ 165 /* compiled. */ 166 167 /* If a function wishes to utilize a function without it being remembered */ 168 /* by ted, it may declare an area of its own and compile into it. It first */ 169 /* must be initialized: */ 170 /* dcl expr_area (200) bit (36); */ 171 /* call tedsrch_$init_exp (addr (expr_area), size (expr_area)); */ 172 %include tedsrch_; 173 174 /* END INCLUDE FILE ..... ted_support.incl.pl1 ..... */