├── AUTHORS
├── BOKIN_MODEL
├── BOKIN_MODEL_FAQ
├── COPYING
├── COPYING.LIB
├── ChangeLog
├── DONORS
├── FAQ
├── INSTALL
├── LICENSE
├── Makefile.am
├── Makefile.in
├── NEWS
├── README
├── THANKS
├── acinclude.m4
├── aclocal.m4
├── config-h.in
├── config.guess
├── config.sub
├── configure
├── configure.ac
├── convert.pl
├── depcomp
├── doc
├── Makefile.am
├── Makefile.in
├── define.texi
├── faq.texi
├── fdl.texi
├── global.info
├── global.ref
├── global.texi
├── globash.ref
├── gozilla.ref
├── gtags-cscope.ref
├── gtags-parser.ref
├── gtags.ref
├── htags.ref
├── mdate-sh
├── reference.texi
├── stamp-vti
├── texinfo.tex
└── version.texi
├── global
├── Makefile.am
├── Makefile.in
├── const.h
├── global.1
├── global.c
└── manual.in
├── globash.rc
├── globash
├── Makefile.am
├── Makefile.in
├── const.h
├── globash.1
├── globash.in
├── globash.rc
└── manual.in
├── gozilla
├── Makefile.am
├── Makefile.in
├── const.h
├── gozilla.1
├── gozilla.c
└── manual.in
├── gtags-cscope.vim
├── gtags-cscope
├── Makefile.am
├── Makefile.in
├── const.h
├── gtags-cscope.1
├── gtags-cscope.c
└── manual.in
├── gtags.conf
├── gtags.conf.in
├── gtags.el
├── gtags.pl
├── gtags.vim
├── gtags
├── Makefile.am
├── Makefile.in
├── const.h
├── gtags.1
├── gtags.c
└── manual.in
├── htags-refkit
├── Makefile.am
├── Makefile.in
├── README
└── htags_path2url.c
├── htags
├── Makefile.am
├── Makefile.in
├── anchor.c
├── anchor.h
├── asm.c
├── asm.l
├── assoc.c
├── assoc.h
├── bless.sh.tmpl
├── c.c
├── c.l
├── cache.c
├── cache.h
├── cflowindex.c
├── common.c
├── common.h
├── completion.cgi.tmpl
├── completion.cgi.tmpl.in
├── const.h
├── cpp.c
├── cpp.l
├── defineindex.c
├── dupindex.c
├── fileindex.c
├── ghtml.cgi.tmpl
├── global.cgi.tmpl
├── global.cgi.tmpl.in
├── htags.1
├── htags.c
├── htags.h
├── incop.c
├── incop.h
├── java.c
├── java.l
├── jscode_suggest.tmpl
├── jscode_treeview.tmpl
├── lexcommon.h
├── manual.in
├── path2url.c
├── path2url.h
├── php.c
├── php.l
├── src2html.c
├── style.css
└── style.css.tmpl
├── icons
├── Makefile.am
├── Makefile.in
├── back.png
├── bottom.png
├── c.png
├── dir.png
├── first.png
├── help.png
├── index.png
├── last.png
├── left.png
├── n_bottom.png
├── n_first.png
├── n_last.png
├── n_left.png
├── n_right.png
├── n_top.png
├── pglobe.png
├── right.png
├── text.png
└── top.png
├── install-sh
├── jquery
├── Makefile.am
├── Makefile.in
├── images
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── file.gif
│ ├── folder-closed.gif
│ ├── folder.gif
│ ├── minus.gif
│ ├── plus.gif
│ ├── treeview-black-line.gif
│ ├── treeview-black.gif
│ ├── treeview-default-line.gif
│ ├── treeview-default.gif
│ ├── treeview-famfamfam-line.gif
│ ├── treeview-famfamfam.gif
│ ├── treeview-gray-line.gif
│ ├── treeview-gray.gif
│ ├── treeview-red-line.gif
│ └── treeview-red.gif
├── jquery.js
├── jquery.suggest.css
├── jquery.suggest.js
├── jquery.treeview.css
└── jquery.treeview.js
├── libdb
├── Makefile.am
├── Makefile.in
├── README
├── bt_close.c
├── bt_conv.c
├── bt_debug.c
├── bt_delete.c
├── bt_get.c
├── bt_open.c
├── bt_overflow.c
├── bt_page.c
├── bt_put.c
├── bt_search.c
├── bt_seq.c
├── bt_split.c
├── bt_utils.c
├── btree.h
├── compat.h
├── db.c
├── db.h
├── extern.h
├── mpool.c
├── mpool.h
└── queue.h
├── libglibc
├── Makefile.am
├── Makefile.in
├── getopt.c
├── getopt.h
├── getopt1.c
├── getopt_int.h
├── hash-string.c
├── hash-string.h
├── obstack.c
├── obstack.h
├── regex.c
├── regex.h
└── snprintf.c
├── libltdl
├── COPYING.LIB
├── Makefile.am
├── Makefile.in
├── README
├── argz.c
├── argz_.h
├── libltdl
│ ├── lt__alloc.h
│ ├── lt__dirent.h
│ ├── lt__glibc.h
│ ├── lt__private.h
│ ├── lt__strl.h
│ ├── lt_dlloader.h
│ ├── lt_error.h
│ ├── lt_system.h
│ └── slist.h
├── loaders
│ ├── dld_link.c
│ ├── dlopen.c
│ ├── dyld.c
│ ├── load_add_on.c
│ ├── loadlibrary.c
│ ├── preopen.c
│ └── shl_load.c
├── lt__alloc.c
├── lt__dirent.c
├── lt__strl.c
├── lt_dlloader.c
├── lt_error.c
├── ltdl.c
├── ltdl.h
└── slist.c
├── libparser
├── C.c
├── Cpp.c
├── HACKING
├── Kconfig.c
├── Makefile.am
├── Makefile.in
├── asm_parse.c
├── asm_parse.h
├── asm_parse.y
├── asm_res.gpf
├── asm_res.h
├── asm_res.in
├── asm_scan.c
├── asm_scan.l
├── c_res.gpf
├── c_res.h
├── c_res.in
├── cpp_res.gpf
├── cpp_res.h
├── cpp_res.in
├── internal.h
├── java.c
├── java_res.gpf
├── java_res.h
├── java_res.in
├── parser.c
├── parser.h
├── php.c
├── php.l
├── php_res.gpf
├── php_res.h
├── php_res.in
└── reserved.pl
├── libutil
├── Makefile.am
├── Makefile.in
├── abs2rel.c
├── abs2rel.h
├── args.c
├── args.h
├── char.c
├── char.h
├── checkalloc.c
├── checkalloc.h
├── compress.c
├── compress.h
├── conf.c
├── conf.h
├── date.c
├── date.h
├── dbop.c
├── dbop.h
├── defined.c
├── defined.h
├── die.c
├── die.h
├── env.c
├── env.h
├── fileop.c
├── fileop.h
├── find.c
├── find.h
├── format.h
├── getdbpath.c
├── getdbpath.h
├── global.h
├── gparam.h
├── gpathop.c
├── gpathop.h
├── gtagsop.c
├── gtagsop.h
├── idset.c
├── idset.h
├── is_unixy.c
├── is_unixy.h
├── langmap.c
├── langmap.h
├── langmap.h.in
├── linetable.c
├── linetable.h
├── locatestring.c
├── locatestring.h
├── makepath.c
├── makepath.h
├── path.c
├── path.h
├── pathconvert.c
├── pathconvert.h
├── pool.c
├── pool.h
├── split.c
├── split.h
├── statistics.c
├── statistics.h
├── strbuf.c
├── strbuf.h
├── strhash.c
├── strhash.h
├── strlimcpy.c
├── strlimcpy.h
├── strmake.c
├── strmake.h
├── tab.c
├── tab.h
├── test.c
├── test.h
├── token.c
├── token.h
├── usable.c
├── usable.h
├── varray.c
├── varray.h
├── version.c
├── version.h
├── xargs.c
└── xargs.h
├── ltmain.sh
├── missing
├── plugin-example
├── Makefile.am
├── Makefile.in
├── README
└── exuberant-ctags.c
└── reconf.sh
/DONORS:
--------------------------------------------------------------------------------
1 | ___________________________________
2 | | | | | | _ | | |
3 | | |___| | | | | _| | | | GNU GLOBAL source code tag system
4 | | | | | | | | | | |
5 | | ~~ | ~~| | ~ | | | ~~| for all hackers.
6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 | Copyright (c) 2007 Tama Communications Corporation
8 |
9 | Everyone is permitted to copy and distribute verbatim copies
10 | of this document, but changing it is not allowed.
11 |
12 | ----------------------------------
13 |
14 | Donor List
15 | ==========
16 |
17 | This is the list of donations to GNU GLOBAL.
18 |
19 | o This announcement is based on the BOKIN model. Please see BOKIN_MODEL.
20 | o JPY means Japanese yen. All donations are converted into JPY.
21 |
22 | Thank you very much for the donation to GNU GLOBAL!
23 |
24 | No Date Name Nationality Amount(JPY)
25 | ---------------------------------------------------------------------------
26 | 1 2007/08/15 Akiyoshi Saiki Japan 10000
27 | 2 2009/11/25 Kuninori Morimoto Japan 5000
28 | 3 2010/08/20 kiyoad Japan 10000
29 | ===========================================================================
30 | Total 25000
31 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2000, 2001, 2002 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | SUBDIRS = libglibc libutil libparser libltdl plugin-example
14 | if !USE_DB185_COMPAT
15 | SUBDIRS += libdb
16 | endif
17 | SUBDIRS += global gozilla gtags htags htags-refkit gtags-cscope globash \
18 | doc icons jquery jquery/images
19 |
20 | gtagsdir = ${datadir}/gtags
21 | gtags_DATA = AUTHORS COPYING ChangeLog FAQ INSTALL LICENSE NEWS README THANKS \
22 | gtags.conf gtags.el gtags.pl gtags.vim gtags-cscope.vim \
23 | BOKIN_MODEL BOKIN_MODEL_FAQ DONORS
24 |
25 | EXTRA_DIST = ${gtags_DATA} reconf.sh convert.pl
26 |
27 | # If you would like to install gtags.el to the lisp directory then uncomment
28 | # the following line.
29 | # dist_lisp_LISP = gtags.el
30 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | ___________________________________
2 | | | | | | _ | | |
3 | | |___| | | | | _| | | | GNU GLOBAL source code tag system
4 | | | | | | | | | | |
5 | | ~~ | ~~| | ~ | | | ~~| for all hackers.
6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 | Copyright (c) 2000, 2001, 2002, 2003, 2004, 2007 Tama Communications Corporation
8 |
9 | This file is free software; as a special exception the author gives
10 | unlimited permission to copy and/or distribute it, with or without
11 | modifications, as long as this notice is preserved.
12 |
13 | This program is distributed in the hope that it will be useful, but
14 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
15 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 |
17 | ----------------------------------
18 |
19 | GNU GLOBAL is a source code tag system that works the same way across diverse
20 | environments. It supports C, C++, Yacc, Java, PHP4 and assembly source code.
21 |
22 | * BOKINware
23 |
24 | GNU GLOBAL is BOKINware. It means that it is free software based on
25 | GNU GPL, and is commercial (for-profit) software based on BOKIN model.
26 |
27 | BOKIN Model is a business model to obtain proceeds by widely collecting
28 | donations while developing and distributing free software. This model is
29 | constructed not to take away consumer's freedom of software, and is similar
30 | to the model of FSF except that FSF is not commercial organization.
31 |
32 | Your contribution is put on donors list in DONORS file, and distributed
33 | all over the world with GNU GLOBAL itself.
34 | Please see the files: DONORS, BOKIN_MODEL and BOKIN_MODEL_FAQ for more details.
35 |
36 | * Supported OS
37 |
38 | GNU system - Debian, Fedora, Suse, etc.
39 | BSD system - FreeBSD, NetBSD, OpenBSD, MacOSX, etc.
40 | Besides, various POSIX compatible systems.
41 |
42 | [Note] Though GNU GLOBAL supports only UNIX(POSIX) environment,
43 | some outsite projects develop DOS or Windows 32 version of it.
44 | Please see:
45 | http://www.gnu.org/software/global/download.html
46 |
47 | * How to install
48 |
49 | Please see 'INSTALL'.
50 |
51 | * Documentation
52 |
53 | Please see 'doc/global.texi'(texinfo format) to know how to use GLOBAL.
54 | You can see it even on GLOBAL's web site:
55 | http://www.gnu.org/software/global/globaldoc_toc.html
56 | http://www.gnu.org/software/global/manual/
57 |
58 | The descriptions about new facilities are added to 'NEWS'. At least,
59 | you should read '[INCOMPATIBLE CHANGES]' for each version.
60 |
61 | * License
62 |
63 | You may redistribute copies of GNU GLOBAL under the terms of
64 | the GNU General Public License. For more information about
65 | these matters, see the files named 'LICENSE' and 'COPYING'.
66 |
67 | * Latest information
68 |
69 | You can see the latest information on GLOBAL's web site.
70 |
71 | http://www.gnu.org/software/global/whatsnew.html
72 |
73 | * Mailing list
74 |
75 | If you think you have found a bug or a suggestion for improvements
76 | in GLOBAL or you need help about GLOBAL, then some mailing lists are
77 | available. Please see GLOBAL's WWW.
78 |
79 | http://www.gnu.org/software/global/maillist.html
80 |
81 | Enjoy!
82 |
--------------------------------------------------------------------------------
/acinclude.m4:
--------------------------------------------------------------------------------
1 | # Local additions to Autoconf macros.
2 | #
3 | # Copyright (c) 2000, 2001 Tama Communications Corporation
4 | #
5 | # This file is part of GNU GLOBAL.
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU General Public License as published by
9 | # the Free Software Foundation, either version 3 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with this program. If not, see .
19 | #
20 | AC_DEFUN([AG_DJGPP],
21 | [AC_CACHE_CHECK([whether we are using the GNU DJGPP compiler], ac_cv_djgpp,
22 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifdef __DJGPP__
23 | int a;
24 | #else
25 | XXXXXX
26 | #endif]])],[ac_cv_djgpp=yes],[ac_cv_djgpp=no])])
27 | AM_CONDITIONAL(DJGPP, test $ac_cv_djgpp = yes)
28 | ])
29 |
--------------------------------------------------------------------------------
/doc/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2000, 2001 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | info_TEXINFOS = global.texi
14 |
15 | global_TEXINFOS = fdl.texi reference.texi define.texi faq.texi \
16 | global.ref gtags.ref htags.ref gozilla.ref gtags-cscope.ref globash.ref
17 |
18 | EXTRA_DIST = texinfo.tex
19 |
--------------------------------------------------------------------------------
/doc/globash.ref:
--------------------------------------------------------------------------------
1 | @c This file is generated automatically by convert.pl from globash/manual.in.
2 | @unnumberedsubsec NAME
3 | globash - a special shell for GLOBAL using GNU bash.
4 | @unnumberedsubsec SYNOPSIS
5 | @noindent
6 | @quotation
7 | blobash@*
8 | @end quotation
9 | @unnumberedsubsec DESCRIPTION
10 | Globash is a special shell for GLOBAL using GNU bash.
11 | You can use a lot of function to ease reading source code
12 | like tag stack, tag mark and cookie.
13 | At first, you should make tag files using gtags and
14 | invoke this command in the project.
15 | Please refer to the help (type 'ghelp') about a detailed usage.
16 | @unnumberedsubsec FILES
17 | @table @asis
18 | @item @file{GTAGS}
19 | Tag file for object definitions.
20 | @item @file{GRTAGS}
21 | Tag file for object references.
22 | @item @file{GPATH}
23 | Tag file for path of source files.
24 | @item @file{~/.globashrc}
25 | The personal initialization file, executed for globash.
26 | @end table
27 | @unnumberedsubsec ENVIRONMENT
28 | The following environment variables affect the execution of globash:
29 | @table @asis
30 | @item @var{EDITOR}
31 | The editor used by the show command.
32 | @end table
33 | @unnumberedsubsec SEE ALSO
34 | gtags(1),
35 | htags(1),
36 | less(1).
37 |
38 | GNU GLOBAL source code tag system@*
39 | (http://www.gnu.org/software/global/).
40 | @unnumberedsubsec AUTHOR
41 | Shigio YAMAGUCHI.
42 | @unnumberedsubsec HISTORY
43 | The global command appeared in GLOBAL-4.1(2001).
44 |
--------------------------------------------------------------------------------
/doc/gtags-cscope.ref:
--------------------------------------------------------------------------------
1 | @c This file is generated automatically by convert.pl from gtags-cscope/manual.in.
2 | @unnumberedsubsec NAME
3 | gtags-cscope - pseudo cscope which implements the line-oriented interface
4 | @unnumberedsubsec SYNOPSIS
5 | @noindent
6 | @quotation
7 | gtags-cscope [-Cqv]@*
8 | @end quotation
9 | @unnumberedsubsec DESCRIPTION
10 | Gtags-cscope is a pseudo cscope which implements the
11 | line-oriented interface of cscope(1).
12 | You can use this command for various clients instead of true cscope.
13 |
14 | Since gtags-cscope is intended to make GLOBAL available
15 | through cscope interface, the output is not necessarily the same
16 | as cscope.
17 |
18 | Command 2 is not available.
19 | This command is used as a internal command for context search.
20 | @unnumberedsubsec OPTIONS
21 | The following options are available:
22 | @table @asis
23 | @item @samp{-C}, @samp{--ignore-case}
24 | Ignore letter case when searching.
25 | @item @samp{-q}, @samp{--quiet}
26 | Quiet mode.
27 | @item @samp{-v}, @samp{--verbose}
28 | Verbose mode.
29 | @end table
30 | @unnumberedsubsec EXAMPLES
31 | @example
32 | $ gtags-cscope
33 | >> help
34 | 0: Find this C symbol
35 | 1: Find this definition
36 | 2: (This command is used by gtags-cscope.vim internally)
37 | 3: Find functions calling this function
38 | 4: Find this text string
39 | 6: Find this egrep pattern
40 | 7: Find this file
41 | 8: Find files #including this file
42 | c: Toggle ignore/use letter case
43 | r: Rebuild the database
44 | q: Quit the session
45 | h: Show help
46 | >> 1main
47 | cscope: 9 lines
48 | global/global.c main 158 main(int argc, char **argv)
49 | gozilla/gozilla.c main 155 main(int argc, char **argv)
50 | gtags-parser/gctags.c main 158 main(int argc, char **argv)
51 | gtags-cscope/gtags-cscope.c main 115 main(int argc, char **argv)
52 | gtags/gtags.c main 150 main(int argc, char **argv)
53 | htags-refkit/htags_path2url.c main 281 main(int argc, char **argv)
54 | htags/htags.c main 1400 main(int argc, char **argv)
55 | libglibc/getopt.c main 704 main (argc, argv)
56 | libglibc/getopt1.c main 93 main (argc, argv)
57 | >> q
58 | $ _
59 | @end example
60 | @unnumberedsubsec DIAGNOSTICS
61 | Gtags-cscope exits with a non 0 value if an error occurred, 0 otherwise.
62 | @unnumberedsubsec SEE ALSO
63 | cscope(1),
64 | gtags(1),
65 | global(1),
66 | htags(1).
67 |
68 | GNU GLOBAL source code tag system@*
69 | (http://www.gnu.org/software/global/).
70 | @unnumberedsubsec BUG
71 | The second field of the output is almost since
72 | GLOBAL doesn't recognize it.
73 | Command 2 (Find functions called by this function) is not implemented.
74 | @unnumberedsubsec AUTHOR
75 | Shigio YAMAGUCHI.
76 | @unnumberedsubsec HISTORY
77 | The gtags-cscope command appeared in 2006.
78 |
--------------------------------------------------------------------------------
/doc/reference.texi:
--------------------------------------------------------------------------------
1 | @c This file is generated automatically by convert.pl from a set of manual.in.
2 | @menu
3 | * global:: global - print locations of the specified object.
4 | * gtags:: gtags - create tag files for global.
5 | * htags:: htags - generate a hypertext from a set of source files.
6 | * gozilla:: gozilla - force mozilla to display specified part of a source file.
7 | * gtags-cscope:: gtags-cscope - pseudo cscope which implements the line-oriented interface
8 | * globash:: globash - a special shell for GLOBAL using GNU bash.
9 | @end menu
10 |
11 | @node global
12 | @section global - print locations of the specified object.
13 | @include global.ref
14 | @node gtags
15 | @section gtags - create tag files for global.
16 | @include gtags.ref
17 | @node htags
18 | @section htags - generate a hypertext from a set of source files.
19 | @include htags.ref
20 | @node gozilla
21 | @section gozilla - force mozilla to display specified part of a source file.
22 | @include gozilla.ref
23 | @node gtags-cscope
24 | @section gtags-cscope - pseudo cscope which implements the line-oriented interface
25 | @include gtags-cscope.ref
26 | @node globash
27 | @section globash - a special shell for GLOBAL using GNU bash.
28 | @include globash.ref
29 |
--------------------------------------------------------------------------------
/doc/stamp-vti:
--------------------------------------------------------------------------------
1 | @set UPDATED 6 December 2010
2 | @set UPDATED-MONTH December 2010
3 | @set EDITION 5.9.3
4 | @set VERSION 5.9.3
5 |
--------------------------------------------------------------------------------
/doc/version.texi:
--------------------------------------------------------------------------------
1 | @set UPDATED 6 December 2010
2 | @set UPDATED-MONTH December 2010
3 | @set EDITION 5.9.3
4 | @set VERSION 5.9.3
5 |
--------------------------------------------------------------------------------
/global/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2000 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | bin_PROGRAMS= global
14 |
15 | global_SOURCES = global.c
16 |
17 | INCLUDES = @INCLUDES@
18 |
19 | LDADD = @LDADD@
20 |
21 | global_LDADD = $(LDADD) $(LIBLTDL)
22 | global_DEPENDENCIES = $(LDADD) $(LTDLDEPS)
23 |
24 | man_MANS = global.1
25 |
26 | EXTRA_DIST = $(man_MANS) const.h manual.in
27 |
--------------------------------------------------------------------------------
/globash/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | bin_SCRIPTS = globash
14 |
15 | body = $(srcdir)/$(bin_SCRIPTS).in
16 |
17 | $(bin_SCRIPTS): $(body)
18 | sed -e 's!@DATADIR@!'$(datadir)/gtags'!g' $(body) >$(bin_SCRIPTS).tmp && \
19 | chmod +x $(bin_SCRIPTS).tmp && mv $(bin_SCRIPTS).tmp $(bin_SCRIPTS)
20 |
21 | man_MANS = $(bin_SCRIPTS).1
22 |
23 | gtagsdir = ${datadir}/gtags
24 | gtags_DATA = globash.rc
25 |
26 | EXTRA_DIST = $(man_MANS) $(bin_SCRIPTS).in $(gtags_DATA) manual.in
27 |
28 | CLEANFILES = $(bin_SCRIPTS)
29 |
--------------------------------------------------------------------------------
/globash/const.h:
--------------------------------------------------------------------------------
1 | /* This file is generated automatically by convert.pl from globash/manual.in. */
2 | const char *progname = "globash";
3 | const char *usage_const = "Usage: blobash\n";
4 | See also:\n\
5 | GNU GLOBAL web site: http://www.gnu.org/software/global/\n\
6 | ";
7 |
--------------------------------------------------------------------------------
/globash/globash.1:
--------------------------------------------------------------------------------
1 | .\" This file is generated automatically by convert.pl from globash/manual.in.
2 | .TH GLOBASH 1 "May 2010" "GNU Project"
3 | .SH NAME
4 | globash \- a special shell for GLOBAL using GNU bash.
5 | .SH SYNOPSIS
6 | \fBblobash\fP
7 | .br
8 | .SH DESCRIPTION
9 | \fBGlobash\fP is a special shell for GLOBAL using GNU bash.
10 | You can use a lot of function to ease reading source code
11 | like tag stack, tag mark and cookie.
12 | At first, you should make tag files using \fBgtags\fP and
13 | invoke this command in the project.
14 | Please refer to the help (type 'ghelp') about a detailed usage.
15 | .SH FILES
16 | .TP
17 | \'GTAGS\'
18 | Tag file for object definitions.
19 | .TP
20 | \'GRTAGS\'
21 | Tag file for object references.
22 | .TP
23 | \'GPATH\'
24 | Tag file for path of source files.
25 | .TP
26 | \'~/.globashrc\'
27 | The personal initialization file, executed for globash.
28 | .SH ENVIRONMENT
29 | The following environment variables affect the execution of \fBglobash\fP:
30 | .TP
31 | \fBEDITOR\fP
32 | The editor used by the show command.
33 | .SH "SEE ALSO"
34 | \fBgtags\fP(1),
35 | \fBhtags\fP(1),
36 | \fBless\fP(1).
37 | .PP
38 | GNU GLOBAL source code tag system
39 | .br
40 | (http://www.gnu.org/software/global/).
41 | .SH AUTHOR
42 | Shigio YAMAGUCHI.
43 | .SH HISTORY
44 | The \fBglobal\fP command appeared in GLOBAL-4.1(2001).
45 |
--------------------------------------------------------------------------------
/globash/globash.in:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # globash - a special shell for GLOBAL using GNU bash.
4 | #
5 | # Copyright (c) 2010 Tama Communications Corporation
6 | #
7 | # This file is part of GNU GLOBAL.
8 | #
9 | # This program is free software: you can redistribute it and/or modify
10 | # it under the terms of the GNU General Public License as published by
11 | # the Free Software Foundation, either version 3 of the License, or
12 | # (at your option) any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with this program. If not, see .
21 | #
22 | ### Working directory
23 | #
24 | # The HOME_ETC environment variable is used by home-etc facility
25 | # in PLD Linux/GNU. GloBash obey this method if the variable defined.
26 | #
27 | case $1 in
28 | -x) set -x;;
29 | esac
30 | if [ -n "$HOME_ETC" ]; then
31 | GHOME="$HOME_ETC/.globash"
32 | else
33 | GHOME="$HOME/.globash"
34 | fi
35 | prompt="Do you create '$GHOME'? ([y]/n)"
36 | if [ ! -d "$GHOME" ]; then
37 | echo -n "GloBash needs a working directory. $prompt"
38 | while read ans; do
39 | case $ans in
40 | YES|Yes|yes|Y|y|"")
41 | echo -n "Creating..."
42 | if mkdir "$GHOME"; then
43 | echo "Done."
44 | break
45 | else
46 | echo "cannot make '$GHOME' directory."
47 | exit 1
48 | fi
49 | ;;
50 | NO|No|no|N|n)
51 | echo "Bye ..."
52 | exit 1;;
53 | esac
54 | echo -n "$prompt"
55 | done
56 | echo
57 | echo "___________________________________________"
58 | echo "| | | | | _ | | | | |"
59 | echo "| |___| | | | | _| | | ---| | | A special shell for GLOBAL"
60 | echo "| | | | | | | | | | |"
61 | echo "| ~~ | ~~| | ~ | | |--- | | | using GNU bash"
62 | echo "___________________________________________|"
63 | echo
64 | echo "Copyright (c) 2001, 2002, 2004, 2006, 2009, 2010"
65 | echo "Tama Communications Corporation"
66 | echo
67 | echo "Welcome to GloBash!"
68 | echo
69 | fi
70 | prompt="Do you create tag files in the current directory? ([y]/n)"
71 | if [ "`global -p 2>/dev/null`" = "" ]; then
72 | echo -n "GTAGS not found. $prompt"
73 | while read ans; do
74 | case $ans in
75 | Y|y|"") echo -n "Creating..."
76 | gtags
77 | echo "Done."
78 | break;;
79 | N|n) echo "Please make tag files using gtags(1) before starting this command. Bye."
80 | exit 1;;
81 | esac
82 | echo -n "$prompt"
83 | done
84 | echo
85 | fi
86 | exec bash --rcfile "@DATADIR@/globash.rc"
87 |
--------------------------------------------------------------------------------
/globash/manual.in:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2001, 2002, 2004, 2006, 2009, 2010
3 | # Tama Communications Corporation
4 | #
5 | # This file is part of GNU GLOBAL.
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU General Public License as published by
9 | # the Free Software Foundation, either version 3 of the License, or
10 | # (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU General Public License
18 | # along with this program. If not, see .
19 | #
20 | # This file is converted to the following files:
21 | # o command source file(for usage and help).
22 | # o man format reference manual.
23 | # o texinfo format reference manual.
24 | #
25 | @HEADER GLOBASH,1,May 2010,GNU Project
26 | @NAME globash - a special shell for GLOBAL using GNU bash.
27 | @SYNOPSIS
28 | @name{blobash}
29 | @DESCRIPTION
30 | @name{Globash} is a special shell for GLOBAL using GNU bash.
31 | You can use a lot of function to ease reading source code
32 | like tag stack, tag mark and cookie.
33 | At first, you should make tag files using @name{gtags} and
34 | invoke this command in the project.
35 | Please refer to the help (type 'ghelp') about a detailed usage.
36 | @FILES
37 | @begin_itemize
38 | @item{@file{GTAGS}}
39 | Tag file for object definitions.
40 | @item{@file{GRTAGS}}
41 | Tag file for object references.
42 | @item{@file{GPATH}}
43 | Tag file for path of source files.
44 | @item{@file{~/.globashrc}}
45 | The personal initialization file, executed for globash.
46 | @end_itemize
47 | @ENVIRONMENT
48 | The following environment variables affect the execution of @name{globash}:
49 | @begin_itemize
50 | @item{@var{EDITOR}}
51 | The editor used by the show command.
52 | @end_itemize
53 | @SEE ALSO
54 | @xref{gtags,1},
55 | @xref{htags,1},
56 | @xref{less,1}.
57 |
58 | GNU GLOBAL source code tag system@br
59 | (http://www.gnu.org/software/global/).
60 | @AUTHOR
61 | Shigio YAMAGUCHI.
62 | @HISTORY
63 | The @name{global} command appeared in GLOBAL-4.1(2001).
64 |
--------------------------------------------------------------------------------
/gozilla/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2002 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | bin_PROGRAMS= gozilla
14 |
15 | INCLUDES = @INCLUDES@
16 |
17 | LDADD = @LDADD@
18 |
19 | gozilla_DEPENDENCIES = $(LDADD)
20 |
21 | man_MANS = gozilla.1
22 |
23 | EXTRA_DIST = $(man_MANS) const.h manual.in
24 |
--------------------------------------------------------------------------------
/gozilla/const.h:
--------------------------------------------------------------------------------
1 | /* This file is generated automatically by convert.pl from gozilla/manual.in. */
2 | const char *progname = "gozilla";
3 | const char *usage_const = "Usage: gozilla [-b browser][-p][+no] file\n\
4 | gozilla [-b browser][-p] -d name\n";
5 | const char *help_const = "Options:\n\
6 | +no\n\
7 | Line number.\n\
8 | -b browser\n\
9 | Browser to use. By default, it is assumed mozilla.\n\
10 | -d name\n\
11 | Print object definitions.\n\
12 | --help\n\
13 | Show help.\n\
14 | -p\n\
15 | Print just a generated URL instead of displaying it.\n\
16 | file\n\
17 | File name or alias name.\n\
18 | -q, --quiet\n\
19 | Quiet mode.\n\
20 | -v, --verbose\n\
21 | Verbose mode.\n\
22 | --version\n\
23 | Show version number.\n\
24 | See also:\n\
25 | GNU GLOBAL web site: http://www.gnu.org/software/global/\n\
26 | ";
27 |
--------------------------------------------------------------------------------
/gozilla/gozilla.1:
--------------------------------------------------------------------------------
1 | .\" This file is generated automatically by convert.pl from gozilla/manual.in.
2 | .TH GOZILLA 1 "March 2010" "GNU Project"
3 | .SH NAME
4 | gozilla \- force mozilla to display specified part of a source file.
5 | .SH SYNOPSIS
6 | \fBgozilla\fP [-b browser][-p][+no] file
7 | .br
8 | \fBgozilla\fP [-b browser][-p] -d name
9 | .br
10 | .SH DESCRIPTION
11 | \fBGozilla\fP forces \fBmozilla\fP to display specified part of a source file.
12 | \fBGozilla\fP can be used with other browsers like firefox and epiphany.
13 | .PP
14 | In advance of using this command, you must execute \fBgtags\fP(1)
15 | and \fBhtags\fP(1) at the root directory of a project to make tag files.
16 | Then you can execute this command anywhere in the project.
17 | .PP
18 | First form:
19 | .br
20 | You can specify a source file and optional line number.
21 | This syntax is similar to \fBvi\fP(1) and \fBemacs\fP(1).
22 | .PP
23 | Second form:
24 | .br
25 | You can specify a definition name directly. The definition name should
26 | exist in \'GTAGS\'.
27 | .PP
28 | Some browsers require you to load it before executing \fBgozilla\fP.
29 | .SH OPTIONS
30 | The following options are available:
31 | .TP
32 | \fB+no\fP
33 | Line number.
34 | .TP
35 | \fB-b\fP \fIbrowser\fP
36 | Browser to use. By default, it is assumed \fBmozilla\fP.
37 | .TP
38 | \fB-d\fP \fIname\fP
39 | Print object definitions.
40 | .TP
41 | \fB--help\fP
42 | Show help.
43 | .TP
44 | \fB-p\fP
45 | Print just a generated URL instead of displaying it.
46 | .TP
47 | \fIfile\fP
48 | File name or alias name.
49 | .TP
50 | \fB-q\fP, \fB--quiet\fP
51 | Quiet mode.
52 | .TP
53 | \fB-v\fP, \fB--verbose\fP
54 | Verbose mode.
55 | .TP
56 | \fB--version\fP
57 | Show version number.
58 | .SH FILES
59 | .TP
60 | \'HTML/\'
61 | Hypertext of source code.
62 | .TP
63 | \'GTAGS/\'
64 | Tag file for object definitions.
65 | .TP
66 | \'$HOME/.gozillarc\'
67 | Alias file. Please read source code for the detail.
68 | .SH ENVIRONMENT
69 | .TP
70 | \fBGTAGSROOT\fP
71 | The root directory of the project.
72 | .TP
73 | \fBGTAGSDBPATH\fP
74 | The directory on which tag files exist.
75 | This value is ignored when GTAGSROOT is not defined.
76 | .TP
77 | \fBBROWSER\fP
78 | Browser to use. By default, it is assumed \fBmozilla\fP.
79 | .SH EXAMPLES
80 | .nf
81 | $ gtags
82 | $ htags
83 | $ global -x main
84 | main 82 ctags.c main(argc, argv)
85 | $ mozilla &
86 | $ gozilla +82 ctags.c
87 | $ gozilla -d main
88 | .PP
89 | $ firefox &
90 | $ gozilla -b firefox +82 ctags.c
91 | .PP
92 | .fi
93 | .SH DIAGNOSTICS
94 | \fBGozilla\fP exits with a non 0 value if an error occurred, 0 otherwise.
95 | .SH "SEE ALSO"
96 | \fBglobal\fP(1),
97 | \fBgtags\fP(1),
98 | \fBhtags\fP(1),
99 | \fBfirefox\fP(1),
100 | \fBepiphany\fP(1),
101 | \fBmozilla\fP(1).
102 | .PP
103 | GNU GLOBAL source code tag system
104 | .br
105 | (http://www.gnu.org/software/global/).
106 | .SH NOTES
107 | \fBGozilla\fP means 'Global for mozilla'.
108 | .SH BUGS
109 | \fBGozilla\fP can accept not only source files but also text files,
110 | directories, HTML files and even URLs, because it is omnivorous.
111 | .SH AUTHORS
112 | Shigio YAMAGUCHI.
113 | .SH HISTORY
114 | The \fBgozilla\fP command appeared in FreeBSD 2.2.2 but did not
115 | installed by default.
116 |
--------------------------------------------------------------------------------
/gtags-cscope/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2006 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | bin_PROGRAMS= gtags-cscope
14 |
15 | INCLUDES = @INCLUDES@
16 |
17 | LDADD = @LDADD@
18 |
19 | gtags_cscope_DEPENDENCIES = $(LDADD)
20 |
21 | man_MANS = gtags-cscope.1
22 |
23 | EXTRA_DIST = $(man_MANS) const.h manual.in
24 |
--------------------------------------------------------------------------------
/gtags-cscope/const.h:
--------------------------------------------------------------------------------
1 | /* This file is generated automatically by convert.pl from gtags-cscope/manual.in. */
2 | const char *progname = "gtags-cscope";
3 | const char *usage_const = "Usage: gtags-cscope [-Cqv]\n";
4 | const char *help_const = "Options:\n\
5 | -C, --ignore-case\n\
6 | Ignore letter case when searching.\n\
7 | -q, --quiet\n\
8 | Quiet mode.\n\
9 | -v, --verbose\n\
10 | Verbose mode.\n\
11 | See also:\n\
12 | GNU GLOBAL web site: http://www.gnu.org/software/global/\n\
13 | ";
14 |
--------------------------------------------------------------------------------
/gtags-cscope/gtags-cscope.1:
--------------------------------------------------------------------------------
1 | .\" This file is generated automatically by convert.pl from gtags-cscope/manual.in.
2 | .TH GTAGS-CSCOPE 1 "May 2006" "GNU Project"
3 | .SH NAME
4 | gtags\-cscope - pseudo cscope which implements the line-oriented interface
5 | .SH SYNOPSIS
6 | \fBgtags-cscope\fP [-Cqv]
7 | .br
8 | .SH DESCRIPTION
9 | \fBGtags-cscope\fP is a pseudo cscope which implements the
10 | line-oriented interface of \fBcscope\fP(1).
11 | You can use this command for various clients instead of true cscope.
12 | .PP
13 | Since \fBgtags-cscope\fP is intended to make GLOBAL available
14 | through cscope interface, the output is not necessarily the same
15 | as cscope.
16 | .PP
17 | Command 2 is not available.
18 | This command is used as a internal command for context search.
19 | .SH OPTIONS
20 | The following options are available:
21 | .TP
22 | \fB-C\fP, \fB--ignore-case\fP
23 | Ignore letter case when searching.
24 | .TP
25 | \fB-q\fP, \fB--quiet\fP
26 | Quiet mode.
27 | .TP
28 | \fB-v\fP, \fB--verbose\fP
29 | Verbose mode.
30 | .SH EXAMPLES
31 | .nf
32 | $ gtags-cscope
33 | >> help
34 | 0: Find this C symbol
35 | 1: Find this definition
36 | 2: (This command is used by gtags-cscope.vim internally)
37 | 3: Find functions calling this function
38 | 4: Find this text string
39 | 6: Find this egrep pattern
40 | 7: Find this file
41 | 8: Find files #including this file
42 | c: Toggle ignore/use letter case
43 | r: Rebuild the database
44 | q: Quit the session
45 | h: Show help
46 | >> 1main
47 | cscope: 9 lines
48 | global/global.c main 158 main(int argc, char **argv)
49 | gozilla/gozilla.c main 155 main(int argc, char **argv)
50 | gtags-parser/gctags.c main 158 main(int argc, char **argv)
51 | gtags-cscope/gtags-cscope.c main 115 main(int argc, char **argv)
52 | gtags/gtags.c main 150 main(int argc, char **argv)
53 | htags-refkit/htags_path2url.c main 281 main(int argc, char **argv)
54 | htags/htags.c main 1400 main(int argc, char **argv)
55 | libglibc/getopt.c main 704 main (argc, argv)
56 | libglibc/getopt1.c main 93 main (argc, argv)
57 | >> q
58 | $ _
59 | .fi
60 | .SH DIAGNOSTICS
61 | \fBGtags-cscope\fP exits with a non 0 value if an error occurred, 0 otherwise.
62 | .SH "SEE ALSO"
63 | \fBcscope\fP(1),
64 | \fBgtags\fP(1),
65 | \fBglobal\fP(1),
66 | \fBhtags\fP(1).
67 | .PP
68 | GNU GLOBAL source code tag system
69 | .br
70 | (http://www.gnu.org/software/global/).
71 | .SH BUG
72 | The second field of the output is almost since
73 | GLOBAL doesn't recognize it.
74 | Command 2 (Find functions called by this function) is not implemented.
75 | .SH AUTHOR
76 | Shigio YAMAGUCHI.
77 | .SH HISTORY
78 | The \fBgtags-cscope\fP command appeared in 2006.
79 |
--------------------------------------------------------------------------------
/gtags/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2000 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | bin_PROGRAMS= gtags
14 |
15 | INCLUDES = @INCLUDES@
16 |
17 | LDADD = @LDADD@
18 |
19 | gtags_LDADD = $(LDADD) $(LIBLTDL)
20 | gtags_DEPENDENCIES = $(LDADD) $(LTDLDEPS)
21 |
22 | man_MANS = gtags.1
23 |
24 | EXTRA_DIST = $(man_MANS) const.h manual.in
25 |
--------------------------------------------------------------------------------
/gtags/const.h:
--------------------------------------------------------------------------------
1 | /* This file is generated automatically by convert.pl from gtags/manual.in. */
2 | const char *progname = "gtags";
3 | const char *usage_const = "Usage: gtags [-ciIOqvw][-d tag-file][-f file][dbpath]\n";
4 | const char *help_const = "Options:\n\
5 | -c, --compact\n\
6 | Make GTAGS in compact format.\n\
7 | This option does not influence GRTAGS,\n\
8 | because they are always made in compact format.\n\
9 | --config[=name]\n\
10 | Print the value of config variable name.\n\
11 | If name is not specified then print all names and values.\n\
12 | -d, --dump tag-file\n\
13 | Dump a tag file. The output format is 'keydata'.\n\
14 | This is for debugging.\n\
15 | -f, --file file\n\
16 | Browse through all source files whose names are listed in file.\n\
17 | The argument file can be set to - to accept a list of\n\
18 | files from the standard input.\n\
19 | File names must be separated by newline.\n\
20 | --gtagsconf file\n\
21 | Set the GTAGSCONF environment variable to file.\n\
22 | --gtagslabel label\n\
23 | Set the GTAGSLABEL environment variable to label.\n\
24 | -I, --idutils\n\
25 | Also make the ID database file for idutils(1).\n\
26 | -i, --incremental\n\
27 | Update tag files incrementally. You had better use\n\
28 | global(1) with the -u option.\n\
29 | -O, --objdir\n\
30 | Use BSD-style objdir as the location of tag files.\n\
31 | If $MAKEOBJDIRPREFIX directory exists, gtags creates\n\
32 | $MAKEOBJDIRPREFIX/ directory and makes\n\
33 | tag files in it.\n\
34 | If dbpath is specified, this options is ignored.\n\
35 | --single-update file\n\
36 | Update tag files for single file.\n\
37 | It is considered that file was updated, and other files were not\n\
38 | updated. The file must be relative path name from the current directory.\n\
39 | This option implies the -i option.\n\
40 | If the file is new then --single-update is ignored,\n\
41 | and the processing is automatically switched to normal incremental updating.\n\
42 | --statistics\n\
43 | Print statistics information.\n\
44 | This option is valid only for normal creation of tag files.\n\
45 | -q, --quiet\n\
46 | Quiet mode.\n\
47 | -v, --verbose\n\
48 | Verbose mode.\n\
49 | -w, --warning\n\
50 | Print warning messages.\n\
51 | dbpath\n\
52 | The directory in which tag files are generated.\n\
53 | The default is the current directory.\n\
54 | See also:\n\
55 | GNU GLOBAL web site: http://www.gnu.org/software/global/\n\
56 | ";
57 |
--------------------------------------------------------------------------------
/htags-refkit/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2006 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | EXTRA_DIST = README htags_path2url.c
14 |
15 | htags_path2url: htags_path2url.c
16 | ${CC} -g -DTEST htags_path2url.c -o htags_path2url
17 |
--------------------------------------------------------------------------------
/htags/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2000, 2001, 2003, 2004, 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | bin_PROGRAMS= htags
14 |
15 | htags_SOURCES = htags.c defineindex.c dupindex.c fileindex.c cflowindex.c src2html.c \
16 | anchor.c cache.c common.c incop.c assoc.c path2url.c \
17 | c.c cpp.c java.c php.c asm.c
18 |
19 | noinst_HEADERS = htags.h anchor.h cache.h common.h incop.h assoc.h path2url.h \
20 | lexcommon.h
21 |
22 | INCLUDES = @INCLUDES@ -I$(srcdir)
23 |
24 | LDADD = @LDADD@
25 |
26 | htags_DEPENDENCIES = $(LDADD)
27 |
28 | man_MANS = htags.1
29 |
30 | gtagsdir = ${datadir}/gtags
31 | gtags_DATA = global.cgi.tmpl ghtml.cgi.tmpl completion.cgi.tmpl bless.sh.tmpl \
32 | jscode_suggest.tmpl jscode_treeview.tmpl style.css.tmpl
33 | EXTRA_DIST = $(man_MANS) $(gtags_DATA) manual.in global.cgi.tmpl.in completion.cgi.tmpl.in \
34 | const.h c.l cpp.l java.l php.l asm.l
35 | install-data-hook:
36 | dir="$(DESTDIR)$(localstatedir)/gtags/sitekeys"; \
37 | if [ ! -d $$dir ]; then \
38 | $(MKDIR_P) $$dir; \
39 | chmod 755 $$dir; \
40 | fi
41 |
--------------------------------------------------------------------------------
/htags/anchor.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2005 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _ANCHOR_H_
20 | #define _ANCHOR_H_
21 |
22 | #include "checkalloc.h"
23 | /*
24 | * Anchor table.
25 | *
26 | * Most names are written to tag[] directly.
27 | * Long name whose length > ANCHOR_NAMELEN are written to newly allocated
28 | * memory and are linked to reserve. It is necessary to clear the variable
29 | * which is not used.
30 | */
31 | #define ANCHOR_NAMELEN 32
32 | struct anchor {
33 | int lineno;
34 | char type;
35 | char done;
36 | int length;
37 | char tag[ANCHOR_NAMELEN];
38 | char *reserve;
39 | };
40 |
41 | #define gettag(a) (a->tag[0] ? a->tag : a->reserve)
42 | #define settag(a, b) do { \
43 | char *tag = b; \
44 | (a)->length = strlen(tag); \
45 | if ((a)->length < ANCHOR_NAMELEN) { \
46 | strlimcpy((a)->tag, tag, sizeof((a)->tag)); \
47 | (a)->reserve = NULL; \
48 | } else { \
49 | (a)->reserve = check_strdup(tag); \
50 | (a)->tag[0] = '\0'; \
51 | } \
52 | } while (0)
53 |
54 | #define A_PREV 0
55 | #define A_NEXT 1
56 | #define A_FIRST 2
57 | #define A_LAST 3
58 | #define A_TOP 4
59 | #define A_BOTTOM 5
60 | #define A_SIZE 6
61 |
62 | #define A_INDEX 6
63 | #define A_HELP 7
64 | #define A_LIMIT 8
65 |
66 | void anchor_prepare(FILE *);
67 | void anchor_load(const char *);
68 | void anchor_unload(void);
69 | struct anchor *anchor_first(void);
70 | struct anchor *anchor_next(void);
71 | struct anchor *anchor_get(const char *, int, int, int);
72 | int define_line(int);
73 | int *anchor_getlinks(int);
74 | void anchor_dump(FILE *, int);
75 |
76 | #endif /* _ANCHOR_H_ */
77 |
--------------------------------------------------------------------------------
/htags/assoc.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2010 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifdef HAVE_CONFIG_H
20 | #include
21 | #endif
22 | #ifdef STDC_HEADERS
23 | #include
24 | #endif
25 |
26 | #include "checkalloc.h"
27 | #include "die.h"
28 | #include "htags.h"
29 | #include "assoc.h"
30 |
31 | /*
32 | * assoc_open: open associate array.
33 | *
34 | * r) descriptor
35 | */
36 | ASSOC *
37 | assoc_open()
38 | {
39 | ASSOC *assoc = (ASSOC *)check_malloc(sizeof(ASSOC));
40 |
41 | /*
42 | * Use invisible temporary file.
43 | */
44 | assoc->dbop = dbop_open(NULL, 1, 0600, 0);
45 | if (assoc->dbop == NULL)
46 | abort();
47 | assoc->dbop->put_errmsg = "cannot write to temporary file.\nYou can specify the directory for the temporary file using environment variable 'TMPDIR'.";
48 | return assoc;
49 | }
50 | /*
51 | * assoc_close: close associate array.
52 | *
53 | * i) assoc descriptor
54 | */
55 | void
56 | assoc_close(ASSOC *assoc)
57 | {
58 | if (assoc == NULL)
59 | return;
60 | if (assoc->dbop == NULL)
61 | abort();
62 | dbop_close(assoc->dbop);
63 | free(assoc);
64 | }
65 | /*
66 | * assoc_put: put data into associate array.
67 | *
68 | * i) assoc descriptor
69 | * i) name name
70 | * i) value value
71 | */
72 | void
73 | assoc_put(ASSOC *assoc, const char *name, const char *value)
74 | {
75 | if (assoc->dbop == NULL)
76 | abort();
77 | dbop_put(assoc->dbop, name, value);
78 | }
79 | /*
80 | * assoc_put_withlen: put data into associate array.
81 | *
82 | * i) assoc descriptor
83 | * i) name name
84 | * i) value value
85 | * i) len length
86 | */
87 | void
88 | assoc_put_withlen(ASSOC *assoc, const char *name, const char *value, int len)
89 | {
90 | if (assoc->dbop == NULL)
91 | abort();
92 | dbop_put_withlen(assoc->dbop, name, value, len);
93 | }
94 | /*
95 | * assoc_get: get data from associate array.
96 | *
97 | * i) assoc descriptor
98 | * i) name name
99 | * r) value
100 | */
101 | const char *
102 | assoc_get(ASSOC *assoc, const char *name)
103 | {
104 | if (assoc->dbop == NULL)
105 | abort();
106 | return dbop_get(assoc->dbop, name);
107 | }
108 |
--------------------------------------------------------------------------------
/htags/assoc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2010 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _ASSOC_H_
20 | #define _ASSOC_H_
21 |
22 | #include "dbop.h"
23 |
24 | typedef struct {
25 | DBOP *dbop;
26 | } ASSOC;
27 |
28 | ASSOC *assoc_open(void);
29 | void assoc_close(ASSOC *);
30 | void assoc_put(ASSOC *, const char *, const char *);
31 | void assoc_put_withlen(ASSOC *, const char *, const char *, int);
32 | const char *assoc_get(ASSOC *, const char *);
33 |
34 | #endif /* ! _ASSOC_H_ */
35 |
--------------------------------------------------------------------------------
/htags/bless.sh.tmpl:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Copyright (c) 2000, 2004, 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | # Usage:
14 | # $ sh bless.sh
15 | #
16 | if [ ! -f 'bless.sh' ]; then
17 | echo "Bless.sh script should be executed as 'sh bless.sh'."
18 | exit 1
19 | fi
20 | #
21 | # Bless the site key.
22 | #
23 | pwd >@LOCALSTATEDIR@/gtags/sitekeys/@sitekey@
24 |
--------------------------------------------------------------------------------
/htags/cache.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2005, 2010 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifdef HAVE_CONFIG_H
20 | #include
21 | #endif
22 | #include
23 | #ifdef HAVE_STRING_H
24 | #include
25 | #else
26 | #include
27 | #endif
28 | #include
29 | #include "global.h"
30 | #include "assoc.h"
31 | #include "htags.h"
32 | #include "cache.h"
33 |
34 | static ASSOC *assoc[GTAGLIM];
35 | /*
36 | * Cache file is used for duplicate object entry.
37 | *
38 | * If function 'func()' is defined more than once then the cache record
39 | * of GTAGS has (1) the frequency and the name of duplicate object entry file,
40 | * else it has (2) the tag definition.
41 | * It can be distinguished the first character of the cache record.
42 | * If it is a blank then it is the former else the latter.
43 | *
44 | * (1) Duplicate tag file
45 | * +-----------------------+
46 | * |' '\0\0|
47 | * +-----------------------+
48 | * Duplicate tag file can be referred to as 'D/.html'.
49 | *
50 | * (2) Tag definition
51 | * +----------------------+
52 | * |\0\0|
53 | * +----------------------+
54 | * Tag is referred to as 'S/.html#'.
55 | */
56 |
57 | /*
58 | * cache_open: open cache file.
59 | */
60 | void
61 | cache_open(void)
62 | {
63 | assoc[GTAGS] = assoc_open();
64 | assoc[GRTAGS] = assoc_open();
65 | assoc[GSYMS] = symbol ? assoc_open() : NULL;
66 | }
67 | /*
68 | * cache_put: put tag line.
69 | *
70 | * i) db db type
71 | * i) tag tag name
72 | * i) line tag line
73 | */
74 | void
75 | cache_put(int db, const char *tag, const char *line, int len)
76 | {
77 | if (db >= GTAGLIM)
78 | die("I don't know such tag file.");
79 | assoc_put_withlen(assoc[db], tag, line, len);
80 | }
81 | /*
82 | * cache_get: get tag line.
83 | *
84 | * i) db db type
85 | * i) tag tag name
86 | * r) tag line
87 | */
88 | const char *
89 | cache_get(int db, const char *tag)
90 | {
91 | if (db >= GTAGLIM)
92 | die("I don't know such tag file.");
93 | return assoc_get(assoc[db], tag);
94 | }
95 | /*
96 | * cache_close: close cache file.
97 | */
98 | void
99 | cache_close(void)
100 | {
101 | int i;
102 |
103 | for (i = GTAGS; i < GTAGLIM; i++) {
104 | if (assoc[i]) {
105 | assoc_close(assoc[i]);
106 | assoc[i] = NULL;
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/htags/cache.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2010 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _CACHE_H_
20 | #define _CACHE_H_
21 |
22 | void cache_open(void);
23 | void cache_put(int, const char *, const char *, int);
24 | const char *cache_get(int, const char *);
25 | void cache_close(void);
26 |
27 | #endif /* ! _CACHE_H_ */
28 |
--------------------------------------------------------------------------------
/htags/completion.cgi.tmpl:
--------------------------------------------------------------------------------
1 | #! /usr/local/bin/perl
2 | #
3 | # Copyright (c) 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | $script_name = 'completion.cgi';
14 | sub error_and_exit {
15 | print STDERR "$script_name: " . $_[0];
16 | exit 1;
17 | }
18 | if (! -x '@globalpath@') {
19 | error_and_exit("server side command not found.");
20 | }
21 | @pairs = split (/&/, $ENV{'QUERY_STRING'});
22 | foreach $p (@pairs) {
23 | ($name, $value) = split(/=/, $p);
24 | $value =~ tr/+/ /;
25 | $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C", hex($1))/eg;
26 | $form{$name} = $value;
27 | }
28 | $q = $form{'q'};
29 | if (!$q) {
30 | error_and_exit("request value is null.");
31 | }
32 | $type = $form{'type'};
33 | if ($type eq 'definition' || $type eq 'reference') {
34 | $flags = 'c';
35 | } elsif ($type eq 'symbol') {
36 | $flags = 'cs';
37 | } elsif ($type eq 'path') {
38 | $flags = 'P';
39 | } elsif ($type eq 'idutils') {
40 | $flags = 'cI';
41 | } elsif ($type eq 'grep') {
42 | $flags = 'crs';
43 | } else {
44 | error_and_exit("invalid type name.");
45 | }
46 | if ($form{'icase'}) {
47 | $flags .= 'i';
48 | }
49 | if ($form{'other'}) {
50 | $flags .= 'o';
51 | }
52 | if ($form{'limit'}) {
53 | $limit = $form{'limit'};
54 | }
55 | if ($form{'id'}) {
56 | $sitekeys = "@LOCALSTATEDIR@/gtags/sitekeys/" . $form{'id'};
57 | if (-f $sitekeys && open(KEY, $sitekeys)) {
58 | $distpath = ;
59 | chop($distpath);
60 | close(KEY);
61 | } else {
62 | error_and_exit("couldn't open unique key file(1).");
63 | }
64 | chdir("$distpath/cgi-bin");
65 | if ($?) {
66 | error_and_exit("couldn't find tag directory in secure mode.");
67 | }
68 | }
69 | if (-f "../GTAGSROOT" && open(GTAGSROOT, "../GTAGSROOT")) {
70 | $gtagsroot = ;
71 | chop($gtagsroot);
72 | close(GTAGSROOT);
73 | } else {
74 | $gtagsroot = "../..";
75 | }
76 | chdir($gtagsroot);
77 | print "Content-Type: text/html\n\n";
78 | open(PIPE, "-|") || exec '@globalpath@', '-'.$flags, '-e', $q;
79 | if ($limit > 0) {
80 | while () {
81 | print if ($limit-- > 0);
82 | }
83 | } else {
84 | print ;
85 | }
86 | close(PIPE);
87 | exit(0);
88 |
--------------------------------------------------------------------------------
/htags/completion.cgi.tmpl.in:
--------------------------------------------------------------------------------
1 | #! @PERL@
2 | #
3 | # Copyright (c) 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | $script_name = 'completion.cgi';
14 | sub error_and_exit {
15 | print STDERR "$script_name: " . $_[0];
16 | exit 1;
17 | }
18 | if (! -x '@globalpath@') {
19 | error_and_exit("server side command not found.");
20 | }
21 | @pairs = split (/&/, $ENV{'QUERY_STRING'});
22 | foreach $p (@pairs) {
23 | ($name, $value) = split(/=/, $p);
24 | $value =~ tr/+/ /;
25 | $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C", hex($1))/eg;
26 | $form{$name} = $value;
27 | }
28 | $q = $form{'q'};
29 | if (!$q) {
30 | error_and_exit("request value is null.");
31 | }
32 | $type = $form{'type'};
33 | if ($type eq 'definition' || $type eq 'reference') {
34 | $flags = 'c';
35 | } elsif ($type eq 'symbol') {
36 | $flags = 'cs';
37 | } elsif ($type eq 'path') {
38 | $flags = 'P';
39 | } elsif ($type eq 'idutils') {
40 | $flags = 'cI';
41 | } elsif ($type eq 'grep') {
42 | $flags = 'crs';
43 | } else {
44 | error_and_exit("invalid type name.");
45 | }
46 | if ($form{'icase'}) {
47 | $flags .= 'i';
48 | }
49 | if ($form{'other'}) {
50 | $flags .= 'o';
51 | }
52 | if ($form{'limit'}) {
53 | $limit = $form{'limit'};
54 | }
55 | if ($form{'id'}) {
56 | $sitekeys = "@LOCALSTATEDIR@/gtags/sitekeys/" . $form{'id'};
57 | if (-f $sitekeys && open(KEY, $sitekeys)) {
58 | $distpath = ;
59 | chop($distpath);
60 | close(KEY);
61 | } else {
62 | error_and_exit("couldn't open unique key file(1).");
63 | }
64 | chdir("$distpath/cgi-bin");
65 | if ($?) {
66 | error_and_exit("couldn't find tag directory in secure mode.");
67 | }
68 | }
69 | if (-f "../GTAGSROOT" && open(GTAGSROOT, "../GTAGSROOT")) {
70 | $gtagsroot = ;
71 | chop($gtagsroot);
72 | close(GTAGSROOT);
73 | } else {
74 | $gtagsroot = "../..";
75 | }
76 | chdir($gtagsroot);
77 | print "Content-Type: text/html\n\n";
78 | open(PIPE, "-|") || exec '@globalpath@', '-'.$flags, '-e', $q;
79 | if ($limit > 0) {
80 | while () {
81 | print if ($limit-- > 0);
82 | }
83 | } else {
84 | print ;
85 | }
86 | close(PIPE);
87 | exit(0);
88 |
--------------------------------------------------------------------------------
/htags/ghtml.cgi.tmpl:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Copyright (c) 2008 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | # Please see 'HTML/.htaccess' for the detail.
14 | #
15 | echo "content-type: text/html"
16 | echo
17 | gzip -S ghtml -d -c "$PATH_TRANSLATED"
18 |
--------------------------------------------------------------------------------
/htags/incop.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2004, 2006 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _INCOP_H
20 | #define _INCOP_H
21 |
22 | #include "strbuf.h"
23 |
24 | struct data {
25 | #if defined(_WIN32) || defined(__DJGPP__)
26 | char name[MAXPATHLEN];
27 | #else
28 | char *name;
29 | #endif
30 | int id;
31 | int count;
32 | int ref_count;
33 | STRBUF *contents;
34 | STRBUF *ref_contents;
35 | };
36 |
37 | void init_inc(void);
38 | void put_inc(const char *, const char *, int);
39 | struct data *get_inc(const char *);
40 | struct data *first_inc(void);
41 | struct data *next_inc(void);
42 | void put_included(struct data *, const char *);
43 | struct data *get_included(const char *);
44 |
45 | #endif /* ! _INCOP_H */
46 |
--------------------------------------------------------------------------------
/htags/jscode_suggest.tmpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
--------------------------------------------------------------------------------
/htags/jscode_treeview.tmpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
--------------------------------------------------------------------------------
/htags/path2url.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004, 2010 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _GPATH_H_
20 | #define _GPATH_H_
21 |
22 | void load_gpath(const char *);
23 | const char *path2fid(const char *);
24 | const char *path2fid_readonly(const char *);
25 | void unload_gpath(void);
26 |
27 | #endif /* ! _GPATH_H_ */
28 |
--------------------------------------------------------------------------------
/htags/style.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005 Tama Communications Corporation
3 | *
4 | * This file is free software; as a special exception the author gives
5 | * unlimited permission to copy and/or distribute it, with or without
6 | * modifications, as long as this notice is preserved.
7 | *
8 | * This program is distributed in the hope that it will be useful, but
9 | * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 | * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 | */
12 | body { color: #191970; background-color: #f5f5dc; }
13 | a.visited { color: gray; }
14 | .title { color: #cc0000; }
15 | .error { color: red; }
16 | .cvs { font-size: 90%; }
17 | .caution { text-align: center; margin: 1em 40px; }
18 | .left { text-align: left; }
19 | .center { text-align: center; }
20 | .right { text-align: right; }
21 | img.icon { vertical-align: top; border: 0; }
22 | th, td { white-space: nowrap; }
23 | .tag { text-align: left; }
24 | .line { text-align: right; }
25 | .code { text-align: left; }
26 | th.file { text-align: center; }
27 | td.file { text-align: left; }
28 | table.flist { border-spacing: 2px; width: 100%; }
29 | em { font-style: normal; }
30 | em.comment { color: green; font-style: italic; }
31 | em.sharp { color: #8b0000; }
32 | em.brace { color: red; }
33 | em.position { color: gray; font-style: italic; }
34 | em.warned { background-color: yellow; }
35 | em.string { text-decoration: underline; }
36 | strong.reserved { font-weight: bold; }
37 |
--------------------------------------------------------------------------------
/htags/style.css.tmpl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2010 Tama Communications Corporation
3 | *
4 | * This file is free software; as a special exception the author gives
5 | * unlimited permission to copy and/or distribute it, with or without
6 | * modifications, as long as this notice is preserved.
7 | *
8 | * This program is distributed in the hope that it will be useful, but
9 | * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 | * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 | */
12 | body { color: #191970; background-color: #f5f5dc; }
13 | a.visited { color: gray; }
14 | .title { color: #cc0000; }
15 | .error { color: red; }
16 | .cvs { font-size: 90%; }
17 | .caution { text-align: center; margin: 1em 40px; }
18 | .left { text-align: left; }
19 | .center { text-align: center; }
20 | .right { text-align: right; }
21 | img.icon { vertical-align: top; border: 0; }
22 | th, td { white-space: nowrap; }
23 | .tag { text-align: left; }
24 | .line { text-align: right; }
25 | .code { text-align: left; }
26 | .curline:hover { background-color:lightgray; }
27 | th.file { text-align: center; }
28 | td.file { text-align: left; }
29 | table.flist { border-spacing: 2px; width: 100%; }
30 | em { font-style: normal; }
31 | em.comment { color: green; font-style: italic; }
32 | em.sharp { color: #8b0000; }
33 | em.brace { color: red; }
34 | em.position { color: gray; font-style: italic; }
35 | em.warned { background-color: yellow; }
36 | em.string { text-decoration: underline; }
37 | strong.reserved { font-weight: bold; }
38 |
--------------------------------------------------------------------------------
/icons/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2006 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | icons_DATA = index.png c.png text.png dir.png back.png help.png \
14 | first.png last.png left.png right.png top.png bottom.png \
15 | n_first.png n_last.png n_left.png n_right.png n_top.png n_bottom.png \
16 | pglobe.png
17 | iconsdir = ${datadir}/gtags/icons
18 |
19 | EXTRA_DIST = ${icons_DATA}
20 |
--------------------------------------------------------------------------------
/icons/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/back.png
--------------------------------------------------------------------------------
/icons/bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/bottom.png
--------------------------------------------------------------------------------
/icons/c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/c.png
--------------------------------------------------------------------------------
/icons/dir.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/dir.png
--------------------------------------------------------------------------------
/icons/first.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/first.png
--------------------------------------------------------------------------------
/icons/help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/help.png
--------------------------------------------------------------------------------
/icons/index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/index.png
--------------------------------------------------------------------------------
/icons/last.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/last.png
--------------------------------------------------------------------------------
/icons/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/left.png
--------------------------------------------------------------------------------
/icons/n_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/n_bottom.png
--------------------------------------------------------------------------------
/icons/n_first.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/n_first.png
--------------------------------------------------------------------------------
/icons/n_last.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/n_last.png
--------------------------------------------------------------------------------
/icons/n_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/n_left.png
--------------------------------------------------------------------------------
/icons/n_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/n_right.png
--------------------------------------------------------------------------------
/icons/n_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/n_top.png
--------------------------------------------------------------------------------
/icons/pglobe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/pglobe.png
--------------------------------------------------------------------------------
/icons/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/right.png
--------------------------------------------------------------------------------
/icons/text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/text.png
--------------------------------------------------------------------------------
/icons/top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/icons/top.png
--------------------------------------------------------------------------------
/jquery/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | jquery_DATA = jquery.js jquery.suggest.css jquery.suggest.js \
14 | jquery.treeview.css jquery.treeview.js
15 |
16 | jquerydir = ${datadir}/gtags/jquery
17 |
18 | EXTRA_DIST = ${jquery_DATA}
19 |
--------------------------------------------------------------------------------
/jquery/images/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | images_DATA = file.gif folder-closed.gif folder.gif minus.gif plus.gif \
14 | treeview-black-line.gif treeview-black.gif treeview-default-line.gif \
15 | treeview-default.gif treeview-famfamfam-line.gif treeview-famfamfam.gif \
16 | treeview-gray-line.gif treeview-gray.gif treeview-red-line.gif \
17 | treeview-red.gif
18 |
19 | imagesdir = ${datadir}/gtags/jquery/images
20 |
21 | EXTRA_DIST = ${images_DATA}
22 |
--------------------------------------------------------------------------------
/jquery/images/file.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/file.gif
--------------------------------------------------------------------------------
/jquery/images/folder-closed.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/folder-closed.gif
--------------------------------------------------------------------------------
/jquery/images/folder.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/folder.gif
--------------------------------------------------------------------------------
/jquery/images/minus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/minus.gif
--------------------------------------------------------------------------------
/jquery/images/plus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/plus.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-black-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-black-line.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-black.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-black.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-default-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-default-line.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-default.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-default.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-famfamfam-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-famfamfam-line.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-famfamfam.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-famfamfam.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-gray-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-gray-line.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-gray.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-gray.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-red-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-red-line.gif
--------------------------------------------------------------------------------
/jquery/images/treeview-red.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/namhyung/global/e8571bc9eb83550a7325a8198a34dbbf8aff53f4/jquery/images/treeview-red.gif
--------------------------------------------------------------------------------
/jquery/jquery.suggest.css:
--------------------------------------------------------------------------------
1 | .ac_results {
2 | border: 1px solid gray;
3 | background-color: white;
4 | padding: 0;
5 | margin: 0;
6 | list-style: none;
7 | position: absolute;
8 | z-index: 10000;
9 | display: none;
10 | }
11 |
12 | .ac_results li {
13 | padding: 2px 5px;
14 | white-space: nowrap;
15 | color: #101010;
16 | text-align: left;
17 | }
18 |
19 | .ac_over {
20 | cursor: pointer;
21 | background-color: #F0F0B8;
22 | }
23 |
24 | .ac_match {
25 | text-decoration: underline;
26 | color: black;
27 | }
28 |
--------------------------------------------------------------------------------
/jquery/jquery.treeview.css:
--------------------------------------------------------------------------------
1 | .treeview, .treeview ul {
2 | padding: 0;
3 | margin: 0;
4 | list-style: none;
5 | }
6 |
7 | .treeview ul {
8 | background-color: #f5f5dc;
9 | margin-top: 4px;
10 | }
11 |
12 | .treeview .hitarea {
13 | background: url(images/treeview-default.gif) -64px -25px no-repeat;
14 | height: 16px;
15 | width: 16px;
16 | margin-left: -16px;
17 | float: left;
18 | cursor: pointer;
19 | }
20 | /* fix for IE6 */
21 | * html .hitarea {
22 | display: inline;
23 | float:none;
24 | }
25 |
26 | .treeview li {
27 | margin: 0;
28 | padding: 3px 0pt 3px 16px;
29 | }
30 |
31 | .treeview a.selected {
32 | background-color: #eee;
33 | }
34 |
35 | #treecontrol { margin: 1em 0; display: none; }
36 |
37 | .treeview .hover { color: red; cursor: pointer; }
38 |
39 | .treeview li { background: url(images/treeview-default-line.gif) 0 0 no-repeat; }
40 | .treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; }
41 |
42 | .treeview .expandable-hitarea { background-position: -80px -3px; }
43 |
44 | .treeview li.last { background-position: 0 -1766px }
45 | .treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); }
46 | .treeview li.lastCollapsable { background-position: 0 -111px }
47 | .treeview li.lastExpandable { background-position: -32px -67px }
48 |
49 | .treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }
50 |
51 | .treeview-red li { background-image: url(images/treeview-red-line.gif); }
52 | .treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(images/treeview-red.gif); }
53 |
54 | .treeview-black li { background-image: url(images/treeview-black-line.gif); }
55 | .treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); }
56 |
57 | .treeview-gray li { background-image: url(images/treeview-gray-line.gif); }
58 | .treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); }
59 |
60 | .treeview-famfamfam li { background-image: url(images/treeview-famfamfam-line.gif); }
61 | .treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(images/treeview-famfamfam.gif); }
62 |
63 |
64 | .filetree li { padding: 3px 0 2px 16px; }
65 | .filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; }
66 | .filetree span.folder { background: url(images/folder.gif) 0 0 no-repeat; }
67 | .filetree li.expandable span.folder { background: url(images/folder-closed.gif) 0 0 no-repeat; }
68 | .filetree span.file { background: url(images/file.gif) 0 0 no-repeat; }
69 |
--------------------------------------------------------------------------------
/libdb/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2000, 2001 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | noinst_LIBRARIES = libglodb.a
14 |
15 | noinst_HEADERS = btree.h db.h extern.h mpool.h queue.h compat.h
16 |
17 | libglodb_a_SOURCES = \
18 | bt_close.c bt_conv.c bt_debug.c bt_delete.c bt_get.c bt_open.c bt_overflow.c \
19 | bt_page.c bt_put.c bt_search.c bt_seq.c bt_split.c bt_utils.c db.c mpool.c
20 |
21 | libglodb_a_DEPENDENCIES = $(libglodb_a_LIBADD)
22 |
--------------------------------------------------------------------------------
/libdb/README:
--------------------------------------------------------------------------------
1 | Btree library derived from db(3) 1.85 with patch 2, 3, 4 applied.
2 |
3 | Some code was modified to keep compatibility and to fix warning.
4 |
5 | BSD advertising clause was deleted, according to the following declaration.
6 |
7 | derived from .
8 | ----------------------------------------------------------------------------
9 | July 22, 1999
10 |
11 | To All Licensees, Distributors of Any Version of BSD:
12 |
13 | As you know, certain of the Berkeley Software Distribution ("BSD") source
14 | code files require that further distributions of products containing all or
15 | portions of the software, acknowledge within their advertising materials
16 | that such products contain software developed by UC Berkeley and its
17 | contributors.
18 |
19 | Specifically, the provision reads:
20 |
21 | " * 3. All advertising materials mentioning features or use of this software
22 | * must display the following acknowledgement:
23 | * This product includes software developed by the University of
24 | * California, Berkeley and its contributors."
25 |
26 | Effective immediately, licensees and distributors are no longer required to
27 | include the acknowledgement within advertising materials. Accordingly, the
28 | foregoing paragraph of those BSD Unix files containing it is hereby deleted
29 | in its entirety.
30 |
31 | William Hoskins
32 | Director, Office of Technology Licensing
33 | University of California, Berkeley
34 | ----------------------------------------------------------------------------
35 |
--------------------------------------------------------------------------------
/libdb/bt_page.c:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 1990, 1993, 1994
3 | * The Regents of the University of California. All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. Neither the name of the University nor the names of its contributors
14 | * may be used to endorse or promote products derived from this software
15 | * without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 | * SUCH DAMAGE.
28 | */
29 |
30 | #if defined(LIBC_SCCS) && !defined(lint)
31 | static char sccsid[] = "@(#)bt_page.c 8.3 (Berkeley) 7/14/94";
32 | #endif /* LIBC_SCCS and not lint */
33 |
34 | #ifdef HAVE_CONFIG_H
35 | #include
36 | #endif
37 | #include
38 |
39 | #include
40 |
41 | #include "db.h"
42 | #include "btree.h"
43 |
44 | /*
45 | * __bt_free --
46 | * Put a page on the freelist.
47 | *
48 | * Parameters:
49 | * t: tree
50 | * h: page to free
51 | *
52 | * Returns:
53 | * RET_ERROR, RET_SUCCESS
54 | *
55 | * Side-effect:
56 | * mpool_put's the page.
57 | */
58 | int
59 | __bt_free(t, h)
60 | BTREE *t;
61 | PAGE *h;
62 | {
63 | /* Insert the page at the head of the free list. */
64 | h->prevpg = P_INVALID;
65 | h->nextpg = t->bt_free;
66 | t->bt_free = h->pgno;
67 | F_SET(t, B_METADIRTY);
68 |
69 | /* Make sure the page gets written back. */
70 | return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
71 | }
72 |
73 | /*
74 | * __bt_new --
75 | * Get a new page, preferably from the freelist.
76 | *
77 | * Parameters:
78 | * t: tree
79 | * npg: storage for page number.
80 | *
81 | * Returns:
82 | * Pointer to a page, NULL on error.
83 | */
84 | PAGE *
85 | __bt_new(t, npg)
86 | BTREE *t;
87 | pgno_t *npg;
88 | {
89 | PAGE *h;
90 |
91 | if (t->bt_free != P_INVALID &&
92 | (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
93 | *npg = t->bt_free;
94 | t->bt_free = h->nextpg;
95 | F_SET(t, B_METADIRTY);
96 | return (h);
97 | }
98 | return (mpool_new(t->bt_mp, npg));
99 | }
100 |
--------------------------------------------------------------------------------
/libdb/extern.h:
--------------------------------------------------------------------------------
1 | /*-
2 | * Copyright (c) 1991, 1993, 1994
3 | * The Regents of the University of California. All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. Neither the name of the University nor the names of its contributors
14 | * may be used to endorse or promote products derived from this software
15 | * without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 | * SUCH DAMAGE.
28 | *
29 | * @(#)extern.h 8.10 (Berkeley) 7/20/94
30 | */
31 |
32 | int __bt_close(DB *, int);
33 | int __bt_cmp(BTREE *, const DBT *, EPG *);
34 | int __bt_crsrdel(BTREE *, EPGNO *);
35 | int __bt_defcmp(const DBT *, const DBT *);
36 | size_t __bt_defpfx(const DBT *, const DBT *);
37 | int __bt_delete(const DB *, const DBT *, u_int);
38 | int __bt_dleaf(BTREE *, const DBT *, PAGE *, u_int);
39 | int __bt_fd(const DB *);
40 | int __bt_free(BTREE *, PAGE *);
41 | int __bt_get(const DB *, const DBT *, DBT *, u_int);
42 | PAGE *__bt_new(BTREE *, pgno_t *);
43 | void __bt_pgin(void *, pgno_t, void *);
44 | void __bt_pgout(void *, pgno_t, void *);
45 | int __bt_push(BTREE *, pgno_t, int);
46 | int __bt_put(const DB *dbp, DBT *, const DBT *, u_int);
47 | int __bt_ret(BTREE *, EPG *, DBT *, DBT *, DBT *, DBT *, int);
48 | EPG *__bt_search(BTREE *, const DBT *, int *);
49 | int __bt_seq(const DB *, DBT *, DBT *, u_int);
50 | void __bt_setcur(BTREE *, pgno_t, u_int);
51 | int __bt_split(BTREE *, PAGE *,
52 | const DBT *, const DBT *, int, size_t, u_int32_t);
53 | int __bt_sync(const DB *, u_int);
54 |
55 | int __ovfl_delete(BTREE *, void *);
56 | int __ovfl_get(BTREE *, void *, size_t *, void **, size_t *);
57 | int __ovfl_put(BTREE *, const DBT *, pgno_t *);
58 |
59 | void __bt_dnpage(DB *, pgno_t);
60 | void __bt_dpage(PAGE *);
61 | void __bt_dump(DB *);
62 | void __bt_stat(DB *);
63 |
--------------------------------------------------------------------------------
/libglibc/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2000, 2001 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | noinst_LIBRARIES = libgloglibc.a
14 |
15 | noinst_HEADERS = regex.h getopt.h obstack.h hash-string.h getopt_int.h
16 |
17 | libgloglibc_a_SOURCES = regex.c getopt.c getopt1.c snprintf.c obstack.c \
18 | hash-string.c
19 |
20 | libgloglibc_a_DEPENDENCIES = $(libgloglibc_a_LIBADD)
21 |
--------------------------------------------------------------------------------
/libglibc/hash-string.c:
--------------------------------------------------------------------------------
1 | /* Implements a string hashing function.
2 | Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
3 | This file is part of the GNU C Library.
4 |
5 | The GNU C Library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | The GNU C Library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with the GNU C Library; if not, write to the Free
17 | Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 | 02110-1301 USA. */
19 |
20 | #include "hash-string.h"
21 |
22 |
23 | /* Defines the so called `hashpjw' function by P.J. Weinberger
24 | [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
25 | 1986, 1987 Bell Telephone Laboratories, Inc.] */
26 | unsigned long int
27 | __hash_string (str_param)
28 | const char *str_param;
29 | {
30 | unsigned long int hval, g;
31 | const char *str = str_param;
32 |
33 | /* Compute the hash value for the given string. */
34 | hval = 0;
35 | while (*str != '\0')
36 | {
37 | hval <<= 4;
38 | hval += (unsigned char) *str++;
39 | g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
40 | if (g != 0)
41 | {
42 | hval ^= g >> (HASHWORDBITS - 8);
43 | hval ^= g;
44 | }
45 | }
46 | return hval;
47 | }
48 |
--------------------------------------------------------------------------------
/libglibc/hash-string.h:
--------------------------------------------------------------------------------
1 | /* Implements a string hashing function.
2 | Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
3 | This file is part of the GNU C Library.
4 |
5 | The GNU C Library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | The GNU C Library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with the GNU C Library; if not, write to the Free
17 | Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 | 02110-1301 USA. */
19 |
20 | /* @@ end of prolog @@ */
21 |
22 | #ifndef PARAMS
23 | # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
24 | # define PARAMS(Args) Args
25 | # else
26 | # define PARAMS(Args) ()
27 | # endif
28 | #endif
29 |
30 | /* We assume to have `unsigned long int' value with at least 32 bits. */
31 | #define HASHWORDBITS 32
32 |
33 |
34 | /* Defines the so called `hashpjw' function by P.J. Weinberger
35 | [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
36 | 1986, 1987 Bell Telephone Laboratories, Inc.] */
37 | extern unsigned long int __hash_string PARAMS ((const char *__str_param));
38 |
--------------------------------------------------------------------------------
/libglibc/snprintf.c:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
2 | This file is part of the GNU C Library.
3 |
4 | The GNU C Library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public License as
6 | published by the Free Software Foundation; either version 2 of the
7 | License, or (at your option) any later version.
8 |
9 | The GNU C Library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with the GNU C Library; see the file COPYING.LIB. If not,
16 | write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 | Boston, MA 02110-1301 USA. */
18 |
19 | #ifdef HAVE_CONFIG_H
20 | #include
21 | #endif
22 | #include
23 | #include
24 |
25 | /*
26 | * drived from GNU C Library and modified at 2001/10/09.
27 | *
28 | * This is the simplest version of snprintf, that is, it just exits after
29 | * writing over MAXLEN characters. It is used in the system which doesn't
30 | * have snprintf(3).
31 | */
32 |
33 | #ifndef HAVE_SNPRINTF
34 | /* Write formatted output into S, according to the format
35 | string FORMAT, writing no more than MAXLEN characters. */
36 | /* VARARGS3 */
37 | int
38 | snprintf (char *s, size_t maxlen, const char *format, ...)
39 | {
40 | va_list arg;
41 | int done;
42 |
43 | va_start (arg, format);
44 | /* done = __vsnprintf (s, maxlen, format, arg); */
45 | done = vsprintf (s, format, arg);
46 | if (done >= maxlen) {
47 | fprintf(stderr, "This program exit because vsprintf(3) destroy memory.\n");
48 | fprintf(stderr, "You should install snprintf(3) instead.\n");
49 | exit(1);
50 | }
51 | va_end (arg);
52 |
53 | return done;
54 | }
55 | #endif /* HAVE_SNPRINTF */
56 |
--------------------------------------------------------------------------------
/libltdl/README:
--------------------------------------------------------------------------------
1 | This is GNU libltdl, a system independent dlopen wrapper for GNU libtool.
2 |
3 | It supports the following dlopen interfaces:
4 | * dlopen (Solaris, Linux and various BSD flavors)
5 | * shl_load (HP-UX)
6 | * LoadLibrary (Win16 and Win32)
7 | * load_add_on (BeOS)
8 | * GNU DLD (emulates dynamic linking for static libraries)
9 | * dyld (darwin/Mac OS X)
10 | * libtool's dlpreopen
11 | --
12 | Copyright (C) 1999, 2003 Free Software Foundation, Inc.
13 | Written by Thomas Tanner, 1999
14 |
15 | This file is part of GNU Libtool.
16 |
17 | GNU Libtool is free software; you can redistribute it and/or
18 | modify it under the terms of the GNU General Public License as
19 | published by the Free Software Foundation; either version 2 of
20 | the License, or (at your option) any later version.
21 |
22 | As a special exception to the GNU General Public License,
23 | if you distribute this file as part of a program or library that
24 | is built using GNU Libtool, you may include this file under the
25 | same distribution terms that you use for the rest of that program.
26 |
27 | GNU Libtool is distributed in the hope that it will be useful,
28 | but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | GNU General Public License for more details.
31 |
32 | You should have received a copy of the GNU General Public License
33 | along with GNU Libtool; see the file COPYING. If not, a copy
34 | can be downloaded from http://www.gnu.org/licenses/gpl.html,
35 | or obtained by writing to the Free Software Foundation, Inc.,
36 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
37 |
38 |
--------------------------------------------------------------------------------
/libltdl/argz_.h:
--------------------------------------------------------------------------------
1 | /* lt__argz.h -- internal argz interface for non-glibc systems
2 |
3 | Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
4 | Written by Gary V. Vaughan, 2004
5 |
6 | NOTE: The canonical source of this file is maintained with the
7 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
8 |
9 | GNU Libltdl is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation; either
12 | version 2 of the License, or (at your option) any later version.
13 |
14 | As a special exception to the GNU Lesser General Public License,
15 | if you distribute this file as part of a program or library that
16 | is built using GNU Libtool, you may include this file under the
17 | same distribution terms that you use for the rest of that program.
18 |
19 | GNU Libltdl is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU Lesser General Public License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public
25 | License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26 | copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27 | or obtained by writing to the Free Software Foundation, Inc.,
28 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 | */
30 |
31 | #if !defined(LT__ARGZ_H)
32 | #define LT__ARGZ_H 1
33 |
34 | #include
35 | #define __need_error_t
36 | #include
37 | #include
38 |
39 | #if defined(LTDL)
40 | # include "lt__glibc.h"
41 | # include "lt_system.h"
42 | #else
43 | # define LT_SCOPE
44 | #endif
45 |
46 | #if defined(__cplusplus)
47 | extern "C" {
48 | #endif
49 |
50 | LT_SCOPE error_t argz_append (char **pargz, size_t *pargz_len,
51 | const char *buf, size_t buf_len);
52 | LT_SCOPE error_t argz_create_sep(const char *str, int delim,
53 | char **pargz, size_t *pargz_len);
54 | LT_SCOPE error_t argz_insert (char **pargz, size_t *pargz_len,
55 | char *before, const char *entry);
56 | LT_SCOPE char * argz_next (char *argz, size_t argz_len,
57 | const char *entry);
58 | LT_SCOPE void argz_stringify (char *argz, size_t argz_len, int sep);
59 |
60 | #if defined(__cplusplus)
61 | }
62 | #endif
63 |
64 | #if !defined(LTDL)
65 | # undef LT_SCOPE
66 | #endif
67 |
68 | #endif /*!defined(LT__ARGZ_H)*/
69 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__alloc.h:
--------------------------------------------------------------------------------
1 | /* lt__alloc.h -- internal memory management interface
2 |
3 | Copyright (C) 2004 Free Software Foundation, Inc.
4 | Written by Gary V. Vaughan, 2004
5 |
6 | NOTE: The canonical source of this file is maintained with the
7 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
8 |
9 | GNU Libltdl is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation; either
12 | version 2 of the License, or (at your option) any later version.
13 |
14 | As a special exception to the GNU Lesser General Public License,
15 | if you distribute this file as part of a program or library that
16 | is built using GNU Libtool, you may include this file under the
17 | same distribution terms that you use for the rest of that program.
18 |
19 | GNU Libltdl is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU Lesser General Public License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public
25 | License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26 | copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27 | or obtained by writing to the Free Software Foundation, Inc.,
28 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 | */
30 |
31 | #if !defined(LT__ALLOC_H)
32 | #define LT__ALLOC_H 1
33 |
34 | #include "lt_system.h"
35 |
36 | LT_BEGIN_C_DECLS
37 |
38 | #define MALLOC(tp, n) (tp*) lt__malloc((n) * sizeof(tp))
39 | #define REALLOC(tp, mem, n) (tp*) lt__realloc((mem), (n) * sizeof(tp))
40 | #define FREE(mem) LT_STMT_START { \
41 | if (mem) { free ((void *)mem); mem = NULL; } } LT_STMT_END
42 | #define MEMREASSIGN(p, q) LT_STMT_START { \
43 | if ((p) != (q)) { if (p) free (p); (p) = (q); (q) = 0; } \
44 | } LT_STMT_END
45 |
46 | /* If set, this function is called when memory allocation has failed. */
47 | LT_SCOPE void (*lt__alloc_die) (void);
48 |
49 | LT_SCOPE void *lt__malloc (size_t n);
50 | LT_SCOPE void *lt__zalloc (size_t n);
51 | LT_SCOPE void *lt__realloc (void *mem, size_t n);
52 | LT_SCOPE void *lt__memdup (void const *mem, size_t n);
53 |
54 | LT_SCOPE char *lt__strdup (const char *string);
55 |
56 | LT_END_C_DECLS
57 |
58 | #endif /*!defined(LT__ALLOC_H)*/
59 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__dirent.h:
--------------------------------------------------------------------------------
1 | /* lt__dirent.h -- internal directory entry scanning interface
2 |
3 | Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
4 | Written by Bob Friesenhahn, 2001
5 |
6 | NOTE: The canonical source of this file is maintained with the
7 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
8 |
9 | GNU Libltdl is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation; either
12 | version 2 of the License, or (at your option) any later version.
13 |
14 | As a special exception to the GNU Lesser General Public License,
15 | if you distribute this file as part of a program or library that
16 | is built using GNU Libtool, you may include this file under the
17 | same distribution terms that you use for the rest of that program.
18 |
19 | GNU Libltdl is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU Lesser General Public License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public
25 | License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26 | copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27 | or obtained by writing to the Free Software Foundation, Inc.,
28 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 | */
30 |
31 | #if !defined(LT__DIRENT_H)
32 | #define LT__DIRENT_H 1
33 |
34 | #if defined(LT_CONFIG_H)
35 | # include LT_CONFIG_H
36 | #else
37 | # include
38 | #endif
39 |
40 | #include "lt_system.h"
41 |
42 | #ifdef HAVE_DIRENT_H
43 | /* We have a fully operational dirent subsystem. */
44 | # include
45 | # define D_NAMLEN(dirent) (strlen((dirent)->d_name))
46 |
47 | #elif defined __WINDOWS__
48 | /* Use some wrapper code to emulate dirent on windows.. */
49 | # define WINDOWS_DIRENT_EMULATION 1
50 |
51 | # include
52 |
53 | # define D_NAMLEN(dirent) (strlen((dirent)->d_name))
54 | # define dirent lt__dirent
55 | # define DIR lt__DIR
56 | # define opendir lt__opendir
57 | # define readdir lt__readdir
58 | # define closedir lt__closedir
59 |
60 | LT_BEGIN_C_DECLS
61 |
62 | struct dirent
63 | {
64 | char d_name[LT_FILENAME_MAX];
65 | int d_namlen;
66 | };
67 |
68 | typedef struct
69 | {
70 | HANDLE hSearch;
71 | WIN32_FIND_DATA Win32FindData;
72 | BOOL firsttime;
73 | struct dirent file_info;
74 | } DIR;
75 |
76 |
77 | LT_SCOPE DIR * opendir (const char *path);
78 | LT_SCOPE struct dirent *readdir (DIR *entry);
79 | LT_SCOPE void closedir (DIR *entry);
80 |
81 | LT_END_C_DECLS
82 |
83 | #else /* !defined(__WINDOWS__)*/
84 | ERROR - cannot find dirent
85 | #endif /*!defined(__WINDOWS__)*/
86 |
87 | #endif /*!defined(LT__DIRENT_H)*/
88 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__glibc.h:
--------------------------------------------------------------------------------
1 | /* lt__glibc.h -- support for non glibc environments
2 |
3 | Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
4 | Written by Gary V. Vaughan, 2004
5 |
6 | NOTE: The canonical source of this file is maintained with the
7 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
8 |
9 | GNU Libltdl is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation; either
12 | version 2 of the License, or (at your option) any later version.
13 |
14 | As a special exception to the GNU Lesser General Public License,
15 | if you distribute this file as part of a program or library that
16 | is built using GNU Libtool, you may include this file under the
17 | same distribution terms that you use for the rest of that program.
18 |
19 | GNU Libltdl is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU Lesser General Public License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public
25 | License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26 | copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27 | or obtained by writing to the Free Software Foundation, Inc.,
28 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 | */
30 |
31 | #if !defined(LT__GLIBC_H)
32 | #define LT__GLIBC_H 1
33 |
34 | #if defined(LT_CONFIG_H)
35 | # include LT_CONFIG_H
36 | #else
37 | # include
38 | #endif
39 |
40 | #if !defined(HAVE_ARGZ_H) || !defined(HAVE_WORKING_ARGZ)
41 | /* Redefine any glibc symbols we reimplement to import the
42 | implementations into our lt__ namespace so we don't ever
43 | clash with the system library if our clients use argz_*
44 | from there in addition to libltdl. */
45 | # undef argz_append
46 | # define argz_append lt__argz_append
47 | # undef argz_create_sep
48 | # define argz_create_sep lt__argz_create_sep
49 | # undef argz_insert
50 | # define argz_insert lt__argz_insert
51 | # undef argz_next
52 | # define argz_next lt__argz_next
53 | # undef argz_stringify
54 | # define argz_stringify lt__argz_stringify
55 | #endif
56 |
57 | #ifdef __cplusplus
58 | extern "C" {
59 | #endif
60 |
61 | #include
62 |
63 | #ifdef __cplusplus
64 | }
65 | #endif
66 |
67 | # define slist_concat lt__slist_concat
68 | # define slist_cons lt__slist_cons
69 | # define slist_delete lt__slist_delete
70 | # define slist_remove lt__slist_remove
71 | # define slist_reverse lt__slist_reverse
72 | # define slist_sort lt__slist_sort
73 | # define slist_tail lt__slist_tail
74 | # define slist_nth lt__slist_nth
75 | # define slist_find lt__slist_find
76 | # define slist_length lt__slist_length
77 | # define slist_foreach lt__slist_foreach
78 | # define slist_box lt__slist_box
79 | # define slist_unbox lt__slist_unbox
80 |
81 | #include
82 |
83 | #endif /*!defined(LT__GLIBC_H)*/
84 |
--------------------------------------------------------------------------------
/libltdl/libltdl/lt__strl.h:
--------------------------------------------------------------------------------
1 | /* lt__strl.h -- size-bounded string copying and concatenation
2 |
3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc.
4 | Written by Bob Friesenhahn, 2004
5 |
6 | NOTE: The canonical source of this file is maintained with the
7 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
8 |
9 | GNU Libltdl is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation; either
12 | version 2 of the License, or (at your option) any later version.
13 |
14 | As a special exception to the GNU Lesser General Public License,
15 | if you distribute this file as part of a program or library that
16 | is built using GNU Libtool, you may include this file under the
17 | same distribution terms that you use for the rest of that program.
18 |
19 | GNU Libltdl is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU Lesser General Public License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public
25 | License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26 | copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27 | or obtained by writing to the Free Software Foundation, Inc.,
28 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 | */
30 |
31 | #if !defined(LT__STRL_H)
32 | #define LT__STRL_H 1
33 |
34 | #if defined(LT_CONFIG_H)
35 | # include LT_CONFIG_H
36 | #else
37 | # include
38 | #endif
39 |
40 | #include
41 | #include "lt_system.h"
42 |
43 | #if !defined(HAVE_STRLCAT)
44 | # define strlcat(dst,src,dstsize) lt_strlcat(dst,src,dstsize)
45 | LT_SCOPE size_t lt_strlcat(char *dst, const char *src, const size_t dstsize);
46 | #endif /* !defined(HAVE_STRLCAT) */
47 |
48 | #if !defined(HAVE_STRLCPY)
49 | # define strlcpy(dst,src,dstsize) lt_strlcpy(dst,src,dstsize)
50 | LT_SCOPE size_t lt_strlcpy(char *dst, const char *src, const size_t dstsize);
51 | #endif /* !defined(HAVE_STRLCPY) */
52 |
53 | #endif /*!defined(LT__STRL_H)*/
54 |
--------------------------------------------------------------------------------
/libltdl/lt__alloc.c:
--------------------------------------------------------------------------------
1 | /* lt__alloc.c -- internal memory management interface
2 |
3 | Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
4 | Written by Gary V. Vaughan, 2004
5 |
6 | NOTE: The canonical source of this file is maintained with the
7 | GNU Libtool package. Report bugs to bug-libtool@gnu.org.
8 |
9 | GNU Libltdl is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation; either
12 | version 2 of the License, or (at your option) any later version.
13 |
14 | As a special exception to the GNU Lesser General Public License,
15 | if you distribute this file as part of a program or library that
16 | is built using GNU Libtool, you may include this file under the
17 | same distribution terms that you use for the rest of that program.
18 |
19 | GNU Libltdl is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | GNU Lesser General Public License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public
25 | License along with GNU Libltdl; see the file COPYING.LIB. If not, a
26 | copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
27 | or obtained by writing to the Free Software Foundation, Inc.,
28 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 | */
30 |
31 | #include "lt__private.h"
32 |
33 | #include
34 |
35 | #include "lt__alloc.h"
36 |
37 | static void alloc_die_default (void);
38 |
39 | void (*lt__alloc_die) (void) = alloc_die_default;
40 |
41 | /* Unless overridden, exit on memory failure. */
42 | static void
43 | alloc_die_default (void)
44 | {
45 | fprintf (stderr, "Out of memory.\n");
46 | exit (EXIT_FAILURE);
47 | }
48 |
49 | void *
50 | lt__malloc (size_t n)
51 | {
52 | void *mem;
53 |
54 | if (! (mem = malloc (n)))
55 | (*lt__alloc_die) ();
56 |
57 | return mem;
58 | }
59 |
60 | void *
61 | lt__zalloc (size_t n)
62 | {
63 | void *mem;
64 |
65 | if ((mem = lt__malloc (n)))
66 | memset (mem, 0, n);
67 |
68 | return mem;
69 | }
70 |
71 | void *
72 | lt__realloc (void *mem, size_t n)
73 | {
74 | if (! (mem = realloc (mem, n)))
75 | (*lt__alloc_die) ();
76 |
77 | return mem;
78 | }
79 |
80 | void *
81 | lt__memdup (void const *mem, size_t n)
82 | {
83 | void *newmem;
84 |
85 | if ((newmem = lt__malloc (n)))
86 | return memcpy (newmem, mem, n);
87 |
88 | return 0;
89 | }
90 |
91 | char *
92 | lt__strdup (const char *string)
93 | {
94 | return (char *) lt__memdup (string, strlen (string) +1);
95 | }
96 |
--------------------------------------------------------------------------------
/libparser/HACKING:
--------------------------------------------------------------------------------
1 | ___________________________________
2 | | | | | | _ | | |
3 | | |___| | | | | _| | | | GNU GLOBAL source code tag system
4 | | | | | | | | | | |
5 | | ~~ | ~~| | ~ | | | ~~| for all hackers.
6 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 | Copyright (c) 2003, 2004 Tama Communications Corporation
8 |
9 | This file is free software; as a special exception the author gives
10 | unlimited permission to copy and/or distribute it, with or without
11 | modifications, as long as this notice is preserved.
12 |
13 | This program is distributed in the hope that it will be useful, but
14 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
15 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 |
17 | ----------------------------------
18 |
19 | 1. Required programs.
20 |
21 | To build the parser, you need to have the following package installed:
22 |
23 | - GNU gperf 3.0.3 to look up reserved words.
24 | - flex 2.5.4a to generate php and assembly parser.
25 | - GNU bison 1.875 to generate assembly parser.
26 |
27 | 2. Reserved word processing using GNU gperf.
28 |
29 | This mechanism is independent of lex and bison.
30 |
31 | 2.1 Outline
32 |
33 | (1) Generate gperf(1) source from each reserved word file.
34 |
35 | _res.in reserved word file
36 | |
37 | [reserved.pl]
38 | |
39 | v
40 | _res.gpf gperf source file
41 |
42 | (2) Generate include file from gperf source.
43 |
44 | _res.gpf gperf source file
45 | |
46 | [gperf(1)]
47 | |
48 | v
49 | _res.h include file
50 |
51 | (3) Include above file from lex source and you can use
52 | _reserved_word() function.
53 |
54 | Lex source file
55 | +-------------------------------------
56 | |...
57 | |#include "_res.h"
58 | |...
59 | |WORD {
60 | | if (_reserved_word(yytext, yyleng)) {
61 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62 | | ...
63 | +-------------------------------------
64 |
65 |
66 | 2.2 Reserved word file format.
67 |
68 | o One word and 'word' which means 'reserved word' a line.
69 | o Null line and the line start with ';' is skipped.
70 | o You need not sort words by alphabetical order.
71 |
72 | [Example]
73 | +---------------------
74 | |; This is comment.
75 | |
76 | |int word
77 | |auto word
78 | |...
79 | |foreach word
80 | +---------------------
81 |
--------------------------------------------------------------------------------
/libparser/Kconfig.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2011 Namhyung Kim
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include
22 | #endif
23 | #ifdef HAVE_STRING_H
24 | #include
25 | #else
26 | #include
27 | #endif
28 |
29 | #include "internal.h"
30 | #include "die.h"
31 | #include "strbuf.h"
32 | #include "strlimcpy.h"
33 | #include "token.h"
34 |
35 | enum kconfig_keywords {
36 | KCONFIG_ITEM = 2001,
37 | KCONFIG_TYPE,
38 | KCONFIG_HELP,
39 | KCONFIG_MENU,
40 | KCONFIG_DEFAULT,
41 | KCONFIG_DEPENDS,
42 | KCONFIG_SELECTS,
43 | KCONFIG_CONDITION,
44 | };
45 |
46 | int
47 | kconfig_reserved_word(const char *str, int len)
48 | {
49 | if (!strncmp("config", str, len) ||
50 | !strncmp("menuconfig", str, len))
51 | return KCONFIG_ITEM;
52 |
53 | return 0;
54 | }
55 |
56 | void
57 | kconfig(const struct parser_param *param)
58 | {
59 | int cc;
60 | int level = 0; /* implicitly used in PUT() */
61 | int items = 0;
62 | int lines = 0;
63 | int configs = 0;
64 | int symbols = 0;
65 | int config_item = 0;
66 | int line_start = 1;
67 | STRBUF *sb = strbuf_open(0);
68 |
69 | if (!opentoken(param->file))
70 | die("'%s' cannot open.", param->file);
71 |
72 | crflag = 1; /* require nexttoken() returns '\n' */
73 |
74 | while ((cc = nexttoken("\n", kconfig_reserved_word)) != EOF) {
75 | switch (cc) {
76 | case KCONFIG_ITEM:
77 | if (line_start)
78 | config_item = 1;
79 | line_start = 0;
80 | configs++;
81 | break;
82 |
83 | case '\n':
84 | config_item = 0;
85 | line_start = 1;
86 | lines++;
87 | break;
88 |
89 | case SYMBOL:
90 | if (config_item) {
91 | char buf[256];
92 | snprintf(buf, 256, "CONFIG_%s", token);
93 | PUT(PARSER_DEF, buf, lineno, sp);
94 | items++;
95 | }
96 | symbols++;
97 | /* fall through */
98 | default:
99 | config_item = 0;
100 | line_start = 0;
101 | break;
102 | }
103 | }
104 |
105 | if (param->flags & PARSER_DEBUG) {
106 | printf("number of items found: %d\n", items);
107 | printf("number of configs found: %d\n", configs);
108 | printf("number of symbols found: %d\n", symbols);
109 | printf("number of total lines: %d\n", lines);
110 | }
111 |
112 | strbuf_close(sb);
113 |
114 | closetoken();
115 | }
116 |
--------------------------------------------------------------------------------
/libparser/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | noinst_LIBRARIES = libgloparser.a
14 |
15 | noinst_HEADERS = parser.h internal.h asm_parse.h \
16 | c_res.h cpp_res.h java_res.h php_res.h asm_res.h asm_parse.h
17 |
18 | libgloparser_a_SOURCES = parser.c C.c Cpp.c asm_parse.c asm_scan.c java.c php.c \
19 | Kconfig.c
20 |
21 | INCLUDES = @INCLUDES@
22 |
23 | libgloparser_a_DEPENDENCIES = $(libgloparser_a_LIBADD)
24 |
25 | EXTRA_DIST = reserved.pl HACKING \
26 | c_res.in c_res.gpf \
27 | cpp_res.in cpp_res.gpf \
28 | java_res.in java_res.gpf \
29 | php_res.in php_res.gpf php.l \
30 | asm_res.in asm_res.gpf asm_parse.y asm_scan.l
31 |
--------------------------------------------------------------------------------
/libparser/asm_parse.h:
--------------------------------------------------------------------------------
1 |
2 | /* A Bison parser, made by GNU Bison 2.4.1. */
3 |
4 | /* Skeleton interface for Bison's Yacc-like parsers in C
5 |
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 | Free Software Foundation, Inc.
8 |
9 | This program is free software: you can redistribute it and/or modify
10 | it under the terms of the GNU General Public License as published by
11 | the Free Software Foundation, either version 3 of the License, or
12 | (at your option) any later version.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program. If not, see . */
21 |
22 | /* As a special exception, you may create a larger work that contains
23 | part or all of the Bison parser skeleton and distribute that work
24 | under terms of your choice, so long as that work isn't itself a
25 | parser generator using the skeleton or a modified version thereof
26 | as a parser skeleton. Alternatively, if you modify or redistribute
27 | the parser skeleton itself, you may (at your option) remove this
28 | special exception, which will cause the skeleton and the resulting
29 | Bison output files to be licensed under the GNU General Public
30 | License without this special exception.
31 |
32 | This special exception was added by the Free Software Foundation in
33 | version 2.2 of Bison. */
34 |
35 |
36 | /* Tokens. */
37 | #ifndef YYTOKENTYPE
38 | # define YYTOKENTYPE
39 | /* Put the tokens into the symbol table, so that GDB and other debuggers
40 | know about them. */
41 | enum yytokentype {
42 | ASM_CONST = 258,
43 | ASM_CALL = 259,
44 | ASM_ENTRY = 260,
45 | ASM_EXT = 261,
46 | ASM_SYMBOL = 262,
47 | ASM_LABEL = 263,
48 | ASM_DEFINE = 264,
49 | ASM_UNDEF = 265,
50 | ASM_DIRECTIVE = 266,
51 | ASM_MACRO = 267,
52 | ASM_EQU = 268
53 | };
54 | #endif
55 |
56 |
57 |
58 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
59 | typedef int YYSTYPE;
60 | # define YYSTYPE_IS_TRIVIAL 1
61 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */
62 | # define YYSTYPE_IS_DECLARED 1
63 | #endif
64 |
65 | extern YYSTYPE asm_lval;
66 |
67 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
68 | typedef struct YYLTYPE
69 | {
70 | int first_line;
71 | int first_column;
72 | int last_line;
73 | int last_column;
74 | } YYLTYPE;
75 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
76 | # define YYLTYPE_IS_DECLARED 1
77 | # define YYLTYPE_IS_TRIVIAL 1
78 | #endif
79 |
80 | extern YYLTYPE asm_lloc;
81 |
82 |
--------------------------------------------------------------------------------
/libparser/asm_res.gpf:
--------------------------------------------------------------------------------
1 | %{
2 | #include "strmake.h"
3 | #define START_VARIABLE 1001
4 | #define START_WORD 2001
5 | #define START_SHARP 3001
6 | #define START_YACC 4001
7 | #define IS_RESERVED_WORD(a) ((a) >= START_WORD)
8 | #define IS_RESERVED_VARIABLE(a) ((a) >= START_VARIABLE && (a) < START_WORD)
9 | #define IS_RESERVED_SHARP(a) ((a) >= START_SHARP && (a) < START_YACC)
10 | #define IS_RESERVED_YACC(a) ((a) >= START_YACC)
11 |
12 | #define SHARP_SHARP 3001
13 | #define SHARP_ASSERT 3002
14 | #define SHARP_DEFINE 3003
15 | #define SHARP_ELIF 3004
16 | #define SHARP_ELSE 3005
17 | #define SHARP_ENDIF 3006
18 | #define SHARP_ERROR 3007
19 | #define SHARP_IDENT 3008
20 | #define SHARP_IF 3009
21 | #define SHARP_IFDEF 3010
22 | #define SHARP_IFNDEF 3011
23 | #define SHARP_IMPORT 3012
24 | #define SHARP_INCLUDE 3013
25 | #define SHARP_INCLUDE_NEXT 3014
26 | #define SHARP_LINE 3015
27 | #define SHARP_PRAGMA 3016
28 | #define SHARP_SCCS 3017
29 | #define SHARP_UNASSERT 3018
30 | #define SHARP_UNDEF 3019
31 | #define SHARP_WARNING 3020
32 | %}
33 | struct keyword { char *name; int token; }
34 | %%
35 | "##", SHARP_SHARP
36 | "#assert", SHARP_ASSERT
37 | "#define", SHARP_DEFINE
38 | "#elif", SHARP_ELIF
39 | "#else", SHARP_ELSE
40 | "#endif", SHARP_ENDIF
41 | "#error", SHARP_ERROR
42 | "#ident", SHARP_IDENT
43 | "#if", SHARP_IF
44 | "#ifdef", SHARP_IFDEF
45 | "#ifndef", SHARP_IFNDEF
46 | "#import", SHARP_IMPORT
47 | "#include", SHARP_INCLUDE
48 | "#include_next", SHARP_INCLUDE_NEXT
49 | "#line", SHARP_LINE
50 | "#pragma", SHARP_PRAGMA
51 | "#sccs", SHARP_SCCS
52 | "#unassert", SHARP_UNASSERT
53 | "#undef", SHARP_UNDEF
54 | "#warning", SHARP_WARNING
55 | %%
56 | int
57 | asm_reserved_sharp(const char *str, int len)
58 | {
59 | struct keyword *keyword;
60 |
61 | /* Delete blanks. Ex. ' # define ' => '#define' */
62 | str = strtrim(str, TRIM_ALL, &len);
63 |
64 | keyword = asm_lookup(str, len);
65 | return (keyword && IS_RESERVED_SHARP(keyword->token)) ? keyword->token : 0;
66 | }
67 |
--------------------------------------------------------------------------------
/libparser/asm_res.in:
--------------------------------------------------------------------------------
1 | ;; Process this file with reserved.pl to create gperf source.
2 | ;
3 | ; Copyright (c) 2004 Tama Communications Corporation
4 | ;
5 | ; This file is free software; as a special exception the author gives
6 | ; unlimited permission to copy and/or distribute it, with or without
7 | ; modifications, as long as this notice is preserved.
8 | ;
9 | ; This program is distributed in the hope that it will be useful, but
10 | ; WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | ; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 |
13 | ;
14 | ; Pre-processer macro.
15 | ;
16 | ## sharp
17 | #assert sharp
18 | #define sharp
19 | #elif sharp
20 | #else sharp
21 | #endif sharp
22 | #error sharp
23 | #ident sharp
24 | #if sharp
25 | #ifdef sharp
26 | #ifndef sharp
27 | #import sharp
28 | #include sharp
29 | #include_next sharp
30 | #line sharp
31 | #pragma sharp
32 | #sccs sharp
33 | #unassert sharp
34 | #undef sharp
35 | #warning sharp
36 |
--------------------------------------------------------------------------------
/libparser/c_res.in:
--------------------------------------------------------------------------------
1 | ;; Process this file with reserved.pl to create gperf source.
2 | ;
3 | ; Copyright (c) 2003 Tama Communications Corporation
4 | ;
5 | ; This file is free software; as a special exception the author gives
6 | ; unlimited permission to copy and/or distribute it, with or without
7 | ; modifications, as long as this notice is preserved.
8 | ;
9 | ; This program is distributed in the hope that it will be useful, but
10 | ; WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | ; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 |
13 | ;
14 | ; C reserved word list.
15 | ;
16 | __P word
17 | __attribute__,__attribute word
18 | __extension__ word
19 | __thread word
20 | asm,__asm,__asm__ word
21 | const,__const,__const__ word
22 | inline,__inline,__inline__ word
23 | restrict,__restrict,__restrict__ word
24 | signed,__signed,__signed__ word
25 | volatile,__volatile,__volatile__ word
26 | _Bool word
27 | _Complex word
28 | _Imaginary word
29 | auto word
30 | break word
31 | case word
32 | char word
33 | continue word
34 | default word
35 | do word
36 | double word
37 | else word
38 | enum word
39 | extern word
40 | float word
41 | for word
42 | goto word
43 | if word
44 | int word
45 | long word
46 | register word
47 | return word
48 | short word
49 | sizeof word
50 | static word
51 | struct word
52 | switch word
53 | typedef word
54 | union word
55 | unsigned word
56 | void word
57 | while word
58 | ;
59 | ; Pre-processer macro.
60 | ;
61 | ## sharp
62 | #assert sharp
63 | #define sharp
64 | #elif sharp
65 | #else sharp
66 | #endif sharp
67 | #error sharp
68 | #ident sharp
69 | #if sharp
70 | #ifdef sharp
71 | #ifndef sharp
72 | #import sharp
73 | #include sharp
74 | #include_next sharp
75 | #line sharp
76 | #pragma sharp
77 | #sccs sharp
78 | #unassert sharp
79 | #undef sharp
80 | #warning sharp
81 | ;
82 | ; Yacc reserved word.
83 | ;
84 | %% yacc
85 | %debug yacc
86 | %default_prec,%default-prec yacc
87 | %define yacc
88 | %defines yacc
89 | %destructor yacc
90 | %dprec yacc
91 | %error_verbose,%error-verbose yacc
92 | %expect yacc
93 | %expect_rr,%expect-rr yacc
94 | %file-prefix yacc
95 | %glr-parser yacc
96 | %initial-action yacc
97 | %left yacc
98 | %lex-param yacc
99 | %locations yacc
100 | %merge yacc
101 | %name_prefix,%name-prefix yacc
102 | %no_default_prec,%no_default-prec,%no-default_prec,%no-default-prec yacc
103 | %no_lines,%no-lines yacc
104 | %nonassoc,%binary yacc
105 | %nondeterministic-parser yacc
106 | %nterm yacc
107 | %output yacc
108 | %parse-param yacc
109 | %prec yacc
110 | %printer yacc
111 | %pure_parser,%pure-parser yacc
112 | %require yacc
113 | %right yacc
114 | %skeleton yacc
115 | %start yacc
116 | %token,%term yacc
117 | %token_table,%token-table yacc
118 | %type yacc
119 | %union yacc
120 | %verbose yacc
121 | %yacc,%fixed_output_files,%fixed-output_files,%fixed_output-files,%fixed-output-files yacc
122 | %{ yacc
123 | %} yacc
124 |
--------------------------------------------------------------------------------
/libparser/cpp_res.in:
--------------------------------------------------------------------------------
1 | ;; Process this file with reserved.pl to create gperf source.
2 | ;
3 | ; Copyright (c) 2003 Tama Communications Corporation
4 | ;
5 | ; This file is free software; as a special exception the author gives
6 | ; unlimited permission to copy and/or distribute it, with or without
7 | ; modifications, as long as this notice is preserved.
8 | ;
9 | ; This program is distributed in the hope that it will be useful, but
10 | ; WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | ; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 |
13 | ;
14 | ; C++ reserved word list.
15 | ;
16 | :: word
17 | __P word
18 | __attribute__,__attribute word
19 | __extension__ word
20 | __thread word
21 | asm,__asm,__asm__ word
22 | const,__const,__const__ word
23 | inline,__inline,__inline__ word
24 | signed,__signed,__signed__ word
25 | volatile,__volatile,__volatile__ word
26 | auto word
27 | bool word
28 | break word
29 | case word
30 | catch word
31 | char word
32 | class word
33 | const_cast word
34 | continue word
35 | default word
36 | delete word
37 | do word
38 | double word
39 | dynamic_cast word
40 | else word
41 | enum word
42 | explicit word
43 | export word
44 | extern word
45 | false word
46 | float word
47 | for word
48 | friend word
49 | goto word
50 | if word
51 | int word
52 | long word
53 | mutable word
54 | namespace word
55 | new word
56 | operator word
57 | private word
58 | protected word
59 | public word
60 | register word
61 | reinterpret_cast word
62 | return word
63 | short word
64 | sizeof word
65 | static word
66 | static_cast word
67 | struct word
68 | switch word
69 | template word
70 | this word
71 | throw word
72 | true word
73 | try word
74 | typedef word
75 | typename word
76 | typeid word
77 | union word
78 | unsigned word
79 | using word
80 | virtual word
81 | void word
82 | wchar_t word
83 | while word
84 | ;
85 | ; Pre-processer macro.
86 | ;
87 | ## sharp
88 | #assert sharp
89 | #define sharp
90 | #elif sharp
91 | #else sharp
92 | #endif sharp
93 | #error sharp
94 | #ident sharp
95 | #if sharp
96 | #ifdef sharp
97 | #ifndef sharp
98 | #import sharp
99 | #include sharp
100 | #include_next sharp
101 | #line sharp
102 | #pragma sharp
103 | #sccs sharp
104 | #unassert sharp
105 | #undef sharp
106 | #warning sharp
107 |
--------------------------------------------------------------------------------
/libparser/internal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1998, 1999, 2000, 2001, 2003, 2010
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _INTERNAL_H_
22 | #define _INTERNAL_H_
23 |
24 | #include "parser.h"
25 | #include "strbuf.h"
26 | #include "token.h"
27 |
28 | #define PUT(type, tag, lno, line) do { \
29 | DBG_PRINT(level, line); \
30 | param->put(type, tag, lno, curfile, line, param->arg); \
31 | } while (0)
32 |
33 | #define DBG_PRINT(level, a) do { \
34 | if (param->flags & PARSER_DEBUG) \
35 | dbg_print(level, a); \
36 | } while (0)
37 |
38 | /* parser procedures */
39 | void C(const struct parser_param *);
40 | void yacc(const struct parser_param *);
41 | void Cpp(const struct parser_param *);
42 | void java(const struct parser_param *);
43 | void php(const struct parser_param *);
44 | void assembly(const struct parser_param *);
45 | void kconfig(const struct parser_param *);
46 |
47 | void dbg_print(int, const char *);
48 |
49 | extern STRBUF *asm_symtable;
50 | void asm_initscan(void);
51 | int asm_lex(const struct parser_param *);
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/libparser/java_res.in:
--------------------------------------------------------------------------------
1 | ;; Process this file with reserved.pl to create gperf source.
2 | ;
3 | ; Copyright (c) 2003 Tama Communications Corporation
4 | ;
5 | ; This file is free software; as a special exception the author gives
6 | ; unlimited permission to copy and/or distribute it, with or without
7 | ; modifications, as long as this notice is preserved.
8 | ;
9 | ; This program is distributed in the hope that it will be useful, but
10 | ; WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | ; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 |
13 | ;
14 | ; java reserved word list.
15 | ;
16 | abstract word
17 | boolean word
18 | break word
19 | byte word
20 | case word
21 | catch word
22 | char word
23 | class word
24 | const word
25 | continue word
26 | default word
27 | do word
28 | double word
29 | else word
30 | enum word
31 | extends word
32 | false word
33 | final word
34 | finally word
35 | float word
36 | for word
37 | goto word
38 | if word
39 | implements word
40 | import word
41 | instanceof word
42 | int word
43 | interface word
44 | long word
45 | native word
46 | new word
47 | null word
48 | package word
49 | private word
50 | protected word
51 | public word
52 | return word
53 | short word
54 | static word
55 | strictfp word
56 | super word
57 | switch word
58 | synchronized word
59 | this word
60 | throw word
61 | throws word
62 | union word
63 | transient word
64 | true word
65 | try word
66 | void word
67 | volatile word
68 | while word
69 | widefp word
70 |
--------------------------------------------------------------------------------
/libparser/parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, 2010
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _PARSER_H_
22 | #define _PARSER_H_
23 |
24 | /*
25 | * Built-in parser base on gctags
26 | */
27 |
28 | void parser_init(const char *, const char *);
29 | void parser_exit(void);
30 |
31 | /* tag type */
32 | #define PARSER_DEF 1 /* definition */
33 | #define PARSER_REF_SYM 2 /* reference or other symbol */
34 |
35 | /* flags */
36 | #define PARSER_DEBUG 1 /* debug mode */
37 | #define PARSER_VERBOSE 2 /* verbose mode */
38 | #define PARSER_WARNING 4 /* print warning message */
39 | #define PARSER_END_BLOCK 8 /* force level 1 block end */
40 | #define PARSER_BEGIN_BLOCK 16 /* force level 1 block start */
41 |
42 | typedef void (*PARSER_CALLBACK)(int, const char *, int, const char *, const char *, void *);
43 |
44 | void parse_file(const char *, int, PARSER_CALLBACK, void *);
45 |
46 | struct parser_param {
47 | int size; /* size of this structure */
48 | int flags;
49 | const char *file;
50 | PARSER_CALLBACK put;
51 | void *arg;
52 | int (*isnotfunction)(const char *);
53 | const char *langmap;
54 | void (*die)(const char *, ...);
55 | };
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/libparser/php_res.in:
--------------------------------------------------------------------------------
1 | ;; Process this file with reserved.pl to create gperf source.
2 | ;
3 | ; Copyright (c) 2003 Tama Communications Corporation
4 | ;
5 | ; This file is free software; as a special exception the author gives
6 | ; unlimited permission to copy and/or distribute it, with or without
7 | ; modifications, as long as this notice is preserved.
8 | ;
9 | ; This program is distributed in the hope that it will be useful, but
10 | ; WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | ; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 |
13 | ;
14 | ; PHP reserved word list.
15 | ;
16 | __FILE__ word
17 | __LINE__ word
18 | __FUNCTION__ word
19 | __CLASS__ word
20 | and,AND,And word
21 | array,ARRAY,Array word
22 | as,AS,As word
23 | break,BREAK,Break word
24 | case,CASE,Case word
25 | cfunction,CFUNCTION,Cfunction,CFunction word
26 | class,CLASS,Class word
27 | const,CONST,Const word
28 | continue,CONTINUE,Continue word
29 | declare,DECLARE,Declare word
30 | default,DEFAULT,Default word
31 | define,DEFINE,Define word
32 | do,DO,Do word
33 | die,DIE,Die word
34 | each,EACH,Each word
35 | echo,ECHO,Echo word
36 | else,ELSE,Else word
37 | elseif,ELSEIF,Elseif,ElseIf word
38 | empty,EMPTY,Empty word
39 | enddeclare,ENDDECLARE,Enddeclare,EndDeclare word
40 | endfor,ENDFOR,Endfor,EndFor word
41 | endforeach,ENDFOREACH,Endforeach,EndForeach word
42 | endif,ENDIF,Endif,EndIf word
43 | endwhile,ENDWHILE,Endwhile,EndWhile word
44 | endswitch,ENDSWITCH,Endswitch,EndSwitch word
45 | eval,EVAL,Eval word
46 | exit,EXIT,Exit word
47 | failure,FAILURE,Failure word
48 | false,FALSE,False word
49 | for,FOR,For word
50 | foreach,FOREACH,Foreach,ForEach word
51 | function,FUNCTION,Function word
52 | global,GLOBAL,Global word
53 | header,HEADER,Header word
54 | list,LIST,List word
55 | if,IF,If word
56 | include,INCLUDE,Include word
57 | include_once,INCLUDE_ONCE,Include_once,Include_Once word
58 | is_array,IS_ARRAY,Is_array,Is_Array word
59 | is_set,IS_SET,Is_set,Is_Set word
60 | new,NEW,New word
61 | old_function,OLD_FUNCTION,Old_function,Old_Function word
62 | or,OR,Or word
63 | print,PRINT,Print word
64 | printf,PRINTF,Printf word
65 | return,RETURN,Return word
66 | require,REQUIRE,Require word
67 | require_once,REQUIRE_ONCE,Require_once,Require_Once word
68 | setcookie,SETCOOKIE,Setcookie,SetCookie word
69 | success,SUCCESS,Success word
70 | static,STATIC,Static word
71 | switch,SWITCH,Switch word
72 | true,TRUE,True word
73 | var,VAR,Var word
74 | while,WHILE,While word
75 | unset,UNSET,Unset word
76 | xor,XOR,Xor word
77 |
78 | ;
79 | ; PHP reserved variable list.
80 | ;
81 | GLOBALS variable
82 | HTTP_COOKIE_VARS variable
83 | HTTP_ENV_VARS variable
84 | HTTP_GET_VARS variable
85 | HTTP_POST_FILES variable
86 | HTTP_POST_VARS variable
87 | HTTP_SERVER_VARS variable
88 | HTTP_SESSION_VARS variable
89 | _COOKIE variable
90 | _ENV variable
91 | _FILES variable
92 | _GET variable
93 | _POST variable
94 | _REQUEST variable
95 | _SERVER variable
96 | _SESSION variable
97 |
--------------------------------------------------------------------------------
/libutil/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2000, 2001 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | noinst_LIBRARIES = libgloutil.a
14 |
15 | noinst_HEADERS = \
16 | conf.h dbop.h defined.h die.h find.h getdbpath.h global.h gparam.h \
17 | gtagsop.h locatestring.h makepath.h path.h gpathop.h strbuf.h \
18 | strmake.h tab.h test.h token.h usable.h version.h is_unixy.h abs2rel.h \
19 | split.h strlimcpy.h linetable.h env.h char.h date.h langmap.h \
20 | varray.h idset.h strhash.h xargs.h format.h pathconvert.h \
21 | compress.h checkalloc.h pool.h fileop.h statistics.h args.h
22 |
23 | libgloutil_a_SOURCES = \
24 | conf.c dbop.c defined.c die.c find.c getdbpath.c gtagsop.c locatestring.c \
25 | makepath.c path.c gpathop.c strbuf.c strmake.c tab.c test.c \
26 | token.c usable.c version.c is_unixy.c abs2rel.c split.c strlimcpy.c linetable.c \
27 | env.c char.c date.c langmap.c varray.c idset.c strhash.c xargs.c \
28 | pathconvert.c compress.c checkalloc.c pool.c fileop.c statistics.c args.c
29 |
30 | AM_CFLAGS = -DBINDIR='"$(bindir)"' -DDATADIR='"$(datadir)"' -DLOCALSTATEDIR='"$(localstatedir)"' -DSYSCONFDIR='"$(sysconfdir)"'
31 |
32 | INCLUDES = @INCLUDES@
33 |
34 | libgloutil_a_DEPENDENCIES = $(libgloutil_a_LIBADD)
35 |
--------------------------------------------------------------------------------
/libutil/abs2rel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2002, 2008 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _RELATIVE_H_
21 | #define _RELATIVE_H_
22 |
23 | char *normalize(const char *, const char *, const char *, char *, const int);
24 | char *normalize_pathname(const char *, char *, const int);
25 | char *abs2rel(const char *, const char *, char *, const int);
26 | char *rel2abs(const char *, const char *, char *, const int);
27 |
28 | #endif /* ! _RELATIVE_H_ */
29 |
--------------------------------------------------------------------------------
/libutil/args.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _ARGS_H_
21 | #define _ARGS_H_
22 | #include "gpathop.h"
23 |
24 | void args_open(char *const *);
25 | void args_open_filelist(const char *);
26 | void args_open_gfind(GFIND *gp);
27 | void args_open_nop();
28 | void args_open_both(char *const *, const char *);
29 | const char *args_read(void);
30 | void args_close(void);
31 |
32 | #endif /* ! _ARGS_H_ */
33 |
--------------------------------------------------------------------------------
/libutil/char.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include
22 | #endif
23 | #include
24 |
25 | #include "char.h"
26 | #include "strbuf.h"
27 |
28 | #define B BINARYCHAR
29 | #define R REGEXCHAR
30 | #define U URLCHAR
31 | #define RU REGEXCHAR | URLCHAR
32 | const unsigned char chartype[256] = {
33 | #if '\n' == 0x0a && ' ' == 0x20 && '0' == 0x30 \
34 | && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
35 | /* ASCII */
36 | B, B, B, B, B, B, B, B, 0, 0, 0, 0, 0, 0, B, B,
37 | B, B, B, B, B, B, B, B, B, B, B, 0, B, B, B, B,
38 | 0, U, 0, 0, R, 0, 0, U,RU,RU,RU, R, 0, U,RU, U, /* !"#$%&'()*+,-./ */
39 | U, U, U, U, U, U, U, U, U, U, 0, 0, 0, 0, 0, R, /* 0123456789:;<=>? */
40 | 0, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, /* @ABCDEFGHIJKLMNO */
41 | U, U, U, U, U, U, U, U, U, U, U, R, R, R, R, U, /* PQRSTUVWXYZ[\]^_ */
42 | 0, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, /* `abcdefghijklmno */
43 | U, U, U, U, U, U, U, U, U, U, U, R, 0, R, U, /* pqrstuvwxyz{|}~ */
44 | #else
45 | #error "Unsupported character encoding."
46 | #endif
47 | };
48 | /*
49 | * isregex: test whether or not regular expression
50 | *
51 | * i) s string
52 | * r) 1: is regex, 0: not regex
53 | */
54 | int
55 | isregex(const char *s)
56 | {
57 | int c;
58 |
59 | while ((c = *s++) != '\0')
60 | if (isregexchar(c))
61 | return 1;
62 | return 0;
63 | }
64 | /*
65 | * quote string.
66 | *
67 | * 'aaa' => \'\a\a\a\'
68 | */
69 | const char *
70 | quote_string(const char *s)
71 | {
72 | STATIC_STRBUF(sb);
73 |
74 | strbuf_clear(sb);
75 | for (; *s; s++) {
76 | if (!isalnum((unsigned char)*s))
77 | strbuf_putc(sb, '\\');
78 | strbuf_putc(sb, *s);
79 | }
80 | return strbuf_value(sb);
81 | }
82 |
--------------------------------------------------------------------------------
/libutil/char.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _CHAR_H_
21 | #define _CHAR_H_
22 |
23 | extern const unsigned char chartype[256];
24 |
25 | #define REGEXCHAR 1
26 | #define URLCHAR 2
27 | #define BINARYCHAR 4
28 | #define test_chartype(c, t) (chartype[(unsigned char)(c)] & (t))
29 |
30 | /* test whether or not regular expression char. */
31 | #define isregexchar(c) test_chartype(c, REGEXCHAR)
32 |
33 | /* test whether can be included in URL without escaping. */
34 | #define isurlchar(c) test_chartype(c, URLCHAR)
35 |
36 | /* test whether or not cahr included in binary file. */
37 | #define isbinarychar(c) test_chartype(c, BINARYCHAR)
38 |
39 | int isregex(const char *);
40 | const char *quote_string(const char *);
41 |
42 | #endif /* ! _CHAR_H_ */
43 |
--------------------------------------------------------------------------------
/libutil/checkalloc.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include
22 | #endif
23 | #include
24 | #include
25 |
26 | #include "checkalloc.h"
27 | #include "die.h"
28 | /*
29 | * Functions which allocate memory with check.
30 | */
31 |
32 | /*
33 | * check_malloc: memory allocator
34 | */
35 | void *
36 | check_malloc(size_t size)
37 | {
38 | void *p = (void *)malloc(size);
39 | if (p == NULL)
40 | die("short of memory.");
41 | return p;
42 | }
43 |
44 | /*
45 | * check_calloc: memory allocator
46 | */
47 | void *
48 | check_calloc(size_t number, size_t size)
49 | {
50 | void *p = (void *)calloc(number, size);
51 | if (p == NULL)
52 | die("short of memory.");
53 | return p;
54 | }
55 | /*
56 | * check_realloc: memory allocator
57 | */
58 | void *
59 | check_realloc(void *area, size_t size)
60 | {
61 | void *p = (void *)realloc(area, size);
62 | if (p == NULL)
63 | die("short of memory.");
64 | return p;
65 | }
66 | /*
67 | * check_strdup: allocate memory and copy string to it.
68 | *
69 | * i) string original string
70 | * r) allocated memory
71 | */
72 | char *
73 | check_strdup(const char *string)
74 | {
75 | char *p = check_malloc(strlen(string) + 1);
76 | strcpy(p, string);
77 | return p;
78 | }
79 |
--------------------------------------------------------------------------------
/libutil/checkalloc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _CHECKALLOC_H
21 | #define _CHECKALLOC_H
22 | #include
23 |
24 | void *check_malloc(size_t);
25 | void *check_calloc(size_t, size_t);
26 | void *check_realloc(void *, size_t);
27 | char *check_strdup(const char *);
28 |
29 | #endif /* _CHECKALLOC_H */
30 |
--------------------------------------------------------------------------------
/libutil/compress.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _COMPRESS_H
22 | #define _COMPRESS_H
23 |
24 | /*
25 | * Please list words which appear in definition line.
26 | *
27 | * 'ddefine' means 'd => define'.
28 | */
29 | #define DEFAULT_ABBREVIATION "ddefine ttypedef"
30 |
31 | void abbrev_open(const char *);
32 | void abbrev_close(void);
33 | void abbrev_dump(void);
34 | char *compress(const char *text, const char *name);
35 | char *uncompress(const char *text, const char *name);
36 |
37 | #endif /* ! _COMPRESS_H */
38 |
--------------------------------------------------------------------------------
/libutil/conf.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _CONF_H_
22 | #define _CONF_H_
23 |
24 | #include "strbuf.h"
25 | /*
26 | * Access library for gtags.conf (.globalrc).
27 | * File format is a subset of XXXcap (termcap, printcap) file.
28 | */
29 | #define GTAGSCONF "/etc/gtags.conf"
30 | #define OLD_GTAGSCONF "/etc/global.conf" /* for compatibility */
31 | #define DEBIANCONF "/etc/gtags/gtags.conf"
32 | #define OLD_DEBIANCONF "/etc/gtags/global.conf"/* for compatibility */
33 | #define GTAGSRC ".globalrc"
34 | #ifdef __DJGPP__
35 | #define DOS_GTAGSRC "_globalrc"
36 | #endif
37 | #define DEFAULTLABEL "default"
38 |
39 | void openconf(void);
40 | int getconfn(const char *, int *);
41 | int getconfs(const char *, STRBUF *);
42 | int getconfb(const char *);
43 | const char *getconfline(void);
44 | void closeconf(void);
45 |
46 | #endif /* ! _CONF_H_ */
47 |
--------------------------------------------------------------------------------
/libutil/date.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include
22 | #endif
23 | #include
24 | #ifdef HAVE_STRING_H
25 | #include
26 | #else
27 | #include
28 | #endif
29 | #include
30 | #include "die.h"
31 | #include "strlimcpy.h"
32 | #include "date.h"
33 | /*
34 | * now: current date and time
35 | *
36 | * r) date and time
37 | */
38 | const char *
39 | now(void)
40 | {
41 | static char buf[128];
42 |
43 | #ifdef HAVE_STRFTIME
44 | time_t tval;
45 |
46 | if (time(&tval) == -1)
47 | die("cannot get current time.");
48 | (void)strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Z %Y", localtime(&tval));
49 | #else
50 | FILE *ip;
51 |
52 | strlimcpy(buf, "unknown time", sizeof(buf));
53 | if ((ip = popen("date", "r")) != NULL) {
54 | if (fgets(buf, sizeof(buf), ip))
55 | buf[strlen(buf) - 1] = 0;
56 | pclose(ip);
57 | }
58 | #endif
59 | return buf;
60 | }
61 |
--------------------------------------------------------------------------------
/libutil/date.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _NOW_H_
21 | #define _NOW_H_
22 |
23 | const char *now(void);
24 |
25 | #endif /* ! _NOW_H_ */
26 |
--------------------------------------------------------------------------------
/libutil/defined.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1998, 1999, 2000, 2001
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifdef HAVE_CONFIG_H
22 | #include
23 | #endif
24 | #ifdef STDC_HEADERS
25 | #include
26 | #endif
27 |
28 | #include "die.h"
29 | #include "dbop.h"
30 | #include "defined.h"
31 | #include "makepath.h"
32 |
33 | static DBOP *dbop = NULL;
34 |
35 | /*
36 | * Tag command that supports referenced tag must call this function
37 | * to decide whether or not the tag is defined.
38 | */
39 | int
40 | defined(const char *name)
41 | {
42 | if (dbop == NULL) {
43 | const char *dbpath;
44 |
45 | /*
46 | * gtags(1) set GTAGSDBPATH to the path GTAGS exist.
47 | */
48 | if (!(dbpath = getenv("GTAGSDBPATH")))
49 | dbpath = ".";
50 | dbop = dbop_open(makepath(dbpath, "GTAGS", NULL), 0, 0, 0);
51 | if (dbop == NULL)
52 | die("'GTAGS' not found.");
53 | }
54 | if (dbop_get(dbop, name))
55 | return 1;
56 | return 0;
57 | }
58 |
--------------------------------------------------------------------------------
/libutil/defined.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1998, 1999, 2000
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _DEFINED_H_
22 | #define _DEFINED_H_
23 |
24 | int defined(const char *);
25 |
26 | #endif /* ! _DEFINED_H_ */
27 |
--------------------------------------------------------------------------------
/libutil/die.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifdef HAVE_CONFIG_H
22 | #include
23 | #endif
24 | #include
25 | #ifdef STDC_HEADERS
26 | #include
27 | #endif
28 |
29 | #include "die.h"
30 |
31 | static int quiet;
32 | static int verbose;
33 | static int debug;
34 | static void (*exit_proc)(void);
35 |
36 | void
37 | setquiet(void)
38 | {
39 | quiet = 1;
40 | }
41 | void
42 | setverbose(void)
43 | {
44 | verbose = 1;
45 | }
46 | void
47 | setdebug(void)
48 | {
49 | debug = 1;
50 | }
51 | void
52 | sethandler(void (*proc)(void))
53 | {
54 | exit_proc = proc;
55 | }
56 | void
57 | die(const char *s, ...)
58 | {
59 | va_list ap;
60 |
61 | if (!quiet) {
62 | fprintf(stderr, "%s: ", progname);
63 | va_start(ap, s);
64 | (void)vfprintf(stderr, s, ap);
65 | va_end(ap);
66 | fputs("\n", stderr);
67 | }
68 | if (exit_proc)
69 | (*exit_proc)();
70 | if (debug)
71 | abort();
72 | exit(1);
73 | }
74 |
75 | void
76 | die_with_code(int n, const char *s, ...)
77 | {
78 | va_list ap;
79 |
80 | if (!quiet) {
81 | fprintf(stderr, "%s: ", progname);
82 | va_start(ap, s);
83 | (void)vfprintf(stderr, s, ap);
84 | va_end(ap);
85 | fputs("\n", stderr);
86 | }
87 | if (exit_proc)
88 | (*exit_proc)();
89 | if (debug)
90 | abort();
91 | exit(n);
92 | }
93 | void
94 | message(const char *s, ...)
95 | {
96 | va_list ap;
97 |
98 | if (!quiet && verbose) {
99 | va_start(ap, s);
100 | (void)vfprintf(stderr, s, ap);
101 | va_end(ap);
102 | fputs("\n", stderr);
103 | }
104 | }
105 | void
106 | warning(const char *s, ...)
107 | {
108 | va_list ap;
109 |
110 | if (!quiet) {
111 | fputs("Warning: ", stderr);
112 | va_start(ap, s);
113 | (void)vfprintf(stderr, s, ap);
114 | va_end(ap);
115 | fputs("\n", stderr);
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/libutil/die.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _DIE_H_
22 | #define _DIE_H_
23 |
24 | #ifdef HAVE_CONFIG_H
25 | #include
26 | #endif
27 | #include
28 |
29 | #ifndef __attribute__
30 | /* This feature is available in gcc versions 2.5 and later. */
31 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
32 | # define __attribute__(x)
33 | # endif
34 | /* The __-protected variants of `format' and `printf' attributes
35 | are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
36 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
37 | # define __format__ format
38 | # define __printf__ printf
39 | # endif
40 | #endif
41 |
42 | extern const char *progname;
43 |
44 | void setquiet(void);
45 | void setverbose(void);
46 | void setdebug(void);
47 | void sethandler(void (*proc)(void));
48 | void die(const char *s, ...)
49 | __attribute__ ((__noreturn__, __format__ (__printf__, 1, 2)));
50 | void die_with_code(int n, const char *s, ...)
51 | __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
52 | void message(const char *s, ...)
53 | __attribute__ ((__format__ (__printf__, 1, 2)));
54 | void warning(const char *s, ...)
55 | __attribute__ ((__format__ (__printf__, 1, 2)));
56 |
57 | #endif /* ! _DIE_H_ */
58 |
--------------------------------------------------------------------------------
/libutil/env.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2005 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include
22 | #endif
23 | #ifdef STDC_HEADERS
24 | #include
25 | #endif
26 | #ifdef HAVE_STRING_H
27 | #include
28 | #else
29 | #include
30 | #endif
31 | #ifdef HAVE_HOME_ETC_H
32 | #include
33 | #endif
34 |
35 | #include "die.h"
36 | #include "env.h"
37 | #include "strbuf.h"
38 |
39 | extern char **environ;
40 |
41 | /*
42 | * set_env: put environment variable.
43 | *
44 | * i) var environment variable
45 | * i) val value
46 | */
47 | void
48 | set_env(const char *var, const char *val)
49 | {
50 | /*
51 | * sparc-sun-solaris2.6 doesn't have setenv(3).
52 | */
53 | #ifdef HAVE_PUTENV
54 | STRBUF *sb = strbuf_open(0);
55 |
56 | strbuf_sprintf(sb, "%s=%s", var, val);
57 | putenv(strbuf_value(sb));
58 | /* Don't free memory. putenv(3) require it. */
59 | #else
60 | setenv(var, val, 1);
61 | #endif
62 | }
63 | /*
64 | * get_home_directory: get environment dependent home directory.
65 | *
66 | * r) home directory
67 | */
68 | char *
69 | get_home_directory(void)
70 | {
71 | #ifdef HAVE_HOME_ETC_H
72 | return _HEdir;
73 | #else
74 | return getenv("HOME");
75 | #endif
76 | }
77 |
78 | /*
79 | * env_size: calculate the size of area used by environment.
80 | */
81 | int
82 | env_size(void)
83 | {
84 | char **e;
85 | int size = 0;
86 |
87 | for (e = environ; *e != NULL; e++)
88 | size += strlen(*e) + 1;
89 |
90 | return size;
91 | }
92 |
--------------------------------------------------------------------------------
/libutil/env.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, 2004, 2005 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _ENV_H_
20 | #define _ENV_H_
21 |
22 | void set_env(const char *, const char *);
23 | char *get_home_directory(void);
24 | int env_size(void);
25 |
26 | #endif /* ! _ENV_H_ */
27 |
--------------------------------------------------------------------------------
/libutil/fileop.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 | #ifndef _FILEOP_H
21 | #define _FILEOP_H
22 |
23 | #ifdef HAVE_CONFIG_H
24 | #include
25 | #endif
26 | #include
27 |
28 | #include "gparam.h"
29 |
30 | #define FILEOP_INPUT 1
31 | #define FILEOP_OUTPUT 2
32 | #define FILEOP_COMPRESS 4
33 |
34 | typedef struct {
35 | int type;
36 | FILE *fp;
37 | char command[MAXFILLEN];
38 | char path[MAXPATHLEN];
39 | } FILEOP;
40 |
41 | FILEOP *open_input_file(const char *);
42 | FILEOP *open_output_file(const char *, int);
43 | FILE *get_descripter(FILEOP *);
44 | void close_file(FILEOP *);
45 |
46 | #endif /* ! _FILEOP_H */
47 |
--------------------------------------------------------------------------------
/libutil/find.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2005
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _FIND_H_
22 | #define _FIND_H_
23 |
24 | void find_open(const char *);
25 | void find_open_filelist(const char *, const char *);
26 | char *find_read(void);
27 | void find_close(void);
28 |
29 | #endif /* ! _FIND_H_ */
30 |
--------------------------------------------------------------------------------
/libutil/format.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2006 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _FORMAT_H_
20 | #define _FORMAT_H_
21 |
22 | /*
23 | * (1) ctags -x format (FORMAT_CTAGS_X)
24 | *
25 | * PART_TAG PART_LNO PART_PATH PART_LINE
26 | * +----------------------------------------------
27 | * |main 227 ./src/main.c main()
28 | *
29 | * (2) ctags -x + file id format (FORMAT_CTAGS_XID)
30 | *
31 | * 0 PART_TAG+1 PART_LNO+1 PART_PATH+1 PART_LINE+1
32 | * +----------------------------------------------
33 | * |110 main 227 ./src/main.c main()
34 | *
35 | * (3) ctags format (FORMAT_CTAGS)
36 | *
37 | * +----------------------------------------------
38 | * |main ./src/main.c 227
39 | *
40 | * (4) path name format (FORMAT_PATH)
41 | *
42 | * +----------------------------------------------
43 | * |./src/main.c
44 | *
45 | * (5) grep format (FORMAT_GREP)
46 | *
47 | * +----------------------------------------------
48 | * |./src/main.c:227:main()
49 | *
50 | * (6) cscope line mode format (FORMAT_CSCOPE)
51 | *
52 | * +----------------------------------------------
53 | * |./src/main.c main 227 main()
54 | */
55 | #define FORMAT_CTAGS 1
56 | #define FORMAT_CTAGS_X 2
57 | #define FORMAT_CTAGS_XID 3
58 | #define FORMAT_PATH 4
59 | #define FORMAT_GREP 5
60 | #define FORMAT_CSCOPE 6
61 |
62 | /*
63 | * FORMAT_CTAGS_X
64 | */
65 | #define PART_TAG 0
66 | #define PART_LNO 1
67 | #define PART_PATH 2
68 | #define PART_LINE 3
69 |
70 | /*
71 | * Path name type
72 | */
73 | #define PATH_RELATIVE 1
74 | #define PATH_ABSOLUTE 2
75 | #define PATH_THROUGH 3
76 |
77 | #endif /* ! _FORMAT_H_ */
78 |
--------------------------------------------------------------------------------
/libutil/getdbpath.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2008
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _GETDBPATH_H_
22 | #define _GETDBPATH_H_
23 |
24 | char *getobjdir(const char *, int);
25 | int gtagsexist(const char *, char *, int, int);
26 | void getdbpath(char *, char *, char *, int);
27 | void setupdbpath(int);
28 | const char *get_dbpath();
29 | const char *get_root();
30 | const char *get_root_with_slash();
31 | const char *get_cwd();
32 |
33 | #endif /* ! _GETDBPATH_H_ */
34 |
--------------------------------------------------------------------------------
/libutil/global.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _GLOBAL_H_
22 | #define _GLOBAL_H_
23 |
24 | #include "gparam.h"
25 | #include "abs2rel.h"
26 | #include "args.h"
27 | #include "char.h"
28 | #include "checkalloc.h"
29 | #include "compress.h"
30 | #include "conf.h"
31 | #include "date.h"
32 | #include "dbop.h"
33 | #include "defined.h"
34 | #include "die.h"
35 | #include "env.h"
36 | #include "fileop.h"
37 | #include "find.h"
38 | #include "format.h"
39 | #include "getdbpath.h"
40 | #include "gpathop.h"
41 | #include "gtagsop.h"
42 | #include "idset.h"
43 | #include "is_unixy.h"
44 | #include "langmap.h"
45 | #include "linetable.h"
46 | #include "locatestring.h"
47 | #include "makepath.h"
48 | #include "path.h"
49 | #include "pathconvert.h"
50 | #include "pool.h"
51 | #include "split.h"
52 | #include "statistics.h"
53 | #include "strbuf.h"
54 | #include "strhash.h"
55 | #include "strlimcpy.h"
56 | #include "strmake.h"
57 | #include "tab.h"
58 | #include "test.h"
59 | #include "token.h"
60 | #include "usable.h"
61 | #include "version.h"
62 | #include "varray.h"
63 | #include "xargs.h"
64 |
65 | #endif /* ! _GLOBAL_H_ */
66 |
--------------------------------------------------------------------------------
/libutil/gparam.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2007, 2008
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _GPARAM_H_
22 | #define _GPARAM_H_
23 | #ifndef __BORLANDC__
24 | #include
25 | #endif
26 |
27 | #define MAXFILLEN 1024 /* max length of filter */
28 | #define IDENTLEN 512 /* max length of ident */
29 | #define MAXBUFLEN 1024 /* max length of buffer */
30 | #define MAXPROPLEN 1024 /* max length of property */
31 | #define MAXARGLEN 512 /* max length of argument */
32 | #define MAXTOKEN 512 /* max length of token */
33 | #define MAXFIDLEN 32 /* max length of fid */
34 | #ifndef MAXPATHLEN
35 | #define MAXPATHLEN 1024 /* max length of path */
36 | #endif
37 | #define MAXKEYLEN MAXPATHLEN /* max length of record key */
38 | #define MAXURLLEN 1024 /* max length of URL */
39 | /*
40 | * The default cache size of db library is 50MB.
41 | * The minimum size is 500KB.
42 | */
43 | #define GTAGSCACHE 50000000 /* default cache size 50MB */
44 | #define GTAGSMINCACHE 500000 /* minimum cache size 500KB */
45 |
46 | #endif /* ! _GPARAM_H_ */
47 |
--------------------------------------------------------------------------------
/libutil/gpathop.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2005, 2006
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _PATHOP_H_
22 | #define _PATHOP_H_
23 | #include
24 |
25 | #include "gparam.h"
26 | #include "dbop.h"
27 |
28 | #define NEXTKEY " __.NEXTKEY"
29 |
30 | /*
31 | * File type
32 | */
33 | #define GPATH_SOURCE 1
34 | #define GPATH_OTHER 2
35 | #define GPATH_BOTH 3
36 |
37 | typedef struct {
38 | /* set by gfind_open() */
39 | DBOP *dbop;
40 | const char *prefix;
41 | int target;
42 | int version;
43 | /* set by gfind_open() and gfind_read() */
44 | int first;
45 | int eod; /* end of data */
46 | /* set by gfind_read() */
47 | int type; /* File type */
48 | const char *path; /* return value of gfind_read() */
49 | } GFIND;
50 |
51 | int gpath_open(const char *, int);
52 | const char *gpath_path2fid(const char *, int *);
53 | const char *gpath_fid2path(const char *, int *);
54 | void gpath_put(const char *, int);
55 | void gpath_delete(const char *);
56 | void gpath_close(void);
57 | int gpath_nextkey(void);
58 | GFIND *gfind_open(const char *, const char *, int);
59 | const char *gfind_read(GFIND *);
60 | void gfind_close(GFIND *);
61 |
62 | #endif /* ! _PATHOP_H_ */
63 |
--------------------------------------------------------------------------------
/libutil/idset.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2006, 2007 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _IDSET_H_
20 | #define _IDSET_H_
21 |
22 | /*
23 | * Any id is not equal to END_OF_ID.
24 | */
25 | #define END_OF_ID ((unsigned int)(-1))
26 |
27 | typedef struct {
28 | unsigned int size;
29 | unsigned int min;
30 | unsigned int max;
31 | unsigned int lastid; /* used by idset_first() and idset_next() */
32 | unsigned long *set;
33 | } IDSET;
34 |
35 | IDSET *idset_open(unsigned int);
36 | int idset_empty(IDSET *);
37 | void idset_add(IDSET *, unsigned int);
38 | int idset_contains(IDSET *, unsigned int);
39 | unsigned int idset_first(IDSET *);
40 | unsigned int idset_next(IDSET *);
41 | unsigned int idset_count(IDSET *);
42 | void idset_close(IDSET *);
43 |
44 | #endif /* ! _IDSET_H_ */
45 |
--------------------------------------------------------------------------------
/libutil/is_unixy.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2001 Tama Communications Corporation
3 | *
4 | * Contributed by Jason Hood , 2001.
5 | *
6 | * This file is part of GNU GLOBAL.
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program. If not, see .
20 | */
21 |
22 | #ifdef HAVE_CONFIG_H
23 | #include
24 | #endif
25 | #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__)
26 | #include
27 | #ifdef __DJGPP__
28 | #include
29 | #endif
30 | #endif
31 |
32 | #include "is_unixy.h"
33 |
34 | /*
35 | * is_unixy: whether running in a unix-like shell or not
36 | *
37 | * r) 1: unixy shell, 0: DOS shell (COMMAND.COM)
38 | */
39 | int
40 | is_unixy(void)
41 | {
42 | #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__)
43 | static int unix_shell = -1;
44 |
45 | if (unix_shell == -1) {
46 | char *s = getenv("SHELL");
47 | #ifdef __DJGPP__
48 | /* Assume if SHELL isn't defined, COMSPEC is DOS. */
49 | unix_shell = (s == NULL) ? 0 : _is_unixy_shell(s);
50 | #else
51 | unix_shell = (s != 0);
52 | #endif
53 | }
54 | return unix_shell;
55 | #else
56 | return 1;
57 | #endif
58 | }
59 |
--------------------------------------------------------------------------------
/libutil/is_unixy.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2001 Tama Communications Corporation
3 | *
4 | * Contributed by Jason Hood , 2001.
5 | *
6 | * This file is part of GNU GLOBAL.
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program. If not, see .
20 | */
21 |
22 | #ifndef _IS_UNIXY_H_
23 | #define _IS_UNIXY_H_
24 |
25 | int is_unixy(void);
26 |
27 | #endif /* ! _IS_UNIXY_H_ */
28 |
--------------------------------------------------------------------------------
/libutil/langmap.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _LANGMAP_H_
21 | #define _LANGMAP_H_
22 |
23 | #include "strbuf.h"
24 |
25 | #define DEFAULTLANGMAP "c:.c.h,yacc:.y,asm:.s.S,java:.java,cpp:.c++.cc.cpp.cxx.hxx.hpp.C.H,php:.php.php3.phtml,kconfig:Kconfig"
26 | #define DEFAULTSKIP "GPATH,GTAGS,GRTAGS,GSYMS,HTML/,HTML.pub/,html/,tags,TAGS,ID,y.tab.c,y.tab.h,cscope.out,cscope.po.out,cscope.in.out,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,autom4te.cache/"
27 |
28 | void setup_langmap(const char *);
29 | const char *decide_lang(const char *);
30 | void make_suffixes(const char *, STRBUF *);
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/libutil/langmap.h.in:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _LANGMAP_H_
21 | #define _LANGMAP_H_
22 |
23 | #include "strbuf.h"
24 |
25 | #define DEFAULTLANGMAP "@DEFAULTLANGMAP@"
26 | #define DEFAULTSKIP "@DEFAULTSKIP@"
27 |
28 | void setup_langmap(const char *);
29 | const char *decide_lang(const char *);
30 | void make_suffixes(const char *, STRBUF *);
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/libutil/linetable.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2002 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _LINETABLE_H
21 | #define _LINETABLE_H
22 | #include
23 |
24 | int linetable_open(const char *);
25 | int linetable_read(char *, int);
26 | char *linetable_get(int, int *);
27 | void linetable_close(void);
28 | void linetable_print(FILE *, int);
29 |
30 | #endif /* ! _LINETABLE_H */
31 |
--------------------------------------------------------------------------------
/libutil/locatestring.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2002
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _LOCATESTRING_H_
22 | #define _LOCATESTRING_H_
23 |
24 | #define MATCH_FIRST 0
25 | #define MATCH_AT_FIRST 1
26 | #define MATCH_LAST 2
27 | #define MATCH_AT_LAST 3
28 | #define MATCH_COMPLETE 4
29 | #define IGNORE_CASE 8
30 |
31 | char *locatestring(const char *, const char *, int);
32 |
33 | #endif /* ! _LOCATESTRING_H_ */
34 |
--------------------------------------------------------------------------------
/libutil/makepath.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifdef HAVE_CONFIG_H
22 | #include
23 | #endif
24 | #ifdef HAVE_STRING_H
25 | #include
26 | #else
27 | #include
28 | #endif
29 |
30 | #include "gparam.h"
31 | #include "die.h"
32 | #include "makepath.h"
33 | #include "strbuf.h"
34 |
35 | /*
36 | * makepath: make path from directory and file.
37 | *
38 | * i) dir directory(optional)
39 | * i) file file
40 | * i) suffix suffix(optional)
41 | * r) path
42 | *
43 | * It is necessary to note the usage of makepath(), because it returns
44 | * module local area. If makepath() is called again in the function which
45 | * is passed the return value of makepath(), then the value is overwritten.
46 | * This may cause the bug which is not understood easily.
47 | * You must not pass the return value except for the safe functions
48 | * described below.
49 | *
50 | * Here are safe functions.
51 | * o functions in standard C library.
52 | * o following libutil functions:
53 | * test(), dbop_open(), strlimcpy(), strbuf_puts(), die()
54 | */
55 | const char *
56 | makepath(const char *dir, const char *file, const char *suffix)
57 | {
58 | STATIC_STRBUF(sb);
59 | int length;
60 | char sep = '/';
61 |
62 | strbuf_clear(sb);
63 | if (dir != NULL) {
64 | if ((length = strlen(dir)) > MAXPATHLEN)
65 | die("path name too long. '%s'\n", dir);
66 |
67 | #if defined(_WIN32) || defined(__DJGPP__)
68 | /* follows native way. */
69 | if (dir[0] == '\\' || dir[2] == '\\')
70 | sep = '\\';
71 | #endif
72 | strbuf_puts(sb, dir);
73 | strbuf_unputc(sb, sep);
74 | strbuf_putc(sb, sep);
75 | }
76 | strbuf_puts(sb, file);
77 | if (suffix) {
78 | if (*suffix != '.')
79 | strbuf_putc(sb, '.');
80 | strbuf_puts(sb, suffix);
81 | }
82 | if ((length = strlen(strbuf_value(sb))) > MAXPATHLEN)
83 | die("path name too long. '%s'\n", strbuf_value(sb));
84 | return strbuf_value(sb);
85 | }
86 |
--------------------------------------------------------------------------------
/libutil/makepath.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _MAKEPATH_H_
22 | #define _MAKEPATH_H_
23 |
24 | const char *makepath(const char *, const char *, const char *);
25 |
26 | #endif /* ! _MAKEPATH_H_ */
27 |
--------------------------------------------------------------------------------
/libutil/path.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2008
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _PATH_H_
22 | #define _PATH_H_
23 |
24 | #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__)
25 | #include
26 | #endif
27 |
28 | /*
29 | * PATHSEP - Define OS-specific directory and path seperators
30 | */
31 | #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__)
32 | #define PATHSEP ";"
33 | #else
34 | #define PATHSEP ":"
35 | #endif
36 |
37 | #define isdrivechar(x) (((x) >= 'A' && (x) <= 'Z') || ((x) >= 'a' && (x) <= 'z'))
38 |
39 | int isabspath(const char *);
40 | char *canonpath(char *);
41 | #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__)
42 | char *realpath(const char *, char *);
43 | #endif
44 | int makedirectories(const char *, const char *, int);
45 |
46 | #endif /* ! _PATH_H_ */
47 |
--------------------------------------------------------------------------------
/libutil/pathconvert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005, 2006, 2010 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _PATHCONVERT_H_
20 | #define _PATHCONVERT_H_
21 |
22 | #include
23 | #include "gparam.h"
24 | #include "strbuf.h"
25 |
26 | typedef struct {
27 | FILE *op;
28 | int type; /* PATH_ABSOLUTE, PATH_RELATIVE */
29 | int format; /* defined in format.h */
30 | STRBUF *abspath;
31 | char basedir[MAXPATHLEN];
32 | int start_point;
33 |
34 | } CONVERT;
35 |
36 | void set_encode_chars(const unsigned char *);
37 | void set_print0();
38 | char *decode_path(const unsigned char *);
39 | CONVERT *convert_open(int, int, const char *, const char *, const char *, FILE *);
40 | void convert_put(CONVERT *, const char *);
41 | void convert_put_path(CONVERT *, const char *);
42 | void convert_put_using(CONVERT *, const char *, const char *, int, const char *, const char *);
43 | void convert_close(CONVERT *cv);
44 |
45 | #endif /* ! _PATHCONVERT_H_ */
46 |
--------------------------------------------------------------------------------
/libutil/pool.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _POOL_H
20 | #define _POOL_H
21 |
22 | #include "obstack.h"
23 |
24 | typedef struct {
25 | struct obstack obstack; /* memory pool */
26 | char *first_object; /* first object (for reset) */
27 | } POOL;
28 |
29 | POOL *pool_open(void);
30 | void *pool_malloc(POOL *, int);
31 | char *pool_strdup(POOL *, const char *, int);
32 | char *pool_strdup_withterm(POOL *, const char *, int);
33 | void pool_reset(POOL *);
34 | void pool_close(POOL *);
35 |
36 | #endif /* ! _POOL_H */
37 |
--------------------------------------------------------------------------------
/libutil/split.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2002, 2005, 2010 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _SPLIT_H_
21 | #define _SPLIT_H_
22 |
23 | #define NPART 10
24 |
25 | typedef struct {
26 | int npart;
27 | struct part {
28 | char *start;
29 | char *end;
30 | int savec;
31 | } part[NPART];
32 | } SPLIT;
33 |
34 | int split(const char *, int, SPLIT *);
35 | void recover(SPLIT *);
36 | void split_dump(SPLIT *);
37 | const char *parse_xid(const char *, char *, int *);
38 | const char *nextstring(const char *);
39 | const char *nextelement(const char *);
40 |
41 | #endif /* ! _SPLIT_H_ */
42 |
--------------------------------------------------------------------------------
/libutil/strhash.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _STRHASH_H
20 | #define _STRHASH_H
21 |
22 | #include "pool.h"
23 | #include "queue.h"
24 |
25 | struct sh_entry {
26 | SLIST_ENTRY(sh_entry) ptr;
27 | char *name; /* name: hash key */
28 | void *value; /* value: user structure */
29 | };
30 |
31 | SLIST_HEAD(sh_head, sh_entry);
32 |
33 | typedef struct {
34 | int buckets; /* number of buckets */
35 | struct sh_head *htab; /* hash buckets */
36 | POOL *pool; /* memory pool */
37 | unsigned long entries; /* number of entries */
38 | /*
39 | * iterator
40 | */
41 | struct sh_entry *cur_entry;
42 | int cur_bucket;
43 | } STRHASH;
44 |
45 | STRHASH *strhash_open(int);
46 | struct sh_entry *strhash_assign(STRHASH *, const char *, int);
47 | char * strhash_strdup(STRHASH *, const char *, int);
48 | struct sh_entry *strhash_first(STRHASH *);
49 | struct sh_entry *strhash_next(STRHASH *);
50 | void strhash_reset(STRHASH *);
51 | void strhash_close(STRHASH *);
52 |
53 | #endif /* ! _STRHASH_H */
54 |
--------------------------------------------------------------------------------
/libutil/strlimcpy.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2002 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include
22 | #endif
23 | #include "die.h"
24 | #include "strlimcpy.h"
25 |
26 | /*
27 | * strlimcpy: copy string with limit.
28 | *
29 | * o) dest destination string
30 | * i) source source string
31 | * i) limit size of dest
32 | *
33 | * NOTE: This function is similar to strlcpy of OpenBSD but is different
34 | * because strlimcpy abort when it beyond the limit.
35 | */
36 | void
37 | strlimcpy(char *dest, const char *const source, const int limit)
38 | {
39 | int n = (int)limit;
40 | const char *s = source;
41 |
42 | while (n--)
43 | if (!(*dest++ = *s++))
44 | return;
45 | die("buffer overflow. strlimcpy(dest, '%s', %d).", source, limit);
46 | }
47 |
--------------------------------------------------------------------------------
/libutil/strlimcpy.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2002 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _STRLIMCPY_H_
21 | #define _STRLIMCPY_H_
22 |
23 | void strlimcpy(char *, const char *, const int);
24 |
25 | #endif /* ! _STRLIMCPY_H_ */
26 |
--------------------------------------------------------------------------------
/libutil/strmake.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1998, 1999, 2000, 2004, 2006, 2010
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _STRMAKE_H_
22 | #define _STRMAKE_H_
23 |
24 | #include
25 |
26 | #define TRIM_HEAD 1
27 | #define TRIM_TAIL 2
28 | #define TRIM_BOTH 3
29 | #define TRIM_ALL 4
30 |
31 | #ifndef isblank
32 | #define isblank(c) ((c) == ' ' || (c) == '\t')
33 | #endif
34 |
35 | #define SKIP_BLANKS(p) do { \
36 | while (*p && isblank((unsigned char)*p)) \
37 | p++; \
38 | } while (0)
39 |
40 | const char *strmake(const char *, const char *);
41 | const char *strtrim(const char *, int, int *);
42 | int strcmp_withterm(const char *, const char *, int);
43 | const char *strcpy_withterm(char *, const char *, int, int);
44 |
45 | #endif /* ! _STRMAKE_H_ */
46 |
--------------------------------------------------------------------------------
/libutil/tab.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1996, 1997, 1998, 1999, 2000, 2006
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _TAB_H_
22 | #define _TAB_H_
23 |
24 | #include
25 |
26 | void settabs(int);
27 | size_t read_file_detabing(char *, size_t, FILE *, int *, int *);
28 | void detab_replacing(FILE *op, const char *buf, const char *(*replace)(int c));
29 |
30 |
31 | #endif /* ! _TAB_H_ */
32 |
--------------------------------------------------------------------------------
/libutil/test.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2006
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _TEST_H_
22 | #define _TEST_H_
23 |
24 | int test(const char *, const char *);
25 | int filesize(const char *);
26 |
27 |
28 | #endif /* ! _TEST_H_ */
29 |
--------------------------------------------------------------------------------
/libutil/token.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1998, 1999, 2000, 2003
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _TOKEN_H_
22 | #define _TOKEN_H_
23 |
24 | #include "gparam.h"
25 | #include "strbuf.h"
26 |
27 | #define SYMBOL 0
28 |
29 | extern const char *sp, *cp, *lp;
30 | extern int lineno;
31 | extern int crflag;
32 | extern int cmode;
33 | extern int cppmode;
34 | extern int ymode;
35 | extern char token[MAXTOKEN];
36 | extern char curfile[MAXPATHLEN];
37 | extern int continued_line;
38 |
39 | #define nextchar() \
40 | (cp == NULL ? \
41 | ((sp = cp = strbuf_fgets(ib, ip, STRBUF_NOCRLF)) == NULL ? \
42 | EOF : \
43 | (lineno++, *cp == 0 ? \
44 | (lp = cp, cp = NULL, continued_line = 0, '\n') : \
45 | (unsigned char)*cp++)) : \
46 | (*cp == 0 ? \
47 | (lp = cp, cp = NULL, continued_line = 0, '\n') : \
48 | (unsigned char)*cp++))
49 | #define atfirst (sp && sp == (cp ? cp - 1 : lp))
50 |
51 | int opentoken(const char *);
52 | void closetoken(void);
53 | int nexttoken(const char *, int (*)(const char *, int));
54 | void pushbacktoken(void);
55 | int peekc(int);
56 | void throwaway_nextchar();
57 | int atfirst_exceptspace(void);
58 |
59 | #endif /* ! _TOKEN_H_ */
60 |
--------------------------------------------------------------------------------
/libutil/usable.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1998, 1999, 2000, 2002
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifdef HAVE_CONFIG_H
22 | #include
23 | #endif
24 | #include
25 | #ifdef STDC_HEADERS
26 | #include
27 | #endif
28 | #ifdef HAVE_STRING_H
29 | #include
30 | #else
31 | #include
32 | #endif
33 |
34 | #include "gparam.h"
35 | #include "locatestring.h"
36 | #include "makepath.h"
37 | #include "path.h"
38 | #include "test.h"
39 | #include "strbuf.h"
40 | #include "strlimcpy.h"
41 | #include "usable.h"
42 |
43 | #if defined(_WIN32) || defined(__DJGPP__)
44 | static const char *suffix[] = {".exe", ".com", ".bat",};
45 | #endif
46 |
47 | /*
48 | * usable: check if command is executable or not.
49 | *
50 | * i) command
51 | * r) ==NULL: not found.
52 | * !=NULL: absolute path of command.
53 | */
54 | char *
55 | usable(const char *command)
56 | {
57 | STRBUF *sb;
58 | char *p;
59 | const char *dir;
60 | static char path[MAXPATHLEN];
61 |
62 | #if defined(_WIN32) || defined(__DJGPP__)
63 | int i, lim = sizeof(suffix)/sizeof(char *);
64 | #endif
65 |
66 | if (isabspath(command) || locatestring(command, "./", MATCH_AT_FIRST)
67 | || locatestring(command, "../", MATCH_AT_FIRST)) {
68 | if (test("fx", command)) {
69 | strlimcpy(path, command, sizeof(path));
70 | return path;
71 | }
72 | return NULL;
73 | }
74 | /*
75 | * If found in BINDIR then use it.
76 | */
77 | if (test("fx", makepath(BINDIR, command, NULL))) {
78 | strlimcpy(path, makepath(BINDIR, command, NULL), sizeof(path));
79 | return path;
80 | }
81 | /*
82 | * Locate the command for each path in PATH.
83 | */
84 | *path = 0;
85 | /* Don't use fixed length buffer for environment variable
86 | * because it brings buffer overflow. */
87 | sb = strbuf_open(0);
88 | strbuf_puts(sb, getenv("PATH"));
89 | p = strbuf_value(sb);
90 | while (p) {
91 | dir = p;
92 | if ((p = locatestring(p, PATHSEP, MATCH_FIRST)) != NULL)
93 | *p++ = 0;
94 | if (test("fx", makepath(dir, command, NULL))) {
95 | strlimcpy(path, makepath(dir, command, NULL), sizeof(path));
96 | goto finish;
97 | }
98 | #if defined(_WIN32) || defined(__DJGPP__)
99 | for (i = 0; i < lim; i++)
100 | if (test("f", makepath(dir, command, suffix[i]))) {
101 | strlimcpy(path, makepath(dir, command, suffix[i]), sizeof(path));
102 | goto finish;
103 | }
104 | #endif
105 | }
106 | finish:
107 | strbuf_close(sb);
108 | return *path ? path : NULL;
109 | }
110 |
--------------------------------------------------------------------------------
/libutil/usable.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1998, 1999, 2000
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifndef _USABLE_H_
22 | #define _USABLE_H_
23 |
24 | char *usable(const char *);
25 |
26 | #endif /* ! _USABLE_H_ */
27 |
--------------------------------------------------------------------------------
/libutil/varray.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef _VARRAY_H
20 | #define _VARRAY_H
21 |
22 | typedef struct _varray {
23 | char *vbuf;
24 | int size;
25 | int length;
26 | int alloced;
27 | int expand;
28 | } VARRAY;
29 |
30 | VARRAY *varray_open(int, int);
31 | void *varray_assign(VARRAY *, int, int);
32 | void *varray_append(VARRAY *);
33 | void varray_reset(VARRAY *);
34 | void varray_close(VARRAY *);
35 |
36 | #endif /* ! _VARRAY_H */
37 |
--------------------------------------------------------------------------------
/libutil/version.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1999, 2000, 2001, 2007
3 | * Tama Communications Corporation
4 | *
5 | * This file is part of GNU GLOBAL.
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .
19 | */
20 |
21 | #ifdef HAVE_CONFIG_H
22 | #include
23 | #endif
24 | #include
25 | #ifdef STDC_HEADERS
26 | #include
27 | #endif
28 |
29 | #include "version.h"
30 |
31 | const char *copy = "\
32 | Copyright (c) 2010 Tama Communications Corporation\n\
33 | License GPLv3+: GNU GPL version 3 or later \n\
34 | This is free software: you are free to change and redistribute it.\n\
35 | There is NO WARRANTY, to the extent permitted by law.\n\
36 | This is also commercial (for-profit) software based on BOKIN model.\n\
37 | Please see the donation page .\n\
38 | ";
39 | /*
40 | * get_version: get version string.
41 | */
42 | char *
43 | get_version(void)
44 | {
45 | return VERSION;
46 | }
47 | /*
48 | * version: print version information.
49 | */
50 | void
51 | version(const char *name, const int verbose)
52 | {
53 | if (name == NULL)
54 | name = progname;
55 | /*
56 | * if the -q option is not specified then always verbose
57 | * according to the GNU coding standard
58 | */
59 | if (qflag)
60 | fprintf(stdout, "%s\n", VERSION);
61 | else {
62 | fprintf(stdout, "%s - %s\n", name, PACKAGE_STRING);
63 | fprintf(stdout, "%s", copy);
64 | }
65 | exit(0);
66 | }
67 |
--------------------------------------------------------------------------------
/libutil/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 1999, 2000 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _VERSION_H_
21 | #define _VERSION_H_
22 |
23 | extern const char *progname;
24 | extern int qflag;
25 |
26 | char *get_version(void);
27 | void version(const char *, const int);
28 |
29 | #endif /* ! _VERSION_H_ */
30 |
--------------------------------------------------------------------------------
/libutil/xargs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005 Tama Communications Corporation
3 | *
4 | * This file is part of GNU GLOBAL.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | #ifndef _XARGS_H_
21 | #define _XARGS_H_
22 |
23 | #include
24 |
25 | #include "strbuf.h"
26 |
27 | /*
28 | * Types
29 | */
30 | #define XARGS_FILE 1
31 | #define XARGS_ARGV 2
32 | #define XARGS_STRBUF 3
33 | #define XARGS_FIND 4
34 | /*
35 | * Options
36 | */
37 | #define XA_IGNORE_ERROR 1
38 | #define XA_SKIP_NOTSOURCE 2
39 | #define XA_PUT_GPATH 4
40 | #define XA_TRIM_LINE 8
41 |
42 | typedef struct {
43 | /*
44 | * common area
45 | */
46 | char *command;
47 | FILE *pipe;
48 | STRBUF *result;
49 | int end_of_arg;
50 | int unread;
51 | int seqno; /* sequencial number */
52 | int type; /* XARGS_XXX Types */
53 | /*
54 | * options
55 | *
56 | * These variables are set to directly by calling procedures.
57 | * This might have to be reviewed.
58 | */
59 | int ignore_error;
60 | int max_args; /* 0: no limit, >0: limit */
61 | int put_gpath;
62 | int trim_line;
63 | int skip_assembly;
64 | void (*verbose)(char *, int, int);
65 | /*
66 | * XARGS_FILE
67 | */
68 | FILE *ip;
69 | long fptr;
70 | STRBUF *path;
71 | /*
72 | * XARGS_ARGV
73 | */
74 | int argc;
75 | char *const *argv;
76 | /*
77 | * XARGS_STRBUF
78 | */
79 | char *curp;
80 | char *endp;
81 | /*
82 | * XARGS_FIND
83 | */
84 | } XARGS;
85 |
86 | XARGS *xargs_open_with_file(const char *, int, FILE *);
87 | XARGS *xargs_open_with_argv(const char *, int, int, char *const *);
88 | XARGS *xargs_open_with_strbuf(const char *, int, STRBUF *);
89 | XARGS *xargs_open_with_find(const char *, int);
90 | char *xargs_read(XARGS *);
91 | void xargs_unread(XARGS *);
92 | int xargs_close(XARGS *);
93 |
94 | #endif /*! _XARGS_H_ */
95 |
--------------------------------------------------------------------------------
/plugin-example/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to create Makefile.in
2 | #
3 | # Copyright (c) 2010 Tama Communications Corporation
4 | #
5 | # This file is free software; as a special exception the author gives
6 | # unlimited permission to copy and/or distribute it, with or without
7 | # modifications, as long as this notice is preserved.
8 | #
9 | # This program is distributed in the hope that it will be useful, but
10 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | #
13 | plugindir = ${libdir}/gtags
14 | plugin_LTLIBRARIES = exuberant-ctags.la
15 |
16 | exuberant_ctags_la_SOURCES = exuberant-ctags.c
17 | exuberant_ctags_la_LDFLAGS = -module -avoid-version
18 |
19 | INCLUDES = @INCLUDES@
20 |
--------------------------------------------------------------------------------
/plugin-example/README:
--------------------------------------------------------------------------------
1 | This is an example of plug-in parser for gtags(1).
2 |
3 | This parser is built as a shared library, and is installed to
4 | /usr/local/lib/gtags by default.
5 |
6 | How to use a plug-in parser
7 | ===========================
8 |
9 | To use this plug-in parser, please do like follows:
10 | (It assumed that Exuberant ctags exists in "/usr/local/bin".)
11 |
12 | $ ./configure --with-exuberant-ctags=/usr/local/bin/ctags
13 | $ make install
14 | $ gtags --gtagsconf=/usr/local/share/gtags/gtags.conf --gtagslabel=plugin-example
15 |
16 | How to write a plug-in parser
17 | =============================
18 |
19 | You should write a parser function like follows:
20 |
21 | #include "parser.h"
22 | void
23 | parser(const struct parser_param *param)
24 | {
25 | ...
26 | }
27 |
28 | A param argument is given to each parser function.
29 | You can write a tag using the param argument like follows:
30 |
31 | o write a tag to GTAGS
32 |
33 | param->put(PARSER_DEF, , , , , param->arg);
34 |
35 | o write a tag to GRTAGS or GSYMS
36 |
37 | param->put(PARSER_REF_SYM, , , , , param->arg);
38 |
39 | Note:
40 | (1) Gtags always makes GRTAGS and GSYMS even if you don't use PARSER_REF_SYM.
41 | (2) When you use PARSER_REF_SYM, you cannot decide which to write tag in GRTAGS or GSYMS.
42 | If the symbol is defined in GTAGS, tag is written to GRTAGS else to GSYMS.
43 |
--------------------------------------------------------------------------------