summaryrefslogtreecommitdiff
path: root/library/backend/vcc.y
authorzecke <zecke>2002-09-10 12:09:49 (UTC)
committer zecke <zecke>2002-09-10 12:09:49 (UTC)
commit6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4 (patch) (unidiff)
tree6ebc93c6432f4ed9d00ef1448b6a047ef522a79a /library/backend/vcc.y
parentd10cddb3c9ce75bc90b14add14bc133737fe35aa (diff)
downloadopie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.zip
opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.gz
opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.bz2
Qtopia1-6 merge
still to test bic changes to be resolved more changes to be made?
Diffstat (limited to 'library/backend/vcc.y') (more/less context) (show whitespace changes)
-rw-r--r--library/backend/vcc.y103
1 files changed, 56 insertions, 47 deletions
diff --git a/library/backend/vcc.y b/library/backend/vcc.y
index e326a64..5bcf0cb 100644
--- a/library/backend/vcc.y
+++ b/library/backend/vcc.y
@@ -514,13 +514,13 @@ static int lexWithinMode(enum LexMode mode) {
514 unsigned long i; 514 unsigned long i;
515 for (i=0;i<lexBuf.lexModeStackTop;i++) 515 for (i=0;i<lexBuf.lexModeStackTop;i++)
516 if (mode == lexBuf.lexModeStack[i]) return 1; 516 if (mode == lexBuf.lexModeStack[i]) return 1;
517 return 0; 517 return 0;
518 } 518 }
519 519
520static char lexGetc_() 520static int lexGetc_()
521 { 521 {
522 /* get next char from input, no buffering. */ 522 /* get next char from input, no buffering. */
523 if (lexBuf.curPos == lexBuf.inputLen) 523 if (lexBuf.curPos == lexBuf.inputLen)
524 return EOF; 524 return EOF;
525 else if (lexBuf.inputString) 525 else if (lexBuf.inputString)
526 return *(lexBuf.inputString + lexBuf.curPos++); 526 return *(lexBuf.inputString + lexBuf.curPos++);
@@ -928,66 +928,75 @@ static int match_begin_end_name(int end) {
928 } 928 }
929 return 0; 929 return 0;
930 } 930 }
931 931
932static char* lexGetQuotedPrintable() 932static char* lexGetQuotedPrintable()
933 { 933 {
934 char cur; 934 int c;
935 935 lexSkipWhite();
936 c = lexLookahead();
936 lexClearToken(); 937 lexClearToken();
937 do { 938
938 cur = lexGetc(); 939 while (c != EOF && c != ';') {
939 switch (cur) { 940 if (c == '\n') {
940 case '=': { 941 // break, leave '\n' on remaining chars.
941 int c = 0;
942 int next[2];
943 int i;
944 for (i = 0; i < 2; i++) {
945 next[i] = lexGetc();
946 if (next[i] >= '0' && next[i] <= '9')
947 c = c * 16 + next[i] - '0';
948 else if (next[i] >= 'A' && next[i] <= 'F')
949 c = c * 16 + next[i] - 'A' + 10;
950 else
951 break; 942 break;
943 } else if (c == '=') {
944 int cur = 0;
945 int next;
946
947 lexSkipLookahead(); // skip '='
948 next = lexLookahead();
949
950 if (next == '\n') {
951 // skip and only skip the \n
952 lexSkipLookahead();
953 c = lexLookahead();
954 ++mime_lineNum; // aid in error reporting
955 continue;
956 } else if (next >= '0' && next <= '9') {
957 cur = next - '0';
958 } else if (next >= 'A' && next <= 'F') {
959 cur = next - 'A' + 10;
960 } else {
961 // we have been sent buggy stuff. doesn't matter
962 // what we do so long as we keep going.
963 // should probably spit an error here
964 c = lexLookahead();
965 continue;
952 } 966 }
953 if (i == 0) { 967
954 /* single '=' follow by LINESEP is continuation sign? */ 968 lexSkipLookahead(); // skip A-Z0-9
955 if (next[0] == '\n') { 969 next = lexLookahead();
956 ++mime_lineNum; 970
957 } 971 cur = cur * 16;
958 else { 972 // this time really just expecting 0-9A-F
959 lexPushLookaheadc('='); 973 if (next >= '0' && next <= '9') {
960 goto EndString; 974 cur += next - '0';
961 } 975 } else if (next >= 'A' && next <= 'F') {
976 cur += next - 'A' + 10;
977 } else {
978 // we have been sent buggy stuff. doesn't matter
979 // what we do so long as we keep going.
980 // should probably spit an error here
981 c = lexLookahead();
982 continue;
962 } 983 }
963 else if (i == 1) { 984
964 lexPushLookaheadc(next[1]); 985 // got a valid escaped =. append it.
965 lexPushLookaheadc(next[0]); 986 lexSkipLookahead(); // skip second 0-9A-F
966 lexAppendc('='); 987 lexAppendc(cur);
967 } else { 988 } else {
968 lexAppendc(c); 989 lexSkipLookahead(); // skip whatever we just read.
990 lexAppendc(c); // and append it.
969 } 991 }
970 break; 992 c = lexLookahead();
971 } /* '=' */
972 case '\n': {
973 lexPushLookaheadc('\n');
974 goto EndString;
975 } 993 }
976 case (char)EOF:
977 break;
978 default:
979 lexAppendc(cur);
980 break;
981 } /* switch */
982 } while (cur != (char)EOF);
983
984EndString:
985 lexAppendc(0); 994 lexAppendc(0);
986 return lexStr(); 995 return c==EOF?0:lexStr();
987 } /* LexQuotedPrintable */ 996}
988 997
989static int yylex() { 998static int yylex() {
990 999
991 int lexmode = LEXMODE(); 1000 int lexmode = LEXMODE();
992 if (lexmode == L_VALUES) { 1001 if (lexmode == L_VALUES) {
993 int c = lexGetc(); 1002 int c = lexGetc();