4tags - C version of 4gltags
Posted in 1994
Are you looking for a tag generator for Informix 4GL, look no further. Are you unsatisfied with the speed for 4gltags in shell version(s) ?. Well here's the solution, C version of 4gltags. I was tired of the poor performance of other 4gltag programs, so I wrote this one i C. 'Highlights': Creates tags for FUNCTIONS and REPORTS. Automatically appends tags to existing tag file. Automatically sorts tags. Fast. (YMMV ;-) This is *NIX version, uses tsearch(). If you want the source for tsearch() so you can make a (yech) DOS version give me a mail. Comments and suggetions is welcome at: lajo@q8.dk Maybe this should go in the FAQ, Kerry ? ----------------------------- CUT HERE --------------------------------------- : "@(#)shar.sh 1.4" #! /bin/sh # # This is a shell archive. # Remove everything above this line and run sh on the resulting file. # If this archive is complete, you will see this message at the end: # "All files extracted" # # Created: Mon Dec 19 11:01:02 DNT 1994 by lajo at Kpd (Kuwait Petroleum Denmark). # Files archived in this archive: # README # 4tags.c # rm_trail.c # strstr.c # Makefile # 4tags.1 # #-------------------- if [ -f README -a README != -c ] then echo shar: README already exists else echo 'x - README (1691 characters)' sed -e 's/^X//' >README <<'SHAR-EOF' XMon Dec 19 10:41:46 DNT 1994 X X Yes this is a 'C' version of 4gltags. X X 4tags.c is pretty fast - on my machine it processed 8000 lines 4GL X code per second. X Yes both REPORT and FUNCTION declarations will become tags, duplicated X tags are ignored because vi can only use one and ignores the rest. X X In this package you will find : X X README - This File X 4tags.c X rm_trail.c X strstr.c - the Sources X Makefile - Makefile (also for free ;-) X 4tags.1 - Man page X X X Any comments and/or suggestions, send them to X lajo@q8.dk X X X This package was programmed and prepared by : X X Lars Johansson X Dansk Software R}dgivning Aps X Dydammen 5 X DK-2750 Ballerup X Denmark X lajo@dsr.dk X X Currently located at : X X Kuwait Petroleum (Danmark) A/S X Hummeltoftevej 49 X DK-2830 Virum X Denmark X lajo@q8.dk X X Copyright (c) Lars Johansson 1994 X X Notice: X Permission to use, copy, modify, distribute, and sell this software and X its documentation for any purpose is hereby granted without fee, provided X that the above copyright notices and this permission notice appear in X all copies of the software and related documentation. X X THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, X EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY X WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. X X IN NO EVENT SHALL LARS JOHANSSON BE LIABLE FOR ANY SPECIAL, INCIDENTAL, X INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER X RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE X POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR X IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. X SHAR-EOF chmod README if [ `wc -c <README` -ne 1691 ] then echo shar: README unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f 4tags.c -a README != -c ] then echo shar: 4tags.c already exists else echo 'x - 4tags.c (8075 characters)' sed -e 's/^X//' >4tags.c <<'SHAR-EOF' X/* ------------------------------------------------------------------------- X * File : 4tags.c X * Author : Lars Johansson (lajo@q8.dk) X * Date : 16/12/94 X * Purpose : Creates tags for Informix 4gl file(s) X * X * Notice: X * Permission to use, copy, modify, distribute, and sell this software and X * its documentation for any purpose is hereby granted without fee, provided X * that the above copyright notices and this permission notice appear in X * all copies of the software and related documentation. X * X * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, X * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY X * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. X * X * IN NO EVENT SHALL LARS JOHANSSON BE LIABLE FOR ANY SPECIAL, INCIDENTAL, X * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER X * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE X * POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR X * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. X * X * ------------------------------------------------------------------------- */ Xstatic char Copyright[] = "Copyright (c) Lars Johansson 1994"; Xstatic char sccs[] = "@(#)4tags.c 2.9 94/12/19 10:56:30"; X#include <stdio.h> X#include <signal.h> X#include <search.h> X Xchar *mem_error = "Sorry, no more memory"; X Xint verbose; Xint append; Xint update; X X Xvoid SigHandler(int Sig); Xchar *strstr(char*, char*); Xint SaveTag(void *Save ); Xint SaveTag1(void *Save ); Xint WriteTags(char *tmpname, char *mode); Xint TagSort(char *p1, char *p2); X Xstatic int Antal=0; Xstatic int Line=0; Xstatic long TotalLines=0; Xstatic int Debug=0; Xstatic long Compares=0; Xstatic int Complain=1; Xstatic FILE *OutFile; Xstatic char FileName[1024]; Xstatic void *Tree_Head; X Xmain( int argc, char **argv) X{ X X FILE *fp, *outfp; X char tmpname[256]; X char omode[10]; X int index=1, files=0; X extern char *optarg; X extern int optind; X int c; X X if ( argc < 2) X { X printhelp(); X exit(1); X } X append=1; X strcpy(tmpname, "tags"); X strcpy(omode, "w"); X X /* Get some options */ X while ((c = getopt (argc, argv, "do:qv?")) != -1 ) X { X switch (c) X { X case 'd': Debug=1; break; X case 'o': X strcpy(tmpname, optarg); X break; X case 'q': Complain=0; break; X case 'v': verbose=1; break; X case '?': X default: X printhelp(); X exit(1); X X } X } X X if (Debug) X { X printf("Debug: Enabling all signals\\n"); X for(Line=0; Line < 30; Line++) X signal(Line, SigHandler); X Line=0; X } X X /* X * Rest of argv must be files - loop thru 'em X */ X argc--; X for(; optind <= argc; optind++) X { X if ( (fp = fopen(argv[optind], "r")) != NULL) X { X strcpy(FileName, argv[optind]); X MakeTag(fp, argv[optind]); X fclose(fp); X files++; X } X index++; X } X if (files) X { X WriteTags(tmpname, omode); X } X else X if ( verbose ) X printf("No files processed\\n"); X X if ( verbose ) X { X printf("%d Files Processed\\n", files); X printf("%d Lines Process\\n", TotalLi