diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/Makefile | 37 | ||||
-rw-r--r-- | bin/README.html | 136 | ||||
-rwxr-xr-x | bin/class2hxxcxx | 80 | ||||
-rwxr-xr-x | bin/class2hxxcxxsingle | 80 | ||||
-rwxr-xr-x | bin/class2info | 197 | ||||
-rw-r--r-- | bin/class2info.awk | 1594 | ||||
-rwxr-xr-x | bin/class2man | 78 | ||||
-rwxr-xr-x | bin/class2mml | 79 | ||||
-rwxr-xr-x | bin/class2src | 79 | ||||
-rwxr-xr-x | bin/classinfo.ps | 868 | ||||
-rw-r--r-- | bin/clone.1 | 297 | ||||
-rw-r--r-- | bin/clone.cpp | 955 | ||||
-rw-r--r-- | bin/clone.csh | 26 | ||||
-rwxr-xr-x | bin/g++dep | 80 | ||||
-rw-r--r-- | bin/hiding.fmt | 20 | ||||
-rwxr-xr-x | bin/html-windex | 33 | ||||
-rwxr-xr-x | bin/info2doc.awk | 2181 | ||||
-rw-r--r-- | bin/info2doc.fmt | 23 | ||||
-rwxr-xr-x | bin/info2head | 166 | ||||
-rw-r--r-- | bin/info2head.fmt | 23 | ||||
-rwxr-xr-x | bin/info2headsrc | 326 | ||||
-rwxr-xr-x | bin/info2man | 169 | ||||
-rwxr-xr-x | bin/info2mml | 166 | ||||
-rwxr-xr-x | bin/info2src | 133 | ||||
-rwxr-xr-x | bin/info2src.awk | 630 | ||||
-rwxr-xr-x | bin/man2html | 88 | ||||
-rw-r--r-- | bin/man2html1.awk | 139 | ||||
-rw-r--r-- | bin/man2html2.awk | 18 | ||||
-rwxr-xr-x | bin/rename-ace.pl | 175 | ||||
-rwxr-xr-x | bin/vendor.fmt | 101 |
30 files changed, 8977 insertions, 0 deletions
diff --git a/bin/Makefile b/bin/Makefile new file mode 100644 index 00000000000..3125c849be6 --- /dev/null +++ b/bin/Makefile @@ -0,0 +1,37 @@ +############################################################################# +# +# Makefile for assignment 1 +# +############################################################################# + +CXX = CC +CFILES = clone.cpp +OFILES = clone.o +DFLAGS = -g +CFLAGS = $(DFLAGS) -I$(WRAPPER_ROOT) + +############################################################################# +# C++ directives + +.SUFFIXES: .cpp +.cpp.o: + $(CXX) $(CFLAGS) -c $< +############################################################################# + +clone: $(OFILES) + $(CXX) $(CFLAGS) -o $@ $(OFILES) + +clean: + -/bin/rm -f *.o *.out *~ core + +realclean: clean + -/bin/rm -fr clone + +depend: + g++dep -f Makefile $(CFILES) +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +clone.o : clone.cpp +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY + diff --git a/bin/README.html b/bin/README.html new file mode 100644 index 00000000000..6c6577b411e --- /dev/null +++ b/bin/README.html @@ -0,0 +1,136 @@ +<HTML> + +<HEAD> +<TITLE>ACE OSE Tools</TITLE> + +<BODY text = "#000000" +link="#000fff" +vlink="#ff0f0f" +bgcolor="#ffffff"> + +<HR> +<H3>Modified Version of the OSE Documentation Tools</H3> + +This <A HREF="http://www.cs.wustl.edu/~schmidt/ACE-bin/">directory</A> +contains versions of the freely available <A +HREF="http://www.telstra.com.au/docs/ose/doc/ose-home.html">OSE</A> +tools modified by Karlheinz Dorn (kdorn@erlh.siemens.de). I (Doug +Schmidt) am grateful to him for contributing his efforts to help +improve ACE. You can obtain these files via the <A +HREF="ACE-obtain.html">ACE</A> release.<P> + +The primary goal of the modifications was to create a <EM>class</EM>.hxx and +<EM>class</EM>.cxx file (for each class, struct, union included within the +original ACE header file) from the ACE *.h header files by collecting +the comments from that file and feeding them into the newly created +files, but keeping the ACE *.h file untouched. <P> + +This helps when making product documentation using commercial +documentation tools (e.g., GEORGE) by feeding in these newly created +files with a customizable layout. The modifications should be an +upgrade to the original OSE-tools, but many bug-fixes are also done +for the OSE-tool files (some are listed below). <P> + +This extensions make it very easy to include new ACE versions into +commercial documentations without doing any painful modifications of +the deltas within a frozen ACE-version or directly within ACE source +files when a new release arises. <P> + +The following changes were made to the original OSE tools: + +<UL> + +<LI> The vendor headers can be suppressed within the hiding.fmt file, +so it is possible to generate <EM>class</EM>.cxx and +<EM>class</EM>.hxx files consisting only of pure class description +(hxx) and pure prototypes (cxx). Look at the vendor.fmt file and +change the field <EM>vendor</EM> in replacing it with your company +identifying line. <P> + +<LI> Added a new script class2hxxcxx for making a <EM>class</EM>.hxx file for each + class, struct, union included in an ACE *.h file as well as a *.cxx + file that includes the correct prototypes for all classes within that + *.h file. <P> + +<LI> Added new script info2headsrc for creating a <EM>class</EM>.hxx file for each + class, struct, union included in an ACE *.h file as well as a <EM>class</EM>.cxx + file that includes the correct prototypes for that class. <P> + +<LI> added a new script class2hxxcxxsingle for the feature listed above. <P> + +<LI> added a new format file named "hiding.fmt" to control more fine grained output + of a class in separating/suppressing PUBLIC, PROTECTED, PRIVATE parts of a + class, struct, union for output explicitly. <P> + +<LI> added a new format file named "vendor.fmt" to control vendor specific + compilation-unit headers as well as class and method headers for the newly + created <EM>class</EM>.hxx and <EM>class</EM>.cxx files. The information for these headers + is collected from the headers and comments of the according ACE *.h files. <P> + +<LI> changed info2doc and info2src for the features listed above. <P> + +<LI> added the ability for handling multiline ENUMs properly (class2info,info2doc). <P> + +<LI> added the ability for handling operator functions properly (info2src). <P> + +<LI> added the ability for handling template functions properly (info2src). <P> + +<LI> added the ability for handling nested classes, structs, unions properly + by introducing nawk-function recursion within info2doc (class2info, + info2doc, info2src). <P> + +<LI> added the ability for handling default values properly (info2src). <P> + +</UL> + +<HR><P> +<H3>Known Bugs</H3> + +Some bugs inherited from the original OSE-tools are remaining. So the +developer of the *.h files should the following keep in mind: + +- do not write multiline inheritance! <P> + +INCORRECT: <P> + +<pre><code> + class x : + public y + { + } +</pre></code> + +CORRECT: <P> + +<pre><code> + class x : public y + { + } +</pre></code> + +- do not write multiline templates!<P> + +INCORRECT: <P> + +<pre><code> + template <class t, + class> + class x + { + } +</pre></code> + +CORRECT: <P> + +<pre><code> + template <class t, class u> + class x + { + } +</pre></code> + +<P><HR><P> +Back to the <A HREF="ACE.html">ACE</A> home page. + +</BODY> +</HTML> diff --git a/bin/class2hxxcxx b/bin/class2hxxcxx new file mode 100755 index 00000000000..2254f645d75 --- /dev/null +++ b/bin/class2hxxcxx @@ -0,0 +1,80 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Script to combine class2info and info2head and info2src. +# +# = AUTHOR(S) +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT/$OSE_RELEASE_NAME +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/lib"} + +CLASS2INFO="$BINDIR/class2info" +INFO2HEAD="$BINDIR/info2head" +INFO2SRC="$BINDIR/info2src" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` files" +} + +# +# Check usage. +# +if test "$#" = "0" +then + USAGE +fi + +while test "$#" != "0" +do + $CLASS2INFO $1 + if test "$?" != "0" + then + exit 1 + fi + file=`basename $1` + base="`echo $file | sed -e 's/\..*$//'`" + if test -f "$base.ci" + then + $INFO2SRC $base.ci + $INFO2HEAD $base.ci +# rm -f $base.ci + fi + shift +done diff --git a/bin/class2hxxcxxsingle b/bin/class2hxxcxxsingle new file mode 100755 index 00000000000..94c869cb739 --- /dev/null +++ b/bin/class2hxxcxxsingle @@ -0,0 +1,80 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Script to combine class2info and info2head and info2src. +# +# = AUTHOR(S) +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT/$OSE_RELEASE_NAME +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/lib"} + +CLASS2INFO="$BINDIR/class2info" +INFO2HEADSRC="$BINDIR/info2headsrc" +INFO2SRC="$BINDIR/info2src" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` files" +} + +# +# Check usage. +# +if test "$#" = "0" +then + USAGE +fi + +while test "$#" != "0" +do + $CLASS2INFO $1 + if test "$?" != "0" + then + exit 1 + fi + file=`basename $1` + base="`echo $file | sed -e 's/\..*$//'`" + if test -f "$base.ci" + then +# $INFO2SRC $base.ci + $INFO2HEADSRC $base.ci +# rm -f $base.ci + fi + shift +done diff --git a/bin/class2info b/bin/class2info new file mode 100755 index 00000000000..752ced3ebce --- /dev/null +++ b/bin/class2info @@ -0,0 +1,197 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Converts a C++ class header file into a classinfo description file. +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright - OTC LIMITED (1991) +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/bin"} + +INFO2INFO="$BINDIR/info2info" + +AWK="nawk" + +if test "$AWK" = "nawk" +then + VARG="-v" +fi + + +FILES= +V2= + +trap 'rm -f /tmp/ci.$$; exit' 1 2 3 13 15 + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` file.h ..." +} + +# +# Check usage. +# +if test $# = 0 +then + USAGE +fi + +# +# Parse command line. +# +while test $# != 0 +do + case $1 in +# -v2) +# V2=YES +# shift +# ;; + *.h|*.hh|*.H|*.hxx|*.hpp|*.h++) + FILES="$FILES $1" + shift + ;; + *) + USAGE + ;; + esac +done + +# +# Check usage again. +# +if test -z "$FILES" +then + USAGE +fi + +# +# Check for awk file. +# +CLASS2INFO=$LIBDIR/class2info.awk +HIDINGFMT=$LIBDIR/hiding.fmt + +if test ! -f $HIDINGFMT +then + ERROR "Can't find $HIDINGFMT" +fi + + +if ( test ! -f $CLASS2INFO ) +then + ERROR "Can't find $CLASS2INFO" +fi + + + +VCSA=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^CSAHEADER$" { + if ( $2 ~ "on" ) + printf("%s","csaprintheader=on"); + else + printf("%s","csaprintheader="); +}' $HIDINGFMT` + +VPUBL=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PUBLIC$" { + if ( $2 ~ "on" ) + printf("%s","publ=on"); + else + printf("%s","publ="); +}' $HIDINGFMT` + +VPROT=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PROTECTED$" { + if ( $2 ~ "on" ) + printf("%s","prot=on"); + else + printf("%s","prot="); +}' $HIDINGFMT` + +VPRIV=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PRIVATE$" { + if ( $2 ~ "on" ) + printf("%s","priv=on"); + else + printf("%s","priv="); +}' $HIDINGFMT` + +#echo " $VPUBL $VPROT $VPRIV " + + +# +# Parse each file. +# +# $VARG publ=on $VARG prot=off $VARG priv=off \ +for i in $FILES +do + if test ! -f $i + then + ERROR "$i doesn't exist." + fi + FILENAME=`basename $i` + INFOFILE=`echo $FILENAME | sed -e 's/\..*$//'`.ci + rm -f $INFOFILE + if test "$?" != 0 + then + ERROR "Couldn't remove info file $INFOFILE." + fi + expand $i > /tmp/ci.$$ + $AWK \ + -f $CLASS2INFO $VARG filename=$i \ + $VARG $VPUBL $VARG $VPROT $VARG $VPRIV \ + /tmp/ci.$$ > $INFOFILE + rm -f /tmp/ci.$$ +# if test ! -z "$V2" +# then +# $INFO2INFO $INFOFILE +# fi +done diff --git a/bin/class2info.awk b/bin/class2info.awk new file mode 100644 index 00000000000..1810a8f3e0c --- /dev/null +++ b/bin/class2info.awk @@ -0,0 +1,1594 @@ +# ============================================================================= +# +# = DESCRIPTION +# Awk script for converting C++ class header file to classinfo file. +# Requires nawk or gawk. +# comments like /* ... */ with ... goes over multiple lines are not ok +# and will be not printed as comments! +# class xxx +# : public yyyy is not allowed but : class xxx : public yyyy +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# +# ============================================================================= + +BEGIN { + initialised = 0 + accpubl = "on" + accprot = "on" + accpriv = "on" + accpubl = publ + accprot = prot + accpriv = priv + accpubl = "on" + accprot = "off" + accpriv = "off" +} +{ + if ( initialised == 0 ) + { + initialised = 1 + "date" | getline line + printf( "CLASS2INFO\n%s\n%s\n\n", line, filename ) + anonenum = 1 + } + doParse(); + next +} + + + +{ + print "error" | "cat 1>&2" + exit +} + +# +# If a comment starts with '// ==', discard lines until the end of the +# comment or a line of the form '// = NAME' is found. This is special +# case to deal with comment headers in files. e.g: +# +# // ========== ... +# // +# // = LIBRARY +# // ... +# +# lines up to '// = LIBRARY' would be discarded. +# +# /^[\t ]*\/\/[\t ]*==+[\t ]*$/ { +# handleHeader() +# } + +function handleHeader() +{ + getline + while ( \ + ( $0 ~ "^[\t ]*//" ) \ + && \ + ( $0 !~ "^[\t ]*//[\t ]*= [a-zA-Z0-9]+[^<>]*[\t ]*$" ) \ + ) + { + getline + } +} + +# +# Extract labelled comments. These are denoted by '// = NAME', where the word +# NAME is actually replaced by the some identifying label. +# A labelled section is terminated by the end of the comment block, another +# labelled comment, or a comment line of the form '// =='. e.g: +# Note: a label cannot contain the characters '<>', these are identified +# as being special commands and are simply passed through. +# +# // = LIBRARY +# // C++ +# // +# // = VERSION +# // ... +# // +# // ========== ... +# +# the LIBRARY section would be terminated by '// = VERSION', and the VERSION +# section by '// =====...'. +# +# /^[\t ]*\/\/[\t ]*= [a-zA-Z0-9]+[^<>]*[\t ]*$/ { +# handleInfo() +# } + +function handleInfo( label ) +{ + sub( "^[\t ]*//", "", $0 ) + while ( $0 ~ "^[\t ]*= [a-zA-Z0-9]+[^<>]*[\t ]*$" ) + { + match( $0, " [a-zA-Z0-9]+[^<>]*$" ) + label = substr( $0, RSTART, RLENGTH ) + sub( "^[\t ]*", "", label ) + if ( name ~ "^$" ) + printf( "INFO\nGLOBAL\n%s\n", label ) + else if ( hiding ~ "^$" ) + printf( "INFO\nHDR\n%s\n%s\n", label, name ) + else + printf( "INFO\nBODY\n%s\n%s\n%s\n", label, name, hiding ) + $0 = outputComment() + } +} + +function SetCommentClrComment( line, comment) +{ + if ( match( line, "(\/\\*.*\\*\/)?$" ) > 0) + { + comment = substr( line, RSTART, RLENGTH ) + sub( "//.*$", "", line ) + } + else + if ( match( line, "(//.*)?$" ) > 0) + { + comment = substr( line, RSTART, RLENGTH ) + sub( "\/\\*.*$", "", line ) + } +} + + +function check_print_first() +{ + if ( ((hiding == "private") && (accpriv == "on") ) || ((hiding == "public") && (accpubl == "on") ) || ((hiding == "protected") && (accprot == "on") ) ) + pra = 1 + else + { + pra = 0 + $0 = "" + } + return pra +} + +function check_print() +{ + if ( ( type ~ "class" ) && ( hiding ~ "^$" ) ) + { + if (accpriv == "on") + { + pra = 1 + return pra + } + else + { + pra = 0 + $0 = "" + return pra + } + } + else + { + + if ((accpubl == "on") || ( hiding ~ "^$" )) + { + pra = 1 + return pra + } + else + { + pra = 0 + $0 = "" + return pra + } + } + + if ( ((hiding == "private") && (accpriv == "on") ) || ((hiding == "public") && (accpubl == "on") ) || ((hiding == "protected") && (accprot == "on") ) ) + { + pra = 1 + } + else + { + pra = 0 + $0 = "" + } + return pra +} + +# +# transfer a c comment /* ... */ to a C++ // ... comment +# the comment comes in feld and goes back in feld +# + +function Set_c_Comment_to_CPP_Comment( feld) +{ + if ( match( feld, "\/\\*.*\\*\/$" ) > 0) + { +# printf("\n----feldb=|%s|----\n",feld); + sub( "\/\\*", "\/\/", feld ) + sub( "\\*\/", "", feld ) +# printf("\n----felda=|%s|----\n",feld); + } + return feld +} + + + +# +# Gather up unlabelled comments. +# +# /^[\t ]*\/\/.*$/ { +# handleComment() +# } + +function handleComment() +{ + if ( name ~ "^$" ) + printf( "COMMENT\nGLOBAL\n" ) + else if ( hiding ~ "^$" ) + printf( "COMMENT\nHDR\n%s\n", name ) + else + printf( "COMMENT\nBODY\n%s\n%s\n", name, hiding ) + $0 = outputComment( $0 ) +} + +# +# Skip past '#define's. Leave it up to programmers to document important +# definitions with a section. +# +# /^[\t ]*#[\t ]*define/ { +# handleDefine() +# } + +function handleDefine( line ) +{ + if ( $0 ~ ".*\\\\$" ) + { + end = 0 + while ( end == 0 ) + { + getline line + if ( line !~ ".*\\\\$" ) + end = 1 + } + } + # next + $0 = "" +} + +# +# Record name of files which are included. +# Note: Since we do not process '#if's we will get all includes, even if +# some are particular to some systems etc. +# +# /^[\t ]*#[\t ]*include[\t ]*<.+>/ { +# () +# } + +function handleInclude() +{ + match( $0, "<.+>" ) + $0 = substr( $0, RSTART, RLENGTH ) + printf( "INCLUDE\n%s\n\n", $0 ) + # next + $0 = "" +} + +# /^[\t ]*#[\t ]*include[\t ]*".+"/ { +# handleLocalInclude() +# } + +function handleLocalInclude() +{ + match( $0, "\".+\"" ) + $0 = substr( $0, RSTART, RLENGTH ) + printf( "INCLUDE\n%s\n\n", $0 ) + # next + $0 = "" +} + +# +# Skip any other pre-processor directives. +# +# /^[\t ]*#.*$/ { +# handlePreprocessor() +# } + +function handlePreprocessor_alt() +{ + # next + $0 = "" +} + +function handlePreprocessor() +{ + printf( "PREPROC\n%s\n\n", $0 ) + # next + $0 = "" +} + +# +# Trap typedefs. +# +# /^typedef[\t ]+/ { +# handleTypedef() +# } + +function handleTypedef( comment, line ) +{ + line = $0 + while ( line !~ ";[\t ]*(//.*)?$" ) + { + line = uncomment( line ) + getline + sub( "^[\t ]*", "", $0 ) + line = line " " $0 + sub( "\\) \\(", ")(", line ) + } + match( line, "(//.*)?$" ) + comment = substr( line, RSTART, RLENGTH ) + sub( "//.*$", "", line ) + sub( "^[\t ]*typedef[\t ]*", "typedef ", line ) + if ( name ~ "^$" ) + printf( "TYPEDEF\n%s\n%s\n%s\n", "::", "public", line ) + else + printf( "TYPEDEF\n%s\n%s\n%s\n", name, hiding, line ) + $0 = outputComment( comment ) +} + +# +# Trap externs. +# +# /^extern[\t ]+/ { +# handleExtern() +# } + +function handleExtern( lang, comment ) +{ + if ( $0 ~ "\"C\"[\t ]*$" || $0 ~ "\"C\"[\t ]*\{[\t ]*$" ) + { + # Bracketed includes (??). Skip them for now. + while ( $0 !~ "}[\t]*$" && $0 !~ "}[\t ]*;[\t]*$" ) + getline + getline + } + else + { + if ( $0 !~ ";[\t ]*(//.*)?$" ) + $0 = handleArgs( $0 ) + match( $0, "(//.*)?$" ) + comment = substr( $0, RSTART, RLENGTH ) + sub( "//.*$", "", $0 ) + sub( "^extern[\t ]*", "", $0 ) + if ( match( $0, "\"[^\"]*\"" ) != 0 ) + { + lang = substr( $0, RSTART, RLENGTH ) + sub( "^\"[\t ]*", "", lang ) + sub( "[\t ]*\"$", "", lang ) + } + else + lang = "C++" + sub( "\"[^\"]*\"[\t ]*", "", $0 ) + printf( "EXTERN\n%s\n%s\n", lang , $0 ) + $0 = outputComment( comment ) + } +} + +# +# Trap class, struct, union and template definitions. +# Note: handleADT() does the hard work of determining if the particular +# use is in a definition, declaration or other. +# +# /^[\t ]*class/ { +# handleClass() +# } + +function handleClass() +{ + class = 1 + sub( "^[\t ]*class[\t ]+(ACE_[.]*Export[\t ]+)?", "", $0 ) + if ( handleADT( $0 ) == 1 ) + { + if ( topName ~ "^$" ) + printf( "CLASS\n%s\n", name ) + else + printf( "CLASS\n%s::%s\n", topName, name ) + outputSuperClasses( bases ) + bases = "" + } + class = 0 + # next + $0 = "" +} + +# /^[\t ]*enum/ { +# handleEnumCsa() +# } + +function handleEnumCsa() +{ + enum = 1 + sub( "^[\t ]*enum[\t ]+", "", $0 ) + if ( handleADT( $0 ) == 1 ) + { + if ( topName ~ "^$" ) + printf( "ENUM\n%s\n", name ) + else + printf( "ENUM\n%s::%s\n", topName, name ) + bases = "" + } + enum = 0 + # next + $0 = "" +} + +# /^[\t ]*struct/ { +# handleStruct() +# } + +function handleStruct() +{ + struct = 1 + sub( "^[\t ]*struct[\t ]+", "", $0 ) + if ( handleADT( $0 ) == 1 ) + { + if ( topName ~ "^$" ) + printf( "STRUCT\n%s\n", name ) + else + printf( "STRUCT\n%s::%s\n", topName, name ) + outputSuperClasses( bases ) + bases = "" + } + struct = 0 + # next + $0 = "" +} + +# /^[\t ]*union/ { +# handleUnion() +# } + +function handleUnion() +{ + union = 1 + sub( "^[\t ]*union[\t ]+", "", $0 ) + if ( handleADT( $0 ) == 1 ) + { + if ( topName ~ "^$" ) + printf( "UNION\n%s\n", name ) + else + printf( "UNION\n%s::%s\n", topName, name ) + outputSuperClasses( bases ) + bases = "" + } + union = 0 + # next + $0 = "" +} + +# /^[\t ]*template[\t ]*<.+>[\t ]+class/ { +# handleTemplate() +# } + +function handleTemplate() +{ + template = 1 + + match( $0, "^[\t ]*template[\t ]*<.+>[\t ]+(class|struct|union)[\t ]+" ) +# nested template error!!! match( $0, "^template[\t ]*<.+>[\t ]+(class|struct|union)[\t ]+" ) + + line = substr( $0, RSTART, RLENGTH ) + match( line, "[\t ]+(class|struct|union)[\t ]+$" ) + adttype = substr( line, RSTART, RLENGTH ) + sub( "^[\t ]*", "", adttype ) + sub( "[\t ]*$", "", adttype ) + match( line, "<.+>" ) + targs = substr( line, RSTART, RLENGTH ) + sub( "^[\t ]*template[\t ]*<.+>[\t ]+(class|struct|union)[\t ]+", "", $0 ) + if ( handleADT( $0 ) == 1 ) + { +# printf( "TEMPLATE\n%s\n%s\n%s\n", adttype, name, targs ) + if ( topName !~ "^$" ) + printf( "TEMPLATE\n%s\n%s::%s\n%s\n", adttype, topName, name, targs ) + else + printf( "TEMPLATE\n%s\n%s\n%s\n", adttype, name, targs ) + outputSuperClasses( bases ) + bases = "" + } + template = 0 + # next + $0 = "" +} + +# +# Trap enumerated types. +# + +# This handles enums where there is potentially more than one entry on +# a line. We throw away all comments in this case. + +function handleLineEnum() +{ + enum = 1 + sub( "^[\t ]*enum[\t ]*", "", $0 ) + line = $0 + sub( "[\t ]*\{.*", "", line ) + pushLevel() + name = line + if ( name != "" ) + { + if ( topName ~ "^$" ) + printf( "ENUM\n%s\n\n", name ) + else + printf( "ENUM\n%s::%s\n\n", topName, name ) + } + else + { + name = anonenum + anonenum++ + if ( topName ~ "^$" ) + printf( "ANONENUM\n%s\n\n", name ) + else + printf( "ANONENUM\n%s::%s\n\n", topName, name ) + } + line = $0 + sub( "^.*\{[\t ]*", "", line ) + sub( "[\t ]*//.*$", "", line ) + while ( line !~ "}.*" ) + { + getline + line = line $0 + sub( "[\t ]*//.*$", "", line ) + } + # Forget about variables for now. + sub( "[\t ]*}.*", "", line ) + gsub( "[\t ]+", "", line ) + num = split( line, item, "," ) + for ( i=1; i<=num; i++ ) + { + if ( topName ~ "^$" ) + printf( "ENUMITEM\n%s\n%s\n\n", name, item[i] ) + else + printf( "ENUMITEM\n%s::%s\n%s\n\n", topName, name, item[i] ) + } + $0 = "" + popLevel( $0 ) + enum = 0 +} + +# This handles enums which are formatted to preferred style. +# Can collect comments meaningfully in this format. + +function handleEnum() +{ + enum = 1 + sub( "^[\t ]*enum[\t ]*", "", $0 ) + sub( "([\t ]*\{)?[\t ]*$", "", $0 ) + sub( "^[\t ]*", "", $0 ) + pushLevel() + name = $0 + if ( name != "" ) + { + if ( topName ~ "^$" ) + printf( "ENUM\n%s\n\n", name ) + else + printf( "ENUM\n%s::%s\n\n", topName, name ) + } + else + { + name = anonenum + anonenum++ + if ( topName ~ "^$" ) + printf( "ANONENUM\n%s\n\n", name ) + else + printf( "ANONENUM\n%s::%s\n\n", topName, name ) + } + getline + while ( $0 ~ /^[\t ]*\/\/[\t ]*=/ ) + handleInfo() + while ( 1 ) + { + while ( $0 ~ /^[\t ]*$/ || $0 ~ /^[\t ]*\{/ ) + getline + + if ( $0 ~ /,[^\/]*,/ ) + { + line = $0 + sub( "[,\t ]*//.*", " ", line ) + gsub( "[\t ]+", "", line ) + num = split( line, item, "," ) + for ( i=1; i<=num; i++ ) + { + if ( topName ~ "^$" ) + printf( "ENUMITEM\n%s\n%s\n", name, item[i] ) + else + printf( "ENUMITEM\n%s::%s\n%s\n", topName, name, item[i] ) + if ( i != num ) + printf( "\n" ) + } + sub( "^.*//", "//", $0 ) + currentlevel = level + $0 = outputComment( $0 ) +# if ( $0 ~ /^$/ ) + if ( currentlevel != level ) + { + enum = 0 + return + } + } + else if ( $0 ~ /^.*,[\t ]*(\/\/.*)?$/ ) + { + match( $0, ".*,([\t ]*//)?" ) + enumval = substr( $0, RSTART, RLENGTH ) + sub( "[\t ]*,.*$", "", enumval ) + sub( "^[\t ]*", "", enumval ) + if ( topName ~ "^$" ) + printf( "ENUMITEM\n%s\n%s\n", name, enumval ) + else + printf( "ENUMITEM\n%s::%s\n%s\n", topName, name, enumval ) + sub( "^.*//", "//", $0 ) + currentlevel = level + $0 = outputComment( $0 ) +# if ( $0 ~ /^$/ ) + if ( currentlevel != level ) + { + enum = 0 + return + } + } + else if ( $0 ~ /^.*(\/\/.*)?$/ ) + { + match( $0, ".*([\t ]*//)?" ) + enumval = substr( $0, RSTART, RLENGTH ) + sub( "[\t ]*([\t ]*//.*)?$", "", enumval ) + sub( "^[\t ]*", "", enumval ) + if ( topName ~ "^$" ) + printf( "ENUMITEM\n%s\n%s\n", name, enumval ) + else + printf( "ENUMITEM\n%s::%s\n%s\n", topName, name, enumval ) + sub( "^.*//", "//", $0 ) + currentlevel = level + $0 = outputComment( $0 ) +# if ( $0 ~ /^$/ ) + if ( currentlevel != level ) + { + enum = 0 + return + } + $0 = "" + } + else if ( $0 ~ /^[\t ]*}[\t ]*;/ ) + { + # Shouldn't happen, but just in case. + popLevel( $0 ) + enum = 0 + return + } + } + enum = 0 +} + +# +# Trap the end of a abstract data type or enumerated type. +# Note: arrays are going to cause a problem here. e.g: +# +# int foo[] = +# { +# }; +# +# so this needs to be cleaned up a bit. +# +# /^[\t ]*}.*;[\t ]*/ { +# handleEndADT() +# } + +function handleEndADT() +{ + popLevel( $0 ) + # next + $0 = "" +} + +# +# Trap private, protected and public keywords in class, struct or union. +# +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /^[\t ]*private[\t ]*:[\t ]*(\/\/.*)?$/ { +# handlePrivate() +# } + +function handlePrivate() +{ +#if (accpriv == "on" ) + printf( "ACCESS\n%s\nprivate\n\n", name ) + hiding = "private" + # next + $0 = "" +} + +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /^[\t ]*protected[\t ]*:[\t ]*(\/\/.*)?$/ { +# handleProtected() +# } + +function handleProtected() +{ +#if (accprot == "on" ) + printf( "ACCESS\n%s\nprotected\n\n", name ) + hiding = "protected" + # next + $0 = "" +} + +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /^[\t ]*public[\t ]*:[\t ]*(\/\/.*)?$/ { +# handlePublic() +# } + +function handlePublic() +{ +#if (accpubl == "on" ) + printf( "ACCESS\n%s\npublic\n\n", name ) + hiding = "public" + # next + $0 = "" +} + +# +# Handle friend declaration. +# +function handleFriend( comment, line ) +{ + line = $0 + if ( $0 ~ /[,(][\t ]*(\/\/.*)?$/ ) + { + line = uncomment( line ) + line = handleArgs( line ) + } + if ( line !~ /;[\t ]*(\/\/.*)?$/ ) + { + line = uncomment( line ) + comment = handleInline() + line = line ";" + } + else + { + match( line, "//.*$" ) + comment = substr( line, RSTART, RLENGTH ) + } + gsub( "\t", " ", line ) + gsub( " +", " ", line ) + sub( "^ *", "", line ) + if ( name ~ "^$" ) + printf( "FRIEND\n%s\n%s\n%s\n", "::", "public", line ) + else + if ( hiding ~ "^$" ) + printf( "FRIEND\n%s\n%s\n%s\n", name, "public", line ) + else + printf( "FRIEND\n%s\n%s\n%s\n", name, hiding, line ) + $0 = outputComment( comment ) +} + +# +# Trap inline constructors with an initialiser list. +# +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /\)[\t ]*:[\t ]*.*\(.*\)[\t ]*({(.*})?[\t ]*)?(\/\/.*)?$/ { +# handleInlineCtor() +# } + +function handleInlineCtor() +{ + sub( "[\t ]*//.*", "", $0 ) + match( $0, ".*\\)[\t ]*:[\t ]*" ) + prototype = substr( $0, RSTART, RLENGTH ) + sub( "[\t ]*:[\t ]*$", "", prototype ) + outputFunction( prototype ) + if ( $0 !~ "}[\t ]*$" ) + { + $0 = handleInline() + if ( $0 ~ "^[\t ]*//.*$" ) + $0 = outputComment( $0 ) + } + else + $0 = outputComment( "" ) +} + +# +# Trap any inline functions, including constructors/destructors, with +# a complete prototype on the first line. +# +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /\)[\t ]*(const[\t ]*)?({(.*})?[\t ]*)?(\/\/.*)?$/ { +# handleInlineFunction() +# } + +function handleInlineFunction() +{ + sub( "[\t ]*//.*$", "", $0 ) + +# XXXX v1 match( $0, ".*\\)[\t ]*(const[\t ]*)?([^{]*{)?[\t ]*" ) +# XXXX v2 match( $0, ".*\\)[\t ]*(const)?([\t ]*\{)?[\t ]*" ) +# XXXX v2 prototype = substr( $0, RSTART, RLENGTH ) + + pos = index($0,"{") + if ( pos != 0 ) + prototype = substr( $0, 1, pos-1 ) + else + prototype = $0 + + sub( "[\t ]*\{[\t ]*$", "", prototype ) + outputFunction( prototype ) + if ( $0 !~ "}[\t ]*$" ) + { + savename = name + $0 = handleInline() + if ( $0 ~ "^[\t ]*//.*$" ) + $0 = outputComment( $0 ) + else + { + if ( savename == name ) + printf( "\n" ) + } + } + else + $0 = outputComment() +} + +# +# Trap normal Enum declaration. +# +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /\)[\t ]*(enum[\t ]*)?(=[\t ]*0[\t ]*)?,[\t ]*(\/\/.*)?$/ { +# handleenum() +# } + +function handleEnumFun() +{ + $0 = Set_c_Comment_to_CPP_Comment( $0) + match( $0, "//.*" ) + comment = substr( $0, RSTART, RLENGTH ) + $0 = uncomment( $0 ) + outputEnum( $0 ) + $0 = outputComment( comment ) +} + +# +# Trap normal function declaration. +# +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /\)[\t ]*(const[\t ]*)?(=[\t ]*0[\t ]*)?;[\t ]*(\/\/.*)?$/ { +# handleFunction() +# } + +function handleFunction() +{ + $0 = Set_c_Comment_to_CPP_Comment( $0) + match( $0, "//.*" ) + comment = substr( $0, RSTART, RLENGTH ) + $0 = uncomment( $0 ) + outputFunction( $0 ) + $0 = outputComment( comment ) +} + +# +# Trap member variables. +# +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /[\t ]*;[\t ]*(\/\/.*)?$/ { +# handleMember() +# } + +function handleMember() +{ + $0 = Set_c_Comment_to_CPP_Comment( $0) + match( $0, "//.*" ) + comment = substr( $0, RSTART, RLENGTH ) + sub( "[\t ]*//.*", "", $0 ) + outputMember( $0 ) + $0 = outputComment( comment ) +} + +function handleMember_orig() +{ + match( $0, "//.*" ) + comment = substr( $0, RSTART, RLENGTH ) + sub( "[\t ]*//.*", "", $0 ) + outputMember( $0 ) + $0 = outputComment( comment ) +} + +function handleMember_neu() +{ + match( $0, "/\\*.*\\*/" ) + comment = substr( $0, RSTART, RLENGTH ) + if ( length(comment) == 0 ) + { + match( $0, "//.*" ) + comment = substr( $0, RSTART, RLENGTH ) + } +# else +# sub( "[\t ]*//.*", "", $0 ) + $0 = uncomment( $0 ) + outputMember( $0 ) + $0 = outputComment( comment ) +} + +# +# Trap remainder of functions and constructors, where prototypes go +# over more than one line. +# +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /((\((.*,)?)|([_a-zA-Z0-9_]+))[\t ]*(\/\/.*)?$/ { +# handleMultilineEnums() +# } + +function handleMultilineEnums( prototype ) +{ + $0 = uncomment( $0 ) + prototype = handleEnumArgs( $0 ) + prototype = uncomment( prototype ) + sub( "\{.*}[\t ]*$", "", prototype ) + outputEnum( prototype ) + if ( prototype !~ ";[\t ]*" ) + { + savename = name + $0 = handleInline() + if ( line ~ "^[\t ]*//.*$" ) + $0 = outputComment( $0 ) + else + { + if ( savename == name ) + printf( "\n" ) + } + } + else + $0 = outputComment() +} + +# +# Trap remainder of functions and constructors, where prototypes go +# over more than one line. +# +# ( name !~ "^$" ) && +# ( type !~ "enum" ) && +# /((\((.*,)?)|([_a-zA-Z0-9_]+))[\t ]*(\/\/.*)?$/ { +# handleMultilineFunctions() +# } + +function handleMultilineFunctions( prototype ) +{ + $0 = uncomment( $0 ) + prototype = handleArgs( $0 ) + prototype = uncomment( prototype ) + sub( "\{.*}[\t ]*$", "", prototype ) + outputFunction( prototype ) + if ( prototype !~ ";[\t ]*" ) + { + savename = name + $0 = handleInline() + if ( line ~ "^[\t ]*//.*$" ) + $0 = outputComment( $0 ) + else + { + if ( savename == name ) + printf( "\n" ) + } + } + else + $0 = outputComment() +} + +# +# pushLevel() and popLevel() implement a stack for classes encountered. +# This is to handle class definitions local to classes. +# pushLevel() is invoked when entering a abstract data type, and +# popLevel() is executed when leaving. +# +function pushLevel() +{ + level++ + names[level] = name + types[level] = type + hidings[level] = hiding + topName = name + +# 3.11.95 evtl auskommentieren! + hiding = "" + + if ( class == 1 ) + { + type = "class" +# hiding = "private" + } + else if ( struct == 1 ) + { + type = "struct" +# hiding = "public" + } + else if ( union == 1 ) + { + type = "union" +# hiding = "public" + } + else if ( enum == 1 ) + type = "enum" +} + +function popLevel( line ) +{ + if ( name !~ "^$" ) + { + printf( "END\n%s\n\n", name ) + oldname = name + name = names[level] + type = types[level] + hiding = hidings[level] + level-- + topName = names[level] + if ( line ~ "^[\t ]*}.*[_a-zA-Z0-9]+.*;[\t ]*(//.*)?$" ) + { + line = uncomment( line ) + sub( "^[\t ]*}[\t ]*", "", line ) + if ( line ~ "^[_a-zA-Z0-9]+" ) + line = oldname " " line + else + line = oldname line + outputMember( line ) + return outputComment() + } + return "" + } +} + +# +# Removes comments from a line. +# +function uncomment( line ) +{ + sub( "/\\*.*\\*/", "", line ) + sub( "[\t ]*//.*$", "" , line ) + return line +} + +# +# Accumulates comment blocks and outputs them, followed by a blank line. +# +function outputComment( line ) +{ + if ( line !~ "^[\t ]*//" ) + getline line + + num = 0 + while ( line ~ "^[\t ]*//" ) + { + sub( "^[\t ]*//", "", line ) + if ( line ~ "^[\t ]*=(( [a-zA-Z0-9]+[^<>]*)|(=+))[\t ]*$" ) + break + else + lines[num++] = line + + getline line + } + indent = -1 + for ( i=0; i<num; i++ ) + { + if ( lines[i] !~ "^[\t ]*=.*" ) + { + if ( match( lines[i], "^ *[^ ]" ) != 0 ) + { + if ( indent == -1 ) + indent = RLENGTH-1 + else + { + if ( RLENGTH-1 < indent ) + indent = RLENGTH-1 + } + } + } + } + blank = 0 + for ( i=0; i<num; i++ ) + { + if ( lines[i] ~ "^[\t ]*$" ) + blank++ + else + { + for ( j=0; j<blank; j++ ) + printf( "//\n" ) + blank = 0 + if ( lines[i] !~ "^[\t ]*=( <.+>)?[\t ]*" ) + { + printf( "// %s\n", substr( lines[i], indent+1 ) ) + } + else + { + sub( "^[\t ]*", "", lines[i] ) + printf( "// %s\n", lines[i] ) + } + } + } + printf( "\n" ) + if ( line ~ "^[\t ]*}.*;[\t ]*$" ) + line = popLevel( line ) + + return line +} + +# +# Checks occurences of ADT and determines if they are in fact a definition +# or a declaration. If they are definition, it will generate any superclasses +# for the ADT. +# +function handleADT( line ) +{ + # + # Check for class declaration: + # class Foo; + # + if ( line ~ "[_a-zA-Z][ <,>_0-9a-zA-Z]*[\t ]*;" ) + { + # Do nothing, this is a declaration. + return 0 + } + # + # Check for derived classes: + # class Foo : Foobar + # + else if ( line ~ "[^:]:[^:]*" ) + { + pushLevel() + match( line, ".*[^:]:[^:]?" ) + name = substr( line, RSTART, RLENGTH-1 ) + sub( ":.*", "", name ) + sub( "[\t ]*$", "", name ) + if ( template == 1) + { + if ( name ~ "<.+>" ) + { + match( name, "<.+>" ) + args = substr( name, RSTART, RLENGTH ) + sub( "[\t ]*<.+>[\t ]*", "", name ) + } + } + match( line, ":.*" ) + bases = substr( line, RSTART, RLENGTH ) + sub( ":[\t ]*", "", bases ) + sub( "[\t ]*$", "", bases ) + if ( bases !~ ",$" && bases !~ "^$" ) + { + sub( "[\t ]*\{[\t ]*$", "", bases ) + } + else + { + while ( bases ~ ".*,[\t ]*$" || bases ~ "^$" ) + { + getline contbases + contbases = uncomment( contbases ) + while ( length( contbases ) == 0 ) + { + getline contbases + contbases = uncomment( contbases ) + } + bases = bases " " contbases + } + sub( "[\t ]*\{[\t ]*$", "", bases ) + } + } + # + # Check for non-derived classes: + # class Foo + # + # else if ( line ~ "[_a-zA-Z][ <>,_0-9a-zA-Z]*(<.+>)?[\t ]*\{*$" ) + else if ( line ~ "[_a-zA-Z][ <>,_0-9a-zA-Z]*(<.+>)?[\t ]*(\{[\t ]*)?$" ) + { + pushLevel() + if ( template == 1) + match( line, "[_a-zA-Z][_0-9a-zA-Z]*" ) + else + match( line, "[_a-zA-Z][ <>,_0-9a-zA-Z]*" ) + name = substr( line, RSTART, RLENGTH ) + sub( "[\t ]*$", "", name ) + if ( template == 1) + { + sub( "[_a-zA-Z][_0-9a-zA-Z]*", "", line ) + if ( line ~ "^<" ) + { + match( line, "<.+>" ) + args = substr( line, RSTART, RLENGTH ) + } + } + } + else + { + # Discard anything else. + return 0 + } + return 1 +} + +# +# Generates the actual list of superclasses. +# +function outputSuperClasses( line ) +{ + if ( line ~ /^[\t ]*$/ ) + printf( "\n" ) + else + { + gsub( "(\t| )+", " ", line ) + narg = 0 + while ( match( line, "[^<>,# ]*<[^<>]*>" ) ) + { + narg++ + arg = substr( line, RSTART, RLENGTH ) + sub( "[^<>,# ]*<[^<>]*>", "#" narg, line ) + bargs["#" narg] = arg + # Need the following to stop resubstitution of the pattern matched + # back into the string. + gsub( "&", "\\\\&", bargs["#" narg] ) + } + num = split( line, item, "," ) + i = 1 + while ( i<=num ) + { + access = "private" + inherit = "" + + if ( item[i] ~ "[\t ]*public[\t ]*" ) + { + access = "public" + sub( "[\t ]*public[\t ]*", "", item[i] ) + } + else if ( item[i] ~ "[\t ]*protected[\t ]*" ) + { + access = "protected" + sub( "[\t ]*protected[\t ]*", "", item[i] ) + } + sub( "[\t ]*private[\t ]*", "", item[i] ) + + if ( item[i] ~ "[\t ]*virtual[\t ]*" ) + { + inherit = " virtual" + sub( "[\t ]*virtual[\t ]*", "", item[i] ) + } + + while ( match( item[i], "#[0-9]+" ) ) + { + arg = substr( item[i], RSTART, RLENGTH ) + sub( arg, bargs[arg], item[i] ) + } + sub( "^[\t ]*", "", item[i] ) + sub( "[\t ]*$", "", item[i] ) + + printf( "%s%s %s\n", access, inherit, item[i] ) + + ++i + } + printf( "\n" ) + } +} + +# +# Outputs enum prototypes. +# +function outputEnum( line ) +{ + if ( line !~ ";[\t ]*$" ) + { + sub( "[\t ]*$", ";", line ) + if ( line !~ /^[\t ]*inline[\t ]+/ ) + sub( "^[\t ]*", "inline ", line ) + } + if ( ( type ~ "class" ) && ( hiding ~ "^$" ) ) + hide = "private" + else + hide = "public" + printf( "ENUM\n%s\n%s\n", name, hiding ~ "^$" ? hide : hiding ) + gsub( "\t", " ", line ) + gsub( " +", " ", line ) + sub( "^ *", "", line ) + sub( " *$", "", line ) + sub( "( ?;)*$", ";", line ) + printf( "%s\n", line ) +} + +# +# Outputs function prototypes. +# +function outputFunction( line ) +{ + if ( line !~ ";[\t ]*$" ) + { + sub( "[\t ]*$", ";", line ) + if ( line !~ /^[\t ]*inline[\t ]+/ ) + sub( "^[\t ]*", "inline ", line ) + } + if ( ( type ~ "class" ) && ( hiding ~ "^$" ) ) + hide = "private" + else + hide = "public" + printf( "FUNC\n%s\n%s\n", name, hiding ~ "^$" ? hide : hiding ) + gsub( "\t", " ", line ) + gsub( " +", " ", line ) + sub( "^ *", "", line ) + sub( " *$", "", line ) + sub( "( ?;)*$", ";", line ) + printf( "%s\n", line ) +} + +# +# Output member variables. +# +function outputMember( line ) +{ + if ( ( type ~ "class" ) && ( hiding ~ "^$" ) ) + hide = "private" + else + hide = "public" + printf( "MEMBER\n%s\n%s\n", name, hiding ~ "^$" ? hide : hiding ) + gsub( "\t", " ", line ) + gsub( " +", " ", line ) + sub( "^ *", "", line ) + sub( " *$", "", line ) + sub( "( ?;)*$", ";", line ) + printf( "%s\n", line ) +} + +# +# Output member variables. +# +function outputMemberEnum( line ) +{ + if ( ( type ~ "class" ) && ( hiding ~ "^$" ) ) + hide = "private" + else + hide = "public" + printf( "ENUM\n%s\n%s\n", name, hiding ~ "^$" ? hide : hiding ) + gsub( "\t", " ", line ) + gsub( " +", " ", line ) + sub( "^ *", "", line ) + sub( " *$", "", line ) + sub( "( ?;)*$", ";", line ) + printf( "%s\n", line ) +} + +# +# Gathers up argument lists which cover more than one line. +# +function handleArgs( prototype ) +{ + getline line + line = uncomment( line ) + sub( "^[\t ]*", "", line ) + sub( "[\t ]*$", "", line ) + + # 3.11.95 supress preproc in fuctions args + sub( "#.*$", "", line ) + + if ( ( prototype ~ "\\($" || line ~ "^\\(" || line ~ "^\\)" ) && \ + prototype !~ ",$" ) + prototype = prototype line + else + prototype = prototype " " line + while ( \ + ( prototype !~ "\\)[\t ]*(const[\t ]*)?((\{.*)|(//.*))?$" ) \ + && \ + ( prototype !~ "\\)[\t ]*(const[\t ]*)?(=[\t ]*0[\t ]*)?;[\t ]*(//.*)?$" ) \ + && \ + ( prototype !~ "\\)[\t ]*:.*$" ) \ + ) + { + getline line + line = uncomment( line ) + sub( "^[\t ]*", "", line ) + sub( "[\t ]*$", "", line ) + + # 3.11.95 supress preproc in fuctions args + sub( "#.*$", "", line ) + + if ( ( prototype ~ "\\($" || line ~ "^\\(" || line ~ "^\\)" ) && \ + prototype !~ ",$" ) + prototype = prototype line + else + prototype = prototype " " line + } + if ( prototype ~ "\\)[\t ]*:.*$" ) + sub( "\\)[\t ]*:.*$", ")", prototype ) + else if ( prototype ~ "\\)[\t ]*\{.*$" ) + sub( "\\)[\t ]*\{.*$", ")", prototype ) + return prototype +} + +# +# Gathers up enum argument lists which cover more than one line. +# +function handleEnumArgs( prototype ) +{ + getline line + line = uncomment( line ) + sub( "^[\t ]*", "", line ) + sub( "[\t ]*$", "", line ) + if ( ( prototype ~ "\\{$" || line ~ "^\\{" || line ~ "^\\}" ) && \ + prototype !~ ",$" ) + prototype = prototype line + else + prototype = prototype " " line + while ( \ + ( prototype !~ "\\}[\t ]*(const[\t ]*)?((\{.*)|(//.*))?$" ) \ + && \ + ( prototype !~ "\\}[\t ]*(const[\t ]*)?(=[\t ]*0[\t ]*)?;[\t ]*(//.*)?$" ) \ + && \ + ( prototype !~ "\\}[\t ]*:.*$" ) \ + ) + { + getline line + line = uncomment( line ) + sub( "^[\t ]*", "", line ) + sub( "[\t ]*$", "", line ) + if ( ( prototype ~ "\\($" || line ~ "^\\(" || line ~ "^\\)" ) && \ + prototype !~ ",$" ) + prototype = prototype line + else + prototype = prototype " " line + } + if ( prototype ~ "\\}[\t ]*:.*$" ) + sub( "\\}[\t ]*:.*$", "}", prototype ) + else if ( prototype ~ "\\}[\t ]*\{.*$" ) + sub( "\\}[\t ]*\{.*$", "}", prototype ) + return prototype +} + +# +# Skips inline code. End of such code is determined when either a blank line, +# comment, or end of ADT is encountered. +# +function handleInline() +{ + getline line + while (line !~ "^[\t ]*(}.*;[\t ]*)?(//.*)?$" ) + getline line + + if ( line ~ "[\t ]*}[\t ]*[_a-zA-Z0-9]*[\t ]*;[\t ]*$" ) + { + printf( "\n" ) + popLevel( line ) + } + + if ( line ~ "^[\t ]*//.*" ) + return line + else + return "" +} + +# +# The main parsing loop. +# This implements a recursive descent parser of sorts. +# +function doParse() +{ + while ( $0 !~ "^$" ) + { + if ( $0 ~ /^[\t ]*template[\t ]*<[^:]+>[\t ]*$/ ) + { + getline line + $0 = $0 " " line + } + + if ( $0 ~ /^[\t ]*\/\/[\t ]*==+[\t ]*$/ ) + { + handleHeader() + } + else if ( $0 ~ /^[\t ]*\/\/[\t ]*= [a-zA-Z0-9]+[^<>]*[\t ]*$/ ) + { + handleInfo() + } + else if ( $0 ~ /^[\t ]*\/\/.*$/ ) + { + handleComment() + } + else if ( $0 ~ /^[\t ]*#[\t ]*define/ ) + { + handleDefine() + } + else if ( $0 ~ /^[\t ]*#[\t ]*include[\t ]*<.+>/ ) + { + handleInclude() + } + else if ( $0 ~ /^[\t ]*#[\t ]*include[\t ]*".+"/ ) + { + handleLocalInclude() + } + else if ( $0 ~ /^[\t ]*#.*$/ ) + { + handlePreprocessor() + } + else if ( $0 ~ /^[\t ]*typedef[\t ]+/ ) + { + handleTypedef() + } + else if ( $0 ~ /^extern[\t ]+/ ) + { + handleExtern() + } + else if ( $0 ~ /^[\t ]*class[\t ]/ ) + { + handleClass() + } + else if ( $0 ~ /^[\t ]*struct[\t ]/ ) + { + handleStruct() + } + else if ( $0 ~ /^[\t ]*union[\t ]/ ) + { + handleUnion() + } + else if ( $0 ~ /^[\t ]*template[\t ]*<.+>[\t ]+class[\t ]/ ) + { + handleTemplate() + } + else if ( $0 ~ /^[\t ]*enum[\t ]*.*;[\t ]*(\/\/.*)?$/ ) + { +#printf("\ntype=%s-------single------\n",type); + handleEnumFun() + } + else if ( ($0 ~ /((\((.*,)?)|([_a-zA-Z0-9_]+))[\t ]*(\/\/.*)?$/) && ( name !~ "^$" ) && ( $0 ~ /^[\t ]*enum/ ) ) + { +#printf("\ntype=%s-------multi------\n",type); + handleMultilineEnums() + } + else if ( $0 ~ /^[\t ]*}.*;[\t ]*/ ) + { + handleEndADT() + } + else if ( ( name !~ "^$" ) && ( type !~ "enum" ) ) + { + if ( $0 ~ /^[\t ]*private[\t ]*:[\t ]*(\/\/.*)?$/ ) + { + handlePrivate() + } + else if ( $0 ~ /^[\t ]*protected[\t ]*:[\t ]*(\/\/.*)?$/ ) + { + handleProtected() + } + else if ( $0 ~ /^[\t ]*public[\t ]*:[\t ]*(\/\/.*)?$/ ) + { + handlePublic() + } + else if ( $0 ~ /^[\t ]*friend[\t ]+/ ) + { + handleFriend() + } + else if ( $0 ~ /\)[\t ]*:[\t ]*.*\(.*\)[\t ]*(\{(.*})?[\t ]*)(\/\/.*)?$/ ) + { + handleInlineCtor() + } + else if ( $0 ~ /\)[\t ]*(const[\t ]*)?(\{(.*})?[\t ]*)?(\/\/.*)?$/ && + $0 !~ /^.*operator[\t ]*\(\)[\t ]*(\/\/.*)?$/ ) + { + handleInlineFunction() + } + else if ( $0 ~ /\)[\t ]*(const[\t ]*)?(=[\t ]*0[\t ]*)?;?[\t ]*(\/\/.*)?$/ && + $0 !~ /^.*operator[\t ]*\(\)[\t ]*(\/\/.*)?$/ ) + { + handleFunction() + } + else if ( $0 ~ /[\t ]*;[\t ]*(\/\/.*)?(\/\\*.*\\*\/)?$/ ) + { + handleMember() + } + else if ( $0 ~ /((\((.*,)?)|([_a-zA-Z0-9_>)]+[*&]?))[\t ]*(\/\/.*)?$/ ) + { + handleMultilineFunctions() + } + else + $0 = "" + } + else + $0 = "" + } +} diff --git a/bin/class2man b/bin/class2man new file mode 100755 index 00000000000..dd18b742712 --- /dev/null +++ b/bin/class2man @@ -0,0 +1,78 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Script to combine class2info and info2man. +# +# = AUTHOR(S) +# Graham Dumpleton +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT/$OSE_RELEASE_NAME +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/lib"} + +CLASS2INFO="$BINDIR/class2info" +INFO2MAN="$BINDIR/info2man" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` files" +} + +# +# Check usage. +# +if test "$#" = "0" +then + USAGE +fi + +while test "$#" != "0" +do + $CLASS2INFO $1 + if test "$?" != "0" + then + exit 1 + fi + file=`basename $1` + base="`echo $file | sed -e 's/\..*$//'`" + if test -f "$base.ci" + then + $INFO2MAN $base.ci + rm -f $base.ci + fi + shift +done diff --git a/bin/class2mml b/bin/class2mml new file mode 100755 index 00000000000..20453e0010b --- /dev/null +++ b/bin/class2mml @@ -0,0 +1,79 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Script to combine class2info and info2mml. +# +# = AUTHOR(S) +# Graham Dumpleton +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT/$OSE_RELEASE_NAME +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/lib"} + +CLASS2INFO="$BINDIR/class2info" +INFO2MAN="$BINDIR/info2mml" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` files" +} + +# +# Check usage. +# +if test "$#" = "0" +then + USAGE +fi + +while test "$#" != "0" +do + $CLASS2INFO $1 + if test "$?" != "0" + then + exit 1 + fi + file=`basename $1` + base="`echo $file | sed -e 's/\..*$//'`" + if test -f "$base.ci" + then + $INFO2MAN $base.ci + rm -f $base.ci + fi + shift +done diff --git a/bin/class2src b/bin/class2src new file mode 100755 index 00000000000..9feb23fe857 --- /dev/null +++ b/bin/class2src @@ -0,0 +1,79 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Generates member function stubs for the src file to standard output. +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT/$OSE_RELEASE_NAME +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/lib"} + +CLASS2INFO="$BINDIR/class2info" +INFO2SRC="$BINDIR/info2src" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` files" +} + +# +# Check usage. +# +if test "$#" = "0" +then + USAGE +fi + +while test "$#" != "0" +do + $CLASS2INFO $1 + if test "$?" != "0" + then + exit 1 + fi + file=`basename $1` + base="`echo $file | sed -e 's/\..*$//'`" + if test -f "$base.ci" + then + $INFO2SRC $base.ci $2 $3 $4 + rm -f $base.ci + fi + shift +done diff --git a/bin/classinfo.ps b/bin/classinfo.ps new file mode 100755 index 00000000000..950535ed86e --- /dev/null +++ b/bin/classinfo.ps @@ -0,0 +1,868 @@ +%!PS-Adobe-3.0 +%%BoundingBox: 54 72 558 720 +%%Creator: Mozilla (NetScape) HTML->PS +%%DocumentData: Clean7Bit +%%Orientation: Portrait +%%Pages: 9 +%%PageOrder: Ascend +%%Title: Classinfo Tools +%%EndComments +%%BeginProlog +[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright + /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one + /two /three /four /five /six /seven /eight /nine /colon /semicolon + /less /equal /greater /question /at /A /B /C /D /E + /F /G /H /I /J /K /L /M /N /O + /P /Q /R /S /T /U /V /W /X /Y + /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c + /d /e /f /g /h /i /j /k /l /m + /n /o /p /q /r /s /t /u /v /w + /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef + /space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright + /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior + /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf + /threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla + /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde + /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex + /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring + /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis + /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave + /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def +/c { matrix currentmatrix currentpoint translate + 3 1 roll scale newpath 0 0 1 0 360 arc setmatrix } bind def +/F0 + /Times-Roman findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/f0 { /F0 findfont exch scalefont setfont } bind def +/F1 + /Times-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/f1 { /F1 findfont exch scalefont setfont } bind def +/F2 + /Times-Italic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/f2 { /F2 findfont exch scalefont setfont } bind def +/F3 + /Times-BoldItalic findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/f3 { /F3 findfont exch scalefont setfont } bind def +/F4 + /Courier findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/f4 { /F4 findfont exch scalefont setfont } bind def +/F5 + /Courier-Bold findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/f5 { /F5 findfont exch scalefont setfont } bind def +/F6 + /Courier-Oblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/f6 { /F6 findfont exch scalefont setfont } bind def +/F7 + /Courier-BoldOblique findfont + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding isolatin1encoding def + currentdict end +definefont pop +/f7 { /F7 findfont exch scalefont setfont } bind def +/rhc { + { + currentfile read { + dup 97 ge + { 87 sub true exit } + { dup 48 ge { 48 sub true exit } { pop } ifelse } + ifelse + } { + false + exit + } ifelse + } loop +} bind def + +/cvgray { % xtra_char npix cvgray - (string npix long) + dup string + 0 + { + rhc { cvr 4.784 mul } { exit } ifelse + rhc { cvr 9.392 mul } { exit } ifelse + rhc { cvr 1.824 mul } { exit } ifelse + add add cvi 3 copy put pop + 1 add + dup 3 index ge { exit } if + } loop + pop + 3 -1 roll 0 ne { rhc { pop } if } if + exch pop +} bind def + +/smartimage12rgb { % w h b [matrix] smartimage12rgb - + /colorimage where { + pop + { currentfile rowdata readhexstring pop } + false 3 + colorimage + } { + exch pop 8 exch + 3 index 12 mul 8 mod 0 ne { 1 } { 0 } ifelse + 4 index + 6 2 roll + { 2 copy cvgray } + image + pop pop + } ifelse +} def +/cshow { dup stringwidth pop 2 div neg 0 rmoveto show } bind def +/rshow { dup stringwidth pop neg 0 rmoveto show } bind def +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +24 f1 0 697.5 moveto +(OSE - Tools User Guide) show +12 f2 0 668.5 moveto +(Graham Dumpleton) show +12 f2 0 655.4 moveto +(Dumpleton Software Consulting Pty Limited) show +12 f2 0 642.3 moveto +(PO BOX 3150) show +12 f2 0 629.2 moveto +(Parramatta, 2124) show +12 f2 0.2 616.1 moveto +(N.S.W, Australia) show +12 f2 0 603 moveto +(email: grahamd@nms.otc.com.au) show +0 593.9 moveto +504 0 rlineto 0 -1.4 rlineto -504 0 rlineto closepath fill +18 f1 0 557.2 moveto +(Table of Contents) show +12 f1 0 528.8 moveto +(Classinfo Tools) show +12 f0 78.3 528.8 moveto +( ) show +12 f1 28 501.7 moveto +(1 Available Programs) show +12 f0 139.3 501.7 moveto +( ) show +12 f1 28 487.9 moveto +(2 Global Sections) show +12 f0 116.6 487.9 moveto +( ) show +12 f1 28 474.1 moveto +(3 Block Formatting) show +12 f0 127.9 474.1 moveto +( ) show +12 f1 28 460.3 moveto +(4 Inline Formatting) show +12 f0 128.6 460.3 moveto +( ) show +12 f1 28 446.5 moveto +(5 Class Sections) show +12 f0 109.3 446.5 moveto +( ) show +12 f1 28 432.7 moveto +(6 Member Documentation) show +12 f0 162.6 432.7 moveto +( ) show +12 f1 28 418.9 moveto +(7 Contract Section) show +12 f0 123.3 418.9 moveto +( ) show +0 396.5 moveto +504 0 rlineto 0 -1.4 rlineto -504 0 rlineto closepath fill +24 f1 0 354 moveto +(Classinfo Tools) show +18 f1 0 318.7 moveto +(1 Available Programs) show +12 f0 0 290.8 moveto +(The documentation tools provided with the OSE build environment, allow comments in your code files,) show +12 f0 0 277.5 moveto +(to be extracted and formatted into end user documentation. To enable the tools to do this in a predictable) show +12 f0 0 264.2 moveto +(manner, the comments must be formatted according to a small set of rules. At present, the tools can) show +12 f0 0 250.9 moveto +(extract comments from C++ class header files and produce either UNIX style manual pages, of Frame) show +12 f0 0 237.6 moveto +(mml files. The tools provided are described below.) show +10 f4 0 213.7 moveto +(-------------------------------------------------------------------------------) show +10 f5 0 203.2 moveto +(Program) show +10 f4 42.2 203.2 moveto +( ) show +10 f5 72.2 203.2 moveto +(Purpose) show +10 f4 114.2 203.2 moveto +( ) show +10 f4 0 192.7 moveto +(-------------------------------------------------------------------------------) show +10 f4 0 182.2 moveto +(class2info Parses a C++ header file and produces a file which contains infor ) show +10 f4 0 171.7 moveto +( mation about the class in the header file, in a form which is more ) show +10 f4 0 161.2 moveto +( easily parsed by other tools. ) show +10 f4 0 150.7 moveto +(info2man Takes the output file from class2info and produces a UNIX ) show +10 f4 0 140.2 moveto +( style manual page for each class described in the input file. ) show +10 f4 0 129.7 moveto +(class2man Combines the programs class2info and info2man, to pro ) show +10 f4 0 119.2 moveto +( duce a UNIX style manual page for each class declaration in a ) show +10 f4 0 108.7 moveto +( header file. ) show +10 f4 0 98.2 moveto +(info2mml Takes the output file from class2info and produces a Frame ) show +10 f4 0 87.7 moveto +( mml file for each class described in the inout file. ) show +10 f4 0 77.2 moveto +(class2mml Combines the programs class2info and info2mml, to pro ) show +pagelevel restore +showpage +%%Page: 2 2 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +10 f4 0 711.9 moveto +( duce a Frame mml file for each class declaration in a header file. ) show +10 f4 0 701.4 moveto +(-------------------------------------------------------------------------------) show +12 f0 0 677.7 moveto +(Using the same front end parser as the documentation extraction tools, are the following tools:) show +10 f4 0 653.8 moveto +(----------------------------------------------------------------------------) show +10 f5 0 643.3 moveto +(Program) show +10 f4 42.2 643.3 moveto +( ) show +10 f5 66.2 643.3 moveto +(Purpose) show +10 f4 108.2 643.3 moveto +( ) show +10 f4 0 632.8 moveto +(----------------------------------------------------------------------------) show +10 f4 0 622.3 moveto +(info2src Takes the output file from class2info and produces on stan ) show +10 f4 0 611.8 moveto +( dard output, empty stub functions for each of the member func ) show +10 f4 0 601.3 moveto +( tions listed in the class declarations described in the file. ) show +10 f4 0 590.8 moveto +(class2src Combines the programs class2info and info2src, to pro ) show +10 f4 0 580.3 moveto +( duce on standard output, empty stub functions for each of the ) show +10 f4 0 569.8 moveto +( member functions listed in the class declarations described in a ) show +10 f4 0 559.3 moveto +( header file. ) show +10 f4 0 548.8 moveto +(----------------------------------------------------------------------------) show +12 f0 0 525.1 moveto +(These use information contained in a C++ class header file, to produce code stubs suitable for the) show +12 f0 0 511.8 moveto +(corresponding implementation file for that class.) show +12 f0 0 485.2 moveto +(The format which C++ class header files must adhere to is the subject of the remainder of this document.) show +18 f1 0 452.5 moveto +(2 Global Sections) show +12 f0 0 424.6 moveto +(To include a section in the manual page of each class in a header file, the comment containing the body) show +12 f0 0 411.3 moveto +(text of the section, must appear at global scope within the header file. The title of the section must) show +12 f0 0 398 moveto +(appear on a separate line, immediately prior to the body text of the section. To distinguish the title of the) show +12 f0 0 384.7 moveto +(section from the body text, you must precede it with a tag, consisting of the character `='. There must be) show +12 f0 0 371.4 moveto +(a single space only, before and after the tag. For example:) show +10 f4 0 347.5 moveto +( // = SECTION TITLE) show +10 f4 0 326.5 moveto +( // Body text.) show +12 f0 0 302.8 moveto +(Any text following the title of the section, up till the end of the comment, the start of another section, or) show +12 f0 0 289.5 moveto +(a line commencing with `==', is interpreted to be the body text for that section. Multiple sections may be) show +12 f0 0 276.2 moveto +(documented in a single comment block. Any leading, or trailing blank lines will be discarded in the) show +12 f0 0 262.9 moveto +(output. An example of a comment block containing multiple sections is given below.) show +10 f4 0 239 moveto +( // =====================================================) show +10 f4 0 218 moveto +( //) show +10 f4 0 197 moveto +( // = SECTION TITLE1) show +10 f4 0 176 moveto +( // Body text.) show +10 f4 0 155 moveto +( //) show +10 f4 0 134 moveto +( // = SECTION TITLE2) show +10 f4 0 113 moveto +( // Body text.) show +10 f4 0 92 moveto +( //) show +pagelevel restore +showpage +%%Page: 3 3 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +10 f4 0 711.9 moveto +( // =====================================================) show +12 f0 0 688.2 moveto +(Certain sections, appearing at global scope, are given special treatment in the generated manual pages.) show +12 f0 0 674.9 moveto +(These are:) show +10 f4 0 651 moveto +(-------------------------------------------------------------------------------) show +10 f5 0 640.5 moveto +(Section) show +10 f4 42 640.5 moveto +( ) show +10 f5 90 640.5 moveto +(Description) show +10 f4 156 640.5 moveto +( ) show +10 f4 0 630 moveto +(-------------------------------------------------------------------------------) show +10 f4 0 619.5 moveto +(LIBRARY The name of the library, of which the file is a part. This will ) show +10 f4 0 609 moveto +( appear in the header of each manual page. ) show +10 f4 0 598.5 moveto +(FILENAME The name of the file. This will be used in conjunction with ) show +10 f4 0 588 moveto +( the library name, to produce an include line in the synopsis. ) show +10 f4 0 577.5 moveto +(AUTHOR\(S\) The names of the authors. If the authors are placed on sepa ) show +10 f4 0 567 moveto +( rate lines, commas should not be used to terminate each line. ) show +10 f4 0 556.5 moveto +( If more than one author is placed on a single line, a comma ) show +10 f4 0 546 moveto +( should be used to separate each. ) show +10 f4 0 535.5 moveto +(COPYRIGHT The copyright applying to the contents of the file. ) show +10 f4 0 525 moveto +(VERSION The version number of the file. If using RCS, this would be ) show +10 f4 0 514.5 moveto +( set to `$Revision$'. ) show +10 f4 0 504 moveto +(DATE RELEASED The date that the current version of the file was released. If ) show +10 f4 0 493.5 moveto +( using RCS, this would be set to `$Date$'. ) show +10 f4 0 483 moveto +(RCSID The raw ID produced by RCS. Normally set to `$Id$'. ) show +10 f4 0 472.5 moveto +(SCCSID The raw ID produced by SCCS. Normally set to `%W%'. ) show +10 f4 0 462 moveto +(-------------------------------------------------------------------------------) show +12 f0 0 438.3 moveto +(Using these tags, you can construct a comment block at the start of each file, which describes the file,) show +12 f0 0 425 moveto +(authors and version of the file. For example:) show +10 f4 0 401.1 moveto +( /*) show +10 f4 0 380.1 moveto +( // ========================================================) show +10 f4 0 359.1 moveto +( //) show +10 f4 0 338.1 moveto +( // = LIBRARY) show +10 f4 0 317.1 moveto +( // OTC) show +10 f4 0 296.1 moveto +( //) show +10 f4 0 275.1 moveto +( // = FILENAME) show +10 f4 0 254.1 moveto +( // collctn/list.hh) show +10 f4 0 233.1 moveto +( //) show +10 f4 0 212.1 moveto +( // = RCSID) show +10 f4 0 191.1 moveto +( // $Id$) show +10 f4 0 170.1 moveto +( //) show +10 f4 0 149.1 moveto +( // = AUTHOR\(S\)) show +10 f4 0 128.1 moveto +( // Graham Dumpleton) show +10 f4 0 107.1 moveto +( //) show +10 f4 0 86.1 moveto +( // = COPYRIGHT) show +pagelevel restore +showpage +%%Page: 4 4 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +10 f4 0 711.9 moveto +( // Copyright 1991 1992 1993 OTC LIMITED) show +10 f4 0 690.9 moveto +( //) show +10 f4 0 669.9 moveto +( // =====================================================) show +10 f4 0 648.9 moveto +( */) show +18 f1 0 619.1 moveto +(3 Block Formatting) show +12 f0 0 591.2 moveto +(When the text of your comments appear in the manual page, they will be reformatted. If you need to) show +12 f0 0 577.9 moveto +(include an excerpt of code in the manual page, for example:) show +10 f4 0 554 moveto +( // = EXAMPLE) show +10 f4 0 533 moveto +( // void dump\(Class* theClass\)) show +10 f4 0 512 moveto +( // {) show +10 f4 0 491 moveto +( // cout << theClass->name\(\) << endl;) show +10 f4 0 470 moveto +( // }) show +12 f0 0 446.3 moveto +(it will appear as:) show +10 f4 0 422.4 moveto +( void dump\(Class* theClass\) { cout << *theClass << endl; }) show +12 f0 0 398.7 moveto +(If the example is complicated, the result will be unreadable.) show +12 f0 0 372.1 moveto +(To let the documentation tools know that the text you have included is special and should not be) show +12 f0 0 358.8 moveto +(reformatted, you can mark it as being a code example. For example:) show +10 f4 0 334.9 moveto +( // = EXAMPLE) show +10 f4 0 313.9 moveto +( // = BEGIN<CODE>) show +10 f4 0 292.9 moveto +( // void dump\(Class* theClass\)) show +10 f4 0 271.9 moveto +( // {) show +10 f4 0 250.9 moveto +( // cout << *theClass << endl;) show +10 f4 0 229.9 moveto +( // }) show +10 f4 0 208.9 moveto +( // = END<CODE>) show +12 f0 0 185.2 moveto +(The commands in this example are, `BEGIN<CODE>'and `END<CODE>'. In all cases, the format of) show +12 f0 0 171.9 moveto +(commands used to change the formatting of a block of text is:) show +10 f4 0 148 moveto +( // = BEGIN<COMMAND>) show +10 f4 0 127 moveto +( // ....) show +10 f4 0 106 moveto +( // = END<COMMAND>) show +12 f0 0 82.3 moveto +(The `BEGIN' for a command, must always have a matching `END'. The commands which are currently) show +pagelevel restore +showpage +%%Page: 5 5 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +12 f0 0 709.2 moveto +(understood by the documentation tools are:) show +10 f4 0 685.3 moveto +(--------------------------------------------------------------------) show +10 f5 0 674.8 moveto +(Command) show +10 f4 42 674.8 moveto +( ) show +10 f5 54 674.8 moveto +(Description) show +10 f4 120 674.8 moveto +( ) show +10 f4 0 664.3 moveto +(--------------------------------------------------------------------) show +10 f4 0 653.8 moveto +(INDENT Text will be indented with respect to the surrounding text. ) show +10 f4 0 643.3 moveto +(NOFILL Text will be output with indentation and formatting as it ) show +10 f4 0 632.8 moveto +( appears. ) show +10 f4 0 622.3 moveto +(CODE Text is output in `NOFILL' mode using a fixed width font. ) show +10 f4 0 611.8 moveto +(COMMENT Text will not be output. This command would be used to sur ) show +10 f4 0 601.3 moveto +( round comments about the implementation, which should not ) show +10 f4 0 590.8 moveto +( appear in the user documentation. ) show +10 f4 0 580.3 moveto +(--------------------------------------------------------------------) show +12 f0 0 556.6 moveto +(Commands may be nested, with the exception that no commands should be nested within a `CODE') show +12 f0 0 543.3 moveto +(block.) show +18 f1 0 510.6 moveto +(4 Inline Formatting) show +12 f0 0 482.7 moveto +(As well as changing the formatting of a block of text, you can change the font style used. This is done) show +12 f0 0 469.4 moveto +(by placing special sequences of characters in the body of the text. Inline formatting commands come in) show +12 f0 0 456.1 moveto +(the following three forms:) show +10 f4 0 432.2 moveto +(----------------------------------------------------------------------------------) show +10 f5 0 421.7 moveto +(Command) show +10 f4 42 421.7 moveto +( ) show +10 f5 96 421.7 moveto +(Description) show +10 f4 162 421.7 moveto +( ) show +10 f4 0 411.2 moveto +(----------------------------------------------------------------------------------) show +10 f4 0 400.7 moveto +(<text> Text between `<` and `>', is displayed in a fixed with font. ) show +10 f4 0 390.2 moveto +(<{text}> Text between `<{` and `}>', is displayed in an italic font. ) show +10 f4 0 379.7 moveto +(<[text]> Text between `<[` and `]>', is displayed in a bold font. ) show +10 f4 0 369.2 moveto +(----------------------------------------------------------------------------------) show +12 f0 0 345.5 moveto +(`<text>' should be used for all C++ keywords, function names, variable names, class names, expressions) show +12 f0 0 332.2 moveto +(etc. The others can be used to highlight text. An example of how inline formatting commands may be) show +12 f0 0 318.9 moveto +(used, follows:) show +10 f4 0 295 moveto +( // = ASSERTIONS) show +10 f4 0 274 moveto +( // Assertion checks can be placed into code using) show +10 f4 0 253 moveto +( // the <OTCLIB_ASSERT\(\)> macro. Note that you should) show +10 f4 0 232 moveto +( // <[NOT]> use an expression in the condition check,) show +10 f4 0 211 moveto +( // which has a side effect, the result of which is) show +10 f4 0 190 moveto +( // necessary for the correct operation of the) show +10 f4 0 169 moveto +( // program. The reason for this, is that assertions) show +10 f4 0 148 moveto +( // can be compiled out of your code by defining the) show +10 f4 0 127 moveto +( // <NDEBUG> symbol.) show +12 f0 0 103.3 moveto +(Since `<`, and `>' are special characters, you must prefix them with a `\\' if the actual character needs to) show +12 f0 0 90 moveto +(printed. For example:) show +pagelevel restore +showpage +%%Page: 6 6 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +10 f4 0 711.9 moveto +( <operator\\<\(\)>) show +12 f0 0 688.2 moveto +(If `{`, `}', `[` or `]' appear adjacent to either `<` or `>' in the forms described above, they will also need) show +12 f0 0 674.9 moveto +(to be prefixed with a `\\'. For example:) show +10 f4 0 651 moveto +( <\\[A-Za-z_]*>) show +18 f1 0 621.2 moveto +(5 Class Sections) show +12 f0 0 593.3 moveto +(Sections pertaining to a class, are placed in the class declaration before the initial opening brace. For) show +12 f0 0 580 moveto +(example:) show +10 f4 0 556.1 moveto +( template<class T>) show +10 f4 0 535.1 moveto +( class OTC_List : public OTC_Collection<T>) show +10 f4 0 514.1 moveto +( // = SECTION NAME) show +10 f4 0 493.1 moveto +( // Body text.) show +10 f4 0 472.1 moveto +( {) show +10 f4 0 451.1 moveto +( ...) show +10 f4 0 430.1 moveto +( };) show +12 f0 0 406.4 moveto +(These sections will only appear in the manual page for that class. Sections appearing with a class, which) show +12 f0 0 393.1 moveto +(are given special treatment in the manual page are:) show +10 f4 0 369.2 moveto +(-----------------------------------------------------------------------------) show +10 f5 0 358.7 moveto +(Section) show +10 f4 42 358.7 moveto +( ) show +10 f5 78 358.7 moveto +(Description) show +10 f4 144 358.7 moveto +( ) show +10 f4 0 348.2 moveto +(-----------------------------------------------------------------------------) show +10 f4 0 337.7 moveto +(TITLE A one line description of the class. This will be used in the ) show +10 f4 0 327.2 moveto +( `NAME' section of the manual page. ) show +10 f4 0 316.7 moveto +(CLASS TYPE The type of class. For example: Abstract or Concrete. ) show +10 f4 0 306.2 moveto +(AUDIENCE Who may use the class. For example, the class may only be ) show +10 f4 0 295.7 moveto +( of interest to the class librarian. ) show +10 f4 0 285.2 moveto +(DESCRIPTION A description of the class. ) show +10 f4 0 274.7 moveto +(NOTES Any special features, unimplemented but desirable features, ) show +10 f4 0 264.2 moveto +( side effects, or known bugs. ) show +10 f4 0 253.7 moveto +(SEE ALSO References to any associated documents, systems or classes. ) show +10 f4 0 243.2 moveto +( If listed separately on each line, no comma should be used at ) show +10 f4 0 232.7 moveto +( the end of the line. If more than one appears on a single line, ) show +10 f4 0 222.2 moveto +( a comma should be used to separate them. ) show +10 f4 0 211.7 moveto +(EXAMPLE If realistic, a brief example of how the class may be used. ) show +10 f4 0 201.2 moveto +( Copious examples should not be included here, but should be ) show +10 f4 0 190.7 moveto +( described in a separate user guide. ) show +10 f4 0 180.2 moveto +(-----------------------------------------------------------------------------) show +18 f1 0 150.4 moveto +(6 Member Documentation) show +12 f0 0 122.5 moveto +(Documentation for member variables and member functions do not have to be tagged, as has been the) show +12 f0 0 109.2 moveto +(case so far. It does however have to be put in a certain place with respect to the member variable or) show +12 f0 0 95.9 moveto +(function declaration. The locations, where comments related to a member function or variable can be) show +12 f0 0 82.6 moveto +(placed, are on the same line as the declaration following the semi-colon,) show +pagelevel restore +showpage +%%Page: 7 7 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +10 f4 0 706.7 moveto +( void func1\(\); // Comment) show +10 f4 0 685.7 moveto +( void func2\(\); // Comment) show +12 f0 0 662 moveto +(or on the line immediately following the declaration.) show +10 f4 0 638.1 moveto +( void func1\(\);) show +10 f4 0 617.1 moveto +( // Comment) show +10 f4 0 585.6 moveto +( void func2\(\);) show +10 f4 0 564.6 moveto +( // Comment) show +12 f0 0 540.9 moveto +(The comment may extend over more than one line. A comment for a particular member variable or) show +12 f0 0 527.6 moveto +(function will be terminated by any line which doesn't contain only a comment. A comment will only be) show +12 f0 0 514.3 moveto +(associated with the declaration which immediately preceeds it. For example:) show +10 f4 0 490.4 moveto +( void func1\(\);) show +10 f4 0 469.4 moveto +( void func2\(\);) show +10 f4 0 448.4 moveto +( // Comment) show +12 f0 0 424.7 moveto +(the comment is associated with func2\(\) only and not func1\(\).) show +12 f0 0 398.1 moveto +(If a member function is defined inline, the comment must be placed after the code. For example:) show +10 f4 0 374.2 moveto +( void func1\(\) { ... }) show +10 f4 0 353.2 moveto +( // Comment) show +10 f4 0 321.7 moveto +( void func2\(\)) show +10 f4 0 300.7 moveto +( { ... }) show +10 f4 0 279.7 moveto +( // Comment) show +12 f0 0 256 moveto +(A limitation of the extraction tools, currently requires that you do not place comments, or blank lines,) show +12 f0 0 242.7 moveto +(within the body of the inline code.) show +18 f1 0 210 moveto +(7 Contract Section) show +12 f0 0 182.1 moveto +(Contracts allow grouping of related member functions and variables. This) show +12 f0 0 155.5 moveto +(makes it easier to find a function which serves the purpose you require.) show +12 f0 0 128.9 moveto +(A contract is a grouping of operations which fulfill a responsibility of the class. Contracts could include:) show +18.1 106.4 moveto +3.3 3.3 c fill +12 f0 28 102.3 moveto +(Initialisation of the class.) show +18.1 93.1 moveto +3.3 3.3 c fill +12 f0 28 89 moveto +(Destruction of the class.) show +18.1 79.8 moveto +3.3 3.3 c fill +12 f0 28 75.7 moveto +(The ability to insert items into, or modify a particular aspect of a class.) show +pagelevel restore +showpage +%%Page: 8 8 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +18.1 713.3 moveto +3.3 3.3 c fill +12 f0 28 709.2 moveto +(The ability to make queries about a class or iterate over data it contains.) show +12 f0 0 682.6 moveto +(A contract section is started by placing a comment containing the section title, prior to the functions in) show +12 f0 0 669.3 moveto +(the class that are being grouped together. The list of functions in a contract is terminated by the) show +12 f0 0 656 moveto +(commencement of another contract, a new public, protected, or private section, or the end of the class.) show +12 f0 0 629.4 moveto +(If contract sections are used, only functions which appear under a contract section will appear in the) show +12 f0 0 616.1 moveto +(manual page. Functions which are not in a contract section are not displayed. If no contract sections are) show +12 f0 0 602.8 moveto +(used, two default contract sections, with labels `PROTECTED MEMBERS' and `PUBLIC) show +12 f0 0 589.5 moveto +(MEMBERS', will be created.) show +12 f0 0 562.9 moveto +(An example of a class using contracts is:) show +10 f4 0 539 moveto +( class Class) show +10 f4 0 518 moveto +( // ...) show +10 f4 0 497 moveto +( {) show +10 f4 0 476 moveto +( public:) show +10 f4 0 444.5 moveto +( ~Class\(\);) show +10 f4 0 423.5 moveto +( // This will not appear in the) show +10 f4 0 402.5 moveto +( // manual page.) show +10 f4 0 371 moveto +( // = INITIALISATION) show +10 f4 0 339.5 moveto +( Class\(char const* theString\);) show +10 f4 0 318.5 moveto +( // This will appear in the manual) show +10 f4 0 297.5 moveto +( // page in section INITIALISATION.) show +10 f4 0 276.5 moveto +( //) show +10 f4 0 255.5 moveto +( // Inline formatting, for example:) show +10 f4 0 234.5 moveto +( // <theString>, may be used, as may) show +10 f4 0 213.5 moveto +( // block formatting commands.) show +10 f4 0 182 moveto +( // = QUERY) show +10 f4 0 161 moveto +( // As with all other sections, a contract) show +10 f4 0 140 moveto +( // section can have body text. This will appear) show +10 f4 0 119 moveto +( // in the manual page after the section name and) show +10 f4 0 98 moveto +( // before the functions are listed.) show +pagelevel restore +showpage +%%Page: 9 9 +%%BeginPageSetup +/pagelevel save def +54 0 translate +%%EndPageSetup +newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath +10 f4 0 711.9 moveto +( char const* string\(\);) show +10 f4 0 680.4 moveto +( // Extra information for the current contract may) show +10 f4 0 659.4 moveto +( // also be included between members. This is) show +10 f4 0 638.4 moveto +( // generally used where it is necessary to make a) show +10 f4 0 617.4 moveto +( // comment about a specific set of members in a) show +10 f4 0 596.4 moveto +( // contract.) show +10 f4 0 564.9 moveto +( OTC_Boolean isValid\(\) const;) show +10 f4 0 543.9 moveto +( };) show +10 f4 0 522.9 moveto +( ) show +pagelevel restore +showpage +%%EOF diff --git a/bin/clone.1 b/bin/clone.1 new file mode 100644 index 00000000000..7c36d90fd85 --- /dev/null +++ b/bin/clone.1 @@ -0,0 +1,297 @@ +.TH CLONE 1 "6 June 1989" "" +.SH NAME +clone \- make a clone of an entire directory tree +.SH SYNOPSIS +.B clone +[ +.B -q +] [ +.B -v +] [ +.B -f +] [ +.B -c | -s +] [ +.B -S +] +.I "dir1 dir2" +.SH DESCRIPTION +.I Clone +makes an identical copy of an entire (source) directory tree rooted at +the directory named +.I dir1 +into the (target) directory tree +rooted at +.I dir2. +The target directory +.I dir2 +will be created if it does not already exist. +On the other hand, if the directory +.I dir2 +exists, or if the +.I dir2 +directory has any existing subdirectories, then these +directories will +.B not +be deleted or replaced by +.I clone. +.PP +.I Clone +normally creates the clone +directory tree by creating any new directories needed +beneath +.I dir2 +(possibly including +.I dir2 +itself). +.I Clone +then fills in the new directories with hard links +to all of the files in the original (source) directory tree +.I dir1 +such that the new (target) directory tree appears to also contain +all of the files and subdirectories contained in the original (source) +directory tree. +Hard links are normally used when creating +.I clones +of the files in the source directory tree +inside the new (target) directory tree. +This insures that the cost (in disk space) of +.I cloning +a given source directory tree will be very low. +If desired, the new (clone) directory tree can be filled in with +symbolic links or with actual copies of the original files (instead of +using hard links). +.PP +.I Clone +may be particularly useful for maintaining multiple versions +of nearly identical source trees. +.PP +An important feature of +.I clone +is that the +.I dir2 +argument may already exist and may already contain some +files and subdirectories. In such cases, +.I clone +does not disturb these existing files or subdirectories. +Rather, it simply adds the material from the source directory, +.I dir1, +to the material already present within +.I dir2. +In cases where +there are conflicts between files or directories which +already exist in +.I dir2 +but which also exist in +.I dir1, +.I clone +(by default) leaves the files or directories in the target directory +.I dir2 +untouched unless the +.B -f +(force) flag is used, in which case, +.I clone +will override (i.e. delete) the conflicting entries +from the target directory +.I dir2 +and replace them with clones from the source directory +.I dir1. +.SH OPTIONS +.I Clone +recognizes the following options: +.TP +.BI \-q +Quite mode. Suppress all warnings and non-fatal error messages. +.TP +.BI \-v +Verbose mode. Print verbose messages which describe each individual +linking (or copying) action, as well as all +.I mkdir +actions that +.I clone +executes. +.TP +.BI \-f +Force mode. In cases where an item (i.e. either a file or a directory) +exists in the source directory tree +.I dir1, +and also already exists in the target directory tree +.I dir2, +delete the item (ether a file or a directory) in +the target directory tree and then replace it with a clone +of the corresponding item from the source directory tree. +All such deletions causes warning to be issued to +.I stderr +unless the +.B \-q +(quite mode) +option is also specified. +Note that if a given item already exists in the target directory tree, +and if it also exists in the source directory tree, and if both the +(existing) source and target items are themselves directories, then the +.B \-f +option has no effect for these items. Existing directories in the +target directory tree are never deleted by +.I clone +unless there is a corresponding item in the source directory tree which is +.B not +a directory (i.e. is a regular file) and the +.B \-f +option is in effect. +.TP +.BI \-s +Symbolic link mode (not available on System V). When used, this +option causes all non-directory files to be +.I cloned +by making symbolic links from the target directory tree into the source +directory tree. This mode overrides the default mode in which +hard links are used to clone all non-directory files. +.TP +.BI \-c +Copy mode. +In this mode, a physical copy of each non-directory file in the source directory +tree is created in the target directory tree. Note that when this mode is used, +it is an error for the source directory tree to contain any block or character +device files, or any named pipe files. +.TP +.BI \-S +SCCS mode. +In this mode, only the source tree structure is cloned, not its contents. +Symbolic links are created within the destination tree to subdirectories +in the source tree named +.B SCCS. +This mode is useful when multiple developers work from a common SCCS project +tree. To accomplish this, each developer creates a local project tree by +.I cloning +the common SCCS project directory, specifying the +.B \-S +option. +Individual developers are then able to work within their local project tree while +ensuring that all SCCS operations are applied to the common SCCS project tree. +Use of the +.B \-S +option implies the use of the +.B \-s +option and is thus not available on System V. +.SH EXAMPLES +Assume that you have +two directory trees called +.I src1 +and +.I src2 +and that you wish to combine the contents of these +two directories into a new directory named +.I dst +such that if there are any files with duplicate names in both +.I src1 +and in +.I src2 +the files from the +.I src2 +directory tree will take precedence +over the corresponding files in the directory tree +.I src1. +The following commands would accomplish this task: +.sp 1 +.in +0.4i +.ft B +clone src1 dst +.br +clone -f src2 dst +.sp 1 +.in -0.4i +.ft R +Or alternatively, for this simple case, you could have said: +.ft B +.in +0.4i +.sp 1 +clone src2 dst +.br +clone src1 dst +.br +.sp 1 +.in -04.i +.ft R +.PP +To clone an SCCS project tree, such as +.B /pub/EOS_client_server, +one might use the following command, shown with the resulting output: +.sp 1 +.in +0.4i +.ft B +doc% clone -S -v /pub/EOS_client_server ~/EOS_CS +.br +clone: created new output directory: /home/ebupsn/EOS_CS +.br +clone: created new output directory: /home/ebupsn/EOS_CS/bin +.br +clone: created new output directory: /home/ebupsn/EOS_CS/lib +.br +clone: created new output directory: /home/ebupsn/EOS_CS/include +.br +clone: created new output directory: /home/ebupsn/EOS_CS/cmd +.br +clone: created new output directory: /home/ebupsn/EOS_CS/cmd/clone +.br +clone: created symlink /home/ebupsn/EOS_CS/cmd/clone/SCCS -> /pub/EOS_client_server/cmd/clone/SCCS +.br +clone: created symlink /home/ebupsn/EOS_CS/cmd/SCCS -> /pub/EOS_client_server/cmd/SCCS +.br +clone: created new output directory: /home/ebupsn/EOS_CS/man +.br +clone: created new output directory: /home/ebupsn/EOS_CS/man/man1 +.br +clone: created new output directory: /home/ebupsn/EOS_CS/man/man3 +.br +clone: created new output directory: /home/ebupsn/EOS_CS/man/cat1 +.br +clone: created new output directory: /home/ebupsn/EOS_CS/man/cat3 +.br +clone: created symlink /home/ebupsn/EOS_CS/SCCS -> /pub/EOS_client_server/SCCS +.br +.sp 1 +.in -0.4i +.ft R +.SH CAVEATS +On BSD systems, if there are symbolic links in the source tree, +the effects of +.I cloning +may not be what you expect. +A symbolic link within the source tree results in the creation of an +identical symbolic link within the destination tree. +A warning is issued if the symbolic link is either absolute and points +into the source directory or if the symbolic link is relative and +points out of the source tree. +.PP +If the +.B \-S +option is in effect and the source directory is itself a symbolic link +to a directory, the contents of the symbolic link are cloned in the +destination directory rather than setting the destination directory +to be an identical symbolic link. +The rational for this is as follows. +In networked environments, SCCS project directories are often configured +as NFS file systems managed by an NFS auto-mount daemon. +The NFS auto-mount daemon mounts NFS file systems in a temporary locations +and then creates symbolic links to the temporary locations. +Accesses to this symbolic links trigger the NFS auto-mount daemon. +It is therefore necessary that symbolic links in the destination tree +refer to the NFS auto-mount point symbolic link rather than to the NFS +auto-mount point itself. +Symbolic links within the source tree are ignored. +.SH WARNINGS +There are numerous possible warning and/or error messages which +.I clone +will issue for strange circumstances. +These should all be self-explanatory. +.SH FILES +.ta 1.7i +/usr/local/bin/clone The clone program +.SH "SEE ALSO" +ln(1), link(2), symlink(2), readlink(2), mkdir (1), mkdir (2) +.SH AUTHORS +Written by Ron Guilmette at the Microelectronics and Computer Technology +Corporation. Current E-mail address is rfg@ics.uci.edu. +.PP +SCCS mode added 07-April-1993 by Paul Stephenson at Ericsson Business +Communications. Current E-mail address is paul.stephenson@ebu.ericsson.se. diff --git a/bin/clone.cpp b/bin/clone.cpp new file mode 100644 index 00000000000..98d85b1baa3 --- /dev/null +++ b/bin/clone.cpp @@ -0,0 +1,955 @@ +#include "ace/OS.h" +// @(#)clone.cpp 1.1 10/18/96 + + +#if 0 +#if defined (USG) +#define lstat stat +#else +extern "C" char *getwd (char *); +#define getcwd(str,len) (getwd(str)) +#endif +#endif + +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +#ifndef BLKDEV_IOSIZE +#define BLKDEV_IOSIZE 1024 +#endif + +extern char *sys_errlist[]; +static void clone (char* s_path, char* d_path, int sroot_flag); + +static char *pname; +static int errors = 0; + +static char* src_path = 0; +static char* dst_path = 0; + +static int quiet_flag = 0; +static int verbose_flag = 0; +static int force_flag = 0; +#ifndef USG +static int symlink_flag = 0; +#endif +static int copy_flag = 0; +static int sccs_flag = 0; + +static void +usage (void) +{ +#ifdef USG + fprintf (stderr, "%s: usage: '%s [-q][-v][-f][-c] pathname1 pathname2'\n", pname, pname); +#else + fprintf (stderr, "%s: usage: '%s [-q][-v][-f][-S][-c | -s | -S] pathname1 pathname2'\n", pname, pname); +#endif + exit (1); +} + +/* abspath(): return the absolutized pathname for the given relative + pathname. Note that if that pathname is already absolute, it may + still be returned in a modified form because this routine also + eliminates redundant slashes and single dots and eliminates double + dots to get a shortest possible pathname from the given input + pathname. The absolutization of relative pathnames is made by + assuming that the given pathname is to be taken as relative to the + first argument (cwd) or to the current directory if cwd is null. */ + +static char * +abspath (char *cwd, char *rel_pathname) +{ + static char cwd_buffer[MAXPATHLEN]; + char abs_buffer[MAXPATHLEN]; + register char *endp; + register char *p; + register char *inp = abs_buffer; + register char *outp = abs_buffer; + + /* Setup the current working directory as needed. */ + + if (!cwd) + { + if (!cwd_buffer[0]) + getcwd (cwd_buffer, MAXPATHLEN); + cwd = cwd_buffer; + } + else if (*cwd != '/') + abort (); /* base path must be absolute */ + + /* Copy the pathname (possibly preceeded by the current working + directory name) into the absolutization buffer. */ + + endp = abs_buffer; + if (rel_pathname[0] != '/') + { + p = cwd; + while (*endp++ = *p++) + continue; + *(endp-1) = '/'; /* overwrite null */ + } + p = rel_pathname; + while (*endp++ = *p++) + continue; + if (endp[-1] == '/') + *endp = (char) 0; + + /* Now make a copy of abs_buffer into abs_buffer, shortening the + pathname (by taking out slashes and dots) as we go. */ + + *outp++ = *inp++; /* copy first slash */ + for (;;) + { + if (!inp[0]) + break; + else if (inp[0] == '/' && outp[-1] == '/') + { + inp++; + continue; + } + else if (inp[0] == '.' && outp[-1] == '/') + { + if (!inp[1]) + break; + else if (inp[1] == '/') + { + inp += 2; + continue; + } + else if ((inp[1] == '.') && (inp[2] == 0 || inp[2] == '/')) + { + inp += (inp[2] == '/') ? 3 : 2; + outp -= 2; + while (outp >= abs_buffer && *outp != '/') + outp--; + if (outp < abs_buffer) + { + /* Catch cases like /.. where we try to backup to a + point above the absolute root of the logical file + system. */ + + fprintf (stderr, "%s: fatal: invalid pathname: %s\n", + pname, rel_pathname); + exit (1); + } + *++outp = (char) 0; + continue; + } + } + *outp++ = *inp++; + } + + /* On exit, make sure that there is a trailing null, and make sure that + the last character of the returned string is *not* a slash. */ + + *outp = (char) 0; + if (outp[-1] == '/') + *--outp = (char) 0; + + /* Make a copy (in the heap) of the stuff left in the absolutization + buffer and return a pointer to the copy. */ + + return strcpy ((char *) malloc (outp - abs_buffer + 1), abs_buffer); +} + +static char* +path_concat (char* s1, char* s2) +{ + int s1_len; + char* ret_val = (char *) malloc ((s1_len = strlen (s1)) + strlen (s2) + 2); + + strcpy (ret_val, s1); + ret_val[s1_len] = '/'; + strcpy (&ret_val[s1_len+1], s2); + return ret_val; +} + +/* Decide if the given path (which may be relative to . or absolute) designa +tes + a point within the original "src_path" directory, and return non-zero if +it + does, or zero otherwise. */ + +static int +in_original_tree (char* other_path) +{ + char* abs_src_path = abspath (NULL, src_path); + char* abs_src_path_slash = path_concat (abs_src_path, ""); + char* abs_other_path = abspath (NULL, other_path); + int ret_val = !strncmp (abs_src_path_slash, abs_other_path, strlen (abs_src_path_slash)); + + free (abs_src_path); + free (abs_src_path_slash); + free (abs_other_path); + return ret_val; +} + +static void +fix_mode (int new_mode, char* d_path) +{ + if (chmod (d_path, new_mode)) + { + if (!quiet_flag) + fprintf (stderr, "%s: warning: can't chmod on output entity %s: %s\n", + pname, d_path, sys_errlist[errno]); + } +} + +static int +remove_item (char* s_path, char* d_path) +{ + struct stat dst_stat_buf; + DIR* dirp; + char containing_dir[MAXPATHLEN]; + + if (lstat (d_path, &dst_stat_buf) == -1) + { + if (!quiet_flag) + fprintf (stderr, "%s: error: cannot get status of %s: %s\n", + pname, d_path, sys_errlist[errno]); + return -1; + } + + /* Before wasting a lot of time sniffing at the thing we are trying to + delete, first make sure that we have write permission into the + directory that contains this thing. Otherwise, it is all a waste + of time. */ + + if (*d_path == '/') + strcpy(containing_dir, d_path); + else + { + containing_dir[0] = '.'; + containing_dir[1] = '/'; + strcpy(containing_dir+2, d_path); + } + *(strrchr (containing_dir, '/')) = '\0'; + if (containing_dir[0] == '\0') + { + containing_dir[0] = '/'; + containing_dir[1] = '\0'; + } + if (access (containing_dir, W_OK)) + { + if (!quiet_flag) + fprintf (stderr, "%s: error: don't have write access to %s: %s\n", + pname, containing_dir, sys_errlist[errno]); + return -1; + } + + switch (dst_stat_buf.st_mode & S_IFMT) + { + case S_IFDIR: + if (access (d_path, R_OK) != 0) + { + if (!quiet_flag) + fprintf (stderr, "%s: error: don't have read permission for directory %s\n", + pname, d_path); + return -1; + } + if (access (d_path, X_OK) != 0) + { + if (!quiet_flag) + fprintf (stderr, + "%s: error: don't have search permission for directory %s\n", + pname, d_path); + return -1; + } + if (access (d_path, W_OK) != 0) + { + if (!quiet_flag) + fprintf (stderr, + "%s: error: don't have write permission for directory %s\n", + pname, d_path); + return -1; + } + if ((dirp = opendir (d_path)) == NULL) + { + if (!quiet_flag) + fprintf (stderr, + "%s: error: can't open directory %s for reading: %s\n", + pname, d_path, sys_errlist[errno]); + return -1; + } + for (;;) + { + struct dirent* dir_entry_p; + char* new_s_path; + char* new_d_path; + + if ((dir_entry_p = readdir (dirp)) == NULL) + break; + if (!strcmp (dir_entry_p->d_name, ".")) + continue; + if (!strcmp (dir_entry_p->d_name, "..")) + continue; + new_s_path = path_concat (s_path, dir_entry_p->d_name); + new_d_path = path_concat (d_path, dir_entry_p->d_name); + if (remove_item (new_s_path, new_d_path)) + { + closedir (dirp); + return -1; + } + free (new_s_path); + free (new_d_path); + } + closedir (dirp); + if (rmdir (d_path)) + { + if (!quiet_flag) + fprintf (stderr, "%s: error: can't delete existing directory %s: %s\n", + pname, d_path, sys_errlist[errno]); + return -1; + } + if (!quiet_flag) + fprintf (stderr, "%s: removed directory %s\n", + pname, d_path); + break; + + /* Note that symbolic links can be treated just like normal files + when the time comes for deleting them. Unlinking a symbolic link + just deletes the link and *not* the thing it points to. */ + + default: + if (unlink (d_path)) + { + if (!quiet_flag) + fprintf (stderr, "%s: error: can't delete existing file %s: %s\n", + pname, d_path, sys_errlist[errno]); + return -1; + } + if (!quiet_flag) + fprintf (stderr, "%s: removed file %s\n", + pname, d_path); + break; + } + return 0; +} + +#ifndef USG +static void +mk_symbolic_link (char *s_path, char *d_path) +{ + if (symlink (s_path, d_path)) + { + if (!quiet_flag) + fprintf (stderr, "%s: error: can't symlink %s to %s: %s\n", + pname, s_path, d_path, sys_errlist[errno]); + } + else + { + if (verbose_flag) + fprintf (stderr, "%s: created symlink %s -> %s\n", + pname, d_path, s_path); + } +} +#endif + +static void +mk_hard_link (char *s_path, char *d_path) +{ + if (link (s_path, d_path)) + { + if (!quiet_flag) + fprintf (stderr, "%s: error: can't link %s to %s: %s\n", + pname, s_path, d_path, sys_errlist[errno]); + } + else + { + if (verbose_flag) + fprintf (stderr, "%s: created hard link %s = %s\n", + pname, d_path, s_path); + } +} + +static void +copy_file (char *s_path, char *d_path) +{ + int input, output; + struct stat src_stat_buf; + + if (lstat (s_path, &src_stat_buf) == -1) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't get status of %s: %s\n", + pname, s_path, sys_errlist[errno]); + fprintf (stderr, "%s: input entity %s will be ignored\n", + pname, s_path); + } + return; + } + + if ((input = open (s_path, O_RDONLY, 0)) == -1) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't open input file %s: %s\n", + pname, d_path, sys_errlist[errno]); + fprintf (stderr, "%s: input file %s will be ignored\n", + pname, s_path); + } + return; + } + + if ((output = open (d_path, O_CREAT | O_WRONLY, src_stat_buf.st_mode & 07777)) == -1) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't create output file %s: %s\n", + pname, d_path, sys_errlist[errno]); + fprintf (stderr, "%s: input file %s will be ignored\n", + pname, s_path); + } + return; + } + + for (;;) + { + int rlen, wlen; + char block_buf[BLKDEV_IOSIZE]; + + if ((rlen = read (input, block_buf, BLKDEV_IOSIZE)) == -1) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: bad read from input file %s: %s\n", + pname, s_path, sys_errlist[errno]); + fprintf (stderr, "%s: input file %s was not fully copied\n", + pname, s_path); + } + break; + } + + if (rlen == 0) + break; + + if ((wlen = write (output, block_buf, rlen)) == -1 || wlen != rlen) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: bad write to output file %s: %s\n", + pname, s_path, sys_errlist[errno]); + fprintf (stderr, "%s: input file %s not fully copied\n", + pname, s_path); + } + break; + } + } + + close (output); + close (input); + + fix_mode (src_stat_buf.st_mode & 07777, d_path); + + if (verbose_flag) + fprintf (stderr, "%s: created file copy %s = %s\n", + pname, d_path, s_path); +} + +static void +symlink_SCCS (char* s_path, char* d_path) +{ + struct stat dst_stat_buf; + char symlink_buf[MAXPATHLEN]; + int count; + + if (access (d_path, F_OK)) /* Does d_path exit? */ + { + if (errno != ENOENT) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't check accessability of %s: %s\n", + pname, d_path, sys_errlist[errno]); + fprintf (stderr, "%s: input %s will be ignored\n", + pname, s_path); + } + return; + } + } + else /* d_path exists. What is it? */ + { + if (lstat (d_path, &dst_stat_buf) == -1) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: unable to get status of %s: %s\n", + pname, d_path, sys_errlist[errno]); + fprintf (stderr, "%s: input %s will be ignored\n", + pname, s_path); + } + return; + } + + if (S_ISLNK(dst_stat_buf.st_mode)) /* d_path is a symbolic link */ + { + if ((count = readlink (d_path, symlink_buf, MAXPATHLEN)) == -1) + { + fprintf (stderr, "%s: error: can't read symlink %s: %s\n", + pname, d_path, sys_errlist[errno]); + fprintf (stderr, "%s: input file %s will be ignored\n", + pname, s_path); + return; + } + symlink_buf[count] = '\0'; + + if (!strcmp(s_path, symlink_buf)) /* symlink = s_path. Done */ + { + return; + } + else /* symlink != s_path */ + { + if (force_flag) + { + if (remove_item (s_path, d_path) != 0) + return; + } + else + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: Symbolic link %s already exists \ + but does not point to %s\n", + pname, d_path, s_path); + fprintf (stderr, "%s: input s %s will be ignored\n", + pname, s_path); + } + return; + } + } + } + else /* d_path is NOT a symbolic link */ + { + if (force_flag) + { + if (remove_item (s_path, d_path)) + return; + } + else + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: output already exists: %s\n", + pname, d_path); + fprintf (stderr, "%s: input %s will be ignored\n", + pname, s_path); + } + return; + } + } + } + + if (symlink (s_path, d_path)) + { + if (!quiet_flag) + fprintf (stderr, "%s: error: can't symlink %s to %s: %s\n", + pname, s_path, d_path, sys_errlist[errno]); + } + else + { + if (verbose_flag) + fprintf (stderr, "%s: created symlink %s -> %s\n", + pname, d_path, s_path); + } +} + +static void +clone_dir (char* s_path, char* d_path) +{ + DIR* dirp; + + if (access (s_path, R_OK) != 0) + { + if (!quiet_flag) + { + fprintf (stderr, + "%s: error: don't have read permission for input directory %s\n" +, + pname, s_path); + fprintf (stderr, "%s: input directory %s will be ignored\n", + pname, s_path); + } + return; + } + + if (access (s_path, X_OK) != 0) + { + if (!quiet_flag) + { + fprintf (stderr, + "%s: error: don't have search permission for input directory %s\n", + pname, s_path); + fprintf (stderr, "%s: input directory %s will be ignored\n", + pname, s_path); + } + return; + } + + if ((dirp = opendir (s_path)) == NULL) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't open directory %s for reading: %s\n", + pname, s_path, sys_errlist[errno]); + fprintf (stderr, "%s: input directory %s will be ignored\n", + pname, s_path); + } + return; + } + + for (;;) + { + struct dirent* dir_entry_p; + char* new_s_path; + char* new_d_path; + char symlink_buf[MAXPATHLEN]; + int len; + + if ((dir_entry_p = readdir (dirp)) == NULL) + break; + if (!strcmp (dir_entry_p->d_name, ".")) + continue; + if (!strcmp (dir_entry_p->d_name, "..")) + continue; + + new_s_path = path_concat (s_path, dir_entry_p->d_name); + new_d_path = path_concat (d_path, dir_entry_p->d_name); + + if (sccs_flag && !strcmp (dir_entry_p->d_name, "SCCS")) + symlink_SCCS(new_s_path, new_d_path); + else + clone (new_s_path, new_d_path, 0); + + free (new_s_path); + free (new_d_path); + } + + closedir (dirp); +} + +static void +clone_symbolic_link (char* s_path,char* d_path) +{ + char symlink_buf[MAXPATHLEN]; + int count; + + if ((count = readlink (s_path, symlink_buf, MAXPATHLEN)) == -1) + { + fprintf (stderr, "%s: error: can't read symlink %s: %s\n", + pname, s_path, sys_errlist[errno]); + fprintf (stderr, "%s: input file %s will be ignored\n", + pname, s_path); + return; + } + symlink_buf[count] = '\0'; + + if (symlink_buf[0] == '/') /* symlink is absolute */ + { + if (in_original_tree (symlink_buf)) + { + if (!quiet_flag) + fprintf (stderr, + "%s: warning: absolute symlink points into source tree %s -> %s\n", + pname, s_path, symlink_buf); + } + } + else /* symlink is relative */ + { + char* src_root_relative = path_concat (s_path, symlink_buf); + int in_orig = in_original_tree (src_root_relative); + + free (src_root_relative); + if (!in_orig) + { + if (!quiet_flag) + fprintf (stderr, + "%s: warning: relative symlink points out of source tree %s -> %s\n", + pname, s_path, symlink_buf); + } + } + + mk_symbolic_link(symlink_buf, d_path); /* Make an identical symlink. */ +} + + +/* clone: clone the item designated by s_path as the new item d_path. */ + +#define IS_DIR(STAT_BUF) (((STAT_BUF).st_mode & S_IFMT) == S_IFDIR) + +static void +clone (char* s_path, char* d_path, int sroot_flag) +{ + struct stat src_stat_buf; + struct stat dst_stat_buf; + int dir_already_exists = 0; + char* intype = "file"; + + if (lstat (s_path, &src_stat_buf) == -1) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't get status of %s: %s\n", + pname, s_path, sys_errlist[errno]); + fprintf (stderr, "%s: input entity %s will be ignored\n", + pname, s_path); + } + return; + } + if (sccs_flag && sroot_flag && S_ISLNK (src_stat_buf.st_mode)) + { + + /* If root of the source path is a symbolic link and + SCCS cloning is enabled, clone the target of the link */ + + if (stat(s_path, &src_stat_buf) == -1) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't get status of %s: %s\n", + pname, s_path, sys_errlist[errno]); + fprintf (stderr, "%s: input entity %s will be ignored\n", + pname, s_path); + } + return; + } + } + if (IS_DIR (src_stat_buf)) + intype = "directory"; + if (access (d_path, 0)) + { + if (errno != ENOENT) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't check accessability of %s: %s\n", + pname, d_path, sys_errlist[errno]); + fprintf (stderr, "%s: input %s %s will be ignored\n", + pname, intype, s_path); + } + return; + } + } + else + { + char* outtype = "file"; + + if (lstat (d_path, &dst_stat_buf) == -1) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: unable to get status of %s: %s\n" +, + pname, d_path, sys_errlist[errno]); + fprintf (stderr, "%s: input %s %s will be ignored\n", + pname, intype, s_path); + } + return; + } + if (IS_DIR (dst_stat_buf)) + outtype = "directory"; + if (IS_DIR (src_stat_buf) && IS_DIR (dst_stat_buf)) + { + dir_already_exists = -1; + + /* Have to make sure that we have full access to the output + directory (at least temporarily). */ + + chmod (d_path, (dst_stat_buf.st_mode & 07777) | 0700); + if (access (d_path, R_OK | W_OK | X_OK) != 0) + { + if (!quiet_flag) + { + fprintf (stderr, + "%s: error: too few permissions for existing directory %s\n", + pname, d_path); + fprintf (stderr, "%s: input directory %s will be ignored\n", + pname, s_path); + } + return; + } + } + else + { + if (force_flag) + { + if (remove_item (s_path, d_path)) + return; + } + else + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: output %s already exists: %s\n", + pname, outtype, d_path); + fprintf (stderr, "%s: input %s %s will be ignored\n", + pname, intype, s_path); + } + return; + } + } + } + + switch (src_stat_buf.st_mode & S_IFMT) + { + case S_IFDIR: /* Clone a directory */ + + if (!dir_already_exists) + { + /* Don't let others sneak in. + Only we can write the new directory (for now). */ + + if (mkdir (d_path, 0700)) + { + if (!quiet_flag) + { + fprintf (stderr, "%s: error: can't create output directory %s: %s\n", + pname, d_path, sys_errlist[errno]); + fprintf (stderr, "%s: input directory %s will be ignored\n", + pname, s_path); + } + return; + } + if (verbose_flag) + fprintf (stderr, "%s: created new output directory: %s\n", + pname, d_path); + } + + clone_dir(s_path, d_path); + + /* By default, output directories which existed before this + program was executed are reset back to their original + permissions (when we are done adding things to them). For + output directories which are actually created by this program + however, these have their permissions set so that they are + essentially the same as the permissions for their corresponding + input directories, except that the owner is given full + permissions. */ + + if (dir_already_exists) + fix_mode (dst_stat_buf.st_mode & 07777, d_path); + else + fix_mode ((src_stat_buf.st_mode & 07777) | 0700, d_path); + break; + +#ifndef USG + case S_IFLNK: /* Clone a symbolic link */ + + if (!sccs_flag) + clone_symbolic_link (s_path, d_path); + break; +#endif + + default: /* Clone a normal file */ + + if (sccs_flag) + break; + +#ifndef USG + if (symlink_flag) + mk_symbolic_link(s_path, d_path); + else +#endif + if (copy_flag) + copy_file(s_path, d_path); + else + mk_hard_link(s_path, d_path); + + break; + } /* switch */ +} + +int +main (int argc, char *argv[]) +{ + char **argn; + + pname = (pname = strrchr (argv[0], '/')) ? pname+1 : argv[0]; + for (argn = argv+1; *argn; argn++) + { + if (**argn != '-') + { + if (!src_path) + src_path = *argn; + else if (!dst_path) + dst_path = *argn; + else + usage (); + } + else + { + switch (* ((*argn)+1)) + { + case 0: + fprintf (stderr, "%s: invalid option: -\n", pname); + errors = -1; + break; + + case 'q': + quiet_flag = -1; + break; + + case 'v': + verbose_flag = -1; + break; + + case 'f': + force_flag = -1; + break; + +#ifndef USG + case 'S': + sccs_flag = -1; + + if (copy_flag) + errors++; + break; +#endif + +#ifndef USG + case 's': + symlink_flag = -1; + if (copy_flag) + errors++; + break; +#endif + + case 'c': + copy_flag = -1; +#ifndef USG + if (symlink_flag) + errors++; + + if (sccs_flag) + errors++; +#endif + break; + + default: + fprintf (stderr, "%s: invalid option: -%c\n", + pname, *((*argn)+1)); + errors = -1; + } + } + } + if (errors || src_path == 0 || dst_path == 0) + usage (); +#if 0 // ndef USG + if (symlink_flag && *src_path != '/') + { + fprintf (stderr, "%s: error: source root pathname must be absolute when using -s\n", + pname); + exit (1); + } +#endif + if (access (src_path, 0) == -1) + { + fprintf (stderr, "%s: error: accessing source root entity %s: %s\n", + pname, src_path, sys_errlist[errno]); + exit (1); + } + umask (0); /* disable all masking */ + clone (src_path, dst_path, 1); + return 0; +} diff --git a/bin/clone.csh b/bin/clone.csh new file mode 100644 index 00000000000..1c14e912d64 --- /dev/null +++ b/bin/clone.csh @@ -0,0 +1,26 @@ +#!/bin/csh + +set src_root=`pwd` +set dst_root=`abspath $1` + +set subdirs=`find * -type d -print` + +mkdir $dst_root +set files=`find * \( -type d -prune \) -o -type f -print` + +if ($#files) then + ln $files $dst_root +endif + +if ($#subdirs) then + foreach subdir ($subdirs) + cd $src_root + mkdir $dst_root/$subdir + cd $src_root/$subdir + set files=`find * \( -type d -prune \) -o -type f -print` + if ($#files) then + ln $files $dst_root/$subdir + endif + end +endif +exit 0 diff --git a/bin/g++dep b/bin/g++dep new file mode 100755 index 00000000000..b149b7ff98d --- /dev/null +++ b/bin/g++dep @@ -0,0 +1,80 @@ +#! /bin/sh + +# This utility is a lightly editted version of the freed Berkeley +# script `mkdep'. The current script is intended to work for GNU G++. + +# Here is the original BSD header: +# @(#)mkdep.sh 1.7 (Berkeley) 10/13/87 +# + +PATH=/bin:/usr/bin:/usr/ucb:/usr/gnu:/usr/gnu/bin:/opt/gnu/bin:/pkg/gnu/bin:$PATH +export PATH + +if [ $# = 0 ] ; then + echo 'usage: g++dep [-p] [-f makefile] [flags] file ...' + exit 1 +fi + +MAKE=Makefile # default makefile name is "Makefile" +case $1 in + # -f allows you to select a makefile name + -f) + MAKE=$2 + shift; shift ;; + + # the -p flag produces "program: program.c" style dependencies + # so .o's don't get produced + -p) + SED='-e s;\.o;;' + shift ;; + # -r allows the use of relative pathnames... + -r) + REL="-e s;$WRAPPER_ROOT;\$(WRAPPER_ROOT);g" + shift ;; +esac + +if [ ! -w $MAKE ]; then + echo "g++dep: no writeable file \"$MAKE\"" + exit 1 +fi + +TMP=/tmp/g++dep$$ + +trap 'rm -f $TMP ; exit 1' 1 2 3 13 15 + +cp $MAKE ${MAKE}.bak + +sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP + +cat << _EOF_ >> $TMP +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +_EOF_ + +gcc -MM $* | /bin/sed -e "s; \./; ;g" $SED $REL | \ + awk ' { \ + if ($1 != prev) { \ + if (rec != "") \ + print rec; rec = $0; prev = $1; \ + } \ + else { \ + if (length(rec $2) > 78) { \ + print rec; rec = $0; \ + } else \ + rec = rec " " $2 \ + } \ + } \ + END { \ + print rec \ + } ' >> $TMP + +cat << _EOF_ >> $TMP + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY +_EOF_ + +# copy to preserve permissions +cp $TMP $MAKE +rm -f ${MAKE}.bak $TMP +exit 0 diff --git a/bin/hiding.fmt b/bin/hiding.fmt new file mode 100644 index 00000000000..e77a719aee2 --- /dev/null +++ b/bin/hiding.fmt @@ -0,0 +1,20 @@ +# +# access control file for ADTs +# +# K. Dorn +# + +CSAMERGECXXHXX +off + +CSAHEADER +on + +PUBLIC +on + +PROTECTED +on + +PRIVATE +on diff --git a/bin/html-windex b/bin/html-windex new file mode 100755 index 00000000000..2a80ae85f6b --- /dev/null +++ b/bin/html-windex @@ -0,0 +1,33 @@ +#!/bin/sh +# +# This script generates automatically to its stdout a windex.html file; +# this file is useful just after running man2html. +# All the html man pages must be located under an html directory at the +# same level as the generated windex.html file. +# + + +WINDEX=$1 + +cat <<EOF + <!-- This is an automatically generated file. Do Not Edit! + Use windex2html to generate it --> + <center><h1>ACE Wrappers Man Pages Index</h1></center> + <p> + This file has been generated from the <i>windex</i> file from the ACE package + and it contains a list of pointers to the man2html'ed man pages. + <p> + <HR> + <UL> +EOF + +cat $WINDEX | \ + sed -e 's/ / /g' \ + -e 's%\(3\).*-%3\)</a>%g' \ + -e 's/^[a-zA-Z_]*/&\.html">/g' \ + -e 's/\.PP/<BR>/g' \ + -e 's%^%<li><a HREF="html/%g' \ + -e 's%\\f(CO[a-zA-Z_]*%<CODE>&</B></I></CODE>%g' \ + -e 's%\\f(CO%%g' + +echo "</UL>" diff --git a/bin/info2doc.awk b/bin/info2doc.awk new file mode 100755 index 00000000000..de2016e83fb --- /dev/null +++ b/bin/info2doc.awk @@ -0,0 +1,2181 @@ +# ============================================================================= +# +# = DESCRIPTION +# Awk script which performs the actual conversion from classinfo file +# to various types of documentation. +# +# = AUTHOR(S) +# Graham Dumpleton +# K.Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED +# +# ============================================================================= + +BEGIN { + # + # Set some defaults. + # + #device = "text" +# access["public"] = "on" +# access["protected"] = "on" +# access["private"] = "on" + access["public"] = publ + access["protected"] = prot + access["private"] = priv + + lower["CLASS"] = "class" + lower["STRUCT"] = "struct" + lower["UNION"] = "union" + lower["class"] = "class" + lower["struct"] = "struct" + lower["union"] = "union" + upper["public"] = "PUBLIC" + upper["protected"] = "PROTECTED" + upper["private"] = "PRIVATE" + + classfunc = "" + rettyp = "" + classname="" + classtitle="" + filedate="" + filename="" + filename1="" + origfile="" + author="" + classdescription="" + firsttime = "first" + nesting_level = 0 + +# csaprintheader=1 + + # + # Check that info file, class have been specified. + # + # if ( infile ~ /^$/ || class ~ /^$/ ) + # exit + + # + # Read in info file. + # + # FS="\n"; RS="" + # while ( getline < infile > 0 ) + # lines[++num] = $0 + + # + # Prepare for format file. + # + FS=" "; RS="\n" + + # + # Find some defaults in info file. + # + # findLibrary() + # findFilename() +} +# end of Begin section!!!!! + + +# +# +# +function csa_print_compilation_header_alt() +{ + if (csaprintheader == "on") + { + if ( length( firsttime ) > 3 ) + { + + csa_compilation_header=sprintf("\n/*[ Compilation unit "\ + "----------------------------------------------------------\n"\ + "\n"\ + " Component\ \ \ \ \ \ \ : CSA - OSC\n"\ + "\n"\ + " Name\ \ \ \ \ \ \ \ \ \ \ \ : %s.h\n"\ + "\n"\ + " Author : %s\n"\ + "\n"\ + " Language : C++\n"\ + "\n"\ + " Creation Date : %s\n"\ + "\n"\ + " Test State : %%Q%%\n"\ + "\n"\ + " Description : %s\n"\ + " %s\n"\ + "\n"\ + "\n"\ + " Copyright (C) Siemens AG 1995 All Rights Reserved\n"\ + "\n"\ + "--------------------------------------"\ + "---------------------------------------*/\n"\ + "/*] END */\n"\ + "#pragma ident \"%%Z%% %%M%% %%I%% (%%G%%), %%Y%% %%Q%%:"\ + " implementation file for class \n"\ + "%s\"\n"\ + "\n"\ + "#undef __STDC__\n"\ + "#undef __GNUG__\n"\ + "\n",filename1,author,filedate,classtitle,classdescription,classname); + printf("%s",csa_compilation_header); + firsttime = "" + } + } +} +# +# +# +function csa_print_compilation_header() +{ + if ((csaprintheader == "on" && merge != "on") || (merge == "on" && loop == "1")) + { + if ( length( firsttime ) > 3 ) + { + for ( i=0; i<=num; i++ ) + { + n = split( lines[i], line, "\n" ) + if (line[1] == "INCLUDE" && line[2] !~ /^.*\.\i/) + printf( "#include %s\n", line[2]) + } + + + csa_compilation_header=sprintf(vcohxx,filename1,author,filedate,classtitle,classdescription,classname); + printf("%s",csa_compilation_header); + firsttime = "" + } + } +} + +# +# +# +function csa_print_class_header_alt() +{ + if (csaprintheader == "on") + { + csa_class_header=sprintf("\n/*[ Class ---------------------"\ + "-------------------------------------------\n"\ + "\n"\ + " Name : %s\n"\ + "\n"\ + " Description : %s\n"\ + " %s\n"\ + "\n"\ + "--------------------------------------------"\ + "------------------------------*/\n\n",class,classtitle,classdescription) + + if ( device != "text" ) + print( ".nf\n" ) + printf("%s",csa_class_header); + } +} +# +# +# +function csa_print_class_header() +{ + if (csaprintheader == "on") + { + csa_class_header=sprintf(vclhxx,class,classtitle,classdescription) + + if ( device != "text" ) + print( ".nf\n" ) + printf("%s",csa_class_header); + } +} + +# +# +# +function csa_print_class_end() +{ + if (csaprintheader == "on") + { + csa_class_end=sprintf("\n/*] END Class */\n\n") + + if ( device != "text" ) + print( ".nf\n" ) + printf("%s",csa_class_end); + } +} + +# +# +# +function csa_collect_info() +{ + classdescription = "" + classtitle = "" + found = 0 + for ( i=0; i<=num; i++ ) + { + + n = split( lines[i], line, "\n" ) + + csa_get_filedate_and_name() + csa_get_class_name_and_title(n) + csa_get_library() + csa_get_author() + + + + if ( line[1] == "INFO" && + line[2] == "HDR" && + line[3] == "DESCRIPTION" && + line[4] == class ) + { + found = 1 + break + } + + } + if ( found == 1 ) + { + for ( i=5; i<=n; i++ ) + { + len = length(line[i]) + comm = substr(line[i],4,len) + classdescription = classdescription comm "\n " + } + } + + found = 0 + + csa_get_origfile_name() +} + +# +# +# +function csa_get_origfile_name() +{ + len=length(infile) + origfile=substr(infile,1,len-2) + origfile = origfile "h" +} + +# +# +# +function csa_get_author() +{ + if ( line[1] == "INFO" && + line[2] == "GLOBAL" && + line[3] == "AUTHOR" ) + { + len=length(line[4]) + author=substr(line[4],4,len) + } +} + +# +# +# +function csa_get_library() +{ + if ( line[1] == "INFO" && + line[2] == "GLOBAL" && + line[3] == "LIBRARY" ) + { + #library=line[4] + } +} + +# +# +# +function csa_get_class_name_and_title(n) +{ + if ( line[1] == "INFO" && + line[2] == "HDR" && + line[3] == "TITLE" && + line[4] == class ) + { + classname=line[4] +# classtitle=line[5] +# len = length(line[5]) +# classtitle = substr(line[5],4,len) + for ( j=5; j<=n; j++ ) + { + len = length(line[j]) + comm = substr(line[j],4,len) + classtitle = classtitle comm "\n " + } + } +} + +# +# +# +function csa_get_filedate_and_name() +{ + if ( line[1] == "CLASS2INFO" ) + { + filedate=line[2] + filename=line[3] + len=length(line[3]) + filename1=substr(line[3],1,(len-2)) + } +} + +# +# +# +function csa_get_() +{ +} + +# +# +# +function read_ci_file() +{ + while ( getline < infile > 0 ) + lines[++num] = $0 +} + +function read_fvclhxx_file() +{ + vclhxx1 = "\n" + while ( getline < fvclhxx > 0 ) + vclhxx1 = vclhxx1 $0 "\n" + vclhxx = vclhxx1 +} + +function read_fvcohxx_file() +{ + vcohxx1 = "\n" + while ( getline < fvcohxx > 0 ) + vcohxx1 = vcohxx1 $0 "\n" + vcohxx = vcohxx1 +} + +# +# currently not used because not necessary (in recursion properly handled!) +# +function read_ci_file_and_modify() +{ + while ( getline < infile > 0 ) + { + if ($1 ~ "^(CLASS|STRUCT|UNION)$" && $2 ~ "(::|<)") + { +#printf("\n----old=|%s|-----\n",$2) + n = split( $0, line, "\n" ) + len = length($2) + match( $2, "(::|<).*$") + $2 = substr( $2,RSTART+2,RLENGTH) +#printf("\n----new=|%s|-----\n",$2) + + line[1] = $1 "\n" + line[2] = $2 + new = "" + for (i=1; i<=(n+1) ;i++) + new = new line[i] + lines[++num] = new "\n" + } + else + lines[++num] = $0 "\n" + + } + +# for (i=1; i<=num ;i++) +# print lines[i] +} + +# +# Start next pass. +# +$1 == "start" { + + if ( pass == 0) + { + # + # Check that info file, class have been specified. + # + if ( infile ~ /^$/ || class ~ /^$/ ) + exit + + # + # Read in info file. + # + FS="\n"; RS="" + + read_ci_file() + FS=" "; RS="\n" + if (csaprintheader == "on") + { + read_fvclhxx_file() + read_fvcohxx_file() + } + # + # Prepare for format file. + # + FS=" "; RS="\n" + + # + # Find some defaults in info file. + # + findLibrary() + findFilename() + } + + pass++ +} + +# +# Sets the output device to use. +# +# $1 == "set" && $2 == "device" { +# device = $3 +# } + +# +# Prevents a section from being printed. +# +$1 == "hide" && $2 == "section" { + section = $3 + for ( i=4; i<=NF; i++ ) + section = " " section + sections[section] = "" +} + +# +# Prevents a contract from being printed. +# +# Note: a contract will not be displayed if it occurs in a part of the class +# which has been disabled. For instance, if anything occuring in the private +# section of a class is being hidden, the no contracts from that section will +# be displayed either. +# +$1 == "hide" && $2 == "contract" { + contract = $3 + for ( i=4; i<=NF; i++ ) + contract = " " contract + contracts[contract] = "" +} + +# +# Specification of whether a part of a class is hidden or not. +# +$1 == "set" && $2 in access { + access[$2] = $3 +} + +# +# Print a prelude. This should produce any stuff necessary to initialise +# the document. +# +pass == "2" && $1 == "print" && $2 == "prelude" { + "date" | getline date + split ( date, d, " " ) + date = d[2] " " d[3] ", " d[6] + if ( device == "text" ) + { + } + else if ( device == "troff" ) + { + print( ".\\\" troff -man %" ) + print( ".\\\"" ) + print( ".\\\" DO NOT EDIT" ) + print( ".\\\"" ) + print( ".\\\" This manual page is automatically generated by class2man." ) + print( ".\\\"" ) + print( ".ds sL " library ) + print( ".ds sV " date ) + print( ".ds sC " class ) + print( ".ds sS 3" ) + print( ".TH \"\\*(sC\" \"\\*(sS\" \"\\*(sV\" \"\\*(sL Library\" \"\\*(sL Reference Manual\"" ) + } + else if ( device == "mml" ) + { + print( "<MML>" ) + print( "<Comment *** This file is automatically generated by class2mml.>" ) + print( "<!DefineTag Body>" ) + print( "<!DefineTag Heading1>" ) + print( "<!DefineTag Heading2>" ) + print( "" ) + } +} + +# +# Print out a title. +# The title should be generated from the class name and any information +# in the section labelled 'TITLE" which occurs in the hdr of a class. +# On pass 1 we simply note that we intend using the 'TITLE' section so +# that it doesn't get printed out as a seperate section. +# +pass == "1" && $1 == "print" && $2 == "title" { + sections["TITLE"] = "" +} + +# +# On pass 2 we actually print the title. +# Note: even if a 'TITLE' section is not found for the class, then the class +# name at least should be output. +# +pass == "2" && $1 == "print" && $2 == "title" { + found = 0 + for ( i=0; i<=num; i++ ) + { + n = split( lines[i], line, "\n" ) + if ( line[1] == "INFO" && + line[2] == "HDR" && + line[3] == "TITLE" && + line[4] == class ) + { + found = 1 + break + } + } + if ( device == "text" ) + { + if ( found == 1 ) + { + print( class " " ) + for ( i=5; i<=n; i++ ) + outputLine( line[i] ) + } + else + print( class ) + } + else if ( device == "troff" ) + { + print( ".PP" ) + print( ".SH \"NAME\"" ) + if ( found == 1 ) + { + print( class " \\- " ) + for ( i=5; i<=n; i++ ) + outputLine( line[i] ) + } + else + print( class ) + } + else if ( device == "mml" ) + { + print( "<Heading1>" ) + print( class ) + if ( found == 1 ) + { + print( "<Body>" ) + for ( i=5; i<=n; i++ ) + outputLine( line[i] ) + } + } +} + +# +# On pass 1 we actually store the class description for csa. +# +pass == "1" { + if (csaprintheader == "on") + csa_collect_info() +} + +# +# Print a synopsis. +# This should include a line indicating which header file needs to be included +# and a description of the members variables and functions in the class. +# A section of the class should not be output if access["section"] == "off". +# e.g.: Don't print private stuff if access["private"] == "off". +# +# +# das ist die standard ausgabe! (nur hier!) +# +pass == 2 && $1 == "print" && $2 == "synopsis" { + + + if (csaprintheader == "on") + csa_print_compilation_header() + + if ( device == "text" ) + { + print( "\ "SYNOPSIS"\ " ) + print( "\n" ) + } + else if ( device == "troff" ) + { + print( ".PP" ) + print( ".SH \"SYNOPSIS\"" ) + print( ".nf\n" ) + } + else if ( device == "mml" ) + { + print( "" ) + print( "<Heading2>") + print( "SYNOPSIS" ) + printf( "<Body>" ) + printf( "<Plain>" ) + printf( "<LeftIndent 0.1in>" ) + printf( "<FirstIndent 0.1in>" ) + printf( "<Alignment l>" ) + } + + # + # check for includes + # + if ( filename != "" && library != "C++" ) + { + if ( device == "text" ) + { + if ( merge != "on") + { +# printf( "\n#include <%s/%s>\n", library,filename) +# printf( "\n#include <%s/%s>\n", library,origfile) +# print( "\n" ) + } + else + { + if ( loop == "1") + { +# printf( "\n#include <%s/%s>\n", library,filename) +# printf( "\n#include <%s/%s>\n", library,origfile) +# print( "\n" ) + } + } + } + else if ( device == "troff" ) + { + print( "\\f(CO#include <" library "/" filename ">" ) + print( "" ) + } + else if ( device == "mml" ) + { + print( "<Family Courier>#include \\<" library "/" filename "\\>" ) + print( "<HardReturn>" ) + } + + if (csaprintheader == "on") + csa_print_class_header() + + } + + bases = "" + baseindex = 0 + numfields = 0 + + # + # start searching for loop for output 1 ADTs + # + for ( i=0; i<=num; i++ ) + { + numfields = split( lines[i], line, "\n" ) + if ( line[1] ~ /(CLASS|UNION|STRUCT)/ && line[2] == class ) + { + type = lower[line[1]] + baseindex = 3 + # + # + # break heisst, jetzt ist richtige klasse gefunden, die von aussen mitgegeben wurde!!!!!! + # + + break + } + else if ( \ + line[1] == "TEMPLATE" && \ + line[2] ~ /(class|union|struct)/ && \ + line[3] == class \ + ) + { + baseindex = 5 + type = "template" + break + } + } + + # + # end of searching for loop for output 1 ADTs + # ab hier function eingesetzt! + # + +#printf("\nvor parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + class = parse_and_print_adt(class,class,class,baseindex,type) +#printf("\nafter parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + + +# +# bis hier geht parse function +# + +#till end csa_print_class_end() + + if (csaprintheader == "on") + csa_print_class_end() + +} + +# +# Print copyright holders. This must break the line before each copyright +# holder. +# +# wird im moment nicht gerufen +# +pass == "2" && $1 == "print" && $2 == "copyright" { + for ( i=0; i<=num; i++ ) + { + n = split( lines[i], line, "\n" ) + if ( line[1] == "INFO" && + line[2] == "GLOBAL" && + line[3] == "COPYRIGHT" ) + { + if ( device == "text" ) + { + print( "COPYRIGHT" ) + } + else if ( device == "troff" ) + { + print( ".PP" ) + print( ".SH COPYRIGHT" ) + } + else if ( device == "mml" ) + { + print( "" ) + print( "<Heading2>" ) + print( "COPYRIGHT" ) + printf( "<Body>" ) + printf( "<Plain>" ) + printf( "<LeftIndent 0in>" ) + printf( "<FirstIndent 0in>" ) + printf( "<SpaceAfter 8pt>" ) + } + start = 4 + for ( k=start; k<=n; k++ ) + { + if ( k != start && line[k] ~ "[\t ]*Copyright" ) + { + if ( device == "text" ) + print( "\n" ) + else if ( device == "troff" ) + print( ".br" ) + else if ( device == "mml" ) + printf( "<HardReturn>" ) + } + outputLine( line[k] ) + } + break + } + } +} + +# +# Print out any sections which have not been previously printed out and +# which are not hidden. +# +pass == "1" && $1 == "print" && $2 == "section" && $3 == "*" { + next +} + +pass == "2" && $1 == "print" && $2 == "section" && $3 == "*" { + for ( i=0; i<=num; i++ ) + { + n = split( lines[i], line, "\n" ) + if ( line[1] == "INFO" && + ( line[2] == "GLOBAL" || + ( line[2] == "HDR" && line[4] == class ) ) ) + { + if ( line[3] in sections ) + continue + else + { + section = line[3] + sections[section] = "" +#printf("\noutputSection() - 1 - called!!!!!!!!!!!!"); + outputSection() + } + } + } +} + +# +# Print out a section. +# On pass 1 only record the fact that this section will be printed. +# +pass == "1" && $1 == "print" && $2 == "section" { + section = $3 + for ( i=4; i<=NF; i++ ) + section = section " " $i + sections[section] = "" +} + +# +# Print out a section. +# On pass 2 actually print it out. +# +pass == "2" && $1 == "print" && $2 == "section" { + section = $3 + for ( i=4; i<=NF; i++ ) + section = section " " $i + found = 0 + for ( i=0; i<=num; i++ ) + { + n = split( lines[i], line, "\n" ) + if ( line[1] == "INFO" && + ( line[2] == "GLOBAL" || + ( line[2] == "HDR" && line[4] == class ) ) && + line[3] == section ) + { + found = 1 + break + } + } + if ( found == 1 ) + { +#printf("\noutputSection() - 2 - called!!!!!!!!!!!!"); + outputSection() + } +} + +# +# Print out any contracts which have not previously been printed, and +# which are not hidden. +# +# If there are no contracts in the class, then print out sections for the +# private, protected and public members; thats if they are not being hidden. +# +pass == "1" && $1 == "print" && $2 == "contract" && $3 == "\*" { + next +} + +pass == "2" && $1 == "print" && $2 == "contract" && $3 == "\*" { + for ( i=0; i<=num; i++ ) + { + n = split( lines[i], line, "\n" ) + + if ( line[1] == "INFO" && + line[2] == "BODY" && + line[4] == class ) + { + if ( line[3] in contracts ) + continue + else if ( access[line[5]] == "on" ) + { + contract = line[3] + contracts[contract] = "" + +#printf("\noutputContract() called!!!!!"); + outputContract() + } + } + } + i = 0 + for ( j in contracts ) + i++ + if ( i == 0 ) + { +#printf("\noutputClassSection() -2- called!!!!!!!\n"); + if ( access["public"] == "on" ) + outputClassSection( "public" ) + if ( access["protected"] == "on" ) + outputClassSection( "protected" ) + if ( access["private"] == "on" ) + outputClassSection( "private" ) + } +} + +# +# Print out a particular contract, regardless of whether it is hidden or +# not. +# On pass 1 we only note that the contract will be printed. +# +pass == "1" && $1 == "print" && $2 == "contract" { + contract = $3 + for ( i=4; i<=NF; i++ ) + contract = contract " " $i + contracts[contract] = "" +} + +pass == "2" && $1 == "print" && $2 == "contract" { + contract = $3 + for ( i=4; i<=NF; i++ ) + contract = contract " " $i + found = 0 + for ( i=0; i<=num; i++ ) + { + n = split( lines[i], line, "\n" ) + if ( line[1] == "INFO" && + line[2] == "BODY" && + line[4] == class && + line[3] == section ) + { + found = 1 + break + } + } + if ( found == 1 ) + { +#printf("\noutputContract() called!!!!!"); + outputContract() + } +} + +# +# Output a particular section of a class. +# This ignores whether that part is hidden. +# +pass == "2" && $1 == "print" && $3 in access { +#printf("\noutputClassSection() -1- called!!!!!!!\n"); + outputClassSection( $3 ) +} + +# +# Actually prints out a particular section of a class. +# +# +# wird nie gerufen +# +function outputClassSection( part ) +{ + start = 0 + for ( i=0; i<=num; i++ ) + { + n = split( lines[i], line, "\n" ) + if ( ( line[1] == "FUNC" || + line[1] == "MEMBER" || + line[1] == "TYPEDEF" || + line[1] == "FRIEND" ) && + line[2] == class && + line[3] == part ) + { + if ( start == 0 ) + { + start = 1 + if ( device == "text" ) + { + printf( "\n %s MEMBERS\n" ,upper[line[3]]) + } + else if ( device == "troff" ) + { + print( ".PP" ) + print( ".SH \"" upper[line[3]] " MEMBERS\"" ) + } + else if ( device == "mml" ) + { + print( "" ) + print( "<Heading2>" ) + print( upper[line[3]] " MEMBERS" ) + printf( "<Body>" ) + printf( "<Plain>" ) + printf( "<LeftIndent 0in>" ) + printf( "<FirstIndent 0in>" ) + printf( "<SpaceAfter 8pt>" ) + } + } + if ( device == "text" ) + { + print( "\n" ) + } + else if ( device == "troff" ) + { + print( ".nf" ) + } + else if ( device == "mml" ) + { + printf( "<Alignment l>" ) + } + outputPrototype( line[4] ) + if ( device == "text" ) + { + } + else if ( device == "troff" ) + { + print( ".fi" ) + print( ".RS 0.25i" ) + } + else if ( device == "mml" ) + { + printf( "<Alignment lr>" ) + printf( "<LeftIndent 0.1in>" ) + printf( "<FirstIndent 0.1in>" ) + } + for ( l=5; l<=n; l++ ) + outputLine( line[l] ) + if ( device == "text" ) + { + print( "" ) + } + else if ( device == "troff" ) + { + print( ".RE" ) + print( "" ) + } + else if ( device == "mml" ) + { + printf( "<LeftIndent 0in>" ) + printf( "<FirstIndent 0in>" ) + } + } + } +} + +# +# Once a contract has been found, this prints it out. +# +# +# wird nie gerufen +# +function outputContract() { + if ( device == "text" ) + { + print( "\ " contract "\ " ) + } + else if ( device == "troff" ) + { + print( ".PP" ) + print( ".SH \"" contract "\"" ) + } + else if ( device == "mml" ) + { + print( "" ) + print( "<Heading2>" ) + print( contract ) + printf( "<Body>" ) + printf( "<Plain>" ) + printf( "<LeftIndent 0in>" ) + printf( "<FirstIndent 0in>" ) + printf( "<SpaceAfter 8pt>" ) + } + + for ( k=6; k<=n; k++ ) + outputLine( line[k] ) + + # print( "" ) + for ( k=i+1; k<=num; k++ ) + { + n = split( lines[k], line, "\n" ) + if ( ( line[1] == "INFO" && + line[2] == "BODY" && + line[4] == class ) || + ( line[1] == "END" && + line[2] == class ) || + ( line[1] == "ACCESS" && + line[2] == class ) ) + { + break + } + else + if ( ( line[1] == "FUNC" || + line[1] == "MEMBER" || + line[1] == "TYPEDEF" || + line[1] == "FRIEND" ) && + line[2] == class ) + { + if ( device == "text" ) + { + print( "\n" ) + } + else if ( device == "troff" ) + { + print( ".nf" ) + } + else if ( device == "mml" ) + { + printf( "<Alignment l>" ) + } + outputPrototype( line[4] ) + if ( device == "text" ) + { + } + else if ( device == "troff" ) + { + print( ".fi" ) + print( ".RS 0.25i" ) + } + else if ( device == "mml" ) + { + printf( "<Alignment lr>" ) + printf( "<LeftIndent 0.1in>" ) + printf( "<FirstIndent 0.1in>" ) + } + for ( l=5; l<=n; l++ ) + outputLine( line[l] ) + if ( device == "text" ) + { + print( "" ) + } + else if ( device == "troff" ) + { + print( ".RE" ) + print( "" ) + } + else if ( device == "mml" ) + { + printf( "<LeftIndent 0in>" ) + printf( "<FirstIndent 0in>" ) + } + } + else if ( line[1] == "COMMENT" && + line[2] == "BODY" && + line[3] == class ) + { + for ( l=5; l<=n; l++ ) + outputLine( line[l] ) + # print( "" ) + } + } +} + +# +# Once a section has been found, this prints it out. +# +# +# wird nie gerufen +# +function outputSection() +{ + + if ( line[2] == "GLOBAL" ) + start = 4 + else + start = 5 + + if ( device == "text" ) + { + print( "\ " section "\ " ) + } + else if ( device == "troff" ) + { + print( ".PP" ) + print( ".SH \"" section "\"" ) + } + else if ( device == "mml" ) + { + print( "" ) + print( "<Heading2>" ) + print( section ) + if ( line[start] != "" ) + { + printf( "<Body>" ) + printf( "<Plain>" ) + printf( "<LeftIndent 0in>" ) + printf( "<FirstIndent 0in>" ) + printf( "<Alignment lr>" ) + printf( "<SpaceAfter 8pt>" ) + printf( "<Family Times>" ) + } + } + + blankLine = 0 + for ( k=start; k<=n; k++ ) + outputLine( line[k] ) +} + +# +# Removes comment delimiter from start of line. +# +function removeComment( line ) +{ + sub( "^// ?", "", line ) + return line +} + +# +# Output a line. This checks for various formatting requests and will +# appropriately expand them. +# +function outputLine( line ) +{ + line = removeComment( line ) + if ( inComment == 0 ) + { + if ( line ~ "^= BEGIN<CODE>" ) + { + inCode = 1 + if ( device == "text" ) + { + print( "\n" ) + } + else if ( device == "troff" ) + { + print( ".RS 0.25i" ) + print( ".nf\n\\f(CO" ) + } + else if ( device == "mml" ) + { + printf( "<Plain>" ) + printf( "<LeftIndent 0.2in>" ) + printf( "<FirstIndent 0.2in>" ) + printf( "<Alignment l>" ) + printf( "<Family Courier>" ) + } + } + else if ( line ~ "^= END<CODE>" ) + { + inCode = -1 + if ( device == "text" ) + { + print( "\n" ) + } + else if ( device == "troff" ) + { + print( "\\fP\n.fi" ) + print( ".RE" ) + } + else if ( device == "mml" ) + { + printf( "<LeftIndent 0in>" ) + printf( "<FirstIndent 0in>" ) + printf( "<Alignment lr>" ) + printf( "<Family Times>") + } + } + else if ( line ~ "^= BEGIN<COMMENT>" ) + inComment = 1 + else if ( line ~ "^= BEGIN<INDENT>" ) + { + if ( device == "text" ) + { + } + else if ( device == "troff" ) + print( ".RS 0.25i" ) + else if ( device == "mml" ) + { + printf( "<LeftIndent 0.2in>" ) + printf( "<FirstIndent 0.2in>" ) + } + } + else if ( line ~ "^= END<INDENT>" ) + { + if ( device == "text" ) + { + } + else if ( device == "troff" ) + print( ".RE" ) + else if ( device == "mml" ) + { + printf( "<LeftIndent 0in>" ) + printf( "<FirstIndent 0in>" ) + } + } + else if ( line ~ "^= BEGIN<NOFILL>" ) + { + inNoFill = 1 + if ( device == "text" ) + { + } + else if ( device == "troff" ) + print( ".nf" ) + else if ( device == "mml" ) + printf( "<Alignment l>" ) + } + else if ( line ~ "^= END<NOFILL>" ) + { + inNoFill = 0 + if ( device == "text" ) + { + } + else if ( device == "troff" ) + print( ".fi" ) + else if ( device == "mml" ) + printf( "<Alignment lr>" ) + } + else + { + if ( inCode > 0 ) + { + if ( device == "mml" ) + { + gsub( " ", "\\ ", line ) + gsub( "<", "\\<", line ) + gsub( ">", "\\>", line ) + if ( inCode > 1 ) + line = "<HardReturn>" line + } + print( line ) + inCode = inCode + 1 + } + else + { + gsub( "\\\\]>", "]\\fP", line ) + gsub( "\\\\}>", "]\\fP", line ) + gsub( "([^\\\\]|^)<\\[", "&<\\fB", line ) + gsub( "[^\\\\]\\]>", "&>\\fP", line ) + gsub( "<\\[<", "", line ) + gsub( "\\]>>", "", line ) + gsub( "([^\\\\]|^)<\{", "&<\\fI", line ) + gsub( "[^\\\\]}>", "&>\\fP", line ) + gsub( "<\{<", "", line ) + gsub( "}>>", "", line ) + gsub( "([^\\\\]|^)<", "&<\\f(CO", line ) + gsub( "[^\\\\]>", "&>\\fP", line ) + gsub( "<<", "", line ) + gsub( ">>", "", line ) + gsub( "\\\\<", "<", line ) + gsub( "\\\\>", ">", line ) + gsub( "\\\\", "\\\\", line ) + gsub( "\\\\fB", "fB", line ) + gsub( "\\\\fI", "fI", line ) + gsub( "\\\\fP", "fP", line ) + gsub( "\\\\f\\(CO", "f(CO", line ) + + if ( device == "mml" ) + { + if ( inNoFill > 0 ) + gsub( " ", "\\ ", line ) + + gsub( "<", "\\<", line ) + gsub( ">", "\\>", line ) + gsub( "\\\\fP", "<Family Times><Plain>", line ) + gsub( "\\\\fB", "<Bold>", line ) + gsub( "\\\\fI", "<Italic>", line ) + gsub( "\\\\f\\(CO", "<Family Courier>", line ) + + if ( inNoFill > 0 ) + { + if ( inNoFill > 1 ) + line = "<HardReturn>" line + inNoFill = inNoFill + 1 + } + } + + if ( line == "" ) + { + blankLine = 1 + } + else + { + if ( blankLine == 1 ) + { + if ( inCode == 0 ) + print( "" ) + blankLine = 0 + if ( inCode == -1 ) + inCode = 0 + } + print( line ) + } + } + } + } + else + { + if ( line ~ "^= END<COMMENT>" ) + inComment = 0 + } +} + +# +# Searches for the 'LIBRARY' section and sets 'library' to the value found. +# +function findLibrary() +{ + for ( i=0; i<=num; i++ ) + { + split( lines[i], line, "\n" ) + if ( line[1] == "INFO" && + line[2] == "GLOBAL" && + line[3] == "LIBRARY" ) + { + len=length(line[4]) + libr = substr(line[4],4,len) + library = removeComment( libr ) + break + } + } + if ( library == "" ) + library = "C++" +} + +# +# Searches for the 'FILENAME' section and sets 'filename' to the value found. +# +function findFilename() +{ + for ( i=0; i<=num; i++ ) + { + split( lines[i], line, "\n" ) + if ( line[1] == "INFO" && + line[2] == "GLOBAL" && + ( line[3] == "FILENAME" || + line[3] == "RCSID" || + line[3] == "SCCSID" ) ) + { + filename = removeComment( line[4] ) + if ( line[3] == "RCSID" ) + { + sub( "^.*\\$Id:[\t ]*", "", filename ) + sub( ",v.*$", "", filename ) + } + else if ( line[3] == "SCCSID" ) + { + sub( "^.*@\\(#\\)", "", filename ) + sub( "[\t ]+.*$", "", filename ) + } + break + } + } +} + +# +# Outputs a prototype, wrapping it if required. +# +function outputPrototype( prototype ) +{ + sub( "[\t ]*$", "", prototype ) + if ( prototype !~ "^.*;$" ) + prototype = prototype ";" + + if ( device == "text" ) + width = 70 + else if ( device == "troff" ) + width = 70 + else if ( device == "mml" ) + width = 60 + + if ( length(prototype) > width ) + { + # multiline enums,functions have no spaces at the beginning, insert it! + if ( device == "mml" ) + { + gsub( ">", "\\>", prototype ) + gsub( "<", "\\<", prototype ) + } + if ( ( funcptr = match( prototype, "^[^(]*\\([^)]*\\)\\(" ) ) !~ "0" ) + match( prototype, "^[^(]*\\([^)]*\\)" ) + else + match( prototype, "^[^(]*\\(" ) + funcname = substr( prototype, RSTART, RLENGTH ) + if ( prototype ~ "^[^(]*\\(\\)[\t ]*\\(" ) + { + funcname = funcname ")(" + sub( "^[^(]*\\(\\)[\t ]*\\(", "", prototype ) + } + else + { + if ( funcptr ~ "0" ) + sub( "^[^(]*\\(", "", prototype ) + else + sub( "^[^(]*\\([^)]*\\)\\(", "", prototype ) + } + match( prototype, "\\)([\t ]*)?(=[\t ]*0|const[\t ]*(=[\t ]*0)?)?;[\t ]*" ) + functail = substr( prototype, RSTART, RLENGTH ) + sub( "\\)([\t ]*)?(=[\t ]*0|const[\t ]*(=[\t ]*0)?)?;.*$", "", prototype ) + sub( "\\($", "", funcname ) + match( funcname, "^[\t ]*" ) + space = substr( funcname, RSTART, RLENGTH ) + if (funcname != "") + { + # multiline enums or long typedefs have no funcname, so do not print it! + if ( device == "text" ) + { + printf( funcname ) + printf( "(\n" ) +#printf("\n---funcname=|%s|----\n",funcname); + } + else if ( device == "troff" ) + { + printf( "\\f(CO" funcname ) + printf( "(\n" ) + } + else if ( device = "mml" ) + { + gsub( " ", "\\ ", space ) + gsub( " ", "\\ ", funcname ) + printf( "<Family Courier>%s(\n<HardReturn>", funcname ) + } + } + narg = 0 + while ( match( prototype, "[^<>,#]*<[^<>]*>" ) ) + { + # collect the multiple line arguments + narg++ + arg = substr( prototype, RSTART, RLENGTH ) + sub( "[^<>,#]*<[^<>]*>", "#" narg, prototype ) + fargs["#" narg] = arg + # Need the following to stop resubstitution of the pattern matched + # back into the string. + gsub( "&", "\\\\&", fargs["#" narg] ) + } + numargs = split( prototype, args, "," ) +#------ + space = "" + for (z=1; z<=(nesting_level+1); z++) + space = space " " +# printf( "%s",outspace) +#------ + + for ( m=1; m<=numargs; m++ ) + { + while ( match( args[m], "#[0-9]+" ) ) + { + arg = substr( args[m], RSTART, RLENGTH ) + sub( arg, fargs[arg], args[m] ) + } + sub( "[\t ]*", "", args[m] ) + + # print one argument + +# printf( "%s %s", space, args[m] ) + printf( "%s%s", space, args[m] ) + if ( m == numargs ) + { + # print after the last argument + + if ( device == "text" ) + print( "" ) + else if ( device == "troff" ) + print( "" ) + else if ( device == "mml" ) + printf( "\n<HardReturn>" ) + } + else + { + # print after each argument of a line + + if ( device == "text" ) + print( "," ) + else if ( device == "troff" ) + print( "," ) + else if ( device == "mml" ) + printf( ",\n<HardReturn>" ) + } + } + # print after all arguments of a multiline are printed + + if ( device == "text" ) + print( space functail "\ " ) + else if ( device == "troff" ) + print( space functail "\\fP" ) + else if ( device == "mml" ) + print( space functail "<Family Times>" ) + + } + else # prototype < width + { + # not multiline enums,functions have spaces at the beginning already! + if ( device == "mml" ) + { + gsub( ">", "\\>", prototype ) + gsub( "<", "\\<", prototype ) + } + if ( device == "text" ) + print( prototype "\ " ) + else if ( device == "troff" ) + print( "\\f(CO" prototype "\\fP" ) + else if ( device == "mml" ) + { + gsub( " ", "\\ ", prototype ) + print( "<Family Courier>" prototype "<Family Times>" ) + } + } +} + +#============================================================= +# neue rkursive parse function fuer nested ADTs +#============================================================= +function parse_and_print_adt (baseandsubclass, class, oldclass, baseindex, type) +{ + # 3.11.95 + bases = "" + + nesting_level++ + printf( "\n") +# printf("\nclass=%s oldclass=%s nesting_level=%s\n",class,oldclass,nesting_level); + if ( baseindex != 0 ) + { + for ( i=baseindex; i<=numfields; i++ ) + { + if ( bases == "" ) + bases = line[i] + else + bases = bases ", " line[i] + } + } + + outspace = "" + for (z=1; z<nesting_level; z++) + outspace = outspace " " + printf( "%s",outspace) + + if ( type == "template" ) + { + # + # ADT == template + # + for ( i=0; i<=num; i++ ) + { + split( lines[i], line, "\n" ) + +# if ( line[1] == "TEMPLATE" && line[3] == class ) + if ( line[1] == "TEMPLATE" && (line[3] == class || line[3] == baseandsubclass) ) + break + } + if ( device == "text" ) + printf( "template%s\n",line[4] ) + else if ( device == "troff" ) + printf( "template%s\n",line[4] ) + else if ( device == "mml" ) + { + sub( "<", "\\<", line[4] ) + sub( ">", "\\>", line[4] ) + printf( "<HardReturn>template%s\n",line[4] ) + } +# typestat = line[2] " " line[3] + typestat = line[2] " " class + + outspace = "" + for (z=1; z<nesting_level; z++) + outspace = outspace " " + printf( "%s",outspace) + + if ( device == "text" ) + printf( "%s", typestat ) + else if ( device == "troff" ) + printf( "%s", typestat ) + else if ( device == "mml" ) + printf( "<HardReturn>%s", typestat ) + } + else + { + # + # ADT != template + # + typestat = type " " class + if ( device == "mml" ) + printf( "<HardReturn>" ) + printf( "%s", typestat ) + } + + if ( bases != "" ) + { + # + # analyse if ADT has base classes + # + typestat = typestat " : " + printf( " : " ) + if ( length(typestat) + length(bases) > 70 ) + { + print( "" ) + if ( device == "mml" ) + printf( "<HardReturn>" ) + narg = 0 + while ( match( bases, "[^<>,# ]*<[^<>]*>" ) ) + { + narg++ + arg = substr( bases, RSTART, RLENGTH ) + sub( "[^<>,# ]*<[^<>]*>", "#" narg, bases ) + bargs["#" narg] = arg + # Need the following to stop resubstitution of the pattern matched + # back into the string. + gsub( "&", "\\\\&", bargs["#" narg] ) + } + numbases = split( bases, base, "," ) + for ( m=1; m<=numbases; m++ ) + { + while ( match( base[m], "#[0-9]+" ) ) + { + arg = substr( base[m], RSTART, RLENGTH ) + sub( arg, bargs[arg], base[m] ) + } + sub( "^[\t ]*", "", base[m] ) + if ( device == "mml" ) + { + gsub( "<", "\\<", base[m] ) + gsub( ">", "\\>", base[m] ) + } + if ( device == "text" ) + printf( " %s", base[m] ) + else if ( device == "troff" ) + printf( " %s", base[m] ) + else + printf( "\\ \\ %s", base[m] ) + if ( m == numbases ) + print( "" ) + else + { + print( "," ) + if ( device == "mml" ) + printf( "<HardReturn>" ) + } + } + } + else + { + if ( device == "mml" ) + { + gsub( "<", "\\<", bases ) + gsub( ">", "\\>", bases ) + } + print( bases ) + } + } + else + { + # + # ADT has no base classes + # + printf( "\n" ) + } + +#till start if (csaprintheader == "on") csa_print_class_end() + + outspace = "" + for (z=1; z<nesting_level; z++) + outspace = outspace " " + if ( device == "text" ) + print( outspace "{\ " ) + else if ( device == "troff" ) + print( outspace "{\\fP" ) + else if ( device == "mml" ) + print( outspace "<HardReturn>{<Family Times>") + if ( access["public"] == "on" ) + { + # + # collecting loop over the public lines of 1 ADT + # + start = 0 + for ( i=0; i<=num; i++ ) + { + split( lines[i], line, "\n" ) + + # + # 3.11.95 check outermost access + # + if ( line[1] == "ACCESS") + { + outeraccess = line[3] + #printf("\n----- outeraccess = |%s| --------\n",outeraccess) + } + + # + # start for nesting ADT + # + if ( line[1] == "CLASS" || line[1] == "STRUCT" || line[1] == "UNION" ) + { + # + # check for a normal nested ADT + # + if ( line[2] ~ "(::|<)" && lastaccess == "public" && outeraccess == "public") + { + if (line[2] ~ "::") + { + len = length(line[2]) + match( line[2], "(::|<).*$") + newclass = substr( line[2],RSTART+2,RLENGTH) + thisclass = substr( line[2],1,RSTART-1) + if (class == thisclass) + { + # + # hier is a nested class, struct, or union found!!!!!!! + # + + basesubclass = line[2] + #printf("\n----basesubclass=|%s|-----\n",basesubclass) + #printf("\n----thisclass=|%s|---------newclass=|%s|-----\n",thisclass,newclass) + #printf("\n----RECURSION--class=|%s|--line[1]=|%s|--line[2]=|%s|---\n", \ + #class,line[1],line[2]); + + nesttype = lower[line[1]] + nestbaseindex = 3 + #printf("\nvor parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + save_i = i + class = parse_and_print_adt(basesubclass,newclass,thisclass,nestbaseindex,nesttype) + i = save_i + #printf("\nafter parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + start = 1 + continue + } + } + } + } + else + { + # + # check for a TEMPLATE nested ADT + # + if ( line[1] == "TEMPLATE" && line[2] ~ /(class|union|struct)/ && lastaccess == "public" && outeraccess == "public") + { + len = length(line[3]) + match( line[3], "(::|<).*$") + newclass = substr( line[3],RSTART+2,RLENGTH) + thisclass = substr( line[3],1,RSTART-1) + if (class == thisclass) + { + # + # hier is a nested class, struct, or union found!!!!!!! + # + + basesubclass = line[3] + #printf("\n----basesubclass=|%s|-----\n",basesubclass) + #printf("\n----thisclass=|%s|---------newclass=|%s|-----\n",thisclass,newclass) + #printf("\n---RECURSION--class=|%s|--line[1]=|%s|--line[2]=|%s|--line[3]=|%s|---\n", \ + #class,line[1],line[2],line[3]); + + nesttype = "template" + nestbaseindex = 5 + #printf("\nvor parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + save_i = i + class = parse_and_print_adt(basesubclass,newclass,thisclass,nestbaseindex,nesttype) + i = save_i + #printf("\nafter parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + start = 1 + continue + } + } + } + # + # end for nesting ADT + # + # + # now print the protoypes of the public ADT + # + if ( ( line[1] == "MEMBER" || + line[1] == "FUNC" || + line[1] == "TYPEDEF" || + line[1] == "ENUM" || + line[1] == "FRIEND" ) && + line[2] == class && + line[3] == "public" ) + { + outspace = "" + for (z=1; z<nesting_level; z++) + outspace = outspace " " + lastaccess = "public" + if ( start == 0 ) + { + start = 1 + if ( device == "text" ) + print( outspace "\ \n" outspace "public:\n") + else if ( device == "troff" ) + print( outspace " \\f(COpublic:\\fP") + else if ( device == "mml" ) + print( outspace "<HardReturn><Family Courier>\\ \\ public:<Family Times>" ) + } + outspace = "" + for (z=1; z<=nesting_level; z++) + outspace = outspace " " + if ( device == "text" ) + { + outputPrototype( outspace line[4] ) + } + else if ( device == "troff" ) + outputPrototype( outspace line[4] ) + else + { + printf( "<HardReturn>" ) + outputPrototype( outspace line[4] ) + } + } + } + } + if ( access["protected"] == "on" ) + { + # + # collecting loop over the protected lines of 1 ADT + # + start = 0 + for ( i=0; i<=num; i++ ) + { + split( lines[i], line, "\n" ) + + # + # 3.11.95 check outermost access + # + if ( line[1] == "ACCESS") + { + outeraccess = line[3] + #printf("\n----- outeraccess = |%s| --------\n",outeraccess) + } + + # + # start for nesting ADT + # + if ( line[1] == "CLASS" || line[1] == "STRUCT" || line[1] == "UNION" ) + { + # + # check for a normal nested ADT + # + if ( line[2] ~ "(::|<)" && lastaccess == "protected" && outeraccess == "protected") + { + if (line[2] ~ "::") + { + len = length(line[2]) + match( line[2], "(::|<).*$") + newclass = substr( line[2],RSTART+2,RLENGTH) + thisclass = substr( line[2],1,RSTART-1) + if (class == thisclass) + { + # + # hier is a nested class, struct, or union found!!!!!!! + # + + basesubclass = line[2] + #printf("\n----basesubclass=|%s|-----\n",basesubclass) + #printf("\n----thisclass=|%s|---------newclass=|%s|-----\n",thisclass,newclass) + #printf("\n----RECURSION--class=|%s|--line[1]=|%s|--line[2]=|%s|---\n", \ + #class,line[1],line[2]); + + nesttype = lower[line[1]] + nestbaseindex = 3 + #printf("\nvor parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + save_i = i + class = parse_and_print_adt(basesubclass,newclass,thisclass,nestbaseindex,nesttype) + i = save_i + #printf("\nafter parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + start = 1 + continue + } + } + } + } + else + { + # + # check for a TEMPLATE nested ADT + # + if ( line[1] == "TEMPLATE" && line[2] ~ /(class|union|struct)/ && lastaccess == "protected" && outeraccess == "protected") + { + len = length(line[3]) + match( line[3], "(::|<).*$") + newclass = substr( line[3],RSTART+2,RLENGTH) + thisclass = substr( line[3],1,RSTART-1) + if (class == thisclass) + { + # + # hier is a nested class, struct, or union found!!!!!!! + # + + basesubclass = line[3] + #printf("\n----basesubclass=|%s|-----\n",basesubclass) + #printf("\n----thisclass=|%s|---------newclass=|%s|-----\n",thisclass,newclass) + #printf("\n---RECURSION--class=|%s|--line[1]=|%s|--line[2]=|%s|--line[3]=|%s|---\n", \ + #class,line[1],line[2],line[3]); + + nesttype = "template" + nestbaseindex = 5 + #printf("\nvor parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + save_i = i + class = parse_and_print_adt(basesubclass,newclass,thisclass,nestbaseindex,nesttype) + i = save_i + #printf("\nafter parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + start = 1 + continue + } + } + } + # + # end for nesting ADT + # + # + # now print the protoypes of the public ADT + # + if ( ( line[1] == "MEMBER" || + line[1] == "FUNC" || + line[1] == "TYPEDEF" || + line[1] == "ENUM" || + line[1] == "FRIEND" ) && + line[2] == class && + line[3] == "protected" ) + { + outspace = "" + for (z=1; z<nesting_level; z++) + outspace = outspace " " + lastaccess = "protected" + if ( start == 0 ) + { + start = 1 + if ( device == "text" ) + print( outspace "\ \n" outspace "protected:\n") + else if ( device == "troff" ) + print( outspace " \\f(COprotected:\\fP") + else if ( device == "mml" ) + print(outspace "<HardReturn><Family Courier>\\ \\ protected:<Family Times>" ) + } + outspace = "" + for (z=1; z<=nesting_level; z++) + outspace = outspace " " + if ( device == "text" ) + outputPrototype( outspace line[4] ) + else if ( device == "troff" ) + outputPrototype( outspace line[4] ) + else + { + printf( "<HardReturn>" ) + outputPrototype( outspace line[4] ) + } + } + } + } + if ( access["private"] == "on" ) + { + # + # collecting loop over the private lines of 1 ADT + # + start = 0 + for ( i=0; i<=num; i++ ) + { + split( lines[i], line, "\n" ) + + # + # 3.11.95 check outermost access + # + if ( line[1] == "ACCESS") + { + outeraccess = line[3] + #printf("\n----- outeraccess = |%s| --------\n",outeraccess) + } + + # + # start for nesting ADT + # + if ( line[1] == "CLASS" || line[1] == "STRUCT" || line[1] == "UNION" ) + { + # + # check for a normal nested ADT + # + if ( line[2] ~ "(::|<)" && lastaccess == "private" && outeraccess == "private") + { + if (line[2] ~ "::") + { + len = length(line[2]) + match( line[2], "(::|<).*$") + newclass = substr( line[2],RSTART+2,RLENGTH) + thisclass = substr( line[2],1,RSTART-1) + if (class == thisclass) + { + # + # hier is a nested class, struct, or union found!!!!!!! + # + + basesubclass = line[2] + #printf("\n----basesubclass=|%s|-----\n",basesubclass) + #printf("\n----thisclass=|%s|---------newclass=|%s|-----\n",thisclass,newclass) + #printf("\n----RECURSION--class=|%s|--line[1]=|%s|--line[2]=|%s|---\n", \ + #class,line[1],line[2]); + + nesttype = lower[line[1]] + nestbaseindex = 3 + #printf("\nvor parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + save_i = i + class = parse_and_print_adt(basesubclass,newclass,thisclass,nestbaseindex,nesttype) + i = save_i + #printf("\nafter parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + start = 1 + continue + } + } + } + } + else + { + # + # check for a TEMPLATE nested ADT + # + if ( line[1] == "TEMPLATE" && line[2] ~ /(class|union|struct)/ && lastaccess == "private" && outeraccess == "private") + { + len = length(line[3]) + match( line[3], "(::|<).*$") + newclass = substr( line[3],RSTART+2,RLENGTH) + thisclass = substr( line[3],1,RSTART-1) + if (class == thisclass) + { + # + # hier is a nested class, struct, or union found!!!!!!! + # + + basesubclass = line[3] + #printf("\n----basesubclass=|%s|-----\n",basesubclass) + #printf("\n----thisclass=|%s|---------newclass=|%s|-----\n",thisclass,newclass) + #printf("\n---RECURSION--class=|%s|--line[1]=|%s|--line[2]=|%s|--line[3]=|%s|---\n", \ + #class,line[1],line[2],line[3]); + + nesttype = "template" + nestbaseindex = 5 + #printf("\nvor parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + save_i = i + class = parse_and_print_adt(basesubclass,newclass,thisclass,nestbaseindex,nesttype) + i = save_i + #printf("\nafter parse_and_print_adt: class=%s nesting_level=%s",class,nesting_level); + #printf("\ni=%s num=%s line[1]=|%s| line[2]=|%s| line[3]=|%s|\n", \ + #i,num,line[1],line[2],line[3]); + start = 1 + continue + } + } + } + # + # end for nesting ADT + # + # + # now print the protoypes of the public ADT + # + if ( ( line[1] == "MEMBER" || + line[1] == "FUNC" || + line[1] == "TYPEDEF" || + line[1] == "ENUM" || + line[1] == "FRIEND" ) && + line[2] == class && + line[3] == "private" ) + { + outspace = "" + for (z=1; z<nesting_level; z++) + outspace = outspace " " + lastaccess = "private" + if ( start == 0 ) + { + start = 1 + if ( device == "text" ) + print( outspace "\ \n" outspace "private:\n") + else if ( device == "troff" ) + print( outspace " \\f(COprivate:\\fP") + else if ( device == "mml" ) + print(outspace "<HardReturn><Family Courier>\\ \\ private:<Family Times>" ) + } + outspace = "" + for (z=1; z<=nesting_level; z++) + outspace = outspace " " + if ( device == "text" ) + outputPrototype( outspace line[4] ) + else if ( device == "troff" ) + outputPrototype( outspace line[4] ) + else + { + printf( "<HardReturn>" ) + outputPrototype( outspace line[4] ) + } + } + } + } + outspace = "" + for (z=1; z<nesting_level; z++) + outspace = outspace " " + if ( device == "text" ) + { + print( outspace "};" ) + print( "\n" ) + } + else if ( device == "troff" ) + { + print( outspace "\\f(CO};" ) + print( "\\fP\n.fi" ) + } + else if ( device == "mml" ) + { + print( outspace "<HardReturn><Family Courier>};<Family Times>" ) + } + nesting_level-- + return oldclass +} diff --git a/bin/info2doc.fmt b/bin/info2doc.fmt new file mode 100644 index 00000000000..ef0b0331543 --- /dev/null +++ b/bin/info2doc.fmt @@ -0,0 +1,23 @@ +start +hide section FILENAME +hide section COPYRIGHT +print prelude +print title +print synopsis +print section CLASS TYPE +print section AUDIENCE +print section DESCRIPTION +print section EXAMPLE +print contract * +print section * +print section NOTES +print section PORTABILITY +print section SEE ALSO +print section LIBRARY +print section VERSION +print section DATE RELEASED +print section RCSID +print section SCCSID +print section AUTHOR(S) +print copyright +end diff --git a/bin/info2head b/bin/info2head new file mode 100755 index 00000000000..de8efa99c14 --- /dev/null +++ b/bin/info2head @@ -0,0 +1,166 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Front end to awk script for generating manual pages from classinfo +# files. +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/bin"} + +AWK="${AWK-nawk}" + + +if test "$AWK" = "nawk" +then + VARG="-v" +fi + +EXT="3" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` file.ci" +} + +# +# Check usage. +# +if test $# != "1" -o "'basename $1 .ci'" = "$1" +then + USAGE +fi + +# +# Check for awk file etc. +# +INFO2DOC=$LIBDIR/info2doc.awk +MANFMT=$LIBDIR/info2head.fmt +HIDINGFMT=$LIBDIR/hiding.fmt + +if test ! -f $HIDINGFMT +then + ERROR "Can't find $HIDINGFMT" +fi + +if test ! -f $INFO2DOC +then + ERROR "Can't find $INFO2DOC" +fi + +if test ! -f $MANFMT +then + ERROR "Can't find $MANFMT" +fi + + + +ADTS=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^(CLASS|STRUCT|UNION)$" && $2 !~ "(::|<)" { + printf( "%s\n", $2 ) +} +$1 ~ "^TEMPLATE$" && $3 !~ "::" { + printf( "%s\n", $3 ) +}' $1` + + +VPUBL=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PUBLIC$" { + if ( $2 ~ "on" ) + printf("%s","publ=on"); + else + printf("%s","publ="); +}' $HIDINGFMT` + +VPROT=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PROTECTED$" { + if ( $2 ~ "on" ) + printf("%s","prot=on"); + else + printf("%s","prot="); +}' $HIDINGFMT` + +VPRIV=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PRIVATE$" { + if ( $2 ~ "on" ) + printf("%s","priv=on"); + else + printf("%s","priv="); +}' $HIDINGFMT` + +echo " $VPUBL $VPROT $VPRIV " + + +# $VARG publ=on $VARG prot= $VARG priv= \ +# $VARG $VPUBL $VARG $VPROT $VARG $VPRIV \ +if test ! -z "$ADTS" +then + for ADT in $ADTS + do + echo "$ADT" + + echo "making $ADTS.hxx file ..." + $AWK -f $INFO2DOC \ + $VARG $VPUBL $VARG $VPROT $VARG $VPRIV \ + $VARG pass=0 $VARG device=text $VARG infile=$1 \ + $VARG class=$ADT \ + $MANFMT $MANFMT > $ADT.$EXT +# troff -a $ADT.$EXT > $ADT.hxx + cp $ADT.$EXT $ADT.hxx + echo "$ADTS.hxx file done!" +# echo "removing $ADTS.$EXT file ..." + \rm $ADT.$EXT +# echo "file $ADTS.$EXT file removed!" + done +fi diff --git a/bin/info2head.fmt b/bin/info2head.fmt new file mode 100644 index 00000000000..87eb1c8b1d0 --- /dev/null +++ b/bin/info2head.fmt @@ -0,0 +1,23 @@ +start +hide section FILENAME +hide section COPYRIGHT +hide prelude +hide title +print synopsis +hide section CLASS TYPE +hide section AUDIENCE +hide section DESCRIPTION +hide section EXAMPLE +hide contract * +hide section * +hide section NOTES +hide section PORTABILITY +hide section SEE ALSO +hide section LIBRARY +hide section VERSION +hide section DATE RELEASED +hide section RCSID +hide section SCCSID +hide section AUTHOR(S) +hide copyright +end diff --git a/bin/info2headsrc b/bin/info2headsrc new file mode 100755 index 00000000000..cc2c1f999dd --- /dev/null +++ b/bin/info2headsrc @@ -0,0 +1,326 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Front end to awk script for generating <class>.hxx and <class>.hxx files +# from classinfo files. +# +# = AUTHOR(S) +# K. Dorn +# +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/bin"} + +AWK="${AWK-nawk}" + + +if test "$AWK" = "nawk" +then + VARG="-v" +fi + +EXT="3" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` file.ci" +} + +# +# Check usage. +# +if test $# != "1" -o "'basename $1 .ci'" = "$1" +then + USAGE +fi + + +# +# Check for awk file etc. +# +INFO2SRC=$BINDIR/info2src.awk +INFO2DOC=$LIBDIR/info2doc.awk +MANFMT=$LIBDIR/info2head.fmt +HIDINGFMT=$LIBDIR/hiding.fmt +VENDORFMT=$LIBDIR/vendor.fmt + +if test ! -f $VENDORFMT +then + ERROR "Can't find $VENDORFMT" +fi + +if test ! -f $HIDINGFMT +then + ERROR "Can't find $HIDINGFMT" +fi + +if test ! -f $INFO2DOC +then + ERROR "Can't find $INFO2DOC" +fi + +if test ! -f $MANFMT +then + ERROR "Can't find $MANFMT" +fi + +ADTS=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^(CLASS|STRUCT|UNION)$" && $2 !~ "(::|<)" { + printf( "%s\n", $2 ) +} +$1 ~ "^TEMPLATE$" && $3 !~ "::" { + printf( "%s\n", $3 ) +}' $1` + + + +VMERGE=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^CSAMERGECXXHXX$" { + if ( $2 ~ "on" ) + printf("%s","merge=on"); + else + printf("%s","merge="); +}' $HIDINGFMT` + +VCSA=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^CSAHEADER$" { + if ( $2 ~ "on" ) + printf("%s","csaprintheader=on"); + else + printf("%s","csaprintheader="); +}' $HIDINGFMT` + +VPUBL=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PUBLIC$" { + if ( $2 ~ "on" ) + printf("%s","publ=on"); + else + printf("%s","publ="); +}' $HIDINGFMT` + +VPROT=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PROTECTED$" { + if ( $2 ~ "on" ) + printf("%s","prot=on"); + else + printf("%s","prot="); +}' $HIDINGFMT` + +VPRIV=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PRIVATE$" { + if ( $2 ~ "on" ) + printf("%s","priv=on"); + else + printf("%s","priv="); +}' $HIDINGFMT` + + + + +VCOCXX=`$AWK ' +BEGIN { + FS=""; RS="" +} +/VENDOR_COMPILATION_HEADER_CXX_START/, /VENDOR_COMPILATION_HEADER_CXX_END/ { +sub("^VENDOR_COMPILATION_HEADER_CXX_START\n","",$0) +sub("VENDOR_COMPILATION_HEADER_CXX_END$","",$0) + +gsub( / \\\" /, "999", $0 ) +gsub( "\"\\[\t ]*", "234", $0 ) +gsub( "234\\\n", "345", $0 ) +gsub( /234.\n/, "456", $0 ) +gsub( /456[\t ]*234/, "567", $0 ) +gsub( /567/, "", $0 ) +gsub( /234/, "", $0 ) +gsub( /345/, "", $0 ) +gsub( "999", "\"", $0 ) + +print $0 +}' $VENDORFMT` + + +VMECXX=`$AWK ' +BEGIN { + FS=""; RS="" +} +/VENDOR_METHOD_HEADER_CXX_START/, /VENDOR_METHOD_HEADER_CXX_END/ { +sub("^VENDOR_METHOD_HEADER_CXX_START\n","",$0) +sub("VENDOR_METHOD_HEADER_CXX_END$","",$0) + +gsub( / \\\" /, "999", $0 ) +gsub( "\"\\[\t ]*", "234", $0 ) +gsub( "234\\\n", "345", $0 ) +gsub( /234.\n/, "456", $0 ) +gsub( /456[\t ]*234/, "567", $0 ) +gsub( /567/, "", $0 ) +gsub( /234/, "", $0 ) +gsub( /345/, "", $0 ) +gsub( "999", "\"", $0 ) + +print $0 +}' $VENDORFMT` + +VCOHXX=`$AWK ' +BEGIN { + FS=""; RS="" +} +/VENDOR_COMPILATION_HEADER_HXX_START/, /VENDOR_COMPILATION_HEADER_HXX_END/ { +sub("^VENDOR_COMPILATION_HEADER_HXX_START\n","",$0) +sub("VENDOR_COMPILATION_HEADER_HXX_END$","",$0) + +gsub( / \\\" /, "999", $0 ) +gsub( "\"\\[\t ]*", "234", $0 ) +gsub( "234\\\n", "345", $0 ) +gsub( /234.\n/, "456", $0 ) +gsub( /456[\t ]*234/, "567", $0 ) +gsub( /567/, "", $0 ) +gsub( /234/, "", $0 ) +gsub( /345/, "", $0 ) +gsub( "999", "\"", $0 ) + +print $0 +}' $VENDORFMT` + + +VCLHXX=`$AWK ' +BEGIN { + FS=""; RS="" +} +/VENDOR_CLASS_HEADER_HXX_START/, /VENDOR_CLASS_HEADER_HXX_END/ { +sub("^VENDOR_CLASS_HEADER_HXX_START\n","",$0) +sub("VENDOR_CLASS_HEADER_HXX_END$","",$0) + +gsub( / \\\" /, "999", $0 ) +gsub( "\"\\[\t ]*", "234", $0 ) +gsub( "234\\\n", "345", $0 ) +gsub( /234.\n/, "456", $0 ) +gsub( /456[\t ]*234/, "567", $0 ) +gsub( /567/, "", $0 ) +gsub( /234/, "", $0 ) +gsub( /345/, "", $0 ) +gsub( "999", "\"", $0 ) + +print $0 +}' $VENDORFMT` + + +echo " $VCOCXX " > vcocxx.txt +echo " $VMECXX " > vmecxx.txt +echo " $VCOHXX " > vcohxx.txt +echo " $VCLHXX " > vclhxx.txt + + + +echo " $VPUBL $VPROT $VPRIV $VCSA $VMERGE" + +# +# get from *.ci file the classes that should separated +# and make the <class>.hxx and <class>.cxx files +# +if test ! -z "$ADTS" +then + LASTADT="" + LOPCNT=1 + BASEFILENAME=`basename $1` + HXXMERGEFILE=`echo $BASEFILENAME | sed -e 's/\..*$//'`.mhxx + CXXMERGEFILE=`echo $BASEFILENAME | sed -e 's/\..*$//'`.mcxx + rm -f $HXXMERGEFILE + rm -f $CXXMERGEFILE + for ADT in $ADTS + do + if test "$LASTADT" != "$ADT" + then + echo "loop = $LOPCNT" + echo "$ADT" + + echo "making $ADTS.hxx file ..." + $AWK -f $INFO2DOC \ + $VARG fvclhxx=vclhxx.txt \ + $VARG fvcohxx=vcohxx.txt \ + $VARG $VPUBL $VARG $VPROT $VARG $VPRIV $VARG $VCSA $VARG $VMERGE \ + $VARG pass=0 $VARG device=text $VARG infile=$1 \ + $VARG class=$ADT $VARG loop=$LOPCNT\ + $MANFMT $MANFMT > $ADT.hxx + echo "$ADTS.hxx file done!" + if test "$VMERGE" = "merge=on" + then + echo "merging $ADT.hxx into $HXXMERGEFILE" + cat $ADT.hxx >> $HXXMERGEFILE + fi + + echo "making $ADTS.cxx file ..." + $AWK -f $INFO2SRC \ + $VARG fvmecxx=vmecxx.txt \ + $VARG fvcocxx=vcocxx.txt \ + $VARG $VPUBL $VARG $VPROT $VARG $VPRIV $VARG $VCSA $VARG $VMERGE \ + $VARG infile=$1 $VARG classext=$ADT $VARG mode=single $VARG loop=$LOPCNT\ + $1 > $ADT.cxx + echo "$ADTS.cxx file done!" + if test "$VMERGE" = "merge=on" + then + echo "merging $ADT.cxx into $CXXMERGEFILE" + cat $ADT.cxx >> $CXXMERGEFILE + fi + + LOPCNT=`expr $LOPCNT + 1` + LASTADT=$ADT + fi + done +fi +# +# remove temporary vendor files +# +rm -f vcocxx.txt +rm -f vmecxx.txt +rm -f vcohxx.txt +rm -f vclhxx.txt diff --git a/bin/info2man b/bin/info2man new file mode 100755 index 00000000000..21d3746d6a9 --- /dev/null +++ b/bin/info2man @@ -0,0 +1,169 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Front end to awk script for generating manual pages from classinfo +# files. +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/bin"} + +AWK="${AWK-nawk}" + +if test "$AWK" = "nawk" +then + VARG="-v" +fi + +EXT="3" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` file.ci" +} + +# +# Check usage. +# +if test $# != "1" -o "'basename $1 .ci'" = "$1" +then + USAGE +fi + +# +# Check for awk file etc. +# +INFO2MAN=$LIBDIR/info2doc.awk +MANFMT=$LIBDIR/info2doc.fmt +HIDINGFMT=$LIBDIR/hiding.fmt + +if test ! -f $HIDINGFMT +then + ERROR "Can't find $HIDINGFMT" +fi + +if test ! -f $INFO2MAN +then + ERROR "Can't find $INFO2MAN" +fi + +if test ! -f $MANFMT +then + ERROR "Can't find $MANFMT" +fi + + + + +ADTS=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^(CLASS|STRUCT|UNION)$" && $2 !~ "(::|<)" { + printf( "%s\n", $2 ) +} +$1 ~ "^TEMPLATE$" && $3 !~ "::" { + printf( "%s\n", $3 ) +}' $1` + + + +VCSA=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^CSAHEADER$" { + if ( $2 ~ "on" ) + printf("%s","csaprintheader=off"); + else + printf("%s","csaprintheader=off"); +}' $HIDINGFMT` + +VPUBL=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PUBLIC$" { + if ( $2 ~ "on" ) + printf("%s","publ=on"); + else + printf("%s","publ="); +}' $HIDINGFMT` + +VPROT=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PROTECTED$" { + if ( $2 ~ "on" ) + printf("%s","prot=on"); + else + printf("%s","prot="); +}' $HIDINGFMT` + +VPRIV=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PRIVATE$" { + if ( $2 ~ "on" ) + printf("%s","priv=on"); + else + printf("%s","priv="); +}' $HIDINGFMT` + +echo " $VPUBL $VPROT $VPRIV $VCSA " + + + +if test ! -z "$ADTS" +then + for ADT in $ADTS + do + echo "$ADT" + + $AWK -f $INFO2MAN \ + $VARG $VPUBL $VARG $VPROT $VARG $VPRIV $VARG $VCSA \ + $VARG pass=0 $VARG device=troff $VARG infile=$1 \ + $VARG class=$ADT $MANFMT $MANFMT > $ADT.$EXT + done +fi diff --git a/bin/info2mml b/bin/info2mml new file mode 100755 index 00000000000..21257927f42 --- /dev/null +++ b/bin/info2mml @@ -0,0 +1,166 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Front end to awk script for generating Frame mml from classinfo +# files. +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT/$OSE_RELEASE_NAME +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/bin"} + +AWK="${AWK-nawk}" + +if test "$AWK" = "nawk" +then + VARG="-v" +fi + +EXT="mml" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` file.ci" +} + +# +# Check usage. +# +if test $# != "1" -o "'basename $1 .ci'" = "$1" +then + USAGE +fi + +# +# Check for awk file etc. +# +INFO2MAN=$LIBDIR/info2doc.awk +HIDINGFMT=$LIBDIR/hiding.fmt +MANFMT=$LIBDIR/info2doc.fmt + + +if test ! -f $HIDINGFMT +then + ERROR "Can't find $HIDINGFMT" +fi + +if test ! -f $INFO2MAN +then + ERROR "Can't find $INFO2MAN" +fi + +if test ! -f $MANFMT +then + ERROR "Can't find $MANFMT" +fi + +ADTS=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^(CLASS|STRUCT|UNION)$" && $2 !~ "(::|<)" { + printf( "%s\n", $2 ) +} +$1 ~ "^TEMPLATE$" && $3 !~ "::" { + printf( "%s\n", $3 ) +}' $1` + + +VCSA=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^CSAHEADER$" { + if ( $2 ~ "on" ) + printf("%s","csaprintheader=off"); + else + printf("%s","csaprintheader=off"); +}' $HIDINGFMT` + +VPUBL=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PUBLIC$" { + if ( $2 ~ "on" ) + printf("%s","publ=on"); + else + printf("%s","publ="); +}' $HIDINGFMT` + +VPROT=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PROTECTED$" { + if ( $2 ~ "on" ) + printf("%s","prot=on"); + else + printf("%s","prot="); +}' $HIDINGFMT` + +VPRIV=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PRIVATE$" { + if ( $2 ~ "on" ) + printf("%s","priv=on"); + else + printf("%s","priv="); +}' $HIDINGFMT` + +echo " $VPUBL $VPROT $VPRIV $VCSA " + + + +if test ! -z "$ADTS" +then + for ADT in $ADTS + do + echo "$ADT" + + $AWK -f $INFO2MAN \ + $VARG $VPUBL $VARG $VPROT $VARG $VPRIV $VARG $VCSA \ + $VARG pass=0 $VARG device=mml $VARG infile=$1 \ + $VARG class=$ADT $MANFMT $MANFMT > $ADT.$EXT + done +fi diff --git a/bin/info2src b/bin/info2src new file mode 100755 index 00000000000..e8e3847faf7 --- /dev/null +++ b/bin/info2src @@ -0,0 +1,133 @@ +#! /bin/sh +# ============================================================================= +# +# = DESCRIPTION +# Script to combine class2info and info2src. +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# +# ============================================================================= + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT/$OSE_RELEASE_NAME +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/bin"} + +AWK="nawk" + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` file.ci" +} + +if test $# != "1" -o "'basename $1 .ci'" = "$1" +then + USAGE +fi + +# +# Check for awk file. +# +INFO2SRC=$BINDIR/info2src.awk +HIDINGFMT=$LIBDIR/hiding.fmt + +file=`basename $1` +base="`echo $file | sed -e 's/\..*$//'`" + +if test ! -f $INFO2SRC +then + ERROR "Can't find $INFO2SRC" +fi + +if test ! -f $HIDINGFMT +then + ERROR "Can't find $HIDINGFMT" +fi + + +VCSA=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^CSAHEADER$" { + if ( $2 ~ "on" ) + printf("%s","csaprintheader=on"); + else + printf("%s","csaprintheader="); +}' $HIDINGFMT` + +VPUBL=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PUBLIC$" { + if ( $2 ~ "on" ) + printf("%s","publ=on"); + else + printf("%s","publ="); +}' $HIDINGFMT` + +VPROT=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PROTECTED$" { + if ( $2 ~ "on" ) + printf("%s","prot=on"); + else + printf("%s","prot="); +}' $HIDINGFMT` + +VPRIV=`$AWK ' +BEGIN { + FS="\n"; RS="" +} +$1 ~ "^PRIVATE$" { + if ( $2 ~ "on" ) + printf("%s","priv=on"); + else + printf("%s","priv="); +}' $HIDINGFMT` + +echo " $VPUBL $VPROT $VPRIV $VCSA " + + +# $VARG publ=on $VARG prot=on $VARG priv=on \ +echo "making $base.cxx file ..." +$AWK -f $INFO2SRC \ + $VARG $VPUBL $VARG $VPROT $VARG $VPRIV $VARG $VCSA \ + $VARG infile=$1 $VARG classext= $VARG mode=multiple \ + $1 > $base.cxx +echo "$base.cxx file done!" diff --git a/bin/info2src.awk b/bin/info2src.awk new file mode 100755 index 00000000000..1a8b19ae964 --- /dev/null +++ b/bin/info2src.awk @@ -0,0 +1,630 @@ +# ============================================================================= +# +# = DESCRIPTION +# Awk script to convert classinfo description file to src stubs. +# +# = AUTHOR(S) +# Graham Dumpleton +# K. Dorn +# +# = COPYRIGHT +# Copyright 1991 OTC LIMITED +# +# ============================================================================= + +BEGIN { +# separator = "/* ------------------------------"\ +# "------------------------------------------- */" + separator = "" + csa_method_trailer=sprintf("\n/*] END Method */\n\n") + FS="\n"; RS="" + firsttime = "first" + templ="" + blank=" " + classfunc = "" + rettyp = "" + classname="" + classtitle="" + filedate="" + filename="" + filename1="" + author="" + classdescription="" + methoddescription="" + +# csaprintheader=1 + +# accpubl = "off" +# accprot = "off" +# accpriv = "off" +} +# +# variable von awk sind nicht in begin zuweisbar! +# +{ + accmergecxxhxx = merge + accloop = loop + accpubl = publ + accprot = prot + accpriv = priv +#printf("\nmerge=%s loop=%s csaprintheader=%s firsttime=%s\n",merge,loop,csaprintheader,firsttime); +} + +function csa_print_compilation_header_alt() +{ + if ( length( firsttime ) > 3 ) + { + + csa_compilation_header=sprintf("\n/*[ Compilation unit "\ + "----------------------------------------------------------\n"\ + "\n"\ + " Component : CSA - OSC\n"\ + "\n"\ + " Name : %s.[Ci]\n"\ + "\n"\ + " Author : %s\n"\ + "\n"\ + " Language : C++\n"\ + "\n"\ + " Creation Date : %s\n"\ + "\n"\ + " Test State : %%Q%%\n"\ + "\n"\ + " Description : %s\n"\ + "\n"\ + "\n"\ + " Copyright (C) Siemens AG 1995 All Rights Reserved\n"\ + "\n"\ + "--------------------------------------"\ + "---------------------------------------*/\n"\ + "/*] END */\n"\ + "#pragma ident \"%%Z%% %%M%% %%I%% (%%G%%), %%Y%% %%Q%%:"\ + " implementation file for class \n"\ + "%s\"\n"\ + "\n"\ + "#undef __STDC__\n"\ + "#undef __GNUG__\n"\ + "\n",filename1,author,filedate,classdescription,names[$2]); + printf("%s",csa_compilation_header); + firsttime = "" + } +} + +function csa_print_compilation_header() +{ + if ((csaprintheader == "on" && merge != "on") || (merge == "on" && loop == "1")) + { + if ( length( firsttime ) > 3 ) + { + FS=" "; RS="\n" + read_fvmecxx_file() + read_fvcocxx_file() + FS="\n"; RS="" + + #csa_compilation_header=sprintf(vcocxx,filename1,author,filedate,classdescription,names[$2]); +csa_compilation_header=sprintf(vcocxx,filename1,author,filedate,classdescription,classname); + printf("%s",csa_compilation_header); + firsttime = "" + } + } + else if (csaprintheader == "on" && merge == "on" && loop != "1" && length( firsttime ) > 3) + { + FS=" "; RS="\n" + read_fvmecxx_file() + read_fvcocxx_file() + FS="\n"; RS="" + firsttime = "" + } +} + +function csa_print_method_header_alt() +{ + prrettyp = "" + if (rettyp != "") + prrettyp=sprintf("type = %s",rettyp); + else + prrettyp=sprintf("-"); + + csa_method_header=sprintf("\n/*[ Method ---------------------"\ + "-------------------------------------------\n"\ + "\n"\ + " Name : %s\n"\ + "\n"\ + " Description : %s\n"\ + "\n"\ + " Return : %s\n"\ + "\n"\ + "--------------------------------------------"\ + "------------------------------*/\n\n",classfunc,methoddescription,prrettyp) + printf("%s",csa_method_header); +} + +function csa_print_method_header() +{ + if (csaprintheader == "on") + { + prrettyp = "" + if (rettyp != "") + prrettyp=sprintf("type = %s",rettyp); + else + prrettyp=sprintf("-"); + + csa_method_header=sprintf(vmecxx,classfunc,methoddescription,prrettyp) + printf("%s",csa_method_header); + } +} + +function csa_print_method_trailer() +{ + if (csaprintheader == "on") + { + csa_method_trailer=sprintf("/*] END Method */\n") + printf("\n%s\n",csa_method_trailer); + } +} + +function csa_get_method_description() +{ + n = split( $0, line, "\n" ) + methoddescription="" + for ( i=5; i<=n; i++ ) + { + len = length(line[i]) + comm = substr(line[i],4,len) + methoddescription = methoddescription comm "\n " + } +} + + +function read_fvmecxx_file() +{ + vmecxx1 = "\n" + while ( getline < fvmecxx > 0 ) + vmecxx1 = vmecxx1 $0 "\n" + vmecxx = vmecxx1 +} + +function read_fvcocxx_file() +{ + vcocxx1 = "\n" + while ( getline < fvcocxx > 0 ) + vcocxx1 = vcocxx1 $0 "\n" + vcocxx = vcocxx1 +} + + +# +# hier laueft er durch mit allen zeilen +# + +$1 ~ /CLASS2INFO/ { + filedate=$2 + filename=$3 + len=length($3) + filename1=substr($3,1,(len-2)) +} + +$1 ~ /INFO/ && $2 ~ /GLOBAL/ && $3 ~ /LIBRARY/ { + library=$4 + len=length(library) + library=substr(library,4,len) + if ( merge != "on") + printf( "#include <%s/%s>\n", library, filename ) + else + if ( loop == "1") + printf( "#include <%s/%s>\n", library, filename ) +} + +$1 ~ /INFO/ && $2 ~ /GLOBAL/ && $3 ~ /AUTHOR/ { + l=length($4) + author=substr($4,4,l) +} + +$1 ~ /INFO/ && $2 ~ /HDR/ && $3 ~ /TITLE/ { + classname=$4 + classtitle=$5 +} + +$1 ~ /INFO/ && $2 ~ /HDR/ && $3 ~ /DESCRIPTION/ { + n = split( $0, line, "\n" ) + classdescription="" + for ( i=5; i<=n; i++ ) + { + len = length(line[i]) + comm = substr(line[i],4,len) + classdescription = classdescription comm "\n " + } +# if (csaprintheader == "on") +# csa_print_compilation_header() +} + +$1 ~ /INCLUDE/ { + if ( merge != "on") + printf( "#include %s\n", $2) +# else +# if ( loop == "1") +# printf( "#include %s\n", $2) +} + +# +# neu mit nested classes +# +$1 ~ /(CLASS|STRUCT|UNION)/ { + nestedclass = "" + nested = "" + templnested = "" + containerclass = "" + if ( $2 ~ "(::|<)" ) + { + len = length($2) + match( $2, "(::|<).*$") + newclass = substr( $2,RSTART+2,RLENGTH) + thisclass = substr( $2,1,RSTART-1) + if (thisclass == classext) + { + nestedclass = newclass + nested = "on" + containerclass = thisclass + class = newclass $3 # 23.10.95 + } + else + nestedclass = "" + } + else + { + names[$2] = $2 + } +} + +# +# neu mit nested classes +# +$1 ~ /TEMPLATE/ { + templnestedclass = "" + nested = "" + templnested = "" + if ( $2 ~ /(class|union|struct)/ && $3 ~ "(::|<)" ) + { + len = length($3) + match( $3, "(::|<).*$") + templnewclass = substr( $3,RSTART+2,RLENGTH) + templthisclass = substr( $3,1,RSTART-1) + if (templthisclass == classext) + { + templnestedclass = templnewclass + nestedtempl = $4 +#printf("\n------nestedtempl=%s----\n",nestedtempl); + class = templnewclass $4 + nestedtemplclass = templnewclass $4 + nested = "on" + templnested = "on" + containerclass = templthisclass + } + else + templnestedclass = "" + } + else + { + class = $3 $4 + templclass = $3 $4 + args[$3] = $4 + templ=$4 + # This needs extra work. + # + # macht aus: <class hans,class otto> folgendes: + # <hans,otto> + + sub( "<[\t ]*(class)[\t ]+", "<", class ) + sub( ",[\t ]*(class)[\t ]+", ",", class ) + + names[$3] = class + } +} + +# +# neu nested classes, achtung: nur level1 moeglich, da keine rekursion! +# +$1 ~ /END/ && $2 == class{ + nested= "" + templnested= "" +} + +# +# alt ohne nested classes +# +#$1 ~ /(CLASS|STRUCT|UNION)/ { +# names[$2] = $2 +#} + +# +# alt ohne nested classes +# +#$1 ~ /TEMPLATE/ { +# class = $3 $4 +# templclass = $3 $4 +# args[$3] = $4 +# templ=$4 +# # This needs extra work. +# +# macht aus: <class hans,class otto> folgendes: +# <hans,otto> +# +# sub( "<[\t ]*(class)[\t ]+", "<", class ) +# sub( ",[\t ]*(class)[\t ]+", ",", class ) + +# names[$3] = class +#} + + +$1 ~ /FUNC/ { + prototype = $4 + class = $2 + hiding = $3 + if ( (((hiding == "private") && (accpriv == "on") ) || ((hiding == "public") && (accpubl == "on") ) || ((hiding == "protected") && (accprot == "on") )) && ((mode != "single") || ((mode == "single") && ((classext == class) || (class == nestedclass) || (class == templnestedclass))) )) + { +# printf("\nclassext=%s\n",classext); +# printf("\nclass =%s\n",class); +# printf("\nhiding=%s\n",hiding); + csa_print_compilation_header() + # Filter out inline functions. + flinline=0 + if ( prototype ~ /^[\t ]*inline[\t ]+/ ) + { + flinline=1 +#printf("\n######inline####\n"); +# next + sub( "^[\t ]*inline[\t ]+", "", prototype ) + } + # Filter out pure virtual functions: wenn prototype "= 0 ;" enthaelt! + flpurevirt=0 + if ( prototype ~ /[\t ]*=[\t ]*0[\t ]*;[\t ]*$/ ) + { + flpurevirt=1 + next + } + # Strip out unwanted bits "static oder virtual". + flstatic=0 + if ( prototype ~ /^[\t ]*static[\t ]+/ ) + { + flstatic=1 + } + flvirtual=0 + if ( prototype ~ /^[\t ]*virtual[\t ]+/ ) + { + flvirtual=1 + } + sub( "^[\t ]*(static|virtual)[\t ]+", "", prototype ) +# suchstring ersetzen src/zielstring + # Strip out unwanted bits "; + # blank und tab" am ende der methode. + sub( ";[\t ]*$", "", prototype ) + # Strip out unwanted bits : 1. default werte der methode aus class def und comma. +# gsub( "[\t ]*\\(=[^(=][^,=]*,", ",", prototype ) +# gsub( "[\t ]*\\(=[^(=][^,=]*\\)", ")", prototype ) + +#neu + if ( prototype !~ /[\t \&\*]*operator[^a-zA-Z0-9]+/ ) + { +#neu + # Strip out unwanted bits : 1. default werte der methode aus class def und comma, aber nicht bei + # operator funs , wegen deren "=" ! + gsub( "[\t ]*=[^(=][^,=]*,", ",", prototype ) + gsub( "[\t ]*=[^(=][^,=]*\\)", ")", prototype ) +#neu + } +#neu + +#printf("\nprototype=|%s|\n",prototype); + + # Put in class name. + floperator=0 + if ( prototype ~ /[\t \&\*]*operator[^a-zA-Z0-9]+/ ) + { + # + # operator funcs + # + floperator=1 +#printf("\noperatorfunc|%s|\n",prototype); + match( prototype, "[^\t \&\*]*operator" ) + typoper = substr( prototype, 1,RSTART-1) +#printf("\ntypoper=|%s|\n",typoper); + wholelen=length(prototype) + restoper = substr( prototype, RSTART, wholelen) +#printf("\nrestoper=|%s|\n",restoper); + len=length(restoper) + restoper1 = substr( restoper, 9, len ) + match( restoper1, "[^\t ].*$" ) # trimstring fuer anf des feldes + restoper2 = substr( restoper1, RSTART, RLENGTH ) +#printf("\nrestoper2=|%s|\n",restoper2); + len=length(restoper2) # pvar++ + restoper3 = substr( restoper2,2, len ) +#printf("\nrestoper3=|%s|\n",restoper3); + match( restoper3, "\\(.*$" ) # gebe naechsten string der + # mit ( anfaengt bis zum ende + decl = substr( restoper3, RSTART, RLENGTH ) +#printf("\nparas=|%s| s=%d l=%d\n",decl,RSTART,RLENGTH); + parstart=index(restoper,decl) + restoperfun=substr(restoper,1,parstart-1) +#printf("\nrestoperfun=|%s|\n",restoperfun); + +#neu + # Strip out unwanted bits : 1. default werte der methode aus class def und comma. + gsub( "[\t ]*=[^(=][^,=]*,", ",", decl ) + gsub( "[\t ]*=[^(=][^,=]*\\)", ")", decl ) + restoper=restoperfun decl +#printf("\nneu restoper=|%s|\n",restoper); +#neu + + +if (nested == "on" ) + prototype=typoper containerclass "::" class "::" restoper +else + prototype=typoper class "::" restoper +#printf("\nprototype=|%s|\n",prototype); + +if (nested == "on" ) + classfunc = containerclass "::" class "::" restoperfun +else + classfunc = class "::" restoperfun +#printf("\nclassfunc=|%s|\n",classfunc); + rettyp = typoper +#printf("\nrettyp=|%s|\n",rettyp); + funcname = classfunc +#printf("\n7|%s|\n",funcname); + } + else + { + # + # other functions + # + match( prototype, "[^\t ]*\\(.*$" ) + decl = substr( prototype, RSTART, RLENGTH ) + +#-----neu start, damit 0-n blanks zwischen "func-name" und "(" stehen koennen! + match( decl, "\\(.*$" ) + decl = substr( decl, RSTART, RLENGTH ) + parstart=index(prototype,decl) + typfuncn=substr(prototype,1,parstart-1) + sub( "[\t ]*$", "", typfuncn ) + prototype = "" + prototype = typfuncn " " decl +#printf("\nprototypeneu=|%s|\n",prototype); +#printf("\ntypfuncnneu=|%s|\n",typfuncn); +#printf("\ndeclneu=|%s|\n",decl); + + + match( prototype, "[^\t ]*\\(.*$" ) + decl = substr( prototype, RSTART, RLENGTH ) +#-----neu end + +#printf("\ndecl=|%s|\n",decl); + parstart=index(prototype,decl) + typfuncn=substr(prototype,1,parstart-1) + + nitems=split(typfuncn,typfuncitems,"[\t \&\*]") + sub( "[\t ]*$", "", typfuncn ) + funcn = typfuncitems[nitems-1] + funstart=index(typfuncn,funcn) + typ=substr(typfuncn,1,funstart-1) +#printf("\ntypfuncn=|%s|\n",typfuncn); +#printf("\nfuncn=|%s|\n",funcn); +#printf("\ntyp=|%s|\n",typ); +if (nested == "on" ) + sub( "^", typ containerclass "::" class "::" funcn, decl ) +else + sub( "^", typ class "::" funcn, decl ) + prototype=decl +#printf("\nprototype=|%s|\n",prototype); + classfunc = "" +if (nested == "on" ) + sub( "^", containerclass "::" class "::" funcn, classfunc ) +else + sub( "^", class "::" funcn, classfunc ) +#printf("\nclassfunc=|%s|\n",classfunc); + rettyp = "" + sub( "^", typ, rettyp ) +#printf("\nrettyp=|%s|\n",rettyp); +#printf("\n6|%s|\n",prototype); + match( prototype, "^[^(]*\\(" ) + funcname = substr( prototype, RSTART, RLENGTH ) +#printf("\n7|%s|\n",funcname); + } + + # Output it. + + if (firsttime == "") + { + csa_get_method_description() +# if (csaprintheader == "on") + csa_print_method_header() + + if ( length(prototype) > 75 ) + { + match( prototype, "^[^(]*\\(" ) + funcname = substr( prototype, RSTART, RLENGTH ) + if ( prototype ~ "^[^(]*\\(\\)[\t ]*\\(" ) + { + funcname = funcname ")(" + sub( "^[^(]*\\(\\)[\t ]*\\(", "", prototype ) + } + else + sub( "^[^(]*\\(", "", prototype ) + + if ( templclass ~ "<" && templnested == "" && nested == "") + { + printf( "template%s\n", templ) + } + if ( templnested == "on") + { + printf( "template%s\n", nestedtempl ) + } + printf( "%s\n", funcname ) + + match( prototype, "\\)([\t ]*const)?[\t ]*$" ) + functail = substr( prototype, RSTART, RLENGTH ) + sub( "\\)([\t ]* const)?[\t ]*$", "", prototype ) + narg = 0 + while ( match( prototype, "[^<>,#]*<[^<>]*>" ) ) + { + narg++ + arg = substr( prototype, RSTART, RLENGTH ) + sub( "[^<>,#]*<[^<>]*>", "#" narg, prototype ) + fargs["#" narg] = arg + # Need the following to stop resubstitution of the pattern matched + # back into the string. + gsub( "&", "\\\\&", fargs["#" narg] ) + } + numargs = split( prototype, args, "," ) + for ( m=1; m<=numargs; m++ ) + { + while ( match( args[m], "#[0-9]+" ) ) + { + arg = substr( args[m], RSTART, RLENGTH ) + sub( arg, fargs[arg], args[m] ) + } + sub( "[\t ]*", "", args[m] ) + printf( " %s", args[m] ) + if ( m == numargs ) + { + print( "" ) + } + else + print( "," ) + } + if (flinline == 1) + printf("/* inline */\n"); +# printf( "%s\n%s{\n}\n\n%s\n", functail,csa_method_trailer, separator ) + printf( "%s\n", functail) +# csa_print_method_trailer() +# printf( "{\n}\n\n%s\n", separator ) + } + else + { + if (flinline == 1) + printf("/* inline */\n"); + + if ( templclass ~ "<" && templnested == "" && nested == "") + { + printf( "template%s\n", templ ) + } + if ( templnested == "on") + { + printf( "template%s\n", nestedtempl ) + } +# printf( "%s\n%s{\n}\n\n%s\n", prototype,csa_method_trailer, separator ) + printf( "%s\n", prototype) +# csa_print_method_trailer() +# printf( "{\n}\n\n%s\n", separator ) + } + csa_print_method_trailer() + if (rettyp != "" && rettyp != "void " && rettyp != "void") + printf( "{\n\treturn((%s)0);\n}\n\n%s\n",rettyp, separator ) + else + printf( "{\n}\n\n%s\n", separator ) + + } + # end of firsttime + } + # end of if +} +#end of FUNC diff --git a/bin/man2html b/bin/man2html new file mode 100755 index 00000000000..7211bdc60bb --- /dev/null +++ b/bin/man2html @@ -0,0 +1,88 @@ +#!/bin/sh + +OSE_HOST= + +OSE_RELEASE_NAME= +export OSE_RELEASE_NAME + +OSE_ROOT=${OSE_ROOT-$WRAPPER_ROOT} +export OSE_ROOT + +OSE_VERSION_ROOT=$OSE_ROOT +export OSE_VERSION_ROOT + +BINDIR="$OSE_VERSION_ROOT/$OSE_HOST/bin" +LIBDIR=${CLASSINFOLIBDIR-"$OSE_VERSION_ROOT/bin"} + +# +# Error. +# +ERROR() +{ + echo "`basename $0`: $1" >&2 + shift + while test $# != "0" + do + echo $1 >&2 + shift + done + exit 1 +} + +# +# Usage message. +# +USAGE() +{ + ERROR "Usage: `basename $0` files" +} + +# +# Check usage. +# +if test "$#" = "0" +then + USAGE +fi + +while test "$#" != "0" +do + INPUT=$1 + BASENAME=`basename $INPUT | sed -e 's/\(.*\)\.[^.]*$/\1/'` + OUTPUT=${BASENAME}.html + + if test -f ${INPUT} + then + echo ${BASENAME} + cat ${INPUT} | + sed -e 's/\\-/-/g' \ + -e 's/\\ / /g' \ + -e 's/\\[0&]/ /g' \ + -e 's/&/\&/g' \ + -e 's/</\</g' \ + -e 's/>/\>/g' \ + -e 's/\\|//g' \ + -e 's/\\e/\\/g' | + /bin/nawk -f ${LIBDIR}/man2html1.awk | + sed -e 's^\\fB\([^\\]*\)\\fR^<B>\1</B></I>^g' \ + -e 's^\\f(CO\(.[^\\]*\)\\fR^<CODE>\1</CODE>^g' \ + -e 's^\\fI\(.[^\\]*\)\\fR^<I>\1</I></B>^g' \ + -e 's^\\fB^<B>^g' \ + -e 's^\\f(CO^<CODE>^g' \ + -e 's^\\fI^<I>^g' \ + -e 's^\\f[RP]^</B></I></CODE>^g' \ + -e 's/^.[LP]P/<P>/' \ + -e 's/^.br/<BR>/' \ + -e 's/^\.DS.*/<pre>/' \ + -e 's$^\.DE.*$</pre>$' \ + -e 's/^\.nf */<pre>/' \ + -e 's$^\.fi *$</pre>$' \ + -e 's$^\.BE *$</pre><HR>$' \ + -e 's/^\.RS.*/<UL>/' \ + -e 's$^\.RE.*$</UL>$' \ + -e 's^\.SH *"*\([^"]*\)"*^</pre><H2>\1</H2>^' \ + -e '/^\.[a-zA-Z]*.*/d' | + /bin/nawk -f ${LIBDIR}/man2html2.awk > ${OUTPUT} + fi + shift +done diff --git a/bin/man2html1.awk b/bin/man2html1.awk new file mode 100644 index 00000000000..a780ab70c9f --- /dev/null +++ b/bin/man2html1.awk @@ -0,0 +1,139 @@ +#!/bin/nawk + + +# defining macros - eat them +/^\.de.*/ { + getline + while ( $0 !~ "^\.\.$" ) + { + getline + } + getline + } + +# eat [nt]roff comments +$0 ~ /['.][\/\\]"/ || $1 == "'" { next } + +# remove sidebar macros +$1 == ".VS" || $1 == ".VE" || $1 == ".AS" { next } + + +# handle first .SH as special case - .SH NAME +/^.SH *NAME */ { + getline + while ( $0 ~ /\.[a-zA-Z].*/ ) # eat dot-cmd following title + { + getline + } + print "<TITLE>" $0 "</TITLE>" + print "<H1>" $0 "</H1>\n" + next + +#-e 's/^.SH *NAME */{N;s#.*\n\(.*\)#<H1>\1</H1>#;}' \ + } + + +# Convert .IP Paragraphs upto next .cmd to hanging indents +# using <DL></DL> pairs without intervening <LI> + +/^\.IP */ { + if ( inIP > 0 ) + { + print "</DL>" + } + inIP = 1 + startIP = 1 + print "<DL>" + match($0, /".*"/ ) + if ( RSTART > 0 ) + { + arg = substr( $0, RSTART+1, RLENGTH-2) + + print "<DT> " arg + } + else if ( length( $2 ) > 0 ) + { + print "<DT> " $2 + } + next + } + +$0 ~ /^\.[a-zA-Z]*/ && inIP > 0 { + inIP = 0 + print "</DL>" + } + +# Convert +# .TP +# Line1 +# line 2 - n +# .Any +# +# to +# <DL> +# <DT> Line1 +# <DD> lines 2 - n +# <DT> + +/^\.TP */ { + if ( inTP > 0 ) + { + print "</DL>" + } + inTP = 1 + print "<DL>" + next + } + +inTP == 1 && $1 !~ /\.[a-zA-Z]*/ { + print "<DT> " $0 + inTP = 2 + next + } + +inTP == 2 && $1 !~ /\.[a-zA-Z]*/{ + print "</I></B>" # Belt and suspenders + print "<DD> " $0 + inTP = 3 + next + } + +$0 ~ /^\.[a-zA-Z]*/ && inTP > 0 { + inTP = 0 + print "</DL>" + } + + + +$1 == ".AP" { + $1="" + print "<DL >" + print "<DT> " $2 "\t\t" $3 "\t\t("$4")" + inTP = 2 + next + } + +# make a blank line +$1 == ".sp" { + print "<BR>" + next # print "<BR>" + } + + +$1 == ".ta" { next } + +# just pass everything else on + + { + if ( startIP > 0 ) + { + print "<DD> " $0 + startIP = 0 + } + else + { + print $0 + } + } + + diff --git a/bin/man2html2.awk b/bin/man2html2.awk new file mode 100644 index 00000000000..31c4cece3b9 --- /dev/null +++ b/bin/man2html2.awk @@ -0,0 +1,18 @@ +#!/bin/nawk + +$0 ~ "</pre><H2>SEE ALSO</H2>" { + print $0 + getline + while ( $0 !~ "^<P>$" && $0 !~ "^[ \t]*$" ) { + gsub("OTC[_a-zA-Z0-9]*_[_a-zA-Z0-9]*","<A HREF=\"&.html\">&</A>",$0) + gsub("OUX[_a-zA-Z0-9]*_[_a-zA-Z0-9]*","<A HREF=\"&.html\">&</A>",$0) + gsub("OTK[_a-zA-Z0-9]*_[_a-zA-Z0-9]*","<A HREF=\"&.html\">&</A>",$0) + print $0 + if ( getline <= 0 ) + $0 = "" + } + if ( $0 !~ "^[ \t]*$" ) + print $0 +} + +{ print $0 } diff --git a/bin/rename-ace.pl b/bin/rename-ace.pl new file mode 100755 index 00000000000..c785370f779 --- /dev/null +++ b/bin/rename-ace.pl @@ -0,0 +1,175 @@ +#!/pkg/gnu/bin/perl -pi +s/\bAcceptor\b/ACE_Acceptor/g; +s/\bAddr\b/ACE_Addr/g; +s/\bArgument_Vector\b/ACE_ARGV/g; +s/\bAtomic_Op\b/ACE_Atomic_Op/g; +s/\bCORBA_Handler\b/ACE_CORBA_Handler/g; +s/\bCondition\b/ACE_Condition/g; +s/\bConnector\b/ACE_Connector/g; +s/\bControl_Block\b/ACE_Control_Block/g; +s/\bControl_Mode\b/ACE_Control_Mode/g; +s/\bData_Block\b/ACE_Data_Block/g; +s/\bDummy_Node\b/ACE_Dummy_Node/g; +s/\bDynamic_Node\b/ACE_Dynamic_Node/g; +s/\bElapsed_Time\b/ACE_Elapsed_Time/g; +s/\bEvent_Handler\b/ACE_Event_Handler/g; +s/\bEvent_Handler_T\b/ACE_Event_Handler_T/g; +s/\bFIFO\b/ACE_FIFO/g; +s/\bFIFO_Recv\b/ACE_FIFO_Recv/g; +s/\bFIFO_Recv_Msg\b/ACE_FIFO_Recv_Msg/g; +s/\bFIFO_Send\b/ACE_FIFO_Send/g; +s/\bFIFO_Send_Msg\b/ACE_FIFO_Send_Msg/g; +s/\bFunction_Node\b/ACE_Function_Node/g; +s/\bGet_Opt\b/ACE_Get_Opt/g; +s/\bGuard\b/ACE_Guard/g; +s/\bHANDLE\b/ACE_HANDLE/g; +s/\bHandle_Set_Iterator\b/ACE_Handle_Set_Iterator/g; +s/\bHandle_Set\b/ACE_Handle_Set/g; +s/\bHigh_Res_Timer\b/ACE_High_Res_Timer/g; +s/\bINET_Addr\b/ACE_INET_Addr/g; +s/\bIO_Cntl_Cmds\b/ACE_IO_Cntl_Cmds/g; +s/\bIO_Cntl_Msg\b/ACE_IO_Cntl_Msg/g; +s/\bIO_Vector\b/ACE_IO_Vector/g; +s/\bIPC_SAP\b/ACE_IPC_SAP/g; +s/\bLSOCK\b/ACE_LSOCK/g; +s/\bLSOCK_Acceptor\b/ACE_LSOCK_Acceptor/g; +s/\bLSOCK_Aceeptor\b/ACE_LSOCK_Aceeptor/g; +s/\bLSOCK_CODgram\b/ACE_LSOCK_CODgram/g; +s/\bLSOCK_Connector\b/ACE_LSOCK_Connector/g; +s/\bLSOCK_Dgram\b/ACE_LSOCK_Dgram/g; +s/\bLSOCK_Stream\b/ACE_LSOCK_Stream/g; +s/\bLocal_Memory_Pool\b/ACE_Local_Memory_Pool/g; +s/\bLocation_Node\b/ACE_Location_Node/g; +s/\bLog_Msg\b/ACE_Log_Msg/g; +s/\bLog_Priority\b/ACE_Log_Priority/g; +s/\bLog_Record\b/ACE_Log_Record/g; +s/\bMalloc\b/ACE_Malloc/g; +s/\bMalloc_Align\b/ACE_Malloc_Align/g; +s/\bMalloc_Header\b/ACE_Malloc_Header/g; +s/\bMalloc_Stats\b/ACE_Malloc_Stats/g; +s/\bMap_Entry\b/ACE_Map_Entry/g; +s/\bMap_Iterator\b/ACE_Map_Iterator/g; +s/\bMap_Manager\b/ACE_Map_Manager/g; +s/\bMem_Map\b/ACE_Mem_Map/g; +s/\bMMAP_Memory_Pool\b/ACE_MMAP_Memory_Pool/g; +s/\bMT_SYNCH\b/ACE_MT_SYNCH/g; +s/\bMemory_Pool\b/ACE_Memory_Pool/g; +s/\bMessage_Block\b/ACE_Message_Block/g; +s/\bMessage_Queue\b/ACE_Message_Queue/g; +s/\bMessage_Type\b/ACE_Message_Type/g; +s/\bModule\b/ACE_Module/g; +s/\bModule_Link\b/ACE_Module_Link/g; +s/\bModule_Type\b/ACE_Module_Type/g; +s/\bMultiplexor\b/ACE_Multiplexor/g; +s/\bMutex\b/ACE_Mutex/g; +s/\bNull_Condition\b/ACE_Null_Condition/g; +s/\bNull_Mutex\b/ACE_Null_Mutex/g; +s/\bNULL_SYNCH\b/ACE_NULL_SYNCH/g; +s/\bObchunk\b/ACE_Obchunk/g; +s/\bObject_Node\b/ACE_Object_Node/g; +s/\bObstack\b/ACE_Obstack/g; +s/\bOneshot_Acceptor\b/ACE_Oneshot_Acceptor/g; +s/\bParse_Node\b/ACE_Parse_Node/g; +s/\bProcess_Mutex\b/ACE_Process_Mutex/g; +s/\bProfile_Timer\b/ACE_Profile_Timer/g; +s/\bQ_Entry\b/ACE_Q_Entry/g; +s/\bQueue\b/ACE_Queue/g; +s/\bRW_Mutex\b/ACE_RW_Mutex/g; +s/\bRaw_Data_Block\b/ACE_Raw_Data_Block/g; +s/\bReactor\b/ACE_Reactor/g; +s/\bReactor_Mask\b/ACE_Reactor_Mask/g; +s/\bReactor_Token\b/ACE_Reactor_Token/g; +s/\bRead_Guard\b/ACE_Read_Guard/g; +s/\bRecursive_Lock\b/ACE_Recursive_Lock/g; +s/\bRemove_Node\b/ACE_Remove_Node/g; +s/\bRequest_Queue\b/ACE_Request_Queue/g; +s/\bResume_Node\b/ACE_Resume_Node/g; +s/\bSOCK\b/ACE_SOCK/g; +s/\bSOCK_Acceptor\b/ACE_SOCK_Acceptor/g; +s/\bSOCK_CODgram\b/ACE_SOCK_CODgram/g; +s/\bSOCK_Connector\b/ACE_SOCK_Connector/g; +s/\bSOCK_DGRAM\b/ACE_SOCK_DGRAM/g; +s/\bSOCK_Dgram\b/ACE_SOCK_Dgram/g; +s/\bSOCK_Dgram_Bcast\b/ACE_SOCK_Dgram_Bcast/g; +s/\bSOCK_Dgram_Mcast\b/ACE_SOCK_Dgram_Mcast/g; +s/\bSOCK_IO\b/ACE_SOCK_IO/g; +s/\bSOCK_Stream\b/ACE_SOCK_Stream/g; +s/\bSPIPE\b/ACE_SPIPE/g; +s/\bSPIPE_Acceptor\b/ACE_SPIPE_Acceptor/g; +s/\bSPIPE_Addr\b/ACE_SPIPE_Addr/g; +s/\bSPIPE_Connector\b/ACE_SPIPE_Connector/g; +s/\bSPIPE_IO\b/ACE_SPIPE_Stream/g; +s/\bSPIPE_Msg\b/ACE_SPIPE_Msg/g; +s/\bSString\b/ACE_SString/g; +s/\bSV_Message\b/ACE_SV_Message/g; +s/\bSV_Message_Queue\b/ACE_SV_Message_Queue/g; +s/\bSV_Semaphore\b/ACE_SV_Semaphore/g; +s/\bSV_Semaphore_Complex\b/ACE_SV_Semaphore_Complex/g; +s/\bSV_Semaphore_Simple\b/ACE_SV_Semaphore_Simple/g; +s/\bSV_Shared_Memory\b/ACE_SV_Shared_Memory/g; +s/\bSemaphore\b/ACE_Semaphore/g; +s/\bService_Config\b/ACE_Service_Config/g; +s/\bService_Manager\b/ACE_Service_Manager/g; +s/\bService_Object\b/ACE_Service_Object/g; +s/\bService_Object_Type\b/ACE_Service_Object_Type/g; +s/\bService_Record\b/ACE_Service_Record/g; +s/\bService_Repository\b/ACE_Service_Repository/g; +s/\bService_Repository_Iterator\b/ACE_Service_Repository_Iterator/g; +s/\bService_Type\b/ACE_Service_Type/g; +s/\bShared_Malloc\b/ACE_Shared_Malloc/g; +s/\bShared_Malloc_MM\b/ACE_Shared_Malloc_MM/g; +s/\bShared_Malloc_SV\b/ACE_Shared_Malloc_SV/g; +s/\bShared_Memory\b/ACE_Shared_Memory/g; +s/\bShared_Memory_Pool\b/ACE_Shared_Memory_Pool/g; +s/\bShared_Object\b/ACE_Shared_Object/g; +s/\bSig_Action\b/ACE_Sig_Action/g; +s/\bSig_Handler\b/ACE_Sig_Handler/g; +s/\bSig_Set\b/ACE_Sig_Set/g; +s/\bSignalHandler\b/ACE_SignalHandler/g; +s/\bSignalHandlerV\b/ACE_SignalHandlerV/g; +s/\bSignal_Guard\b/ACE_Signal_Guard/g; +s/\bSignal_Handler\b/ACE_Signal_Handler/g; +s/\bStatic_Node\b/ACE_Static_Node/g; +s/\bStr_Buf\b/ACE_Str_Buf/g; +s/\bStream\b/ACE_Stream/g; +s/\bStream_Head\b/ACE_Stream_Head/g; +s/\bStream_Iterator\b/ACE_Stream_Iterator/g; +s/\bStream_Modules\b/ACE_Stream_Modules/g; +s/\bStream_Node\b/ACE_Stream_Node/g; +s/\bStream_Tail\b/ACE_Stream_Tail/g; +s/\bSTREAM_Type\b/ACE_STREAM_Type/g; +s/\bSuspend_Node\b/ACE_Suspend_Node/g; +s/\bSvc_Handler\b/ACE_Svc_Handler/g; +s/\bSvc_Manager\b/ACE_Svc_Manager/g; +s/\bSvc_Tuple\b/ACE_Svc_Tuple/g; +s/\bSynch\b/ACE_Synch/g; +s/\bSynch_Options\b/ACE_Synch_Options/g; +s/\bTHR_FUNC\b/ACE_THR_FUNC/g; +s/\bTLI\b/ACE_TLI/g; +s/\bTLI_Acceptor\b/ACE_TLI_Acceptor/g; +s/\bTLI_Connector\b/ACE_TLI_Connector/g; +s/\bTLI_Stream\b/ACE_TLI_Stream/g; +s/\bTask\b/ACE_Task/g; +s/\bThread\b/ACE_Thread/g; +s/\bThread_Control\b/ACE_Thread_Control/g; +s/\bThread_Manager\b/ACE_Thread_Manager/g; +s/\bThread_Mutex\b/ACE_Thread_Mutex/g; +s/\bThread_Spawn\b/ACE_Thread_Spawn/g; +s/\bThread_Specific\b/ACE_Thread_Specific/g; +s/\bThru_Task\b/ACE_Thru_Task/g; +s/\bTime_Value\b/ACE_Time_Value/g; +s/\bTimer_Handle\b/ACE_Timer_Handle/g; +s/\bTimer_Queue\b/ACE_Timer_Queue/g; +s/\bToken\b/ACE_Token/g; +s/\bTrace\b/ACE_Trace/g; +s/\bTry_Guard\b/ACE_Try_Guard/g; +s/\bTyped_SV_Message\b/ACE_Typed_SV_Message/g; +s/\bTyped_SV_Message_Queue\b/ACE_Typed_SV_Message_Queue/g; +s/\bUNIX_Addr\b/ACE_UNIX_Addr/g; +s/\bUPIPE\b/ACE_UPIPE/g; +s/\bUPIPE_Addr\b/ACE_UPIPE_Addr/g; +s/\bUPIPE_Stream\b/ACE_UPIPE_Stream/g; +s/\bUPIPE_Acceptor\b/ACE_UPIPE_Acceptor/g; +s/\bUPIPE_Connector\b/ACE_UPIPE_Connector/g; +s/\bWrite_Guard\b/ACE_Write_Guard/g; +s@ace/ACE_@ace/@g; diff --git a/bin/vendor.fmt b/bin/vendor.fmt new file mode 100755 index 00000000000..a780d430fec --- /dev/null +++ b/bin/vendor.fmt @@ -0,0 +1,101 @@ +# +# vendor description header control file for ADTs +# please insert your company name in the field <vendor> +# +# K. Dorn +# + +VENDOR_COMPILATION_HEADER_CXX_START +"\n/*[ Compilation unit "\ + "----------------------------------------------------------\n"\ + "\n"\ + " Component : CSA - OSC\n"\ + "\n"\ + " Name : %s.[Ci]\n"\ + "\n"\ + " Author : %s\n"\ + "\n"\ + " Language : C++\n"\ + "\n"\ + " Creation Date : %s\n"\ + "\n"\ + " Test State : %%Q%%\n"\ + "\n"\ + " Description : %s\n"\ + "\n"\ + "\n"\ + " Copyright (C) <Vendor> 1995 All Rights Reserved\n"\ + "\n"\ + "--------------------------------------"\ + "---------------------------------------*/\n"\ + "/*] END */\n"\ + "#pragma ident \" %%Z%% %%M%% %%I%% (%%G%%), %%Y%% %%Q%%:"\ + " implementation file for class "\ + "%s \" \n "\ + "\n"\ + "\n" +VENDOR_COMPILATION_HEADER_CXX_END + + +VENDOR_METHOD_HEADER_CXX_START +"\n/*[ Method ---------------------"\ + "-------------------------------------------\n"\ + "\n"\ + " Name : %s\n"\ + "\n"\ + " Description : %s\n"\ + "\n"\ + " Return : %s\n"\ + "\n"\ + "--------------------------------------------"\ + "------------------------------*/\n\n" +VENDOR_METHOD_HEADER_CXX_END + + +VENDOR_COMPILATION_HEADER_HXX_START +"\n/*[ Compilation unit "\ + "----------------------------------------------------------\n"\ + "\n"\ + " Component : CSA - OSC\n"\ + "\n"\ + " Name : %s.h\n"\ + "\n"\ + " Author : %s\n"\ + "\n"\ + " Language : C++\n"\ + "\n"\ + " Creation Date : %s\n"\ + "\n"\ + " Test State : %%Q%%\n"\ + "\n"\ + " Description : %s\n"\ + "\n %s\n"\ + "\n"\ + "\n"\ + " Copyright (C) <Vendor> 1995 All Rights Reserved\n"\ + "\n"\ + "--------------------------------------"\ + "---------------------------------------*/\n"\ + "/*] END */\n"\ + "#pragma ident \" %%Z%% %%M%% %%I%% (%%G%%), %%Y%% %%Q%%:"\ + " implementation file for class "\ + "%s \" \n "\ + "\n"\ + "\n" +VENDOR_COMPILATION_HEADER_HXX_END + +VENDOR_CLASS_HEADER_HXX_START +"\n/*[ Class ---------------------"\ + "-------------------------------------------\n"\ + "\n"\ + " Name : %s\n"\ + "\n"\ + " Description : %s\n"\ + "\n %s\n"\ + "\n"\ + "--------------------------------------------"\ + "------------------------------*/\n\n" +VENDOR_CLASS_HEADER_HXX_END + + + |