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
eee22892
Commit
eee22892
authored
Mar 12, 2007
by
Magnus Hagander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a run with perltidy to format the code. Per request from Andrew Dunstan.
parent
576027bb
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1376 additions
and
1089 deletions
+1376
-1089
src/tools/msvc/Project.pm
src/tools/msvc/Project.pm
+417
-326
src/tools/msvc/README
src/tools/msvc/README
+8
-0
src/tools/msvc/Solution.pm
src/tools/msvc/Solution.pm
+303
-245
src/tools/msvc/config.pl
src/tools/msvc/config.pl
+14
-14
src/tools/msvc/genbki.pl
src/tools/msvc/genbki.pl
+164
-127
src/tools/msvc/gendef.pl
src/tools/msvc/gendef.pl
+36
-31
src/tools/msvc/install.pl
src/tools/msvc/install.pl
+157
-123
src/tools/msvc/mkvcbuild.pl
src/tools/msvc/mkvcbuild.pl
+277
-223
No files found.
src/tools/msvc/Project.pm
View file @
eee22892
This diff is collapsed.
Click to expand it.
src/tools/msvc/README
View file @
eee22892
...
...
@@ -63,3 +63,11 @@ Get from http://www.zlib.net
libxml2 and libxslt - required for XML support
Get from http://www.zlatkovic.com/pub/libxml or build from source from
http://xmlsoft.org. Note that libxml2 requires iconv.
Code indention
--------------
If the perl code is modified, use perltidy on it since pgindent won't
touch perl code. Use the following commandline:
perltidy -b -bl -nsfs -naws -l=100 *.pl *.pm
src/tools/msvc/Solution.pm
View file @
eee22892
This diff is collapsed.
Click to expand it.
src/tools/msvc/config.pl
View file @
eee22892
src/tools/msvc/genbki.pl
View file @
eee22892
...
...
@@ -11,7 +11,7 @@
#
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/tools/msvc/genbki.pl,v 1.
4 2007/02/19 14:05:42
mha Exp $
# $PostgreSQL: pgsql/src/tools/msvc/genbki.pl,v 1.
5 2007/03/12 19:10:50
mha Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -25,19 +25,23 @@ $version =~ /^(\d+\.\d+)/ || die "Bad format verison $version\n";
my
$majorversion
=
$1
;
my
$pgext
=
read_file
("
src/include/pg_config_manual.h
");
$pgext
=~
/^#define\s+NAMEDATALEN\s+(\d+)$/mg
||
die
"
Could not read NAMEDATALEN from pg_config_manual.h
\n
";
$pgext
=~
/^#define\s+NAMEDATALEN\s+(\d+)$/mg
||
die
"
Could not read NAMEDATALEN from pg_config_manual.h
\n
";
my
$namedatalen
=
$1
;
my
$pgauthid
=
read_file
("
src/include/catalog/pg_authid.h
");
$pgauthid
=~
/^#define\s+BOOTSTRAP_SUPERUSERID\s+(\d+)$/mg
||
die
"
Could not read BOOTSTRAUP_SUPERUSERID from pg_authid.h
\n
";
$pgauthid
=~
/^#define\s+BOOTSTRAP_SUPERUSERID\s+(\d+)$/mg
||
die
"
Could not read BOOTSTRAUP_SUPERUSERID from pg_authid.h
\n
";
my
$bootstrapsuperuserid
=
$1
;
my
$pgnamespace
=
read_file
("
src/include/catalog/pg_namespace.h
");
$pgnamespace
=~
/^#define\s+PG_CATALOG_NAMESPACE\s+(\d+)$/mg
||
die
"
Could not read PG_CATALOG_NAMESPACE from pg_namespace.h
\n
";
$pgnamespace
=~
/^#define\s+PG_CATALOG_NAMESPACE\s+(\d+)$/mg
||
die
"
Could not read PG_CATALOG_NAMESPACE from pg_namespace.h
\n
";
my
$pgcatalognamespace
=
$1
;
my
$indata
=
"";
while
(
my
$f
=
shift
)
{
while
(
my
$f
=
shift
)
{
$indata
.=
read_file
(
$f
);
$indata
.=
"
\n
";
}
...
...
@@ -73,31 +77,42 @@ my $nc = 0;
my
$inside
=
0
;
my
@attr
;
my
@types
;
foreach
my
$line
(
split
/\n/
,
$indata
)
{
if
(
$line
=~
/^DATA\((.*)\)$/m
)
{
foreach
my
$line
(
split
/\n/
,
$indata
)
{
if
(
$line
=~
/^DATA\((.*)\)$/m
)
{
my
$data
=
$1
;
my
@fields
=
split
/\s+/
,
$data
;
if
(
$#fields
>=
4
&&
$fields
[
0
]
eq
"
insert
"
&&
$fields
[
1
]
eq
"
OID
"
&&
$fields
[
2
]
eq
"
=
")
{
if
(
$#fields
>=
4
&&
$fields
[
0
]
eq
"
insert
"
&&
$fields
[
1
]
eq
"
OID
"
&&
$fields
[
2
]
eq
"
=
")
{
$oid
=
$fields
[
3
];
}
else
{
else
{
$oid
=
0
;
}
$data
=~
s/\s{2,}/ /g
;
$bki
.=
$data
.
"
\n
";
}
elsif
(
$line
=~
/^DESCR\("(.*)"\)$/m
){
if
(
$oid
!=
0
)
{
elsif
(
$line
=~
/^DESCR\("(.*)"\)$/m
)
{
if
(
$oid
!=
0
)
{
$desc
.=
sprintf
("
%d
\t
%s
\t
0
\t
%s
\n
",
$oid
,
$catalog
,
$1
);
}
}
elsif
(
$line
=~
/^SHDESCR\("(.*)"\)$/m
)
{
if
(
$oid
!=
0
)
{
elsif
(
$line
=~
/^SHDESCR\("(.*)"\)$/m
)
{
if
(
$oid
!=
0
)
{
$shdesc
.=
sprintf
("
%d
\t
%s
\t
%s
\n
",
$oid
,
$catalog
,
$1
);
}
}
elsif
(
$line
=~
/^DECLARE_(UNIQUE_)?INDEX\((.*)\)$/m
)
{
if
(
$reln_open
)
{
elsif
(
$line
=~
/^DECLARE_(UNIQUE_)?INDEX\((.*)\)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
...
...
@@ -106,19 +121,24 @@ foreach my $line (split /\n/, $indata) {
$fields
[
2
]
=~
s/\s{2,}/ /g
;
$bki
.=
"
declare
$u
index
$fields
[0]
$fields
[1]
$fields
[2]
\n
";
}
elsif
(
$line
=~
/^DECLARE_TOAST\((.*)\)$/m
)
{
if
(
$reln_open
)
{
elsif
(
$line
=~
/^DECLARE_TOAST\((.*)\)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
my
@fields
=
split
/,/
,
$1
;
$bki
.=
"
declare toast
$fields
[1]
$fields
[2] on
$fields
[0]
\n
";
}
elsif
(
$line
=~
/^BUILD_INDICES/
)
{
elsif
(
$line
=~
/^BUILD_INDICES/
)
{
$bki
.=
"
build indices
\n
";
}
elsif
(
$line
=~
/^CATALOG\((.*)\)(.*)$/m
)
{
if
(
$reln_open
)
{
elsif
(
$line
=~
/^CATALOG\((.*)\)(.*)$/m
)
{
if
(
$reln_open
)
{
$bki
.=
"
close
$catalog
\n
";
$reln_open
=
0
;
}
...
...
@@ -127,29 +147,39 @@ foreach my $line (split /\n/, $indata) {
$catalog
=
$fields
[
0
];
$oid
=
$fields
[
1
];
$bootstrap
=
$shared_relation
=
$without_oids
=
"";
if
(
$rest
=~
/BKI_BOOTSTRAP/
)
{
if
(
$rest
=~
/BKI_BOOTSTRAP/
)
{
$bootstrap
=
"
bootstrap
";
}
if
(
$rest
=~
/BKI_SHARED_RELATION/
)
{
if
(
$rest
=~
/BKI_SHARED_RELATION/
)
{
$shared_relation
=
"
shared_relation
";
}
if
(
$rest
=~
/BKI_WITHOUT_OIDS/
)
{
if
(
$rest
=~
/BKI_WITHOUT_OIDS/
)
{
$without_oids
=
"
without_oids
";
}
$nc
++
;
$inside
=
1
;
next
;
}
if
(
$inside
==
1
)
{
if
(
$inside
==
1
)
{
next
if
(
$line
=~
/{/
);
if
(
$line
=~
/}/
)
{
# Last line
if
(
$line
=~
/}/
)
{
# Last line
$bki
.=
"
create
$bootstrap$shared_relation$without_oids$catalog
$oid
\n
(
\n
";
my
$first
=
1
;
for
(
my
$i
=
0
;
$i
<=
$#attr
;
$i
++
)
{
if
(
$first
==
1
)
{
for
(
my
$i
=
0
;
$i
<=
$#attr
;
$i
++
)
{
if
(
$first
==
1
)
{
$first
=
0
;
}
else
{
}
else
{
$bki
.=
"
,
\n
";
}
$bki
.=
"
"
.
$attr
[
$i
]
.
"
=
"
.
$types
[
$i
];
...
...
@@ -159,25 +189,30 @@ foreach my $line (split /\n/, $indata) {
undef
(
@types
);
$reln_open
=
1
;
$inside
=
0
;
if
(
$bootstrap
eq
"")
{
if
(
$bootstrap
eq
"")
{
$bki
.=
"
open
$catalog
\n
";
}
next
;
}
# inside catalog definition, so keep sucking up attributes
# inside catalog definition, so keep sucking up attributes
my
@fields
=
split
/\s+/
,
$line
;
if
(
$fields
[
1
]
=~
/(.*)\[.*\]/
)
{
#Array attribute
if
(
$fields
[
1
]
=~
/(.*)\[.*\]/
)
{
#Array attribute
push
@attr
,
$1
;
push
@types
,
$fields
[
0
]
.
'
[]
';
}
else
{
else
{
push
@attr
,
$fields
[
1
];
push
@types
,
$fields
[
0
];
}
next
;
}
}
if
(
$reln_open
==
1
)
{
if
(
$reln_open
==
1
)
{
$bki
.=
"
close
$catalog
\n
";
}
...
...
@@ -192,12 +227,14 @@ open(O,">$prefix.shdescription") || die "Could not write $prefix.shdescription\n
print
O
$shdesc
;
close
(
O
);
sub
Usage
{
sub
Usage
{
print
"
Usage: genbki.pl <version> <prefix> <input1> [<input2> <input3>...]
\n
";
exit
(
1
);
}
sub
read_file
{
sub
read_file
{
my
$filename
=
shift
;
my
$F
;
my
$t
=
$/
;
...
...
src/tools/msvc/gendef.pl
View file @
eee22892
...
...
@@ -3,21 +3,24 @@ my @def;
die
"
Usage: gendef.pl <modulepath>
\n
"
unless
(
$ARGV
[
0
]
=~
/\\([^\\]+$)/
);
my
$defname
=
uc
$1
;
if
(
-
f
"
$ARGV
[0]/
$defname
.def
")
{
if
(
-
f
"
$ARGV
[0]/
$defname
.def
")
{
print
"
Not re-generating
$defname
.DEF, file already exists.
\n
";
exit
(
0
);
}
print
"
Generating
$defname
.DEF from directory
$ARGV
[0]
\n
";
while
(
<
$ARGV
[
0
]
/*.
obj
>
)
{
while
(
<
$ARGV
[
0
]
/*.
obj
>
)
{
print
"
.
";
system
("
dumpbin /symbols /out:symbols.out
$_
>NUL
")
&&
die
"
Could not call dumpbin
";
open
(
F
,
"
<symbols.out
")
||
die
"
Could not open symbols.out for
$_
\n
";
while
(
<
F
>
)
{
while
(
<
F
>
)
{
s/\(\)//g
;
next
unless
/^\d/
;
my
@pieces
=
split
;
my
@pieces
=
split
;
next
unless
$pieces
[
6
];
next
if
(
$pieces
[
2
]
eq
"
UNDEF
");
next
unless
(
$pieces
[
4
]
eq
"
External
");
...
...
@@ -40,12 +43,14 @@ open(DEF,">$ARGV[0]/$defname.def") || die "Could not write to $defname\n";
print
DEF
"
EXPORTS
\n
";
my
$i
=
0
;
my
$last
=
"";
foreach
my
$f
(
sort
@def
)
{
foreach
my
$f
(
sort
@def
)
{
next
if
(
$f
eq
$last
);
$last
=
$f
;
$f
=~
s/^_//
;
$i
++
;
# print DEF " $f \@ $i\n"; # ordinaled exports?
# print DEF " $f \@ $i\n"; # ordinaled exports?
print
DEF
"
$f
\n
";
}
close
(
DEF
);
...
...
src/tools/msvc/install.pl
View file @
eee22892
...
...
@@ -10,56 +10,76 @@ my $target = shift || Usage();
chdir
("
../../..
")
if
(
-
f
"
../../../configure
");
my
$conf
=
"";
if
(
-
d
"
debug
")
{
if
(
-
d
"
debug
")
{
$conf
=
"
debug
";
}
if
(
-
d
"
release
")
{
if
(
-
d
"
release
")
{
$conf
=
"
release
";
}
die
"
Could not find debug or release binaries
"
if
(
$conf
eq
"");
print
"
Installing for
$conf
\n
";
EnsureDirectories
('
bin
','
lib
','
share
','
share/timezonesets
');
EnsureDirectories
('
bin
','
lib
','
share
','
share/timezonesets
');
CopySolutionOutput
(
$conf
,
$target
);
copy
(
$target
.
'
/lib/libpq.dll
',
$target
.
'
/bin/libpq.dll
');
CopySetOfFiles
('
config files
',
"
*.sample
",
$target
.
'
/share/
');
CopySetOfFiles
('
timezone names
',
'
src
\
timezone
\
tznames
\
*.txt
',
$target
.
'
/share/timezonesets/
');
CopyFiles
('
timezone sets
',
$target
.
'
/share/timezonesets/
',
'
src/timezone/tznames/
',
'
Default
','
Australia
','
India
');
CopyFiles
(
'
timezone sets
',
$target
.
'
/share/timezonesets/
',
'
src/timezone/tznames/
',
'
Default
','
Australia
','
India
'
);
CopySetOfFiles
('
BKI files
',
"
src
\\
backend
\\
catalog
\\
postgres.*
",
$target
.
'
/share/
');
CopySetOfFiles
('
SQL files
',
"
src
\\
backend
\\
catalog
\\
*.sql
",
$target
.
'
/share/
');
CopyFiles
('
Information schema data
',
$target
.
'
/share/
',
'
src/backend/catalog/
',
'
sql_features.txt
');
CopyFiles
(
'
Information schema data
',
$target
.
'
/share/
',
'
src/backend/catalog/
',
'
sql_features.txt
'
);
GenerateConversionScript
();
GenerateTimezoneFiles
();
sub
Usage
{
sub
Usage
{
print
"
Usage: install.pl <targetdir>
\n
";
exit
(
1
);
}
sub
EnsureDirectories
{
sub
EnsureDirectories
{
mkdir
$target
unless
-
d
(
$target
);
while
(
my
$d
=
shift
)
{
while
(
my
$d
=
shift
)
{
mkdir
$target
.
'
/
'
.
$d
unless
-
d
(
$target
.
'
/
'
.
$d
);
}
}
sub
CopyFiles
{
sub
CopyFiles
{
my
$what
=
shift
;
my
$target
=
shift
;
my
$basedir
=
shift
;
print
"
Copying
$what
";
while
(
my
$f
=
shift
)
{
while
(
my
$f
=
shift
)
{
print
"
.
";
$f
=
$basedir
.
$f
;
die
"
No file
$f
\n
"
if
(
!
-
f
$f
);
copy
(
$f
,
$target
.
basename
(
$f
))
||
croak
"
Could not copy
$f
to
$target
"
.
basename
(
$f
)
.
"
to
$target
"
.
basename
(
$f
)
.
"
\n
";
die
"
No file
$f
\n
"
if
(
!-
f
$f
);
copy
(
$f
,
$target
.
basename
(
$f
))
||
croak
"
Could not copy
$f
to
$target
"
.
basename
(
$f
)
.
"
to
$target
"
.
basename
(
$f
)
.
"
\n
";
}
print
"
\n
";
}
sub
CopySetOfFiles
{
sub
CopySetOfFiles
{
my
$what
=
shift
;
my
$spec
=
shift
;
my
$target
=
shift
;
...
...
@@ -67,7 +87,8 @@ sub CopySetOfFiles {
print
"
Copying
$what
";
open
(
$D
,
"
dir /b /s
$spec
|
")
||
croak
"
Could not list
$spec
\n
";
while
(
<
$D
>
)
{
while
(
<
$D
>
)
{
chomp
;
next
if
/regress/
;
# Skip temporary install in regression subdir
my
$tgt
=
$target
.
basename
(
$_
);
...
...
@@ -78,14 +99,16 @@ sub CopySetOfFiles {
print
"
\n
";
}
sub
CopySolutionOutput
{
sub
CopySolutionOutput
{
my
$conf
=
shift
;
my
$target
=
shift
;
my
$rem
=
qr{Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"\) = "([^"]+)"}
;
my
$sln
=
read_file
("
pgsql.sln
")
||
croak
"
Could not open pgsql.sln
\n
";
print
"
Copying build output files...
";
while
(
$sln
=~
$rem
)
{
while
(
$sln
=~
$rem
)
{
my
$pf
=
$1
;
my
$dir
;
my
$ext
;
...
...
@@ -93,18 +116,23 @@ sub CopySolutionOutput {
$sln
=~
s/$rem//
;
my
$proj
=
read_file
("
$pf
.vcproj
")
||
croak
"
Could not open
$pf
.vcproj
\n
";
if
(
$proj
!~
qr{ConfigurationType="([^"]+)"}
)
{
if
(
$proj
!~
qr{ConfigurationType="([^"]+)"}
)
{
croak
"
Could not parse
$pf
.vcproj
\n
";
}
if
(
$1
==
1
)
{
if
(
$1
==
1
)
{
$dir
=
"
bin
";
$ext
=
"
exe
";
}
elsif
(
$1
==
2
)
{
elsif
(
$1
==
2
)
{
$dir
=
"
lib
";
$ext
=
"
dll
";
}
else
{
else
{
# Static lib, such as libpgport, only used internally during build, don't install
next
;
}
...
...
@@ -114,33 +142,39 @@ sub CopySolutionOutput {
print
"
\n
";
}
sub
GenerateConversionScript
{
sub
GenerateConversionScript
{
my
$sql
=
"";
my
$F
;
print
"
Generating conversion proc script...
";
my
$mf
=
read_file
('
src/backend/utils/mb/conversion_procs/Makefile
');
$mf
=~
s{\\\s*[\r\n]+}{}mg
;
$mf
=~
/^CONVERSIONS\s*=\s*(.*)$/m
||
die
"
Could not find CONVERSIONS line in conversions Makefile
\n
";
$mf
=~
/^CONVERSIONS\s*=\s*(.*)$/m
||
die
"
Could not find CONVERSIONS line in conversions Makefile
\n
";
my
@pieces
=
split
/\s+/
,
$1
;
while
(
$#pieces
>
0
)
{
while
(
$#pieces
>
0
)
{
my
$name
=
shift
@pieces
;
my
$se
=
shift
@pieces
;
my
$de
=
shift
@pieces
;
my
$func
=
shift
@pieces
;
my
$obj
=
shift
@pieces
;
$sql
.=
"
--
$se
-->
$de
\n
";
$sql
.=
"
CREATE OR REPLACE FUNCTION
$func
(INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '
\
$libdir
/
$obj
', '
$func
' LANGUAGE C STRICT;
\n
";
$sql
.=
"
CREATE OR REPLACE FUNCTION
$func
(INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '
\
$libdir
/
$obj
', '
$func
' LANGUAGE C STRICT;
\n
";
$sql
.=
"
DROP CONVERSION pg_catalog.
$name
;
\n
";
$sql
.=
"
CREATE DEFAULT CONVERSION pg_catalog.
$name
FOR '
$se
' TO '
$de
' FROM
$func
;
\n
";
}
open
(
$F
,"
>
$target
/share/conversion_create.sql
")
||
die
"
Could not write to conversion_create.sql
\n
";
open
(
$F
,"
>
$target
/share/conversion_create.sql
")
||
die
"
Could not write to conversion_create.sql
\n
";
print
$F
$sql
;
close
(
$F
);
print
"
\n
";
}
sub
GenerateTimezoneFiles
{
sub
GenerateTimezoneFiles
{
my
$mf
=
read_file
("
src/timezone/Makefile
");
$mf
=~
s{\\\s*[\r\n]+}{}mg
;
$mf
=~
/^TZDATA\s*:?=\s*(.*)$/m
||
die
"
Could not find TZDATA row in timezone makefile
\n
";
...
...
@@ -151,8 +185,8 @@ sub GenerateTimezoneFiles {
print
"
\n
";
}
sub
read_file
{
sub
read_file
{
my
$filename
=
shift
;
my
$F
;
my
$t
=
$/
;
...
...
src/tools/msvc/mkvcbuild.pl
View file @
eee22892
This diff is collapsed.
Click to expand it.
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