Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
73b92d10
Commit
73b92d10
authored
Mar 21, 2002
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added typedef patches and a new option '-c' to automatically create C typedefs from SQL ones.
parent
a13ddd36
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
35 deletions
+123
-35
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+6
-0
src/interfaces/ecpg/preproc/c_keywords.c
src/interfaces/ecpg/preproc/c_keywords.c
+1
-0
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/ecpg.c
+13
-7
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/extern.h
+1
-0
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+101
-26
src/interfaces/ecpg/test/test3.pgc
src/interfaces/ecpg/test/test3.pgc
+1
-2
No files found.
src/interfaces/ecpg/ChangeLog
View file @
73b92d10
...
...
@@ -1225,6 +1225,12 @@ Wed Mar 6 10:40:28 CET 2002
Sun Mar 10 13:08:22 CET 2002
- Fixed two bugs in define command in lexer.
Thu Mar 21 08:25:08 CET 2002
- Applied patch by Nicolas Bazin <nbazin@ingenico.com.au> for improved
typedef handling.
- Added option '-c' to automatically create C typedef from SQL one.
- Set ecpg version to 2.10.0.
- Set library version to 3.4.0.
src/interfaces/ecpg/preproc/c_keywords.c
View file @
73b92d10
...
...
@@ -36,6 +36,7 @@ static ScanKeyword ScanKeywords[] = {
{
"signed"
,
SQL_SIGNED
},
{
"static"
,
S_STATIC
},
{
"struct"
,
SQL_STRUCT
},
{
"typedef"
,
S_TYPEDEF
},
{
"union"
,
UNION
},
{
"unsigned"
,
SQL_UNSIGNED
},
{
"varchar"
,
VARCHAR
},
...
...
src/interfaces/ecpg/preproc/ecpg.c
View file @
73b92d10
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.5
3 2002/01/10 10:42:54
meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.5
4 2002/03/21 09:42:50
meskes Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
...
...
@@ -17,7 +17,8 @@ extern char *optarg;
#include "extern.h"
int
ret_value
=
0
,
autocommit
=
0
;
autocommit
=
false
;
auto_create_c
=
false
;
struct
_include_path
*
include_paths
=
NULL
;
struct
cursor
*
cur
=
NULL
;
struct
typedefs
*
types
=
NULL
;
...
...
@@ -31,11 +32,11 @@ help(const char *progname)
/* printf is a macro some places; don't #ifdef inside its arguments */
#ifdef YYDEBUG
printf
(
"Usage:
\n
"
" %s [-d] [-I DIRECTORY] [-o OUTFILE] [-t] file1 [file2...]
\n\n
"
,
" %s [-d] [-I DIRECTORY] [-o OUTFILE] [-t]
[-c] [-D symbol]
file1 [file2...]
\n\n
"
,
progname
);
#else
printf
(
"Usage:
\n
"
" %s [-I DIRECTORY] [-o OUTFILE] [-t] file1 [file2...]
\n\n
"
,
" %s [-I DIRECTORY] [-o OUTFILE] [-t]
[-c] [-D symbol]
file1 [file2...]
\n\n
"
,
progname
);
#endif
printf
(
"Options:
\n
"
);
...
...
@@ -45,6 +46,8 @@ help(const char *progname)
printf
(
" -I DIRECTORY search DIRECTORY for include files
\n
"
);
printf
(
" -o OUTFILE write result to OUTFILE
\n
"
);
printf
(
" -t turn on autocommit of transactions
\n
"
);
printf
(
" -c automatically generate C code from embedded SQL code
\n
currently this works for EXEC SQL TYPE
\n
"
);
printf
(
" -D symbol define symbo
\n
"
);
printf
(
"
\n
If no output file is specified, the name is formed by adding .c
\n
"
"to the input file name, after stripping off .pgc if present.
\n
"
);
printf
(
"
\n
Report bugs to <pgsql-bugs@postgresql.org>.
\n
"
);
...
...
@@ -58,6 +61,7 @@ add_include_path(char *path)
include_paths
=
mm_alloc
(
sizeof
(
struct
_include_path
));
include_paths
->
path
=
path
;
include_paths
->
next
=
ip
;
}
static
void
...
...
@@ -107,7 +111,7 @@ main(int argc, char *const argv[])
add_include_path
(
"/usr/local/include"
);
add_include_path
(
"."
);
while
((
c
=
getopt
(
argc
,
argv
,
"vo:I:tD:d"
))
!=
-
1
)
while
((
c
=
getopt
(
argc
,
argv
,
"v
c
o:I:tD:d"
))
!=
-
1
)
{
switch
(
c
)
{
...
...
@@ -122,13 +126,15 @@ main(int argc, char *const argv[])
add_include_path
(
optarg
);
break
;
case
't'
:
autocommit
=
1
;
autocommit
=
true
;
break
;
case
'v'
:
verbose
=
true
;
break
;
case
'c'
:
auto_create_c
=
true
;
break
;
case
'D'
:
/* XXX not documented */
add_preprocessor_define
(
optarg
);
break
;
case
'd'
:
...
...
src/interfaces/ecpg/preproc/extern.h
View file @
73b92d10
...
...
@@ -11,6 +11,7 @@
extern
int
braces_open
,
autocommit
,
auto_create_c
,
ret_value
,
struct_level
;
extern
char
*
descriptor_index
;
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
73b92d10
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/test/test3.pgc
View file @
73b92d10
...
...
@@ -11,9 +11,8 @@ exec sql type str is varchar[10];
int
main ()
{
typedef struct { long born; short age; } birthinfo;
exec sql type birthinfo is struct { long born; short age; };
exec sql begin declare section;
typedef struct { long born; short age; } birthinfo;
struct personal_struct { str name;
birthinfo birth;
} personal;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment