From 125079e6d7f96d67bfa751560525fc96a57a5f6d Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 8 Sep 1997 04:14:01 +0000 Subject: Reorganize developers files. --- src/BACKEND_DIRS | 47 ------------------------------- src/DEVELOPERS | 1 + src/DEV_TIPS | 66 -------------------------------------------- src/FIND_STATIC | 43 ----------------------------- src/MAKE_CTAGS | 10 ------- src/MAKE_ETAGS | 10 ------- src/MAKE_MKID | 7 ----- src/PGINDENT | 48 -------------------------------- src/tools/BACKEND_DIRS | 47 +++++++++++++++++++++++++++++++ src/tools/find_static | 43 +++++++++++++++++++++++++++++ src/tools/find_typedef | 27 ++++++++++++++++++ src/tools/make_diff/README | 35 +++++++++++++++++++++++ src/tools/make_diff/cporig | 8 ++++++ src/tools/make_diff/difforig | 11 ++++++++ src/tools/make_diff/rmorig | 6 ++++ 15 files changed, 178 insertions(+), 231 deletions(-) delete mode 100644 src/BACKEND_DIRS create mode 100644 src/DEVELOPERS delete mode 100644 src/DEV_TIPS delete mode 100644 src/FIND_STATIC delete mode 100644 src/MAKE_CTAGS delete mode 100644 src/MAKE_ETAGS delete mode 100644 src/MAKE_MKID delete mode 100644 src/PGINDENT create mode 100644 src/tools/BACKEND_DIRS create mode 100755 src/tools/find_static create mode 100755 src/tools/find_typedef create mode 100644 src/tools/make_diff/README create mode 100755 src/tools/make_diff/cporig create mode 100755 src/tools/make_diff/difforig create mode 100755 src/tools/make_diff/rmorig (limited to 'src') diff --git a/src/BACKEND_DIRS b/src/BACKEND_DIRS deleted file mode 100644 index 92131e128fc..00000000000 --- a/src/BACKEND_DIRS +++ /dev/null @@ -1,47 +0,0 @@ -access various index access methods -access/common common access routines -access/gist easy-to-define access method system -access/hash hash -access/heap heap -access/index index handling -access/nbtree btree -access/rtree rtree -access/transam transaction manager (BEGIN/ABORT/COMMIT) -bootstrap handles initdb requests to create initial template database -catalog system catalog manipulation -commands commands that do not require executor -executor executes complex node plans from optimizer -include include files -lib support library -libpq communication to client libpq library routines -main passes control to postmaster or postgres -nodes creation/manipulation of nodes -optimizer creates path and plan -optimizer/path creates path from parser output -optimizer/plan optmizes path output -optimizer/prep handle special plan cases -optimizer/util optimizer support routines -parser converts SQL query to query tree -postmaster controls postgres server startup/termination -regex regular expression library -rewrite rules system -storage manages various storage systems -storage/buffer shared buffer pool manager -storage/file file manager -storage/ipc semaphores and shared memory -storage/large_object large objects -storage/lmgr lock manager -storage/page page manager -storage/smgr storage(disk) manager -tcop traffic cop, dispatches request to proper module -tioga array handling? -utils support routines -utils/adt built-in data type routines -utils/cache system/relation/function cache routines -utils/error error reporting routines -utils/fmgr function manager -utils/hash hash routines for internal algorithms -utils/init initialization stuff -utils/mmgr memory manager(process-local memory) -utils/sort sort routines for internal algorithms -utils/time transaction time qualification routines diff --git a/src/DEVELOPERS b/src/DEVELOPERS new file mode 100644 index 00000000000..99f0c8c8908 --- /dev/null +++ b/src/DEVELOPERS @@ -0,0 +1 @@ +All the developer tools are located in the /tools directory. diff --git a/src/DEV_TIPS b/src/DEV_TIPS deleted file mode 100644 index 7cac0862202..00000000000 --- a/src/DEV_TIPS +++ /dev/null @@ -1,66 +0,0 @@ -Bruce Momjian - -Here are some of the scripts I use to make development easier. - -First, I use 'cpdir' on every file I am about to change. This makes a -copy with the extension .orig. If an .orig already exists, I am warned. - - : - # cporig - for FILE - do - if [ ! -f "$FILE.orig" ] - then cp $FILE $FILE.orig - else echo "$FILE.orig exists" 1>&2 - fi - done - -I can get really fancy with this. I can do 'cporig *' and make a .orig -for every file in the current directory. I can: - - cporig `grep -l HeapTuple *` - -If I use mkid (from ftp.postgreSQL.org), I can do: - - cporig `lid -kn 'fsyncOff'` - -and get a copy of every file containing that word. I can then do: - - vi `find . -name '*.orig'` - -or even better (using mkid): - - eid fsyncOff - -to edit all those files. - -When I am ready to generate a patch, I run this command from the top of -the source tree: - - : - #difforig - if [ "$#" -eq 0 ] - then APATH="." - else APATH="$1" - fi - find $APATH -name '*.orig' -print | sort | while read FILE - do - NEW="`dirname $FILE`/`basename $FILE .orig`" - echo "$NEW" 1>&2 - diff -c $FILE $NEW - done - -I pipe the output of this to a file to hold my patch, and the file names -it processes appear on my screen. It creates a nice patch for me of all -the files I used with cporig. - -Finally, I remove my old copies with: - - : - # rmorig - if [ "$#" -eq 0 ] - then APATH="." - else APATH="$1" - fi - find $APATH -name '*.orig' -exec rm {} \; - diff --git a/src/FIND_STATIC b/src/FIND_STATIC deleted file mode 100644 index bce75a2bf67..00000000000 --- a/src/FIND_STATIC +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -trap "rm -f /tmp/$$" 0 1 2 3 15 - -# This script finds functions that are either never called, or -# should be static. -# Some functions, like library functions and debug_print functions, -# should remain unchanged. - -# Run on a compiled source tree, from the top of the source tree - -# My nm utility has 9 characters of address which I strip, then a 'type' -# character, with T as a text function, and U as an undefined function -# symbol, then the function name. - -find . -name '[a-z]*.o' -type f -print | while read FILE -do - nm $FILE | cut -c10-100 |awk '{printf "%s\t%s\t%s\n", "'"$FILE"'",$1,$2}' -done >/tmp/$$ -destroydb debug -createdb debug -echo " - create table debug (file text, scope char, func text); - - copy debug from '/tmp/"$$"'; - - select * - into table debug2 - from debug; - - update debug2 - set scope = '_' - from debug - where debug2.func = debug.func and - debug2.scope = 'T' and debug.scope = 'U'; - - delete from debug2 - where scope = '_'; - - select * - from debug2 - where scope = 'T'; -" |psql debug - diff --git a/src/MAKE_CTAGS b/src/MAKE_CTAGS deleted file mode 100644 index ef99564694c..00000000000 --- a/src/MAKE_CTAGS +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -trap "rm -f /tmp/$$" 0 1 2 3 15 -rm -f ./tags -find `pwd`/ -type f -name '*.[chyl]' -print|xargs ctags -t -a -f tags -sort tags >/tmp/$$ && mv /tmp/$$ tags - -find . -type d -print |while read DIR -do - [ "$DIR" != "." ] && ln -f -s `pwd`/tags $DIR/tags -done diff --git a/src/MAKE_ETAGS b/src/MAKE_ETAGS deleted file mode 100644 index 94b9597aa40..00000000000 --- a/src/MAKE_ETAGS +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -trap "rm -f /tmp/$$" 0 1 2 3 15 -rm -f ./TAGS -find `pwd`/ -type f -name '*.[chyl]' -print | \ - xargs etags --append --output=TAGS - -find . -type d -print | \ -while read DIR; do - [ "$DIR" != "." ] && ln -f -s `pwd`/TAGS $DIR -done diff --git a/src/MAKE_MKID b/src/MAKE_MKID deleted file mode 100644 index 01ed0f079b2..00000000000 --- a/src/MAKE_MKID +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -find `pwd`/ -type f -name '*.[chyl]' -print|sed 's;//;/;g' | mkid -S.gen=C - - -find . -type d -print |while read DIR -do - [ "$DIR" != "." ] && ln -f -s `pwd`/ID $DIR/ID -done diff --git a/src/PGINDENT b/src/PGINDENT deleted file mode 100644 index 2c9371fbc5b..00000000000 --- a/src/PGINDENT +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -# This can format all PostgreSQL *.c and *.h files, -# excluding libpq++, *.y, and *.l files. -# -# On 09/06/1997, from the top directory, I ran: -# -# find . -name '*.[ch]' -type f -print | grep -v '++' | xargs -n100 PGINDENT -# - -trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15 -entab /dev/null -if [ "$?" -ne 0 ] -then echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2 - echo "This will put the 'entab' command in your path." >&2 - echo "Then run $0 again." - exit 1 -fi -indent -st /dev/null -if [ "$?" -ne 0 ] -then echo "You do not appear to have 'indent' installed on your system." >&2 - exit 1 -fi -for FILE -do - cat $FILE | - sed 's;/\* *---;/*---X_X;g' | - sed 's;\([} ]\)else[ ]*\(/\*.*\)$;\1else\ -\2;g' | # workaround for indent bug - detab -t4 -qc | - sed 's;^DATA(.*$;/*&*/;' >/tmp/$$a # protect backslashes in DATA() - indent -bad -bap -bbb -bc -bl -d0 -cdb -cli1 -nce -nfc1 -di12 -i4 -l75 \ - -lp -nip -npro /tmp/$$a >/tmp/$$ 2>&1 - if [ "$?" -ne 0 -o -s /tmp/$$ ] - then echo "$FILE" - cat /tmp/$$ - fi - cat /tmp/$$a | - sed 's;^/\*\(DATA(.*\)\*/$;\1;' | - sed 's;/\*---X_X;/* ---;g' | - sed 's;^static[ ][ ]*;static ;g' | # workaround indent bug - detab -t8 -qc | - entab -t4 -qc >/tmp/$$ && cat /tmp/$$ >$FILE -done - -# The 'for' loop makes these backup files useless -# so delete them -rm -f *a.BAK diff --git a/src/tools/BACKEND_DIRS b/src/tools/BACKEND_DIRS new file mode 100644 index 00000000000..92131e128fc --- /dev/null +++ b/src/tools/BACKEND_DIRS @@ -0,0 +1,47 @@ +access various index access methods +access/common common access routines +access/gist easy-to-define access method system +access/hash hash +access/heap heap +access/index index handling +access/nbtree btree +access/rtree rtree +access/transam transaction manager (BEGIN/ABORT/COMMIT) +bootstrap handles initdb requests to create initial template database +catalog system catalog manipulation +commands commands that do not require executor +executor executes complex node plans from optimizer +include include files +lib support library +libpq communication to client libpq library routines +main passes control to postmaster or postgres +nodes creation/manipulation of nodes +optimizer creates path and plan +optimizer/path creates path from parser output +optimizer/plan optmizes path output +optimizer/prep handle special plan cases +optimizer/util optimizer support routines +parser converts SQL query to query tree +postmaster controls postgres server startup/termination +regex regular expression library +rewrite rules system +storage manages various storage systems +storage/buffer shared buffer pool manager +storage/file file manager +storage/ipc semaphores and shared memory +storage/large_object large objects +storage/lmgr lock manager +storage/page page manager +storage/smgr storage(disk) manager +tcop traffic cop, dispatches request to proper module +tioga array handling? +utils support routines +utils/adt built-in data type routines +utils/cache system/relation/function cache routines +utils/error error reporting routines +utils/fmgr function manager +utils/hash hash routines for internal algorithms +utils/init initialization stuff +utils/mmgr memory manager(process-local memory) +utils/sort sort routines for internal algorithms +utils/time transaction time qualification routines diff --git a/src/tools/find_static b/src/tools/find_static new file mode 100755 index 00000000000..bce75a2bf67 --- /dev/null +++ b/src/tools/find_static @@ -0,0 +1,43 @@ +#!/bin/sh +trap "rm -f /tmp/$$" 0 1 2 3 15 + +# This script finds functions that are either never called, or +# should be static. +# Some functions, like library functions and debug_print functions, +# should remain unchanged. + +# Run on a compiled source tree, from the top of the source tree + +# My nm utility has 9 characters of address which I strip, then a 'type' +# character, with T as a text function, and U as an undefined function +# symbol, then the function name. + +find . -name '[a-z]*.o' -type f -print | while read FILE +do + nm $FILE | cut -c10-100 |awk '{printf "%s\t%s\t%s\n", "'"$FILE"'",$1,$2}' +done >/tmp/$$ +destroydb debug +createdb debug +echo " + create table debug (file text, scope char, func text); + + copy debug from '/tmp/"$$"'; + + select * + into table debug2 + from debug; + + update debug2 + set scope = '_' + from debug + where debug2.func = debug.func and + debug2.scope = 'T' and debug.scope = 'U'; + + delete from debug2 + where scope = '_'; + + select * + from debug2 + where scope = 'T'; +" |psql debug + diff --git a/src/tools/find_typedef b/src/tools/find_typedef new file mode 100755 index 00000000000..3017da5b708 --- /dev/null +++ b/src/tools/find_typedef @@ -0,0 +1,27 @@ +#!/bin/sh +# This script attempts to find all typedef's in the postgres binaries +# by using 'nm' to report all typedef debugging symbols. +# +# For this program to work, you must have compiled all binaries with +# debugging symbols. +# +# This is run on BSD/OS 3.0, so you may need to make changes for your +# version of nm. +# +# Ignore the nm errors about a file not being a binary file. +# +# Remember, debugging symbols are your friends. +# + +if [ "$#" -ne 1 -o ! -d "$1" ] +then echo "Usage: $0 postgres_binary_directory" 1>&2 + exit 1 +fi + +nm -a "$1"/* | +grep LSYM | +grep ':t' | +sed 's/^.*LSYM \([^:]*\):.*$/\1/' | +grep -v ' ' | # some typedefs have spaces, revove them +sort | +uniq diff --git a/src/tools/make_diff/README b/src/tools/make_diff/README new file mode 100644 index 00000000000..59e87c020ee --- /dev/null +++ b/src/tools/make_diff/README @@ -0,0 +1,35 @@ +Bruce Momjian + +Here are some of the scripts I use to make development easier. + +First, I use 'cporig' on every file I am about to change. This makes a +copy with the extension .orig. If an .orig already exists, I am warned. + +I can get really fancy with this. I can do 'cporig *' and make a .orig +for every file in the current directory. I can: + + cporig `grep -l HeapTuple *` + +If I use mkid (from ftp.postgreSQL.org), I can do: + + cporig `lid -kn 'fsyncOff'` + +and get a copy of every file containing that word. I can then do: + + vi `find . -name '*.orig'` + +or even better (using mkid): + + eid fsyncOff + +to edit all those files. + +When I am ready to generate a patch, I run 'difforig' command from the top of +the source tree: + +I pipe the output of this to a file to hold my patch, and the file names +it processes appear on my screen. It creates a nice patch for me of all +the files I used with cporig. + +Finally, I remove my old copies with 'rmorig'. + diff --git a/src/tools/make_diff/cporig b/src/tools/make_diff/cporig new file mode 100755 index 00000000000..0b188ac3e5f --- /dev/null +++ b/src/tools/make_diff/cporig @@ -0,0 +1,8 @@ +: +for FILE +do + if [ ! -f "$FILE.orig" ] + then cp $FILE $FILE.orig + else echo "$FILE.orig exists" 1>&2 + fi +done diff --git a/src/tools/make_diff/difforig b/src/tools/make_diff/difforig new file mode 100755 index 00000000000..a70b8bed4e9 --- /dev/null +++ b/src/tools/make_diff/difforig @@ -0,0 +1,11 @@ +: +if [ "$#" -eq 0 ] +then APATH="." +else APATH="$1" +fi +find $APATH -name '*.orig' -print | sort | while read FILE +do + NEW="`dirname $FILE`/`basename $FILE .orig`" + echo "$NEW" 1>&2 + diff -c $FILE $NEW +done diff --git a/src/tools/make_diff/rmorig b/src/tools/make_diff/rmorig new file mode 100755 index 00000000000..f6d0d4eff68 --- /dev/null +++ b/src/tools/make_diff/rmorig @@ -0,0 +1,6 @@ +: +if [ "$#" -eq 0 ] +then APATH="." +else APATH="$1" +fi +find $APATH -name '*.orig' -exec rm {} \; -- cgit v1.2.3