diff options
Diffstat (limited to 'pkg/softools')
-rw-r--r-- | pkg/softools/README | 3 | ||||
-rw-r--r-- | pkg/softools/memchk.par | 2 | ||||
-rw-r--r-- | pkg/softools/memchk.x | 102 | ||||
-rw-r--r-- | pkg/softools/mkmanpage.cl | 15 | ||||
-rw-r--r-- | pkg/softools/mkmanpage.hlp | 43 | ||||
-rw-r--r-- | pkg/softools/mkmanpage.par | 5 | ||||
-rw-r--r-- | pkg/softools/mkpkg | 24 | ||||
-rw-r--r-- | pkg/softools/mktags.hlp | 54 | ||||
-rw-r--r-- | pkg/softools/mktags.par | 3 | ||||
-rw-r--r-- | pkg/softools/mktags.x | 172 | ||||
-rw-r--r-- | pkg/softools/mkttydata.hlp | 110 | ||||
-rw-r--r-- | pkg/softools/mkttydata.par | 4 | ||||
-rw-r--r-- | pkg/softools/softools.cl | 26 | ||||
-rw-r--r-- | pkg/softools/softools.hd | 19 | ||||
-rw-r--r-- | pkg/softools/softools.men | 15 | ||||
-rw-r--r-- | pkg/softools/softools.par | 4 | ||||
-rw-r--r-- | pkg/softools/tgutil.x | 136 | ||||
-rw-r--r-- | pkg/softools/x_softools.x | 6 |
18 files changed, 743 insertions, 0 deletions
diff --git a/pkg/softools/README b/pkg/softools/README new file mode 100644 index 00000000..985dde19 --- /dev/null +++ b/pkg/softools/README @@ -0,0 +1,3 @@ +SOFTOOLS -- Software tools package. This directory contains only the portable +software maintenance utilities. Additional tools may be found in the HOST$BOOT +directories and in the local USER package. diff --git a/pkg/softools/memchk.par b/pkg/softools/memchk.par new file mode 100644 index 00000000..2f53e9c4 --- /dev/null +++ b/pkg/softools/memchk.par @@ -0,0 +1,2 @@ +fname,s,h,STDIN,,,input file +passall,b,h,yes,,,pass good input lines as well as bad diff --git a/pkg/softools/memchk.x b/pkg/softools/memchk.x new file mode 100644 index 00000000..8fc5eef4 --- /dev/null +++ b/pkg/softools/memchk.x @@ -0,0 +1,102 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <ctype.h> + +# MEMCHK -- Scan the mem.log output produced by the debug version of MEMIO +# (this must be sorted first) and check for memory which is allocated but +# never freed. + +procedure t_memchk() + +int fd, ip +bool passall, mark +int addr, retaddr, seqno, action, class +int old_addr, old_seqno, old_action +char lbuf[SZ_LINE], old_lbuf[SZ_LINE] +char descr[SZ_LINE], old_descr[SZ_LINE] +char tokbuf[SZ_FNAME], fname[SZ_FNAME] + +bool clgetb() +int open(), getline(), nscan(), gctol() +define print_ 91 + +begin + call clgstr ("fname", fname, SZ_FNAME) + fd = open (fname, READ_ONLY, TEXT_FILE) + + passall = clgetb ("passall") + old_addr = 0 + old_action = 0 + + while (getline (fd, lbuf) != EOF) { + # Scan next line. + call sscan (lbuf) + call gargwrd (tokbuf, SZ_FNAME) + ip = 1; ip = gctol (tokbuf, ip, addr, 16) + call gargi (seqno) + call gargwrd (tokbuf, SZ_FNAME) + ip = 1; ip = gctol (tokbuf, ip, retaddr, 16) + call gargwrd (tokbuf, SZ_FNAME) + action = tokbuf[1] + call gargi (class) + call gargstr (descr, SZ_LINE) + + if (nscan() < 4) { + if (passall) + call putline (STDOUT, lbuf) + next + } + + if (addr != old_addr) { + # Starting a log for a new buffer address. + if (old_lbuf[1] != EOS) { + if (IS_ALPHA(old_action) && old_action != 'F') { + ip = 1 + while (old_lbuf[ip] != '\n' && old_lbuf[ip] != EOS) + ip = ip + 1 + old_lbuf[ip] = EOS + call printf ("%s %70t####\n") + call pargstr (old_lbuf) + + } else if (passall) + call putline (STDOUT, old_lbuf) + } + + } else { + # Verify operation on a particular buffer address. + + if (old_lbuf[1] != EOS && passall) + call putline (STDOUT, old_lbuf) + + mark = false + if (IS_ALPHA(action) && class == 1) + switch (old_action) { + case 'A', 'R': + if (action != 'R' && action != 'F') + mark = true + case 'F': + if (action != 'A') + mark = true + } + + if (mark) { + ip = 1 + while (lbuf[ip] != '\n' && lbuf[ip] != EOS) + ip = ip + 1 + lbuf[ip] = EOS + call printf ("%s %70t####\n") + call pargstr (lbuf) + lbuf[1] = EOS + } + } + + old_addr = addr + old_seqno = seqno + old_action = action + call strcpy (descr, old_descr, SZ_LINE) + call strcpy (lbuf, old_lbuf, SZ_LINE) + } + + if (old_lbuf[1] != EOS && passall) + call putline (STDOUT, old_lbuf) +end diff --git a/pkg/softools/mkmanpage.cl b/pkg/softools/mkmanpage.cl new file mode 100644 index 00000000..e78af577 --- /dev/null +++ b/pkg/softools/mkmanpage.cl @@ -0,0 +1,15 @@ +#{ MKMANPAGE -- Make a template for a manual page, ready to be filled in. +# Leaves us in the editor. +# +# mkmanpage (module) + +{ + fname = module // ".hlp" + + if (clformat) + copy (cltemplate, fname) + else + copy (xtemplate, fname) + + edit (fname) +} diff --git a/pkg/softools/mkmanpage.hlp b/pkg/softools/mkmanpage.hlp new file mode 100644 index 00000000..75721696 --- /dev/null +++ b/pkg/softools/mkmanpage.hlp @@ -0,0 +1,43 @@ +.help mkmanpage Feb86 softools +.ih +NAME +mkmanpage -- create and edit a new manual page +.ih +USAGE +mkmanage module +.ih +PARAMETERS +.ls module +The name of the program to be documented, i.e., the name that will appear at +the top of the manual page, and the root name of the ".hlp" file to be +created. +.le +.ls clformat = yes +Make a CL format manual page template? +.le +.ls cltemplate = "doc$mancl.hlp" +Filename of the template file for a CL manual page. +.le +.ls xtemplate = "doc$manx.hlp" +Filename of the template file for a library procedure manual page. +.le +.ih +DESCRIPTION +The \fImkmanpage\fR task is used to create a fill-in-the-blanks type +template, to be edited to create the manual page for the named help module +or task. Depending upon the type of manual page to be created, \fImkmanpage\fR +copies the template file to the current directory, creating a new file with +the name "module.hlp", where \fImodule\fR is the name entered on the +command line. The editor is called up to edit the file and the task exits. +.ih +EXAMPLES +1. Make a new manual page for task "page". + + cl> mkmanpage page + +The task creates a file "page.hlp" in the current directory, and calls +up the editor to edit the new file. +.ih +SEE ALSO +mkhelpdb, help, lroff +.endhelp diff --git a/pkg/softools/mkmanpage.par b/pkg/softools/mkmanpage.par new file mode 100644 index 00000000..a784425a --- /dev/null +++ b/pkg/softools/mkmanpage.par @@ -0,0 +1,5 @@ +module,s,a,,,,"module name" +clformat,b,h,yes,,,"make a CL format manual page template" +cltemplate,f,h,"doc$mancl.hlp",,,"template for a CL program manual page" +xtemplate,f,h,"doc$manx.hlp",,,"template for a procedure manual page" +fname,f,h diff --git a/pkg/softools/mkpkg b/pkg/softools/mkpkg new file mode 100644 index 00000000..f78b672a --- /dev/null +++ b/pkg/softools/mkpkg @@ -0,0 +1,24 @@ +# Make the SOFTOOLS package. + +$call relink +$exit + +update: + $call relink + $call install + ; + +relink: + $update libpkg.a + $omake x_softools.x + $link x_softools.o libpkg.a -o xx_softools.e + ; + +install: + $move xx_softools.e bin$x_softools.e + +libpkg.a: + memchk.x <ctype.h> + mktags.x <ctotok.h> <ctype.h> <error.h> + tgutil.x <ctotok.h> <ctype.h> <error.h> + ; diff --git a/pkg/softools/mktags.hlp b/pkg/softools/mktags.hlp new file mode 100644 index 00000000..5e07866d --- /dev/null +++ b/pkg/softools/mktags.hlp @@ -0,0 +1,54 @@ +.help mktags Sep85 softools +.ih +NAME +mktags -- tag all procedure declarations in a set of files +.ih +USAGE +mktags +.ih +PARAMETERS +.ls files = "*.x" +The files to be tagged, e.g., "*.x". +.le +.ls listing = no +If this switch is enabled a sorted list of all procedures declared in the +set of files will be printed on the standard output, giving the procedure +name, line and file number, and procedure declaration on each output line. +.le +.ls tags = yes +If this switch is enabled a "tags" file will be written in the current +directory for use with the VI editor. +.le +.ih +DESCRIPTION +The named files are scanned for procedure declarations. Each such declaration +found is buffered internally. When all files have been scanned the internal +tag database is sorted and the output files are generated. Two types of +output are provided: +.ls +.ls [1] +A summary of all procedures defined in the given set of files may be printed +on the standard output. This output may be used as a printed index to manually +find procedures in the given file set. +.le +.ls [2] +A "tags" format database file (a text file) may be written. This file is +read by the VI editor when a command of the form ":ta tag" is entered. +This command is used to edit procedures regardless of the file in which they +reside. For example, to edit procedure "maxmin", enter command ":ta maxmin" +when in VI. +.le +.le + + +By default the operation of \fImktags\fR is to silently update the tags +database. If a printed listing is desired the \fIlisting\fR switch must +be enabled. +.ih +BUGS +A fixed amount of storage is allocated internally and overflow will occur if +there are too many tags (procedures) or if there is too much text (the string +buffer will overflow). +.ih +SEE ALSO +.endhelp diff --git a/pkg/softools/mktags.par b/pkg/softools/mktags.par new file mode 100644 index 00000000..0a85ca3d --- /dev/null +++ b/pkg/softools/mktags.par @@ -0,0 +1,3 @@ +files,s,h,"*.x",,,files to be tagged +listing,b,h,no,,,list tags on standard output +tags,b,h,yes,,,write tags database for vi diff --git a/pkg/softools/mktags.x b/pkg/softools/mktags.x new file mode 100644 index 00000000..a879ab34 --- /dev/null +++ b/pkg/softools/mktags.x @@ -0,0 +1,172 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <error.h> +include <ctype.h> +include <ctotok.h> + +define SZ_LBUF 1024 +define MAX_TAGS 8192 +define SZ_SBUF 256000 +define TAGSFILE "tags" + + +# MKTAGS -- Make a "tags" database for the VI editor. Each line of this +# database contains the following fields: +# +# tag name of a procedure or macro define +# file source file in which the tag is found +# pattern VI search pattern for opening file to pattern +# +# Mktags takes as input a list of files and produces [1] the "tags" database +# file as output, [2] a tags listing on the standard output, or both [1],[2]. +# VI uses the tags database to rapidly move to the source for the named tag, +# using the ":ta tag" command. This is very useful when editing a large +# package, especially when it is not clear what file the tagged procedure +# is in. + +procedure t_mktags() + +char fname[SZ_FNAME], lbuf[SZ_LBUF], tag[SZ_FNAME] +bool listing, mktags +int fd, list, ip, ip1, ip2, op, linenum, i, j, out + +bool clgetb() +int tg_compare() +int clpopni(), clgfil() +int open(), tg_getlongline(), gstrmatch(), stridxs() +pointer tg_putstr() + +int ntags +pointer tg_op +pointer tg_sbuf +pointer tg_tag[MAX_TAGS] +pointer tg_file[MAX_TAGS] +pointer tg_lnum[MAX_TAGS] +pointer tg_lbuf[MAX_TAGS] +int tg_sort[MAX_TAGS] + +common /tagcom/ ntags, tg_op, tg_sbuf, tg_tag, tg_file, tg_lnum, tg_lbuf, + tg_sort + +begin + call malloc (tg_sbuf, SZ_SBUF, TY_CHAR) + list = clpopni ("files") + tg_op = tg_sbuf + ntags = 0 + + listing = clgetb ("listing") + mktags = clgetb ("tags") + + # Process each file in the list. + while (clgfil (list, fname, SZ_FNAME) != EOF) { + iferr (fd = open (fname, READ_ONLY, TEXT_FILE)) { + call erract (EA_WARN) + next + } else + linenum = 0 + + # Examine each line in the file until a procedure statement is + # found. Add a tag record for each such item found. + + while (tg_getlongline (fd, lbuf, SZ_LBUF, linenum) != EOF) { + if (gstrmatch (lbuf, "procedure", ip1, ip2) > 0) { + # Ignore keyword if found in argument list or string + # constant. + + ip = stridxs ("(\"#,;", lbuf) + if (ip < ip1) + next + + # Extract tag name. + for (ip=ip2+1; IS_WHITE (lbuf[ip]); ip=ip+1) + ; + for (op=1; lbuf[ip] != EOS; ip=ip+1) + if (IS_ALNUM(lbuf[ip]) || lbuf[ip] == '_') { + tag[op] = lbuf[ip] + op = op + 1 + } else + break + tag[op] = EOS + + # Delete newline. + while (lbuf[ip] != EOS) + ip = ip + 1 + if (lbuf[ip-1] == '\n') + lbuf[ip-1] = EOS + + # Add tag to tag list. + ntags = ntags + 1 + if (ntags > MAX_TAGS) + call error (1, "too many tags") + + tg_file[ntags] = tg_putstr (fname) + tg_lnum[ntags] = linenum + tg_tag [ntags] = tg_putstr (tag) + tg_lbuf[ntags] = tg_putstr (lbuf) + tg_sort[ntags] = ntags + } + } + + call close (fd) + call flush (STDOUT) + } + + call clpcls (list) + + # Sort the tags list. + if (ntags > 1) + call qsort (tg_sort, ntags, tg_compare) + + # Print the tags database file. Any existing tags file will be + # overwritten. + + if (mktags) { + iferr (call delete (TAGSFILE)) + ; + out = open (TAGSFILE, NEW_FILE, TEXT_FILE) + + do i = 1, ntags { + j = tg_sort[i] + call fprintf (out, "%s\t%s\t/^%s$/\n") + call pargstr (Memc[tg_tag[j]]) + call pargstr (Memc[tg_file[j]]) + call pargstr (Memc[tg_lbuf[j]]) + } + + call close (out) + } + + # Print the tags listing if desired. + if (listing) { + do i = 1, ntags { + j = tg_sort[i] + + # Process spooled line, compressing whitespace to a single + # blank and skipping leading whitespace. + + op = 1 + for (ip=tg_lbuf[j]; IS_WHITE (Memc[ip]); ip=ip+1) + ; + for (; Memc[ip] != EOS; ip=ip+1) + if (IS_WHITE (Memc[ip])) { + lbuf[op] = ' ' + op = op + 1 + while (IS_WHITE (Memc[ip])) + ip = ip + 1 + ip = ip - 1 + } else { + lbuf[op] = Memc[ip] + op = op + 1 + } + lbuf[op] = EOS + + call printf ("%-18s%3d %-18s %s\n") + call pargstr (Memc[tg_tag[j]]) + call pargi (tg_lnum[j]) + call pargstr (Memc[tg_file[j]]) + call pargstr (lbuf) + } + } + + call mfree (tg_sbuf, TY_CHAR) +end diff --git a/pkg/softools/mkttydata.hlp b/pkg/softools/mkttydata.hlp new file mode 100644 index 00000000..70533914 --- /dev/null +++ b/pkg/softools/mkttydata.hlp @@ -0,0 +1,110 @@ +.help mkttydata Jun90 softools +.ih +NAME +mkttydata -- build a cache for graphcap/termcap device entries +.ih +USAGE +mkttydata devices termcap_file output_file +.ih +PARAMETERS +.ls devlist +A comma delimited list of the devices whose termcap or graphcap entries +are to be compiled. +.le +.ls termcap_file +The name of the termcap or graphcap file be searched, e.g., "dev$termcap", +or "dev$graphcap". +.le +.ls output_file +The name of the output file to be written, an SPP include file containing +a number of declarations and data initialization statements. +This should be "dev$cachet.dat" if the standard termcap is being compiled, +and "dev$cacheg.dat" if the standard graphcap is being compiled. +.le +.ls verbose = yes +Causes a message to be printed for each device entry compiled. +.le +.ih +DESCRIPTION +The \fImkttydata\fR task is used by the IRAF system manager to precompile +the \fItermcap\fR or \fIgraphcap\fR entries for commonly used video or +graphics terminals. This can be advantageous on slow systems since otherwise +the termcap or graphcap file must be searched at runtime every time the +screen is cleared or a graph is plotted, reducing the performance and +interactive response of the system. Since each IRAF site will commonly use +a different set of devices, entries can only be cached by the local system +manager after the system is installed. [NOTE, Jun 1990: the above is +still true, but with the addition of features such as shared libraries and +multiple architecture support to some versions of IRAF, relinking IRAF is +more difficult and it is easier to make mistakes. Furthermore, modern +systems are getting very fast. For most sites it will be easier, and safer, +to merely copy frequently referenced device entries to the head of the +termcap or graphcap file and skip the sysgen.] + +The input to \fImkttydata\fR consists of a list of devices and a reference +to either the termcap or graphcap file. The output is an SPP include file +which is referenced by the procedures in the TTY package. After updating +the cache files, a full system sysgen is required to recompile the affected +modules, update them in the system libraries, and relink all executables. + +Enter the following values for the \fItermcap_file\fR and \fIoutput_file\fR +parameters to build the termcap and graphcap cache files. Note that for +caching to work the value of \fItermcap_file\fR must match that of +the \fItermcap\fR or \fIgraphcap\fR environment variable, hence do not +enter "graphcap" rather than "dev$graphcap", just because you happen to +be in the dev directory. + + +.ks +.nf + \fItermcap_file\fR \fIoutput_file\fR + + termcap dev$termcap dev$cachet.dat + graphcap dev$graphcap dev$cacheg.dat +.fi +.ke + + +After updating these files, perform a sysgen-relink to update the +system libraries and relink all executables (this takes a while, and +requires IRAF permissions and full sources). Instructions for performing +the sysgen-relink are given in the \fISite Manager's Guide\fR for your +IRAF system. The exact procedure for performing a sysgen-relink depends +upon the host system. In particular, if the system support multiple +architectures, each architecture must be restored and relinked separately. +Note that systems configured for multiple architecture support are +shipped configured "generic", and you must restore an architecture before +relinking or the entire IRAF system will be recompiled (which is time +consuming, and inadvisable due to the possibility of system or compiler +differences introducing bugs into IRAF). + +After this finishes, log out and back in and you should notice the +difference when running tasks like \fIpage\fR, \fIclear\fR, and \fIimplot\fR. + +Note that once a device entry is cached it cannot be modified without +going through this all over again, while if the entry is not cached it +can be edited and the new entry used immediately. It is therefore not +desirable to cache new termcap or graphcap entries until they have stopped +changing. Even after a device entry has been cached, however, it is possible +to test new entries by changing the entry name, or by changing the value +of the \fItermcap\fR or \fIgraphcap\fR environment variable. If these +values are different than they were when the entries were cached, the cached +entries will not be used, even if the device name matches that of a cached +entry. + +For additional information on graphcap see the "GIO Design" document. +For additional information on termcap see the Berkeley UNIX "Programmer's +Guide: Reference Manual", section 5. IRAF uses a standard UNIX termcap. +.ih +EXAMPLES +1. Update the graphcap cache. + + cl> mktty vt640,vt240,4012,cit414a dev$graphcap dev$cacheg.dat +.ih +BUGS +There is a fixed limit on the amount of data that can be cached. +If the limit is exceedd the affected TTY modules will fail to compile. +.ih +SEE ALSO +showcap, IRAF Site Manager's Guide +.endhelp diff --git a/pkg/softools/mkttydata.par b/pkg/softools/mkttydata.par new file mode 100644 index 00000000..f5b10d03 --- /dev/null +++ b/pkg/softools/mkttydata.par @@ -0,0 +1,4 @@ +devlist,s,a,,,,"devices (comma delimited list)" +termcap_file,f,a,"dev$termcap",,,"termcap filename" +output_file,f,a,"dev$cachet.dat",,,"name of output file" +verbose,b,h,yes diff --git a/pkg/softools/softools.cl b/pkg/softools/softools.cl new file mode 100644 index 00000000..8f95a70a --- /dev/null +++ b/pkg/softools/softools.cl @@ -0,0 +1,26 @@ +#{ SOFTOOLS -- Software tools package. This package contains tools and +# utilities used by the programmer (or user-programmer) for software +# development. + +package softools + +task $generic, + $mkpkg, + $rmbin, + $rmfiles, + $rtar, + $wtar, + $xc, + $xyacc = "$foreign" + +task mktags, + memchk = "softools$x_softools.e" + +task mkttydata = "softools$x_mkttydata.e" +task mkmanpage = "softools$mkmanpage.cl" + +task lroff, + mkhelpdb, + hdbexamine = "system$x_system.e" + +clbye() diff --git a/pkg/softools/softools.hd b/pkg/softools/softools.hd new file mode 100644 index 00000000..0a682d53 --- /dev/null +++ b/pkg/softools/softools.hd @@ -0,0 +1,19 @@ +# Help directory for the SOFTOOLS (software tools) package. + +$help = "pkg$system/help/" +$lroff = "pkg$system/help/lroff/" + +generic hlp = host$boot/generic/generic.hlp +hdbexamine hlp = help$hdbexamine.hlp +lroff hlp = lroff$lroff.hlp +mkhelpdb hlp = help$mkhelpdb.hlp +mkmanpage hlp = mkmanpage.hlp +mkpkg hlp = host$boot/mkpkg/mkpkg.hlp +mktags hlp = mktags.hlp +mkttydata hlp = mkttydata.hlp +rmbin hlp = host$boot/rmbin/rmbin.hlp" +rmfiles hlp = host$boot/rmfiles/rmfiles.hlp" +rtar hlp = host$boot/rtar/rtar.hlp" +wtar hlp = host$boot/wtar/wtar.hlp" +xc hlp = host$boot/spp/xc.hlp" +xyacc hlp = host$boot/xyacc/README" diff --git a/pkg/softools/softools.men b/pkg/softools/softools.men new file mode 100644 index 00000000..cdfaacbd --- /dev/null +++ b/pkg/softools/softools.men @@ -0,0 +1,15 @@ + generic - Preprocess a generic source file + hdbexamine - Examine a help database + lroff - Lroff (line-roff) text formatter + memchk - Process a memdbg mem.log file for errors + mkhelpdb - Make (compile) a help database + mkmanpage - Make a manual page + mkpkg - Make or update an object library or package + mktags - Tag all procedure declarations in a set of files + mkttydata - Build cache for termcap/graphcap device entries + rmbin - Find/delete binary files in subdirectories + rmfiles - Find/delete files in subdirectories + rtar - Read a TAR format archive file + wtar - Write a TAR format archive file + xc - Compile and/or link a program + xyacc - Build an SPP language parser diff --git a/pkg/softools/softools.par b/pkg/softools/softools.par new file mode 100644 index 00000000..b6390ea4 --- /dev/null +++ b/pkg/softools/softools.par @@ -0,0 +1,4 @@ +# Dummy package parameter file. + +version,s,h,"Sun Dec 15 13:34:55 MST 1985" +mode,s,h,ql diff --git a/pkg/softools/tgutil.x b/pkg/softools/tgutil.x new file mode 100644 index 00000000..5bb4787d --- /dev/null +++ b/pkg/softools/tgutil.x @@ -0,0 +1,136 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <error.h> +include <ctype.h> +include <ctotok.h> + +define SZ_LBUF 1024 +define MAX_TAGS 8192 +define SZ_SBUF 256000 +define TAGSFILE "tags" + + + +# TG_COMPARE -- String compare of two tags. + +int procedure tg_compare (s1, s2) + +int s1 # t_sort index of string 1 +int s2 # t_sort index of string 2 + +int ntags +pointer tg_op +pointer tg_sbuf +pointer tg_tag[MAX_TAGS] +pointer tg_file[MAX_TAGS] +pointer tg_lnum[MAX_TAGS] +pointer tg_lbuf[MAX_TAGS] +int tg_sort[MAX_TAGS] + +common /tagcom/ ntags, tg_op, tg_sbuf, tg_tag, tg_file, tg_lnum, tg_lbuf, + tg_sort + +int strncmp() + +begin + return (strncmp (Memc[tg_tag[s1]], Memc[tg_tag[s2]], ARB)) +end + + +# TG_PUTSTR -- Add a string to the string buffer and return a pointer to +# the beginning of the string. + +pointer procedure tg_putstr (str) + +char str[ARB] # string to be appended + +int nchars +pointer newstr +int strlen() + +int ntags +pointer tg_op +pointer tg_sbuf +pointer tg_tag[MAX_TAGS] +pointer tg_file[MAX_TAGS] +pointer tg_lnum[MAX_TAGS] +pointer tg_lbuf[MAX_TAGS] +int tg_sort[MAX_TAGS] + +common /tagcom/ ntags, tg_op, tg_sbuf, tg_tag, tg_file, tg_lnum, tg_lbuf, + tg_sort + +begin + nchars = strlen (str) + newstr = tg_op + + if (tg_op - tg_sbuf + nchars >= SZ_SBUF) + call error (2, "out of string buffer space") + + call strcpy (str, Memc[newstr], nchars) + tg_op = tg_op + nchars + 1 + + return (newstr) +end + + +# TG_GETLONGLINE -- Get a long line, i.e., a logical line possibly spanning +# several physical lines with the newlines escaped at the ends. Skip +# comment lines and .help sections. + +int procedure tg_getlongline (fd, obuf, maxch, linenum) + +int fd # input file +char obuf[ARB] # output buffer +int maxch +int linenum + +int op, status +int getline(), strncmp() + +begin + op = 1 + + while (maxch - op + 1 >= SZ_LINE) { + # Get next non-comment line. + repeat { + status = getline (fd, obuf[op]) + linenum = linenum + 1 + + if (status == EOF) { + break + } else if (obuf[op] == '#') { + next + } else if (obuf[op] == '.') { + # Skip help sections. + if (strncmp (obuf[op], ".help", 5) == 0) { + repeat { + status = getline (fd, obuf[op]) + linenum = linenum + 1 + if (status == EOF) + break + if (strncmp (obuf[op], ".endhelp", 8) == 0) + break + } + } else + break + } else + break + } + + if (status == EOF) { + if (op == 1) + return (EOF) + else + return (op - 1) + } else + op = op + status + + if (obuf[op-2] == '\\' && obuf[op-1] == '\n') + op = op - 2 + else + break + } + + return (op - 1) +end diff --git a/pkg/softools/x_softools.x b/pkg/softools/x_softools.x new file mode 100644 index 00000000..41009cfc --- /dev/null +++ b/pkg/softools/x_softools.x @@ -0,0 +1,6 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# Link the SOFTOOLS package. + +task mktags = t_mktags, + memchk = t_memchk |