another ecpg patch
Started by Michael Meskesalmost 27 years ago1 messages
Note this one contains the one I send the other day. If that one was already
applied this one will fail partly. If this is the case tell me and I resend
a correct version.
Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net | Use PostgreSQL!
Attachments:
ecpg.patchtext/plain; charset=us-asciiDownload
diff -rcN ecpg/ChangeLog ecpg.mm/ChangeLog
*** ecpg/ChangeLog Fri Jan 22 07:29:43 1999
--- ecpg.mm/ChangeLog Fri Jan 29 13:21:56 1999
***************
*** 383,385 ****
--- 383,397 ----
- Set library version to 2.6.3
- Added 'exec sql whenever sqlwarning'.
- Set ecpg version to 2.4.6
+
+ Wed Jan 27 12:42:22 CET 1999
+
+ - Fixed bug that caused ecpg to lose 'goto' information.
+ - Set ecpg version to 2.4.7
+
+ Fri Jan 29 18:03:52 CET 1999
+
+ - Fixed bug that caused 'enum' to be rejected in pure C code.
+ - Fixed bug that caused function names to be translated to lower case.
+ - Set ecpg version to 2.4.8
+
diff -rcN ecpg/preproc/Makefile ecpg.mm/preproc/Makefile
*** ecpg/preproc/Makefile Tue Jan 19 07:21:04 1999
--- ecpg.mm/preproc/Makefile Fri Jan 29 13:05:04 1999
***************
*** 3,9 ****
MAJOR_VERSION=2
MINOR_VERSION=4
! PATCHLEVEL=6
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
--- 3,9 ----
MAJOR_VERSION=2
MINOR_VERSION=4
! PATCHLEVEL=8
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
diff -rcN ecpg/preproc/pgc.l ecpg.mm/preproc/pgc.l
*** ecpg/preproc/pgc.l Sat Oct 3 07:47:12 1998
--- ecpg.mm/preproc/pgc.l Fri Jan 29 13:20:52 1999
***************
*** 333,354 ****
<SQL>{identifier}/{space}*-{number} {
int i;
ScanKeyword *keyword;
BEGIN(xm);
! for(i = 0; yytext[i]; i++)
! if (isascii((unsigned char)yytext[i]) && isupper(yytext[i]))
! yytext[i] = tolower(yytext[i]);
! if (i >= NAMEDATALEN)
! yytext[NAMEDATALEN-1] = '\0';
!
! keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
return keyword->value;
}
else
{
! keyword = ScanECPGKeywordLookup((char*)yytext);
if (keyword != NULL) {
return keyword->value;
}
--- 333,355 ----
<SQL>{identifier}/{space}*-{number} {
int i;
ScanKeyword *keyword;
+ char lower_text[NAMEDATALEN];
BEGIN(xm);
! /* this should leave the last byte set to '\0' */
! strncpy(lower_text, yytext, NAMEDATALEN-1);
! for(i = 0; lower_text[i]; i++)
! if (isascii((unsigned char)lower_text[i]) && isupper(lower_text[i]))
! lower_text[i] = tolower(lower_text[i]);
! printf("yyt= %s, lt = %s\n", yytext, lower_text);
! keyword = ScanKeywordLookup((char*)lower_text);
if (keyword != NULL) {
return keyword->value;
}
else
{
! keyword = ScanECPGKeywordLookup((char*)lower_text);
if (keyword != NULL) {
return keyword->value;
}
***************
*** 475,495 ****
<SQL>{identifier} {
int i;
ScanKeyword *keyword;
! for(i = 0; yytext[i]; i++)
! if (isascii((unsigned char)yytext[i]) && isupper(yytext[i]))
! yytext[i] = tolower(yytext[i]);
!
! if (i >= NAMEDATALEN)
! yytext[NAMEDATALEN-1] = '\0';
! keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
return keyword->value;
}
else
{
! keyword = ScanECPGKeywordLookup((char*)yytext);
if (keyword != NULL) {
return keyword->value;
}
--- 476,497 ----
<SQL>{identifier} {
int i;
ScanKeyword *keyword;
+ char lower_text[NAMEDATALEN];
! /* this should leave the last byte set to '\0' */
! strncpy(lower_text, yytext, NAMEDATALEN-1);
! for(i = 0; lower_text[i]; i++)
! if (isascii((unsigned char)lower_text[i]) && isupper(lower_text[i]))
! lower_text[i] = tolower(lower_text[i]);
! printf("yyt= %s, lt = %s\n", yytext, lower_text);
! keyword = ScanKeywordLookup((char*)lower_text);
if (keyword != NULL) {
return keyword->value;
}
else
{
! keyword = ScanECPGKeywordLookup((char*)lower_text);
if (keyword != NULL) {
return keyword->value;
}
diff -rcN ecpg/preproc/preproc.y ecpg.mm/preproc/preproc.y
*** ecpg/preproc/preproc.y Fri Jan 22 07:29:47 1999
--- ecpg.mm/preproc/preproc.y Fri Jan 29 13:03:09 1999
***************
*** 521,527 ****
/* special embedded SQL token */
%token SQL_BREAK SQL_CALL SQL_CONNECT SQL_CONNECTION SQL_CONTINUE
%token SQL_DISCONNECT SQL_FOUND SQL_GO SQL_GOTO
! %token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_OPEN SQL_RELEASE
%token SQL_SECTION SQL_SEMI SQL_SQLERROR SQL_SQLPRINT SQL_START
%token SQL_STOP SQL_WHENEVER SQL_SQLWARNING
--- 521,528 ----
/* special embedded SQL token */
%token SQL_BREAK SQL_CALL SQL_CONNECT SQL_CONNECTION SQL_CONTINUE
%token SQL_DISCONNECT SQL_FOUND SQL_GO SQL_GOTO
! %token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_OPEN
! %token SQL_PREPARE SQL_RELEASE
%token SQL_SECTION SQL_SEMI SQL_SQLERROR SQL_SQLPRINT SQL_START
%token SQL_STOP SQL_WHENEVER SQL_SQLWARNING
***************
*** 813,818 ****
--- 814,822 ----
output_line_number();
free($1);
}
+ | ECPGPrepare {
+ yyerror("PREPARE is not supported yet.");
+ }
/*
* We start with a lot of stuff that's very similar to the backend's parsing
***************
*** 4671,4682 ****
}
| SQL_GOTO name {
$<action>$.code = W_GOTO;
! $<action>$.command = $2;
$<action>$.str = cat2_str(make1_str("goto "), $2);
}
| SQL_GO TO name {
$<action>$.code = W_GOTO;
! $<action>$.command = $3;
$<action>$.str = cat2_str(make1_str("goto "), $3);
}
| DO name '(' dotext ')' {
--- 4675,4686 ----
}
| SQL_GOTO name {
$<action>$.code = W_GOTO;
! $<action>$.command = strdup($2);
$<action>$.str = cat2_str(make1_str("goto "), $2);
}
| SQL_GO TO name {
$<action>$.code = W_GOTO;
! $<action>$.command = strdup($3);
$<action>$.str = cat2_str(make1_str("goto "), $3);
}
| DO name '(' dotext ')' {
***************
*** 4695,4702 ****
$<action>$.str = cat2_str(make1_str("call"), mm_strdup($<action>$.command));
}
! /* some other stuff for ecpg */
ecpg_expr: attr opt_indirection
{
$$ = cat2_str($1, $2);
--- 4699,4713 ----
$<action>$.str = cat2_str(make1_str("call"), mm_strdup($<action>$.command));
}
! /*
! * As long as the prepare statement in not supported by the backend, we will
! * try to simulate it here so we get dynamic SQL
! */
! ECPGPrepare: SQL_PREPARE name FROM name
! {
! }
+ /* some other stuff for ecpg */
ecpg_expr: attr opt_indirection
{
$$ = cat2_str($1, $2);
***************
*** 5032,5037 ****
--- 5043,5049 ----
| S_CHAR { $$ = make1_str("char"); }
| S_CONST { $$ = make1_str("const"); }
| S_DOUBLE { $$ = make1_str("double"); }
+ | S_ENUM { $$ = make1_str("enum"); }
| S_EXTERN { $$ = make1_str("extern"); }
| S_FLOAT { $$ = make1_str("float"); }
| S_INT { $$ = make1_str("int"); }
diff -rcN ecpg/test/header_test.h ecpg.mm/test/header_test.h
*** ecpg/test/header_test.h Fri Jan 22 07:29:47 1999
--- ecpg.mm/test/header_test.h Fri Jan 29 12:59:38 1999
***************
*** 1,9 ****
exec sql include sqlca;
! exec sql whenever sqlerror do print_and_stop();
exec sql whenever sqlwarning do warn();
! void print_and_stop(void)
{
sqlprint();
exit(-1);
--- 1,9 ----
exec sql include sqlca;
! exec sql whenever sqlerror do PrintAndStop();
exec sql whenever sqlwarning do warn();
! void PrintAndStop(void)
{
sqlprint();
exit(-1);