676 #define YY_INPUT(buf, result, max_size) (result = new_yy_input(buf, max_size)) |
676 #define YY_INPUT(buf, result, max_size) (result = new_yy_input(buf, max_size)) |
677 |
677 |
678 int new_yy_input(char *buf, int max_size) |
678 int new_yy_input(char *buf, int max_size) |
679 { |
679 { |
680 int result; |
680 int result; |
681 result = fread(buf, 1, max_size, yyin); |
681 if(yyin != NULL) { |
|
682 result = fread(buf, 1, max_size, yyin); |
|
683 } |
|
684 else if((pG->StdInBuffer != NULL) && (pG->StdInBufLength > 0)) { |
|
685 int left = pG->StdInBufLength - pG->StdInfBufPos ; |
|
686 if(left == 0) |
|
687 return YY_NULL ; |
|
688 result = (max_size < left) ? max_size : left ; |
|
689 memcpy(buf,&(pG->StdInBuffer[pG->StdInfBufPos]),result); |
|
690 pG->StdInfBufPos += result ; |
|
691 } |
|
692 |
682 if (result == 0) |
693 if (result == 0) |
683 return YY_NULL; |
694 return YY_NULL; |
684 |
695 const unsigned char BOM[] = {0xef , 0xbb, 0xbf, 0x0 }; |
685 // check for utf8 (BOM) header in buf |
696 // check for utf8 (BOM) header in buf |
686 for (int i = 0; i < result-3; i++) |
697 for (int i = 0; i < result-3; i++) { |
687 { |
698 if (0 == memcmp(&buf[i],BOM,3)) { |
688 if (buf[i] == 0xffffffef && buf[i+1] == 0xffffffbb && buf[i+2] == 0xffffffbf) |
699 memset(&buf[i],0x20,3); |
689 { |
|
690 buf[i] = ' '; |
|
691 buf[i+1] = ' '; |
|
692 buf[i+2] = ' '; |
|
693 } |
700 } |
694 } |
701 } |
695 return result; |
702 return result; |
696 } |
703 } |
697 |
704 |
698 #include "rcomp.hpp" |
705 #include "rcomp.hpp" |
699 #include "fileline.h" |
706 #include "FILELINE.H" |
700 |
707 |
701 #define VALUE_LEN (1024*8) // must match sizeof(YYSTYPE.Value) |
708 #define VALUE_LEN (1024*8) // must match sizeof(YYSTYPE.Value) |
702 char buf[VALUE_LEN]; |
709 char buf[VALUE_LEN]; |
703 char * pCh; |
710 char * pCh; |
704 #define CHECK_APPEND(x) \ |
711 #define CHECK_APPEND(x) \ |
708 |
715 |
709 extern String InputBaseName; |
716 extern String InputBaseName; |
710 extern FileLineManager* pFileLineHandler; |
717 extern FileLineManager* pFileLineHandler; |
711 extern int* pCurrentLineNumber; |
718 extern int* pCurrentLineNumber; |
712 char RealLineNumber[200]; |
719 char RealLineNumber[200]; |
713 // |
720 |
714 // Disable MSVC warnings |
721 |
715 // |
722 #include "ERRORHAN.H" |
716 #ifdef __VC32__ |
|
717 #if 0 |
|
718 ..\src\RCOMP.L(95) : warning C4127: conditional expression is constant |
|
719 ..\src\RCOMP.L(114) : warning C4244: 'initializing' : conversion from 'const int' to 'YY_CHAR', possible loss of data |
|
720 ..\src\RCOMP.L(119) : warning C4244: '=' : conversion from 'const int' to 'YY_CHAR', possible loss of data |
|
721 ..\src\RCOMP.L(130) : warning C4102: 'find_rule' : unreferenced label |
|
722 ..\src\RCOMP.L(513) : warning C4244: 'initializing' : conversion from 'int' to 'YY_CHAR', possible loss of data |
|
723 ..\src\RCOMP.L(518) : warning C4244: '=' : conversion from 'const int' to 'YY_CHAR', possible loss of data |
|
724 ..\src\RCOMP.L(548) : warning C4244: '=' : conversion from 'const int' to 'YY_CHAR', possible loss of data |
|
725 ..\src\RCOMP.L(63) : warning C4505: 'yyunput' : unreferenced local function has been removed |
|
726 \epoc32\BUILD\generatedcpp\rcomp\rcompl.cpp(243) : warning C4505: 'yy_flex_realloc' : unreferenced local function has been removed |
|
727 #endif |
|
728 |
|
729 #pragma warning( disable : 4100 ) |
|
730 #pragma warning( disable : 4102 ) |
|
731 #pragma warning( disable : 4127 ) |
|
732 #pragma warning( disable : 4244 ) |
|
733 #pragma warning( disable : 4245 ) |
|
734 #pragma warning( disable : 4505 ) |
|
735 #endif //__VC32__ |
|
736 |
|
737 #include "errorhan.h" |
|
738 |
723 |
739 #define REGISTER_LINE ErrorHandler::Register(pFileLineHandler->GetCurrentFile(), pFileLineHandler->GetErrorLine(* pCurrentLineNumber)) |
724 #define REGISTER_LINE ErrorHandler::Register(pFileLineHandler->GetCurrentFile(), pFileLineHandler->GetErrorLine(* pCurrentLineNumber)) |
740 |
725 |
741 |
726 |
742 #define string_rules 1 |
727 #define string_rules 1 |
841 |
826 |
842 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
827 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
843 * is returned in "result". |
828 * is returned in "result". |
844 */ |
829 */ |
845 #ifndef YY_INPUT |
830 #ifndef YY_INPUT |
|
831 #error "Unexpected behavior!" |
846 #define YY_INPUT(buf,result,max_size) \ |
832 #define YY_INPUT(buf,result,max_size) \ |
847 if ( yy_current_buffer->yy_is_interactive ) \ |
833 if ( yy_current_buffer->yy_is_interactive ) \ |
848 { \ |
834 { \ |
849 int c = '*', n; \ |
835 int c = '*', n; \ |
850 for ( n = 0; n < max_size && \ |
836 for ( n = 0; n < max_size && \ |