nrform (4135B)
1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License, Version 1.0 only 6 # (the "License"). You may not use this file except in compliance 7 # with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 # 23 # Copyright (c) 1993 by Sun Microsystems, Inc. 24 # 25 26 # from OpenSolaris "nrform 6.7 05/06/08 SMI" 27 28 # 29 # Portions Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany 30 # 31 # Sccsid @(#)nrform 1.4 (gritter) 10/20/06 32 # 33 34 block data 35 integer cshift, csize, yynlin 36 common /yyllib/ cshift, csize, yynlin 37 data yynlin/YYNEWLINE/ 38 end 39 block data 40 common /yyldat/ yyfnd, ymorf, yyprev, yybgin, yytop 41 integer yyfnd, yymorf, yyprev, yybgin, yytop 42 data yybgin/1/ 43 data yyprev/YYNEWLINE/ 44 data yytop/YYTOPVAL/ 45 end 46 integer function yylook(dummy) 47 common /Lverif/ verif 48 common /Ladvan/ advan 49 common /Lstoff/ stoff 50 common /Lsfall/ sfall 51 common /Latable/ atable 52 common /Lextra/ extra 53 common /Lvstop/ vstop 54 integer verif(Sverif), advan(Sadvan),stoff(Sstoff),match(Smatch) 55 integer sfall(Ssfall),atable(Satable),extra(Sextra), vstop(Svstop) 56 integer state, lsp, r 57 integer ch, n 58 common /yyldat/ yyfnd, yymorf, yyprev, yybgin, yytop, yylsp, yylsta(YYLMAX) 59 common /yyxel/ yyleng, yytext 60 integer yyfnd, yymorf, yylsta, yylsp, yytext, yyprev, yyleng, yytop 61 integer lexshf, yytext(YYLMAX), yyback, yybgin 62 integer z, t 63 if (yymorf .eq. 0) 64 yyleng = 0 65 else 66 yymorf=0 67 1776 68 lsp = 1 69 state = yybgin 70 if (yyprev .eq. YYNEWLINE) 71 state = state + 1 72 for (;;){ 73 r = stoff(state) 74 if (r .eq. 0){ 75 z = sfall(state) 76 if (z .eq. 0) 77 break 78 if(stoff(z) == 0) break 79 } 80 ch = input(dummy) 81 ich = lexshf(ch) 82 yyleng = yyleng+1 83 yytext(yyleng) = ch 84 1984 85 if(r .gt. 0){ 86 t = r + ich 87 if (t<= yytop){ 88 if (verif(t) .eq. state){ 89 if(advan(t) == YYERROR){ 90 call unput(yytext(yyleng)) 91 yyleng = yyleng - 1 92 break 93 } 94 state = advan(t) 95 yylsta(lsp) = state 96 lsp = lsp +1 97 goto 2001 98 } 99 } 100 } 101 if(r < 0){ 102 t = r + ich 103 if (t <= yytop .and. verif(t) .eq. state){ 104 if(advan(t) == YYERROR){ 105 call unput(yytext(yyleng)) 106 yyleng = yyleng - 1 107 break 108 } 109 state = advan(t) 110 yylsta(lsp) = state 111 lsp = lsp +1 112 goto 2001 113 } 114 t = r + match(ich) 115 if(t <= yytop && state == verif(t)){ 116 if(advan(t) == YYERROR){ 117 call unput(yytext(yyleng)) 118 yyleng = yyleng - 1 119 break 120 } 121 state = advan(t) 122 yylsta(lsp) = state 123 lsp = lsp + 1 124 goto 2001 125 } 126 } 127 else { 128 if (state > 0) state = sfall(state) 129 if (state .gt. 0) r = stoff(state) 130 if (state .gt. 0 .and. r .ne. 0) 131 goto 1984 132 call unput(yytext(yyleng)) 133 yyleng = yyleng -1 134 break 135 } 136 2001 137 continue 138 } 139 while (lsp .gt. 1){ 140 lsp = lsp -1 141 ilsp = yylsta(lsp) 142 yyfnd = atable(ilsp) 143 if (yyfnd .gt. 0) 144 if (vstop(yyfnd) .gt. 0){ 145 r = vstop(yyfnd) 146 if (extra(r) .ne. 0){ 147 for(;;){ 148 ilsp = yylsta(lsp) 149 if (yyback(atable(ilsp), -r) .eq. 1) 150 break 151 lsp= lsp -1 152 call unput(yytext(yyleng)) 153 yyleng = yyleng -1 154 } 155 } 156 yyprev = lexshf(yytext(yyleng)) 157 yylsp = lsp 158 yyfnd = yyfnd + 1 159 yylook = r 160 yytext(yyleng+1) = 0 161 return 162 } 163 call unput(yytext(yyleng)) 164 } 165 if (yytext(1) .eq. 0){ 166 yylook=0 167 return 168 } 169 yyprev = input(dummy) 170 call output(yyprev) 171 yyprev = lexshf(yyprev) 172 yyleng = 0 173 goto 1776 174 end 175 integer function yyback (isub, n) 176 common /Lvstop/ vstop 177 integer vstop(Svstop) 178 if (isub .ne. 0) 179 while (vstop(isub) .ne. 0){ 180 if (vstop(isub) .eq. m){ 181 yyback = 1 182 return 183 } 184 isub = isub + 1 185 } 186 yyback = 0 187 return 188 end