cxref-1.6d/ 40755 233 144 0 11642337067 6000 5cxref-1.6d/ANNOUNCE 777 233 144 0 11506063522 10747 2doc/ANNOUNCEcxref-1.6d/COPYING 777 233 144 0 11506063522 10553 2doc/COPYINGcxref-1.6d/ChangeLog 644 233 144 30054 11642336614 7605 02010-10-03 Andrew M. Bishop Version 1.6d of cxref released. 2011-10-03 [r636] Andrew M. Bishop * doc/README.html: Update for version 1.6d. 2011-10-03 [r635] Andrew M. Bishop * FILES, LSM: Update again for version 1.6d. 2011-10-03 [r633-634] Andrew M. Bishop * LSM: Update for version 1.6d. * doc/NEWS, FILES, doc/README, src/version.h: Update for version 1.6d. 2011-08-26 [r632] Andrew M. Bishop * src/Makefile.in: Change the Makefile for better compatibility with FreeBSD. 2011-06-18 [r631] Andrew M. Bishop * src/parse.l: Remove gcc warning messages. 2011-04-02 [r630] Andrew M. Bishop * src/parse.y: Allow structure initialisers to have multiple components (e.g. a.b=1). 2010-12-27 Andrew M. Bishop Changed version control environment from RCS to CVS to SVN. 2010-12-27 Andrew M. Bishop * doc/NEWS: Temporary check-in to allow transition from RCS to CVS to SVN. 2010-10-19 Andrew M. Bishop * cpp/cxref-cpp-configure.in, cpp/Makefile.in, doc/Makefile.in, query/Makefile.in: Updated for latest version of autoconf. 2010-05-31 Andrew M. Bishop Version 1.6c of cxref released. 2010-05-31 Andrew M. Bishop * doc/NEWS, src/version.h: Update version number to 1.6c. 2009-04-25 Andrew M. Bishop * doc/FAQ: Remove link to internet feedback form. 2008-08-13 Andrew M. Bishop * doc/README.html: Remove links to pages that are not on web site. 2008-04-02 Andrew M. Bishop * src/parse.l: Removed the char_varying type. 2008-02-26 Andrew M. Bishop * src/parse.y: Handle ASM statements with named identifiers in them. 2008-02-11 Andrew M. Bishop * src/parse.l: Add offsetof() as well. 2007-12-03 Andrew M. Bishop * src/parse.l: Handle the gcc __builtin_offsetof() function. 2007-11-11 Andrew M. Bishop * configure.in: Check that the lex/yacc programs actually exist. 2007-02-16 Andrew M. Bishop Version 1.6b of cxref released. 2007-02-16 Andrew M. Bishop * src/version.h, doc/NEWS: Update to version 1.6b. 2006-10-15 Andrew M. Bishop * src/parse.y: Fix for scope problems with variable declarations like 'extern void (*variable)(void);'. 2006-03-11 Andrew M. Bishop * src/preproc.c, src/cxref.c: Define a value for PATH_MAX in case one is not already defined. 2005-11-19 Andrew M. Bishop * configure.in, cpp/configure.in: Call AC_INIT() properly. 2005-10-15 Andrew M. Bishop * cpp/cccp.c: Remove gcc-4.0 unused variable and signed/unsigned pointer warnings. 2005-05-01 Andrew M. Bishop Version 1.6a of cxref released. 2005-05-01 Andrew M. Bishop * doc/NEWS, src/version.h: Updated to version 1.6a. 2005-02-20 Andrew M. Bishop * src/parse.y: Stop function comments leaking through to #defines inside. 2005-02-05 Andrew M. Bishop * src/Makefile.in: The cxref-cpp program must be run with the -lang-c option to get vararg macros correct. * cpp/cccp.c: Applied Debian gcc-2.95.4 patch 'cpp-dos-newlines.dpatch' (originally from egcs). * cpp/README: Added more text describing the changes for cxref. 2005-02-01 Andrew M. Bishop * Makefile.in, doc/Makefile.in, src/Makefile.in: Install the cxref manual page from 'doc' subdir not 'src'. 2005-01-29 Andrew M. Bishop * cpp/cccp.c: Give a fatal error if cxref-cpp.defines has an invalid -I path in it. 2004-11-20 Andrew M. Bishop * src/type.c: Remove small memory leaks. 2004-11-19 Andrew M. Bishop * src/html.c: Don't read from freed memory location. 2004-11-10 Andrew M. Bishop * src/parse.y: Improve the way that structure initializers are parsed. 2004-11-06 Andrew M. Bishop * cpp/README: Need to modify prefix.c to remove compilation warnings. * cpp/prefix.c: New file. * cpp/config.h: Improve function prototypes for cccp.c local functions. * cpp/Makefile.in: Don't ignore compilation warnings. 2004-11-06 Andrew M. Bishop * src/parse.y: Just some whitespace changes. * src/parse.y: Fixed some structure assignments for parsing the kernel version 2.6. 2004-10-17 Andrew M. Bishop * src/parse.y: Allow variables to be declared in for(;;) statements. 2004-10-12 Andrew M. Bishop * cpp/config.h: Add some function prototypes for cccp.c local functions. 2004-09-26 Andrew M. Bishop Version 1.6 of cxref released. 2004-09-26 Andrew M. Bishop * doc/NEWS, src/version.h: Update for version 1.6. * src/cxref.c: Fix reversal of -html-src/-html options. * Makefile.in: Allow 'make distclean ; make docs' to work. 2004-09-07 Andrew M. Bishop * src/Makefile.in: Simplify parse-yacc.h and parse-yacc.c generation from parse.y. 2004-09-04 Andrew M. Bishop * src/parse.y: Fix problem with structure containing pointer to function looking like a function declaration. 2004-08-29 Andrew M. Bishop * src/parse.y: Handle a goto statement or a named label with a type name. 2004-08-15 Andrew M. Bishop * INSTALL: Add instructions for installing with Cygwin. 2004-07-17 Andrew M. Bishop * src/parse.l: Added C99 Boolean type. Ignore any C99 Complex or GNU C Complex. * src/parse.y: Added C99 Boolean type. 2004-07-03 Andrew M. Bishop * INSTALL, doc/FAQ: Update to version 1.6. 2004-06-26 Andrew M. Bishop * src/html.c: Make the HTML output nicely formatted and using styles. * src/latex.c, src/rtf.c, src/sgml.c: Make some changes to match html.c. * src/cxref.css.in: Add some stylesheet definitions. * doc/Makefile.in: Print something before running latex. * src/cxref.c: If the -latex209, -latex2e, -html20 or -html32 options are used give a warning but continue. 2004-06-23 Andrew M. Bishop * doc/Makefile.in: Don't try and create the example output if compiling outside the source tree. * src/Makefile.in: Fix Makefile bug. * doc/README.html: Change the link to the example output. 2004-06-22 Andrew M. Bishop * doc/Makefile.in: All documents: FAQ, READMEs and example code are handled by this Makefile now. The FAQ and READMEs are processed here, cxref examples go to the example subdirectory. * Makefile.in: New file. * doc/README.tex: Style sheets are now in same directory as README. * configure.in: Move cxref source code into src directory, but keep configure at top level. * cpp/Makefile.in: Fix for win32 installation. * query/Makefile.in: Change dependencies now that cxref source is in src directory. * query/query.c, query/output.c, query/input.c: Change #include now that cxref source is in src directory. * src/Makefile.in: Move cxref source code into src directory. 2004-06-21 Andrew M. Bishop * doc/Makefile.in: Delete the cxref.css file when doing 'make clean'. Add the html-style.c file to the list to process. * src/cxref.css.in: New file. * src/latex.c, src/rtf.c, src/sgml.c: Some comment changes to match html.c. * src/Makefile.in, src/html.c: Added a cxref.css file that is written out when creating an HTML file. 2004-06-20 Andrew M. Bishop * query/Makefile.in, cpp/Makefile.in, src/Makefile.in: Fixes to make compilation outside of the source tree work again. * cpp/autoconfig.h.in, src/autoconfig.h.in: Tidy up and add a standard header. 2004-06-19 Andrew M. Bishop * cpp/configure.in: Don't test for ALLOCA. * configure.in: Don't test for USE_STD_ARG or ALLOCA. * src/memory.c: Use __STDC__ instead of USE_STD_ARG. * cpp/autoconfig.h.in, cpp/config.h, cpp/configure.in: Work out the size of a 'long long' variable in configure. * cpp/cccp.c: Make include path work like system include path. * cpp/Makefile.in, cpp/README, cpp/autoconfig.h.in, cpp/cccp.c, cpp/config.h, cpp/configure.in, cpp/cxref-cpp-configure.in, cpp/version.c: Updated with cpp from gcc-2.95.3. 2004-06-18 Andrew M. Bishop * cpp/cccp.c: New file. 2004-06-16 Andrew M. Bishop * doc/FAQ-html.pl: Update to produce HTMl 4.01 output. * doc/README, doc/README.html, doc/README.man, doc/README.sgml, doc/README.tex: Change the -html* and -latex* options in the instructions. Update the version number and dates. * doc/Makefile.in, src/Makefile.in: Change the -html* and -latex* options in the Makefiles. * src/latex.c, src/cxref.c, src/html.c: Remove the options to produce different types of HTML or LaTeX output. All HTML is now HTML 4.01 and all LaTeX is LaTeX 2e. 2004-06-15 Andrew M. Bishop * doc/Makefile.in: Add version.h. * src/html.c: Remove unwanted tag in HTML output for some variables. 2004-06-13 Andrew M. Bishop * src/cxref.c, src/html.c, src/sgml.c: Use version.h to define the program version number. * src/latex.c, src/rtf.c: Use version.h to define the program version number. Change the local functions to be like HTML/SGML in filename handling. * src/Makefile.in: Add version.h. * src/version.h: New file. 2004-06-13 Andrew M. Bishop Version 1.5g of cxref released. 2004-02-14 Andrew M. Bishop Version 1.5f of cxref released. 2003-06-29 Andrew M. Bishop Version 1.5e of cxref released. 2002-05-05 Andrew M. Bishop Version 1.5d of cxref released. Sat Apr 28 15:45:00 2001 Andrew M. Bishop Version 1.5c of cxref released. Sun Sep 26 10:00:00 1999 Andrew M. Bishop Version 1.5b of cxref released. Fri Jun 18 19:15:00 1999 Andrew M. Bishop Version 1.5a of cxref released. Sun Feb 21 12:00:00 1999 Andrew M. Bishop Version 1.5 of cxref released. Sat Dec 6 14:30:00 1998 Andrew M. Bishop Version 1.4c of cxref not released Sat Apr 18 19:30:00 1998 Andrew M. Bishop Version 1.4b of cxref released Thu Nov 20 20:30:00 1997 Andrew M. Bishop Version 1.4a of cxref released Sat Jul 5 18:30:00 1997 Andrew M. Bishop Version 1.4 of cxref released Wed Apr 23 20:00:00 1997 Andrew M. Bishop Version 1.3a of cxref completed. Sun Dec 8 10:30:00 1996 Andrew M. Bishop Version 1.3 of cxref released Sat Nov 16 16:30:00 1996 Andrew M. Bishop Beta Version 1.3 of cxref released Sat Oct 5 12:30:00 1996 Andrew M. Bishop Version 1.2b of cxref released Sat Aug 17 12:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.2a of cxref released Sat Jul 6 20:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.2 of cxref released Wed May 22 19:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.1 of cxref released Sat Feb 24 16:30:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.0 of cxref released cxref-1.6d/ChangeLog.pre-1.6.cpp 644 233 144 23424 10066070476 11460 02004-06-13 Andrew M. Bishop Version 1.5g of cxref released. 2004-05-09 Andrew M. Bishop * Makefile.in: Add the cxref-cpp-configure script and cxref-cpp.defines file. Renamed the manual pages. * README: Changed the location of the parameters to define if not using gcc. * cccp.c: Add the -cxref-cpp-defines option. Replace C++ style comments with C style comments. * configure.in: Move the gcc configuration detection code to cxref-cpp-configure. * cxref-cpp.man: Renamed from README.man and rewritten. * cxref-cpp-configure.man, cxref-cpp-configure.in: New file. 2004-04-11 Andrew M. Bishop * cccp.c: Fix handling of -Afoo=bar options (patch from Camm Maguire). 2004-03-06 Andrew M. Bishop * configure.in: Add a --without-cxref-cpp option to the configure scripts. 2004-02-14 Andrew M. Bishop Version 1.5f of cxref released. 2004-01-18 Andrew M. Bishop * configure.in: Add a check that the installed gcc preserves comments after #include statements. 2003-07-31 Andrew M. Bishop * cccp.c: Allow for gcc 3.x style -Afoo=bar options as well as existing -Afoo(bar) options (in Makefile CPP_PREDEFINES). 2003-06-29 Andrew M. Bishop Version 1.5e of cxref released. 2003-06-29 Andrew M. Bishop * configure.in: Updated to check that gcc passes through comments after a #define. * README: Update with information about newer gcc versions. 2002-05-05 Andrew M. Bishop Version 1.5d of cxref released. 2002-04-21 Andrew M. Bishop * Makefile.in: Bug fix for 'make install'. 2002-04-14 Andrew M. Bishop * Makefile.in: Change the rule for compiling .c to .o for versions of make that don't understand '%.o:%.c'. * Makefile.in: Include a DESTDIR in the Makefiles to allow installing in a different place to the compile options. 2002-02-17 Andrew M. Bishop * Makefile.in: More fixes to allow configure/build outside of cxref source tree. * configure.in: Allow gcc-3.x to be used in place of cxref-cpp. 2002-01-19 Andrew M. Bishop * cccp.c: Allow for gcc 3.x style -Afoo=bar options as well as existing -Afoo(bar) options. 2001-12-16 Andrew M. Bishop * cccp.c: Added in a #include of alloca.h if HAVE_ALLOCA_H is autoconfigured. 2001-12-09 Andrew M. Bishop * configure.in: When the user does not have gcc try and guess what to do. Sat Apr 28 15:45:00 2001 Andrew M. Bishop Version 1.5c of cxref released. Tue Nov 16 19:06:51 1999 Andrew M. Bishop * autoconfig.h.in: Initial revision Sun Sep 26 10:00:00 1999 Andrew M. Bishop Version 1.5b of cxref released. Sun Aug 22 08:16:39 1999 Andrew M. Bishop * Makefile.in: Add CFLAGS and LDFLAGS to the Makefile.in. Fri Jun 18 19:15:00 1999 Andrew M. Bishop Version 1.5a of cxref released. Sat May 8 14:16:37 1999 Andrew M. Bishop * configure.in: Add a --with-cxref-cpp option. Sun Feb 21 12:00:00 1999 Andrew M. Bishop Version 1.5 of cxref released. Sat Jan 16 12:20:10 1999 Andrew M. Bishop * Makefile.in: Add a new install target for Win32. Sat Jan 16 11:11:56 1999 Andrew M. Bishop * configure.in, Makefile.in: Initial revision * version.c: Change the version string to include cxref. * tm.h, config.h: Modify for use with autoconf and configure. * README: Add information about using autoconf and configure. * version.c: Initial revision Sun Dec 27 12:23:27 1998 Andrew M. Bishop * config-cpp: Use gcc instead of cxref-cpp if new enough. Sat Dec 6 14:30:00 1998 Andrew M. Bishop Version 1.4c of cxref not released Wed Apr 22 17:48:19 1998 Andrew M. Bishop * config.h: Fixed previous AIX change. Sat Apr 18 19:30:00 1998 Andrew M. Bishop Version 1.4b of cxref released Sat Apr 18 18:57:52 1998 Andrew M. Bishop * config.h: Made a change for AIX. Wed Jan 7 19:24:36 1998 Andrew M. Bishop * config.h: Fix a bug that stops compilation on Linux with libc version 6. Thu Nov 20 20:30:00 1997 Andrew M. Bishop Version 1.4a of cxref released Thu Nov 20 19:55:34 1997 Andrew M. Bishop * Makefile: Fixed more SUN make problems. Sat Jul 5 18:30:00 1997 Andrew M. Bishop Version 1.4 of cxref released Mon May 26 15:11:14 1997 Andrew M. Bishop * cccp.c: Submitted my changes to a future version gcc that are needed for cxref. This means that I have seen the future of cccp.c and included a couple of fixes. The option of mine is the '-dI' option to output the #includes. Sun Apr 27 17:00:31 1997 Andrew M. Bishop * README.man, cccp.c: Removed all features except those that could be put in the standard GCC. Fri Apr 25 18:36:28 1997 Andrew M. Bishop * README.man, README, config.h, Makefile, cccp.c: Changed over to cpp-2.7.2, patched in all the cpp-2.6.3 hacks. * cccp.c: Initial revision (new version based on gcc-2.7.2). Wed Apr 23 20:00:00 1997 Andrew M. Bishop Version 1.3a of cxref completed. Wed Apr 23 19:47:27 1997 Andrew M. Bishop * config.h: Added extra #defines in the NEED_SVR4_STRINGS case. Tue Mar 25 18:43:06 1997 Andrew M. Bishop * cccp.c: Added a check for FreeBSD for the use of sys_errlist. Mon Jan 6 20:37:26 1997 Andrew M. Bishop * cccp.c: Changed the behaviour on system include files with ../ in the path. Sun Dec 8 10:30:00 1996 Andrew M. Bishop Version 1.3 of cxref released Sun Dec 8 10:07:57 1996 Andrew M. Bishop * README.man: Initial revision Sun Dec 8 09:15:31 1996 Andrew M. Bishop * cccp.c: Fixed a bug in the code to canonicalise the path name of included files. Sat Nov 16 16:30:00 1996 Andrew M. Bishop Beta Version 1.3 of cxref released Sat Nov 16 16:03:01 1996 Andrew M. Bishop * config-cpp: Made the output more verbose and fixed error in bzero determination. Sat Nov 2 14:23:09 1996 Andrew M. Bishop * tm.h, config.h: Initial revision * Makefile, config-cpp, README: Replaced the configured tm.h and config.h with a generic one. * cccp.c: Allow #define replacements for bzero,bcmp,bcopy and index,rindex to work. Tue Oct 29 19:51:40 1996 Andrew M. Bishop * README: New automated makefiles require new instructions in case of failure. * config-cpp: Initial revision * Makefile: Automated makefile, uses two separate configuration files. Sun Oct 27 15:02:23 1996 Andrew M. Bishop * cccp.c: A CXREF_CPP_PREDEFINES when compiling will override CPP_PREDEFINES from header files. Sat Oct 5 12:30:00 1996 Andrew M. Bishop Version 1.2b of cxref released Sun Aug 18 16:13:44 1996 Andrew M. Bishop * cccp.c: Added a second set of file name mangling to stop some multi-directory reference failures. Sat Jul 6 20:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.2 of cxref released Sat Jul 6 19:44:25 1996 Andrew M. Bishop (amb@gedanken) * README: Reformatted, and spell-checked. Sun Jun 30 19:49:15 1996 Andrew M. Bishop (amb@gedanken) * cccp.c: Changed filname handling so that foo/../ and ./ are removed from include file names, and only system files and those starting with / are output as in the original source. Wed May 22 19:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.1 of cxref released Sat May 18 19:31:21 1996 Andrew M. Bishop (amb@gedanken) * README: Added quite a bit more information about configuring the cxref-cpp program and testing it once made. * Makefile: Removed the example INCLUDE_DIR[123] for SUNs. Sat Feb 24 16:30:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.0 of cxref released Sat Feb 24 14:50:32 1996 Andrew M. Bishop (amb@gedanken) * Makefile: Version 1.0 Released (First release version). Sat Jan 20 21:06:25 1996 Andrew M. Bishop (amb@gedanken) * Makefile: Added a default CC and CFLAGS. Wed Nov 15 19:06:50 1995 Andrew Bishop (amb@dan) * README: Added more explanation about the new config file structure. * Makefile: Added includes for Solaris 2 and modified config file structure. Wed Aug 2 19:55:12 1995 Andrew Bishop (amb@dan) * README: More explanations. * Makefile: Changed INCLUDE_DIR* and tidied up some targets. Tue Aug 1 20:26:16 1995 Andrew Bishop (amb@dan) * cccp.c: Improved comments in code. Tue Jul 25 20:38:05 1995 Andrew Bishop (amb@dan) * Makefile: Changed the clean target to use -f. Sun Jul 23 16:23:59 1995 Andrew Bishop (amb@dan) * cccp.c: Passes through trailing comments for #define / #include. Tue Apr 25 19:10:11 1995 Andrew Bishop (amb@dan) * cccp.c: Some hacks for include files, no full path and better guess of system / local. Mon Apr 24 18:23:12 1995 Andrew Bishop (amb@dan) * Makefile, README, cccp.c: Initial revision cxref-1.6d/ChangeLog.pre-1.6.doc 644 233 144 11326 10066070527 11436 02004-06-13 Andrew M. Bishop Version 1.5g of cxref released. 2004-02-14 Andrew M. Bishop Version 1.5f of cxref released. 2002-06-27 Andrew M. Bishop Version 1.5e of cxref released. 2002-05-05 Andrew M. Bishop Version 1.5d of cxref released. 2001-03-18 Andrew M. Bishop * Makefile.in: Allow the cxref programs to be compiled in a directory different from the source. Sat Apr 28 15:45:00 2001 Andrew M. Bishop Version 1.5c of cxref released. Sun Sep 26 10:00:00 1999 Andrew M. Bishop Version 1.5b of cxref released. Fri Jun 18 19:15:00 1999 Andrew M. Bishop Version 1.5a of cxref released. Sun Feb 21 12:00:00 1999 Andrew M. Bishop Version 1.5 of cxref released. Tue Jan 26 19:40:12 1999 Andrew M. Bishop * Makefile.in: Produce an HTML version of the source file with links into it. Sat Jan 16 11:10:57 1999 Andrew M. Bishop * Makefile.in: Initial revision Mon Dec 28 14:25:28 1998 Andrew M. Bishop * Makefile: Include the rtf and sgml files in the make clean target. Tue Dec 22 14:24:57 1998 Andrew M. Bishop * Makefile: Add in RTF and SGML formats. Sat Jul 5 18:30:00 1997 Andrew M. Bishop Version 1.4 of cxref released Sat Jul 5 18:28:53 1997 Andrew M. Bishop * README: Updated to version 1.4. Wed Apr 23 20:00:00 1997 Andrew M. Bishop Version 1.3a of cxref completed. Sun Dec 8 10:30:00 1996 Andrew M. Bishop Version 1.3 of cxref released Sat Nov 16 16:30:00 1996 Andrew M. Bishop Beta Version 1.3 of cxref released Sat Nov 16 16:16:33 1996 Andrew M. Bishop * README: Changed the names of the files in the description. Tue Oct 29 19:52:36 1996 Andrew M. Bishop * Makefile: Automated makefile, uses separate configuration file. Sun Oct 27 15:27:32 1996 Andrew M. Bishop * page.style: Made the distinction between A4 and US paper sizes more obvious. * cxref.style: Added LaTeX commands to stop warning messages about under/overfull hboxes. * renamed *.sty to *.style so that they can be configured automatically. Sat Oct 5 12:30:00 1996 Andrew M. Bishop Version 1.2b of cxref released Thu Oct 3 18:23:27 1996 Andrew M. Bishop * page.sty: Made the text fit on the page with a 1 inch margin properly. Sat Jul 6 20:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.2 of cxref released Sat Jul 6 19:49:10 1996 Andrew M. Bishop (amb@gedanken) * README: Reformatted, and spell-checked. Sat Jun 29 16:42:24 1996 Andrew M. Bishop (amb@gedanken) * Makefile: Don't assume that . is on the path, so use ./cxref not just cxref. Sat Jun 8 15:04:29 1996 Andrew M. Bishop (amb@gedanken) * cxref.sty: Initial revision * page.sty, fonts.sty: Improved the comment at the top of the file. * README: Added quite a lot of new information, and reference to cxref.sty. * Makefile: Needed to change 'clean' target since rm cxref.* would delete cxref.sty. Wed May 22 19:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.1 of cxref released Sat Feb 24 16:30:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.0 of cxref released Sat Feb 24 14:53:08 1996 Andrew M. Bishop (amb@gedanken) * Makefile: Version 1.0 Released (First release version). Tue Oct 17 20:14:16 1995 Andrew Bishop (amb@dan) * page.sty, fonts.sty: Now works with LaTeX2e version. Sat Jul 29 18:31:03 1995 Andrew Bishop (amb@dan) * page.sty: Added comments about a4 and US paper sizes. * README: Renamed a4.sty to page.sty and described both .sty files better. Wed Jul 12 19:01:45 1995 Andrew Bishop (amb@dan) * Makefile: Changed the rule for all etc (from ':' to ''). Sun Jul 2 11:01:48 1995 Andrew Bishop (amb@dan) * Makefile: Added HTML option. Sat Jul 1 15:37:47 1995 Andrew Bishop (amb@dan) * Makefile: Header added and source and final output separated. Wed Jun 28 20:38:36 1995 Andrew Bishop (amb@dan) * README: Added title. * a4.sty: Added a comment at the top to explain it. Wed May 3 20:20:06 1995 Andrew Bishop (amb@dan) * Makefile: New version with appendix. Wed Apr 26 22:00:44 1995 Andrew Bishop (amb@dan) * Makefile, README, a4.sty, fonts.sty: Initial revision cxref-1.6d/ChangeLog.pre-1.6.query 644 233 144 12332 10063006666 12034 02004-06-13 Andrew M. Bishop Version 1.5g of cxref released. 2004-02-14 Andrew M. Bishop Version 1.5f of cxref released. 2002-06-27 Andrew M. Bishop Version 1.5e of cxref released. 2002-05-05 Andrew M. Bishop Version 1.5d of cxref released. 2002-04-21 Andrew M. Bishop * Makefile.in: Bug fix for 'make install'. 2002-04-14 Andrew M. Bishop * Makefile.in: Change the rule for compiling .c to .o for versions of make that don't understand '%.o:%.c'. * Makefile.in: Include a DESTDIR in the Makefiles to allow installing in a different place to the compile options. 2001-03-18 Andrew M. Bishop * Makefile.in: Allow the cxref programs to be compiled in a directory different from the source. Sat Apr 28 15:45:00 2001 Andrew M. Bishop Version 1.5c of cxref released. Sun Sep 26 10:00:00 1999 Andrew M. Bishop Version 1.5b of cxref released. Sun Aug 22 08:16:43 1999 Andrew M. Bishop * Makefile.in: Add CFLAGS and LDFLAGS to the Makefile.in. Fri Jun 25 18:09:44 1999 Andrew M. Bishop * input.c: Fix the problem if NAME_MAX is not defined even if PATH_MAX is. Fri Jun 18 19:15:00 1999 Andrew M. Bishop Version 1.5a of cxref released. Fri May 7 18:38:20 1999 Andrew M. Bishop * input.c: Increase the size of the statically allocated memory for filenames, function names and typenames. Sun Feb 21 12:00:00 1999 Andrew M. Bishop Version 1.5 of cxref released. Sat Jan 16 12:20:11 1999 Andrew M. Bishop * Makefile.in: Add a new install target for Win32. Sat Jan 16 11:11:05 1999 Andrew M. Bishop * Makefile.in: Initial revision Thu Nov 20 20:30:00 1997 Andrew M. Bishop Version 1.4a of cxref released Sat Aug 23 15:18:56 1997 Andrew M. Bishop * input.c: Created some string lists that were lost in the changes. Added in more cross referencing. Sat Jul 5 18:30:00 1997 Andrew M. Bishop Version 1.4 of cxref released Sat Jul 5 18:28:12 1997 Andrew M. Bishop * README.man, README: Updated to version 1.4. Thu Jun 19 16:26:04 1997 Andrew M. Bishop * query.c: Allow the -N and -O options to be used either as -Odirname or -O dirname. Sun May 11 15:23:10 1997 Andrew M. Bishop * output.c, input.c: Major changes to the internals of the program: Changed StringList and StringList2 to be pointers. Added more options to the AddToStringList() functions. Lists of xrefs use StringList2 with separate function and filename. Added in constructors and destructors for the main datatypes. Added in functions to reset the lexer/parser/analysers when finished. Wed Apr 23 20:00:00 1997 Andrew M. Bishop Version 1.3a of cxref completed. Sun Dec 8 10:30:00 1996 Andrew M. Bishop Version 1.3 of cxref released Sun Dec 8 10:07:45 1996 Andrew M. Bishop * README.man: Initial revision Sat Nov 16 16:30:00 1996 Andrew M. Bishop Beta Version 1.3 of cxref released Tue Oct 29 19:52:59 1996 Andrew M. Bishop * Makefile: Automated makefile, uses separate configuration file. Sat Oct 5 12:30:00 1996 Andrew M. Bishop Version 1.2b of cxref released Mon Aug 19 18:45:53 1996 Andrew M. Bishop * input.c: Fixed seg fault on certain database features. Sat Jul 6 20:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.2 of cxref released Sat Jul 6 19:43:35 1996 Andrew M. Bishop (amb@gedanken) * README: Reformatted, spell-checked, and small change to wording. Sat Jul 6 19:17:03 1996 Andrew M. Bishop (amb@gedanken) * input.c: More cross-referencing done. * output.c: Better formatted and more useful output. Mon Jul 1 19:10:10 1996 Andrew M. Bishop (amb@gedanken) * Makefile: Removed redundant targets. Wed May 22 19:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.1 of cxref released Sat Feb 24 16:30:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.0 of cxref released Sat Feb 24 14:53:52 1996 Andrew M. Bishop (amb@gedanken) * README: Initial revision * query.h, query.c, output.c, input.c, Makefile: Version 1.0 Released (First release version). Sun Feb 4 15:45:32 1996 Andrew M. Bishop (amb@gedanken) * query.h: Now has fewer function prototypes. * query.c: Small changes to make a working version. * output.c, input.c: Extensive modifications, to make a working version. * Makefile: Added default values for CC & CFLAGS, added rules to make ../memory.o and ../slist.o. Tue Nov 28 22:09:52 1995 Andrew Bishop (amb@dan) * query.h, Makefile, query.c, input.c, output.c: Initial revision cxref-1.6d/ChangeLog.pre-1.6.src 644 233 144 146014 10066071137 11501 02004-06-13 Andrew M. Bishop Version 1.5g of cxref released. 2004-06-13 Andrew M. Bishop * NEWS: Updated for version 1.5g release. 2004-05-09 Andrew M. Bishop * NEWS, cxref.c: Update to version 1.5g. * Makefile.in: Don't pass the CXREF_CPP #define to cxref.c if not using cxref-cpp. 2004-04-24 Andrew M. Bishop * parse.y: Bug fix for the previous change allowing mixtures of declarations and statements in compound statements. 2004-03-06 Andrew M. Bishop * INSTALL, configure.in: Add a --without-cxref-cpp option to the configure scripts. 2004-02-14 Andrew M. Bishop Version 1.5f of cxref released. 2004-02-14 Andrew M. Bishop * NEWS: Update to version 1.5f. 2004-01-24 Andrew M. Bishop * html.c, latex.c, rtf.c, sgml.c, warn-raw.c: Declaring a function as extern is the same as not declaring it local. 2004-01-18 Andrew M. Bishop * parse.l, preproc.c: Add extra flags so that parsing gcc-3.x output works better. 2004-01-11 Andrew M. Bishop * warn-raw.c: Fix the text printed for some warnings from the -warn option. 2004-01-10 Andrew M. Bishop * var.c: Ensure that variables defined in header file and locally get comments. 2003-12-02 Andrew M. Bishop * func.c: Don't look for argument comment for functions with void arguments. 2003-09-05 Andrew M. Bishop * parse-yy.h: Corrected a comment. * cxref.c: Add a missing quote character in error message. * Makefile.in: Delete y.tab.h if not needed. 2003-07-20 Andrew M. Bishop * parse.y: Allow mixtures of variable declarations and statements in compound statements (suggested by Henrik Poulsen). 2003-06-29 Andrew M. Bishop Version 1.5e of cxref released. 2003-06-29 Andrew M. Bishop * NEWS: Update with latest information. 2003-06-27 Andrew M. Bishop * cxref.c: Update version number. 2003-06-22 Andrew M. Bishop * parse.l: Handle macros with variable args that use MACRO(a,b,...) as well as MACRO(a,b...). * preproc.c, parse.l: Handle gcc-3.x putting all of its internal #defines in the output. 2003-06-15 Andrew M. Bishop * FAQ-html.pl: Don't force emacs to use perl mode and indent the file with emacs cperl mode. 2003-05-05 Andrew M. Bishop * cxref.c: Update to work with newer version of flex. Removed some gcc warnings. * parse-yy.h, parse.l, Makefile.in: Update to work with newer version of flex. 2003-01-17 Andrew M. Bishop * comment.c: Don't copy from bad pointer if new comment equls current one (patch from Simon 'corecode' Schubert). 2002-09-17 Andrew M. Bishop * parse.l: Don't lose the comment or value when C++ style comments follow a #define. 2002-08-17 Andrew M. Bishop * parse.l: Allow parsing of integers defined with i32 or i64 suffix denoting length. 2002-07-19 Andrew M. Bishop * INSTALL: Clarified the installation instructions. 2002-07-14 Andrew M. Bishop * parse-yy.h: Bug fix for Sun version of yacc. 2002-06-30 Andrew M. Bishop * html.c: Add quick links to cross references in appendix. * html.c: Remove some extra ';' in #include cross reference output. 2002-06-23 Andrew M. Bishop * xref.c: Fix overwriting of cross-reference filenames for local functions with the same name in multiple files. 2002-05-05 Andrew M. Bishop Version 1.5d of cxref released. 2002-05-05 Andrew M. Bishop * NEWS: Updated to version 1.5d. * FAQ: Small updates. * cxref.c: Update the help message version number. * parse.y: Use the YYTRANSLATE() macro when printing the debugging output. 2002-04-21 Andrew M. Bishop * Makefile.in: Bug fix for 'make install'. 2002-04-14 Andrew M. Bishop * parse.y: Add a missing ';' that the latest version of Bison detected. * Makefile.in: Change the rule for compiling .c to .o for versions of make that don't understand '%.o:%.c'. 2002-03-31 Andrew M. Bishop * INSTALL, Makefile.in: Include a DESTDIR in the Makefiles to allow installing in a different place to the compile options. 2002-02-17 Andrew M. Bishop * Makefile.in: More fixes to allow configure/build outside of cxref source tree. 2002-02-03 Andrew M. Bishop * Makefile.in: Add flex specific command line options if using flex. * parse.l: Add some missing rules to stop flex warning message with -s option. Re-indent some of the code for neatness. * parse.l: Handle the GCC floating point hex extension. 2002-01-26 Andrew M. Bishop * parse.l: Keep the sign of negative numbers when reporting the value of #define statements. 2002-01-19 Andrew M. Bishop * INSTALL: Reference the --help option to configure. * cxref-cc: Bug fix for IFS handling. 2002-01-13 Andrew M. Bishop * html.c, warn-raw.c: If a function is included from a header file make it clear in the output. 2002-01-07 Andrew M. Bishop * html.c: Fix bug with referencing wrong source HTML file for global variables. 2001-11-04 Andrew M. Bishop * cxref.c: More fixes for the -R/ bug. 2001-10-27 Andrew M. Bishop * Makefile.in: Remove two instances of $< that caused problems with non-GNU make programs. 2001-09-06 Andrew M. Bishop * cxref.c: Fix bug that stopped -R/ from working. 2001-08-23 Andrew M. Bishop * parse.l: Handle the GNU C __builtin_va_arg extension. 2001-08-17 Andrew M. Bishop * sgml.c: Fix bad SGML output (  instead of &nbs;). 2001-08-11 Andrew M. Bishop * parse.l: Handle the gcc-3.0 __builtin_va_list type. 2001-06-30 Andrew M. Bishop * FAQ-html.pl, README.html: Fixup to make the files HTML 3.2 compliant. * html.c: Remove any ^L characters when writing out HTML source files. Fix bad HTML output (  instead of &nbs;). Don't replace " with " (not valid in HTML 3.2). Sat Apr 28 15:45:00 2001 Andrew M. Bishop Version 1.5c of cxref released. Sat Apr 28 15:43:17 2001 Andrew M. Bishop * NEWS: Updated to version 1.5c. * parse.y: Fix problem with not allocating enough memory. Sun Mar 18 10:29:25 2001 Andrew M. Bishop * Makefile.in, configure.in: Allow the cxref programs to be compiled in a directory different from the source. Sat Jan 6 13:05:13 2001 Andrew M. Bishop * preproc.c, rtf.c, sgml.c, warn-raw.c, xref.c, cxref.c, func.c, html.c, latex.c: Remove some gcc compilation warnings. Sat Aug 19 15:44:44 2000 Andrew M. Bishop * cxref.c: Added more useful debugging messages. Sat Jul 8 15:07:40 2000 Andrew M. Bishop * cxref.c: Disallow files from being cross referenced if they are outside the root directory. Mon Mar 13 19:40:31 2000 Andrew M. Bishop * parse.l: Optimise the lex source for run-time speed. Sat Jan 29 14:46:42 2000 Andrew M. Bishop * parse.y: Allow bracketed function declarations. * parse.l: Fix typo with COMMENT / WARN_COMMENT #define. Tue Nov 16 19:19:50 1999 Andrew M. Bishop * parse.l: Modify SeenComment() function. Add the __restrict keyword (ignore it). Include string.h. * autoconfig.h.in: Initial revision * comment.c, cxref.h: Modify SeenComment() function. * cxref.c: Updated the version number. Sun Sep 26 10:00:00 1999 Andrew M. Bishop Version 1.5b of cxref released. Sun Sep 26 08:55:24 1999 Andrew M. Bishop * NEWS: Update to version 1.5b. Sun Aug 22 08:16:24 1999 Andrew M. Bishop * Makefile.in: Add CFLAGS and LDFLAGS to the Makefile.in. Wed Jul 21 18:26:21 1999 Andrew M. Bishop * cxref.c, preproc.c: Increase the length of the buffer to the getcwd() function call. Sun Jul 11 10:09:53 1999 Andrew M. Bishop * parse.l: Ensure that the lexer is reset to the initial state. * cxref.c: Don't call yyrestart() before the first file. Fri Jul 2 18:26:13 1999 Andrew M. Bishop * preproc.c: Use what the programmer said for deciding if an include file is global or local. Fri Jun 25 18:12:41 1999 Andrew M. Bishop * html.c: Fix a stupid bug with dereferencing a NULL pointer. * xref.c: Fix the problem if NAME_MAX is not defined even if PATH_MAX is. Sun Jun 20 09:55:27 1999 Andrew M. Bishop * xref.c, cxref.c, cxref.h: Speed up the cross referencing. Sat Jun 19 16:52:02 1999 Andrew M. Bishop * html.c: Fix the bug with the +html+ style comments in the source HTML output. Fri Jun 18 19:15:00 1999 Andrew M. Bishop Version 1.5a of cxref released. Fri Jun 18 18:12:18 1999 Andrew M. Bishop * NEWS: Updated to version 1.5a. Thu Jun 17 18:00:39 1999 Andrew M. Bishop * parse.y: Allow the GNU extension to case statements. * parse.l: Fix problems with C++ style comments after #defines. Wed Jun 16 18:51:45 1999 Andrew M. Bishop * parse-yy.h: Turn on the debugging by default. * cxref.c: Fix the CanonicaliseName() function (again). Tue Jun 8 18:41:51 1999 Andrew M. Bishop * cxref.c: Bug fix in the CanonicaliseName function. Fri Jun 4 16:19:06 1999 Andrew M. Bishop * html.c: Make sure that the source file has the correct relative path from the cxref file. Thu May 27 16:44:39 1999 Andrew M. Bishop * README.tex: Changed to LaTeX2e documentclass instead of documentstyle. Wed May 26 18:34:31 1999 Andrew M. Bishop * cxref.c: Fix the CanonicaliseName() function. Thu May 20 19:00:00 1999 Andrew M. Bishop * parse.y, parse.l: Handle more GNU extensions. Sat May 15 19:00:11 1999 Andrew M. Bishop * parse.l, preproc.c, cxref.h: Remove the problem of #line directives confusing the parser. Sat May 15 16:58:57 1999 Andrew M. Bishop * latex.c, rtf.c, sgml.c, cxref.c, html.c: Add the cxref and cpp command lines to the output files (not RTF). Wed May 12 18:54:34 1999 Andrew M. Bishop * INSTALL: Add the --with-cxref-cpp option. Sat May 8 14:16:31 1999 Andrew M. Bishop * configure.in: Add a --with-cxref-cpp option. Fri May 7 18:38:35 1999 Andrew M. Bishop * xref.c: Increase the size of the statically allocated memory for filenames, function names and typenames. Thu Apr 15 18:08:44 1999 Andrew M. Bishop * Makefile.in: Remove the generated lex and yacc parsers in the clean target. Tue Apr 13 19:08:01 1999 Andrew M. Bishop * Makefile.in: Removed some potentially problematic options to Lex/Yacc commands. Fri Mar 26 19:51:08 1999 Andrew M. Bishop * FAQ: Added the -isystem gcc option hint. Fri Mar 19 17:37:52 1999 Andrew M. Bishop * xref.c, parse.l, rtf.c, sgml.c, warn-raw.c, html.c, latex.c: Allow the '$' charcter to be used in function and variable names. Sun Mar 14 09:41:22 1999 Andrew M. Bishop * latex.c: Fix a bug with verbatim comments. Fri Mar 5 20:01:55 1999 Andrew M. Bishop * rtf.c, sgml.c, html.c, latex.c: Fix a bug with the include/exclude directives at the start of comments. Sun Feb 21 12:00:00 1999 Andrew M. Bishop Version 1.5 of cxref released. Sun Feb 21 11:47:58 1999 Andrew M. Bishop * NEWS: Updated to version 1.5. Sat Feb 6 14:53:05 1999 Andrew M. Bishop * FAQ: Added a reference to the fixheader Perl script. Thu Jan 28 19:23:01 1999 Andrew M. Bishop * Makefile.in: Use the -html-src option for the README. Thu Jan 28 19:19:36 1999 Andrew M. Bishop * html.c: Use a table for the struct/union output in HTML 3.2. Wed Jan 27 19:19:31 1999 Andrew M. Bishop * parse.y: Fix a problem with common comments and type casting. Tue Jan 26 19:40:13 1999 Andrew M. Bishop * html.c, cxref.c, README.tex, README.man, README.sgml, README.html, Makefile.in, README: Produce an HTML version of the source file with links into it. Sun Jan 24 16:53:50 1999 Andrew M. Bishop * warn-raw.c, func.c, preproc.c, type.c, var.c, Makefile.in, cxref.h, datatype.h: Store the line numbers of the definitions as we see them. * cxref.c: Don't allow -delete or a filename in the .cxref file. * README.tex, README.sgml, README.html, README.man, README: Some simple documentation changes. Mon Jan 18 17:49:48 1999 Andrew M. Bishop * preproc.c, var.c, parse.y: Stop comments from header files from leaking into the main source file. Sun Jan 17 09:40:47 1999 Andrew M. Bishop * INSTALL: Add information about the --enable-us-paper option. Sat Jan 16 12:20:04 1999 Andrew M. Bishop * Makefile.in: Fix problem with using gcc instead of cxref-cpp. Add a new install target for Win32. Sat Jan 16 11:11:42 1999 Andrew M. Bishop * configure.in, Makefile.in: Initial revision * memory.c: Modify for use with autoconf and configure. * INSTALL: Add information about using autoconf and configure. Mon Jan 11 19:34:07 1999 Andrew M. Bishop * rtf.c: Fix the verbatim comments. Mon Dec 28 14:26:26 1998 Andrew M. Bishop * rtf.c: Make the RTF output work as required. Sun Dec 27 12:41:15 1998 Andrew M. Bishop * FAQ: Use gcc instead of cxref-cpp if new enough. Tue Dec 22 17:10:10 1998 Andrew M. Bishop * FAQ: Put in information about using cxref with cygwin on win32. * memory.c: Allow the file to compile with the win32 cygwin library. Tue Dec 22 15:23:38 1998 Andrew M. Bishop * README.sgml: Initial revision * README.man, README.tex, README.html, README: Updated the documentation to include the new output formats. * rtf.c, sgml.c: Initial revision * comment.c: Handle verbatim comments better. * warn-raw.c: Abstract out the output specific comment handling. * latex.c: Some tidying up to make more like the HTML with tables. * html.c: Add in new HTML-3.2 option. * cxref.h: Add in RTF and SGML formats. * cxref.c: Add in RTF and SGML and allow two types of HTML. * Makefile.config, Makefile: Add in RTF and SGML formats. * INSTALL: Note the changes to the Makefile. Sat Dec 12 17:08:58 1998 Andrew M. Bishop * FAQ-html.pl: Fix a problem with '&' in the FAQ.html output. Sat Dec 6 14:30:00 1998 Andrew M. Bishop Version 1.4c of cxref not released Sun Dec 6 14:28:54 1998 Andrew M. Bishop * NEWS: Updated to version 1.4c. Tue Nov 24 18:54:43 1998 Andrew M. Bishop * FAQ: A new FAQ question/answer. Tue Nov 17 20:05:12 1998 Andrew M. Bishop * cxref.c: Fix the CanonicaliseName() function. Fri Oct 23 18:50:59 1998 Andrew M. Bishop * html.c: Have a different, more specialised, format for the HTML. [WineDoc side branch] * func.c, file.c: Output some parser information. [WineDoc side branch] * cxref.c: Use block comments by default. [WineDoc side branch] * comment.c: Allow both types of comments for functions. [WineDoc side branch] Fri Oct 23 18:21:44 1998 Andrew M. Bishop * comment.c: Strip leading and trailing whitespace from function argument comments. * parse.l: Added in the char_varying() data type. Fri Oct 9 18:43:16 1998 Andrew M. Bishop * parse.y: Allow a typename to be used as the name for a structure in a field_list. * parse.l: Add in the gnu typeof() and __FUNCTION__ extensions. * cxref-cc: More useful error messages. Tue Jun 23 18:11:10 1998 Andrew M. Bishop * memory.c: Added Solaris x86 to the USE_STD_ARG list. Tue Jun 16 18:31:40 1998 Andrew M. Bishop * FAQ-html.pl: Do not make quoted URLs into real links. Sun May 31 07:57:09 1998 Andrew M. Bishop * cxref.c: Fix a bug with cwd=rootdir. Sat May 16 10:56:51 1998 Andrew M. Bishop * parse.y: Allow orphaned ';' in structure definitions. Wed Apr 22 17:47:42 1998 Andrew M. Bishop * Makefile: Make more AIX friendly. Sat Apr 18 19:30:00 1998 Andrew M. Bishop Version 1.4b of cxref released Sat Apr 18 19:29:31 1998 Andrew M. Bishop * README, README.tex, README.man, README.html, NEWS: Updated to version 1.4b. * parse.y: Fixed properly the problem with comments for pointer to function variables. Sat Apr 18 18:46:06 1998 Andrew M. Bishop * latex.c, html.c: Small fix to comment handling. Sat Apr 18 13:29:04 1998 Andrew M. Bishop * comment.c: Use a lot less memory by not using the private memory heap. Fixed SplitComment() that was giving wrong results for some comments. Allow the comment to be deleted to tidy up at the end. * parse.y: Change to the way that common comments are stored due to comment.c changes. * parse.l: Small change to comment.c function interface. * cxref.h: Add a function to free the memory used in comment.c. * cxref.c: Ensure that there are no mallocs not freed on exit. Fix the bug in the -I option mangling based on -R and cwd. Tue Apr 14 18:55:55 1998 Andrew M. Bishop * Makefile: Don't create directories to install into if they already exist. * cxref.c: Be more careful over the exit status of the child process. * parse.l: Added __typeof and __alignof. * install.sh: Fixed a problem with installing cxref-query and making directories. Sat Apr 4 09:27:27 1998 Andrew M. Bishop * FAQ: Fix some typos and make easier for FAQ-html.pl to work with. * FAQ-html.pl: Add links for internal references and external URLs. Thu Mar 26 22:05:20 1998 Andrew M. Bishop * cxref.c: Modify the -I options if they refer to sub-directories of the current dir or -R option dir. Mon Mar 16 19:44:56 1998 Andrew M. Bishop * parse.y, warn-raw.c, html.c, latex.c: Allow empty structures or unions to be defined. Mon Mar 16 19:16:20 1998 Andrew M. Bishop * cxref-cc: Made all the output come out on stderr, handle '-' as filename with a warning. Sun Mar 1 16:11:58 1998 Andrew M. Bishop * parse.y: Added a fix for function prototypes declared using a typedef. Thu Feb 26 19:55:54 1998 Andrew M. Bishop * parse.y: Make sure that comments for pointer to function typedefs and variables are included. * preproc.c: Make sure that the pathname gets updated if we find out later what it really is. * comment.c: Ensure that the file comment comes from the file in question and not an included file. * cxref.c: Allow the argument '-R.' to be ignored and not acted on incorrectly. Wed Feb 11 19:44:08 1998 Andrew M. Bishop * cxref.c: Change int to pid_t. Tue Jan 20 18:51:24 1998 Andrew M. Bishop * parse.l: Save some memory when parsing comments. Thu Nov 20 20:30:00 1997 Andrew M. Bishop Version 1.4a of cxref released Thu Nov 20 20:16:22 1997 Andrew M. Bishop * NEWS: Updated to version 1.4a. * comment.c: Made lines containing only whitespace be replaced by a newline. * parse.l, README.tex, cxref.c, README.html, README.man, README: Added in a -no-comments option. * Makefile: Fixed more SUN make problems. * latex.c, parse.y, warn-raw.c, html.c: Stop wwwoffle crashing on (pointless) unamed structs within structure defintions. Tue Aug 26 16:42:32 1997 Andrew M. Bishop * cxref.c: Fix incorrect parsing of .cxref file when there is a legally recognised space. Mon Aug 25 09:24:14 1997 Andrew M. Bishop * Makefile.config, install.sh, memory.c: Changes to work with Ultrix (install -c and USE_STD_ARG). Sun Aug 24 15:29:16 1997 Andrew M. Bishop * comment.c: Do not try to access a NULL pointer for comments that are empty. Sat Aug 23 15:21:09 1997 Andrew M. Bishop * cxref.c: Improved the CanonicaliseName() function. Wed Aug 6 17:45:33 1997 Andrew M. Bishop * cxref.c: Allow blank lines and comments in the .cxref file. Fixed string handling / memory bug. * comment.c: Fixed string handling / memory bug. * README.man, README.tex, README, README.html: Allow blank lines and comments in the .cxref file. Wed Jul 30 16:50:06 1997 Andrew M. Bishop * parse.l: Better handling of multi-line preprocessor directives. Mon Jul 28 18:17:24 1997 Andrew M. Bishop * Makefile: Made the Makefile work with SUN make. Fri Jul 25 19:10:34 1997 Andrew M. Bishop * preproc.c: Clean up properly in ResetPreProcAnalyser(). * parse.y: Handle 'volatile const' and 'const volatile' and clean up properly in RestParser(). * latex.c, html.c, warn-raw.c: Cope with functions that are declared as external. Fri Jul 18 19:21:56 1997 Andrew M. Bishop * cxref.c: Fixed bug in -CPP option. Sat Jul 5 18:30:00 1997 Andrew M. Bishop Version 1.4 of cxref released Sat Jul 5 18:22:27 1997 Andrew M. Bishop * NEWS: Updated for version 1.4. Sun Jun 22 10:09:28 1997 Andrew M. Bishop * Makefile: Fixed a bug in the allclean target. * parse.y: Bug fix for a GNU C extension. * cxref.c: Bug fix for reading the .cxref file. Sun Jun 22 10:07:12 1997 Andrew M. Bishop * README.tex, README, README.html, README.man, FAQ: Added in a description of the cxref-cc script. * cxref-cc: Initial revision Thu Jun 19 17:40:22 1997 Andrew M. Bishop * cxref.c: Added a new option -Rdirname to specify the source code tree root directory. Added in the reading of options from a .cxref file. * preproc.c, cxref.h: Moved the CanonicaliseName() function from preproc.c to cxref.c and made it global. * README.html, README.man, README.tex, FAQ, README: Added documentation about the -R option and the .cxref file. Wed Jun 18 18:54:33 1997 Andrew M. Bishop * Makefile: Changed the installed cxref to not have a path hard-coded to cxref-cpp (using execvp). Sat Jun 14 16:35:42 1997 Andrew M. Bishop * var.c, warn-raw.c, parse.y, latex.c, parse.l, html.c, datatype.h, func.c: Handle the functions and variables that are included into a file from a header file as if they were actually in the file. But only if the result of compilation of the file is to put them into the object file, so not inline functions or extern variables. Fri Jun 13 18:32:17 1997 Andrew M. Bishop * FAQ: Added in a section 0 pointing to the cxref home-page. Mon May 26 15:30:51 1997 Andrew M. Bishop * preproc.c, cxref.h, parse.l: Cope with comments trailing #include statements now that cxref-cpp has been fixed. Mon May 26 11:23:42 1997 Andrew M. Bishop * html.c, latex.c, README.man, README.tex, README.c, README.html, README: Added in a way to allow extended markup (HTML or LaTeX) inside of comments. Sun May 25 16:59:16 1997 Andrew M. Bishop * README.html, html.c, FAQ-html.pl: Used 'weblint' and 'htmlchek' to check the conformance of the HTML output and fixed most deviations. Sun May 25 10:03:36 1997 Andrew M. Bishop * parse.y: Fixed the reported parse bugs - initialised declarator using GNU extension, - type name / identifier confusion. Sun May 18 15:41:42 1997 Andrew M. Bishop * parse.y: Re-ordered the statements into a logical rather than alphabetical order. Sun May 18 10:05:52 1997 Andrew M. Bishop * latex.c, xref.c, html.c, README.tex, cxref.c, cxref.h, README.html, README.man, README: Added an option to allow files to be deleted from the cross reference output. Sat May 17 15:06:01 1997 Andrew M. Bishop * parse.l, preproc.c, cxref.h: Made fuller use of the CPP changes for included files. * cxref.c: Made fuller use of the CPP changes for included files. Moved CurFile to cxref.c from file.c. * file.c: Moved CurFile to cxref.c from file.c. Fri May 16 19:06:19 1997 Andrew M. Bishop * cxref.c, FAQ, README, README.tex, README.html, README.man: Added in a way of passing extra arguments to the pre-processor. Sun May 11 15:24:04 1997 Andrew M. Bishop * comment.c: Do not Malloc the string returned from SplitComment. * xref.c, warn-raw.c, var.c, slist.c, type.c, preproc.c, parse.y, parse.l, html.c, latex.c, func.c, datatype.h, file.c, cxref.c, cxref.h: Major changes to the internals of the program: Changed StringList and StringList2 to be pointers. Added more options to the AddToStringList() functions. Lists of xrefs use StringList2 with separate function and filename. Added in constructors and destructors for the main datatypes. Added in functions to reset the lexer/parser/analysers when finished. * memory.c: Improved the debugging information. * Makefile: Handle missing sub-directories gracefully. Sun Apr 27 17:09:25 1997 Andrew M. Bishop * comment.c: Tidy up the comment string once it is collected, not in the lexer. * preproc.c, cxref.h: Changed the way that the lexer interfaces to cpp for the include files. * parse.l: Added new comment options; -verbatim-comments and -block-comments. Changed the way that the lexer interfaces to cpp for the include files. * html.c, latex.c, cxref.c: Added new comment options; -verbatim-comments and -block-comments. * README.man: Describe the new comment options. * README, README.html, README.tex: Changed the description of the modifications to cpp and describe the new comment options. * Makefile: Make use of the new cpp option for #includes. Fri Apr 25 18:39:19 1997 Andrew M. Bishop * README.html, README.tex, README: Changed over to cpp-2.7.2. Wed Apr 23 20:00:00 1997 Andrew M. Bishop Version 1.3a of cxref completed. Wed Apr 23 19:46:48 1997 Andrew M. Bishop * parse.y: Added a fix for type cast inside of an array declaration. Thu Mar 6 18:40:22 1997 Andrew M. Bishop * cxref.c: Added the sys/wait.h include file. * Makefile: Fixed a bug in the allclean target added when removing 'make -C'. Fri Feb 7 19:20:37 1997 Andrew M. Bishop * func.c, cxref.c: Fixed minor memory handling problems. * parse.y: Fixed a problem with function prototypes having pointer to pointer to function arguments. Fri Jan 24 20:33:33 1997 Andrew M. Bishop * Makefile: Removed all of the GNU Make features. Thu Jan 9 17:48:23 1997 Andrew M. Bishop * memory.c: Stdarg is needed for other UNIXes. Sat Jan 4 15:54:31 1997 Andrew M. Bishop * install.sh: Made the exit status work correctly now. Sun Dec 15 18:09:43 1996 Andrew M. Bishop * install.sh: Initial revision * Makefile, Makefile.config: Added an installation configuration option. Fri Dec 13 20:03:19 1996 Andrew M. Bishop * Makefile: The program was installed to a INSTDIR/bin/cxref-cpp but cxref-inst looked at INSTDIR/cxref-cpp. Sun Dec 8 10:30:00 1996 Andrew M. Bishop Version 1.3 of cxref released Sun Dec 8 10:11:12 1996 Andrew M. Bishop * NEWS: Added news of version 1.3 changes. Sun Dec 8 10:07:45 1996 Andrew M. Bishop * Makefile.config: Changed the INSTDIR to install the manual pages. * Makefile: Added the manual pages. * README.man: Initial revision Sat Dec 7 20:36:38 1996 Andrew M. Bishop * parse.l: Added C++ style comments More GNU extensions __extension__ keyword is ignored, and expression is parsed __typeof__ keyword returns a type name of __typeof__ Varargs macros allowed * parse.y: Made the parser work on the source conde in the Linux kernel: Added lots more GNU extensions Fixed more problems with type names and identifiers clashing Changed the way that integer types are handled to allow for any number of types Concatenate the value of expressions so that constant expressions e.g. for array sizes are expressed. Sat Dec 7 14:08:39 1996 Andrew M. Bishop * Makefile.config: Stop flex from including #line directives taht confuse cxref. Tue Nov 26 17:50:52 1996 Andrew M. Bishop * cxref.c: Wrote a new popen/pclose that uses execlp instead of system, requires arguments to be kept as a list. Sat Nov 16 16:30:00 1996 Andrew M. Bishop Beta Version 1.3 of cxref released Sat Nov 16 16:19:15 1996 Andrew M. Bishop * NEWS: Added news of version 1.3 (beta) changes. Sat Nov 16 15:29:51 1996 Andrew M. Bishop * cxref.el: Added compatability for newer Emacs cc-mode. Sat Nov 2 17:38:00 1996 Andrew M. Bishop * parse.y: Fixed problems with implicit integer types and type qualifiers. Sat Nov 2 17:21:02 1996 Andrew M. Bishop * warn-raw.c: Really moved type comment to match html.c/latex.c (earlier attempt was wrong). Sat Nov 2 14:44:01 1996 Andrew M. Bishop * README.tex, README.html, README: Removed references to using cxref without cxref-cpp, and improved cxref-cpp section. * README.c: Improved README.c, added cross-referenceable items, removed references to cxref-cpp. * Makefile: Use -xref option on README.c and fix parse-yacc.h target. Wed Oct 30 20:34:03 1996 Andrew M. Bishop * Makefile: Provide the yacc and lex output .[ch] files for people without bison/flex. Tue Oct 29 19:53:55 1996 Andrew M. Bishop * parse.y: Slight change to error message for when parser fails. * cxref.c: Slight change to error message for when cpp dies. * Makefile.config: Initial revision * Makefile: Automated makefile, uses separate configuration file. * INSTALL: New automated makefiles require new instructions. Sun Oct 27 15:50:42 1996 Andrew M. Bishop * cxref.c: Tidied up the usage information, made it 80 chars wide, included author's name, e-mail address, web page, version number. * warn-raw.c: Added ';' in struct listings, moved type comment to match html.c/latex.c. * latex.c: Added ';' in struct listings. * html.c: Added ';' in struct listings, changed order of tags to satisfy weblint, replaced with
    added HTML-2.0 DTD at the top. Sun Oct 20 16:50:10 1996 Andrew M. Bishop * README.tex, README.html, README: Added a 'Further Information' section and general updating. * FAQ-html.pl: Initial revision * FAQ: More information in section 4 and general updating. Sat Oct 5 12:30:00 1996 Andrew M. Bishop Version 1.2b of cxref released Sat Oct 5 12:15:21 1996 Andrew M. Bishop * NEWS: Added news of version 1.2b changes. Sun Sep 29 14:53:59 1996 Andrew M. Bishop * cxref.h, var.c: Tidy up the scope variables after each file. * cxref.c: Added warning about -warn-xref option without and -xref option. Tidy up the scope variables after each file. * warn-raw.c: Check for both -warn-xref and -xref options before printing a warning. * html.c: Stopped the appendix from appearing in the wrong place. Sun Sep 15 16:05:37 1996 Andrew M. Bishop * warn-raw.c, latex.c, html.c: Changed the output format to put comments for a nested struct/union after the variable name. * type.c: Typedefs of function types recognised as such so they can be used in prototypes. Comments in nested structure/union type defintions now get picked up correctly. * cxref.h: Typedefs of function types recognised as such so they can be used in prototypes. * parse.y: Typedefs of function types recognised as such so they can be used in prototypes. Function defintions from header files handled safely. * xref.c: Bug that caused dangling (illegal) cross references fixed. * file.c, func.c, datatype.h: Function prototypes within function definitions now cause no loss of references. Sun Aug 18 16:52:16 1996 Andrew M. Bishop * cxref.c: Recognise an abnormal termination of cxref-cpp (or whatever) and stop processing the file. Sat Aug 17 12:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.2a of cxref released Sat Aug 17 11:56:46 1996 Andrew M. Bishop (amb@gedanken) * NEWS: Added news of version 1.2a changes. * func.c: Better handling of K&R function definitions. * parse.l: Added more GCC extensions. Change the way identifiers and type names are distinguished. * parse.y: Now have feedback to lexical analyser. Use an array to store current variable name to handle nested definitions. Added the rest of the integer types. Removed the reduce/reduce conflict. Sat Jul 6 20:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.2 of cxref released Sat Jul 6 19:56:15 1996 Andrew M. Bishop (amb@gedanken) * NEWS: New news added, reformatted, and spell-checked. * FAQ: Initial revision * README, README.html, README.tex: Reformatted, and spell-checked. Sat Jul 6 19:05:47 1996 Andrew M. Bishop (amb@gedanken) * html.c: Added heading for source files section. Sat Jul 6 17:01:16 1996 Andrew M. Bishop (amb@gedanken) * parse.y: Lots of changes, in particular: Handle parse errors safely, do not exit but go on to the next file. Complete rewrite of function declaration code, fixed scope and K&R problems. Copes with variable types better than it used to. Extern variables allowed within functions (EXTERN_F type). Renamed some of the local variables, and changed their behaviour to accomplish the above. There remain 3 reduce/reduce conflicts that do not (seem to) affect the program output. * INSTALL: Removed the reference to the %expect in parse.y. Thu Jul 4 20:02:27 1996 Andrew M. Bishop (amb@gedanken) * func.c: Bug with ellipses in function definition. Tue Jul 2 20:52:59 1996 Andrew M. Bishop (amb@gedanken) * latex.c, warn-raw.c, html.c: Change the output to handle the EXTERN_F scope type. * cxref.c: Fixed bug in -CPP option handling. Sat Jun 29 16:43:38 1996 Andrew M. Bishop (amb@gedanken) * Makefile: Don't assume that . is on the path, so use ./cxref not just cxref and use $(MAKE) for subdirectories. Sat Jun 29 16:28:52 1996 Andrew M. Bishop (amb@gedanken) * xref.c, cxref.h: Defined the scope type EXTERN_F for variables declared extern within a function. The outputs need to be modified to reflect this, as does the parser and cross-referencer. Thu Jun 27 20:10:03 1996 Andrew M. Bishop (amb@gedanken) * comment.c: Fixed bugs in the SplitComment() function. Sun Jun 16 18:59:47 1996 Andrew M. Bishop (amb@gedanken) * parse.l: Better handling of whitespace in comments and make better use of current parse file variable. Sun Jun 16 16:44:28 1996 Andrew M. Bishop (amb@gedanken) * var.c: Remove the fixed limit on the number of levels of scope variables. * type.c: Fixed bug where 1st and not matching '}' was searched for in typedef definition. * func.c: Use file name from parser, not locally generated for prototypes. Better handling of traditional function declarations. Changed the way that function internal comments are handled. * cxref.h: Changed some function prototypes in func.c. * comment.c: Changed the way that function internal comments are handled. Tue Jun 11 18:12:41 1996 Andrew M. Bishop (amb@gedanken) * parse-yy.h, parse.l: Add support for line numbers and file names in the parser. * parse.y: Gracefully handle yacc parse errors, print line numbers and file names, don't exit. Parse labeled statements with a ';' in a non-ANSI but common way. Sun Jun 9 18:22:33 1996 Andrew M. Bishop (amb@gedanken) * warn-raw.c: Minor improvement to the output for raw mode. * cxref.c: Gracefully handle yacc parse errors, move on to the next file. Sat Jun 8 16:54:32 1996 Andrew M. Bishop (amb@gedanken) * latex.c: Added cxref.sty, Combined the AddLatexAppendix() function into the WriteLatexDocument() function, Merged the WriteLatexPreamble() and WriteLatexPostamble() functions into WriteLatexTemplate(), Removed the code in latex() that tried to convert '-' into an en-dash, Create directories that are needed for the output files to write into. * html.c: Combined the AddHTMLAppendix() function into the WriteHTMLDocument() function, Create directories that are needed for the output files to write into. * func.c: Fixed bug where option_xref==0 still listed out the functions called (syntax error). * README, README.tex, README.html: Updated the README as a result of adding cxref.sty, also minor tweaks. * Makefile: Added doc/cxref.sty to the files included in latex-style.c. * INSTALL: Added a description of the change that needs to be made in doc/page.sty for US paper. Wed May 22 19:00:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.1 of cxref released Wed May 22 17:55:53 1996 Andrew M. Bishop (amb@gedanken) * parse.y: A large number of changes to get the program to provide better debugging output and parse new GNU C language extensions. Better debugging options for the parser, by adding extra levels of debugging, and a wrapper function that intercepts yylex() calls. Allows the asm() GNU extension. Bit-fields now parsed correctly. Enum typedefs allowed to have a trailing comma. Function definitions with no return type are now recognised as int and those with no arguments recognised as void. * parse.l: A large number of changes to get the program to work on other systems and parse new GNU C language extensions. Code fixed to work with a POSIX lex program (no YY_START or <*>). Code handles carriage returns in strange places. GNU __attribute__ & __extension__ compiler directives handled better. Allows the asm() GNU extension. Re-ordered the code, and added comments for each section. * NEWS: Initial revision Mon May 20 18:54:01 1996 Andrew M. Bishop (amb@gedanken) * preproc.c: Fixed bug in SeenInclude where a #include "..." inside a #include <...> didn't work. * parse-yy.h: Added better YACC debugging support. * Makefile: Made latex-style.c be ANSI compatible. * cxref.c: Fixed stupid bug, added better YACC debugging support. Sat May 18 19:40:50 1996 Andrew M. Bishop (amb@gedanken) * README: Changed the title to version 1.1. * INSTALL: Added a few more references to the cpp/README. Sun Feb 25 09:50:47 1996 Andrew M. Bishop (amb@gedanken) * INSTALL: Initial revision Sat Feb 24 16:30:00 1996 Andrew M. Bishop (amb@gedanken) Version 1.0 of cxref released Sat Feb 24 14:54:19 1996 Andrew M. Bishop (amb@gedanken) * INSTALL: Initial revision * xref.c, warn-raw.c, var.c, type.c, slist.c, preproc.c, parse.y, parse.l, parse-yy.h, memory.h, memory.c, latex.c, html.c, func.c, file.c, datatype.h, cxref.h, cxref.el, cxref.c, comment.c, README.tex, README.html, README, Makefile: Version 1.0 Released (First release version). Sun Feb 4 15:41:31 1996 Andrew M. Bishop (amb@gedanken) * xref.c: Re-ordered the cross referencing. * memory.h: Added a SafeCalloc() function. * memory.c: Added a SafeCalloc() function and slight mod to DEBUG macros. * cxref.h: Error in XREF_* macro definitions. * Makefile: Added default values for CC & CFLAGS, added cxref-query. Tue Nov 28 19:31:20 1995 Andrew Bishop (amb@dan) * warn-raw.c: Fixed bug where variable or function is global and is referenced in the file and invalid warning was printed. Fri Nov 24 20:51:40 1995 Andrew Bishop (amb@dan) * parse.l: Made push past work for 'int foo[2]={1,2}; /* */' where the yacc grammar did not ask for ';'. Fri Nov 24 19:21:36 1995 Andrew Bishop (amb@dan) * xref.c: Fixed bug where functions referenced from a file do not get cross-referenced. Tidied up the function cross referencing, rationalising the functions needed. Fixed the extern variable fixup where unknown definitions were ignored. Changed the variable xref file for variables referenced from files. Changed the type definition xref file for not typedef types. Mon Nov 20 19:09:06 1995 Andrew Bishop (amb@dan) * Makefile: Added 'program' as the default target and put 'program' and 'docs' as dependencies of 'all'. Sun Nov 19 15:33:28 1995 Andrew Bishop (amb@dan) * warn-raw.c: Fixed bugs with referencing null pointer if some comments are missing. Wed Nov 15 19:15:01 1995 Andrew Bishop (amb@dan) * parse.y: Added long long types, removed spaces from ends of lines. * latex.c: Added hard-space to the tables to stop latex2e breaking. * cxref.h: Made work on Solaris 2.3 * Makefile: Stopped using echo -n for latex-style.c (fails on SVR4). Tue Oct 17 20:18:25 1995 Andrew Bishop (amb@dan) * latex.c, cxref.c, README.tex, README.html, README: Added support for LaTeX2e version. Mon Oct 9 19:19:33 1995 Andrew Bishop (amb@dan) * latex.c: Fixed some problems with the latex() function that converts illegal symbols to a legel format. Thu Aug 24 20:41:11 1995 Andrew Bishop (amb@dan) * parse.y, type.c: Fixed bug where 'See Also' for typedefs failed. Tue Aug 22 20:03:42 1995 Andrew Bishop (amb@dan) * cxref.c: Fixed bug with -xref options. Sat Aug 12 16:27:07 1995 Andrew Bishop (amb@dan) * cxref.el: Split up the "$Header$" string in the cxref-file-comment. Thu Aug 10 20:09:43 1995 Andrew Bishop (amb@dan) * cxref.el: Changed the cxref-endline-comment to use c-mode functions. Sat Aug 5 16:03:11 1995 Andrew Bishop (amb@dan) * html.c, latex.c: Bug with cross reference of extern variables. Sat Aug 5 15:44:49 1995 Andrew Bishop (amb@dan) * xref.c, warn-raw.c, func.c, cxref.h, cxref.c: Added -xref[...] options. used #defines for -xref[...], -warn[..] and -index[...] options. * README.tex, README.html, README: Added details of the -xref[...] options. * datatype.h, parse-yy.h, parse.y, memory.c, type.c: Fixed xref warnings. Mon Jul 31 20:54:56 1995 Andrew Bishop (amb@dan) * warn-raw.c, type.c, datatype.h: Typedef, references to other types was bogus. * latex.c, html.c: Variable and Typedef bugs. * Makefile: Changed the readme target. * README.tex, README.html, README: Miscellaneous improvements. Sun Jul 30 17:53:01 1995 Andrew Bishop (amb@dan) * README.html, README.tex: Initial revision * README: Spelling, grammar and syntax changes. * README.c: Changed the example include files to be system ones. * Makefile: Added a readme target to make README_c.tex and README.c.html. Sat Jul 29 20:08:53 1995 Andrew Bishop (amb@dan) * xref.c: Fixed references to external variables. * warn-raw.c: Added a FilePart output function. Renamed the #defines for option_warn options. * latex.c, html.c: Added functions and variables referenced to the file section. Added a FilePart output function and added functions and variables referenced in this file section. * README: Renamed a4.sty to page.sty, added cxref.el, improved xref section. * Makefile: Renamed a4.sty to page.sty. * cxref.el: Initial revision Tue Jul 25 20:48:11 1995 Andrew Bishop (amb@dan) * README: Removed examples to README.c. * README.c: Initial revision * cxref.c: Examples of the trailing and leading comments implemented. * cxref.h: Two function prototypes removed. * func.c, type.c: Implement the push through of comments, no spare comment needed and function removed. * comment.c: Implement the push through of comments. * parse.y, parse.l: Implement the push through of comments. * file.c: Fix a bug of freeing some data that is not mallocated. * html.c: Rationalise the usage of the html() function and fix it. Sun Jul 23 16:23:36 1995 Andrew Bishop (amb@dan) * parse.l: Handles trailing comments for #define / #include. * cxref.h, datatype.h, parse-yy.h, memory.h: Modified comment to trailing style for #define / #include. * README: Add explanation of new comment styles and Author / copyright info. * func.c: Option to have return value comment inline. * parse.y: Improved error function (reports EOF). Wed Jul 12 19:02:56 1995 Andrew Bishop (amb@dan) * html.c: Fixed stupid HTML bug with '<' and '>' special characters. * Makefile: Changed the rule for all etc (from ':' to ''). Sat Jul 8 14:37:30 1995 Andrew Bishop (amb@dan) * html.c: Improved HTML. Mon Jul 3 17:38:06 1995 Andrew Bishop (amb@dan) * type.c: Big Bug fixes. Sun Jul 2 17:59:59 1995 Andrew Bishop (amb@dan) * latex.c: Added changes to mirror html.c. * html.c: Initial revision Sun Jul 2 16:00:20 1995 Andrew Bishop (amb@dan) * cxref.h, cxref.c: Added HTML option. * latex.c: Renamed the appendix file. * Makefile, README: Added HTML option. Sat Jul 1 16:29:46 1995 Andrew Bishop (amb@dan) * xref.c, warn-raw.c: Handles struct and union non-typedefs. * type.c: Typedef cross referencing, struct and union non-typedefs. * parse.y: Handles repeated comments, struct and union non-typedefs. * parse.l: Handles bogus comment styles. * latex.c: Typedef cross referencing, Type option. * datatype.h: Typedef cross referencing. * cxref.h: New prototypes. * cxref.c: New options. * comment.c: Handles repeated comments, can discard partial comments if bogus. * Makefile: Added LaTeX style sheets, more verbose output. Wed Jun 28 20:20:09 1995 Andrew Bishop (amb@dan) * README: Updated with new command line options. Wed May 3 20:30:04 1995 Andrew Bishop (amb@dan) * xref.c: New index and warn options. * warn-raw.c: New warn option. * var.c: Now includes scope.c. * type.c: Bug fix. * parse.y: Better type handling. * parse.l: Better handling of comments and #defines. * latex.c: New index and warn options and general tidying up and improvements. * cxref.h, cxref.c: New index and warn options. * comment.c: Change for all-comments option (first comment is for file) and tidy up. * Makefile: Removed scope.c. Wed May 3 20:30:04 1995 Andrew Bishop (amb@dan) Beta testing of this version now. Wed Apr 26 21:57:27 1995 Andrew Bishop (amb@dan) * cxref.c: Handle -all-comments option and discard all '-...' arguments. Wed Apr 26 21:45:21 1995 Andrew Bishop (amb@dan) * type.c: Better handling of comments and multi-file fixed. * Makefile: Bug fixes for local cpp. * cxref.c: Handle -all-comments option and discard all '-...' arguments. * func.c: Handle spare_arg_commment better, variable refs for file. * parse.y: Many changes, better handling of pointer to functions etc. * var.c: Mult-file fixed. * parse.l: New -all-comments option and #define values. * latex.c: New output stuff and much better LaTeX, using environments etc.). * warn-raw.c: New outputs. * xref.c: Output list of typedefs and better handling of function/variable refs. * scope.c: Removed stray variable CurFile. * cxref.h: Value of #defines function proto. * preproc.c: Value of simple #defines. * datatype.h, file.c: Variable refs for file, value for #defines and visible for variables. * comment.c: handle -all-comments option. Sun Apr 23 15:08:36 1995 Andrew Bishop (amb@dan) * README: Minor change to reflect the new cross referencing. * Makefile: Add the option to use a local copy of cpp and added the two new files. * memory.h: Added note about how the memory is used in the program. * parse.l: Changed some of the memory handling to reduce usage. * parse-yy.h: Changed to YYDEBUG = true. * warn-raw.c, xref.c: Function and Variable references and StringLists. * cxref.c: Handles Makefile option of which cpp. * latex.c: Have variable and function references. * parse.y: Multiple changes, to handle function calls, references, typedefs, prototypes and definitions better. New error message when YYDEBUG is set. Scoping for variables. * datatype.h: New datatypes for string lists. * cxref.h: New functions in new files. * comment.c: No change. * file.c: Use StringLists and have function references. * func.c: Use StringLists and have variable and function references. * preproc.c, type.c, var.c: Use StringLists. * scope.c, slist.c: Initial revision Wed Apr 5 20:08:54 1995 Andrew Bishop (amb@dan) * warn-raw.c, var.c, type.c, preproc.c, parse.l, parse-yy.h, memory.h, memory.c, latex.c, func.c, file.c, datatype.h, cxref.h, cxref.c, comment.c, Makefile: Second Beta Version, to allow RPC to test it fully. * README: Initial revision Mon Apr 3 20:22:00 1995 Andrew Bishop (amb@dan) * xref.c, warn-raw.c, var.c, type.c, preproc.c, parse.y, parse.l, parse-yy.h, memory.h, memory.c, latex.c, func.c, file.c, datatype.h, cxref.h, cxref.c, comment.c, Makefile: Stable Version for beta testing. Sat Mar 25 16:15:54 1995 Andrew Bishop (amb@dan) * parse.y, parse.l, cpp.l, xref.c, warn-raw.c, var.c, type.c, preproc.c, parse-yy.h, memory.h, memory.c, latex.c, func.c, file.c, datatype.h, cxref.h, cxref.c, comment.c, Makefile: Initial revision cxref-1.6d/INSTALL 777 233 144 0 11506063522 10547 2doc/INSTALLcxref-1.6d/LSM 644 233 144 2342 11642332267 6370 0Begin3 Title: Cxref - C program cross-referencing & documentation tool Version: 1.6d [Oct-03-11] Entered-date: 03OCT11 Description: A program that takes as input a series of C source files and produces a LaTeX or HTML document containing a cross reference of the files/functions/variables in the program, including documentation taken from suitably formatted source code comments. The documentation is stored in the C source file in specially formatted comments, making it simple to maintain. The cross referencing includes lists of functions called, callers of each function, usage of global variables, header file inclusion, macro definitions and type definitions. Works for ANSI C, including many gcc extensions. Keywords: C programming document cross-reference Author: amb@gedanken.demon.co.uk Maintained-by: amb@gedanken.demon.co.uk Primary-site: www.gedanken.demon.co.uk /download-cxref 406k cxref-1.6d.tgz Alternate-site: www.gedanken.org.uk /software/cxref/download Original-site: Platforms: UNIX Copying-policy: GPL End cxref-1.6d/Makefile.in 644 233 144 2446 11506061166 10060 0# $Header: /home/amb/CVS/cxref/Makefile.in,v 1.3 2005-02-01 18:45:07 amb Exp $ # # C Cross Referencing & Documentation tool. Version 1.6a. # # Top level Makefile. # # Written by Andrew M. Bishop # # This file Copyright 1995,96,97,98,99,2000,01,02,03,04,05 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # # autoconf things srcdir=@srcdir@ VPATH=@srcdir@ ######## programs : cd cpp && $(MAKE) programs cd src && $(MAKE) programs cd query && $(MAKE) programs docs : programs cd doc && $(MAKE) docs all : programs docs ######## install : programs cd src && $(MAKE) install cd cpp && $(MAKE) install cd query && $(MAKE) install cd doc && $(MAKE) install install-win32 : programs cd src && $(MAKE) install-win32 cd cpp && $(MAKE) install-win32 cd query && $(MAKE) install-win32 ######## clean : cd src && $(MAKE) clean cd cpp && $(MAKE) clean cd query && $(MAKE) clean cd doc && $(MAKE) clean #### distclean : clean -rm -f Makefile config.log config.status config.cache cd src && $(MAKE) distclean cd cpp && $(MAKE) distclean cd query && $(MAKE) distclean cd doc && $(MAKE) distclean ######## cxref-1.6d/NEWS 777 233 144 0 11506063522 7663 2doc/NEWScxref-1.6d/README 777 233 144 0 11506063522 10225 2doc/READMEcxref-1.6d/TODO 644 233 144 1407 6732233443 6463 0 IMPROVEMENTS IN CXREF VERSION 1.6 (or later) ============================================ Better RCS / CVS Formatting > Format the RCS / CVS $Log$ and $Revision$ keywords similar to the way that the > $Header$ one is currently formatted. Output format options > Options to allow a finer choice of the output that is produced, for example > function calls but not called, variables used but not visible etc., controlled > by an options file. Output documents > Beautification of the LaTeX and HTML documents by adding a title page. HTML hotlinks > Hotlinks from variable definitions / function definitions to the types that > they are. Internationalisation > Fetch titles and others strings used for HTML and LaTeX from a table. cxref-1.6d/configure 755 233 144 470532 11642330021 7755 0#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for cxref 1.6. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cxref' PACKAGE_TARNAME='cxref' PACKAGE_VERSION='1.6' PACKAGE_STRING='cxref 1.6' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" enable_option_checking=no ac_subst_vars='LTLIBOBJS LIBOBJS subdirs objdir EGREP GREP DVIPS LATEX PERL SET_MAKE LN_S INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM LEXLIB LEX_OUTPUT_ROOT LEX CPP YFLAGS YACC AWK OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC PAGE target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_us_paper ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS YACC YFLAGS CPP' ac_subdirs_all='cpp' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures cxref 1.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/cxref] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of cxref 1.6:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-us-paper use US paper instead of A4 Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF cxref configure 1.6 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by cxref $as_me 1.6, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers src/autoconfig.h" PAGE=A4 # Check whether --enable-us-paper was given. if test "${enable_us_paper+set}" = set; then : enableval=$enable_us_paper; if test "$enableval" = "yes"; then PAGE=US; fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { yyless (input () != 0); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PERL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PERL"; then ac_cv_prog_PERL="$PERL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PERL="perl" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PERL=$ac_cv_prog_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LATEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LATEX"; then ac_cv_prog_LATEX="$LATEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LATEX="latex" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LATEX=$ac_cv_prog_LATEX if test -n "$LATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LATEX" >&5 $as_echo "$LATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "dvips", so it can be a program name with args. set dummy dvips; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DVIPS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DVIPS"; then ac_cv_prog_DVIPS="$DVIPS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DVIPS="dvips" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DVIPS=$ac_cv_prog_DVIPS if test -n "$DVIPS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DVIPS" >&5 $as_echo "$DVIPS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$LEX"; then as_fn_error $? "No lex (or flex) program was found" "$LINENO" 5 fi if test -z "$YACC"; then as_fn_error $? "No yacc/byacc (or bison) program was found" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in malloc.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi for ac_func in getcwd mkdir strerror strstr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done objdir=`pwd` subdirs="$subdirs cpp" ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile query/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by cxref $as_me 1.6, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ cxref config.status 1.6 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/autoconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS src/autoconfig.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "query/Makefile") CONFIG_FILES="$CONFIG_FILES query/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file, --srcdir, and --disable-option-checking arguments # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; --disable-option-checking) ;; *) case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi # Always prepend --disable-option-checking to silence warnings, since # different subdirs can have different --enable and --with options. ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 $as_echo "$ac_msg" >&6 as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cxref-1.6d/configure.in 644 233 144 2301 11506061166 10312 0dnl Process this file with autoconf to produce a configure script. AC_INIT(cxref,1.6) dnl Specify the autoconf file. AC_CONFIG_HEADER(src/autoconfig.h) dnl Check the page size PAGE=A4 AC_ARG_ENABLE(us-paper, [ --enable-us-paper use US paper instead of A4], [if test "$enableval" = "yes"; then PAGE=US; fi]) AC_SUBST(PAGE) dnl Checks for programs. AC_PROG_CC AC_PROG_AWK AC_PROG_YACC AC_PROG_CPP AC_PROG_LEX AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_CHECK_PROG(PERL, perl, perl, ) AC_CHECK_PROG(LATEX, latex, latex, ) AC_CHECK_PROG(DVIPS, dvips, dvips, ) if test -z "$LEX"; then AC_MSG_ERROR([No lex (or flex) program was found]) fi if test -z "$YACC"; then AC_MSG_ERROR([No yacc/byacc (or bison) program was found]) fi dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(malloc.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T dnl Checks for library functions. AC_CHECK_FUNCS(getcwd mkdir strerror strstr) objdir=`pwd` AC_SUBST(objdir) dnl Check the cpp directory AC_CONFIG_SUBDIRS(cpp) dnl Create the output files. AC_OUTPUT(Makefile src/Makefile doc/Makefile query/Makefile) cxref-1.6d/install-sh 755 233 144 3106 11506061166 10011 0#!/bin/sh # # Installation script for Unices without a BSD style install (e.g. HP-UX). # # Written by Andrew M. Bishop # # This file Copyright 1995,96,97,98 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # if [ $# = "0" ]; then echo "A simple installation script" echo "usage: install.sh [-c] -d dir" echo " install.sh [-c] [-m mode] [-g group] [-o owner] file destination" exit 1 fi if [ $1 = "-c" ]; then shift fi if [ $1 = "-d" ]; then if [ "x$2" = "x" ]; then echo "Directory not specified" exit 1 fi dir='' dirs=`echo $2 | sed 's%/% %g'` for d in $dirs; do dir="$dir/$d"; [ -d $dir ] || mkdir $dir done else mode= owner= group= while [ ! $# = 0 ]; do case $1 in -m) shift; mode=$1;; -o) shift; owner=$1;; -g) shift; group=$1;; -*) echo "Unrecognised option $1"; exit 1;; *) src=$1; shift; dst=$1;; esac shift done if [ "x$src" = "x" -o "x$dst" = "x" ]; then echo "Source and destination not specified" exit 1 fi if [ -d $dst ]; then dst=$dst/`basename $src` fi if cp $src $dst; then [ $mode ] && chmod $mode $dst [ $group ] && chgrp $group $dst [ $owner ] && chown $owner $dst else echo Copy of $src to $dst failed exit 1 fi fi exit 0 cxref-1.6d/contrib/ 40755 233 144 0 11506063220 7422 5cxref-1.6d/contrib/README 644 233 144 12466 11006120502 10337 0 Cxref 1.5 - Contributed files ============================= These are some miscellaneous files that are useful with cxref but do not form part of the program itself. Those that were not written by myself have the author or contributor noted in the description. cxref.el -------- An Emacs lisp file that will add comments into C source files in the correct format for cxref to understand. cflow.el -------- (By Paul Barham Paul.Barham@cl.cam.ac.uk) An Emacs lisp file that can be used to convert the cxref.function file into a hierarchy of function calls that can be browsed. fixheader.pl ------------ A Perl script that can be used to find the header files that are missing from a header file that cxref cannot parse or remove unneeded header files from source files. Usage: fixheader filename [filename ...] [-v] [-o] [-Odirname] [-Nbasename] [-Rdirname] [-Ddefine] [-Udefine] [-Iinclude] The -v flag gives a verbose output showing what it is doing (recommended). The -o flag produces an output file from the input file with modifications. The other flags are the same as for cxref itself. This should be considered as experimental at the moment, it works on the cxref source code, but has not been tested very extensively beyond that. cxref_includes.pl ----------------- A perl script that will run cxref on all of the include files that are referenced in the cxref.include file that was written out by running cxref on the source files. Usage: cxref_includes cxref.include knr2ansi.pl ----------- A perl script to be run on a C source file that will produce a set of function prototypes for the functions in the file. xrefgraph.py ------------ (By Tom Holroyd ) > I've been making neat call graphs using cxref and AT&T's recently > OpenSourced Graphviz package. It's great for getting the idea of a > program's structure (works best for small to medium sized programs, > though, unless you print it on BIG paper). > Two notes. First, this is very simple, and several things could be done > with it, especially in the area of node and edge labels. But you might > enjoy playing with it and possibly making cxref output the .dot files > directly (although postprocessing the -raw output may have some > advantages). Second, the -k option gets rid of unknown functions since > lots of stdio stuff can clutter the graph. But it's nice to include > *some* of them, like malloc() and free() -- so to make the graph I > attached, I also included a dummy file with black definitions of those > functions. That's sort of a hack, and some sort of switch to > include/exclude functions or classes of function might work too (in cxref > or in the script). xrgr.pl ------- (By Jamie Honan ) > It reads cxref.function files and produces > graphpviz dot files, similar to xrefgraph.py. > > It has a lot more doco, parameters, will work more correctly with > static functions and passing addresses of functions. It also allows > you to view specific functions and files, and call trees associated > with those functions and files. See the README.xgr file for more details. daVinci_include.pl & daVinci_function.pl ---------------------------------------- Perl scripts that will generate call graphs and file include graphs for the daVinci graph drawing package. The daVinci webpage is http://www.informatik.uni-bremen.de/~davinci/ and it describes the program as: : daVinci is a X-Window visualization tool for drawing directed graphs : automatically in high quality. daVinci is developed by Michael Fröhlich (until : November 1997) and Mattias Werner from the Group of Prof. Dr. Bernd : Krieg-Brückner at University of Bremen, Germany.  tree.pl ------- (By Ian Gilmour ) > Here's a simple perl script I've knocked up to give a v. simple call tree > diagram on a simple terminal. > Usage: $0 cxref_function_file root_function max_level > max_level +ve for functions called by specified function > max_level -ve for functions that call specified function cxref.spec ---------- (By Matthew L Daniel ) > The cxref.spec is an RPM spec file for building binary packages. If > you'll drop that into the root of your tarball, your users can use the > command: "rpm -tb cxref-1.5c.tgz" to create RPMs on their system. cxref-1.5c-webcpp.patch ----------------------- (By Uwe Koloska ) > The first thing I have changed is a patch, that uses webcpp > http://webcpp.sf.net > for highlighting the source code. For this you need a modified version of > webcpp, that adds the anchors into the html-files. The patch is submitted to > the webcpp patch manager at sourceforge. The patch was originally written for version 1.5c, but also works for version 1.5d. The current version of webcpp (0.6.8) does not contain the patch that is needed to work with cxref which is why this cxref patch is here and not included in the source code. sdcc.diff --------- (By Claudio Montecucco ) This patch allows cxref to be used with source code that is written for the SDCC and C51 compilers that are used with small microprocessors and microcontrollers. [I have not added it to the main source code because some of the keywords used may conflict with existing valid C code.] cxref-1.6d/contrib/cxref.el 644 233 144 13671 11506061166 11126 0;; $Header: /home/amb/CVS/cxref/contrib/cxref.el,v 1.5 1996-11-16 15:29:51 amb Exp $ ;; ;; C Cross Referencing & Documentation tool. Version 1.3. ;; ;; Some useful Emacs lisp functions for use with cxref. ;; Adds in comments of the appropriate format for cxref. ;; ;; Written by Andrew M. Bishop ;; ;; This file Copyright 1995,96 Andrew M. Bishop ;; It may be distributed under the GNU Public License, version 2, or ;; any higher version. See section COPYING of the GNU Public license ;; for conditions under which this file may be redistributed. ;; ;;;###autoload (defun cxref-c-mode-common-hook () "Set up the key bindings for cxref in cc-mode" (define-key c-mode-map "\C-c\C-f" 'cxref-file-comment) ;; Control-C Control-F (define-key c-mode-map "\C-cf" 'cxref-function-comment) ;; Control-C f (define-key c-mode-map "\C-cv" 'cxref-variable-comment) ;; Control-C v (define-key c-mode-map "\C-ce" 'cxref-endline-comment) ;; Control-C e (define-key c-mode-map "\C-ci" 'cxref-inline-comment) ;; Control-C i ) ;;;###autoload (add-hook 'c-mode-common-hook 'cxref-c-mode-common-hook) ;; Insert a file comment suitable for parsing with cxref (defun cxref-file-comment () "Inserts a file comment suitable for parsing with cxref" (interactive) (let ((cp (make-marker))) (goto-char (point-min)) (insert "/***************************************") (c-indent-command) (insert (concat "\n$" "Header" "$")) (c-indent-command) (insert "\n") (insert "\n")(c-indent-command) (set-marker cp (point)) (insert "\n***************************************/") (c-indent-command) (insert "\n\n\n") (while (looking-at "\n") (delete-char 1)) (if (string-match "\\.h$" (buffer-file-name)) (let ((st) (defname (file-name-nondirectory (buffer-file-name)))) (while (setq st (string-match "\\." defname)) (setq defname (concat (substring defname 0 st) "_" (substring defname (+ 1 st) nil)))) (setq defname (upcase defname)) (insert (concat "#ifndef " defname "\n")) (insert (concat "#define " defname " /*+ To stop multiple inclusions. +*/\n")) (insert "\n") (goto-char (point-max)) (while (looking-at-backward "\n") (delete-char -1)) (insert "\n\n") (insert (concat "#endif /* " defname " */\n")) )) (goto-char cp) (c-indent-command) )) ;; Insert a function comment suitable for parsing with cxref (defun cxref-function-comment () "Inserts a function comment suitable for parsing with cxref" (interactive) (let ((bp (make-marker)) (cp (make-marker)) (fp (make-marker)) (as) (ae) (a) (depth 0)) (beginning-of-line) (while (looking-at-backward "\n\n") (delete-backward-char 1)) (insert "\n\n") (insert "/*++++++++++++++++++++++++++++++++++++++") (c-indent-command) (insert "\n") (set-marker bp (point)) (insert "\n") (set-marker cp (point)) (insert "++++++++++++++++++++++++++++++++++++++*/") (c-indent-command) (insert "\n\n") (if (looking-at "static") (re-search-forward "[ \t\n]+")) (set-marker fp (point)) (if (not (looking-at "void[\t ]+[a-zA-Z0-9_]")) (progn (setq as (point)) (search-forward "(") (backward-char) (setq ae (point)) (setq a (buffer-substring as ae)) (goto-char cp) (insert "\n") (insert a) (c-indent-line) (insert "\n") (set-marker cp (point)) (goto-char fp) ) ) (search-forward "(") (set-marker fp (point)) (catch 'finished-args (while t (if (looking-at-backward ")") (throw 'finished-args t)) (re-search-forward "[\n\t ]*") (set-marker fp (point)) (setq as (point)) (while (not (and (= depth 0) (looking-at "[,)]"))) (if (looking-at "[({]") (setq depth (1+ depth))) (if (looking-at "[)}]") (setq depth (1- depth))) (forward-char)) (set-marker fp (1+ (point))) (re-search-backward "[\n\t ]*") (setq ae (point)) (setq a (buffer-substring as ae)) (if (not (or (string= a "void") (string= a ""))) (progn (goto-char cp) (insert "\n") (insert a) (c-indent-line) (insert "\n") (set-marker cp (point)) )) (goto-char fp) )) (goto-char bp) (c-indent-command) )) ;; Insert a variable comment suitable for parsing with cxref (defun cxref-variable-comment () "Inserts a variable comment suitable for parsing with cxref" (interactive) (let ((fp (make-marker))) (beginning-of-line) (while (looking-at-backward "\n\n") (delete-backward-char 1)) (insert "\n") (insert "/*+ ") (set-marker fp (point)) (insert " +*/") (insert "\n") (goto-char fp) (c-indent-command) )) ;; Inserts an end of line comment that is parsed by cxref (defun cxref-endline-comment () "Inserts an end of line comment that is parsed by cxref" (interactive) (let ((fp (make-marker))) (end-of-line) (indent-to-column (c-comment-indent)) (insert "/*+ ") (setq fp (point)) (insert " +*/") (goto-char fp) )) ;; Insert an inline comment that is not parsed with cxref (defun cxref-inline-comment () "Inserts an inline comment that is not parsed with cxref" (interactive) (let ((fp (make-marker))) (beginning-of-line) (while (looking-at-backward "\n\n") (delete-backward-char 1)) (insert "\n") (insert "/* ") (set-marker fp (point)) (insert " */") (insert "\n\n") (goto-char fp) (c-indent-command) )) ;; A Very Useful Function (defun looking-at-backward (arg) (save-excursion (let ((cp (point)) (return)) (if (re-search-backward arg (point-min) t) (if (re-search-forward arg cp t) (if (= (point) cp) (setq return t) ))) return ))) cxref-1.6d/contrib/cflow.el 644 233 144 13275 6323232453 11111 0;;; CFLOW.EL --- C flow graph ;; Copyright (C) 1997 Paul Barham ;; Author: Paul Barham Paul.Barham@cl.cam.ac.uk ;; Maintainer: Paul Barham Paul.Barham@cl.cam.ac.uk ;; Created: 19 Mar 1997 ;; Version: 1.0 ;; Keywords: C language cxref flow static call graph browser ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 1, or (at your option) ;; any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; A copy of the GNU General Public License can be obtained from this ;; program's author (send electronic mail to Paul.Barham@cl.cam.ac.uk) ;; or from the Free Software Foundation, Inc., 675 Mass Ave, ;; Cambridge, MA 02139, USA. ;; LCD Archive Entry: ;; cflow|Paul Barham|Paul.Barham@cl.cam.ac.uk ;; |C flow graph ;; |$Date$|$Revision$|~/packages/cflow.el ;;; Commentary: ;; This package is intended to be used in conjunction with cxref ;; packeage (http://www.gedanken.demon.co.uk/cxref/index.html) ;; It parses the cxref.function file generated by cxref and fires up ;; a sort of folding mode which allows the hierarchical flow graph ;; to be recursively expanded. ;; ;; Simply find the file cxref.function in a buffer and type M-x cflow ;; ;; Then you can use: ;; ;; SPC or RETURN Expand the current line ;; x Close up the flow graph under the current node ;; . Find the function on the current line in another window ;; q Quit ;; ;;; Change log: ;; $Log$ ;;; Variables: (defvar cflow-filenames t "Show filenames where each function is declared") (defvar cflow-main "main" "The name of the function at the root of the flowgraph") (defvar cflow-indent "| " "The indentation string added per-level of the flowgraph") ;;; Code: ;;; ;;; This reads in the output of cxref ;;; (defun cxref-readline () (interactive) (let (file fn scope refs (eol (progn (end-of-line) (point)))) (beginning-of-line) (re-search-forward "\\([^ \t]+\\)[ \t]*" eol t) (setq file (buffer-substring-no-properties (match-beginning 1) (match-end 1))) (re-search-forward "\\([^ \t]+\\)[ \t]*" eol t) (setq fn (buffer-substring-no-properties (match-beginning 1) (match-end 1))) (re-search-forward "\\([0-9]+\\)[ \t]*" eol t) (setq scope (car (read-from-string (buffer-substring-no-properties (match-beginning 1) (match-end 1))))) (setq refs nil) (while (re-search-forward "\\([^ \t]+\\)[ \t]*" eol t) (setq refs (cons (buffer-substring-no-properties (match-beginning 1) (match-end 1)) refs))) (list fn file scope (nreverse refs)) )) (defun cxref-parse () (interactive) (let (fns) (save-excursion (beginning-of-buffer) (while (< (point) (point-max)) (setq fns (cons (cxref-readline) fns)) (forward-line 1)) ) fns) ) (defun cflow-insert (indent fname) (string-match "[&%]*\\(.*\\)" fname) (let* ((basename (substring fname (match-beginning 1))) (fun (assoc basename cflow-fns))) (if fun (insert (concat indent fname (if cflow-filenames (concat " (" (nth 1 fun) ")") "") "\n")) (insert (concat indent fname "\n"))) )) (defun cflow-expand () "Expand this node in the flow graph" (interactive) (let (name indent fun) (save-excursion (beginning-of-line) (re-search-forward "\\(^[| ]*\\)[&%]*\\([*a-zA-Z0-9_$]+\\)") (setq indent (concat (buffer-substring-no-properties (match-beginning 1) (match-end 1)) cflow-indent)) (setq name (buffer-substring-no-properties (match-beginning 2) (match-end 2))) (setq fun (assoc name cflow-fns)) (forward-line 1) (beginning-of-line) (or (looking-at indent) (mapcar (lambda (fname) (cflow-insert indent fname)) (nth 3 fun))) )) ) (defun cflow-contract () "Close up this section of the flow graph" (interactive) (let (name indent fun) (save-excursion (beginning-of-line) (re-search-forward "\\(^[| ]*\\)") (setq indent (concat (buffer-substring-no-properties (match-beginning 1) (match-end 1)) cflow-indent)) (forward-line 1) (beginning-of-line) (while (looking-at indent) (kill-line 1)) )) ) (defun cflow-tag () "Find the function on the current line using TAGS" (interactive) (let (name indent fun) (save-excursion (beginning-of-line) (re-search-forward "\\(^[| ]*\\)[&%]*\\([*a-zA-Z0-9_$]+\\)") (setq indent (concat (buffer-substring-no-properties (match-beginning 1) (match-end 1)) cflow-indent)) (setq name (buffer-substring-no-properties (match-beginning 2) (match-end 2))) (message "Finding %s" name) (find-tag-other-window name))) ) (define-derived-mode cflow-mode fundamental-mode "CFlow" (setq cflow-mode t) ;; Linemenu simply highlights the current line ; (linemenu-initialize) ) (define-key cflow-mode-map " " 'cflow-expand) (define-key cflow-mode-map "" 'cflow-expand) (define-key cflow-mode-map "x" 'cflow-contract) (define-key cflow-mode-map "." 'cflow-tag) (define-key cflow-mode-map "q" 'bury-buffer) (defun cflow () (interactive) (let ((buf (get-buffer-create "*cflow*"))) (setq cflow-fns (cxref-parse)) (switch-to-buffer buf) (cflow-mode) (erase-buffer) ;; Don't understand this :-) ; (make-local-variable 'cflow-fns) (cflow-insert "" "$") (cflow-insert "" cflow-main)) ) ;;; CFLOW.EL ends here cxref-1.6d/contrib/make_depend.pl 755 233 144 4126 10211407560 12236 0#!/bin/sh # # C Cross Referencing & Documentation tool. Version 1.5. # # A Perl script to produce a neat output for makefile dependencies. # # Written by Andrew M. Bishop # # This file Copyright 1999,2003 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # exec perl -x $0 $* exit 1 #!perl # The C pre-processor arguments (-D, -I). $cpp_args=""; # The files to check. @cfiles=(); @hfiles=(); # # Parse the command line arguments # if( $#ARGV==-1 ) { print "Usage: make_depend filename1.h [filename2.h ...]\n"; print " filename1.c filename2.c\n"; print " [-Ddefine] [-Udefine] [-Iinclude]\n"; exit 0; } while ( $#ARGV >= 0 ) { $_=$ARGV[0]; if(-f $_) { push(@cfiles,$_) if(m/\.c$/); push(@hfiles,$_) if(m/\.h$/); } else { $cpp_args.=" '".$_."'"; } shift; } die "Error: no source files specified\n" if($#cfiles==-1); die "Error: no header files specified\n" if($#hfiles==-1); # # The main program # #@cfiles=sort(@cfiles); $longest=0; foreach $cfile (@cfiles) { $longest=length($cfile) if(length($cfile)>$longest); } foreach $cfile (@cfiles) { %inc_headers=&GetFileHeaders($cfile); $ofile = $cfile; $ofile =~ s/\.c/.o/; printf("%-".$longest."s : %-".$longest."s",$ofile,$cfile); foreach $hfile (@hfiles) { if($inc_headers{$hfile}) { print " $hfile"; } else { print " "." "x(length($hfile)); } } print "\n"; } # # Get the included headers from an existing file. # sub GetFileHeaders { local($file)=@_; local(%headers)=(); local($depends,$header)=(""); # Parse the file open(IN,"gcc -MM $file $cpp_args|") || die "Cannot run 'gcc -MM $file $cpp_args'\n"; while() { $depends.=$_; } close(IN); $depends =~ s/\\?\n//g; foreach $header (split(/ +/,$depends)) { $headers{$header}=1; } return(%headers); } cxref-1.6d/contrib/sdcc.diff 644 233 144 5257 11005121107 11206 0--- parse.l 2008/04/02 18:57:29 1.51 +++ parse.l 2008/04/27 15:55:53 @@ -14,6 +14,8 @@ %x CPP_INCLUDE CPP_INC_FILE CPP_INC_FLAGS %x CPP_DEFINE CPP_DEFINE_ARGP CPP_DEFINE_BODY CPP_DEFINE_ARGS %x GNU_LABEL GNU_VA_ARG GNU_ATTRIBUTE GNU_TYPEOF GNU_OFFSETOF +%x SDCC_EXTENSION1 SDCC_EXTENSION2 +%x C51_EXTENSION1 C51_EXTENSION3 C51_EXTENSION4 C51_EXTENSION5 C51_PRAGMAASM %{ /*************************************** @@ -194,6 +196,13 @@ [a-z]+ { BEGIN(CPP); } .|\n { BEGIN(INITIAL); /* Ignore bad pre-processor output */ } + /* C51 compiler - contributed by Claudio Montecucco */ + +pragma{W}+asm { BEGIN(C51_PRAGMAASM); } +#{W}*pragma{W}+endasm { BEGIN(INITIAL); } +{N} { } +. { } + /* Preprocessor directives not #define or #include. */ . { } @@ -311,6 +320,43 @@ "_Complex" { } "_Bool" { yylval="_Bool"; return(BOOL); } + /* SDCC - contributed by Claudio Montecucco with modifications from me */ + +"__xdata" { } +"__code" { } +"__interrupt" { BEGIN(SDCC_EXTENSION1); } +"__using" { BEGIN(SDCC_EXTENSION1); } +"(" { } +[^()]+ { } +")" { BEGIN(INITIAL); } + +"__sfr" { BEGIN(SDCC_EXTENSION2); } +"__sbit" { BEGIN(SDCC_EXTENSION2); } +"__at" { BEGIN(SDCC_EXTENSION2); } +[^;]+ { } +";" { BEGIN(INITIAL); } + +"using" { BEGIN(C51_EXTENSION1); } +"(" { } +[^()]+ { } +")" { BEGIN(INITIAL); } + +"xdata" { } +"code" { } + +"sfr" { BEGIN(C51_EXTENSION3); } +"sbit" { BEGIN(C51_EXTENSION3); } +[^;]+ { } +";" { BEGIN(INITIAL); } + +"interrupt" { BEGIN(C51_EXTENSION4); } +[^{]+ { } +"{" { unput('{'); BEGIN(INITIAL); } + +"_at_" { BEGIN(C51_EXTENSION5); } +[^;]+ { } +";" { unput(';'); BEGIN(INITIAL); } + /* C language keywords. */ "auto" { yylval="auto" ; return(AUTO); } cxref-1.6d/contrib/daVinvi_function.pl 755 233 144 3033 7022214624 13266 0#!/bin/sh # # Converts the cxref output files into a format that can be read into # the DaVinci graph drawing program. # # (c) 1999 Andrew M. Bishop # exec perl -x $0 $* #!perl die "Usage: $0 cxref.include\n" if($#ARGV==-1); open(FUNCTION,"<$ARGV[0]") || die "Cannot open $ARGV[0]\n"; %sysfunctions=(); %localfunctions=(); %function=(); while() { chop; ($file,$function,$scope,@calls)=split(/ /); $localfunctions{$function}=1; $function{$function}="$file:$function"; } print "[\n"; close(FUNCTION); open(FUNCTION,"<$ARGV[0]") || die "Cannot open $ARGV[0]\n"; while() { chop; ($file,$function,$scope,@calls)=split(/ /); if($scope==1) { print "l(\"$file:$function\",n(\"\",[a(\"OBJECT\",\"$function\")],\n"; } else { print "l(\"$file:$function\",n(\"\",[a(\"OBJECT\",\"$function\")],\n"; } print "\t[\n"; foreach $call (@calls) { next if($call =~ /\&/); if($call =~ /^%(.+)$/) { print "\te(\"\",[],r(\"$file:$1\")),\n"; } elsif($function{$call}) { print "\te(\"\",[],r(\"$function{$call}\")),\n"; } else { print "\te(\"\",[],r(\"$call\")),\n"; $sysfunctions{$call}=1; } } print "\t]))\n,\n"; } foreach $function (keys(%sysfunctions)) { print "l(\"$function\",n(\"\",[a(\"OBJECT\",\"$function\"),a(\"COLOR\",\"#808080\")],[]))\n,\n"; } print "]\n"; close(FUNCTION); cxref-1.6d/contrib/daVinvi_include.pl 755 233 144 2201 7022214634 13061 0#!/bin/sh # # Converts the cxref output files into a format that can be read into # the DaVinci graph drawing program. # # (c) 1999 Andrew M. Bishop # exec perl -x $0 $* #!perl die "Usage: $0 cxref.include\n" if($#ARGV==-1); open(INCLUDE,"<$ARGV[0]") || die "Cannot open $ARGV[0]\n"; %sysinclude=(); print "[\n"; while() { chop; ($file,@includes)=split(/ /); if($file =~ /\.c$/) { print "l(\"$file\",n(\"\",[a(\"OBJECT\",\"$file\"),a(\"_GO\",\"ellipse\")],\n"; } else { print "l(\"$file\",n(\"\",[a(\"OBJECT\",\"$file\")],\n"; } print "\t[\n"; foreach $include (@includes) { if($include =~ /^%(.+)$/) { print "\te(\"\",[],r(\"$1\")),\n"; } else { $sysincludes{$include}=1; print "\te(\"\",[a(\"EDGEPATTERN\",\"dotted\")],r(\"<$include>\")),\n"; } } print "\t]))\n,\n"; } foreach $include (keys(%sysincludes)) { print "l(\"<$include>\",n(\"\",[a(\"OBJECT\",\"$include\"),a(\"COLOR\",\"#808080\")],[]))\n,\n"; } print "]\n"; close(INCLUDE); cxref-1.6d/contrib/knr2ansi.pl 755 233 144 3161 7007364603 11520 0#!/bin/sh exec perl -x $0 $* #!perl die "Usage: $0 \n" if($#ARGV==-1); foreach $argv (@ARGV) { push(@files,$argv) if(-f $argv); push(@args,$argv) if(! -f $argv); } $args=join(" ",@args); foreach $file (@files) { open(CXREF,"cxref $args $file -raw |") || die "Cannot run cxref on $file\n"; $function=0; $comment=0; $functype=""; $funcname=""; @funcargs=(); @local=(); @global=(); while() { if(m/^FUNCTION : ([a-z0-9A-Z_\$]+) \[([a-zA-Z]+)\]$/) { $function=1; $functype="static " if($2 eq "Local"); $funcname=$1; } $comment=1 if($function && m/^<<<$/); $comment=0 if($function && m/^>>>$/); $functype.=substr($1,0,length($1)-length($funcname)-1) if($function && m/^Type: ([^<]+)( <|\n)/); push(@funcargs,$1) if($function && m/^Arguments: ([^<]+)( <|\n)/); if(!$comment && $function && (m/^$/ || m/^-+$/)) { push(@funcargs,"void") if($#funcargs==-1); $f="$functype $funcname(".join(",",@funcargs).");"; push(@local,$f) if($functype =~ m/static/); push(@global,$f) if($functype !~ m/static/); $functype=""; $funcname=""; @funcargs=(); $function=0; } } close(CXREF); # Output the results print "\n /* local functions in $file */\n\n"; foreach $f (@local) { print "$f\n"; } print "\n /* global functions in $file */\n\n"; foreach $f (@global) { print "$f\n"; } } cxref-1.6d/contrib/tree.pl 755 233 144 7545 7035642637 10751 0#!/bin/sh # # $Header: /cel/swd/usr/iag/cxref/RCS/tree.pl,v 1.2 2000/01/06 14:14:47 iag Exp $ # # Converts the cxref.function output file into a format that can display # a simple tree structure # # Warning: This is my first perl program. It can probably be improved on ! # # This file Copyright 2000 Ian A. Gilmour. # (ian@igilmour.freeserve.co.uk / ian.gilmour.ffei.co.uk) # # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # exec perl -w -x $0 $* #!perl $level = 0; $func = "main"; $max_level = 3; $found = 0; # generates the tree going down # i.e. displays which functions are called by the given function # sub find_func { my $func_reqd = $_[0]; if ($level > $max_level) { return; } else { $level++; } for ($z=0; $z < ($level-1)*3; $z++) { print " "; } print "+- "; if (defined ($functions{$func_reqd})) { print "$func_reqd() \t[$file{$func_reqd}]"; if($scope{$func_reqd}==2) { print " \t(static)"; } if ($fshown{$func_reqd}) { print " \t...referenced above\n"; } else { print "\n"; $fshown{$func_reqd} = 1; for (my $y=0; $y <= $fcount{$func_reqd}; $y++) { find_func ($fcalls{$func_reqd}[$y]); } } } else { if (!defined ($fundefshown{$func_reqd})) { print "$func_reqd() \t[undefined]\n"; $fundefshown{$func_reqd} = 1; } else { print "$func_reqd() \t[undefined] \t...referenced above\n"; } } $level--; } # generates the tree going up # i.e finds which functions call the specified function # sub find_called_func { my $func_reqd = $_[0]; if ($level <= $max_level) { return; } else { $level--; } foreach my $func (keys %functions) { if (defined ($fcount{$func})) { for (my $y=0; $y <= $fcount{$func}; $y++) { if ($func_reqd eq $fcalls{$func}[$y]) { if (!$found) { $found = 1; print "+- $func_reqd()\n"; } for (my $z=0; $z > (($level)*3); $z--) { print " "; } print "+- "; print "$functions{$func} \t[$file{$func}]"; if($scope{$func}==1) { print " \t(static)"; } if ($fshown{$func}) { print " \t...referenced above\n"; } else { print "\n"; $fshown{$func} = 1; find_called_func ($functions{$func}); } } } } } $level++; if (!$found) { print "$func_reqd() not referenced.\n"; }; return; } die "Usage: $0 cxref_function_file root_function max_level\n". "max_level +ve for functions called by specified function\n". "max_level -ve for functions that call specified function\n" if($#ARGV==-1); if (defined ($ARGV[2])) { $max_level = $ARGV[2]; }; if (defined ($ARGV[1])) { $func = $ARGV[1]; }; open(FUNCTION,"<$ARGV[0]") || die "Cannot open $ARGV[0]\n"; # read all function names in once to set up database # while() { s/\%//g; s/\&//g; chop; ($file,$function,$scope,@calls)=split(/ /); if((defined ($scope)) && (($scope==2) || ($scope==1))) { $scope{$function}="$scope"; $functions{$function}="$function"; $file{$function}="$file"; if (defined (@calls)) { $fcalls{$function} = [@calls]; $fcount{$function} = $#calls; $fshown{$function} = 0; } else { $fcount{$function} = -1; } } } close(FUNCTION); # now display reqd info.... # if ($max_level >= 0) { print "Looking for functions that $func() calls...\n"; find_func ($func); } else { print "Looking for functions that call $func()...\n"; find_called_func ($func); } cxref-1.6d/contrib/xrefgraph.py 755 233 144 7046 7001145002 11762 0#! /usr/bin/env python # This program reads the output of cxref: # http://www.gedanken.demon.co.uk/cxref/ # and produces input for Graphviz: # http://www.research.att.com/sw/tools/graphviz/ # and of course you'll need Python: # http://www.python.org/ # 10/12/99, Dr. Tom Holroyd, tomh@po.crl.go.jp # Notes: # * You can give a dummy file to cxref (or edit cxref.function) and use -k # to include some specific functions you're interested in such as malloc(), # etc., without including all the standard libraries. # * If the graph is big, the node labels may be small. Try editing the .dot # file and adding 'node [fontsize = 24]' or similar, or set 'ratio = auto' # and let it output multiple pages. Also, see the dot user's guide. import sys import getopt import re import string __usage = """[-k] [-n] [-t a4|a4r|us|usr] filename Parse the cxref.function file produced by "cxref -xref-func ...", and produce .dot file output suitable for use with graphviz programs like 'dot' or 'neato' that will create a postscript version of the call graph. If -k is specified, only nodes that are 'known', in the sense of being defined within the group of files sent to cxref, are output. Otherwise all called functions are included, e.g., stdio functions, etc. If -n is specified, the node is labeled with the file where the function is defined, if known. -t sets the paper size and orientation (a4r default). Send the output of this script to, e.g., dot -Tps > xref.ps""" __scriptname = sys.argv[0] def printusage(): sys.stderr.write("usage: %s %s\n" % (__scriptname, __usage)) nodeflag = 0 knownflag = 0 # Various paper sizes with .5 inch margins. Note: I used inches here because # dot uses inches. Complain to AT&T. A4paper = { 'page' : "8.26, 11.69", 'rotate' : "", 'size' : "7.2, 10.6" } A4Rpaper = { 'page' : "8.26, 11.69", 'rotate' : "rotate = 90;", 'size' : "10.6, 7.2" } USpaper = { 'page' : "8.5, 11", 'rotate' : "", 'size' : "7.5, 10" } USRpaper = { 'page' : "8.5, 11", 'rotate' : "rotate = 90;", 'size' : "10, 7.5" } papertypes = { 'a4' : A4paper, 'a4r' : A4Rpaper, 'us' : USpaper, 'usr' : USRpaper } paperdef = A4Rpaper try: optlist, args = getopt.getopt(sys.argv[1:], "nkt:") for opt, arg in optlist: if opt == '-n': nodeflag = 1 if opt == '-k': knownflag = 1 if opt == '-t': if papertypes.has_key(arg): paperdef = papertypes[arg] else: raise getopt.error, "unknown paper type '%s'" % arg except getopt.error, msg: sys.stderr.write("%s: %s\n" % (__scriptname, msg)) printusage() sys.exit(1) if len(args) != 1: printusage() sys.exit(1) filename = args[0] profile = open(filename).readlines() # Build the call tree. nodelist = [] # list of known nodes calls = {} # key: node, value: call list (includes unknown nodes) filename = {} # key: node, value: filename sp = re.compile(r'\s%|\s') for line in profile: l = sp.split(string.strip(line)) node = l[1] nodelist.append(node) if filename.has_key(node) or calls.has_key(node): sys.stderr.write("duplicate function '%s', ignoring previous definition\n" % node) filename[node] = l[0] calls[node] = [] for i in range(3, len(l)): calls[node].append(l[i]) # Output the graph. print 'digraph call {' print 'page = "%(page)s"; %(rotate)s size = "%(size)s"' % paperdef print 'ratio = fill; center = 1' for node in nodelist: if nodeflag: label = '%s\\n%s' % (node, filename[node]) print '%s [label = "%s"]' % (node, label) for n in calls[node]: if not knownflag or n in nodelist: print node, '->', n print '}' cxref-1.6d/contrib/README.xrgr 644 233 144 3477 7451145704 11306 0This script generates graphivz dot files from a cxref function cross reference. Graphviz is a graph drawing tool from AT&T. You can get more information on graphviz from http://www.research.att.com/sw/tools/graphviz/ This script works in a similar manner to the xrefgraph.py script. It has some extra functionality, viz ; the ability to draw just part of a call tree, and extra parameters for controlling the final layout. To see the full description of the program, run xrgr.pl --help Some examples: If you just wanted to show the call trees for functions in a file func.c, you would invoke xrgr.pl -n func.c -o outfile.dot cxref.function You then produce a call graph by running e.g. dot -o graph.out -Tps outfile.dot Sometimes it is useful to cluster functions in a file. This can show things like inappropriate modularity (functions that really belong somewhere else). The -c option clusters functions in a file. xrgr.pl -n func.c -c func.c -o outfile.dot cxref.function One of the difficulties with graphviz diagrams is that they can be quite large. If you try to put them on a single sheet, they can be illegible. The alternative is to use multiple sheets, or A3 size paper if you are lucky enough to have an A3 printer. -t multi : multiple pages -t compress : squishes things up but can look really squashed -k deletes calls to functions that are not defined in your code. This will eliminate showing calls to standard library functions. You can also draw the call tree for a single function. This will also help in fitting information onto a single sheet. The following shows the call tree for function CheckFunctionVariableRef, eliminating calls to standard library functions. xrgr.pl -k -f CheckFunctionVariableRef -o xx cxref.function Jamie Honan jhonan@optushome.com.au cxref-1.6d/contrib/cxref-1.5c-webcpp.patch 644 233 144 10040 7465202307 13515 0diff -ru cxref-1.5c/cxref.c cxref-1.5cu1/cxref.c --- cxref-1.5c/cxref.c Sat Jan 6 14:05:12 2001 +++ cxref-1.5cu1/cxref.c Mon Feb 18 17:41:20 2002 @@ -57,6 +57,7 @@ option_xref=0, /*+ do cross referencing. +*/ option_warn=0, /*+ produce warnings. +*/ option_index=0, /*+ produce an index. +*/ + option_webcpp=0, /*+ use webcpp for sources +*/ option_raw=0, /*+ produce raw output. +*/ option_latex=0, /*+ produce LaTeX output. +*/ option_html=0, /*+ produce HTML output. +*/ @@ -379,6 +380,7 @@ " [-warn[-all][-comment][-xref]]\n" " [-index[-all][-file][-func][-var][-type]]\n" " [-latex209|-latex2e] [-html20|-html32] [-rtf] [-sgml] [-raw]\n" + " [-webcpp]\n" " [-Idirname] [-Ddefine] [-Udefine]\n" " [-CPP cpp_program] [-- cpp_arg [ ... cpp_arg]]\n" "\n" @@ -407,6 +409,7 @@ "\n" "-latex209 | -latex2e : Produce LaTeX output (version 2.09 or 2e - default=2e).\n" "-html20 | -html32 : Produce HTML output (version 2.0 or 3.2 - default=3.2).\n" + " -webcpp : use webcpp to colorize sources.\n" "-rtf : Produce RTF output (version 1.x).\n" "-sgml : Produce SGML output (for SGML tools version 1.0.x).\n" "-raw : Produce raw output .\n" @@ -678,6 +681,9 @@ if(!strcmp(args[i],"-no-comments")) {option_no_comments=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} + + if(!strcmp(args[i],"-webcpp")) + {option_webcpp=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strncmp(args[i],"-xref",5)) { diff -ru cxref-1.5c/html.c cxref-1.5cu1/html.c --- cxref-1.5c/html.c Sat Jan 6 14:05:12 2001 +++ cxref-1.5cu1/html.c Fri Feb 15 18:18:06 2002 @@ -42,6 +42,9 @@ /*+ The comments are to be inserted verbatim. +*/ extern int option_verbatim_comments; +/*+ wether to use webcpp for source highlighting +*/ +extern int option_webcpp; + /*+ The type of HTML output to produce. +*/ extern int option_html; @@ -1426,38 +1429,43 @@ ifile=name; ofile=ConcatStrings(4,option_odir,"/",name,HTML_SRC_FILE); - in =fopen(ifile,"r"); - if(!in) - {fprintf(stderr,"cxref: Failed to open the source file '%s'\n",ifile);exit(1);} - - out=fopen(ofile,"w"); - if(!out) - {fprintf(stderr,"cxref: Failed to open the HTML output source file '%s'\n",ofile);exit(1);} - - WriteHTMLPreamble(out,ConcatStrings(2,"Source File ",name),0); - fputs("
    \n",out);
    -
    - strcpy(pad,"    ");
    -
    - while(fgets(line,256,in))
    -   {
    -    lineno++;
    -    if(lineno==10)
    -       pad[3]=0;
    -    else if(lineno==100)
    -       pad[2]=0;
    -    else if(lineno==1000)
    -       pad[1]=0;
    -    else if(lineno==10000)
    -       pad[0]=0;
    -    fprintf(out,"%d%s| %s",lineno,lineno,pad,html(line,1));
    -   }
    -
    - fputs("
    \n",out); - WriteHTMLPostamble(out,0); - - fclose(in); - fclose(out); + if(option_webcpp) { + snprintf(line, 256, "webcpp %s %s -l -x", ifile, ofile); + system (line); + } else { + in =fopen(ifile,"r"); + if(!in) + {fprintf(stderr,"cxref: Failed to open the source file '%s'\n",ifile);exit(1);} + + out=fopen(ofile,"w"); + if(!out) + {fprintf(stderr,"cxref: Failed to open the HTML output source file '%s'\n",ofile);exit(1);} + + WriteHTMLPreamble(out,ConcatStrings(2,"Source File ",name),0); + fputs("
    \n",out);
    +   
    +   strcpy(pad,"    ");
    +   
    +   while(fgets(line,256,in))
    +     {
    +       lineno++;
    +       if(lineno==10)
    +	 pad[3]=0;
    +       else if(lineno==100)
    +	 pad[2]=0;
    +       else if(lineno==1000)
    +	 pad[1]=0;
    +       else if(lineno==10000)
    +	 pad[0]=0;
    +       fprintf(out,"%d%s| %s",lineno,lineno,pad,html(line,1));
    +     }
    +   
    +   fputs("
    \n",out); + WriteHTMLPostamble(out,0); + + fclose(in); + fclose(out); + } } cxref-1.6d/contrib/cxref.spec 644 233 144 2704 7433461753 11425 0Name : cxref Version : 1.5c Release : 2mdk Group : Development/C License : GPL Packager : Matthew L Daniel URL : http://www.gedanken.demon.co.uk/cxref/ Source : http://www.gedanken.demon.co.uk/cxref/%{name}-%{version}.tgz BuildRoot : %{_tmppath}/%{name}-%{version}-root Summary : C program cross-referencing & documentation tool %Description A program that takes as input a series of C source files and produces a LaTeX or HTML document containing a cross reference of the files/functions/variables in the program, including documentation taken from suitably formatted source code comments. The documentation is stored in the C source file in specially formatted comments, making it simple to maintain. The cross referencing includes lists of functions called, callers of each function, usage of global variables, header file inclusion, macro definitions and type definitions. Works for ANSI C, including many gcc extensions. This compiled against gcc-3.0.1. %prep %setup -q %patch -p0 %build %configure --enable-us-paper make %install %makeinstall %clean if test "/" != "${RPM_BUILD_ROOT}"; then rm -rf ${RPM_BUILD_ROOT}; fi %files %defattr(-,root,root) %doc ANNOUNCE COPYING FAQ FAQ.html FAQ-html.pl FILES INSTALL LSM NEWS TODO %doc README README.c README.c.html README.c.rtf README.c.sgml README.c.src.html %doc README_c.tex README.html README.man README.sgml README.tex contrib doc %{_bindir} %{_mandir} cxref-1.6d/contrib/xrgr.pl 755 233 144 34017 7451145643 11003 0#! /usr/bin/perl -w use strict; use vars qw/$VERSION/; BEGIN { $VERSION = '0.91' } use Getopt::Long; use Pod::Usage; Getopt::Long::Configure ("bundling"); my %args; GetOptions (\%args, 'h|?|help', 'V|version', 'd|debug', 'n|filename|file=s@', 'o|output=s', 'k|defined', 'v|verbose', 't|paper=s@', 'm|distance=s', 'l|label=s', 'c|cluster=s@', 'f|function|func=s@') or pod2usage(2); pod2usage(-verbose => 2, -exitval => 1) if $args{'h'}; if ($args{'V'}) { print STDERR "xrgr.pl Version $VERSION\n"; exit; } sub dumpargs { print "filenames " . join(' ', @{$args{'n'}}) . "\n" if $args{'n'}; print "functions " . join(' ', @{$args{'f'}}) . "\n" if $args{'f'}; print "cluster " . join(' ', @{$args{'c'}}) . "\n" if $args{'c'}; print "paper $args{'t'}\n" if $args{'t'}; print "verbose $args{'v'}\n" if $args{'v'}; print "defined $args{'k'}\n" if $args{'k'}; print "distance $args{'m'}\n" if $args{'m'}; print "output $args{'o'}\n" if $args{'o'}; print "label $args{'l'}\n" if $args{'l'}; } #&dumpargs(); my %paper_sizes = ( 'a4' => "page=\"8.26,11.69\"; rotate=0; size=\"7.75,11.0\";", 'a4r' => "page=\"8.26,11.69\"; rotate=90;size=\"11.0,7.75\";", 'usr' => "page=\"8.5,11\"; rotate = 90; size = \"10.5,8.0\";", 'us' => "page=\"8.5,11\"; rotate=0; size=\"8.0,10.5\";" , 'a1' => "page=\"594mm,841mm\"; rotate=0; size=\"575mm,820mm\";", 'a1r' => "page=\"594mm,841mm\"; rotate=90; size=\"820mm,575mm\";", 'a3' => "page=\"297mm,420mm\"; rotate=0; size=\"280mm,550mm\";", 'a3r' => "page=\"297mm,420mm\"; rotate=90; size=\"550mm,280mm\";", ); my %paper_ratios = ( 'multi' => "ratio=auto;", 'single' => "ratio=fill;", 'auto' => "ratio=auto;", 'fill' => "ratio=fill;", 'compress' => "ratio=compress;", ); my $paper_headers; my $paper_size_set = 0; my $paper_ratio_set = 0; my ($papers, $pstring); if ($args{'t'}) { foreach $papers (@{$args{'t'}}) { if (defined($pstring = $paper_sizes{$papers})) { $paper_size_set = 1; } elsif (defined($pstring = $paper_ratios{$papers})) { $paper_ratio_set = 1; } else { die "Invalid -t paper type $papers"; } $paper_headers .= " $pstring\n"; } } if (!$paper_size_set) { $paper_headers .= " $paper_sizes{'a4r'}\n"; } if (!$paper_ratio_set) { $paper_headers .= " $paper_ratios{'single'}\n"; } sub isDigits { /\d+/ ? 1 : 0; } my $distance; $distance = 'all' if (!defined($distance = $args{'m'})); die "-m distance can only be a number or \'all\'" if (!($distance =~ /\d+/) && $distance ne 'all') ; my $verbose; $verbose = 0 unless (defined($verbose = $args{'v'})); local (*OUT); if ($args{'o'}) { open( OUT, ">$args{'o'}" ) or die ("Couldn't open output file $args{'o'}"); select(OUT); } print "digraph call {\n"; print " concentrate = true; remincross = true;\n"; print " $paper_headers"; print " fontname=\"helvetica\"\n"; print " fontsize = 12\n"; print " margin=\"0.25\"\n"; print " ranksep=\"0.5\"\n"; print " exact_ranksep=false\n"; print " center = 1\n"; print " label=\"$args{'l'}\"\n" if $args{'l'}; my $xfilename; local (*SRC); if ($#ARGV < 0) { processlines(*STDIN, "stdin"); } else { foreach $xfilename (@ARGV) { print STDERR "processing $xfilename\n"; if (!open(SRC, $xfilename)) { print STDERR "Failed to open $xfilename : $!\n"; next; } processlines(*SRC, $xfilename); close(SRC); } } #Format: filename funcname scope [[%][&]funcname1] [[%][&]funcname2] ... #The function funcname in file filename calls or references functions #funcname1, funcname2 ... ; those with a % are local, with a & are references. # #Format: filename $ 0 [[%]&funcname1] [[%]&funcname2] ... #The file references functions funcname1, funcname2 ... ; those with a % are #local. my %funcdef; my %calls; my %called; my %tempcalled; my %filedef; my %simplefuncname; my %globalmap; # simplefuncname{simplefuncname} -> list of all functions with this name (could # have multiple static definitions) # funcdef{funcname} -> filename # calls{funcname} -> list of called functions # called{funcname} -> list of functions that call funcname directly # # filedef{filename} = list of functions defined in that file # globalmap{globfun} = maps a global function name to a function-filename sub processlines { my ($infile, $fname) = @_; my $lcount = 0; my $calling; my $simplename; while(<$infile>) { chomp; $lcount++; if (length($_) == 0) { next; } my @slist = split(/ /, $_); if (scalar(@slist) < 3) { die ("$fname has invalid line $lcount"); } my ($filename) = shift(@slist); my ($funcname) = shift(@slist); my ($scope) = shift(@slist); if ($funcname eq '$') { next; # ignore for now $funcname = 'BODY'; } $simplename = $funcname; my $funcfilename = "$funcname" . "-$filename"; if ($scope < 2) { $funcname .= "-$filename"; } else { # global symbol $globalmap{$funcname} = $funcfilename; } push(@{$simplefuncname{$simplename}}, $funcfilename); $funcdef{$funcfilename} = $filename; push (@{$filedef{$filename}}, $funcfilename); foreach $calling (@slist) { my $islocal = 0; if ($calling =~ s/^%//) { $islocal = 1; } if ($calling =~ s/^\&//) { # a reference } if ($islocal) { $calling .= "-$filename"; } push (@{$calls{$funcfilename}}, $calling); push (@{$tempcalled{$calling}}, $funcfilename); } #print "$filename should eq $funcdef{$funcname}\n"; #print "function $funcname calling " . join(' ', @{$calls{$funcname}}) . "\n" if (defined($calls{$funcname})); #print "calls " . join(' ', @{$tempcalled{$calling}}) . "\n"; } } sub fixfuncnames { # after reading in, the global names in called and calls must be fixed # up to point to the correct file my ($furef, $fukey, $fumap); foreach $fukey (keys(%tempcalled)) { my ($funcname, $filename) = split(/-/, $fukey); if (!$filename) { if (defined($fumap = $globalmap{$fukey})) { $called{$fumap} = $tempcalled{$fukey}; } else { $called{$fukey} = $tempcalled{$fukey}; } } else { $called{$fukey} = $tempcalled{$fukey}; } } foreach $fukey (keys(%calls)) { foreach $furef (@{$calls{$fukey}}) { my ($funcname, $filename) = split(/-/, $furef); if (!$filename) { if (defined($fumap = $globalmap{$furef})) { $furef = $fumap; } } } } } fixfuncnames(); sub dumpxref { my ($firef, $furef, $ref, $fulist); foreach $firef (keys(%filedef)) { my $lref = $filedef{$firef}; foreach $ref (@{$lref}) { my $funcdname = $ref; my $scope = 2; my $junk = ''; ($funcdname, $junk) = split(/\-/, $ref); if (defined($junk) && length($junk)) { $scope = 1; } if ($funcdname eq 'BODY') { $funcdname = '$'; $scope = 0; } print "$firef $funcdname $scope"; if (!defined($fulist = $calls{$ref})) { print "\n"; next; } foreach $furef (@$fulist) { my $funccname = $furef; $junk = ''; $scope = 2; ($funccname, $junk) = split(/\-/, $furef); if (defined($junk) && length($junk)) { $scope = 1; $funccname = "\%$funccname"; } print " $funccname"; } print "\n"; } } } my %seendnfun; my %seenupfun; my %seenfun; sub seefun { my ($fname) = @_; my ($funcname, $junk, $filename); if (!$seenfun{$fname}) { $seenfun{$fname} = 1; if (!$args{'k'} || defined($filename = $funcdef{$fname})) { # only interested in defined functions ($funcname, $junk) = split(/\-/, $fname); if ($verbose) { print "\"$fname\" [label=\"$funcname\\n$filename\"];\n"; } else { print "\"$fname\" [label=\"$funcname\"];\n"; } } } } sub tracednfunction { my ($fname, $recdepth) = @_; my ($fulist, $funcname, $junk, $filename, $furef); if (!$seendnfun{$fname}) { $seendnfun{$fname} = 1; seefun($fname); if (($distance eq 'all' || $recdepth < $distance) && (defined($fulist = $calls{$fname}))) { foreach $furef (@$fulist) { if (!$args{'k'} || defined($filename = $funcdef{$furef})) { print " \"$fname\" -> \"$furef\";\n"; &tracednfunction($furef, $recdepth+1); } } } } } sub traceupfunction { my ($fname, $recdepth) = @_; my ($fulist, $funcname, $junk, $filename, $furef); if (!$seenupfun{$fname}) { $seenupfun{$fname} = 1; seefun($fname); if (($distance eq 'all' || $recdepth < $distance) && (defined($fulist = $called{$fname}))) { foreach $furef (@$fulist) { if (!$args{'k'} || defined($filename = $funcdef{$furef})) { print " \"$furef\" -> \"$fname\";\n"; &traceupfunction($furef, $recdepth+1); } } } } } sub dumpall { my ($firef, $furef, $fucref, $fulist, $filename ); foreach $firef (keys(%filedef)) { my $lref = $filedef{$firef}; foreach $furef (@{$lref}) { if ($seendnfun{$furef}) { next; } $seendnfun{$furef} = 1; my $funcdname; my $junk = ''; if (!$args{'k'} || defined($filename = $funcdef{$furef})) { # only interested in defined functions if (!defined($fulist = $calls{$furef})) { next; } foreach $fucref (@$fulist) { if (!$args{'k'} || defined($filename = $funcdef{$fucref})) { seefun($furef); seefun($fucref); print " \"$furef\" -> \"$fucref\";\n"; } } } } } } if ($args{'f'}) { # only interested in certain functions my ($fusref, $funame, $furef); foreach $funame (@{$args{'f'}}) { if (defined($fusref = $simplefuncname{$funame})) { foreach $furef (@$fusref) { tracednfunction($furef, 0); traceupfunction($furef, 0); } } } } elsif ($args{'n'}) { # only interested in certain files my ($fusref, $filename, $furef); foreach $filename (@{$args{'n'}}) { if (defined($fusref = $filedef{$filename})) { foreach $furef (@$fusref) { tracednfunction($furef, 0); traceupfunction($furef, 0); } } } } else { &dumpall(); } sub printcluster { my ($cname) = @_; my $first_elt = 1; if (!defined(${filedef{$cname}})) { return; } my $lref = $filedef{$cname}; my $furef; foreach $furef (@{$lref}) { if ($seenfun{$furef}) { if ($first_elt) { $first_elt = 0; print "subgraph \"cluster_$cname\" { label=\"$cname\"\n"; } print " \"$furef\";\n"; } #my $funcdname; #my $junk = ''; #($funcdname, $junk) = split(/\-/, $ref); #print "$funcdname;\n"; } if (!$first_elt) { print "}\n"; } } # now, output any cluster definitions if ($args{'c'}) { my $cname; foreach $cname (@{$args{'c'}}) { if ($cname eq 'all') { my $firef; foreach $firef (keys(%filedef)) { &printcluster($firef); } last; } else { &printcluster($cname); } } } print "}\n"; =head1 NAME xrgr - cxref to graphviz processor =head1 SYNOPSIS B [B<-m> distance] [B<-c> cluster] [B<-n> filename] [B<-f> function] [filespec] [filespec...] =head1 DESCRIPTION Process entries produced by the cxref program from the cxref.function file and produces a .dot file for use with the graphviz program 'dot'. This can be used to produce a printable call tree graph diagram. Graphviz can be obtained from http://www.research.att.com/sw/tools/graphviz/ Various options can be used to limit the view to a few functions or files. =head1 OPTIONS =over 5 =item B<-m> B<--distance> value This controls the number of functions that will be printed out. This represents the calling and called distance to and from the nominated function or file. If the value B<1> was used, only the directly called functions, and the functions that directly called the function or filename of interest would be output. Default value is B, meaning B possible called and calling functions are output. =item B<-n> B<--filename> B<--file> filename Specify the filename(s) of interest. Only functions contained in the file(s) are to printed, together with any called and calling functions, to a depth controlled by the B<-m> or B<--distance> switch. Multiple B<-n> options can be used to specify multiple filenames. =item B<-c> B<--cluster> filename Output the functions in the nominated file(s) as belonging to a cluster. The value B can be used to place all functions in their respective files as clusters. Multiple B<-c> options can be used to specify multiple filenames as clusters. =item B<-f> B<--function> B<--func> function_name Specify the function(s) of interest. Only these functions are to printed, together with any called and calling functions, to a depth controlled by the B<-m> or B<--distance> switch. Multiple B<-f> options can be used to specify multiple functions. =item B<-k> B<--defined> Only functions that are defined in the group of files given to cxref should be output. Otherwise all called functions are included, e.g., stdio functions, etc. =item B<-t> B<--paper> papersize Set the paper size and orientation (a4r default), and whether multi page or single page (single default); Values are B, B, B, B, B, B, B, B for page size and orientation. B for single page, B for multiple pages. You can also use B to force the page to do a lot to fit, but you probably wont be able to read the function names. Use the B<-t> option twice if you wanted to specify a page size and multiple pages. =item B<-v> B<--verbose> Include the filename in the node when displaying the function name. =item B<-l> B<--label> label Specify the label to be printed with the graph. =item B<-o> B<--output> filename Specify the output filename rather than stdout. =item B<-V> B<--version> Version. Print out the current version of the script and exit. =item B<-h> B<--help> Help. Print out this help. =back =head1 EXAMPLES C Produces a graphviz dot file with every function calling or called by B
    , either directly or indirectly. C Produce a graphviz dot file for every function. Cluster all the functions in the module main.c into their own box. =head1 INSTALLATION Copy this script to a suitable place, e.g. /usr/local/bin or ~/bin. =head1 COPYRIGHT Copyright (c) 2002 Jamie Honan. This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Jamie Honan jhonan@optushome.com.au =cut cxref-1.6d/contrib/fixheader.pl 755 233 144 20152 7623235573 11756 0#!/bin/sh # # C Cross Referencing & Documentation tool. Version 1.5. # # A Perl script to determine the required headers for source files. # # Written by Andrew M. Bishop # # This file Copyright 1999 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # exec perl -x $0 $* exit 1 #!perl # The verbose flag $verbose=0; # The output flag $output=0; # The compiler program. $cc="gcc"; $cflags="-Wall -c"; # The cxref options. $cxref_root="."; $cxref_name="cxref"; $cxref_output="."; # The C pre-processor arguments (-D, -I). $cpp_args=""; # The files to check. @files=(); # # Parse the command line arguments # if( $#ARGV==-1 ) { print "Usage: fixheader filename [filename ...] [-v] [-o]\n"; print " [-Odirname] [-Nbasename] [-Rdirname]\n"; print " [-Ddefine] [-Udefine] [-Iinclude]\n"; print "\n"; print "-v Output verbose information during the processing.\n"; print "-o Output a modified source file after testing.\n"; exit 0; } while ( $#ARGV >= 0 ) { $_=$ARGV[0]; switch: { $_ eq '-v' && do { $verbose=1; last switch;}; $_ eq '-o' && do { $output=1; last switch;}; m/^-R/ && die "The -R option is not implemented\n"; m/^-N/ && do { if($_ eq "-N") {shift; $cxref_name=$ARGV[0];} else {$cxref_name=substr($_,2);} last switch;}; m/^-O/ && do { if($_ eq "-O") {shift; $cxref_output=$ARGV[0];} else {$cxref_output=substr($_,2);} last switch;}; -f $_ && do { push(@files,$_); last switch;}; $cpp_args.=" '".$_."'"; } shift; } # # The main program # foreach $file (@files) { # Initialise the headers @cur_headers=&GetFileHeaders($file); @all_headers=@cur_headers; %use_headers=(); if($file =~ m/\.h$/) { @cxref_headers=&GetCxrefHeaders(); foreach $h (@cxref_headers) { next if($file eq substr($h,1,length($h)-2)); foreach $hh (@all_headers) { $h="" if($hh eq $h); } @all_headers=(@all_headers,$h) if($h =~ m/^\"/); @all_headers=($h,@all_headers) if($h =~ m/^\=0) { @all_headers=@cur_headers; } # Try all of the headers if($file =~ m/\.h$/) { print "\nThis is a header file so we should try all possible headers\n" if($verbose); $all=&TryTheseHeaders($file,"all headers",@all_headers); } else { $all=$current; } # Try removing headers print "\nNow we try to remove unneeded headers\n" if($verbose); tryagain: ($remove,@remain_headers)=&TryRemovingHeaders($file,$all,@all_headers); if(($all<0 && $all!=$remove) || $remove<$all) { $all=$remove; @all_headers=@remain_headers; print "\nWe need to try again now we have removed some problem headers\n" if($verbose); goto tryagain; } # Print out a summary print "\nSummary for $file\n\n"; $added=""; foreach $header (@all_headers) { print " Removed: \#include $header\n" if($use_headers{$header}==0); print " Kept : \#include $header\n" if($use_headers{$header}==1); print " Added : \#include $header\n" if($use_headers{$header}==3); $added.=" $header" if($use_headers{$header}==3); } &FixupFile($file,$added) if($output); print "\n"; } # # Get the included headers from an existing file. # sub GetFileHeaders { local($file)=@_; local(@headers)=(); # Parse the file open(IN,"<$file") || die "Cannot open the source file '$file'\n"; while() { push(@headers,$1) if(m/^[ \t]*\#include ([<\"][^>\"]+[>\"])/); } close(IN); return(@headers); } # # Get the headers from the cxref database # sub GetCxrefHeaders { local(@headers)=(); local(%headers)=(); open(INC,"<$cxref_output/$cxref_name.include") || die "Cannot open the cxref database file '$cxref_output/$cxref_name.include'\n"; while() { chop; local($file,@heads)=split(" +"); foreach $h (@heads) { next if($headers{$h}); $headers{$h}=1; if($h =~ m/^%/) { push(@headers,"\"".substr($h,1)."\""); } else { push(@headers,"<".$h.">"); } } } close(INC); return(@headers); } # # Try removing them one at a time. # sub TryRemovingHeaders { local($file,$curr,@headers)=@_; local($best)=$curr; local(@best_headers)=(); foreach $header (reverse(@headers)) { next if($use_headers{$header}==0 || $use_headers{$header}==2); @try_headers=(); foreach $h (@headers) { next if($use_headers{$h}==0 || $use_headers{$h}==2); push(@try_headers,$h) if($h ne $header); } $use_head=$use_headers{$header}; $use_headers{$header}=-1; $try=&TryTheseHeaders($file,"to remove $header",@try_headers); $use_headers{$header}=$use_head; if(($curr>=0 && $try>=0 && $try<=$curr) || ($curr<0 && $try>=0)) { $use_headers{$header}--; } if(($best>=0 && $try>=0 && $try<=$best) || ($best<0 && $try>$best)) { $best=$try; @best_headers=@try_headers; } } return($best,@best_headers); } # # Try the specified headers # sub TryTheseHeaders { local($file,$what,@these)=@_; print " Trying $what .." if($verbose); $result=&TryCompile($file,@these); print " ($result)" if($verbose); if($result>=0) { print " OK\n" if($verbose); } else { print " Failed\n" if($verbose); } return $result; } # # Try compiling the file and see if it works. # sub TryCompile { local($file,@headers)=@_; $length=0; # Modify the file $tmpfile=$file; $tmpfile =~ s/\.([ch])/.cxref.$1.c/; die "Cannot create temporary filename from name '$file'\n" if($file eq $tmpfile); open(IN,"<$file") || die "Cannot open the source file '$file'\n"; open(OUT,">$tmpfile") || die "Cannot create the temporary file '$tmpfile'\n"; foreach $header (@headers) { print OUT "#include $header\n" if($use_headers{$header}==3); } while() { next if(m/^[ \t]*\#include ([<\"][^>\"]+[>\"])/ && $use_headers{$1}!=1); print OUT; } close(IN); close(OUT); # Test the compilation $result=system "$cc $cflags $tmpfile -o /dev/null $cpp_args > $file.cxref-result 2>&1"; chop($length=`wc -l $file.cxref-result | awk '{print \$1}'`); unlink "$tmpfile"; unlink "$file.cxref-result"; $result=($result & 0xffff); if($result) {$length=-1-$length;} return($length); } # # Fixup the headers in the file. # sub FixupFile { local($file,$added)=@_; # Modify the file $newfile=$file; $newfile =~ s/\.([ch])/.cxref.$1/; die "Cannot create temporary filename from name '$file'\n" if($file eq $newfile); open(IN,"<$file") || die "Cannot open the source file '$file'\n"; open(OUT,">$newfile") || die "Cannot create the output file '$newfile'\n"; if($added) { (@added)=split(" ",$added); foreach $h (@added) { printf OUT "#include %-30s /* Added by cxref */\n",$h; } print OUT "\n"; } while() { if(m/^[ \t]*\#include ([<\"][^>\"]+[>\"])(.*)$/) { printf OUT "/* #include %-30s* Removed by cxref */ %s\n",$1,$2 if($use_headers{$1}==0); print OUT $_ if($use_headers{$1}==1); } else { print OUT; } } close(IN); close(OUT); } cxref-1.6d/contrib/cxref_includes.pl 755 233 144 1756 7623235576 13010 0#!/bin/sh # -*- cperl -*- # # C Cross Referencing & Documentation tool. Version 1.5b. # # A Perl script to determine the headers to process from the cxref.include file. # # Written by Andrew M. Bishop # # This file Copyright 1999 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # if [ ! -f "$1" ]; then echo "Usage: $0 cxref.include" exit 1 fi exec perl -x $0 $1 exit 1 #!perl $|=1; open(INCLUDE,"<$ARGV[0]") || die "Cannot open $ARGV[0]\n"; @files=(); while() { ($cfile,@hfiles)=split(/[ \n]+/); foreach $hfile (@hfiles) { push(@files,substr($hfile,1)) if ($hfile =~ m/^%/); } } close(INCLUDE); $lastfile=''; @files=sort(@files); foreach $file (@files) { if($file ne $lastfile) { print "cxref $file\n"; `cxref $file`; } $lastfile=$file; } cxref-1.6d/contrib/includes2cxref.pl 755 233 144 1736 7623235572 12725 0#!/bin/sh # # C Cross Referencing & Documentation tool. Version 1.5b. # # A Perl script to determine the headers to process from the cxref.include file. # # Written by Andrew M. Bishop # # This file Copyright 1999 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # if [ ! -f "$1" ]; then echo "Usage: $0 cxref.include" exit 1 fi exec perl -x $0 $1 exit 1 #!perl $|=1; open(INCLUDE,"<$ARGV[0]") || die "Cannot open $ARGV[0]\n"; @files=(); while() { ($cfile,@hfiles)=split(/[ \n]+/); foreach $hfile (@hfiles) { push(@files,substr($hfile,1)) if ($hfile =~ m/^%/); } } close(INCLUDE); $lastfile=''; @files=sort(@files); foreach $file (@files) { if($file ne $lastfile) { print "cxref $file\n"; `cxref $file`; } $lastfile=$file; } cxref-1.6d/cpp/ 40755 233 144 0 11642337067 6562 5cxref-1.6d/cpp/Makefile.in 644 233 144 5674 11506061166 10650 0# $Header: /home/amb/CVS/cxref/cpp/Makefile.in,v 1.13 2010-10-19 18:17:51 amb Exp $ # # C Cross Referencing & Documentation tool. Version 1.6d. # # CPP Makefile. # # Written by Andrew M. Bishop # # This file Copyright 1995-2010 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # # autoconf things srcdir=@srcdir@ VPATH=@srcdir@ # The installation locations prefix=@prefix@ exec_prefix=@exec_prefix@ datarootdir=@datarootdir@ bindir=$(DESTDIR)@bindir@ mandir=$(DESTDIR)@mandir@ datadir=$(DESTDIR)@datadir@/cxref # The installation program. INSTALL=@INSTALL@ # The C compiler and linker CC=@CC@ LD=@CC@ CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ # The Yacc program YACC=@YACC@ -l ######## INCLUDE=-I. -I$(srcdir) LIBRARY=@LIBS@ ######## programs : @CXREF_CPP@ ######## OBJ_FILES=cccp.o cexp.o prefix.o version.o #### cxref-cpp : $(OBJ_FILES) cxref-cpp.defines $(LD) $(LDFLAGS) $(OBJ_FILES) -o $@ $(LIBRARY) @touch $@ ######## install : programs [ ! -f cxref-cpp ] || [ -d $(bindir) ] || $(INSTALL) -d $(bindir) [ ! -f cxref-cpp ] || $(INSTALL) -m 755 cxref-cpp $(bindir) [ ! -f cxref-cpp ] || $(INSTALL) -m 755 cxref-cpp-configure $(bindir) [ ! -f cxref-cpp ] || [ -d $(mandir)/man1 ] || $(INSTALL) -d $(mandir)/man1 [ ! -f cxref-cpp ] || $(INSTALL) -m 644 $(srcdir)/cxref-cpp.man $(mandir)/man1/cxref-cpp.1 [ ! -f cxref-cpp ] || $(INSTALL) -m 644 $(srcdir)/cxref-cpp-configure.man $(mandir)/man1/cxref-cpp-configure.1 [ ! -f cxref-cpp ] || [ -d $(datadir) ] || $(INSTALL) -d $(datadir) [ ! -f cxref-cpp ] || $(INSTALL) -m 644 cxref-cpp.defines $(datadir) install-win32 : programs [ ! -f cxref-cpp.exe ] || [ -d $(bindir) ] || $(INSTALL) -d $(bindir) [ ! -f cxref-cpp.exe ] || $(INSTALL) -m 755 cxref-cpp.exe $(bindir) [ ! -f cxref-cpp.exe ] || $(INSTALL) -m 755 cxref-cpp-configure $(bindir) [ ! -f cxref-cpp.exe ] || [ -d $(datadir) ] || $(INSTALL) -d $(datadir) [ ! -f cxref-cpp.exe ] || $(INSTALL) -m 644 cxref-cpp.defines $(datadir) ######## clean : -rm -f cxref-cpp cxref-cpp.defines core *.o *~ #### distclean : clean -rm -f Makefile cxref-cpp-configure autoconfig.h \ config.log config.status config.cache conftest.gcc ######## cccp.o : cccp.c config.h pcp.h autoconfig.h $(CC) -c $(CFLAGS) $< -o $@ $(INCLUDE) -DIN_GCC \ '-DCXREF_CPP_DEFINES="$(datadir)/cxref-cpp.defines"' @touch $@ cexp.o : cexp.c config.h autoconfig.h gansidecl.h ansidecl.h system.h libiberty.h intl.h $(CC) -c $(CFLAGS) $< -o $@ $(INCLUDE) -DIN_GCC @touch $@ prefix.o : prefix.c config.h autoconfig.h gansidecl.h ansidecl.h system.h libiberty.h prefix.h $(CC) -c $(CFLAGS) $< -o $@ $(INCLUDE) -DIN_GCC -DPREFIX=\"/\" @touch $@ version.o : version.c $(CC) -c $(CFLAGS) $< -o $@ $(INCLUDE) -DIN_GCC @touch $@ ######## cxref-cpp.defines : cxref-cpp-configure ./cxref-cpp-configure $(CC) -o $@ ######## cxref-1.6d/cpp/README 644 233 144 16753 11506061166 7503 0 C Cross Referencing & Documenting tool Version 1.6a - cxref-cpp =============================================================== Introduction ------------ This pre-processor is a modified version of the gcc-2.95.3 pre-processor with modifications to make cxref work better. Previous versions of cxref used the pre-processor from gcc-2.7.2. History ------- Depending on the version of gcc that you have installed you may, or may not, need to use this program as the cxref pre-processor. In those cases where you can use your existing gcc version you may still wish to use this program. The table below shows the need for this program depending on the version of gcc installed. GCC version Need for cxref-cpp ----------- ------------------ none Yes (1) < 2.8.0 Yes (1) 2.8.0 - 2.95.3 (?) Optional (not used by default) (2) 3.0.0 (?) - 3.x.y Recommended (used by default) (3) (1) If you do not have gcc installed or it is a version before 2.8.0 then you will need to use cxref-cpp as the pre-processor or the cxref program will not be able to work. This pre-processor includes modifications to pass more information about the original source code through to the output. (2) With gcc version 2.8.0 the required modifications to the pre-processor were included into the mainline of gcc. (3) With gcc version 3.0.0 there was a rewrite of the pre-processor and some of the modifications that were included in version 2.8.0 were removed of modified. In particular the changes that were made mean that comments that follow on the same line as a #define statement or a #include statement are lost. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13726 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14342 for gcc bug reports. Implementation -------------- This program is a copy of the gcc-2.95.3 pre-processor with some modifications that allow it to use the built-in pre-processor definitions from any other version of gcc. The files are modified in the following way. ansidecl.h - Unmodified original from gcc-2.95.3. cexp.c - Unmodified original from gcc-2.95.3. cexp.y - Unmodified original from gcc-2.95.3. gansidecl.h - Unmodified original from gcc-2.95.3. intl.h - Unmodified original from gcc-2.95.3. pcp.h - Unmodified original from gcc-2.95.3. prefix.h - Unmodified original from gcc-2.95.3. system.h - Unmodified original from gcc-2.95.3. libiberty.h - Empty file required for inclusion in system.h prefix.c - Modified from gcc-2.95.3 * Added function prototype. version.c - Modified from gcc-2.95.3 * Version number indicates cxref specific version. cccp.c - Modified from gcc-2.95.3 * Changed to work with cxref . New -cxref-cpp-defines option. . Allow gcc 3.x "-Afoo=bar" options. . Skip standard #defines. . No built-in include paths. * Debian/egcs patch to handle DOS newlines after backslash. config.h - A replacement for the original that has miscellaneous definitions missing from elsewhere and includes the autoconfig.h file. Configuration ------------- There is a standard GNU configure script that should be used to configure cxref-cpp. This is normally called by the configure script in the main directory. The configure script takes two options that control the usage of this program or the installed gcc pre-processor: --with-cxref-cpp and --without-cxref-cpp. By default the configure script will decide if the installed gcc will work fully on its own. The option --with-cxref-cpp will override this decision and force cxref-cpp to be used even if the version of gcc is suitable. The option --without-cxref-cpp will override the automatic decision and force gcc to be used even if it is not suitable. If the automatic configuration fails then the information in the following sections detail what the cxref-cpp-configure script works out. The information is put into the runtime configuration file (cxref-cpp.defines) automatically, only in the case of a problem should it be changed manually. PREDEFINES, INCLUDES and DEFINES -------------------------------- [Note that what follows applies to gcc, other compilers may be different] The cxref-cpp program needs to have the same include directories and predefined macros built in to the program as gcc. This is so that cxref-cpp and gcc have the same behaviour when processing the source files. Use `gcc -E -v -dM - < /dev/null' to see the list of include paths and predefined macros. Those marked `->' below are important. | Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs | gcc version 2.5.8 P -> | /usr/lib/gcc-lib/i486-linux/2.5.8/cpp -lang-c -v -undef \ -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dunix -Di386 -Dlinux -D__unix__ \ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -D__i486__ \ -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) \ -dM - | GNU CPP version 2.5.8 (80386, BSD syntax) | #include "..." search starts here: | #include <...> search starts here: I -> | /usr/local/include I -> | /usr/i486-linux/include I -> | /usr/lib/gcc-lib/i486-linux/2.5.8/include I -> | /usr/include | End of search list. D -> | #define __linux__ 1 D -> | #define linux 1 D -> | #define __i386__ 1 D -> | #define __i386 1 D -> | #define __GNUC_MINOR__ 5 D -> | #define __i486__ 1 D -> | #define i386 1 D -> | #define __unix 1 D -> | #define __unix__ 1 D -> | #define __GNUC__ 2 D -> | #define __linux 1 D -> | #define unix 1 P The command line that is used when gcc calls cpp. Notice that it includes a number of flags that change the default action of cpp. (Try doing 'cpp -v -dM - < /dev/null' to see the difference.) Note the -D... and -A... command line flags, these are the PREDEFINES. I The include files that are built into the cpp program. This list of directories are the INCLUDES. D The pre-defined #defines used for all pre-processing. This list of #defines are the DEFINES. The cxref-cpp runtime configuration file cxref-cpp.defines is created from the PREDEFINES, INCLUDES and DEFINES. Each item in the PREDEFINES list appears following a C++ comment '//' and a space character, each item in the INCLUDES list appears following a C++ comment, a space and '-I' and each item in the DEFINES list appears on a line on its own. For the example output above the cxref-cpp.defines file would look like the following: // -D__GNUC__=2 // -D__GNUC_MINOR__=95 // -Dunix // -Di386 // -Dlinux // -D__unix__ // -D__i386__ // -D__linux__ // -D__unix // -D__i386 // -D__linux // -D__i486__ // -Asystem(unix) // -Asystem(posix) // -Acpu(i386) // -Amachine(i386) // -I/usr/local/include // -I/usr/i486-linux/include // -I/usr/lib/gcc-lib/i486-linux/2.5.8/include // -I/usr/include #define __linux__ 1 #define linux 1 #define __i386__ 1 #define __i386 1 #define __GNUC_MINOR__ 5 #define __i486__ 1 #define i386 1 #define __unix 1 #define __unix__ 1 #define __GNUC__ 2 #define __linux 1 #define unix 1 Testing ------- When cxref-cpp has been made use 'cxref-cpp -v -dM - < /dev/null' and check that the include directories and predefines are the same as those for gcc by using 'gcc -E -v -dM - < /dev/null'. You will need to run cxref-cpp with the option '-cxref-cpp-defines ./cxref-cpp.defines' if you have not installed the file cxref-cpp.defines. cxref-1.6d/cpp/ansidecl.h 444 233 144 11400 6621327221 10513 0/* ANSI and traditional C compatability macros Copyright 1991, 1992, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* ANSI and traditional C compatibility macros ANSI C is assumed if __STDC__ is #defined. Macro ANSI C definition Traditional C definition ----- ---- - ---------- ----------- - ---------- PTR `void *' `char *' LONG_DOUBLE `long double' `double' VOLATILE `volatile' `' SIGNED `signed' `' PTRCONST `void *const' `char *' ANSI_PROTOTYPES 1 not defined CONST is also defined, but is obsolete. Just use const. obsolete -- DEFUN (name, arglist, args) Defines function NAME. ARGLIST lists the arguments, separated by commas and enclosed in parentheses. ARGLIST becomes the argument list in traditional C. ARGS list the arguments with their types. It becomes a prototype in ANSI C, and the type declarations in traditional C. Arguments should be separated with `AND'. For functions with a variable number of arguments, the last thing listed should be `DOTS'. obsolete -- DEFUN_VOID (name) Defines a function NAME, which takes no arguments. obsolete -- EXFUN (name, (prototype)) -- obsolete. Replaced by PARAMS. Do not use; will disappear someday soon. Was used in external function declarations. In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in parentheses). In traditional C it is `NAME()'. For a function that takes no arguments, PROTOTYPE should be `(void)'. obsolete -- PROTO (type, name, (prototype) -- obsolete. This one has also been replaced by PARAMS. Do not use. PARAMS ((args)) We could use the EXFUN macro to handle prototype declarations, but the name is misleading and the result is ugly. So we just define a simple macro to handle the parameter lists, as in: static int foo PARAMS ((int, char)); This produces: `static int foo();' or `static int foo (int, char);' EXFUN would have done it like this: static int EXFUN (foo, (int, char)); but the function is not external...and it's hard to visually parse the function name out of the mess. EXFUN should be considered obsolete; new code should be written to use PARAMS. DOTS is also obsolete. Examples: extern int printf PARAMS ((const char *format, ...)); */ #ifndef _ANSIDECL_H #define _ANSIDECL_H 1 /* Every source file includes this file, so they will all get the switch for lint. */ /* LINTLIBRARY */ #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) /* All known AIX compilers implement these things (but don't always define __STDC__). The RISC/OS MIPS compiler defines these things in SVR4 mode, but does not define __STDC__. */ #define PTR void * #define PTRCONST void *CONST #define LONG_DOUBLE long double #ifndef IN_GCC #define AND , #define NOARGS void #define VOLATILE volatile #define SIGNED signed #endif /* ! IN_GCC */ #define PARAMS(paramlist) paramlist #define ANSI_PROTOTYPES 1 #define VPARAMS(ARGS) ARGS #define VA_START(va_list,var) va_start(va_list,var) /* These are obsolete. Do not use. */ #ifndef IN_GCC #define CONST const #define DOTS , ... #define PROTO(type, name, arglist) type name arglist #define EXFUN(name, proto) name proto #define DEFUN(name, arglist, args) name(args) #define DEFUN_VOID(name) name(void) #endif /* ! IN_GCC */ #else /* Not ANSI C. */ #define PTR char * #define PTRCONST PTR #define LONG_DOUBLE double #ifndef IN_GCC #define AND ; #define NOARGS #define VOLATILE #define SIGNED #endif /* !IN_GCC */ #ifndef const /* some systems define it in header files for non-ansi mode */ #define const #endif #define PARAMS(paramlist) () #define VPARAMS(ARGS) (va_alist) va_dcl #define VA_START(va_list,var) va_start(va_list) /* These are obsolete. Do not use. */ #ifndef IN_GCC #define CONST #define DOTS #define PROTO(type, name, arglist) type name () #define EXFUN(name, proto) name() #define DEFUN(name, arglist, args) name arglist args; #define DEFUN_VOID(name) name() #endif /* ! IN_GCC */ #endif /* ANSI C. */ #endif /* ansidecl.h */ cxref-1.6d/cpp/autoconfig.h.in 644 233 144 4453 11506061166 11511 0/*************************************** $Header: /home/amb/CVS/cxref/cpp/autoconfig.h.in,v 1.4 2004-06-20 13:13:42 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1999,2004 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /* Misc */ /* Define to empty if the keyword does not work. */ #undef const /* Storage */ /* The number of bytes in a int. */ #undef SIZEOF_INT /* The number of bytes in a long. */ #undef SIZEOF_LONG /* The number of bytes in a long. */ #undef SIZEOF_LONG_LONG /* Functions */ /* Define if you have the bcmp function. */ #undef HAVE_BCMP /* Define if you have the bcopy function. */ #undef HAVE_BCOPY /* Define if you have the bzero function. */ #undef HAVE_BZERO /* Define if you have the index function. */ #undef HAVE_INDEX /* Define if you have the rindex function. */ #undef HAVE_RINDEX /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the strsignal function. */ #undef HAVE_STRSIGNAL /* Include files */ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_LOCALE_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_STRINGS_H /* Define if you have the header file. */ #undef HAVE_TIME_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_SYS_WAIT_H cxref-1.6d/cpp/cccp.c 644 233 144 1133367 11506061166 7741 0/* C Compatible Compiler Preprocessor (CCCP) Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. Written by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 Modfied for use as cxref-cpp by Andrew M. Bishop 2004. Changes marked with 'AMB' in the code. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" #include #ifdef HAVE_SYS_RESOURCE_H # include #endif typedef unsigned char U_CHAR; #include "pcp.h" #include "intl.h" #include "prefix.h" #ifdef MULTIBYTE_CHARS #include "mbchar.h" #include #endif /* MULTIBYTE_CHARS */ #ifndef GET_ENV_PATH_LIST #define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0) #endif #ifndef STANDARD_INCLUDE_DIR # define STANDARD_INCLUDE_DIR "/usr/include" #endif /* By default, colon separates directories in a path. */ #ifndef PATH_SEPARATOR # define PATH_SEPARATOR ':' #endif /* By default, a slash separates directory names. */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' #endif /* By default, the suffix for object files is ".o". */ #ifdef OBJECT_SUFFIX # define HAVE_OBJECT_SUFFIX #else # define OBJECT_SUFFIX ".o" #endif /* VMS-specific definitions */ #ifdef VMS #include #include #include #define open(fname,mode,prot) VMS_open (fname,mode,prot) #define fopen(fname,mode) VMS_fopen (fname,mode) #define freopen(fname,mode,ofile) VMS_freopen (fname,mode,ofile) #define fstat(fd,stbuf) VMS_fstat (fd,stbuf) static int VMS_fstat (), VMS_stat (); static int VMS_open (); static FILE *VMS_fopen (); static FILE *VMS_freopen (); static int hack_vms_include_specification (); #define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a))) #define INO_T_HASH(a) 0 #define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */ #endif /* VMS */ /* Windows does not natively support inodes, and neither does MSDOS. */ #if (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN)) \ || defined (__MSDOS__) #define INO_T_EQ(a, b) 0 #endif #ifndef INO_T_EQ #define INO_T_EQ(a, b) ((a) == (b)) #endif #ifndef INO_T_HASH #define INO_T_HASH(a) (a) #endif #ifndef INCLUDE_LEN_FUDGE #define INCLUDE_LEN_FUDGE 0 #endif /* External declarations. */ extern char *version_string; HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT)); HOST_WIDEST_INT parse_c_expression PROTO((char *, int)); /* Name under which this program was invoked. */ static char *progname; /* Nonzero means use extra default include directories for C++. */ static int cplusplus; /* Nonzero means handle cplusplus style comments */ static int cplusplus_comments; /* Nonzero means handle #import, for objective C. */ static int objc; /* Nonzero means this is an assembly file, and allow unknown directives, which could be comments. */ static int lang_asm; /* Current maximum length of directory names in the search path for include files. (Altered as we get more of them.) */ static int max_include_len; /* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */ static int for_lint = 0; /* Nonzero means copy comments into the output file. */ static int put_out_comments = 0; /* Nonzero means don't process the ANSI trigraph sequences. */ static int no_trigraphs = 0; /* Nonzero means print the names of included files rather than the preprocessed output. 1 means just the #include "...", 2 means #include <...> as well. */ static int print_deps = 0; /* Nonzero if missing .h files in -M output are assumed to be generated files and not errors. */ static int print_deps_missing_files = 0; /* Nonzero means print names of header files (-H). */ static int print_include_names = 0; /* Nonzero means don't output line number information. */ static int no_line_directives; /* Nonzero means output the text in failing conditionals, inside #failed ... #endfailed. */ static int output_conditionals; /* dump_only means inhibit output of the preprocessed text and instead output the definitions of all user-defined macros in a form suitable for use as input to cccp. dump_names means pass #define and the macro name through to output. dump_definitions means pass the whole definition (plus #define) through */ static enum {dump_none, dump_only, dump_names, dump_definitions} dump_macros = dump_none; /* Nonzero means pass all #define and #undef directives which we actually process through to the output stream. This feature is used primarily to allow cc1 to record the #defines and #undefs for the sake of debuggers which understand about preprocessor macros, but it may also be useful with -E to figure out how symbols are defined, and where they are defined. */ static int debug_output = 0; /* Nonzero means pass #include lines through to the output, even if they are ifdefed out. */ static int dump_includes; /* Nonzero indicates special processing used by the pcp program. The special effects of this mode are: Inhibit all macro expansion, except those inside #if directives. Process #define directives normally, and output their contents to the output file. Output preconditions to pcp_outfile indicating all the relevant preconditions for use of this file in a later cpp run. */ static FILE *pcp_outfile; /* Nonzero means we are inside an IF during a -pcp run. In this mode macro expansion is done, and preconditions are output for all macro uses requiring them. */ static int pcp_inside_if; /* Nonzero means never to include precompiled files. This is 1 since there's no way now to make precompiled files, so it's not worth testing for them. */ static int no_precomp = 1; /* Nonzero means give all the error messages the ANSI standard requires. */ int pedantic; /* Nonzero means try to make failure to fit ANSI C an error. */ static int pedantic_errors; /* Nonzero means don't print warning messages. -w. */ static int inhibit_warnings = 0; /* Nonzero means warn if slash-star appears in a slash-star comment, or if newline-backslash appears in a slash-slash comment. */ static int warn_comments; /* Nonzero means warn if a macro argument is (or would be) stringified with -traditional. */ static int warn_stringify; /* Nonzero means warn if there are any trigraphs. */ static int warn_trigraphs; /* Nonzero means warn if undefined identifiers are evaluated in an #if. */ static int warn_undef; /* Nonzero means warn if #import is used. */ static int warn_import = 1; /* Nonzero means turn warnings into errors. */ static int warnings_are_errors; /* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */ int traditional; /* Nonzero for the 1989 C Standard, including corrigenda and amendments. */ int c89; /* Nonzero for the 199x C Standard. */ int c9x; /* Nonzero causes output not to be done, but directives such as #define that have side effects are still obeyed. */ static int no_output; /* Nonzero means we should look for header.gcc files that remap file names. */ static int remap; /* Nonzero means this file was included with a -imacros or -include command line and should not be recorded as an include file. */ static int no_record_file; /* Nonzero means that we have finished processing the command line options. This flag is used to decide whether or not to issue certain errors and/or warnings. */ static int done_initializing = 0; /* Line where a newline was first seen in a string constant. */ static int multiline_string_line = 0; /* I/O buffer structure. The `fname' field is nonzero for source files and #include files and for the dummy text used for -D and -U. It is zero for rescanning results of macro expansion and for expanding macro arguments. */ #define INPUT_STACK_MAX 400 static struct file_buf { char *fname; /* Filename specified with #line directive. */ char *nominal_fname; /* The length of nominal_fname, which may contain embedded NULs. */ size_t nominal_fname_len; /* Include file description. */ struct include_file *inc; /* Record where in the search path this file was found. For #include_next. */ struct file_name_list *dir; int lineno; int length; U_CHAR *buf; U_CHAR *bufp; /* Macro that this level is the expansion of. Included so that we can reenable the macro at the end of this level. */ struct hashnode *macro; /* Value of if_stack at start of this file. Used to prohibit unmatched #endif (etc) in an include file. */ struct if_stack *if_stack; /* Object to be freed at end of input at this level. */ U_CHAR *free_ptr; /* True if this is a system header file; see is_system_include. */ char system_header_p; } instack[INPUT_STACK_MAX]; static int last_error_tick; /* Incremented each time we print it. */ static int input_file_stack_tick; /* Incremented when the status changes. */ /* Current nesting level of input sources. `instack[indepth]' is the level currently being read. */ static int indepth = -1; #define CHECK_DEPTH(code) \ if (indepth >= (INPUT_STACK_MAX - 1)) \ { \ error_with_line (line_for_error (instack[indepth].lineno), \ "macro or `#include' recursion too deep"); \ code; \ } /* Current depth in #include directives that use <...>. */ static int system_include_depth = 0; typedef struct file_buf FILE_BUF; /* The output buffer. Its LENGTH field is the amount of room allocated for the buffer, not the number of chars actually present. To get that, subtract outbuf.buf from outbuf.bufp. */ #define OUTBUF_SIZE 10 /* initial size of output buffer */ static FILE_BUF outbuf; /* Grow output buffer OBUF points at so it can hold at least NEEDED more chars. */ #define check_expand(OBUF, NEEDED) \ (((OBUF)->length - ((OBUF)->bufp - (OBUF)->buf) <= (NEEDED)) \ ? grow_outbuf ((OBUF), (NEEDED)) : 0) struct file_name_list { struct file_name_list *next; /* If the following is 1, it is a C-language system include directory. */ int c_system_include_path; /* Mapping of file names for this directory. */ struct file_name_map *name_map; /* Non-zero if name_map is valid. */ int got_name_map; /* The include directory status. */ struct stat st; /* The include prefix: "" denotes the working directory, otherwise fname must end in '/'. The actual size is dynamically allocated. */ char fname[1]; }; #define GCC_INCLUDE_DIR "." /* Not used - AMB */ #define INCLUDE_DEFAULTS { { 0, 0, 0, 0, 0 } } /* No built-in include dirs - AMB */ /* #include "file" looks in source file dir, then stack. */ /* #include just looks in the stack. */ /* -I directories are added to the end, then the defaults are added. */ /* The */ static struct default_include { char *fname; /* The name of the directory. */ char *component; /* The component containing the directory */ int cplusplus; /* Only look here if we're compiling C++. */ int cxx_aware; /* Includes in this directory don't need to be wrapped in extern "C" when compiling C++. */ int included; /* Set if the directory is acceptable. */ } include_defaults_array[] #ifdef INCLUDE_DEFAULTS = INCLUDE_DEFAULTS; #else = { /* Pick up GNU C++ specific include files. */ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0 }, #ifdef CROSS_COMPILE /* This is the dir for fixincludes. Put it just before the files that we fix. */ { GCC_INCLUDE_DIR, "GCC", 0, 0, 0 }, /* For cross-compilation, this dir name is generated automatically in Makefile.in. */ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0 }, #ifdef TOOL_INCLUDE_DIR /* This is another place that the target system's headers might be. */ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 }, #endif #else /* not CROSS_COMPILE */ #ifdef LOCAL_INCLUDE_DIR /* This should be /usr/local/include and should come before the fixincludes-fixed header files. */ { LOCAL_INCLUDE_DIR, 0, 0, 1, 0 }, #endif #ifdef TOOL_INCLUDE_DIR /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here. Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 }, #endif /* This is the dir for fixincludes. Put it just before the files that we fix. */ { GCC_INCLUDE_DIR, "GCC", 0, 0, 0 }, /* Some systems have an extra dir of include files. */ #ifdef SYSTEM_INCLUDE_DIR { SYSTEM_INCLUDE_DIR, 0, 0, 0, 0 }, #endif #ifndef STANDARD_INCLUDE_COMPONENT #define STANDARD_INCLUDE_COMPONENT 0 #endif { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 0 }, #endif /* not CROSS_COMPILE */ { 0, 0, 0, 0, 0 } }; #endif /* no INCLUDE_DEFAULTS */ /* The code looks at the defaults through this pointer, rather than through the constant structure above. This pointer gets changed if an environment variable specifies other defaults. */ static struct default_include *include_defaults = include_defaults_array; static struct file_name_list *include = 0; /* First dir to search */ /* First dir to search for */ /* This is the first element to use for #include <...>. If it is 0, use the entire chain for such includes. */ static struct file_name_list *first_bracket_include = 0; /* This is the first element in the chain that corresponds to a directory of system header files. */ static struct file_name_list *first_system_include = 0; static struct file_name_list *last_include = 0; /* Last in chain */ /* Chain of include directories to put at the end of the other chain. */ static struct file_name_list *after_include = 0; static struct file_name_list *last_after_include = 0; /* Last in chain */ /* Chain to put at the start of the system include files. */ static struct file_name_list *before_system = 0; static struct file_name_list *last_before_system = 0; /* Last in chain */ /* Directory prefix that should replace `/usr' in the standard include file directories. */ static char *include_prefix; /* File to include that contains the gcc definitions for cxref-cpp - AMB */ static char *cxref_cpp_defines=CXREF_CPP_DEFINES; /* Maintain and search list of included files. */ struct include_file { struct include_file *next; /* for include_hashtab */ struct include_file *next_ino; /* for include_ino_hashtab */ char *fname; /* If the following is the empty string, it means #pragma once was seen in this include file, or #import was applied to the file. Otherwise, if it is nonzero, it is a macro name. Don't include the file again if that macro is defined. */ U_CHAR *control_macro; /* Nonzero if the dependency on this include file has been output. */ int deps_output; struct stat st; }; /* Hash tables of files already included with #include or #import. include_hashtab is by full name; include_ino_hashtab is by inode number. */ #define INCLUDE_HASHSIZE 61 static struct include_file *include_hashtab[INCLUDE_HASHSIZE]; static struct include_file *include_ino_hashtab[INCLUDE_HASHSIZE]; /* Global list of strings read in from precompiled files. This list is kept in the order the strings are read in, with new strings being added at the end through stringlist_tailp. We use this list to output the strings at the end of the run. */ static STRINGDEF *stringlist; static STRINGDEF **stringlist_tailp = &stringlist; /* Structure returned by create_definition */ typedef struct macrodef MACRODEF; struct macrodef { struct definition *defn; U_CHAR *symnam; int symlen; }; enum sharp_token_type { NO_SHARP_TOKEN = 0, /* token not present */ SHARP_TOKEN = '#', /* token spelled with # only */ WHITE_SHARP_TOKEN, /* token spelled with # and white space */ PERCENT_COLON_TOKEN = '%', /* token spelled with %: only */ WHITE_PERCENT_COLON_TOKEN /* token spelled with %: and white space */ }; /* Structure allocated for every #define. For a simple replacement such as #define foo bar , nargs = -1, the `pattern' list is null, and the expansion is just the replacement text. Nargs = 0 means a functionlike macro with no args, e.g., #define getchar() getc (stdin) . When there are args, the expansion is the replacement text with the args squashed out, and the reflist is a list describing how to build the output from the input: e.g., "3 chars, then the 1st arg, then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg". The chars here come from the expansion. Whatever is left of the expansion after the last arg-occurrence is copied after that arg. Note that the reflist can be arbitrarily long--- its length depends on the number of times the arguments appear in the replacement text, not how many args there are. Example: #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and pattern list { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL } where (x, y) means (nchars, argno). */ typedef struct definition DEFINITION; struct definition { int nargs; int length; /* length of expansion string */ int predefined; /* True if the macro was builtin or */ /* came from the command line */ U_CHAR *expansion; int line; /* Line number of definition */ char *file; /* File of definition */ size_t file_len; /* Length of file (which can contain NULs) */ char rest_args; /* Nonzero if last arg. absorbs the rest */ struct reflist { struct reflist *next; enum sharp_token_type stringify; /* set if a # operator before arg */ enum sharp_token_type raw_before; /* set if a ## operator before arg */ enum sharp_token_type raw_after; /* set if a ## operator after arg */ char rest_args; /* Nonzero if this arg. absorbs the rest */ int nchars; /* Number of literal chars to copy before this arg occurrence. */ int argno; /* Number of arg to substitute (origin-0) */ } *pattern; union { /* Names of macro args, concatenated in reverse order with comma-space between them. The only use of this is that we warn on redefinition if this differs between the old and new definitions. */ U_CHAR *argnames; } args; }; /* different kinds of things that can appear in the value field of a hash node. Actually, this may be useless now. */ union hashval { char *cpval; DEFINITION *defn; KEYDEF *keydef; }; /* * special extension string that can be added to the last macro argument to * allow it to absorb the "rest" of the arguments when expanded. Ex: * #define wow(a, b...) process (b, a, b) * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); } * { wow (one, two); } -> { process (two, one, two); } * if this "rest_arg" is used with the concat token '##' and if it is not * supplied then the token attached to with ## will not be outputted. Ex: * #define wow (a, b...) process (b ## , a, ## b) * { wow (1, 2); } -> { process (2, 1, 2); } * { wow (one); } -> { process (one); { */ static char rest_extension[] = "..."; #define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1) /* This is the implicit parameter name when using variable number of parameters for macros using the ISO C 9x extension. */ static char va_args_name[] = "__VA_ARGS__"; #define VA_ARGS_NAME_LENGTH (sizeof (va_args_name) - 1) /* The structure of a node in the hash table. The hash table has entries for all tokens defined by #define directives (type T_MACRO), plus some special tokens like __LINE__ (these each have their own type, and the appropriate code is run when that type of node is seen. It does not contain control words like "#define", which are recognized by a separate piece of code. */ /* different flavors of hash nodes --- also used in keyword table */ enum node_type { T_DEFINE = 1, /* the `#define' keyword */ T_INCLUDE, /* the `#include' keyword */ T_INCLUDE_NEXT, /* the `#include_next' keyword */ T_IMPORT, /* the `#import' keyword */ T_IFDEF, /* the `#ifdef' keyword */ T_IFNDEF, /* the `#ifndef' keyword */ T_IF, /* the `#if' keyword */ T_ELSE, /* `#else' */ T_PRAGMA, /* `#pragma' */ T_ELIF, /* `#elif' */ T_UNDEF, /* `#undef' */ T_LINE, /* `#line' */ T_ERROR, /* `#error' */ T_WARNING, /* `#warning' */ T_ENDIF, /* `#endif' */ T_SCCS, /* `#sccs', used on system V. */ T_IDENT, /* `#ident', used on system V. */ T_ASSERT, /* `#assert', taken from system V. */ T_UNASSERT, /* `#unassert', taken from system V. */ T_SPECLINE, /* special symbol `__LINE__' */ T_DATE, /* `__DATE__' */ T_FILE, /* `__FILE__' */ T_BASE_FILE, /* `__BASE_FILE__' */ T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */ T_VERSION, /* `__VERSION__' */ T_SIZE_TYPE, /* `__SIZE_TYPE__' */ T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */ T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */ T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */ T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */ T_IMMEDIATE_PREFIX_TYPE, /* `__IMMEDIATE_PREFIX__' */ T_TIME, /* `__TIME__' */ T_CONST, /* Constant value, used by `__STDC__' */ T_MACRO, /* macro defined by `#define' */ T_DISABLED, /* macro temporarily turned off for rescan */ T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */ T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */ T_UNUSED /* Used for something not defined. */ }; struct hashnode { struct hashnode *next; /* double links for easy deletion */ struct hashnode *prev; struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash chain is kept, in case the node is the head of the chain and gets deleted. */ enum node_type type; /* type of special token */ int length; /* length of token, for quick comparison */ U_CHAR *name; /* the actual name */ union hashval value; /* pointer to expansion, or whatever */ }; typedef struct hashnode HASHNODE; /* Some definitions for the hash table. The hash function MUST be computed as shown in hashf () below. That is because the rescan loop computes the hash value `on the fly' for most tokens, in order to avoid the overhead of a lot of procedure calls to the hashf () function. Hashf () only exists for the sake of politeness, for use when speed isn't so important. */ #define HASHSIZE 1403 static HASHNODE *hashtab[HASHSIZE]; #define HASHSTEP(old, c) ((old << 2) + c) #define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */ /* We let tm.h override the types used here, to handle trivial differences such as the choice of unsigned int or long unsigned int for size_t. When machines start needing nontrivial differences in the size type, it would be best to do something here to figure out automatically from other information what type to use. */ /* The string value for __SIZE_TYPE__. */ #ifndef SIZE_TYPE #define SIZE_TYPE "long unsigned int" #endif /* The string value for __PTRDIFF_TYPE__. */ #ifndef PTRDIFF_TYPE #define PTRDIFF_TYPE "long int" #endif /* The string value for __WCHAR_TYPE__. */ #ifndef WCHAR_TYPE #define WCHAR_TYPE "int" #endif char * wchar_type = WCHAR_TYPE; #undef WCHAR_TYPE /* The string value for __USER_LABEL_PREFIX__ */ #ifndef USER_LABEL_PREFIX #define USER_LABEL_PREFIX "" #endif char * user_label_prefix = USER_LABEL_PREFIX; #undef USER_LABEL_PREFIX /* The string value for __REGISTER_PREFIX__ */ #ifndef REGISTER_PREFIX #define REGISTER_PREFIX "" #endif /* The string value for __IMMEDIATE_PREFIX__ */ #ifndef IMMEDIATE_PREFIX #define IMMEDIATE_PREFIX "" #endif /* In the definition of a #assert name, this structure forms a list of the individual values asserted. Each value is itself a list of "tokens". These are strings that are compared by name. */ struct tokenlist_list { struct tokenlist_list *next; struct arglist *tokens; }; struct assertion_hashnode { struct assertion_hashnode *next; /* double links for easy deletion */ struct assertion_hashnode *prev; /* also, a back pointer to this node's hash chain is kept, in case the node is the head of the chain and gets deleted. */ struct assertion_hashnode **bucket_hdr; int length; /* length of token, for quick comparison */ U_CHAR *name; /* the actual name */ /* List of token-sequences. */ struct tokenlist_list *value; }; typedef struct assertion_hashnode ASSERTION_HASHNODE; /* Some definitions for the hash table. The hash function MUST be computed as shown in hashf below. That is because the rescan loop computes the hash value `on the fly' for most tokens, in order to avoid the overhead of a lot of procedure calls to the hashf function. hashf only exists for the sake of politeness, for use when speed isn't so important. */ #define ASSERTION_HASHSIZE 37 static ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE]; /* Nonzero means inhibit macroexpansion of what seem to be assertion tests, in rescan. For #if. */ static int assertions_flag; /* `struct directive' defines one #-directive, including how to handle it. */ #define DO_PROTO PROTO((U_CHAR *, U_CHAR *, FILE_BUF *, struct directive *)) struct directive { int length; /* Length of name */ int (*func) DO_PROTO; /* Function to handle directive */ char *name; /* Name of directive */ enum node_type type; /* Code which describes which directive. */ }; #define IS_INCLUDE_DIRECTIVE_TYPE(t) \ ((int) T_INCLUDE <= (int) (t) && (int) (t) <= (int) T_IMPORT) /* These functions are declared to return int instead of void since they are going to be placed in the table and some old compilers have trouble with pointers to functions returning void. */ static int do_assert DO_PROTO; static int do_define DO_PROTO; static int do_elif DO_PROTO; static int do_else DO_PROTO; static int do_endif DO_PROTO; static int do_error DO_PROTO; static int do_ident DO_PROTO; static int do_if DO_PROTO; static int do_include DO_PROTO; static int do_line DO_PROTO; static int do_pragma DO_PROTO; #ifdef SCCS_DIRECTIVE static int do_sccs DO_PROTO; #endif static int do_unassert DO_PROTO; static int do_undef DO_PROTO; static int do_warning DO_PROTO; static int do_xifdef DO_PROTO; /* Here is the actual list of #-directives, most-often-used first. */ static struct directive directive_table[] = { { 6, do_define, "define", T_DEFINE}, { 2, do_if, "if", T_IF}, { 5, do_xifdef, "ifdef", T_IFDEF}, { 6, do_xifdef, "ifndef", T_IFNDEF}, { 5, do_endif, "endif", T_ENDIF}, { 4, do_else, "else", T_ELSE}, { 4, do_elif, "elif", T_ELIF}, { 4, do_line, "line", T_LINE}, { 7, do_include, "include", T_INCLUDE}, { 12, do_include, "include_next", T_INCLUDE_NEXT}, { 6, do_include, "import", T_IMPORT}, { 5, do_undef, "undef", T_UNDEF}, { 5, do_error, "error", T_ERROR}, { 7, do_warning, "warning", T_WARNING}, #ifdef SCCS_DIRECTIVE { 4, do_sccs, "sccs", T_SCCS}, #endif { 6, do_pragma, "pragma", T_PRAGMA}, { 5, do_ident, "ident", T_IDENT}, { 6, do_assert, "assert", T_ASSERT}, { 8, do_unassert, "unassert", T_UNASSERT}, { -1, 0, "", T_UNUSED}, }; /* When a directive handler is called, this points to the # (or the : of the %:) that started the directive. */ U_CHAR *directive_start; /* table to tell if char can be part of a C identifier. */ U_CHAR is_idchar[256]; /* table to tell if char can be first char of a c identifier. */ U_CHAR is_idstart[256]; /* table to tell if c is horizontal space. */ static U_CHAR is_hor_space[256]; /* table to tell if c is horizontal or vertical space. */ U_CHAR is_space[256]; #define SKIP_WHITE_SPACE(p) do { while (is_hor_space[*p]) p++; } while (0) #define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*p]) p++; } while (0) static int errors = 0; /* Error counter for exit code */ /* Name of output file, for error messages. */ static char *out_fname; /* Nonzero to ignore \ in string constants. Use to treat #line 1 "A:\file.h as a non-form feed. If you want it to be a form feed, you must use # 1 "\f". */ static int ignore_escape_flag = 1; /* Stack of conditionals currently in progress (including both successful and failing conditionals). */ struct if_stack { struct if_stack *next; /* for chaining to the next stack frame */ char *fname; /* copied from input when frame is made */ size_t fname_len; /* similarly */ int lineno; /* similarly */ int if_succeeded; /* true if a leg of this if-group has been passed through rescan */ U_CHAR *control_macro; /* For #ifndef at start of file, this is the macro name tested. */ enum node_type type; /* type of last directive seen in this group */ }; typedef struct if_stack IF_STACK_FRAME; static IF_STACK_FRAME *if_stack = NULL; /* Buffer of -M output. */ static char *deps_buffer; /* Number of bytes allocated in above. */ static int deps_allocated_size; /* Number of bytes used. */ static int deps_size; /* Number of bytes since the last newline. */ static int deps_column; /* Nonzero means -I- has been seen, so don't look for #include "foo" the source-file directory. */ static int ignore_srcdir; static int safe_read PROTO((int, char *, int)); static void safe_write PROTO((int, char *, int)); static void eprint_string PROTO((const char *, size_t)); int main PROTO((int, char **)); static void path_include PROTO((char *)); static U_CHAR *index0 PROTO((U_CHAR *, int, size_t)); static void trigraph_pcp PROTO((FILE_BUF *)); static void newline_fix PROTO((U_CHAR *)); static void name_newline_fix PROTO((U_CHAR *)); static char *get_lintcmd PROTO((U_CHAR *, U_CHAR *, U_CHAR **, int *, int *)); static void rescan PROTO((FILE_BUF *, int)); static FILE_BUF expand_to_temp_buffer PROTO((U_CHAR *, U_CHAR *, int, int)); static int handle_directive PROTO((FILE_BUF *, FILE_BUF *)); static struct tm *timestamp PROTO((void)); static void special_symbol PROTO((HASHNODE *, FILE_BUF *)); static int is_system_include PROTO((char *)); static char *base_name PROTO((char *)); static int absolute_filename PROTO((char *)); static size_t simplify_filename PROTO((char *)); static char *read_filename_string PROTO((int, FILE *)); static struct file_name_map *read_name_map PROTO((char *)); static int open_include_file PROTO((char *, struct file_name_list *, U_CHAR *, struct include_file **)); static char *remap_include_file PROTO((char *, struct file_name_list *)); static int lookup_ino_include PROTO((struct include_file *)); static void finclude PROTO((int, struct include_file *, FILE_BUF *, int, struct file_name_list *)); static void record_control_macro PROTO((struct include_file *, U_CHAR *)); static char *check_precompiled PROTO((int, struct stat *, char *, char **)); static int check_preconditions PROTO((char *)); static void pcfinclude PROTO((U_CHAR *, U_CHAR *, FILE_BUF *)); static void pcstring_used PROTO((HASHNODE *)); static void write_output PROTO((void)); static void pass_thru_directive PROTO((U_CHAR *, U_CHAR *, FILE_BUF *, struct directive *)); static MACRODEF create_definition PROTO((U_CHAR *, U_CHAR *, FILE_BUF *)); static int check_macro_name PROTO((U_CHAR *, int)); static int compare_defs PROTO((DEFINITION *, DEFINITION *)); static int comp_def_part PROTO((int, U_CHAR *, int, U_CHAR *, int, int)); static DEFINITION *collect_expansion PROTO((U_CHAR *, U_CHAR *, int, struct arglist *)); int check_assertion PROTO((U_CHAR *, int, int, struct arglist *)); static int compare_token_lists PROTO((struct arglist *, struct arglist *)); static struct arglist *read_token_list PROTO((U_CHAR **, U_CHAR *, int *)); static void free_token_list PROTO((struct arglist *)); static ASSERTION_HASHNODE *assertion_install PROTO((U_CHAR *, int, int)); static ASSERTION_HASHNODE *assertion_lookup PROTO((U_CHAR *, int, int)); static void delete_assertion PROTO((ASSERTION_HASHNODE *)); static void do_once PROTO((void)); static HOST_WIDEST_INT eval_if_expression PROTO((U_CHAR *, int)); static void conditional_skip PROTO((FILE_BUF *, int, enum node_type, U_CHAR *, FILE_BUF *)); static void skip_if_group PROTO((FILE_BUF *, int, FILE_BUF *)); static void validate_else PROTO((U_CHAR *, U_CHAR *)); static U_CHAR *skip_to_end_of_comment PROTO((FILE_BUF *, int *, int)); static U_CHAR *skip_quoted_string PROTO((U_CHAR *, U_CHAR *, int, int *, int *, int *)); static char *quote_string PROTO((char *, char *, size_t)); static U_CHAR *skip_paren_group PROTO((FILE_BUF *)); /* Last arg to output_line_directive. */ enum file_change_code {same_file, enter_file, leave_file}; static void output_line_directive PROTO((FILE_BUF *, FILE_BUF *, int, enum file_change_code)); static void macroexpand PROTO((HASHNODE *, FILE_BUF *)); struct argdata; static int macarg PROTO((struct argdata *, int)); static U_CHAR *macarg1 PROTO((U_CHAR *, U_CHAR *, struct hashnode *, int *, int *, int *, int)); static int discard_comments PROTO((U_CHAR *, int, int)); static int change_newlines PROTO((U_CHAR *, int)); static char *my_strerror PROTO((int)); static void notice PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; static void vnotice PROTO((const char *, va_list)); void error PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; void verror PROTO((const char *, va_list)); static void error_from_errno PROTO((char *)); void warning PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; static void vwarning PROTO((const char *, va_list)); static void error_with_line PVPROTO((int, const char *, ...)) ATTRIBUTE_PRINTF_2; static void verror_with_line PROTO((int, const char *, va_list)); static void vwarning_with_line PROTO((int, const char *, va_list)); static void warning_with_line PVPROTO((int, const char *, ...)) ATTRIBUTE_PRINTF_2; void pedwarn PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; void pedwarn_with_line PVPROTO((int, const char *, ...)) ATTRIBUTE_PRINTF_2; static void pedwarn_with_file_and_line PVPROTO((const char *, size_t, int, const char *, ...)) ATTRIBUTE_PRINTF_4; static void pedwarn_strange_white_space PROTO((int)); static void print_containing_files PROTO((void)); static int line_for_error PROTO((int)); static int grow_outbuf PROTO((FILE_BUF *, int)); static HASHNODE *install PROTO((U_CHAR *, int, enum node_type, char *, int)); HASHNODE *lookup PROTO((U_CHAR *, int, int)); static void delete_macro PROTO((HASHNODE *)); static int hashf PROTO((U_CHAR *, int, int)); static void dump_single_macro PROTO((HASHNODE *, FILE *)); static void dump_all_macros PROTO((void)); static void dump_defn_1 PROTO((U_CHAR *, int, int, FILE *)); static void dump_arg_n PROTO((DEFINITION *, int, FILE *)); static void initialize_char_syntax PROTO((void)); static void initialize_builtins PROTO((FILE_BUF *, FILE_BUF *)); static void make_definition PROTO((char *)); static void make_undef PROTO((char *, FILE_BUF *)); static void make_assertion PROTO((const char *, const char *)); static struct file_name_list *new_include_prefix PROTO((struct file_name_list *, const char *, const char *, const char *)); static void append_include_chain PROTO((struct file_name_list *, struct file_name_list *)); static int quote_string_for_make PROTO((char *, const char *)); static void deps_output PROTO((const char *, int)); void fatal PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN; static void perror_with_name PROTO((char *)); static void pfatal_with_name PROTO((char *)) ATTRIBUTE_NORETURN; static void pipe_closed PROTO((int)) ATTRIBUTE_NORETURN; static void memory_full PROTO((void)) ATTRIBUTE_NORETURN; static void print_help PROTO((void)); /* Read LEN bytes at PTR from descriptor DESC, for file FILENAME, retrying if necessary. If MAX_READ_LEN is defined, read at most that bytes at a time. Return a negative value if an error occurs, otherwise return the actual number of bytes read, which may be < LEN if CRs have been skipped, though we try not to do that. */ static int safe_read (desc, ptr, len) int desc; char *ptr; int len; { int left, rcount, nchars; char *rptr; left = len; while (left > 0) { rcount = left; #ifdef MAX_READ_LEN if (rcount > MAX_READ_LEN) rcount = MAX_READ_LEN; #endif nchars = read (desc, ptr, rcount); if (nchars < 0) { #ifdef EINTR if (errno == EINTR) continue; #endif return nchars; } if (nchars == 0) break; /* CRLF pairs, found with Unix when processing DOS files, throw off backslash-newline removal. Therefore, CRs are thrown away here. */ left -= nchars; rptr = ptr; while(nchars--) { if(*rptr == '\r' && *(rptr+1) == '\n') left++; else *ptr++ = *rptr; rptr++; } } return len - left; } /* Write LEN bytes at PTR to descriptor DESC, retrying if necessary, and treating any real error as fatal. If MAX_WRITE_LEN is defined, write at most that many bytes at a time. */ static void safe_write (desc, ptr, len) int desc; char *ptr; int len; { int wcount, written; while (len > 0) { wcount = len; #ifdef MAX_WRITE_LEN if (wcount > MAX_WRITE_LEN) wcount = MAX_WRITE_LEN; #endif written = write (desc, ptr, wcount); if (written < 0) { #ifdef EINTR if (errno == EINTR) continue; #endif pfatal_with_name (out_fname); } ptr += written; len -= written; } } /* Print a string to stderr, with extra handling in case it contains embedded NUL characters. Any present are written as is. Using fwrite for this purpose produces undesireable results on VMS when stderr happens to be a record oriented file, such as a batch log file, rather than a stream oriented one. */ static void eprint_string (string, length) const char *string; size_t length; { size_t segment_length; do { fprintf(stderr, "%s", string); length -= (segment_length = strlen(string)); if (length > 0) { fputc('\0', stderr); length -= 1; /* Advance past the portion which has already been printed. */ string += segment_length + 1; } } while (length > 0); } static void print_help () { printf ("Usage: %s [switches] input output\n", progname); printf ("Switches:\n"); printf (" -include Include the contents of before other files\n"); printf (" -imacros Accept definition of marcos in \n"); printf (" -iprefix Specify as a prefix for next two options\n"); printf (" -iwithprefix Add to the end of the system include paths\n"); printf (" -iwithprefixbefore Add to the end of the main include paths\n"); printf (" -isystem Add to the start of the system include paths\n"); printf (" -idirafter Add to the end of the system include paths\n"); printf (" -I Add to the end of the main include paths\n"); printf (" -nostdinc Do not search the system include directories\n"); printf (" -nostdinc++ Do not search the system include directories for C++\n"); printf (" -o Put output into \n"); printf (" -pedantic Issue all warnings demanded by strict ANSI C\n"); printf (" -traditional Follow K&R pre-processor behaviour\n"); printf (" -trigraphs Support ANSI C trigraphs\n"); printf (" -lang-c Assume that the input sources are in C\n"); printf (" -lang-c89 Assume that the input is C89; depricated\n"); printf (" -lang-c++ Assume that the input sources are in C++\n"); printf (" -lang-objc Assume that the input sources are in ObjectiveC\n"); printf (" -lang-objc++ Assume that the input sources are in ObjectiveC++\n"); printf (" -lang-asm Assume that the input sources are in assembler\n"); printf (" -lang-chill Assume that the input sources are in Chill\n"); printf (" -std= Specify the conformance standard; one of:\n"); printf (" gnu89, gnu9x, c89, c9x, iso9899:1990,\n"); printf (" iso9899:199409, iso9899:199x\n"); printf (" -+ Allow parsing of C++ style features\n"); printf (" -w Inhibit warning messages\n"); printf (" -Wtrigraphs Warn if trigraphs are encountered\n"); printf (" -Wno-trigraphs Do not warn about trigraphs\n"); printf (" -Wcomment{s} Warn if one comment starts inside another\n"); printf (" -Wno-comment{s} Do not warn about comments\n"); printf (" -Wtraditional Warn if a macro argument is/would be turned into\n"); printf (" a string if -traditional is specified\n"); printf (" -Wno-traditional Do not warn about stringification\n"); printf (" -Wundef Warn if an undefined macro is used by #if\n"); printf (" -Wno-undef Do not warn about testing undefined macros\n"); printf (" -Wimport Warn about the use of the #import directive\n"); printf (" -Wno-import Do not warn about the use of #import\n"); printf (" -Werror Treat all warnings as errors\n"); printf (" -Wno-error Do not treat warnings as errors\n"); printf (" -Wall Enable all preprocessor warnings\n"); printf (" -M Generate make dependencies\n"); printf (" -MM As -M, but ignore system header files\n"); printf (" -MD As -M, but put output in a .d file\n"); printf (" -MMD As -MD, but ignore system header files\n"); printf (" -MG Treat missing header file as generated files\n"); printf (" -g Include #define and #undef directives in the output\n"); printf (" -D Define a with string '1' as its value\n"); printf (" -D= Define a with as its value\n"); printf (" -A () Assert the to \n"); printf (" -U Undefine \n"); printf (" -u or -undef Do not predefine any macros\n"); printf (" -v Display the version number\n"); printf (" -H Print the name of header files as they are used\n"); printf (" -C Do not discard comments\n"); printf (" -dM Display a list of macro definitions active at end\n"); printf (" -dD Preserve macro definitions in output\n"); printf (" -dN As -dD except that only the names are preserved\n"); printf (" -dI Include #include directives in the output\n"); printf (" -ifoutput Describe skipped code blocks in output \n"); printf (" -P Do not generate #line directives\n"); printf (" -$ Do not include '$' in identifiers\n"); printf (" -remap Remap file names when including files.\n"); printf (" -h or --help Display this information\n"); } int main (argc, argv) int argc; char **argv; { struct stat st; char *in_fname; char *cp; int f, i; FILE_BUF *fp; char **pend_files; char **pend_defs; char **pend_undefs; char **pend_assertions; char **pend_includes; /* Record the option used with each element of pend_assertions. This is preparation for supporting more than one option for making an assertion. */ char **pend_assertion_options; int no_standard_includes = 0; int no_standard_cplusplus_includes = 0; int missing_newline = 0; /* Non-0 means don't output the preprocessed program. */ int inhibit_output = 0; /* Non-0 means -v, so print the full set of include dirs. */ int verbose = 0; /* File name which deps are being written to. This is 0 if deps are being written to stdout. */ char *deps_file = 0; /* Fopen file mode to open deps_file with. */ char *deps_mode = "a"; /* Stream on which to print the dependency information. */ FILE *deps_stream = 0; /* Target-name to write with the dependency information. */ char *deps_target = 0; #if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT) /* Get rid of any avoidable limit on stack size. */ { struct rlimit rlim; /* Set the stack limit huge so that alloca (particularly stringtab in dbxread.c) does not fail. */ getrlimit (RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max; setrlimit (RLIMIT_STACK, &rlim); } #endif #ifdef SIGPIPE signal (SIGPIPE, pipe_closed); #endif #ifdef HAVE_LC_MESSAGES setlocale (LC_MESSAGES, ""); #endif (void) bindtextdomain (PACKAGE, localedir); (void) textdomain (PACKAGE); progname = base_name (argv[0]); #ifdef VMS { /* Remove extension from PROGNAME. */ char *p; char *s = progname = xstrdup (progname); if ((p = rindex (s, ';')) != 0) *p = '\0'; /* strip version number */ if ((p = rindex (s, '.')) != 0 /* strip type iff ".exe" */ && (p[1] == 'e' || p[1] == 'E') && (p[2] == 'x' || p[2] == 'X') && (p[3] == 'e' || p[3] == 'E') && !p[4]) *p = '\0'; } #endif /* Do not invoke xmalloc before this point, since locale and progname need to be set first, in case a diagnostic is issued. */ pend_files = (char **) xmalloc (argc * sizeof (char *)); pend_defs = (char **) xmalloc (argc * sizeof (char *)); pend_undefs = (char **) xmalloc (argc * sizeof (char *)); pend_assertions = (char **) xmalloc (argc * sizeof (char *)); pend_includes = (char **) xmalloc (argc * sizeof (char *)); pend_assertion_options = (char **) xmalloc (argc * sizeof (char *)); in_fname = NULL; out_fname = NULL; /* Initialize is_idchar. */ initialize_char_syntax (); no_line_directives = 0; no_trigraphs = 1; dump_macros = dump_none; no_output = 0; cplusplus = 0; cplusplus_comments = 1; bzero ((char *) pend_files, argc * sizeof (char *)); bzero ((char *) pend_defs, argc * sizeof (char *)); bzero ((char *) pend_undefs, argc * sizeof (char *)); bzero ((char *) pend_assertions, argc * sizeof (char *)); bzero ((char *) pend_includes, argc * sizeof (char *)); #ifdef MULTIBYTE_CHARS /* Change to the native locale for multibyte conversions. */ setlocale (LC_CTYPE, ""); literal_codeset = getenv ("LANG"); #endif /* Process switches and find input file name. */ for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { if (out_fname != NULL) { print_help (); fatal ("Too many arguments"); } else if (in_fname != NULL) out_fname = argv[i]; else in_fname = argv[i]; } else { switch (argv[i][1]) { case 'i': if (!strcmp (argv[i], "-include")) { int temp = i; if (i + 1 == argc) fatal ("Filename missing after `-include' option"); else simplify_filename (pend_includes[temp] = argv[++i]); } if (!strcmp (argv[i], "-imacros")) { int temp = i; if (i + 1 == argc) fatal ("Filename missing after `-imacros' option"); else simplify_filename (pend_files[temp] = argv[++i]); } if (!strcmp (argv[i], "-iprefix")) { if (i + 1 == argc) fatal ("Filename missing after `-iprefix' option"); else include_prefix = argv[++i]; } if (!strcmp (argv[i], "-ifoutput")) { output_conditionals = 1; } if (!strcmp (argv[i], "-isystem")) { struct file_name_list *dirtmp; if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, "", argv[++i]))) break; dirtmp->c_system_include_path = 1; if (before_system == 0) before_system = dirtmp; else last_before_system->next = dirtmp; last_before_system = dirtmp; /* Tail follows the last one */ } /* Add directory to end of path for includes, with the default prefix at the front of its name. */ if (!strcmp (argv[i], "-iwithprefix")) { struct file_name_list *dirtmp; char *prefix; if (include_prefix != 0) prefix = include_prefix; else { prefix = xstrdup (GCC_INCLUDE_DIR); /* Remove the `include' from /usr/local/lib/gcc.../include. */ if (!strcmp (prefix + strlen (prefix) - 8, "/include")) prefix[strlen (prefix) - 7] = 0; } if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, prefix, argv[++i]))) break; if (after_include == 0) after_include = dirtmp; else last_after_include->next = dirtmp; last_after_include = dirtmp; /* Tail follows the last one */ } /* Add directory to main path for includes, with the default prefix at the front of its name. */ if (!strcmp (argv[i], "-iwithprefixbefore")) { struct file_name_list *dirtmp; char *prefix; if (include_prefix != 0) prefix = include_prefix; else { prefix = xstrdup (GCC_INCLUDE_DIR); /* Remove the `include' from /usr/local/lib/gcc.../include. */ if (!strcmp (prefix + strlen (prefix) - 8, "/include")) prefix[strlen (prefix) - 7] = 0; } dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, prefix, argv[++i]); append_include_chain (dirtmp, dirtmp); } /* Add directory to end of path for includes. */ if (!strcmp (argv[i], "-idirafter")) { struct file_name_list *dirtmp; if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, "", argv[++i]))) break; if (after_include == 0) after_include = dirtmp; else last_after_include->next = dirtmp; last_after_include = dirtmp; /* Tail follows the last one */ } break; case 'o': if (out_fname != NULL) fatal ("Output filename specified twice"); if (i + 1 == argc) fatal ("Filename missing after -o option"); out_fname = argv[++i]; if (!strcmp (out_fname, "-")) out_fname = ""; break; case 'p': if (!strcmp (argv[i], "-pedantic")) pedantic = 1; else if (!strcmp (argv[i], "-pedantic-errors")) { pedantic = 1; pedantic_errors = 1; } else if (!strcmp (argv[i], "-pcp")) { char *pcp_fname; if (i + 1 == argc) fatal ("Filename missing after -pcp option"); pcp_fname = argv[++i]; pcp_outfile = ((pcp_fname[0] != '-' || pcp_fname[1] != '\0') ? fopen (pcp_fname, "w") : stdout); if (pcp_outfile == 0) pfatal_with_name (pcp_fname); no_precomp = 1; } break; case 't': if (!strcmp (argv[i], "-traditional")) { traditional = 1; cplusplus_comments = 0; } else if (!strcmp (argv[i], "-trigraphs")) { no_trigraphs = 0; } break; case 'l': if (! strcmp (argv[i], "-lang-c")) cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; else if (! strcmp (argv[i], "-lang-c89")) cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; else if (! strcmp (argv[i], "-lang-c++")) cplusplus = 1, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 0; else if (! strcmp (argv[i], "-lang-objc")) cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 1; else if (! strcmp (argv[i], "-lang-objc++")) cplusplus = 1, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 1; else if (! strcmp (argv[i], "-lang-asm")) lang_asm = 1; else if (! strcmp (argv[i], "-lint")) for_lint = 1; break; case '+': cplusplus = 1, cplusplus_comments = 1; break; case 's': if (!strcmp (argv[i], "-std=iso9899:1990") || !strcmp (argv[i], "-std=iso9899:199409") || !strcmp (argv[i], "-std=c89") || !strcmp (argv[i], "-std=gnu89")) cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; else if (!strcmp (argv[i], "-std=iso9899:199x") || !strcmp (argv[i], "-std=c9x") || !strcmp (argv[i], "-std=gnu9x")) cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; break; case 'w': inhibit_warnings = 1; break; case 'W': if (!strcmp (argv[i], "-Wtrigraphs")) warn_trigraphs = 1; else if (!strcmp (argv[i], "-Wno-trigraphs")) warn_trigraphs = 0; else if (!strcmp (argv[i], "-Wcomment")) warn_comments = 1; else if (!strcmp (argv[i], "-Wno-comment")) warn_comments = 0; else if (!strcmp (argv[i], "-Wcomments")) warn_comments = 1; else if (!strcmp (argv[i], "-Wno-comments")) warn_comments = 0; else if (!strcmp (argv[i], "-Wtraditional")) warn_stringify = 1; else if (!strcmp (argv[i], "-Wno-traditional")) warn_stringify = 0; else if (!strcmp (argv[i], "-Wundef")) warn_undef = 1; else if (!strcmp (argv[i], "-Wno-undef")) warn_undef = 0; else if (!strcmp (argv[i], "-Wimport")) warn_import = 1; else if (!strcmp (argv[i], "-Wno-import")) warn_import = 0; else if (!strcmp (argv[i], "-Werror")) warnings_are_errors = 1; else if (!strcmp (argv[i], "-Wno-error")) warnings_are_errors = 0; else if (!strcmp (argv[i], "-Wall")) { warn_trigraphs = 1; warn_comments = 1; } break; case 'f': if (!strcmp (argv[i], "-fleading-underscore")) user_label_prefix = "_"; else if (!strcmp (argv[i], "-fno-leading-underscore")) user_label_prefix = ""; break; case 'M': /* The style of the choices here is a bit mixed. The chosen scheme is a hybrid of keeping all options in one string and specifying each option in a separate argument: -M|-MM|-MD file|-MMD file [-MG]. An alternative is: -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely: -M[M][G][D file]. This is awkward to handle in specs, and is not as extensible. */ /* ??? -MG must be specified in addition to one of -M or -MM. This can be relaxed in the future without breaking anything. The converse isn't true. */ /* -MG isn't valid with -MD or -MMD. This is checked for later. */ if (!strcmp (argv[i], "-MG")) { print_deps_missing_files = 1; break; } if (!strcmp (argv[i], "-M")) print_deps = 2; else if (!strcmp (argv[i], "-MM")) print_deps = 1; else if (!strcmp (argv[i], "-MD")) print_deps = 2; else if (!strcmp (argv[i], "-MMD")) print_deps = 1; /* For -MD and -MMD options, write deps on file named by next arg. */ if (!strcmp (argv[i], "-MD") || !strcmp (argv[i], "-MMD")) { if (i + 1 == argc) fatal ("Filename missing after %s option", argv[i]); i++; deps_file = argv[i]; deps_mode = "w"; } else { /* For -M and -MM, write deps on standard output and suppress the usual output. */ deps_stream = stdout; inhibit_output = 1; } break; case 'd': { char *p = argv[i] + 2; char c; while ((c = *p++)) { /* Arg to -d specifies what parts of macros to dump */ switch (c) { case 'M': dump_macros = dump_only; no_output = 1; break; case 'N': dump_macros = dump_names; break; case 'D': dump_macros = dump_definitions; break; case 'I': dump_includes = 1; break; } } } break; case 'g': if (argv[i][2] == '3') debug_output = 1; break; case '-': if (strcmp (argv[i], "--help") != 0) return i; print_help (); exit (0); break; case 'v': notice ("GNU CPP version %s", version_string); #ifdef TARGET_VERSION TARGET_VERSION; #endif fprintf (stderr, "\n"); verbose = 1; break; case 'H': print_include_names = 1; break; case 'D': if (argv[i][2] != 0) pend_defs[i] = argv[i] + 2; else if (i + 1 == argc) fatal ("Macro name missing after -D option"); else i++, pend_defs[i] = argv[i]; break; case 'A': { char *p; if (argv[i][2] != 0) p = argv[i] + 2; else if (i + 1 == argc) fatal ("Assertion missing after -A option"); else p = argv[++i]; if (!strcmp (p, "-")) { /* -A- eliminates all predefined macros and assertions. Let's include also any that were specified earlier on the command line. That way we can get rid of any that were passed automatically in from GCC. */ int j; for (j = 0; j < i; j++) pend_defs[j] = pend_assertions[j] = 0; } else { pend_assertions[i] = p; pend_assertion_options[i] = "-A"; } } break; case 'U': /* JF #undef something */ if (argv[i][2] != 0) pend_undefs[i] = argv[i] + 2; else if (i + 1 == argc) fatal ("Macro name missing after -U option"); else pend_undefs[i] = argv[i+1], i++; break; case 'C': put_out_comments = 1; break; case 'E': /* -E comes from cc -E; ignore it. */ break; case 'P': no_line_directives = 1; break; case '$': /* Don't include $ in identifiers. */ is_idchar['$'] = is_idstart['$'] = 0; break; case 'I': /* Add directory to path for includes. */ { struct file_name_list *dirtmp; if (! ignore_srcdir && !strcmp (argv[i] + 2, "-")) { ignore_srcdir = 1; /* Don't use any preceding -I directories for #include <...>. */ first_bracket_include = 0; } else { dirtmp = new_include_prefix (last_include, NULL_PTR, "", argv[i][2] ? argv[i] + 2 : argv[++i]); append_include_chain (dirtmp, dirtmp); } } break; /* Option for runtime cxref-cpp configuration file - AMB */ case 'c': if (!strcmp (argv[i], "-cxref-cpp-defines")) { if (i + 1 == argc) fatal ("Filename missing after `-cxref-cpp-defines' option"); else cxref_cpp_defines = argv[i+1], i++; } break; /* Option for runtime cxref-cpp configuration file - AMB */ case 'n': if (!strcmp (argv[i], "-nostdinc")) /* -nostdinc causes no default include directories. You must specify all include-file directories with -I. */ no_standard_includes = 1; else if (!strcmp (argv[i], "-nostdinc++")) /* -nostdinc++ causes no default C++-specific include directories. */ no_standard_cplusplus_includes = 1; else if (!strcmp (argv[i], "-noprecomp")) no_precomp = 1; break; case 'r': if (!strcmp (argv[i], "-remap")) remap = 1; break; case '\0': /* JF handle '-' as file name meaning stdin or stdout */ if (in_fname == NULL) { in_fname = ""; break; } else if (out_fname == NULL) { out_fname = ""; break; } /* else fall through into error */ default: fatal ("Invalid option `%s'", argv[i]); } } } /* Add dirs from CPATH after dirs from -I. */ /* There seems to be confusion about what CPATH should do, so for the moment it is not documented. */ /* Some people say that CPATH should replace the standard include dirs, but that seems pointless: it comes before them, so it overrides them anyway. */ GET_ENV_PATH_LIST (cp, "CPATH"); if (cp && ! no_standard_includes) path_include (cp); /* Initialize output buffer */ outbuf.buf = (U_CHAR *) xmalloc (OUTBUF_SIZE); outbuf.bufp = outbuf.buf; outbuf.length = OUTBUF_SIZE; /* Do partial setup of input buffer for the sake of generating early #line directives (when -g is in effect). */ fp = &instack[++indepth]; if (in_fname == NULL) in_fname = ""; fp->nominal_fname = fp->fname = in_fname; fp->nominal_fname_len = strlen (in_fname); fp->lineno = 0; /* In C++, wchar_t is a distinct basic type, and we can expect __wchar_t to be defined by cc1plus. */ if (cplusplus) wchar_type = "__wchar_t"; /* Install __LINE__, etc. Must follow initialize_char_syntax and option processing. */ initialize_builtins (fp, &outbuf); /* Start of setup for the cxref paths and definitions from runtime config - AMB */ { int fd; struct stat sbuf; char *buf,*p; struct include_file *inc; if(stat(cxref_cpp_defines,&sbuf)<0) {perror_with_name(cxref_cpp_defines); exit(FATAL_EXIT_CODE);} if(!S_ISREG(sbuf.st_mode)) {perror_with_name(cxref_cpp_defines); exit(FATAL_EXIT_CODE);} fd=open_include_file(cxref_cpp_defines, NULL_PTR, NULL_PTR, &inc); if(fd==-1) {perror_with_name(cxref_cpp_defines); exit(FATAL_EXIT_CODE);} buf=(char *)xmalloc(sbuf.st_size+2); /* AMB - remove gcc-4.0 warning */ if(safe_read(fd,buf,sbuf.st_size)<0) {perror_with_name(cxref_cpp_defines); exit(FATAL_EXIT_CODE);} p=buf; while(!strncmp(p,"//",2)) { char *oldp=p; while(*p && (*p!='\r' && *p!='\n')) p++; while(*p && (*p=='\r' || *p=='\n')) *p++=0; if(!strncmp(oldp,"// -",4) && *(oldp+=4)) switch(*oldp) { case 'A': make_assertion("-A",oldp+1); break; case 'D': make_definition(oldp+1); break; case 'I': /* treat like -isystem */ { struct file_name_list *dirtmp; dirtmp = new_include_prefix(NULL_PTR,NULL_PTR,"",oldp+1); if(!dirtmp) fatal ("File %s specifies invalid -I path",cxref_cpp_defines); dirtmp->c_system_include_path = 1; if (before_system == 0) before_system = dirtmp; else last_before_system->next = dirtmp; last_before_system = dirtmp; /* Tail follows the last one */ } break; default: ; } } free(buf); lseek(fd,0,SEEK_SET); no_output++; no_record_file++; finclude(fd,inc,&outbuf,0,NULL_PTR); no_output--; no_record_file--; } /* End of setup for the cxref paths and definitions from runtime config - AMB */ /* Now handle the command line options. */ /* Do -U's, -D's and -A's in the order they were seen. */ for (i = 1; i < argc; i++) { if (pend_undefs[i]) { if (debug_output) output_line_directive (fp, &outbuf, 0, same_file); make_undef (pend_undefs[i], &outbuf); } if (pend_defs[i]) { if (debug_output) output_line_directive (fp, &outbuf, 0, same_file); make_definition (pend_defs[i]); } if (pend_assertions[i]) make_assertion (pend_assertion_options[i], pend_assertions[i]); } done_initializing = 1; { /* Read the appropriate environment variable and if it exists replace include_defaults with the listed path. */ char *epath = 0; switch ((objc << 1) + cplusplus) { case 0: GET_ENV_PATH_LIST (epath, "C_INCLUDE_PATH"); break; case 1: GET_ENV_PATH_LIST (epath, "CPLUS_INCLUDE_PATH"); break; case 2: GET_ENV_PATH_LIST (epath, "OBJC_INCLUDE_PATH"); break; case 3: GET_ENV_PATH_LIST (epath, "OBJCPLUS_INCLUDE_PATH"); break; } /* If the environment var for this language is set, add to the default list of include directories. */ if (epath) { int num_dirs; char *startp, *endp; for (num_dirs = 1, startp = epath; *startp; startp++) if (*startp == PATH_SEPARATOR) num_dirs++; include_defaults = (struct default_include *) xmalloc ((num_dirs * sizeof (struct default_include)) + sizeof (include_defaults_array)); startp = endp = epath; num_dirs = 0; while (1) { char c = *endp++; if (c == PATH_SEPARATOR || !c) { endp[-1] = 0; include_defaults[num_dirs].fname = startp == endp ? "." : xstrdup (startp); endp[-1] = c; include_defaults[num_dirs].component = 0; include_defaults[num_dirs].cplusplus = cplusplus; include_defaults[num_dirs].cxx_aware = 1; num_dirs++; if (!c) break; startp = endp; } } /* Put the usual defaults back in at the end. */ bcopy ((char *) include_defaults_array, (char *) &include_defaults[num_dirs], sizeof (include_defaults_array)); } } append_include_chain (before_system, last_before_system); first_system_include = before_system; /* Unless -fnostdinc, tack on the standard include file dirs to the specified list */ if (!no_standard_includes) { struct default_include *p = include_defaults; char *specd_prefix = include_prefix; char *default_prefix = xstrdup (GCC_INCLUDE_DIR); int default_len = 0; /* Remove the `include' from /usr/local/lib/gcc.../include. */ if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) { default_len = strlen (default_prefix) - 7; default_prefix[default_len] = 0; } /* Search "translated" versions of GNU directories. These have /usr/local/lib/gcc... replaced by specd_prefix. */ if (specd_prefix != 0 && default_len != 0) for (p = include_defaults; p->fname; p++) { /* Some standard dirs are only for C++. */ if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) { /* Does this dir start with the prefix? */ if (!strncmp (p->fname, default_prefix, default_len)) { /* Yes; change prefix and add to search list. */ struct file_name_list *new = new_include_prefix (NULL_PTR, NULL_PTR, specd_prefix, p->fname + default_len); if (new) { new->c_system_include_path = !p->cxx_aware; append_include_chain (new, new); if (first_system_include == 0) first_system_include = new; p->included = 1; } } } } /* Search ordinary names for GNU include directories. */ for (p = include_defaults; p->fname; p++) { /* Some standard dirs are only for C++. */ if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) { struct file_name_list *new = new_include_prefix (NULL_PTR, p->component, "", p->fname); if (new) { new->c_system_include_path = !p->cxx_aware; append_include_chain (new, new); if (first_system_include == 0) first_system_include = new; p->included = 1; } } } } /* Tack the after_include chain at the end of the include chain. */ append_include_chain (after_include, last_after_include); if (first_system_include == 0) first_system_include = after_include; /* With -v, print the list of dirs to search. */ if (verbose) { struct file_name_list *p; notice ("#include \"...\" search starts here:\n"); for (p = include; p; p = p->next) { if (p == first_bracket_include) notice ("#include <...> search starts here:\n"); if (!p->fname[0]) fprintf (stderr, " .\n"); else if (!strcmp (p->fname, "/") || !strcmp (p->fname, "//")) fprintf (stderr, " %s\n", p->fname); else /* Omit trailing '/'. */ fprintf (stderr, " %.*s\n", (int) strlen (p->fname) - 1, p->fname); } notice ("End of search list.\n"); { struct default_include * d; notice ("The following default directories have been omitted from the search path:\n"); for (d = include_defaults; d->fname; d++) if (! d->included) fprintf (stderr, " %s\n", d->fname); notice ("End of omitted list.\n"); } } /* -MG doesn't select the form of output and must be specified with one of -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't inhibit compilation. */ if (print_deps_missing_files && (print_deps == 0 || !inhibit_output)) fatal ("-MG must be specified with one of -M or -MM"); /* Either of two environment variables can specify output of deps. Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to and DEPS_TARGET is the target to mention in the deps. */ if (print_deps == 0 && (getenv ("SUNPRO_DEPENDENCIES") != 0 || getenv ("DEPENDENCIES_OUTPUT") != 0)) { char *spec = getenv ("DEPENDENCIES_OUTPUT"); char *s; char *output_file; if (spec == 0) { spec = getenv ("SUNPRO_DEPENDENCIES"); print_deps = 2; } else print_deps = 1; s = spec; /* Find the space before the DEPS_TARGET, if there is one. */ /* This should use index. (mrs) */ while (*s != 0 && *s != ' ') s++; if (*s != 0) { deps_target = s + 1; output_file = xmalloc (s - spec + 1); bcopy (spec, output_file, s - spec); output_file[s - spec] = 0; } else { deps_target = 0; output_file = spec; } deps_file = output_file; deps_mode = "a"; } /* For -M, print the expected object file name as the target of this Make-rule. */ if (print_deps) { deps_allocated_size = 200; deps_buffer = xmalloc (deps_allocated_size); deps_buffer[0] = 0; deps_size = 0; deps_column = 0; if (deps_target) { deps_output (deps_target, ':'); } else if (*in_fname == 0) { deps_output ("-", ':'); } else { char *p, *q; int len; q = base_name (in_fname); /* Copy remainder to mungable area. */ p = (char *) alloca (strlen(q) + 8); strcpy (p, q); /* Output P, but remove known suffixes. */ len = strlen (p); q = p + len; if (len >= 2 && p[len - 2] == '.' && index("cCsSm", p[len - 1])) q = p + (len - 2); else if (len >= 3 && p[len - 3] == '.' && p[len - 2] == 'c' && p[len - 1] == 'c') q = p + (len - 3); else if (len >= 4 && p[len - 4] == '.' && p[len - 3] == 'c' && p[len - 2] == 'x' && p[len - 1] == 'x') q = p + (len - 4); else if (len >= 4 && p[len - 4] == '.' && p[len - 3] == 'c' && p[len - 2] == 'p' && p[len - 1] == 'p') q = p + (len - 4); /* Supply our own suffix. */ strcpy (q, OBJECT_SUFFIX); deps_output (p, ':'); deps_output (in_fname, ' '); } } /* Scan the -imacros files before the main input. Much like #including them, but with no_output set so that only their macro definitions matter. */ no_output++; no_record_file++; for (i = 1; i < argc; i++) if (pend_files[i]) { struct include_file *inc; int fd = open_include_file (pend_files[i], NULL_PTR, NULL_PTR, &inc); if (fd < 0) { perror_with_name (pend_files[i]); return FATAL_EXIT_CODE; } finclude (fd, inc, &outbuf, 0, NULL_PTR); } no_output--; no_record_file--; /* Copy the entire contents of the main input file into the stacked input buffer previously allocated for it. */ /* JF check for stdin */ if (in_fname == NULL || *in_fname == 0) { in_fname = ""; f = 0; } else if ((f = open (in_fname, O_RDONLY, 0666)) < 0) goto perror; if (fstat (f, &st) != 0) pfatal_with_name (in_fname); fp->nominal_fname = fp->fname = in_fname; fp->nominal_fname_len = strlen (in_fname); fp->lineno = 1; fp->system_header_p = 0; /* JF all this is mine about reading pipes and ttys */ if (! S_ISREG (st.st_mode)) { /* Read input from a file that is not a normal disk file. We cannot preallocate a buffer with the correct size, so we must read in the file a piece at the time and make it bigger. */ int size; int bsize; int cnt; if (S_ISDIR (st.st_mode)) fatal ("Input file `%s' is a directory", in_fname); bsize = 2000; size = 0; fp->buf = (U_CHAR *) xmalloc (bsize + 2); for (;;) { cnt = safe_read (f, (char *) fp->buf + size, bsize - size); if (cnt < 0) goto perror; /* error! */ if (cnt == 0) break; /* End of file */ size += cnt; bsize *= 2; fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2); } fp->length = size; } else { /* Read a file whose size we can determine in advance. For the sake of VMS, st.st_size is just an upper bound. */ size_t s = (size_t) st.st_size; if (s != st.st_size || s + 2 < s) memory_full (); fp->buf = (U_CHAR *) xmalloc (s + 2); fp->length = safe_read (f, (char *) fp->buf, s); if (fp->length < 0) goto perror; } fp->bufp = fp->buf; fp->if_stack = if_stack; /* Make sure data ends with a newline. And put a null after it. */ if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n') /* Backslash-newline at end is not good enough. */ || (fp->length > 1 && fp->buf[fp->length - 2] == '\\')) { fp->buf[fp->length++] = '\n'; missing_newline = 1; } fp->buf[fp->length] = '\0'; /* Unless inhibited, convert trigraphs in the input. */ if (!no_trigraphs) trigraph_pcp (fp); /* Now that we know the input file is valid, open the output. */ if (!out_fname || !strcmp (out_fname, "")) out_fname = "stdout"; else if (! freopen (out_fname, "w", stdout)) pfatal_with_name (out_fname); output_line_directive (fp, &outbuf, 0, same_file); /* Scan the -include files before the main input. */ no_record_file++; for (i = 1; i < argc; i++) if (pend_includes[i]) { struct include_file *inc; int fd = open_include_file (pend_includes[i], NULL_PTR, NULL_PTR, &inc); if (fd < 0) { perror_with_name (pend_includes[i]); return FATAL_EXIT_CODE; } finclude (fd, inc, &outbuf, 0, NULL_PTR); } no_record_file--; /* Scan the input, processing macros and directives. */ rescan (&outbuf, 0); if (missing_newline) fp->lineno--; if (pedantic && missing_newline) pedwarn ("file does not end in newline"); /* Now we have processed the entire input Write whichever kind of output has been requested. */ if (dump_macros == dump_only) dump_all_macros (); else if (! inhibit_output) { write_output (); } if (print_deps) { /* Don't actually write the deps file if compilation has failed. */ if (errors == 0) { if (deps_file && ! (deps_stream = fopen (deps_file, deps_mode))) pfatal_with_name (deps_file); fputs (deps_buffer, deps_stream); putc ('\n', deps_stream); if (deps_file) { if (ferror (deps_stream) || fclose (deps_stream) != 0) fatal ("I/O error on output"); } } } if (pcp_outfile && pcp_outfile != stdout && (ferror (pcp_outfile) || fclose (pcp_outfile) != 0)) fatal ("I/O error on `-pcp' output"); if (ferror (stdout) || fclose (stdout) != 0) fatal ("I/O error on output"); if (errors) exit (FATAL_EXIT_CODE); exit (SUCCESS_EXIT_CODE); perror: pfatal_with_name (in_fname); return 0; } /* Given a colon-separated list of file names PATH, add all the names to the search path for include files. */ static void path_include (path) char *path; { char *p; p = path; if (*p) while (1) { char *q = p; char c; struct file_name_list *dirtmp; /* Find the end of this name. */ while ((c = *q++) != PATH_SEPARATOR && c) continue; q[-1] = 0; dirtmp = new_include_prefix (last_include, NULL_PTR, "", p == q ? "." : p); q[-1] = c; append_include_chain (dirtmp, dirtmp); /* Advance past this name. */ p = q; if (! c) break; } } /* Return the address of the first character in S that equals C. S is an array of length N, possibly containing '\0's, and followed by '\0'. Return 0 if there is no such character. Assume that C itself is not '\0'. If we knew we could use memchr, we could just invoke memchr (S, C, N), but unfortunately memchr isn't autoconfigured yet. */ static U_CHAR * index0 (s, c, n) U_CHAR *s; int c; size_t n; { char *p = (char *) s; for (;;) { char *q = index (p, c); if (q) return (U_CHAR *) q; else { size_t l = strlen (p); if (l == n) return 0; l++; p += l; n -= l; } } } /* Pre-C-Preprocessor to translate ANSI trigraph idiocy in BUF before main CCCP processing. Name `pcp' is also in honor of the drugs the trigraph designers must have been on. Using an extra pass through the buffer takes a little extra time, but is infinitely less hairy than trying to handle trigraphs inside strings, etc. everywhere, and also makes sure that trigraphs are only translated in the top level of processing. */ static void trigraph_pcp (buf) FILE_BUF *buf; { register U_CHAR c, *fptr, *bptr, *sptr, *lptr; int len; fptr = bptr = sptr = buf->buf; lptr = fptr + buf->length; while ((sptr = index0 (sptr, '?', (size_t) (lptr - sptr))) != NULL) { if (*++sptr != '?') continue; switch (*++sptr) { case '=': c = '#'; break; case '(': c = '['; break; case '/': c = '\\'; break; case ')': c = ']'; break; case '\'': c = '^'; break; case '<': c = '{'; break; case '!': c = '|'; break; case '>': c = '}'; break; case '-': c = '~'; break; case '?': sptr--; continue; default: continue; } len = sptr - fptr - 2; /* BSD doc says bcopy () works right for overlapping strings. In ANSI C, this will be memmove (). */ if (bptr != fptr && len > 0) bcopy ((char *) fptr, (char *) bptr, len); bptr += len; *bptr++ = c; fptr = ++sptr; } len = buf->length - (fptr - buf->buf); if (bptr != fptr && len > 0) bcopy ((char *) fptr, (char *) bptr, len); buf->length -= fptr - bptr; buf->buf[buf->length] = '\0'; if (warn_trigraphs && fptr != bptr) warning_with_line (0, "%lu trigraph(s) encountered", (unsigned long) (fptr - bptr) / 2); } /* Move all backslash-newline pairs out of embarrassing places. Exchange all such pairs following BP with any potentially-embarrassing characters that follow them. Potentially-embarrassing characters are / and * (because a backslash-newline inside a comment delimiter would cause it not to be recognized). */ static void newline_fix (bp) U_CHAR *bp; { register U_CHAR *p = bp; /* First count the backslash-newline pairs here. */ while (p[0] == '\\' && p[1] == '\n') p += 2; /* What follows the backslash-newlines is not embarrassing. */ if (*p != '/' && *p != '*') return; /* Copy all potentially embarrassing characters that follow the backslash-newline pairs down to where the pairs originally started. */ while (*p == '*' || *p == '/') *bp++ = *p++; /* Now write the same number of pairs after the embarrassing chars. */ while (bp < p) { *bp++ = '\\'; *bp++ = '\n'; } } /* Like newline_fix but for use within a directive-name. Move any backslash-newlines up past any following symbol constituents. */ static void name_newline_fix (bp) U_CHAR *bp; { register U_CHAR *p = bp; /* First count the backslash-newline pairs here. */ while (p[0] == '\\' && p[1] == '\n') p += 2; /* What follows the backslash-newlines is not embarrassing. */ if (!is_idchar[*p]) return; /* Copy all potentially embarrassing characters that follow the backslash-newline pairs down to where the pairs originally started. */ while (is_idchar[*p]) *bp++ = *p++; /* Now write the same number of pairs after the embarrassing chars. */ while (bp < p) { *bp++ = '\\'; *bp++ = '\n'; } } /* Look for lint commands in comments. When we come in here, ibp points into a comment. Limit is as one expects. scan within the comment -- it should start, after lwsp, with a lint command. If so that command is returned as a (constant) string. Upon return, any arg will be pointed to with argstart and will be arglen long. Note that we don't parse that arg since it will just be printed out again. */ static char * get_lintcmd (ibp, limit, argstart, arglen, cmdlen) register U_CHAR *ibp; register U_CHAR *limit; U_CHAR **argstart; /* point to command arg */ int *arglen, *cmdlen; /* how long they are */ { HOST_WIDEST_INT linsize; register U_CHAR *numptr; /* temp for arg parsing */ *arglen = 0; *argstart=NULL; /* AMB - remove gcc-4.0 warning */ SKIP_WHITE_SPACE (ibp); if (ibp >= limit) return NULL; linsize = limit - ibp; /* Oh, I wish C had lexical functions... hell, I'll just open-code the set */ if ((linsize >= 10) && !bcmp (ibp, "NOTREACHED", 10)) { *cmdlen = 10; return "NOTREACHED"; } if ((linsize >= 8) && !bcmp (ibp, "ARGSUSED", 8)) { *cmdlen = 8; return "ARGSUSED"; } if ((linsize >= 11) && !bcmp (ibp, "LINTLIBRARY", 11)) { *cmdlen = 11; return "LINTLIBRARY"; } if ((linsize >= 7) && !bcmp (ibp, "VARARGS", 7)) { *cmdlen = 7; ibp += 7; linsize -= 7; if ((linsize == 0) || ! ISDIGIT (*ibp)) return "VARARGS"; /* OK, read a number */ for (numptr = *argstart = ibp; (numptr < limit) && ISDIGIT (*numptr); numptr++); *arglen = numptr - *argstart; return "VARARGS"; } return NULL; } /* * The main loop of the program. * * Read characters from the input stack, transferring them to the * output buffer OP. * * Macros are expanded and push levels on the input stack. * At the end of such a level it is popped off and we keep reading. * At the end of any other kind of level, we return. * #-directives are handled, except within macros. * * If OUTPUT_MARKS is nonzero, keep Newline markers found in the input * and insert them when appropriate. This is set while scanning macro * arguments before substitution. It is zero when scanning for final output. * There are three types of Newline markers: * * Newline - follows a macro name that was not expanded * because it appeared inside an expansion of the same macro. * This marker prevents future expansion of that identifier. * When the input is rescanned into the final output, these are deleted. * These are also deleted by ## concatenation. * * Newline Space (or Newline and any other whitespace character) * stands for a place that tokens must be separated or whitespace * is otherwise desirable, but where the ANSI standard specifies there * is no whitespace. This marker turns into a Space (or whichever other * whitespace char appears in the marker) in the final output, * but it turns into nothing in an argument that is stringified with #. * Such stringified arguments are the only place where the ANSI standard * specifies with precision that whitespace may not appear. * * During this function, IP->bufp is kept cached in IBP for speed of access. * Likewise, OP->bufp is kept in OBP. Before calling a subroutine * IBP, IP and OBP must be copied back to memory. IP and IBP are * copied back with the RECACHE macro. OBP must be copied back from OP->bufp * explicitly, and before RECACHE, since RECACHE uses OBP. */ static void rescan (op, output_marks) FILE_BUF *op; int output_marks; { /* Character being scanned in main loop. */ register U_CHAR c; /* Length of pending accumulated identifier. */ register int ident_length = 0; /* Hash code of pending accumulated identifier. */ register int hash = 0; /* Current input level (&instack[indepth]). */ FILE_BUF *ip; /* Pointer for scanning input. */ register U_CHAR *ibp; /* Pointer to end of input. End of scan is controlled by LIMIT. */ register U_CHAR *limit; /* Pointer for storing output. */ register U_CHAR *obp; /* REDO_CHAR is nonzero if we are processing an identifier after backing up over the terminating character. Sometimes we process an identifier without backing up over the terminating character, if the terminating character is not special. Backing up is done so that the terminating character will be dispatched on again once the identifier is dealt with. */ int redo_char = 0; /* 1 if within an identifier inside of which a concatenation marker (Newline -) has been seen. */ int concatenated = 0; /* While scanning a comment or a string constant, this records the line it started on, for error messages. */ int start_line; /* Record position of last `real' newline. */ U_CHAR *beg_of_line; /* Pop the innermost input stack level, assuming it is a macro expansion. */ #define POPMACRO \ do { ip->macro->type = T_MACRO; \ if (ip->free_ptr) free (ip->free_ptr); \ --indepth; } while (0) /* Reload `rescan's local variables that describe the current level of the input stack. */ #define RECACHE \ do { ip = &instack[indepth]; \ ibp = ip->bufp; \ limit = ip->buf + ip->length; \ op->bufp = obp; \ check_expand (op, limit - ibp); \ beg_of_line = 0; \ obp = op->bufp; } while (0) if (no_output && instack[indepth].fname != 0) skip_if_group (&instack[indepth], 1, NULL); obp = op->bufp; RECACHE; beg_of_line = ibp; /* Our caller must always put a null after the end of the input at each input stack level. */ if (*limit != 0) abort (); while (1) { c = *ibp++; *obp++ = c; switch (c) { case '\\': if (*ibp == '\n' && !ip->macro) { /* At the top level, always merge lines ending with backslash-newline, even in middle of identifier. But do not merge lines in a macro, since backslash might be followed by a newline-space marker. */ ++ibp; ++ip->lineno; --obp; /* remove backslash from obuf */ break; } /* If ANSI, backslash is just another character outside a string. */ if (!traditional) goto randomchar; /* Otherwise, backslash suppresses specialness of following char, so copy it here to prevent the switch from seeing it. But first get any pending identifier processed. */ if (ident_length > 0) goto specialchar; if (ibp < limit) *obp++ = *ibp++; break; case '%': if (ident_length || ip->macro || traditional) goto randomchar; while (*ibp == '\\' && ibp[1] == '\n') { ibp += 2; ++ip->lineno; } if (*ibp != ':') break; /* Treat this %: digraph as if it were #. */ /* Fall through. */ case '#': if (assertions_flag) { if (ident_length) goto specialchar; /* Copy #foo (bar lose) without macro expansion. */ obp[-1] = '#'; /* In case it was '%'. */ SKIP_WHITE_SPACE (ibp); while (is_idchar[*ibp]) *obp++ = *ibp++; SKIP_WHITE_SPACE (ibp); if (*ibp == '(') { ip->bufp = ibp; skip_paren_group (ip); bcopy ((char *) ibp, (char *) obp, ip->bufp - ibp); obp += ip->bufp - ibp; ibp = ip->bufp; } break; } /* If this is expanding a macro definition, don't recognize preprocessing directives. */ if (ip->macro != 0) goto randomchar; /* If this is expand_into_temp_buffer, don't recognize them either. Warn about them only after an actual newline at this level, not at the beginning of the input level. */ if (! ip->fname) { if (ip->buf != beg_of_line) warning ("preprocessing directive not recognized within macro arg"); goto randomchar; } if (ident_length) goto specialchar; /* # keyword: a # must be first nonblank char on the line */ if (beg_of_line == 0) goto randomchar; { U_CHAR *bp; /* Scan from start of line, skipping whitespace, comments and backslash-newlines, and see if we reach this #. If not, this # is not special. */ bp = beg_of_line; /* If -traditional, require # to be at beginning of line. */ if (!traditional) { while (1) { if (is_hor_space[*bp]) bp++; else if (*bp == '\\' && bp[1] == '\n') bp += 2; else if (*bp == '/' && bp[1] == '*') { bp += 2; while (1) { if (*bp == '*') { if (bp[1] == '/') { bp += 2; break; } } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (bp, limit - bp); if (length > 1) bp += (length - 1); #endif } bp++; } } /* There is no point in trying to deal with C++ // comments here, because if there is one, then this # must be part of the comment and we would never reach here. */ else break; } if (c == '%') { if (bp[0] != '%') break; while (bp[1] == '\\' && bp[2] == '\n') bp += 2; if (bp + 1 != ibp) break; /* %: appears at start of line; skip past the ':' too. */ bp++; ibp++; } } if (bp + 1 != ibp) goto randomchar; } /* This # can start a directive. */ --obp; /* Don't copy the '#' */ ip->bufp = ibp; op->bufp = obp; if (! handle_directive (ip, op)) { #ifdef USE_C_ALLOCA alloca (0); #endif /* Not a known directive: treat it as ordinary text. IP, OP, IBP, etc. have not been changed. */ if (no_output && instack[indepth].fname) { /* If not generating expanded output, what we do with ordinary text is skip it. Discard everything until next # directive. */ skip_if_group (&instack[indepth], 1, 0); RECACHE; beg_of_line = ibp; break; } *obp++ = '#'; /* Copy # (even if it was originally %:). */ /* Don't expand an identifier that could be a macro directive. (Section 3.8.3 of the ANSI C standard) */ SKIP_WHITE_SPACE (ibp); if (is_idstart[*ibp]) { *obp++ = *ibp++; while (is_idchar[*ibp]) *obp++ = *ibp++; } goto randomchar; } #ifdef USE_C_ALLOCA alloca (0); #endif /* A # directive has been successfully processed. */ /* If not generating expanded output, ignore everything until next # directive. */ if (no_output && instack[indepth].fname) skip_if_group (&instack[indepth], 1, 0); obp = op->bufp; RECACHE; beg_of_line = ibp; break; case '\"': /* skip quoted string */ case '\'': /* A single quoted string is treated like a double -- some programs (e.g., troff) are perverse this way */ /* Handle any pending identifier; but the L in L'...' or L"..." is not an identifier. */ if (ident_length) { if (! (ident_length == 1 && hash == HASHSTEP (0, 'L'))) goto specialchar; ident_length = hash = 0; } start_line = ip->lineno; /* Skip ahead to a matching quote. */ while (1) { if (ibp >= limit) { if (ip->macro != 0) { /* try harder: this string crosses a macro expansion boundary. This can happen naturally if -traditional. Otherwise, only -D can make a macro with an unmatched quote. */ POPMACRO; RECACHE; continue; } if (!traditional) { error_with_line (line_for_error (start_line), "unterminated string or character constant"); if (multiline_string_line) { error_with_line (multiline_string_line, "possible real start of unterminated constant"); multiline_string_line = 0; } } break; } *obp++ = *ibp; switch (*ibp++) { case '\n': ++ip->lineno; ++op->lineno; /* Traditionally, end of line ends a string constant with no error. So exit the loop and record the new line. */ if (traditional) { beg_of_line = ibp; goto while2end; } if (c == '\'') { error_with_line (line_for_error (start_line), "unterminated character constant"); goto while2end; } if (multiline_string_line == 0) { if (pedantic) pedwarn_with_line (line_for_error (start_line), "string constant runs past end of line"); multiline_string_line = ip->lineno - 1; } break; case '\\': if (*ibp == '\n') { /* Backslash newline is replaced by nothing at all, but keep the line counts correct. But if we are reading from a macro, keep the backslash newline, since backslash newlines have already been processed. */ if (ip->macro) *obp++ = '\n'; else --obp; ++ibp; ++ip->lineno; } else { /* ANSI stupidly requires that in \\ the second \ is *not* prevented from combining with a newline. */ if (!ip->macro) { while (*ibp == '\\' && ibp[1] == '\n') { ibp += 2; ++ip->lineno; } } *obp++ = *ibp++; } break; case '\"': case '\'': if (ibp[-1] == c) goto while2end; break; #ifdef MULTIBYTE_CHARS default: { int length; --ibp; length = local_mblen (ibp, limit - ibp); if (length > 0) { --obp; bcopy (ibp, obp, length); obp += length; ibp += length; } else ++ibp; } break; #endif } } while2end: break; case '/': if (ip->macro != 0) goto randomchar; if (*ibp == '\\' && ibp[1] == '\n') newline_fix (ibp); if (*ibp != '*' && !(cplusplus_comments && *ibp == '/')) goto randomchar; if (ident_length) goto specialchar; if (*ibp == '/') { /* C++ style comment... */ start_line = ip->lineno; /* Comments are equivalent to spaces. */ if (! put_out_comments) obp[-1] = ' '; { U_CHAR *before_bp = ibp; while (++ibp < limit) { if (*ibp == '\n') { if (put_out_comments) { bcopy ((char *) before_bp, (char *) obp, ibp - before_bp); obp += ibp - before_bp; } break; } if (*ibp == '\\') { if (ibp + 1 < limit && ibp[1] == '\n') { if (warn_comments) warning ("multiline `//' comment"); ++ip->lineno; /* Copy the newline into the output buffer, in order to avoid the pain of a #line every time a multiline comment is seen. */ if (!put_out_comments) *obp++ = '\n'; ++op->lineno; ++ibp; } } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (ibp, limit - ibp); if (length > 1) ibp += (length - 1); #endif } } break; } } /* Ordinary C comment. Skip it, optionally copying it to output. */ start_line = ip->lineno; ++ibp; /* Skip the star. */ /* If this cpp is for lint, we peek inside the comments: */ if (for_lint) { U_CHAR *argbp; int cmdlen, arglen; char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen); if (lintcmd != NULL) { op->bufp = obp; check_expand (op, cmdlen + arglen + 14); obp = op->bufp; /* I believe it is always safe to emit this newline: */ obp[-1] = '\n'; bcopy ("#pragma lint ", (char *) obp, 13); obp += 13; bcopy (lintcmd, (char *) obp, cmdlen); obp += cmdlen; if (arglen != 0) { *(obp++) = ' '; bcopy (argbp, (char *) obp, arglen); obp += arglen; } /* OK, now bring us back to the state we were in before we entered this branch. We need #line because the #pragma's newline always messes up the line count. */ op->bufp = obp; output_line_directive (ip, op, 0, same_file); check_expand (op, limit - ibp + 2); obp = op->bufp; *(obp++) = '/'; } } /* Comments are equivalent to spaces. Note that we already output the slash; we might not want it. For -traditional, a comment is equivalent to nothing. */ if (! put_out_comments) { if (traditional) obp--; else obp[-1] = ' '; } else *obp++ = '*'; { U_CHAR *before_bp = ibp; for (;;) { switch (*ibp++) { case '*': if (ibp[-2] == '/' && warn_comments) warning ("`/*' within comment"); if (*ibp == '\\' && ibp[1] == '\n') newline_fix (ibp); if (*ibp == '/') goto comment_end; break; case '\n': ++ip->lineno; /* Copy the newline into the output buffer, in order to avoid the pain of a #line every time a multiline comment is seen. */ if (!put_out_comments) *obp++ = '\n'; ++op->lineno; break; case 0: if (limit < ibp) { error_with_line (line_for_error (start_line), "unterminated comment"); goto limit_reached; } break; #ifdef MULTIBYTE_CHARS default: { int length; length = local_mblen (ibp, limit - ibp); if (length > 1) ibp += (length - 1); } break; #endif } } comment_end: ibp++; if (put_out_comments) { bcopy ((char *) before_bp, (char *) obp, ibp - before_bp); obp += ibp - before_bp; } } break; case '$': if (! is_idchar['$']) goto randomchar; if (pedantic) pedwarn ("`$' in identifier"); goto letter; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* If digit is not part of identifier, it starts a number, which means that following letters are not an identifier. "0x5" does not refer to an identifier "x5". So copy all alphanumerics that follow without accumulating as an identifier. Periods also, for sake of "3.e7". */ if (ident_length == 0) { for (;;) { if (!ip->macro) { while (ibp[0] == '\\' && ibp[1] == '\n') { ++ip->lineno; ibp += 2; } } c = *ibp++; if (!is_idchar[c] && c != '.') { --ibp; break; } *obp++ = c; /* A sign can be part of a preprocessing number if it follows an `e' or `p'. */ if (c == 'e' || c == 'E' || c == 'p' || c == 'P') { if (!ip->macro) { while (ibp[0] == '\\' && ibp[1] == '\n') { ++ip->lineno; ibp += 2; } } if (*ibp == '+' || *ibp == '-') { *obp++ = *ibp++; /* But traditional C does not let the token go past the sign, and C89 does not allow `p'. */ if (traditional || (c89 && (c == 'p' || c == 'P'))) break; } } } break; } /* fall through */ case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': letter: ident_length++; /* Compute step of hash function, to avoid a proc call on every token */ hash = HASHSTEP (hash, c); break; case '\n': if (ip->fname == 0 && *ibp == '-') { /* Newline - inhibits expansion of preceding token. If expanding a macro arg, we keep the newline -. In final output, it is deleted. We recognize Newline - in macro bodies and macro args. */ if (! concatenated) { ident_length = 0; hash = 0; } ibp++; if (!output_marks) { obp--; } else { /* If expanding a macro arg, keep the newline -. */ *obp++ = '-'; } break; } /* If reprocessing a macro expansion, newline is a special marker. */ else if (ip->macro != 0) { /* Newline White is a "funny space" to separate tokens that are supposed to be separate but without space between. Here White means any whitespace character. Newline - marks a recursive macro use that is not supposed to be expandable. */ if (is_space[*ibp]) { /* Newline Space does not prevent expansion of preceding token so expand the preceding token and then come back. */ if (ident_length > 0) goto specialchar; /* If generating final output, newline space makes a space. */ if (!output_marks) { obp[-1] = *ibp++; /* And Newline Newline makes a newline, so count it. */ if (obp[-1] == '\n') op->lineno++; } else { /* If expanding a macro arg, keep the newline space. If the arg gets stringified, newline space makes nothing. */ *obp++ = *ibp++; } } else abort (); /* Newline followed by something random? */ break; } /* If there is a pending identifier, handle it and come back here. */ if (ident_length > 0) goto specialchar; beg_of_line = ibp; /* Update the line counts and output a #line if necessary. */ ++ip->lineno; ++op->lineno; if (ip->lineno != op->lineno) { op->bufp = obp; output_line_directive (ip, op, 1, same_file); check_expand (op, limit - ibp); obp = op->bufp; } break; /* Come here either after (1) a null character that is part of the input or (2) at the end of the input, because there is a null there. */ case 0: if (ibp <= limit) /* Our input really contains a null character. */ goto randomchar; limit_reached: /* At end of a macro-expansion level, pop it and read next level. */ if (ip->macro != 0) { obp--; ibp--; /* If traditional, and we have an identifier that ends here, process it now, so we get the right error for recursion. */ if (traditional && ident_length && ! is_idchar[*instack[indepth - 1].bufp]) { redo_char = 1; goto randomchar; } POPMACRO; RECACHE; break; } /* If we don't have a pending identifier, return at end of input. */ if (ident_length == 0) { obp--; ibp--; op->bufp = obp; ip->bufp = ibp; goto ending; } /* If we do have a pending identifier, just consider this null a special character and arrange to dispatch on it again. The second time, IDENT_LENGTH will be zero so we will return. */ /* Fall through */ specialchar: /* Handle the case of a character such as /, ', " or null seen following an identifier. Back over it so that after the identifier is processed the special char will be dispatched on again. */ ibp--; obp--; redo_char = 1; default: randomchar: if (ident_length > 0) { register HASHNODE *hp; /* We have just seen an identifier end. If it's a macro, expand it. IDENT_LENGTH is the length of the identifier and HASH is its hash code. The identifier has already been copied to the output, so if it is a macro we must remove it. If REDO_CHAR is 0, the char that terminated the identifier has been skipped in the output and the input. OBP-IDENT_LENGTH-1 points to the identifier. If the identifier is a macro, we must back over the terminator. If REDO_CHAR is 1, the terminating char has already been backed over. OBP-IDENT_LENGTH points to the identifier. */ if (!pcp_outfile || pcp_inside_if) { for (hp = hashtab[MAKE_POS (hash) % HASHSIZE]; hp != NULL; hp = hp->next) { if (hp->length == ident_length) { int obufp_before_macroname; int op_lineno_before_macroname; register int i = ident_length; register U_CHAR *p = hp->name; register U_CHAR *q = obp - i; int disabled; if (! redo_char) q--; do { /* All this to avoid a strncmp () */ if (*p++ != *q++) goto hashcollision; } while (--i); /* We found a use of a macro name. see if the context shows it is a macro call. */ /* Back up over terminating character if not already done. */ if (! redo_char) { ibp--; obp--; } /* Save this as a displacement from the beginning of the output buffer. We can not save this as a position in the output buffer, because it may get realloc'ed by RECACHE. */ obufp_before_macroname = (obp - op->buf) - ident_length; op_lineno_before_macroname = op->lineno; if (hp->type == T_PCSTRING) { pcstring_used (hp); /* Mark the definition of this key as needed, ensuring that it will be output. */ break; /* Exit loop, since the key cannot have a definition any longer. */ } /* Record whether the macro is disabled. */ disabled = hp->type == T_DISABLED; /* This looks like a macro ref, but if the macro was disabled, just copy its name and put in a marker if requested. */ if (disabled) { #if 0 /* This error check caught useful cases such as #define foo(x,y) bar (x (y,0), y) foo (foo, baz) */ if (traditional) error ("recursive use of macro `%s'", hp->name); #endif if (output_marks) { op->bufp = obp; check_expand (op, limit - ibp + 2); obp = op->bufp; *obp++ = '\n'; *obp++ = '-'; } break; } /* If macro wants an arglist, verify that a '(' follows. first skip all whitespace, copying it to the output after the macro name. Then, if there is no '(', decide this is not a macro call and leave things that way. */ if ((hp->type == T_MACRO || hp->type == T_DISABLED) && hp->value.defn->nargs >= 0) { U_CHAR *old_ibp = ibp; U_CHAR *old_obp = obp; int old_iln = ip->lineno; int old_oln = op->lineno; while (1) { /* Scan forward over whitespace, copying it to the output. */ if (ibp == limit && ip->macro != 0) { POPMACRO; RECACHE; old_ibp = ibp; old_obp = obp; old_iln = ip->lineno; old_oln = op->lineno; } else if (is_space[*ibp]) { *obp++ = *ibp++; if (ibp[-1] == '\n') { if (ip->macro == 0) { /* Newline in a file. Count it. */ ++ip->lineno; ++op->lineno; } else if (!output_marks) { /* A newline mark, and we don't want marks in the output. If it is newline-hyphen, discard it entirely. Otherwise, it is newline-whitechar, so keep the whitechar. */ obp--; if (*ibp == '-') ibp++; else { if (*ibp == '\n') ++op->lineno; *obp++ = *ibp++; } } else { /* A newline mark; copy both chars to the output. */ *obp++ = *ibp++; } } } else if (ip->macro) break; else if (*ibp == '/') { /* If a comment, copy it unchanged or discard it. */ if (ibp[1] == '\\' && ibp[2] == '\n') newline_fix (ibp + 1); if (ibp[1] == '*') { if (put_out_comments) { *obp++ = '/'; *obp++ = '*'; } else if (! traditional) { *obp++ = ' '; } for (ibp += 2; ibp < limit; ibp++) { /* We need not worry about newline-marks, since they are never found in comments. */ if (ibp[0] == '*') { if (ibp[1] == '\\' && ibp[2] == '\n') newline_fix (ibp + 1); if (ibp[1] == '/') { ibp += 2; if (put_out_comments) { *obp++ = '*'; *obp++ = '/'; } break; } } else if (*ibp == '\n') { /* Newline in a file. Count it. */ ++ip->lineno; ++op->lineno; } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (ibp, limit - ibp); if (length > 1) { if (put_out_comments) { bcopy (ibp, obp, length - 1); obp += length - 1; } ibp += (length - 1); } #endif } if (put_out_comments) *obp++ = *ibp; } } else if (ibp[1] == '/' && cplusplus_comments) { if (put_out_comments) { *obp++ = '/'; *obp++ = '/'; } else if (! traditional) { *obp++ = ' '; } for (ibp += 2; ; ibp++) { if (*ibp == '\n') break; if (*ibp == '\\' && ibp[1] == '\n') { if (put_out_comments) *obp++ = *ibp++; } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (ibp, limit - ibp); if (length > 1) { if (put_out_comments) { bcopy (ibp, obp, length - 1); obp += length - 1; } ibp += (length - 1); } #endif } if (put_out_comments) *obp++ = *ibp; } } else break; } else if (ibp[0] == '\\' && ibp[1] == '\n') { ibp += 2; ++ip->lineno; } else break; } if (*ibp != '(') { /* It isn't a macro call. Put back the space that we just skipped. */ ibp = old_ibp; obp = old_obp; ip->lineno = old_iln; op->lineno = old_oln; /* Exit the for loop. */ break; } } /* This is now known to be a macro call. Discard the macro name from the output, along with any following whitespace just copied, but preserve newlines if not outputting marks since this is more likely to do the right thing with line numbers. */ obp = op->buf + obufp_before_macroname; if (output_marks) op->lineno = op_lineno_before_macroname; else { int newlines = op->lineno - op_lineno_before_macroname; while (0 < newlines--) *obp++ = '\n'; } /* Prevent accidental token-pasting with a character before the macro call. */ if (!traditional && obp != op->buf) { switch (obp[-1]) { case '!': case '%': case '&': case '*': case '+': case '-': case '.': case '/': case ':': case '<': case '=': case '>': case '^': case '|': /* If we are expanding a macro arg, make a newline marker to separate the tokens. If we are making real output, a plain space will do. */ if (output_marks) *obp++ = '\n'; *obp++ = ' '; } } /* Expand the macro, reading arguments as needed, and push the expansion on the input stack. */ ip->bufp = ibp; op->bufp = obp; macroexpand (hp, op); /* Reexamine input stack, since macroexpand has pushed a new level on it. */ obp = op->bufp; RECACHE; break; } hashcollision: ; } /* End hash-table-search loop */ } ident_length = hash = 0; /* Stop collecting identifier */ redo_char = 0; concatenated = 0; } /* End if (ident_length > 0) */ } /* End switch */ } /* End per-char loop */ /* Come here to return -- but first give an error message if there was an unterminated successful conditional. */ ending: if (if_stack != ip->if_stack) { char *str; switch (if_stack->type) { case T_IF: str = "if"; break; case T_IFDEF: str = "ifdef"; break; case T_IFNDEF: str = "ifndef"; break; case T_ELSE: str = "else"; break; case T_ELIF: str = "elif"; break; default: abort (); } error_with_line (line_for_error (if_stack->lineno), "unterminated `#%s' conditional", str); } if_stack = ip->if_stack; } /* * Rescan a string into a temporary buffer and return the result * as a FILE_BUF. Note this function returns a struct, not a pointer. * * OUTPUT_MARKS nonzero means keep Newline markers found in the input * and insert such markers when appropriate. See `rescan' for details. * OUTPUT_MARKS is 1 for macroexpanding a macro argument separately * before substitution; it is 0 for other uses. */ static FILE_BUF expand_to_temp_buffer (buf, limit, output_marks, assertions) U_CHAR *buf, *limit; int output_marks, assertions; { register FILE_BUF *ip; FILE_BUF obuf; int length = limit - buf; U_CHAR *buf1; int odepth = indepth; int save_assertions_flag = assertions_flag; assertions_flag = assertions; if (length < 0) abort (); /* Set up the input on the input stack. */ buf1 = (U_CHAR *) alloca (length + 1); { register U_CHAR *p1 = buf; register U_CHAR *p2 = buf1; while (p1 != limit) *p2++ = *p1++; } buf1[length] = 0; /* Set up to receive the output. */ obuf.length = length * 2 + 100; /* Usually enough. Why be stingy? */ obuf.bufp = obuf.buf = (U_CHAR *) xmalloc (obuf.length); obuf.nominal_fname = 0; obuf.inc = 0; obuf.dir = 0; obuf.fname = 0; obuf.macro = 0; obuf.if_stack = 0; obuf.free_ptr = 0; obuf.system_header_p = 0; CHECK_DEPTH ({return obuf;}); ++indepth; ip = &instack[indepth]; ip->fname = 0; ip->nominal_fname = 0; ip->nominal_fname_len = 0; ip->inc = 0; ip->system_header_p = 0; ip->macro = 0; ip->free_ptr = 0; ip->length = length; ip->buf = ip->bufp = buf1; ip->if_stack = if_stack; ip->lineno = obuf.lineno = 1; /* Scan the input, create the output. */ rescan (&obuf, output_marks); /* Pop input stack to original state. */ --indepth; if (indepth != odepth) abort (); /* Record the output. */ obuf.length = obuf.bufp - obuf.buf; assertions_flag = save_assertions_flag; return obuf; } /* * Process a # directive. Expects IP->bufp to point after the '#', as in * `#define foo bar'. Passes to the directive handler * (do_define, do_include, etc.): the addresses of the 1st and * last chars of the directive (starting immediately after the # * keyword), plus op and the keyword table pointer. If the directive * contains comments it is copied into a temporary buffer sans comments * and the temporary buffer is passed to the directive handler instead. * Likewise for backslash-newlines. * * Returns nonzero if this was a known # directive. * Otherwise, returns zero, without advancing the input pointer. */ static int handle_directive (ip, op) FILE_BUF *ip, *op; { register U_CHAR *bp, *cp; register struct directive *kt; register int ident_length; U_CHAR *resume_p; /* Nonzero means we must copy the entire directive to get rid of comments or backslash-newlines. */ int copy_directive = 0; U_CHAR *ident, *after_ident; bp = ip->bufp; /* Record where the directive started. do_xifdef needs this. */ directive_start = bp - 1; ignore_escape_flag = 1; /* Skip whitespace and \-newline. */ while (1) { if (is_hor_space[*bp]) { if (*bp != ' ' && *bp != '\t' && pedantic) pedwarn_strange_white_space (*bp); bp++; } else if (*bp == '/') { if (bp[1] == '\\' && bp[2] == '\n') newline_fix (bp + 1); if (! (bp[1] == '*' || (cplusplus_comments && bp[1] == '/'))) break; ip->bufp = bp + 2; skip_to_end_of_comment (ip, &ip->lineno, 0); bp = ip->bufp; } else if (*bp == '\\' && bp[1] == '\n') { bp += 2; ip->lineno++; } else break; } /* Now find end of directive name. If we encounter a backslash-newline, exchange it with any following symbol-constituents so that we end up with a contiguous name. */ cp = bp; while (1) { if (is_idchar[*cp]) cp++; else { if (*cp == '\\' && cp[1] == '\n') name_newline_fix (cp); if (is_idchar[*cp]) cp++; else break; } } ident_length = cp - bp; ident = bp; after_ident = cp; /* A line of just `#' becomes blank. */ if (ident_length == 0 && *after_ident == '\n') { ip->bufp = after_ident; return 1; } if (ident_length == 0 || !is_idstart[*ident]) { U_CHAR *p = ident; while (is_idchar[*p]) { if (*p < '0' || *p > '9') break; p++; } /* Handle # followed by a line number. */ if (p != ident && !is_idchar[*p]) { static struct directive line_directive_table[] = { { 4, do_line, "line", T_LINE}, }; if (pedantic) pedwarn ("`#' followed by integer"); after_ident = ident; kt = line_directive_table; ignore_escape_flag = 0; goto old_linenum; } /* Avoid error for `###' and similar cases unless -pedantic. */ if (p == ident) { while (*p == '#' || is_hor_space[*p]) p++; if (*p == '\n') { if (pedantic && !lang_asm) warning ("invalid preprocessing directive"); return 0; } } if (!lang_asm) error ("invalid preprocessing directive name"); return 0; } /* * Decode the keyword and call the appropriate expansion * routine, after moving the input pointer up to the next line. */ for (kt = directive_table; kt->length > 0; kt++) { if (kt->length == ident_length && !bcmp (kt->name, ident, ident_length)) { register U_CHAR *buf; register U_CHAR *limit; int unterminated; int junk; int *already_output; /* Nonzero means do not delete comments within the directive. #define needs this when -traditional. */ int keep_comments; old_linenum: limit = ip->buf + ip->length; unterminated = 0; already_output = 0; keep_comments = traditional && kt->type == T_DEFINE; /* #import is defined only in Objective C, or when on the NeXT. */ if (kt->type == T_IMPORT && !(objc || lookup ((U_CHAR *) "__NeXT__", -1, -1))) break; /* Find the end of this directive (first newline not backslashed and not in a string or comment). Set COPY_DIRECTIVE if the directive must be copied (it contains a backslash-newline or a comment). */ buf = bp = after_ident; while (bp < limit) { register U_CHAR c = *bp++; switch (c) { case '\\': if (bp < limit) { if (*bp == '\n') { ip->lineno++; copy_directive = 1; bp++; } else if (traditional) bp++; } break; case '"': /* "..." is special for #include. */ if (IS_INCLUDE_DIRECTIVE_TYPE (kt->type)) { while (bp < limit && *bp != '\n') { if (*bp == '"') { bp++; break; } if (*bp == '\\' && bp[1] == '\n') { ip->lineno++; copy_directive = 1; bp++; } bp++; } break; } /* Fall through. */ case '\'': bp = skip_quoted_string (bp - 1, limit, ip->lineno, &ip->lineno, ©_directive, &unterminated); /* Don't bother calling the directive if we already got an error message due to unterminated string. Skip everything and pretend we called the directive. */ if (unterminated) { if (traditional) { /* Traditional preprocessing permits unterminated strings. */ ip->bufp = bp; goto endloop1; } ip->bufp = bp; return 1; } break; /* <...> is special for #include. */ case '<': if (! IS_INCLUDE_DIRECTIVE_TYPE (kt->type)) break; while (bp < limit && *bp != '>' && *bp != '\n') { if (*bp == '\\' && bp[1] == '\n') { ip->lineno++; copy_directive = 1; bp++; } bp++; } break; case '/': if (*bp == '\\' && bp[1] == '\n') newline_fix (bp); if (*bp == '*' || (cplusplus_comments && *bp == '/')) { U_CHAR *obp = bp - 1; ip->bufp = bp + 1; skip_to_end_of_comment (ip, &ip->lineno, 0); bp = ip->bufp; /* No need to copy the directive because of a comment at the end; just don't include the comment in the directive. */ if (!put_out_comments) { U_CHAR *p; for (p = bp; *p == ' ' || *p == '\t'; p++) continue; if (*p == '\n') { bp = obp; goto endloop1; } } /* Don't remove the comments if -traditional. */ if (! keep_comments) copy_directive++; } break; case '\f': case '\r': case '\v': if (pedantic) pedwarn_strange_white_space (c); break; case '\n': --bp; /* Point to the newline */ ip->bufp = bp; goto endloop1; } } ip->bufp = bp; endloop1: resume_p = ip->bufp; /* BP is the end of the directive. RESUME_P is the next interesting data after the directive. A comment may come between. */ /* If a directive should be copied through, and -C was given, pass it through before removing comments. */ if (!no_output && put_out_comments && ((kt->type == T_DEFINE || kt->type == T_UNDEF) ? dump_macros == dump_definitions : IS_INCLUDE_DIRECTIVE_TYPE (kt->type) ? dump_includes : kt->type == T_PRAGMA)) { int len; /* Output directive name. */ check_expand (op, kt->length + 2); /* Make sure # is at the start of a line */ if (op->bufp > op->buf && op->bufp[-1] != '\n') { op->lineno++; *op->bufp++ = '\n'; } *op->bufp++ = '#'; bcopy (kt->name, op->bufp, kt->length); op->bufp += kt->length; /* Output arguments. */ len = (bp - buf); check_expand (op, len); bcopy (buf, (char *) op->bufp, len); op->bufp += len; /* Take account of any (escaped) newlines just output. */ while (--len >= 0) if (buf[len] == '\n') op->lineno++; already_output = &junk; } /* Don't we need a newline or #line? */ if (copy_directive) { register U_CHAR *xp = buf; /* Need to copy entire directive into temp buffer before dispatching */ cp = (U_CHAR *) alloca (bp - buf + 5); /* room for directive plus some slop */ buf = cp; /* Copy to the new buffer, deleting comments and backslash-newlines (and whitespace surrounding the latter). */ while (xp < bp) { register U_CHAR c = *xp++; *cp++ = c; switch (c) { case '\n': abort (); /* A bare newline should never part of the line. */ break; /* <...> is special for #include. */ case '<': if (! IS_INCLUDE_DIRECTIVE_TYPE (kt->type)) break; while (xp < bp && c != '>') { c = *xp++; if (c == '\\' && xp < bp && *xp == '\n') xp++; else *cp++ = c; } break; case '\\': if (*xp == '\n') { xp++; cp--; if (cp != buf && is_hor_space[cp[-1]]) { while (cp - 1 != buf && is_hor_space[cp[-2]]) cp--; SKIP_WHITE_SPACE (xp); } else if (is_hor_space[*xp]) { *cp++ = *xp++; SKIP_WHITE_SPACE (xp); } } else if (traditional && xp < bp) { *cp++ = *xp++; } break; case '\'': case '\"': { int backslash_newlines_p = 0; register U_CHAR *bp1 = skip_quoted_string (xp - 1, bp, ip->lineno, NULL_PTR, &backslash_newlines_p, NULL_PTR); if (backslash_newlines_p) while (xp != bp1) { /* With something like: #define X "a\ b" we should still remove the backslash-newline pair as part of phase two. */ if (xp[0] == '\\' && xp[1] == '\n') xp += 2; else *cp++ = *xp++; } else /* This is the same as the loop above, but taking advantage of the fact that we know there are no backslash-newline pairs. */ while (xp != bp1) *cp++ = *xp++; } break; case '/': if (*xp == '*' || (cplusplus_comments && *xp == '/')) { ip->bufp = xp + 1; /* If we already copied the directive through, already_output != 0 prevents outputting comment now. */ skip_to_end_of_comment (ip, already_output, 0); if (keep_comments) while (xp != ip->bufp) *cp++ = *xp++; /* Delete or replace the slash. */ else if (traditional) cp--; else cp[-1] = ' '; xp = ip->bufp; } } } /* Null-terminate the copy. */ *cp = 0; } else cp = bp; ip->bufp = resume_p; /* Some directives should be written out for cc1 to process, just as if they were not defined. And sometimes we're copying directives through. */ if (!no_output && already_output == 0 && (kt->type == T_DEFINE ? (int) dump_names <= (int) dump_macros : IS_INCLUDE_DIRECTIVE_TYPE (kt->type) ? dump_includes : kt->type == T_PRAGMA)) { int len; /* Output directive name. */ check_expand (op, kt->length + 1); *op->bufp++ = '#'; bcopy (kt->name, (char *) op->bufp, kt->length); op->bufp += kt->length; if (kt->type == T_DEFINE && dump_macros == dump_names) { /* Output `#define name' only. */ U_CHAR *xp = buf; U_CHAR *yp; SKIP_WHITE_SPACE (xp); yp = xp; while (is_idchar[*xp]) xp++; len = (xp - yp); check_expand (op, len + 1); *op->bufp++ = ' '; bcopy (yp, (char *) op->bufp, len); } else { /* Output entire directive. */ len = (cp - buf); check_expand (op, len); bcopy (buf, (char *) op->bufp, len); } op->bufp += len; } /* Don't we need a newline or #line? */ /* Call the appropriate directive handler. buf now points to either the appropriate place in the input buffer, or to the temp buffer if it was necessary to make one. cp points to the first char after the contents of the (possibly copied) directive, in either case. */ (*kt->func) (buf, cp, op, kt); check_expand (op, ip->length - (ip->bufp - ip->buf)); return 1; } } /* It is deliberate that we don't warn about undefined directives. That is the responsibility of cc1. */ return 0; } static struct tm * timestamp () { static struct tm *timebuf; if (!timebuf) { time_t t = time ((time_t *) 0); timebuf = localtime (&t); } return timebuf; } static char *monthnames[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; /* * expand things like __FILE__. Place the expansion into the output * buffer *without* rescanning. */ static void special_symbol (hp, op) HASHNODE *hp; FILE_BUF *op; { char *buf; int i, len; int true_indepth; FILE_BUF *ip = NULL; struct tm *timebuf; int paren = 0; /* For special `defined' keyword */ if (pcp_outfile && pcp_inside_if && hp->type != T_SPEC_DEFINED && hp->type != T_CONST) error ("Predefined macro `%s' used inside `#if' during precompilation", hp->name); for (i = indepth; i >= 0; i--) if (instack[i].fname != NULL) { ip = &instack[i]; break; } if (ip == NULL) { error ("cccp error: not in any file?!"); return; /* the show must go on */ } switch (hp->type) { case T_FILE: case T_BASE_FILE: { FILE_BUF *p = hp->type == T_FILE ? ip : &instack[0]; char *string = p->nominal_fname; if (string) { size_t string_len = p->nominal_fname_len; buf = (char *) alloca (3 + 4 * string_len); quote_string (buf, string, string_len); } else buf = "\"\""; break; } case T_INCLUDE_LEVEL: true_indepth = 0; for (i = indepth; i >= 0; i--) if (instack[i].fname != NULL) true_indepth++; buf = (char *) alloca (8); /* Eight bytes ought to be more than enough */ sprintf (buf, "%d", true_indepth - 1); break; case T_VERSION: buf = (char *) alloca (3 + strlen (version_string)); sprintf (buf, "\"%s\"", version_string); break; #ifndef NO_BUILTIN_SIZE_TYPE case T_SIZE_TYPE: buf = SIZE_TYPE; break; #endif #ifndef NO_BUILTIN_PTRDIFF_TYPE case T_PTRDIFF_TYPE: buf = PTRDIFF_TYPE; break; #endif case T_WCHAR_TYPE: buf = wchar_type; break; case T_USER_LABEL_PREFIX_TYPE: buf = user_label_prefix; break; case T_REGISTER_PREFIX_TYPE: buf = REGISTER_PREFIX; break; case T_IMMEDIATE_PREFIX_TYPE: buf = IMMEDIATE_PREFIX; break; case T_CONST: buf = hp->value.cpval; #ifdef STDC_0_IN_SYSTEM_HEADERS if (ip->system_header_p && hp->length == 8 && bcmp (hp->name, "__STDC__", 8) == 0 && !lookup ((U_CHAR *) "__STRICT_ANSI__", -1, -1)) buf = "0"; #endif if (pcp_inside_if && pcp_outfile) /* Output a precondition for this macro use */ fprintf (pcp_outfile, "#define %s %s\n", hp->name, buf); break; case T_SPECLINE: buf = (char *) alloca (10); sprintf (buf, "%d", ip->lineno); break; case T_DATE: case T_TIME: buf = (char *) alloca (20); timebuf = timestamp (); if (hp->type == T_DATE) sprintf (buf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon], timebuf->tm_mday, timebuf->tm_year + 1900); else sprintf (buf, "\"%02d:%02d:%02d\"", timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec); break; case T_SPEC_DEFINED: buf = " 0 "; /* Assume symbol is not defined */ ip = &instack[indepth]; SKIP_WHITE_SPACE (ip->bufp); if (*ip->bufp == '(') { paren++; ip->bufp++; /* Skip over the paren */ SKIP_WHITE_SPACE (ip->bufp); } if (!is_idstart[*ip->bufp]) goto oops; if (ip->bufp[0] == 'L' && (ip->bufp[1] == '\'' || ip->bufp[1] == '"')) goto oops; if ((hp = lookup (ip->bufp, -1, -1))) { if (pcp_outfile && pcp_inside_if && (hp->type == T_CONST || (hp->type == T_MACRO && hp->value.defn->predefined))) /* Output a precondition for this macro use. */ fprintf (pcp_outfile, "#define %s\n", hp->name); buf = " 1 "; } else if (pcp_outfile && pcp_inside_if) { /* Output a precondition for this macro use */ U_CHAR *cp = ip->bufp; fprintf (pcp_outfile, "#undef "); while (is_idchar[*cp]) /* Ick! */ fputc (*cp++, pcp_outfile); putc ('\n', pcp_outfile); } while (is_idchar[*ip->bufp]) ++ip->bufp; SKIP_WHITE_SPACE (ip->bufp); if (paren) { if (*ip->bufp != ')') goto oops; ++ip->bufp; } break; oops: error ("`defined' without an identifier"); break; default: error ("cccp error: invalid special hash type"); /* time for gdb */ abort (); } len = strlen (buf); check_expand (op, len); bcopy (buf, (char *) op->bufp, len); op->bufp += len; return; } /* Routines to handle #directives */ /* Handle #include and #import. This function expects to see "fname" or on the input. */ static int do_include (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword; { U_CHAR *importing = keyword->type == T_IMPORT ? (U_CHAR *) "" : (U_CHAR *) 0; int skip_dirs = (keyword->type == T_INCLUDE_NEXT); static int import_warning = 0; char *fname; /* Dynamically allocated fname buffer */ char *pcftry; char *pcfname; char *fbeg, *fend; /* Beginning and end of fname */ U_CHAR *fin; struct file_name_list *search_start = include; /* Chain of dirs to search */ struct file_name_list *dsp; /* First in chain, if #include "..." */ struct file_name_list *searchptr = 0; size_t flen; int f = -3; /* file number */ struct include_file *inc = 0; int retried = 0; /* Have already tried macro expanding the include line*/ int angle_brackets = 0; /* 0 for "...", 1 for <...> */ #ifdef VMS int vaxc_include = 0; /* 1 for token without punctuation */ #endif int pcf = -1; char *pcfbuf; char *pcfbuflimit; int pcfnum; if (pedantic && !instack[indepth].system_header_p) { if (importing) pedwarn ("ANSI C does not allow `#import'"); if (skip_dirs) pedwarn ("ANSI C does not allow `#include_next'"); } if (importing && warn_import && !inhibit_warnings && !instack[indepth].system_header_p && !import_warning) { import_warning = 1; warning ("using `#import' is not recommended"); notice ("The fact that a certain header file need not be processed more than once\n\ should be indicated in the header file, not where it is used.\n\ The best way to do this is with a conditional of this form:\n\ \n\ #ifndef _FOO_H_INCLUDED\n\ #define _FOO_H_INCLUDED\n\ ... ...\n\ #endif /* Not _FOO_H_INCLUDED */\n\ \n\ Then users can use `#include' any number of times.\n\ GNU C automatically avoids processing the file more than once\n\ when it is equipped with such a conditional.\n"); } get_filename: fin = buf; SKIP_WHITE_SPACE (fin); /* Discard trailing whitespace so we can easily see if we have parsed all the significant chars we were given. */ while (limit != fin && is_hor_space[limit[-1]]) limit--; fbeg = fend = (char *) alloca (limit - fin); switch (*fin++) { case '\"': { FILE_BUF *fp; /* Copy the operand text, concatenating the strings. */ { for (;;) { for (;;) { if (fin == limit) goto invalid_include_file_name; *fend = *fin++; if (*fend == '"') break; fend++; } if (fin == limit) break; /* If not at the end, there had better be another string. */ /* Skip just horiz space, and don't go past limit. */ while (fin != limit && is_hor_space[*fin]) fin++; if (fin != limit && *fin == '\"') fin++; else goto fail; } } /* We have "filename". Figure out directory this source file is coming from and put it on the front of the list. */ /* If -I- was specified, don't search current dir, only spec'd ones. */ if (ignore_srcdir) break; for (fp = &instack[indepth]; fp >= instack; fp--) { int n; char *nam; if ((nam = fp->nominal_fname) != NULL) { /* Found a named file. Figure out dir of the file, and put it in front of the search list. */ dsp = ((struct file_name_list *) alloca (sizeof (struct file_name_list) + fp->nominal_fname_len)); strcpy (dsp->fname, nam); simplify_filename (dsp->fname); nam = base_name (dsp->fname); *nam = 0; #ifdef VMS /* for hack_vms_include_specification(), a local dir specification must start with "./" on VMS. */ if (nam == dsp->fname) { *nam++ = '.'; *nam++ = '/'; *nam = 0; } #endif /* But for efficiency's sake, do not insert the dir if it matches the search list's first dir. */ dsp->next = search_start; if (!search_start || strcmp (dsp->fname, search_start->fname)) { search_start = dsp; n = nam - dsp->fname; if (n + INCLUDE_LEN_FUDGE > max_include_len) max_include_len = n + INCLUDE_LEN_FUDGE; } dsp[0].got_name_map = 0; break; } } break; } case '<': while (fin != limit && *fin != '>') *fend++ = *fin++; if (*fin == '>' && fin + 1 == limit) { angle_brackets = 1; /* If -I-, start with the first -I dir after the -I-. */ search_start = first_bracket_include; break; } goto fail; default: #ifdef VMS /* * Support '#include xyz' like VAX-C to allow for easy use of all the * decwindow include files. It defaults to '#include ' (so the * code from case '<' is repeated here) and generates a warning. * (Note: macro expansion of `xyz' takes precedence.) */ /* Note: The argument of ISALPHA() can be evaluated twice, so do the pre-decrement outside of the macro. */ if (retried && (--fin, ISALPHA(*(U_CHAR *) (fin)))) { while (fin != limit && (!ISSPACE(*fin))) *fend++ = *fin++; warning ("VAX-C-style include specification found, use '#include ' !"); vaxc_include = 1; if (fin == limit) { angle_brackets = 1; /* If -I-, start with the first -I dir after the -I-. */ search_start = first_bracket_include; break; } } #endif fail: if (! retried) { /* Expand buffer and then remove any newline markers. We can't just tell expand_to_temp_buffer to omit the markers, since it would put extra spaces in include file names. */ FILE_BUF trybuf; U_CHAR *src; int errors_before_expansion = errors; trybuf = expand_to_temp_buffer (buf, limit, 1, 0); if (errors != errors_before_expansion) { free (trybuf.buf); goto invalid_include_file_name; } src = trybuf.buf; buf = (U_CHAR *) alloca (trybuf.bufp - trybuf.buf + 1); limit = buf; while (src != trybuf.bufp) { switch ((*limit++ = *src++)) { case '\n': limit--; src++; break; case '\'': case '\"': { U_CHAR *src1 = skip_quoted_string (src - 1, trybuf.bufp, 0, NULL_PTR, NULL_PTR, NULL_PTR); while (src != src1) *limit++ = *src++; } break; } } *limit = 0; free (trybuf.buf); retried = 1; goto get_filename; } invalid_include_file_name: error ("`#%s' expects \"FILENAME\" or ", keyword->name); return 0; } /* For #include_next, skip in the search path past the dir in which the containing file was found. */ if (skip_dirs) { FILE_BUF *fp; for (fp = &instack[indepth]; fp >= instack; fp--) if (fp->fname != NULL) { /* fp->dir is null if the containing file was specified with an absolute file name. In that case, don't skip anything. */ if (fp->dir) search_start = fp->dir->next; break; } } *fend = 0; flen = simplify_filename (fbeg); if (flen == 0) { error ("empty file name in `#%s'", keyword->name); return 0; } /* Allocate this permanently, because it gets stored in the definitions of macros. */ fname = xmalloc (max_include_len + flen + 1); /* + 1 above for terminating null. */ system_include_depth += angle_brackets; /* If specified file name is absolute, just open it. */ if (absolute_filename (fbeg)) { strcpy (fname, fbeg); f = open_include_file (fname, NULL_PTR, importing, &inc); } else { struct bypass_dir { struct bypass_dir *next; char *fname; struct file_name_list *searchptr; } **bypass_slot = 0; /* Search directory path, trying to open the file. Copy each filename tried into FNAME. */ for (searchptr = search_start; searchptr; searchptr = searchptr->next) { if (searchptr == first_bracket_include) { /* Go to bypass directory if we know we've seen this file before. */ static struct bypass_dir *bypass_hashtab[INCLUDE_HASHSIZE]; struct bypass_dir *p; bypass_slot = &bypass_hashtab[hashf ((U_CHAR *) fbeg, flen, INCLUDE_HASHSIZE)]; for (p = *bypass_slot; p; p = p->next) if (!strcmp (fbeg, p->fname)) { searchptr = p->searchptr; bypass_slot = 0; break; } } #ifdef VMS /* Change this 1/2 Unix 1/2 VMS file specification into a full VMS file specification */ if (searchptr->fname[0]) { strcpy (fname, searchptr->fname); if (fname[strlen (fname) - 1] == ':') { char *slashp; slashp = strchr (fbeg, '/'); /* start at root-dir of logical device if no path given. */ if (slashp == 0) strcat (fname, "[000000]"); } strcat (fname, fbeg); /* Fix up the filename */ hack_vms_include_specification (fname, vaxc_include); } else { /* This is a normal VMS filespec, so use it unchanged. */ strcpy (fname, fbeg); /* if it's '#include filename', add the missing .h */ if (vaxc_include && index(fname,'.')==NULL) strcat (fname, ".h"); } #else strcpy (fname, searchptr->fname); strcat (fname, fbeg); #endif /* VMS */ f = open_include_file (fname, searchptr, importing, &inc); if (f != -1) { if (bypass_slot && searchptr != first_bracket_include) { /* This is the first time we found this include file, and we found it after first_bracket_include. Record its location so that we can bypass to here next time. */ struct bypass_dir *p = (struct bypass_dir *) xmalloc (sizeof (struct bypass_dir)); p->next = *bypass_slot; p->fname = fname + strlen (searchptr->fname); p->searchptr = searchptr; *bypass_slot = p; } break; } #ifdef VMS /* Our VMS hacks can produce invalid filespecs, so don't worry about errors other than EACCES. */ if (errno == EACCES) break; #else if (errno != ENOENT && errno != ENOTDIR) break; #endif } } if (f < 0) { if (f == -2) { /* The file was already included. */ /* If generating dependencies and -MG was specified, we assume missing files are leaf files, living in the same directory as the source file or other similar place; these missing files may be generated from other files and may not exist yet (eg: y.tab.h). */ } else if (print_deps_missing_files && (system_include_depth != 0) < print_deps) { /* If it was requested as a system header file, then assume it belongs in the first place to look for such. */ if (angle_brackets) { if (search_start) { char *p = (char *) alloca (strlen (search_start->fname) + strlen (fbeg) + 1); strcpy (p, search_start->fname); strcat (p, fbeg); deps_output (p, ' '); } } else { /* Otherwise, omit the directory, as if the file existed in the directory with the source. */ deps_output (fbeg, ' '); } } /* If -M was specified, and this header file won't be added to the dependency list, then don't count this as an error, because we can still produce correct output. Otherwise, we can't produce correct output, because there may be dependencies we need inside the missing file, and we don't know what directory this missing file exists in. */ else if (0 < print_deps && print_deps <= (system_include_depth != 0)) warning ("No include path in which to find %s", fbeg); else if (f != -3) error_from_errno (fbeg); else error ("No include path in which to find %s", fbeg); } else { /* Actually process the file. */ pcftry = (char *) alloca (strlen (fname) + 30); pcfbuf = 0; pcfnum = 0; if (!no_precomp) { do { sprintf (pcftry, "%s%d", fname, pcfnum++); pcf = open (pcftry, O_RDONLY, 0666); if (pcf != -1) { struct stat s; if (fstat (pcf, &s) != 0) pfatal_with_name (pcftry); if (! INO_T_EQ (inc->st.st_ino, s.st_ino) || inc->st.st_dev != s.st_dev) { pcfbuf = check_precompiled (pcf, &s, fname, &pcfbuflimit); /* Don't need it any more. */ close (pcf); } else { /* Don't need it at all. */ close (pcf); break; } } } while (pcf != -1 && !pcfbuf); } /* Actually process the file */ if (pcfbuf) { pcfname = xmalloc (strlen (pcftry) + 1); strcpy (pcfname, pcftry); pcfinclude ((U_CHAR *) pcfbuf, (U_CHAR *) fname, op); } else finclude (f, inc, op, is_system_include (fname), searchptr); } system_include_depth -= angle_brackets; return 0; } /* Return nonzero if the given FILENAME is an absolute pathname which designates a file within one of the known "system" include file directories. We assume here that if the given FILENAME looks like it is the name of a file which resides either directly in a "system" include file directory, or within any subdirectory thereof, then the given file must be a "system" include file. This function tells us if we should suppress pedantic errors/warnings for the given FILENAME. The value is 2 if the file is a C-language system header file for which C++ should (on most systems) assume `extern "C"'. */ static int is_system_include (filename) register char *filename; { struct file_name_list *searchptr; for (searchptr = first_system_include; searchptr; searchptr = searchptr->next) if (! strncmp (searchptr->fname, filename, strlen (searchptr->fname))) return searchptr->c_system_include_path + 1; return 0; } /* Yield the non-directory suffix of a file name. */ static char * base_name (fname) char *fname; { char *s = fname; char *p; #if defined (__MSDOS__) || defined (_WIN32) if (ISALPHA (s[0]) && s[1] == ':') s += 2; #endif #ifdef VMS if ((p = rindex (s, ':'))) s = p + 1; /* Skip device. */ if ((p = rindex (s, ']'))) s = p + 1; /* Skip directory. */ if ((p = rindex (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */ if (s != fname) return s; #endif if ((p = rindex (s, '/'))) s = p + 1; #ifdef DIR_SEPARATOR if ((p = rindex (s, DIR_SEPARATOR))) s = p + 1; #endif return s; } /* Yield nonzero if FILENAME is absolute (i.e. not relative). */ static int absolute_filename (filename) char *filename; { #if defined (__MSDOS__) \ || (defined (_WIN32) && !defined (__CYGWIN__) && !defined (_UWIN)) if (ISALPHA (filename[0]) && filename[1] == ':') filename += 2; #endif #if defined (__CYGWIN__) /* At present, any path that begins with a drive spec is absolute. */ if (ISALPHA (filename[0]) && filename[1] == ':') return 1; #endif #ifdef VMS if (index (filename, ':') != 0) return 1; #endif if (filename[0] == '/') return 1; #ifdef DIR_SEPARATOR if (filename[0] == DIR_SEPARATOR) return 1; #endif return 0; } /* Returns whether or not a given character is a directory separator. Used by simplify_filename. */ static inline int is_dir_separator(ch) char ch; { return (ch == DIR_SEPARATOR) #if defined (DIR_SEPARATOR_2) || (ch == DIR_SEPARATOR_2) #endif ; } /* Remove unnecessary characters from FILENAME in place, to avoid unnecessary filename aliasing. Return the length of the resulting string. Do only the simplifications allowed by Posix. It is OK to miss simplifications on non-Posix hosts, since this merely leads to suboptimal results. */ static size_t simplify_filename (filename) char *filename; { register char *from = filename; register char *to = filename; char *to0; /* Remove redundant initial /s. */ if (is_dir_separator (*from)) { *to++ = DIR_SEPARATOR; if (is_dir_separator (*++from)) { if (is_dir_separator (*++from)) { /* 3 or more initial /s are equivalent to 1 /. */ while (is_dir_separator (*++from)) continue; } else { /* On some hosts // differs from /; Posix allows this. */ *to++ = DIR_SEPARATOR; } } } to0 = to; for (;;) { #ifndef VMS if (from[0] == '.' && from[1] == '/') from += 2; else #endif { /* Copy this component and trailing DIR_SEPARATOR, if any. */ while (!is_dir_separator (*to++ = *from++)) { if (!to[-1]) { /* Trim . component at end of nonempty name. */ to -= filename <= to - 3 && to[-3] == DIR_SEPARATOR && to[-2] == '.'; /* Trim unnecessary trailing /s. */ while (to0 < --to && to[-1] == DIR_SEPARATOR) continue; *to = 0; return to - filename; } } #if defined(DIR_SEPARATOR_2) /* Simplify to one directory separator. */ to[-1] = DIR_SEPARATOR; #endif } /* Skip /s after a /. */ while (is_dir_separator (*from)) from++; } } /* The file_name_map structure holds a mapping of file names for a particular directory. This mapping is read from the file named FILE_NAME_MAP_FILE in that directory. Such a file can be used to map filenames on a file system with severe filename restrictions, such as DOS. The format of the file name map file is just a series of lines with two tokens on each line. The first token is the name to map, and the second token is the actual name to use. */ struct file_name_map { struct file_name_map *map_next; char *map_from; char *map_to; }; #define FILE_NAME_MAP_FILE "header.gcc" /* Read a space delimited string of unlimited length from a stdio file. */ static char * read_filename_string (ch, f) int ch; FILE *f; { char *alloc, *set; int len; len = 20; set = alloc = xmalloc (len + 1); if (! is_space[ch]) { *set++ = ch; while ((ch = getc (f)) != EOF && ! is_space[ch]) { if (set - alloc == len) { len *= 2; alloc = xrealloc (alloc, len + 1); set = alloc + len / 2; } *set++ = ch; } } *set = '\0'; ungetc (ch, f); return alloc; } /* Read the file name map file for DIRNAME. If DIRNAME is empty, read the map file for the working directory; otherwise DIRNAME must end in '/'. */ static struct file_name_map * read_name_map (dirname) char *dirname; { /* This structure holds a linked list of file name maps, one per directory. */ struct file_name_map_list { struct file_name_map_list *map_list_next; char *map_list_name; struct file_name_map *map_list_map; }; static struct file_name_map_list *map_list; register struct file_name_map_list *map_list_ptr; char *name; FILE *f; size_t dirlen; for (map_list_ptr = map_list; map_list_ptr; map_list_ptr = map_list_ptr->map_list_next) if (! strcmp (map_list_ptr->map_list_name, dirname)) return map_list_ptr->map_list_map; map_list_ptr = ((struct file_name_map_list *) xmalloc (sizeof (struct file_name_map_list))); map_list_ptr->map_list_name = xstrdup (dirname); map_list_ptr->map_list_map = NULL; dirlen = strlen (dirname); name = (char *) alloca (dirlen + strlen (FILE_NAME_MAP_FILE) + 1); strcpy (name, dirname); strcat (name, FILE_NAME_MAP_FILE); f = fopen (name, "r"); if (!f) map_list_ptr->map_list_map = NULL; else { int ch; while ((ch = getc (f)) != EOF) { char *from, *to; struct file_name_map *ptr; size_t tolen; if (is_space[ch]) continue; from = read_filename_string (ch, f); while ((ch = getc (f)) != EOF && is_hor_space[ch]) ; to = read_filename_string (ch, f); simplify_filename (from); tolen = simplify_filename (to); ptr = ((struct file_name_map *) xmalloc (sizeof (struct file_name_map))); ptr->map_from = from; /* Make the real filename absolute. */ if (absolute_filename (to)) ptr->map_to = to; else { ptr->map_to = xmalloc (dirlen + tolen + 1); strcpy (ptr->map_to, dirname); strcat (ptr->map_to, to); free (to); } ptr->map_next = map_list_ptr->map_list_map; map_list_ptr->map_list_map = ptr; while ((ch = getc (f)) != '\n') if (ch == '\r') continue; if (ch == EOF) break; } fclose (f); } map_list_ptr->map_list_next = map_list; map_list = map_list_ptr; return map_list_ptr->map_list_map; } /* Try to open include file FILENAME. SEARCHPTR is the directory being tried from the include file search path. IMPORTING is "" if we are importing, null otherwise. Return -2 if found, either a matching name or a matching inode. Otherwise, open the file and return a file descriptor if successful or -1 if unsuccessful. Unless unsuccessful, put a descriptor of the included file into *PINC. This function maps filenames on file systems based on information read by read_name_map. */ static int open_include_file (filename, searchptr, importing, pinc) char *filename; struct file_name_list *searchptr; U_CHAR *importing; struct include_file **pinc; { char *fname = remap ? remap_include_file (filename, searchptr) : filename; int fd = -2; /* Look up FNAME in include_hashtab. */ struct include_file **phead = &include_hashtab[hashf ((U_CHAR *) fname, strlen (fname), INCLUDE_HASHSIZE)]; struct include_file *inc, *head = *phead; for (inc = head; inc; inc = inc->next) if (!strcmp (fname, inc->fname)) break; if (!inc || ! inc->control_macro || (inc->control_macro[0] && ! lookup (inc->control_macro, -1, -1))) { fd = open (fname, O_RDONLY, 0); if (fd < 0) { #ifdef VMS /* if #include fails, try again with hacked spec. */ if (!hack_vms_include_specification (fname, 0)) return fd; fd = open (fname, O_RDONLY, 0); if (fd < 0) #endif return fd; } if (!inc) { /* FNAME was not in include_hashtab; insert a new entry. */ inc = (struct include_file *) xmalloc (sizeof (struct include_file)); inc->next = head; inc->fname = fname; inc->control_macro = 0; inc->deps_output = 0; if (fstat (fd, &inc->st) != 0) pfatal_with_name (fname); *phead = inc; /* Look for another file with the same inode and device. */ if (lookup_ino_include (inc) && inc->control_macro && (!inc->control_macro[0] || lookup (inc->control_macro, -1, -1))) { close (fd); fd = -2; } } /* For -M, add this file to the dependencies. */ if (! inc->deps_output && (system_include_depth != 0) < print_deps) { inc->deps_output = 1; deps_output (fname, ' '); } /* Handle -H option. */ if (print_include_names) fprintf (stderr, "%*s%s\n", indepth, "", fname); } if (importing) inc->control_macro = importing; *pinc = inc; return fd; } /* Return the remapped name of the include file FILENAME. SEARCHPTR is the directory being tried from the include file path. */ static char * remap_include_file (filename, searchptr) char *filename; struct file_name_list *searchptr; { register struct file_name_map *map; register char *from; if (searchptr) { if (! searchptr->got_name_map) { searchptr->name_map = read_name_map (searchptr->fname); searchptr->got_name_map = 1; } /* Check the mapping for the directory we are using. */ from = filename + strlen (searchptr->fname); for (map = searchptr->name_map; map; map = map->map_next) if (! strcmp (map->map_from, from)) return map->map_to; } from = base_name (filename); if (from != filename || !searchptr) { /* Try to find a mapping file for the particular directory we are looking in. Thus #include will look up sys/types.h in /usr/include/header.gcc and look up types.h in /usr/include/sys/header.gcc. */ char *dir = (char *) alloca (from - filename + 1); bcopy (filename, dir, from - filename); dir[from - filename] = '\0'; for (map = read_name_map (dir); map; map = map->map_next) if (! strcmp (map->map_from, from)) return map->map_to; } return filename; } /* Insert INC into the include file table, hashed by device and inode number. If a file with different name but same dev+ino was already in the table, return 1 and set INC's control macro to the already-known macro. */ static int lookup_ino_include (inc) struct include_file *inc; { int hash = ((unsigned) (inc->st.st_dev + INO_T_HASH (inc->st.st_ino)) % INCLUDE_HASHSIZE); struct include_file *i = include_ino_hashtab[hash]; inc->next_ino = i; include_ino_hashtab[hash] = inc; for (; i; i = i->next_ino) if (INO_T_EQ (inc->st.st_ino, i->st.st_ino) && inc->st.st_dev == i->st.st_dev) { inc->control_macro = i->control_macro; return 1; } return 0; } /* Process file descriptor F, which corresponds to include file INC, with output to OP. SYSTEM_HEADER_P is 1 if this file resides in any one of the known "system" include directories (as decided by the `is_system_include' function above). DIRPTR is the link in the dir path through which this file was found, or 0 if the file name was absolute. */ static void finclude (f, inc, op, system_header_p, dirptr) int f; struct include_file *inc; FILE_BUF *op; int system_header_p; struct file_name_list *dirptr; { char *fname = inc->fname; int i; FILE_BUF *fp; /* For input stack frame */ int missing_newline = 0; CHECK_DEPTH (return;); fp = &instack[indepth + 1]; bzero ((char *) fp, sizeof (FILE_BUF)); fp->nominal_fname = fp->fname = fname; fp->nominal_fname_len = strlen (fname); fp->inc = inc; fp->length = 0; fp->lineno = 1; fp->if_stack = if_stack; fp->system_header_p = system_header_p; fp->dir = dirptr; if (S_ISREG (inc->st.st_mode)) { size_t s = (size_t) inc->st.st_size; if (s != inc->st.st_size || s + 2 < s) memory_full (); fp->buf = (U_CHAR *) xmalloc (s + 2); fp->bufp = fp->buf; /* Read the file contents, knowing that s is an upper bound on the number of bytes we can read. */ fp->length = safe_read (f, (char *) fp->buf, s); if (fp->length < 0) goto nope; } else if (S_ISDIR (inc->st.st_mode)) { error ("directory `%s' specified in #include", fname); close (f); return; } else { /* Cannot count its file size before reading. First read the entire file into heap and copy them into buffer on stack. */ int bsize = 2000; int st_size = 0; fp->buf = (U_CHAR *) xmalloc (bsize + 2); for (;;) { i = safe_read (f, (char *) fp->buf + st_size, bsize - st_size); if (i < 0) goto nope; /* error! */ if (i == 0) break; /* End of file */ st_size += i; bsize *= 2; fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2); } fp->bufp = fp->buf; fp->length = st_size; } if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n') /* Backslash-newline at end is not good enough. */ || (fp->length > 1 && fp->buf[fp->length - 2] == '\\')) { fp->buf[fp->length++] = '\n'; missing_newline = 1; } fp->buf[fp->length] = '\0'; /* Close descriptor now, so nesting does not use lots of descriptors. */ close (f); /* Must do this before calling trigraph_pcp, so that the correct file name will be printed in warning messages. */ indepth++; input_file_stack_tick++; if (!no_trigraphs) trigraph_pcp (fp); output_line_directive (fp, op, 0, enter_file); rescan (op, 0); if (missing_newline) fp->lineno--; if (pedantic && missing_newline) pedwarn ("file does not end in newline"); indepth--; input_file_stack_tick++; output_line_directive (&instack[indepth], op, 0, leave_file); free (fp->buf); return; nope: perror_with_name (fname); close (f); free (fp->buf); } /* Record that inclusion of the include file INC should be controlled by the macro named MACRO_NAME. This means that trying to include the file again will do something if that macro is defined. */ static void record_control_macro (inc, macro_name) struct include_file *inc; U_CHAR *macro_name; { if (!inc->control_macro || inc->control_macro[0]) inc->control_macro = macro_name; } /* Load the specified precompiled header into core, and verify its preconditions. PCF indicates the file descriptor to read, which must be a regular file. *ST is its file status. FNAME indicates the file name of the original header. *LIMIT will be set to an address one past the end of the file. If the preconditions of the file are not satisfied, the buffer is freed and we return 0. If the preconditions are satisfied, return the address of the buffer following the preconditions. The buffer, in this case, should never be freed because various pieces of it will be referred to until all precompiled strings are output at the end of the run. */ static char * check_precompiled (pcf, st, fname, limit) int pcf; struct stat *st; char *fname ATTRIBUTE_UNUSED; char **limit; { int length = 0; char *buf; char *cp; if (pcp_outfile) return 0; if (S_ISREG (st->st_mode)) { size_t s = (size_t) st->st_size; if (s != st->st_size || s + 2 < s) memory_full (); buf = xmalloc (s + 2); length = safe_read (pcf, buf, s); if (length < 0) goto nope; } else abort (); if (length > 0 && buf[length-1] != '\n') buf[length++] = '\n'; buf[length] = '\0'; *limit = buf + length; /* File is in core. Check the preconditions. */ if (!check_preconditions (buf)) goto nope; for (cp = buf; *cp; cp++) ; #ifdef DEBUG_PCP fprintf (stderr, "Using preinclude %s\n", fname); #endif return cp + 1; nope: #ifdef DEBUG_PCP fprintf (stderr, "Cannot use preinclude %s\n", fname); #endif free (buf); return 0; } /* PREC (null terminated) points to the preconditions of a precompiled header. These are a series of #define and #undef lines which must match the current contents of the hash table. */ static int check_preconditions (prec) char *prec; { MACRODEF mdef; char *lineend; while (*prec) { lineend = index (prec, '\n'); if (*prec++ != '#') { error ("Bad format encountered while reading precompiled file"); return 0; } if (!strncmp (prec, "define", 6)) { HASHNODE *hp; prec += 6; mdef = create_definition ((U_CHAR *) prec, (U_CHAR *) lineend, NULL_PTR); if (mdef.defn == 0) abort (); if ((hp = lookup (mdef.symnam, mdef.symlen, -1)) == NULL || (hp->type != T_MACRO && hp->type != T_CONST) || (hp->type == T_MACRO && !compare_defs (mdef.defn, hp->value.defn) && (mdef.defn->length != 2 || mdef.defn->expansion[0] != '\n' || mdef.defn->expansion[1] != ' '))) return 0; } else if (!strncmp (prec, "undef", 5)) { char *name; int len; prec += 5; while (is_hor_space[(U_CHAR) *prec]) prec++; name = prec; while (is_idchar[(U_CHAR) *prec]) prec++; len = prec - name; if (lookup ((U_CHAR *) name, len, -1)) return 0; } else { error ("Bad format encountered while reading precompiled file"); return 0; } prec = lineend + 1; } /* They all passed successfully */ return 1; } /* Process the main body of a precompiled file. BUF points to the string section of the file, following the preconditions. LIMIT is one character past the end. NAME is the name of the file being read in. OP is the main output buffer. */ static void pcfinclude (buf, name, op) U_CHAR *buf, *name; FILE_BUF *op; { FILE_BUF tmpbuf; int nstrings; U_CHAR *cp = buf; /* First in the file comes 4 bytes indicating the number of strings, */ /* in network byte order. (MSB first). */ nstrings = *cp++; nstrings = (nstrings << 8) | *cp++; nstrings = (nstrings << 8) | *cp++; nstrings = (nstrings << 8) | *cp++; /* Looping over each string... */ while (nstrings--) { U_CHAR *string_start; U_CHAR *endofthiskey; STRINGDEF *str; int nkeys; /* Each string starts with a STRINGDEF structure (str), followed */ /* by the text of the string (string_start) */ /* First skip to a longword boundary */ /* ??? Why a 4-byte boundary? On all machines? */ /* NOTE: This works correctly even if size_t is narrower than a pointer. Do not try risky measures here to get another type to use! Do not include stddef.h--it will fail! */ if ((size_t) cp & 3) cp += 4 - ((size_t) cp & 3); /* Now get the string. */ str = (STRINGDEF *) (GENERIC_PTR) cp; string_start = cp += sizeof (STRINGDEF); for (; *cp; cp++) /* skip the string */ ; /* We need to macro expand the string here to ensure that the proper definition environment is in place. If it were only expanded when we find out it is needed, macros necessary for its proper expansion might have had their definitions changed. */ tmpbuf = expand_to_temp_buffer (string_start, cp++, 0, 0); /* Lineno is already set in the precompiled file */ str->contents = tmpbuf.buf; str->len = tmpbuf.length; str->writeflag = 0; str->filename = name; str->output_mark = outbuf.bufp - outbuf.buf; str->chain = 0; *stringlist_tailp = str; stringlist_tailp = &str->chain; /* Next comes a fourbyte number indicating the number of keys for this string. */ nkeys = *cp++; nkeys = (nkeys << 8) | *cp++; nkeys = (nkeys << 8) | *cp++; nkeys = (nkeys << 8) | *cp++; /* If this number is -1, then the string is mandatory. */ if (nkeys == -1) str->writeflag = 1; else /* Otherwise, for each key, */ for (; nkeys--; free (tmpbuf.buf), cp = endofthiskey + 1) { KEYDEF *kp = (KEYDEF *) (GENERIC_PTR) cp; HASHNODE *hp; /* It starts with a KEYDEF structure */ cp += sizeof (KEYDEF); /* Find the end of the key. At the end of this for loop we advance CP to the start of the next key using this variable. */ endofthiskey = cp + strlen ((char *) cp); kp->str = str; /* Expand the key, and enter it into the hash table. */ tmpbuf = expand_to_temp_buffer (cp, endofthiskey, 0, 0); tmpbuf.bufp = tmpbuf.buf; while (is_hor_space[*tmpbuf.bufp]) tmpbuf.bufp++; if (!is_idstart[*tmpbuf.bufp] || tmpbuf.bufp == tmpbuf.buf + tmpbuf.length) { str->writeflag = 1; continue; } hp = lookup (tmpbuf.bufp, -1, -1); if (hp == NULL) { kp->chain = 0; install (tmpbuf.bufp, -1, T_PCSTRING, (char *) kp, -1); } else if (hp->type == T_PCSTRING) { kp->chain = hp->value.keydef; hp->value.keydef = kp; } else str->writeflag = 1; } } /* This output_line_directive serves to switch us back to the current input file in case some of these strings get output (which will result in line directives for the header file being output). */ output_line_directive (&instack[indepth], op, 0, enter_file); } /* Called from rescan when it hits a key for strings. Mark them all used and clean up. */ static void pcstring_used (hp) HASHNODE *hp; { KEYDEF *kp; for (kp = hp->value.keydef; kp; kp = kp->chain) kp->str->writeflag = 1; delete_macro (hp); } /* Write the output, interspersing precompiled strings in their appropriate places. */ static void write_output () { STRINGDEF *next_string; U_CHAR *cur_buf_loc; int line_directive_len = 80; char *line_directive = xmalloc (line_directive_len); int len; /* In each run through the loop, either cur_buf_loc == next_string_loc, in which case we print a series of strings, or it is less than next_string_loc, in which case we write some of the buffer. */ cur_buf_loc = outbuf.buf; next_string = stringlist; while (cur_buf_loc < outbuf.bufp || next_string) { if (next_string && cur_buf_loc - outbuf.buf == next_string->output_mark) { if (next_string->writeflag) { len = 4 * strlen ((char *) next_string->filename) + 32; while (len > line_directive_len) line_directive = xrealloc (line_directive, line_directive_len *= 2); sprintf (line_directive, "\n# %d ", next_string->lineno); strcpy (quote_string (line_directive + strlen (line_directive), (char *) next_string->filename, strlen ((char *) next_string->filename)), "\n"); safe_write (fileno (stdout), line_directive, strlen (line_directive)); safe_write (fileno (stdout), (char *) next_string->contents, next_string->len); } next_string = next_string->chain; } else { len = (next_string ? (next_string->output_mark - (cur_buf_loc - outbuf.buf)) : outbuf.bufp - cur_buf_loc); safe_write (fileno (stdout), (char *) cur_buf_loc, len); cur_buf_loc += len; } } free (line_directive); } /* Pass a directive through to the output file. BUF points to the contents of the directive, as a contiguous string. LIMIT points to the first character past the end of the directive. KEYWORD is the keyword-table entry for the directive. */ static void pass_thru_directive (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword; { register int keyword_length = keyword->length; check_expand (op, 1 + keyword_length + (limit - buf)); *op->bufp++ = '#'; bcopy (keyword->name, (char *) op->bufp, keyword_length); op->bufp += keyword_length; if (limit != buf && buf[0] != ' ') *op->bufp++ = ' '; bcopy ((char *) buf, (char *) op->bufp, limit - buf); op->bufp += (limit - buf); #if 0 *op->bufp++ = '\n'; /* Count the line we have just made in the output, to get in sync properly. */ op->lineno++; #endif } /* The arglist structure is built by do_define to tell collect_definition where the argument names begin. That is, for a define like "#define f(x,y,z) foo+x-bar*y", the arglist would contain pointers to the strings x, y, and z. Collect_definition would then build a DEFINITION node, with reflist nodes pointing to the places x, y, and z had appeared. So the arglist is just convenience data passed between these two routines. It is not kept around after the current #define has been processed and entered into the hash table. */ struct arglist { struct arglist *next; U_CHAR *name; int length; int argno; char rest_args; }; /* Create a DEFINITION node from a #define directive. Arguments are as for do_define. */ static MACRODEF create_definition (buf, limit, op) U_CHAR *buf, *limit; FILE_BUF *op; { U_CHAR *bp; /* temp ptr into input buffer */ U_CHAR *symname; /* remember where symbol name starts */ int sym_length; /* and how long it is */ int line = instack[indepth].lineno; char *file = instack[indepth].nominal_fname; size_t file_len = instack[indepth].nominal_fname_len; int rest_args = 0; DEFINITION *defn; int arglengths = 0; /* Accumulate lengths of arg names plus number of args. */ MACRODEF mdef; bp = buf; while (is_hor_space[*bp]) bp++; symname = bp; /* remember where it starts */ sym_length = check_macro_name (bp, 0); bp += sym_length; /* Lossage will occur if identifiers or control keywords are broken across lines using backslash. This is not the right place to take care of that. */ if (*bp == '(') { struct arglist *arg_ptrs = NULL; int argno = 0; bp++; /* skip '(' */ SKIP_WHITE_SPACE (bp); /* Loop over macro argument names. */ while (*bp != ')') { struct arglist *temp; temp = (struct arglist *) alloca (sizeof (struct arglist)); temp->name = bp; temp->next = arg_ptrs; temp->argno = argno++; temp->rest_args = 0; arg_ptrs = temp; if (rest_args) pedwarn ("another parameter follows `%s'", rest_extension); if (!is_idstart[*bp]) { if (c9x && limit - bp > (long) REST_EXTENSION_LENGTH && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) { /* This is the ISO C 9x way to write macros with variable number of arguments. */ rest_args = 1; temp->rest_args = 1; } else pedwarn ("invalid character in macro parameter name"); } /* Find the end of the arg name. */ while (is_idchar[*bp]) { bp++; /* do we have a "special" rest-args extension here? */ if (limit - bp > (long) REST_EXTENSION_LENGTH && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) { if (pedantic && !instack[indepth].system_header_p) pedwarn ("ANSI C does not allow macro with variable arguments"); rest_args = 1; temp->rest_args = 1; break; } } if (bp == temp->name && rest_args == 1) { /* This is the ISO C 9x style. */ temp->name = (U_CHAR *) va_args_name; temp->length = VA_ARGS_NAME_LENGTH; } else temp->length = bp - temp->name; if (rest_args == 1) bp += REST_EXTENSION_LENGTH; arglengths += temp->length + 2; SKIP_WHITE_SPACE (bp); if (temp->length == 0 || (*bp != ',' && *bp != ')')) { error ("badly punctuated parameter list in `#define'"); goto nope; } if (*bp == ',') { bp++; SKIP_WHITE_SPACE (bp); /* A comma at this point can only be followed by an identifier. */ if (!is_idstart[*bp] && !(c9x && limit - bp > (long) REST_EXTENSION_LENGTH && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0)) { error ("badly punctuated parameter list in `#define'"); goto nope; } } if (bp >= limit) { error ("unterminated parameter list in `#define'"); goto nope; } { struct arglist *otemp; for (otemp = temp->next; otemp != NULL; otemp = otemp->next) if (temp->length == otemp->length && bcmp (temp->name, otemp->name, temp->length) == 0) { error ("duplicate argument name `%.*s' in `#define'", temp->length, temp->name); goto nope; } if (rest_args == 0 && temp->length == VA_ARGS_NAME_LENGTH && bcmp (temp->name, va_args_name, VA_ARGS_NAME_LENGTH) == 0) { error ("\ reserved name `%s' used as argument name in `#define'", va_args_name); goto nope; } } } ++bp; /* skip paren */ SKIP_WHITE_SPACE (bp); /* now everything from bp before limit is the definition. */ defn = collect_expansion (bp, limit, argno, arg_ptrs); defn->rest_args = rest_args; /* Now set defn->args.argnames to the result of concatenating the argument names in reverse order with comma-space between them. */ defn->args.argnames = (U_CHAR *) xmalloc (arglengths + 1); { struct arglist *temp; int i = 0; for (temp = arg_ptrs; temp; temp = temp->next) { bcopy (temp->name, &defn->args.argnames[i], temp->length); i += temp->length; if (temp->next != 0) { defn->args.argnames[i++] = ','; defn->args.argnames[i++] = ' '; } } defn->args.argnames[i] = 0; } } else { /* Simple expansion or empty definition. */ if (bp < limit) { if (is_hor_space[*bp]) { bp++; SKIP_WHITE_SPACE (bp); } else if (sym_length) { switch (*bp) { case '!': case '"': case '#': case '%': case '&': case '\'': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case ':': case ';': case '<': case '=': case '>': case '?': case '[': case '\\': case ']': case '^': case '{': case '|': case '}': case '~': warning ("missing white space after `#define %.*s'", sym_length, symname); break; default: pedwarn ("missing white space after `#define %.*s'", sym_length, symname); break; } } } /* Now everything from bp before limit is the definition. */ defn = collect_expansion (bp, limit, -1, NULL_PTR); defn->args.argnames = (U_CHAR *) ""; } defn->line = line; defn->file = file; defn->file_len = file_len; /* OP is null if this is a predefinition */ defn->predefined = !op; mdef.defn = defn; mdef.symnam = symname; mdef.symlen = sym_length; return mdef; nope: mdef.symnam = NULL; /* AMB - remove gcc-4.0 warning */ mdef.symlen = 0; /* AMB - remove gcc-4.0 warning */ mdef.defn = 0; return mdef; } /* Process a #define directive. BUF points to the contents of the #define directive, as a contiguous string. LIMIT points to the first character past the end of the definition. KEYWORD is the keyword-table entry for #define. */ static int do_define (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword; { int hashcode; MACRODEF mdef; /* If this is a precompiler run (with -pcp) pass thru #define directives. */ if (pcp_outfile && op) pass_thru_directive (buf, limit, op, keyword); mdef = create_definition (buf, limit, op); if (mdef.defn == 0) goto nope; hashcode = hashf (mdef.symnam, mdef.symlen, HASHSIZE); { HASHNODE *hp; if ((hp = lookup (mdef.symnam, mdef.symlen, hashcode)) != NULL) { int ok = 0; /* Redefining a precompiled key is ok. */ if (hp->type == T_PCSTRING) ok = 1; /* Redefining a macro is ok if the definitions are the same. */ else if (hp->type == T_MACRO) ok = ! compare_defs (mdef.defn, hp->value.defn); /* Redefining a constant is ok with -D. */ else if (hp->type == T_CONST) ok = ! done_initializing; /* Print the warning if it's not ok. */ if (!ok) { /* If we are passing through #define and #undef directives, do that for this re-definition now. */ if (debug_output && op) pass_thru_directive (buf, limit, op, keyword); pedwarn ("`%.*s' redefined", mdef.symlen, mdef.symnam); if (hp->type == T_MACRO) pedwarn_with_file_and_line (hp->value.defn->file, hp->value.defn->file_len, hp->value.defn->line, "this is the location of the previous definition"); } /* Replace the old definition. */ hp->type = T_MACRO; hp->value.defn = mdef.defn; } else { /* If we are passing through #define and #undef directives, do that for this new definition now. */ if (debug_output && op) pass_thru_directive (buf, limit, op, keyword); install (mdef.symnam, mdef.symlen, T_MACRO, (char *) mdef.defn, hashcode); } } return 0; nope: return 1; } /* Check a purported macro name SYMNAME, and yield its length. ASSERTION is nonzero if this is really for an assertion name. */ static int check_macro_name (symname, assertion) U_CHAR *symname; int assertion; { U_CHAR *p; int sym_length; for (p = symname; is_idchar[*p]; p++) ; sym_length = p - symname; if (sym_length == 0 || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '"'))) error (assertion ? "invalid assertion name" : "invalid macro name"); else if (!is_idstart[*symname] || (sym_length == 7 && ! bcmp (symname, "defined", 7))) error ((assertion ? "invalid assertion name `%.*s'" : "invalid macro name `%.*s'"), sym_length, symname); return sym_length; } /* Return zero if two DEFINITIONs are isomorphic. */ static int compare_defs (d1, d2) DEFINITION *d1, *d2; { register struct reflist *a1, *a2; register U_CHAR *p1 = d1->expansion; register U_CHAR *p2 = d2->expansion; int first = 1; if (d1->nargs != d2->nargs) return 1; if (pedantic && strcmp ((char *)d1->args.argnames, (char *)d2->args.argnames)) return 1; for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2; a1 = a1->next, a2 = a2->next) { if (!((a1->nchars == a2->nchars && ! bcmp (p1, p2, a1->nchars)) || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0)) || a1->argno != a2->argno || a1->stringify != a2->stringify || a1->raw_before != a2->raw_before || a1->raw_after != a2->raw_after) return 1; first = 0; p1 += a1->nchars; p2 += a2->nchars; } if (a1 != a2) return 1; if (comp_def_part (first, p1, d1->length - (p1 - d1->expansion), p2, d2->length - (p2 - d2->expansion), 1)) return 1; return 0; } /* Return 1 if two parts of two macro definitions are effectively different. One of the parts starts at BEG1 and has LEN1 chars; the other has LEN2 chars at BEG2. Any sequence of whitespace matches any other sequence of whitespace. FIRST means these parts are the first of a macro definition; so ignore leading whitespace entirely. LAST means these parts are the last of a macro definition; so ignore trailing whitespace entirely. */ static int comp_def_part (first, beg1, len1, beg2, len2, last) int first; U_CHAR *beg1, *beg2; int len1, len2; int last; { register U_CHAR *end1 = beg1 + len1; register U_CHAR *end2 = beg2 + len2; if (first) { while (beg1 != end1 && is_space[*beg1]) beg1++; while (beg2 != end2 && is_space[*beg2]) beg2++; } if (last) { while (beg1 != end1 && is_space[end1[-1]]) end1--; while (beg2 != end2 && is_space[end2[-1]]) end2--; } while (beg1 != end1 && beg2 != end2) { if (is_space[*beg1] && is_space[*beg2]) { while (beg1 != end1 && is_space[*beg1]) beg1++; while (beg2 != end2 && is_space[*beg2]) beg2++; } else if (*beg1 == *beg2) { beg1++; beg2++; } else break; } return (beg1 != end1) || (beg2 != end2); } /* Read a replacement list for a macro with parameters. Build the DEFINITION structure. Reads characters of text starting at BUF until END. ARGLIST specifies the formal parameters to look for in the text of the definition; NARGS is the number of args in that list, or -1 for a macro name that wants no argument list. MACRONAME is the macro name itself (so we can avoid recursive expansion) and NAMELEN is its length in characters. Note that comments, backslash-newlines, and leading white space have already been deleted from the argument. */ /* If there is no trailing whitespace, a Newline Space is added at the end to prevent concatenation that would be contrary to the standard. */ static DEFINITION * collect_expansion (buf, end, nargs, arglist) U_CHAR *buf, *end; int nargs; struct arglist *arglist; { DEFINITION *defn; register U_CHAR *p, *limit, *lastp, *exp_p; struct reflist *endpat = NULL; /* Pointer to first nonspace after last ## seen. */ U_CHAR *concat = 0; /* Pointer to first nonspace after last single-# seen. */ U_CHAR *stringify = 0; /* How those tokens were spelled. */ enum sharp_token_type concat_sharp_token_type = NO_SHARP_TOKEN; enum sharp_token_type stringify_sharp_token_type = NO_SHARP_TOKEN; int maxsize; int expected_delimiter = '\0'; /* Scan thru the replacement list, ignoring comments and quoted strings, picking up on the macro calls. It does a linear search thru the arg list on every potential symbol. Profiling might say that something smarter should happen. */ if (end < buf) abort (); /* Find the beginning of the trailing whitespace. */ limit = end; p = buf; while (p < limit && is_space[limit[-1]]) limit--; /* Allocate space for the text in the macro definition. Each input char may or may not need 1 byte, so this is an upper bound. The extra 3 are for invented trailing newline-marker and final null. */ maxsize = (sizeof (DEFINITION) + (limit - p) + 3); defn = (DEFINITION *) xcalloc (1, maxsize); defn->nargs = nargs; exp_p = defn->expansion = (U_CHAR *) defn + sizeof (DEFINITION); lastp = exp_p; if (p[0] == '#' ? p[1] == '#' : p[0] == '%' && p[1] == ':' && p[2] == '%' && p[3] == ':') { error ("`##' at start of macro definition"); p += p[0] == '#' ? 2 : 4; } /* Process the main body of the definition. */ while (p < limit) { int skipped_arg = 0; register U_CHAR c = *p++; *exp_p++ = c; if (!traditional) { switch (c) { case '\'': case '\"': if (expected_delimiter != '\0') { if (c == expected_delimiter) expected_delimiter = '\0'; } else expected_delimiter = c; break; case '\\': if (p < limit && expected_delimiter) { /* In a string, backslash goes through and makes next char ordinary. */ *exp_p++ = *p++; } break; case '%': if (!expected_delimiter && *p == ':') { /* %: is not a digraph if preceded by an odd number of '<'s. */ U_CHAR *p0 = p - 1; while (buf < p0 && p0[-1] == '<') p0--; if ((p - p0) & 1) { /* Treat %:%: as ## and %: as #. */ if (p[1] == '%' && p[2] == ':') { p += 2; goto sharp_sharp_token; } if (nargs >= 0) { p++; goto sharp_token; } } } break; case '#': /* # is ordinary inside a string. */ if (expected_delimiter) break; if (*p == '#') { sharp_sharp_token: /* ##: concatenate preceding and following tokens. */ /* Take out the first #, discard preceding whitespace. */ exp_p--; while (exp_p > lastp && is_hor_space[exp_p[-1]]) --exp_p; /* Skip the second #. */ p++; concat_sharp_token_type = c; if (is_hor_space[*p]) { concat_sharp_token_type = c + 1; p++; SKIP_WHITE_SPACE (p); } concat = p; if (p == limit) error ("`##' at end of macro definition"); } else if (nargs >= 0) { /* Single #: stringify following argument ref. Don't leave the # in the expansion. */ sharp_token: exp_p--; stringify_sharp_token_type = c; if (is_hor_space[*p]) { stringify_sharp_token_type = c + 1; p++; SKIP_WHITE_SPACE (p); } if (! is_idstart[*p] || nargs == 0 || (*p == 'L' && (p[1] == '\'' || p[1] == '"'))) error ("`#' operator is not followed by a macro argument name"); else stringify = p; } break; } } else { /* In -traditional mode, recognize arguments inside strings and character constants, and ignore special properties of #. Arguments inside strings are considered "stringified", but no extra quote marks are supplied. */ switch (c) { case '\'': case '\"': if (expected_delimiter != '\0') { if (c == expected_delimiter) expected_delimiter = '\0'; } else expected_delimiter = c; break; case '\\': /* Backslash quotes delimiters and itself, but not macro args. */ if (expected_delimiter != 0 && p < limit && (*p == expected_delimiter || *p == '\\')) { *exp_p++ = *p++; continue; } break; case '/': if (expected_delimiter != '\0') /* No comments inside strings. */ break; if (*p == '*') { /* If we find a comment that wasn't removed by handle_directive, this must be -traditional. So replace the comment with nothing at all. */ exp_p--; while (++p < limit) { if (p[0] == '*' && p[1] == '/') { p += 2; break; } } #if 0 /* Mark this as a concatenation-point, as if it had been ##. */ concat = p; #endif } break; } } #ifdef MULTIBYTE_CHARS /* Handle multibyte characters inside string and character literals. */ if (expected_delimiter != '\0') { int length; --p; length = local_mblen (p, limit - p); if (length > 1) { --exp_p; bcopy (p, exp_p, length); p += length; exp_p += length; continue; } ++p; } #endif /* Handle the start of a symbol. */ if (is_idchar[c] && nargs > 0) { U_CHAR *id_beg = p - 1; int id_len; --exp_p; while (p != limit && is_idchar[*p]) p++; id_len = p - id_beg; if (is_idstart[c] && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '"'))) { register struct arglist *arg; for (arg = arglist; arg != NULL; arg = arg->next) { struct reflist *tpat; if (arg->name[0] == c && arg->length == id_len && bcmp (arg->name, id_beg, id_len) == 0) { enum sharp_token_type tpat_stringify; if (expected_delimiter) { if (warn_stringify) { if (traditional) { warning ("macro argument `%.*s' is stringified.", id_len, arg->name); } else { warning ("macro arg `%.*s' would be stringified with -traditional.", id_len, arg->name); } } /* If ANSI, don't actually substitute inside a string. */ if (!traditional) break; tpat_stringify = SHARP_TOKEN; } else { tpat_stringify = (stringify == id_beg ? stringify_sharp_token_type : NO_SHARP_TOKEN); } /* make a pat node for this arg and append it to the end of the pat list */ tpat = (struct reflist *) xmalloc (sizeof (struct reflist)); tpat->next = NULL; tpat->raw_before = concat == id_beg ? concat_sharp_token_type : NO_SHARP_TOKEN; tpat->raw_after = NO_SHARP_TOKEN; tpat->rest_args = arg->rest_args; tpat->stringify = tpat_stringify; if (endpat == NULL) defn->pattern = tpat; else endpat->next = tpat; endpat = tpat; tpat->argno = arg->argno; tpat->nchars = exp_p - lastp; { register U_CHAR *p1 = p; SKIP_WHITE_SPACE (p1); if (p1[0]=='#' ? p1[1]=='#' : p1[0]=='%' && p1[1]==':' && p1[2]=='%' && p1[3]==':') tpat->raw_after = p1[0] + (p != p1); } lastp = exp_p; /* place to start copying from next time */ skipped_arg = 1; break; } } } /* If this was not a macro arg, copy it into the expansion. */ if (! skipped_arg) { register U_CHAR *lim1 = p; p = id_beg; while (p != lim1) *exp_p++ = *p++; if (stringify == id_beg) error ("`#' operator should be followed by a macro argument name"); } } } if (!traditional && expected_delimiter == 0) { /* If ANSI, put in a newline-space marker to prevent token pasting. But not if "inside a string" (which in ANSI mode happens only for -D option). */ *exp_p++ = '\n'; *exp_p++ = ' '; } *exp_p = '\0'; defn->length = exp_p - defn->expansion; /* Crash now if we overrun the allocated size. */ if (defn->length + 1 > maxsize) abort (); #if 0 /* This isn't worth the time it takes. */ /* give back excess storage */ defn->expansion = (U_CHAR *) xrealloc (defn->expansion, defn->length + 1); #endif return defn; } static int do_assert (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op ATTRIBUTE_UNUSED; struct directive *keyword ATTRIBUTE_UNUSED; { U_CHAR *bp; /* temp ptr into input buffer */ U_CHAR *symname; /* remember where symbol name starts */ int sym_length; /* and how long it is */ struct arglist *tokens = NULL; if (pedantic && done_initializing && !instack[indepth].system_header_p) pedwarn ("ANSI C does not allow `#assert'"); bp = buf; while (is_hor_space[*bp]) bp++; symname = bp; /* remember where it starts */ sym_length = check_macro_name (bp, 1); bp += sym_length; /* #define doesn't do this, but we should. */ SKIP_WHITE_SPACE (bp); /* Lossage will occur if identifiers or control tokens are broken across lines using backslash. This is not the right place to take care of that. */ if (*bp != '(') { error ("missing token-sequence in `#assert'"); return 1; } { int error_flag = 0; bp++; /* skip '(' */ SKIP_WHITE_SPACE (bp); tokens = read_token_list (&bp, limit, &error_flag); if (error_flag) return 1; if (tokens == 0) { error ("empty token-sequence in `#assert'"); return 1; } ++bp; /* skip paren */ SKIP_WHITE_SPACE (bp); } /* If this name isn't already an assertion name, make it one. Error if it was already in use in some other way. */ { ASSERTION_HASHNODE *hp; int hashcode = hashf (symname, sym_length, ASSERTION_HASHSIZE); struct tokenlist_list *value = (struct tokenlist_list *) xmalloc (sizeof (struct tokenlist_list)); hp = assertion_lookup (symname, sym_length, hashcode); if (hp == NULL) { if (sym_length == 7 && ! bcmp (symname, "defined", 7)) error ("`defined' redefined as assertion"); hp = assertion_install (symname, sym_length, hashcode); } /* Add the spec'd token-sequence to the list of such. */ value->tokens = tokens; value->next = hp->value; hp->value = value; } return 0; } static int do_unassert (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op ATTRIBUTE_UNUSED; struct directive *keyword ATTRIBUTE_UNUSED; { U_CHAR *bp; /* temp ptr into input buffer */ U_CHAR *symname; /* remember where symbol name starts */ int sym_length; /* and how long it is */ struct arglist *tokens = NULL; int tokens_specified = 0; if (pedantic && done_initializing && !instack[indepth].system_header_p) pedwarn ("ANSI C does not allow `#unassert'"); bp = buf; while (is_hor_space[*bp]) bp++; symname = bp; /* remember where it starts */ sym_length = check_macro_name (bp, 1); bp += sym_length; /* #define doesn't do this, but we should. */ SKIP_WHITE_SPACE (bp); /* Lossage will occur if identifiers or control tokens are broken across lines using backslash. This is not the right place to take care of that. */ if (*bp == '(') { int error_flag = 0; bp++; /* skip '(' */ SKIP_WHITE_SPACE (bp); tokens = read_token_list (&bp, limit, &error_flag); if (error_flag) return 1; if (tokens == 0) { error ("empty token list in `#unassert'"); return 1; } tokens_specified = 1; ++bp; /* skip paren */ SKIP_WHITE_SPACE (bp); } { ASSERTION_HASHNODE *hp; int hashcode = hashf (symname, sym_length, ASSERTION_HASHSIZE); struct tokenlist_list *tail, *prev; hp = assertion_lookup (symname, sym_length, hashcode); if (hp == NULL) return 1; /* If no token list was specified, then eliminate this assertion entirely. */ if (! tokens_specified) { struct tokenlist_list *next; for (tail = hp->value; tail; tail = next) { next = tail->next; free_token_list (tail->tokens); free (tail); } delete_assertion (hp); } else { /* If a list of tokens was given, then delete any matching list. */ tail = hp->value; prev = 0; while (tail) { struct tokenlist_list *next = tail->next; if (compare_token_lists (tail->tokens, tokens)) { if (prev) prev->next = next; else hp->value = tail->next; free_token_list (tail->tokens); free (tail); } else { prev = tail; } tail = next; } } } return 0; } /* Test whether there is an assertion named NAME and optionally whether it has an asserted token list TOKENS. NAME is not null terminated; its length is SYM_LENGTH. If TOKENS_SPECIFIED is 0, then don't check for any token list. */ int check_assertion (name, sym_length, tokens_specified, tokens) U_CHAR *name; int sym_length; int tokens_specified; struct arglist *tokens; { ASSERTION_HASHNODE *hp; int hashcode = hashf (name, sym_length, ASSERTION_HASHSIZE); if (pedantic && !instack[indepth].system_header_p) pedwarn ("ANSI C does not allow testing assertions"); hp = assertion_lookup (name, sym_length, hashcode); if (hp == NULL) /* It is not an assertion; just return false. */ return 0; /* If no token list was specified, then value is 1. */ if (! tokens_specified) return 1; { struct tokenlist_list *tail; tail = hp->value; /* If a list of tokens was given, then succeed if the assertion records a matching list. */ while (tail) { if (compare_token_lists (tail->tokens, tokens)) return 1; tail = tail->next; } /* Fail if the assertion has no matching list. */ return 0; } } /* Compare two lists of tokens for equality including order of tokens. */ static int compare_token_lists (l1, l2) struct arglist *l1, *l2; { while (l1 && l2) { if (l1->length != l2->length) return 0; if (bcmp (l1->name, l2->name, l1->length)) return 0; l1 = l1->next; l2 = l2->next; } /* Succeed if both lists end at the same time. */ return l1 == l2; } /* Read a space-separated list of tokens ending in a close parenthesis. Return a list of strings, in the order they were written. (In case of error, return 0 and store -1 in *ERROR_FLAG.) Parse the text starting at *BPP, and update *BPP. Don't parse beyond LIMIT. */ static struct arglist * read_token_list (bpp, limit, error_flag) U_CHAR **bpp; U_CHAR *limit; int *error_flag; { struct arglist *token_ptrs = 0; U_CHAR *bp = *bpp; int depth = 1; *error_flag = 0; /* Loop over the assertion value tokens. */ while (depth > 0) { struct arglist *temp; int eofp = 0; U_CHAR *beg = bp; /* Find the end of the token. */ if (*bp == '(') { bp++; depth++; } else if (*bp == ')') { depth--; if (depth == 0) break; bp++; } else if (*bp == '"' || *bp == '\'') bp = skip_quoted_string (bp, limit, 0, NULL_PTR, NULL_PTR, &eofp); else while (! is_hor_space[*bp] && *bp != '(' && *bp != ')' && *bp != '"' && *bp != '\'' && bp != limit) bp++; temp = (struct arglist *) xmalloc (sizeof (struct arglist)); temp->name = (U_CHAR *) xmalloc (bp - beg + 1); bcopy ((char *) beg, (char *) temp->name, bp - beg); temp->name[bp - beg] = 0; temp->next = token_ptrs; token_ptrs = temp; temp->length = bp - beg; SKIP_WHITE_SPACE (bp); if (bp >= limit) { error ("unterminated token sequence in `#assert' or `#unassert'"); *error_flag = -1; return 0; } } *bpp = bp; /* We accumulated the names in reverse order. Now reverse them to get the proper order. */ { register struct arglist *prev = 0, *this, *next; for (this = token_ptrs; this; this = next) { next = this->next; this->next = prev; prev = this; } return prev; } } static void free_token_list (tokens) struct arglist *tokens; { while (tokens) { struct arglist *next = tokens->next; free (tokens->name); free (tokens); tokens = next; } } /* Install a name in the assertion hash table. If LEN is >= 0, it is the length of the name. Otherwise, compute the length by scanning the entire name. If HASH is >= 0, it is the precomputed hash code. Otherwise, compute the hash code. */ static ASSERTION_HASHNODE * assertion_install (name, len, hash) U_CHAR *name; int len; int hash; { register ASSERTION_HASHNODE *hp; register int i, bucket; register U_CHAR *p, *q; i = sizeof (ASSERTION_HASHNODE) + len + 1; hp = (ASSERTION_HASHNODE *) xmalloc (i); bucket = hash; hp->bucket_hdr = &assertion_hashtab[bucket]; hp->next = assertion_hashtab[bucket]; assertion_hashtab[bucket] = hp; hp->prev = NULL; if (hp->next != NULL) hp->next->prev = hp; hp->length = len; hp->value = 0; hp->name = ((U_CHAR *) hp) + sizeof (ASSERTION_HASHNODE); p = hp->name; q = name; for (i = 0; i < len; i++) *p++ = *q++; hp->name[len] = 0; return hp; } /* Find the most recent hash node for name "name" (ending with first non-identifier char) installed by install If LEN is >= 0, it is the length of the name. Otherwise, compute the length by scanning the entire name. If HASH is >= 0, it is the precomputed hash code. Otherwise, compute the hash code. */ static ASSERTION_HASHNODE * assertion_lookup (name, len, hash) U_CHAR *name; int len; int hash; { register ASSERTION_HASHNODE *bucket; bucket = assertion_hashtab[hash]; while (bucket) { if (bucket->length == len && bcmp (bucket->name, name, len) == 0) return bucket; bucket = bucket->next; } return NULL; } static void delete_assertion (hp) ASSERTION_HASHNODE *hp; { if (hp->prev != NULL) hp->prev->next = hp->next; if (hp->next != NULL) hp->next->prev = hp->prev; /* Make sure that the bucket chain header that the deleted guy was on points to the right thing afterwards. */ if (hp == *hp->bucket_hdr) *hp->bucket_hdr = hp->next; free (hp); } /* * interpret #line directive. Remembers previously seen fnames * in its very own hash table. */ #define FNAME_HASHSIZE 37 static int do_line (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword ATTRIBUTE_UNUSED; { register U_CHAR *bp; FILE_BUF *ip = &instack[indepth]; FILE_BUF tem; int new_lineno; enum file_change_code file_change = same_file; /* Expand any macros. */ tem = expand_to_temp_buffer (buf, limit, 0, 0); /* Point to macroexpanded line, which is null-terminated now. */ bp = tem.buf; SKIP_WHITE_SPACE (bp); if (!ISDIGIT (*bp)) { error ("invalid format `#line' directive"); return 0; } /* The Newline at the end of this line remains to be processed. To put the next line at the specified line number, we must store a line number now that is one less. */ new_lineno = atoi ((char *) bp) - 1; /* NEW_LINENO is one less than the actual line number here. */ if (pedantic && new_lineno < 0) pedwarn ("line number out of range in `#line' directive"); /* skip over the line number. */ while (ISDIGIT (*bp)) bp++; #if 0 /* #line 10"foo.c" is supposed to be allowed. */ if (*bp && !is_space[*bp]) { error ("invalid format `#line' directive"); return; } #endif SKIP_WHITE_SPACE (bp); if (*bp == '\"') { static HASHNODE *fname_table[FNAME_HASHSIZE]; HASHNODE *hp, **hash_bucket; U_CHAR *fname, *p; int fname_length; fname = ++bp; /* Turn the file name, which is a character string literal, into a null-terminated string. Do this in place. */ p = bp; for (;;) switch ((*p++ = *bp++)) { case '\0': error ("invalid format `#line' directive"); return 0; case '\\': if (! ignore_escape_flag) { char *bpc = (char *) bp; HOST_WIDEST_INT c = parse_escape (&bpc, (HOST_WIDEST_INT) (U_CHAR) (-1)); bp = (U_CHAR *) bpc; if (c < 0) p--; else p[-1] = c; } break; case '\"': *--p = 0; goto fname_done; } fname_done: fname_length = p - fname; SKIP_WHITE_SPACE (bp); if (*bp) { if (pedantic) pedwarn ("garbage at end of `#line' directive"); if (*bp == '1') file_change = enter_file; else if (*bp == '2') file_change = leave_file; else if (*bp == '3') ip->system_header_p = 1; else if (*bp == '4') ip->system_header_p = 2; else { error ("invalid format `#line' directive"); return 0; } bp++; SKIP_WHITE_SPACE (bp); if (*bp == '3') { ip->system_header_p = 1; bp++; SKIP_WHITE_SPACE (bp); } if (*bp == '4') { ip->system_header_p = 2; bp++; SKIP_WHITE_SPACE (bp); } if (*bp) { error ("invalid format `#line' directive"); return 0; } } hash_bucket = &fname_table[hashf (fname, fname_length, FNAME_HASHSIZE)]; for (hp = *hash_bucket; hp != NULL; hp = hp->next) if (hp->length == fname_length && bcmp (hp->value.cpval, fname, fname_length) == 0) { ip->nominal_fname = hp->value.cpval; ip->nominal_fname_len = fname_length; break; } if (hp == 0) { /* Didn't find it; cons up a new one. */ hp = (HASHNODE *) xcalloc (1, sizeof (HASHNODE) + fname_length + 1); hp->next = *hash_bucket; *hash_bucket = hp; ip->nominal_fname = hp->value.cpval = ((char *) hp) + sizeof (HASHNODE); ip->nominal_fname_len = hp->length = fname_length; bcopy (fname, hp->value.cpval, fname_length + 1); } } else if (*bp) { error ("invalid format `#line' directive"); return 0; } ip->lineno = new_lineno; output_line_directive (ip, op, 0, file_change); check_expand (op, ip->length - (ip->bufp - ip->buf)); return 0; } /* Remove the definition of a symbol from the symbol table. according to un*x /lib/cpp, it is not an error to undef something that has no definitions, so it isn't one here either. */ static int do_undef (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword; { int sym_length; HASHNODE *hp; U_CHAR *orig_buf = buf; /* If this is a precompiler run (with -pcp) pass thru #undef directives. */ if (pcp_outfile && op) pass_thru_directive (buf, limit, op, keyword); SKIP_WHITE_SPACE (buf); sym_length = check_macro_name (buf, 0); while ((hp = lookup (buf, sym_length, -1)) != NULL) { /* If we are generating additional info for debugging (with -g) we need to pass through all effective #undef directives. */ if (debug_output && op) pass_thru_directive (orig_buf, limit, op, keyword); if (hp->type != T_MACRO) warning ("undefining `%s'", hp->name); delete_macro (hp); } if (pedantic) { buf += sym_length; SKIP_WHITE_SPACE (buf); if (buf != limit) pedwarn ("garbage after `#undef' directive"); } return 0; } /* Report an error detected by the program we are processing. Use the text of the line in the error message. (We use error because it prints the filename & line#.) */ static int do_error (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op ATTRIBUTE_UNUSED; struct directive *keyword ATTRIBUTE_UNUSED; { int length = limit - buf; U_CHAR *copy = (U_CHAR *) alloca (length + 1); bcopy ((char *) buf, (char *) copy, length); copy[length] = 0; SKIP_WHITE_SPACE (copy); error ("#error %s", copy); return 0; } /* Report a warning detected by the program we are processing. Use the text of the line in the warning message, then continue. (We use error because it prints the filename & line#.) */ static int do_warning (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op ATTRIBUTE_UNUSED; struct directive *keyword ATTRIBUTE_UNUSED; { int length = limit - buf; U_CHAR *copy = (U_CHAR *) alloca (length + 1); bcopy ((char *) buf, (char *) copy, length); copy[length] = 0; SKIP_WHITE_SPACE (copy); if (pedantic && !instack[indepth].system_header_p) pedwarn ("ANSI C does not allow `#warning'"); /* Use `pedwarn' not `warning', because #warning isn't in the C Standard; if -pedantic-errors is given, #warning should cause an error. */ pedwarn ("#warning %s", copy); return 0; } /* Remember the name of the current file being read from so that we can avoid ever including it again. */ static void do_once () { int i; for (i = indepth; i >= 0; i--) if (instack[i].inc) { record_control_macro (instack[i].inc, (U_CHAR *) ""); break; } } /* Report program identification. */ static int do_ident (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword ATTRIBUTE_UNUSED; { FILE_BUF trybuf; int len; /* Allow #ident in system headers, since that's not user's fault. */ if (pedantic && !instack[indepth].system_header_p) pedwarn ("ANSI C does not allow `#ident'"); trybuf = expand_to_temp_buffer (buf, limit, 0, 0); buf = trybuf.buf; len = trybuf.bufp - buf; /* Output expanded directive. */ check_expand (op, 7 + len); bcopy ("#ident ", (char *) op->bufp, 7); op->bufp += 7; bcopy ((char *) buf, (char *) op->bufp, len); op->bufp += len; free (buf); return 0; } /* #pragma and its argument line have already been copied to the output file. Just check for some recognized pragmas that need validation here. */ static int do_pragma (buf, limit, op, keyword) U_CHAR *buf, *limit ATTRIBUTE_UNUSED; FILE_BUF *op ATTRIBUTE_UNUSED; struct directive *keyword ATTRIBUTE_UNUSED; { SKIP_WHITE_SPACE (buf); if (!strncmp ((char *) buf, "once", 4)) { /* Allow #pragma once in system headers, since that's not the user's fault. */ if (!instack[indepth].system_header_p) warning ("`#pragma once' is obsolete"); do_once (); } if (!strncmp ((char *) buf, "implementation", 14)) { /* Be quiet about `#pragma implementation' for a file only if it hasn't been included yet. */ int h; U_CHAR *p = buf + 14, *fname; SKIP_WHITE_SPACE (p); if (*p != '\"') return 0; fname = p + 1; if ((p = (U_CHAR *) index ((char *) fname, '\"'))) *p = '\0'; for (h = 0; h < INCLUDE_HASHSIZE; h++) { struct include_file *inc; for (inc = include_hashtab[h]; inc; inc = inc->next) { if (!strcmp (base_name (inc->fname), (char *) fname)) { warning ("`#pragma implementation' for \"%s\" appears after its #include",fname); return 0; } } } } return 0; } #if 0 /* This was a fun hack, but #pragma seems to start to be useful. By failing to recognize it, we pass it through unchanged to cc1. */ /* The behavior of the #pragma directive is implementation defined. this implementation defines it as follows. */ static int do_pragma () { close (0); if (open ("/dev/tty", O_RDONLY, 0666) != 0) goto nope; close (1); if (open ("/dev/tty", O_WRONLY, 0666) != 1) goto nope; execl ("/usr/games/hack", "#pragma", 0); execl ("/usr/games/rogue", "#pragma", 0); execl ("/usr/new/emacs", "-f", "hanoi", "9", "-kill", 0); execl ("/usr/local/emacs", "-f", "hanoi", "9", "-kill", 0); nope: fatal ("You are in a maze of twisty compiler features, all different"); } #endif #ifdef SCCS_DIRECTIVE /* Just ignore #sccs, on systems where we define it at all. */ static int do_sccs (buf, limit, op, keyword) U_CHAR *buf ATTRIBUTE_UNUSED, *limit ATTRIBUTE_UNUSED; FILE_BUF *op ATTRIBUTE_UNUSED; struct directive *keyword ATTRIBUTE_UNUSED; { if (pedantic) pedwarn ("ANSI C does not allow `#sccs'"); return 0; } #endif /* defined (SCCS_DIRECTIVE) */ /* Handle #if directive by 1) inserting special `defined' keyword into the hash table that gets turned into 0 or 1 by special_symbol (thus, if the luser has a symbol called `defined' already, it won't work inside the #if directive) 2) rescan the input into a temporary output buffer 3) pass the output buffer to the yacc parser and collect a value 4) clean up the mess left from steps 1 and 2. 5) call conditional_skip to skip til the next #endif (etc.), or not, depending on the value from step 3. */ static int do_if (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword ATTRIBUTE_UNUSED; { HOST_WIDEST_INT value; FILE_BUF *ip = &instack[indepth]; value = eval_if_expression (buf, limit - buf); conditional_skip (ip, value == 0, T_IF, NULL_PTR, op); return 0; } /* Handle a #elif directive by not changing if_stack either. see the comment above do_else. */ static int do_elif (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword ATTRIBUTE_UNUSED; { HOST_WIDEST_INT value; FILE_BUF *ip = &instack[indepth]; if (if_stack == instack[indepth].if_stack) { error ("`#elif' not within a conditional"); return 0; } else { if (if_stack->type != T_IF && if_stack->type != T_ELIF) { error ("`#elif' after `#else'"); fprintf (stderr, " (matches line %d", if_stack->lineno); if (! (if_stack->fname_len == ip->nominal_fname_len && !bcmp (if_stack->fname, ip->nominal_fname, if_stack->fname_len))) { fprintf (stderr, ", file "); eprint_string (if_stack->fname, if_stack->fname_len); } fprintf (stderr, ")\n"); } if_stack->type = T_ELIF; } if (if_stack->if_succeeded) skip_if_group (ip, 0, op); else { value = eval_if_expression (buf, limit - buf); if (value == 0) skip_if_group (ip, 0, op); else { ++if_stack->if_succeeded; /* continue processing input */ output_line_directive (ip, op, 1, same_file); } } return 0; } /* Evaluate a #if expression in BUF, of length LENGTH, then parse the result as a C expression and return the value as an int. */ static HOST_WIDEST_INT eval_if_expression (buf, length) U_CHAR *buf; int length; { FILE_BUF temp_obuf; HASHNODE *save_defined; HOST_WIDEST_INT value; save_defined = install ((U_CHAR *) "defined", -1, T_SPEC_DEFINED, NULL_PTR, -1); pcp_inside_if = 1; temp_obuf = expand_to_temp_buffer (buf, buf + length, 0, 1); pcp_inside_if = 0; delete_macro (save_defined); /* clean up special symbol */ temp_obuf.buf[temp_obuf.length] = '\n'; value = parse_c_expression ((char *) temp_obuf.buf, warn_undef && !instack[indepth].system_header_p); free (temp_obuf.buf); return value; } /* routine to handle ifdef/ifndef. Try to look up the symbol, then do or don't skip to the #endif/#else/#elif depending on what directive is actually being processed. */ static int do_xifdef (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword; { int skip; FILE_BUF *ip = &instack[indepth]; U_CHAR *end; int start_of_file = 0; U_CHAR *control_macro = 0; /* Detect a #ifndef at start of file (not counting comments). */ if (ip->fname != 0 && keyword->type == T_IFNDEF) { U_CHAR *p = ip->buf; while (p != directive_start) { U_CHAR c = *p++; if (is_space[c]) ; /* Make no special provision for backslash-newline here; this is slower if backslash-newlines are present, but it's correct, and it's not worth it to tune for the rare backslash-newline. */ else if (c == '/' && (*p == '*' || (cplusplus_comments && *p == '/'))) { /* Skip this comment. */ int junk = 0; U_CHAR *save_bufp = ip->bufp; ip->bufp = p + 1; p = skip_to_end_of_comment (ip, &junk, 1); ip->bufp = save_bufp; } else { goto fail; } } /* If we get here, this conditional is the beginning of the file. */ start_of_file = 1; fail: ; } /* Discard leading and trailing whitespace. */ SKIP_WHITE_SPACE (buf); while (limit != buf && is_hor_space[limit[-1]]) limit--; /* Find the end of the identifier at the beginning. */ for (end = buf; is_idchar[*end]; end++); if (end == buf) { skip = (keyword->type == T_IFDEF); if (! traditional) pedwarn (end == limit ? "`#%s' with no argument" : "`#%s' argument starts with punctuation", keyword->name); } else { HASHNODE *hp; if (! traditional) { if (ISDIGIT (buf[0])) pedwarn ("`#%s' argument starts with a digit", keyword->name); else if (end != limit) pedwarn ("garbage at end of `#%s' argument", keyword->name); } hp = lookup (buf, end-buf, -1); if (pcp_outfile) { /* Output a precondition for this macro. */ if (hp && (hp->type == T_CONST || (hp->type == T_MACRO && hp->value.defn->predefined))) fprintf (pcp_outfile, "#define %s\n", hp->name); else { U_CHAR *cp = buf; fprintf (pcp_outfile, "#undef "); while (is_idchar[*cp]) /* Ick! */ fputc (*cp++, pcp_outfile); putc ('\n', pcp_outfile); } } skip = (hp == NULL) ^ (keyword->type == T_IFNDEF); if (start_of_file && !skip) { control_macro = (U_CHAR *) xmalloc (end - buf + 1); bcopy ((char *) buf, (char *) control_macro, end - buf); control_macro[end - buf] = 0; } } conditional_skip (ip, skip, T_IF, control_macro, op); return 0; } /* Push TYPE on stack; then, if SKIP is nonzero, skip ahead. If this is a #ifndef starting at the beginning of a file, CONTROL_MACRO is the macro name tested by the #ifndef. Otherwise, CONTROL_MACRO is 0. */ static void conditional_skip (ip, skip, type, control_macro, op) FILE_BUF *ip; int skip; enum node_type type; U_CHAR *control_macro; FILE_BUF *op; { IF_STACK_FRAME *temp; temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME)); temp->fname = ip->nominal_fname; temp->fname_len = ip->nominal_fname_len; temp->lineno = ip->lineno; temp->next = if_stack; temp->control_macro = control_macro; if_stack = temp; if_stack->type = type; if (skip != 0) { skip_if_group (ip, 0, op); return; } else { ++if_stack->if_succeeded; output_line_directive (ip, &outbuf, 1, same_file); } } /* Skip to #endif, #else, or #elif. adjust line numbers, etc. Leaves input ptr at the sharp sign found. If ANY is nonzero, return at next directive of any sort. */ static void skip_if_group (ip, any, op) FILE_BUF *ip; int any; FILE_BUF *op; { register U_CHAR *bp = ip->bufp, *cp; register U_CHAR *endb = ip->buf + ip->length; struct directive *kt; IF_STACK_FRAME *save_if_stack = if_stack; /* don't pop past here */ U_CHAR *beg_of_line = bp; register int ident_length; U_CHAR *ident, *after_ident; /* Save info about where the group starts. */ U_CHAR *beg_of_group = bp; int beg_lineno = ip->lineno; int skipping_include_directive = 0; if (output_conditionals && op != 0) { char *ptr = "#failed\n"; int len = strlen (ptr); if (op->bufp > op->buf && op->bufp[-1] != '\n') { *op->bufp++ = '\n'; op->lineno++; } check_expand (op, len); bcopy (ptr, (char *) op->bufp, len); op->bufp += len; op->lineno++; output_line_directive (ip, op, 1, 0); } while (bp < endb) { switch (*bp++) { case '/': /* possible comment */ if (*bp == '\\' && bp[1] == '\n') newline_fix (bp); if (*bp == '*' || (cplusplus_comments && *bp == '/')) { ip->bufp = ++bp; bp = skip_to_end_of_comment (ip, &ip->lineno, 0); } break; case '<': if (skipping_include_directive) { while (bp < endb && *bp != '>' && *bp != '\n') { if (*bp == '\\' && bp[1] == '\n') { ip->lineno++; bp++; } bp++; } } break; case '\"': if (skipping_include_directive) { while (bp < endb && *bp != '\n') { if (*bp == '"') { bp++; break; } if (*bp == '\\' && bp[1] == '\n') { ip->lineno++; bp++; } bp++; } break; } /* Fall through. */ case '\'': bp = skip_quoted_string (bp - 1, endb, ip->lineno, &ip->lineno, NULL_PTR, NULL_PTR); break; case '\\': /* Char after backslash loses its special meaning in some cases. */ if (*bp == '\n') { ++ip->lineno; bp++; } else if (traditional && bp < endb) bp++; break; case '\n': ++ip->lineno; beg_of_line = bp; skipping_include_directive = 0; break; case '%': if (beg_of_line == 0 || traditional) break; ip->bufp = bp - 1; while (bp[0] == '\\' && bp[1] == '\n') bp += 2; if (*bp == ':') goto sharp_token; break; case '#': /* # keyword: a # must be first nonblank char on the line */ if (beg_of_line == 0) break; ip->bufp = bp - 1; sharp_token: /* Scan from start of line, skipping whitespace, comments and backslash-newlines, and see if we reach this #. If not, this # is not special. */ bp = beg_of_line; /* If -traditional, require # to be at beginning of line. */ if (!traditional) { while (1) { if (is_hor_space[*bp]) bp++; else if (*bp == '\\' && bp[1] == '\n') bp += 2; else if (*bp == '/' && bp[1] == '*') { bp += 2; while (1) { if (*bp == '*') { if (bp[1] == '/') { bp += 2; break; } } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (bp, endb - bp); if (length > 1) bp += (length - 1); #endif } bp++; } } /* There is no point in trying to deal with C++ // comments here, because if there is one, then this # must be part of the comment and we would never reach here. */ else break; } } if (bp != ip->bufp) { bp = ip->bufp + 1; /* Reset bp to after the #. */ break; } bp = ip->bufp + 1; /* Point after the '#' */ if (ip->bufp[0] == '%') { /* Skip past the ':' again. */ while (*bp == '\\') { ip->lineno++; bp += 2; } bp++; } /* Skip whitespace and \-newline. */ while (1) { if (is_hor_space[*bp]) bp++; else if (*bp == '\\' && bp[1] == '\n') bp += 2; else if (*bp == '/') { if (bp[1] == '\\' && bp[2] == '\n') newline_fix (bp + 1); if (bp[1] == '*') { for (bp += 2; ; bp++) { if (*bp == '\n') ip->lineno++; else if (*bp == '*') { if (bp[-1] == '/' && warn_comments) warning ("`/*' within comment"); if (bp[1] == '\\' && bp[2] == '\n') newline_fix (bp + 1); if (bp[1] == '/') break; } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (bp, endb - bp); if (length > 1) bp += (length - 1); #endif } } bp += 2; } else if (bp[1] == '/' && cplusplus_comments) { for (bp += 2; ; bp++) { if (*bp == '\n') break; if (*bp == '\\' && bp[1] == '\n') { if (warn_comments) warning ("multiline `//' comment"); ip->lineno++; bp++; } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (bp, endb - bp); if (length > 1) bp += (length - 1); #endif } } } else break; } else break; } cp = bp; /* Now find end of directive name. If we encounter a backslash-newline, exchange it with any following symbol-constituents so that we end up with a contiguous name. */ while (1) { if (is_idchar[*bp]) bp++; else { if (*bp == '\\' && bp[1] == '\n') name_newline_fix (bp); if (is_idchar[*bp]) bp++; else break; } } ident_length = bp - cp; ident = cp; after_ident = bp; /* A line of just `#' becomes blank. */ if (ident_length == 0 && *after_ident == '\n') { continue; } if (ident_length == 0 || !is_idstart[*ident]) { U_CHAR *p = ident; while (is_idchar[*p]) { if (*p < '0' || *p > '9') break; p++; } /* Handle # followed by a line number. */ if (p != ident && !is_idchar[*p]) { if (pedantic) pedwarn ("`#' followed by integer"); continue; } /* Avoid error for `###' and similar cases unless -pedantic. */ if (p == ident) { while (*p == '#' || is_hor_space[*p]) p++; if (*p == '\n') { if (pedantic && !lang_asm) pedwarn ("invalid preprocessing directive"); continue; } } if (!lang_asm && pedantic) pedwarn ("invalid preprocessing directive name"); continue; } for (kt = directive_table; kt->length >= 0; kt++) { IF_STACK_FRAME *temp; if (ident_length == kt->length && bcmp (cp, kt->name, kt->length) == 0) { /* If we are asked to return on next directive, do so now. */ if (any) goto done; switch (kt->type) { case T_IF: case T_IFDEF: case T_IFNDEF: temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME)); temp->next = if_stack; if_stack = temp; temp->lineno = ip->lineno; temp->fname = ip->nominal_fname; temp->fname_len = ip->nominal_fname_len; temp->type = kt->type; break; case T_ELSE: case T_ENDIF: if (pedantic && if_stack != save_if_stack) validate_else (bp, endb); case T_ELIF: if (if_stack == instack[indepth].if_stack) { error ("`#%s' not within a conditional", kt->name); break; } else if (if_stack == save_if_stack) goto done; /* found what we came for */ if (kt->type != T_ENDIF) { if (if_stack->type == T_ELSE) error ("`#else' or `#elif' after `#else'"); if_stack->type = kt->type; break; } temp = if_stack; if_stack = if_stack->next; free (temp); break; case T_INCLUDE: case T_INCLUDE_NEXT: case T_IMPORT: skipping_include_directive = 1; break; default: break; } break; } } /* Don't let erroneous code go by. */ if (kt->length < 0 && !lang_asm && pedantic) pedwarn ("invalid preprocessing directive name"); } } ip->bufp = bp; /* after this returns, rescan will exit because ip->bufp now points to the end of the buffer. rescan is responsible for the error message also. */ done: if (output_conditionals && op != 0) { char *ptr = "#endfailed\n"; int len = strlen (ptr); if (op->bufp > op->buf && op->bufp[-1] != '\n') { *op->bufp++ = '\n'; op->lineno++; } check_expand (op, beg_of_line - beg_of_group); bcopy ((char *) beg_of_group, (char *) op->bufp, beg_of_line - beg_of_group); op->bufp += beg_of_line - beg_of_group; op->lineno += ip->lineno - beg_lineno; check_expand (op, len); bcopy (ptr, (char *) op->bufp, len); op->bufp += len; op->lineno++; } } /* Handle a #else directive. Do this by just continuing processing without changing if_stack ; this is so that the error message for missing #endif's etc. will point to the original #if. It is possible that something different would be better. */ static int do_else (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword ATTRIBUTE_UNUSED; { FILE_BUF *ip = &instack[indepth]; if (pedantic) { SKIP_WHITE_SPACE (buf); if (buf != limit) pedwarn ("text following `#else' violates ANSI standard"); } if (if_stack == instack[indepth].if_stack) { error ("`#else' not within a conditional"); return 0; } else { /* #ifndef can't have its special treatment for containing the whole file if it has a #else clause. */ if_stack->control_macro = 0; if (if_stack->type != T_IF && if_stack->type != T_ELIF) { error ("`#else' after `#else'"); fprintf (stderr, " (matches line %d", if_stack->lineno); if (! (if_stack->fname_len == ip->nominal_fname_len && !bcmp (if_stack->fname, ip->nominal_fname, if_stack->fname_len))) { fprintf (stderr, ", file "); eprint_string (if_stack->fname, if_stack->fname_len); } fprintf (stderr, ")\n"); } if_stack->type = T_ELSE; } if (if_stack->if_succeeded) skip_if_group (ip, 0, op); else { ++if_stack->if_succeeded; /* continue processing input */ output_line_directive (ip, op, 1, same_file); } return 0; } /* Unstack after #endif directive. */ static int do_endif (buf, limit, op, keyword) U_CHAR *buf, *limit; FILE_BUF *op; struct directive *keyword ATTRIBUTE_UNUSED; { if (pedantic) { SKIP_WHITE_SPACE (buf); if (buf != limit) pedwarn ("text following `#endif' violates ANSI standard"); } if (if_stack == instack[indepth].if_stack) error ("unbalanced `#endif'"); else { IF_STACK_FRAME *temp = if_stack; if_stack = if_stack->next; if (temp->control_macro != 0) { /* This #endif matched a #ifndef at the start of the file. See if it is at the end of the file. */ FILE_BUF *ip = &instack[indepth]; U_CHAR *p = ip->bufp; U_CHAR *ep = ip->buf + ip->length; while (p != ep) { U_CHAR c = *p++; if (!is_space[c]) { if (c == '/' && (*p == '*' || (cplusplus_comments && *p == '/'))) { /* Skip this comment. */ int junk = 0; U_CHAR *save_bufp = ip->bufp; ip->bufp = p + 1; p = skip_to_end_of_comment (ip, &junk, 1); ip->bufp = save_bufp; } else goto fail; } } /* If we get here, this #endif ends a #ifndef that contains all of the file (aside from whitespace). Arrange not to include the file again if the macro that was tested is defined. Do not do this for the top-level file in a -include or any file in a -imacros. */ if (indepth != 0 && ! (indepth == 1 && no_record_file) && ! (no_record_file && no_output)) record_control_macro (ip->inc, temp->control_macro); fail: ; } free (temp); output_line_directive (&instack[indepth], op, 1, same_file); } return 0; } /* When an #else or #endif is found while skipping failed conditional, if -pedantic was specified, this is called to warn about text after the directive name. P points to the first char after the directive name. */ static void validate_else (p, limit) register U_CHAR *p; register U_CHAR *limit; { /* Advance P over whitespace and comments. */ while (1) { while (*p == '\\' && p[1] == '\n') p += 2; if (is_hor_space[*p]) p++; else if (*p == '/') { while (p[1] == '\\' && p[2] == '\n') p += 2; if (p[1] == '*') { /* Don't bother warning about unterminated comments since that will happen later. Just be sure to exit. */ for (p += 2; ; p++) { if (p == limit) return; if (*p == '*') { while (p[1] == '\\' && p[2] == '\n') p += 2; if (p[1] == '/') { p += 2; break; } } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (p, limit - p); if (length > 1) p += (length - 1); #endif } } } else if (cplusplus_comments && p[1] == '/') return; else break; } else break; } if (*p != '\n') pedwarn ("text following `#else' or `#endif' violates ANSI standard"); } /* Skip a comment, assuming the input ptr immediately follows the initial slash-star. Bump *LINE_COUNTER for each newline. (The canonical line counter is &ip->lineno.) Don't use this routine (or the next one) if bumping the line counter is not sufficient to deal with newlines in the string. If NOWARN is nonzero, don't warn about slash-star inside a comment. This feature is useful when processing a comment that is going to be processed or was processed at another point in the preprocessor, to avoid a duplicate warning. Likewise for unterminated comment errors. */ static U_CHAR * skip_to_end_of_comment (ip, line_counter, nowarn) register FILE_BUF *ip; int *line_counter; /* place to remember newlines, or NULL */ int nowarn; { register U_CHAR *limit = ip->buf + ip->length; register U_CHAR *bp = ip->bufp; FILE_BUF *op = put_out_comments && !line_counter ? &outbuf : (FILE_BUF *) 0; int start_line = line_counter ? *line_counter : 0; /* JF this line_counter stuff is a crock to make sure the comment is only put out once, no matter how many times the comment is skipped. It almost works */ if (op) { *op->bufp++ = '/'; *op->bufp++ = bp[-1]; } if (cplusplus_comments && bp[-1] == '/') { for (; bp < limit; bp++) { if (*bp == '\n') break; if (*bp == '\\' && bp + 1 < limit && bp[1] == '\n') { if (!nowarn && warn_comments) warning ("multiline `//' comment"); if (line_counter) ++*line_counter; if (op) { ++op->lineno; *op->bufp++ = *bp; } ++bp; } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (bp, limit - bp); if (length > 1) { if (op) { bcopy (bp, op->bufp, length - 1); op->bufp += (length - 1); } bp += (length - 1); } #endif } if (op) *op->bufp++ = *bp; } ip->bufp = bp; return bp; } while (bp < limit) { if (op) *op->bufp++ = *bp; switch (*bp++) { case '\n': /* If this is the end of the file, we have an unterminated comment. Don't swallow the newline. We are guaranteed that there will be a trailing newline and various pieces assume it's there. */ if (bp == limit) { --bp; --limit; break; } if (line_counter != NULL) ++*line_counter; if (op) ++op->lineno; break; case '*': if (bp[-2] == '/' && !nowarn && warn_comments) warning ("`/*' within comment"); if (*bp == '\\' && bp[1] == '\n') newline_fix (bp); if (*bp == '/') { if (op) *op->bufp++ = '/'; ip->bufp = ++bp; return bp; } break; #ifdef MULTIBYTE_CHARS default: { int length; bp--; length = local_mblen (bp, limit - bp); if (length <= 0) length = 1; if (op) { op->bufp--; bcopy (bp, op->bufp, length); op->bufp += length; } bp += length; } #endif } } if (!nowarn) error_with_line (line_for_error (start_line), "unterminated comment"); ip->bufp = bp; return bp; } /* Skip over a quoted string. BP points to the opening quote. Returns a pointer after the closing quote. Don't go past LIMIT. START_LINE is the line number of the starting point (but it need not be valid if the starting point is inside a macro expansion). The input stack state is not changed. If COUNT_NEWLINES is nonzero, it points to an int to increment for each newline passed. If BACKSLASH_NEWLINES_P is nonzero, store 1 thru it if we pass a backslash-newline. If EOFP is nonzero, set *EOFP to 1 if the string is unterminated. */ static U_CHAR * skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p, eofp) register U_CHAR *bp; register U_CHAR *limit; int start_line; int *count_newlines; int *backslash_newlines_p; int *eofp; { register U_CHAR c, match; match = *bp++; while (1) { if (bp >= limit) { error_with_line (line_for_error (start_line), "unterminated string or character constant"); error_with_line (multiline_string_line, "possible real start of unterminated constant"); multiline_string_line = 0; if (eofp) *eofp = 1; break; } c = *bp++; if (c == '\\') { while (*bp == '\\' && bp[1] == '\n') { if (backslash_newlines_p) *backslash_newlines_p = 1; if (count_newlines) ++*count_newlines; bp += 2; } if (*bp == '\n') { if (backslash_newlines_p) *backslash_newlines_p = 1; if (count_newlines) ++*count_newlines; } bp++; } else if (c == '\n') { if (traditional) { /* Unterminated strings and character constants are 'valid'. */ bp--; /* Don't consume the newline. */ if (eofp) *eofp = 1; break; } if (match == '\'') { error_with_line (line_for_error (start_line), "unterminated string or character constant"); bp--; if (eofp) *eofp = 1; break; } /* If not traditional, then allow newlines inside strings. */ if (count_newlines) ++*count_newlines; if (multiline_string_line == 0) { if (pedantic) pedwarn_with_line (line_for_error (start_line), "string constant runs past end of line"); multiline_string_line = start_line; } } else if (c == match) break; #ifdef MULTIBYTE_CHARS { int length; --bp; length = local_mblen (bp, limit - bp); if (length <= 0) length = 1; bp += length; } #endif } return bp; } /* Place into DST a quoted string representing the string SRC. SRCLEN is the length of SRC; SRC may contain null bytes. Return the address of DST's terminating null. */ static char * quote_string (dst, src, srclen) char *dst, *src; size_t srclen; { U_CHAR c; char *srclim = src + srclen; *dst++ = '\"'; while (src != srclim) switch ((c = *src++)) { default: if (ISPRINT (c)) *dst++ = c; else { sprintf (dst, "\\%03o", c); dst += 4; } break; case '\"': case '\\': *dst++ = '\\'; *dst++ = c; break; } *dst++ = '\"'; *dst = '\0'; return dst; } /* Skip across a group of balanced parens, starting from IP->bufp. IP->bufp is updated. Use this with IP->bufp pointing at an open-paren. This does not handle newlines, because it's used for the arg of #if, where there aren't any newlines. Also, backslash-newline can't appear. */ static U_CHAR * skip_paren_group (ip) register FILE_BUF *ip; { U_CHAR *limit = ip->buf + ip->length; U_CHAR *p = ip->bufp; int depth = 0; int lines_dummy = 0; while (p != limit) { int c = *p++; switch (c) { case '(': depth++; break; case ')': depth--; if (depth == 0) return ip->bufp = p; break; case '/': if (*p == '*') { ip->bufp = p; p = skip_to_end_of_comment (ip, &lines_dummy, 0); p = ip->bufp; } case '"': case '\'': { int eofp = 0; p = skip_quoted_string (p - 1, limit, 0, NULL_PTR, NULL_PTR, &eofp); if (eofp) return ip->bufp = p; } break; } } ip->bufp = p; return p; } /* Write out a #line directive, for instance, after an #include file. If CONDITIONAL is nonzero, we can omit the #line if it would appear to be a no-op, and we can output a few newlines instead if we want to increase the line number by a small amount. FILE_CHANGE says whether we are entering a file, leaving, or neither. */ static void output_line_directive (ip, op, conditional, file_change) FILE_BUF *ip, *op; int conditional; enum file_change_code file_change; { int len; char *line_directive_buf, *line_end; if (no_line_directives || ip->fname == NULL || no_output) { op->lineno = ip->lineno; return; } if (conditional) { if (ip->lineno == op->lineno) return; /* If the inherited line number is a little too small, output some newlines instead of a #line directive. */ if (ip->lineno > op->lineno && ip->lineno < op->lineno + 8) { check_expand (op, 10); while (ip->lineno > op->lineno) { *op->bufp++ = '\n'; op->lineno++; } return; } } /* Output a positive line number if possible. */ while (ip->lineno <= 0 && ip->bufp - ip->buf < ip->length && *ip->bufp == '\n') { ip->lineno++; ip->bufp++; } line_directive_buf = (char *) alloca (4 * ip->nominal_fname_len + 100); sprintf (line_directive_buf, "# %d ", ip->lineno); line_end = quote_string (line_directive_buf + strlen (line_directive_buf), ip->nominal_fname, ip->nominal_fname_len); if (file_change != same_file) { *line_end++ = ' '; *line_end++ = file_change == enter_file ? '1' : '2'; } /* Tell cc1 if following text comes from a system header file. */ if (ip->system_header_p) { *line_end++ = ' '; *line_end++ = '3'; } #ifndef NO_IMPLICIT_EXTERN_C /* Tell cc1plus if following text should be treated as C. */ if (ip->system_header_p == 2 && cplusplus) { *line_end++ = ' '; *line_end++ = '4'; } #endif *line_end++ = '\n'; len = line_end - line_directive_buf; check_expand (op, len + 1); if (op->bufp > op->buf && op->bufp[-1] != '\n') *op->bufp++ = '\n'; bcopy ((char *) line_directive_buf, (char *) op->bufp, len); op->bufp += len; op->lineno = ip->lineno; } /* This structure represents one parsed argument in a macro call. `raw' points to the argument text as written (`raw_length' is its length). `expanded' points to the argument's macro-expansion (its length is `expand_length'). `stringified_length' is the length the argument would have if stringified. `use_count' is the number of times this macro arg is substituted into the macro. If the actual use count exceeds 10, the value stored is 10. `free1' and `free2', if nonzero, point to blocks to be freed when the macro argument data is no longer needed. */ struct argdata { U_CHAR *raw, *expanded; int raw_length, expand_length; int stringified_length; U_CHAR *free1, *free2; char newlines; char use_count; }; /* Expand a macro call. HP points to the symbol that is the macro being called. Put the result of expansion onto the input stack so that subsequent input by our caller will use it. If macro wants arguments, caller has already verified that an argument list follows; arguments come from the input stack. */ static void macroexpand (hp, op) HASHNODE *hp; FILE_BUF *op; { int nargs; DEFINITION *defn = hp->value.defn; register U_CHAR *xbuf; int xbuf_len; int start_line = instack[indepth].lineno; int rest_args, rest_zero; CHECK_DEPTH (return;); /* it might not actually be a macro. */ if (hp->type != T_MACRO) { special_symbol (hp, op); return; } /* This macro is being used inside a #if, which means it must be */ /* recorded as a precondition. */ if (pcp_inside_if && pcp_outfile && defn->predefined) dump_single_macro (hp, pcp_outfile); nargs = defn->nargs; if (nargs >= 0) { register int i; struct argdata *args; int parse_error = 0; args = (struct argdata *) alloca ((nargs + 1) * sizeof (struct argdata)); for (i = 0; i < nargs; i++) { args[i].raw = (U_CHAR *) ""; args[i].expanded = 0; args[i].raw_length = args[i].expand_length = args[i].stringified_length = 0; args[i].free1 = args[i].free2 = 0; args[i].use_count = 0; } /* Parse all the macro args that are supplied. I counts them. The first NARGS args are stored in ARGS. The rest are discarded. If rest_args is set then we assume macarg absorbed the rest of the args. */ i = 0; rest_args = 0; do { /* Discard the open-parenthesis or comma before the next arg. */ ++instack[indepth].bufp; if (rest_args) continue; if (i < nargs || (nargs == 0 && i == 0)) { /* If we are working on last arg which absorbs rest of args... */ if (i == nargs - 1 && defn->rest_args) rest_args = 1; parse_error = macarg (&args[i], rest_args); } else parse_error = macarg (NULL_PTR, 0); if (parse_error) { error_with_line (line_for_error (start_line), "unterminated macro call"); break; } i++; } while (*instack[indepth].bufp != ')'); /* If we got one arg but it was just whitespace, call that 0 args. */ if (i == 1) { register U_CHAR *bp = args[0].raw; register U_CHAR *lim = bp + args[0].raw_length; /* cpp.texi says for foo ( ) we provide one argument. However, if foo wants just 0 arguments, treat this as 0. */ if (nargs == 0) while (bp != lim && is_space[*bp]) bp++; if (bp == lim) i = 0; } /* Don't output an error message if we have already output one for a parse error above. */ rest_zero = 0; if (nargs == 0 && i > 0) { if (! parse_error) error ("arguments given to macro `%s'", hp->name); } else if (i < nargs) { /* traditional C allows foo() if foo wants one argument. */ if (nargs == 1 && i == 0 && traditional) ; /* the rest args token is allowed to absorb 0 tokens */ else if (i == nargs - 1 && defn->rest_args) rest_zero = 1; else if (parse_error) ; else if (i == 0) error ("macro `%s' used without args", hp->name); else if (i == 1) error ("macro `%s' used with just one arg", hp->name); else error ("macro `%s' used with only %d args", hp->name, i); } else if (i > nargs) { if (! parse_error) error ("macro `%s' used with too many (%d) args", hp->name, i); } /* Swallow the closeparen. */ ++instack[indepth].bufp; /* If macro wants zero args, we parsed the arglist for checking only. Read directly from the macro definition. */ if (nargs == 0) { xbuf = defn->expansion; xbuf_len = defn->length; } else { register U_CHAR *exp = defn->expansion; register int offset; /* offset in expansion, copied a piece at a time */ register int totlen; /* total amount of exp buffer filled so far */ register struct reflist *ap, *last_ap; /* Macro really takes args. Compute the expansion of this call. */ /* Compute length in characters of the macro's expansion. Also count number of times each arg is used. */ xbuf_len = defn->length; for (ap = defn->pattern; ap != NULL; ap = ap->next) { if (ap->stringify) xbuf_len += args[ap->argno].stringified_length; else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional) /* Add 4 for two newline-space markers to prevent token concatenation. */ xbuf_len += args[ap->argno].raw_length + 4; else { /* We have an ordinary (expanded) occurrence of the arg. So compute its expansion, if we have not already. */ if (args[ap->argno].expanded == 0) { FILE_BUF obuf; obuf = expand_to_temp_buffer (args[ap->argno].raw, args[ap->argno].raw + args[ap->argno].raw_length, 1, 0); args[ap->argno].expanded = obuf.buf; args[ap->argno].expand_length = obuf.length; args[ap->argno].free2 = obuf.buf; } /* Add 4 for two newline-space markers to prevent token concatenation. */ xbuf_len += args[ap->argno].expand_length + 4; } if (args[ap->argno].use_count < 10) args[ap->argno].use_count++; } xbuf = (U_CHAR *) xmalloc (xbuf_len + 1); /* Generate in XBUF the complete expansion with arguments substituted in. TOTLEN is the total size generated so far. OFFSET is the index in the definition of where we are copying from. */ offset = totlen = 0; for (last_ap = NULL, ap = defn->pattern; ap != NULL; last_ap = ap, ap = ap->next) { register struct argdata *arg = &args[ap->argno]; int count_before = totlen; /* Add chars to XBUF. */ for (i = 0; i < ap->nchars; i++, offset++) xbuf[totlen++] = exp[offset]; /* If followed by an empty rest arg with concatenation, delete the last run of nonwhite chars. */ if (rest_zero && totlen > count_before && ((ap->rest_args && ap->raw_before != 0) || (last_ap != NULL && last_ap->rest_args && last_ap->raw_after != 0))) { /* Delete final whitespace. */ while (totlen > count_before && is_space[xbuf[totlen - 1]]) { totlen--; } /* Delete the nonwhites before them. */ while (totlen > count_before && ! is_space[xbuf[totlen - 1]]) { totlen--; } } if (ap->stringify != 0) { int arglen = arg->raw_length; int escaped = 0; int in_string = 0; int c; i = 0; while (i < arglen && (c = arg->raw[i], is_space[c])) i++; while (i < arglen && (c = arg->raw[arglen - 1], is_space[c])) arglen--; if (!traditional) xbuf[totlen++] = '\"'; /* insert beginning quote */ for (; i < arglen; i++) { c = arg->raw[i]; if (! in_string) { /* Special markers Newline Space generate nothing for a stringified argument. */ if (c == '\n' && arg->raw[i+1] != '\n') { i++; continue; } /* Internal sequences of whitespace are replaced by one space except within an string or char token. */ if (c == '\n' ? arg->raw[i+1] == '\n' : is_space[c]) { while (1) { /* Note that Newline Space does occur within whitespace sequences; consider it part of the sequence. */ if (c == '\n' && is_space[arg->raw[i+1]]) i += 2; else if (c != '\n' && is_space[c]) i++; else break; c = arg->raw[i]; } i--; c = ' '; } } if (escaped) escaped = 0; else { if (c == '\\') escaped = 1; else if (in_string) { if (c == in_string) in_string = 0; else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (arg->raw + i, arglen - i); if (length > 1) { bcopy (arg->raw + i, xbuf + totlen, length); i += length - 1; totlen += length; continue; } #endif } } else if (c == '\"' || c == '\'') in_string = c; } /* Escape these chars */ if (c == '\"' || (in_string && c == '\\')) xbuf[totlen++] = '\\'; /* We used to output e.g. \008 for control characters here, but this doesn't conform to the C Standard. Just output the characters as-is. */ xbuf[totlen++] = c; } if (!traditional) xbuf[totlen++] = '\"'; /* insert ending quote */ } else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional) { U_CHAR *p1 = arg->raw; U_CHAR *l1 = p1 + arg->raw_length; if (ap->raw_before != 0) { while (p1 != l1 && is_space[*p1]) p1++; while (p1 != l1 && is_idchar[*p1]) xbuf[totlen++] = *p1++; /* Delete any no-reexpansion marker that follows an identifier at the beginning of the argument if the argument is concatenated with what precedes it. */ if (p1[0] == '\n' && p1[1] == '-') p1 += 2; } else if (!traditional) { /* Ordinary expanded use of the argument. Put in newline-space markers to prevent token pasting. */ xbuf[totlen++] = '\n'; xbuf[totlen++] = ' '; } if (ap->raw_after != 0) { /* Arg is concatenated after: delete trailing whitespace, whitespace markers, and no-reexpansion markers. */ while (p1 != l1) { if (is_space[l1[-1]]) l1--; else if (l1[-1] == '-') { U_CHAR *p2 = l1 - 1; /* If a `-' is preceded by an odd number of newlines then it and the last newline are a no-reexpansion marker. */ while (p2 != p1 && p2[-1] == '\n') p2--; if ((l1 - 1 - p2) & 1) { l1 -= 2; } else break; } else break; } } bcopy ((char *) p1, (char *) (xbuf + totlen), l1 - p1); totlen += l1 - p1; if (!traditional && ap->raw_after == 0) { /* Ordinary expanded use of the argument. Put in newline-space markers to prevent token pasting. */ xbuf[totlen++] = '\n'; xbuf[totlen++] = ' '; } } else { /* Ordinary expanded use of the argument. Put in newline-space markers to prevent token pasting. */ if (!traditional) { xbuf[totlen++] = '\n'; xbuf[totlen++] = ' '; } bcopy ((char *) arg->expanded, (char *) (xbuf + totlen), arg->expand_length); totlen += arg->expand_length; if (!traditional) { xbuf[totlen++] = '\n'; xbuf[totlen++] = ' '; } /* If a macro argument with newlines is used multiple times, then only expand the newlines once. This avoids creating output lines which don't correspond to any input line, which confuses gdb and gcov. */ if (arg->use_count > 1 && arg->newlines > 0) { /* Don't bother doing change_newlines for subsequent uses of arg. */ arg->use_count = 1; arg->expand_length = change_newlines (arg->expanded, arg->expand_length); } } if (totlen > xbuf_len) abort (); } /* If there is anything left of the definition after handling the arg list, copy that in too. */ for (i = offset; i < defn->length; i++) { /* if we've reached the end of the macro */ if (exp[i] == ')') rest_zero = 0; if (! (rest_zero && last_ap != NULL && last_ap->rest_args && last_ap->raw_after != 0)) xbuf[totlen++] = exp[i]; } xbuf[totlen] = 0; xbuf_len = totlen; for (i = 0; i < nargs; i++) { if (args[i].free1 != 0) free (args[i].free1); if (args[i].free2 != 0) free (args[i].free2); } } } else { xbuf = defn->expansion; xbuf_len = defn->length; } /* Now put the expansion on the input stack so our caller will commence reading from it. */ { register FILE_BUF *ip2; ip2 = &instack[++indepth]; ip2->fname = 0; ip2->nominal_fname = 0; ip2->nominal_fname_len = 0; ip2->inc = 0; /* This may not be exactly correct, but will give much better error messages for nested macro calls than using a line number of zero. */ ip2->lineno = start_line; ip2->buf = xbuf; ip2->length = xbuf_len; ip2->bufp = xbuf; ip2->free_ptr = (nargs > 0) ? xbuf : 0; ip2->macro = hp; ip2->if_stack = if_stack; ip2->system_header_p = 0; /* Recursive macro use sometimes works traditionally. #define foo(x,y) bar (x (y,0), y) foo (foo, baz) */ if (!traditional) hp->type = T_DISABLED; } } /* Parse a macro argument and store the info on it into *ARGPTR. REST_ARGS is passed to macarg1 to make it absorb the rest of the args. Return nonzero to indicate a syntax error. */ static int macarg (argptr, rest_args) register struct argdata *argptr; int rest_args; { FILE_BUF *ip = &instack[indepth]; int paren = 0; int newlines = 0; int comments = 0; int result = 0; /* Try to parse as much of the argument as exists at this input stack level. */ U_CHAR *bp = macarg1 (ip->bufp, ip->buf + ip->length, ip->macro, &paren, &newlines, &comments, rest_args); /* If we find the end of the argument at this level, set up *ARGPTR to point at it in the input stack. */ if (!(ip->fname != 0 && (newlines != 0 || comments != 0)) && bp != ip->buf + ip->length) { if (argptr != 0) { argptr->raw = ip->bufp; argptr->raw_length = bp - ip->bufp; argptr->newlines = newlines; } ip->bufp = bp; } else { /* This input stack level ends before the macro argument does. We must pop levels and keep parsing. Therefore, we must allocate a temporary buffer and copy the macro argument into it. */ int bufsize = bp - ip->bufp; int extra = newlines; U_CHAR *buffer = (U_CHAR *) xmalloc (bufsize + extra + 1); int final_start = 0; bcopy ((char *) ip->bufp, (char *) buffer, bufsize); ip->bufp = bp; ip->lineno += newlines; while (bp == ip->buf + ip->length) { if (instack[indepth].macro == 0) { result = 1; break; } ip->macro->type = T_MACRO; if (ip->free_ptr) free (ip->free_ptr); ip = &instack[--indepth]; newlines = 0; comments = 0; bp = macarg1 (ip->bufp, ip->buf + ip->length, ip->macro, &paren, &newlines, &comments, rest_args); final_start = bufsize; bufsize += bp - ip->bufp; extra += newlines; buffer = (U_CHAR *) xrealloc (buffer, bufsize + extra + 1); bcopy ((char *) ip->bufp, (char *) (buffer + bufsize - (bp - ip->bufp)), bp - ip->bufp); ip->bufp = bp; ip->lineno += newlines; } /* Now, if arg is actually wanted, record its raw form, discarding comments and duplicating newlines in whatever part of it did not come from a macro expansion. EXTRA space has been preallocated for duplicating the newlines. FINAL_START is the index of the start of that part. */ if (argptr != 0) { argptr->raw = buffer; argptr->raw_length = bufsize; argptr->free1 = buffer; argptr->newlines = newlines; if ((newlines || comments) && ip->fname != 0) argptr->raw_length = final_start + discard_comments (argptr->raw + final_start, argptr->raw_length - final_start, newlines); argptr->raw[argptr->raw_length] = 0; if (argptr->raw_length > bufsize + extra) abort (); } } /* If we are not discarding this argument, macroexpand it and compute its length as stringified. All this info goes into *ARGPTR. */ if (argptr != 0) { register U_CHAR *buf, *lim; register int totlen; buf = argptr->raw; lim = buf + argptr->raw_length; while (buf != lim && is_space[*buf]) buf++; while (buf != lim && is_space[lim[-1]]) lim--; totlen = traditional ? 0 : 2; /* Count opening and closing quote. */ while (buf != lim) { register U_CHAR c = *buf++; totlen++; /* Internal sequences of whitespace are replaced by one space in most cases, but not always. So count all the whitespace in case we need to keep it all. */ #if 0 if (is_space[c]) SKIP_ALL_WHITE_SPACE (buf); else #endif if (c == '\"' || c == '\\') /* escape these chars */ totlen++; } argptr->stringified_length = totlen; } return result; } /* Scan text from START (inclusive) up to LIMIT (exclusive), taken from the expansion of MACRO, counting parens in *DEPTHPTR, and return if reach LIMIT or before a `)' that would make *DEPTHPTR negative or before a comma when *DEPTHPTR is zero. Single and double quotes are matched and termination is inhibited within them. Comments also inhibit it. Value returned is pointer to stopping place. Increment *NEWLINES each time a newline is passed. REST_ARGS notifies macarg1 that it should absorb the rest of the args. Set *COMMENTS to 1 if a comment is seen. */ static U_CHAR * macarg1 (start, limit, macro, depthptr, newlines, comments, rest_args) U_CHAR *start; register U_CHAR *limit; struct hashnode *macro; int *depthptr, *newlines, *comments; int rest_args; { register U_CHAR *bp = start; while (bp < limit) { switch (*bp) { case '(': (*depthptr)++; break; case ')': if (--(*depthptr) < 0) return bp; break; case '\\': /* Traditionally, backslash makes following char not special. */ if (traditional && bp + 1 < limit && bp[1] != '\n') bp++; break; case '\n': ++*newlines; break; case '/': if (macro) break; if (bp[1] == '\\' && bp[2] == '\n') newline_fix (bp + 1); if (bp[1] == '*') { *comments = 1; for (bp += 2; bp < limit; bp++) { if (*bp == '\n') ++*newlines; else if (*bp == '*') { if (bp[-1] == '/' && warn_comments) warning ("`/*' within comment"); if (bp[1] == '\\' && bp[2] == '\n') newline_fix (bp + 1); if (bp[1] == '/') { bp++; break; } } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (bp, limit - bp); if (length > 1) bp += (length - 1); #endif } } } else if (bp[1] == '/' && cplusplus_comments) { *comments = 1; for (bp += 2; bp < limit; bp++) { if (*bp == '\n') { ++*newlines; break; } if (*bp == '\\' && bp + 1 < limit && bp[1] == '\n') { ++*newlines; if (warn_comments) warning ("multiline `//' comment"); ++bp; } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (bp, limit - bp); if (length > 1) bp += (length - 1); #endif } } } break; case '\'': case '\"': { int quotec; for (quotec = *bp++; bp + 1 < limit && *bp != quotec; bp++) { if (*bp == '\\') { bp++; if (*bp == '\n') ++*newlines; if (!macro) { while (*bp == '\\' && bp[1] == '\n') { bp += 2; ++*newlines; } } } else if (*bp == '\n') { ++*newlines; if (quotec == '\'') break; } else { #ifdef MULTIBYTE_CHARS int length; length = local_mblen (bp, limit - bp); if (length > 1) bp += (length - 1); #endif } } } break; case ',': /* if we've returned to lowest level and we aren't absorbing all args */ if ((*depthptr) == 0 && rest_args == 0) return bp; break; } bp++; } return bp; } /* Discard comments and duplicate newlines in the string of length LENGTH at START, except inside of string constants. The string is copied into itself with its beginning staying fixed. NEWLINES is the number of newlines that must be duplicated. We assume that that much extra space is available past the end of the string. */ static int discard_comments (start, length, newlines) U_CHAR *start; int length; int newlines; { register U_CHAR *ibp; register U_CHAR *obp; register U_CHAR *limit; register int c; /* If we have newlines to duplicate, copy everything that many characters up. Then, in the second part, we will have room to insert the newlines while copying down. NEWLINES may actually be too large, because it counts newlines in string constants, and we don't duplicate those. But that does no harm. */ if (newlines > 0) { ibp = start + length; obp = ibp + newlines; limit = start; while (limit != ibp) *--obp = *--ibp; } ibp = start + newlines; limit = start + length + newlines; obp = start; while (ibp < limit) { *obp++ = c = *ibp++; switch (c) { case '\n': /* Duplicate the newline. */ *obp++ = '\n'; break; case '\\': if (*ibp == '\n') { obp--; ibp++; } break; case '/': if (*ibp == '\\' && ibp[1] == '\n') newline_fix (ibp); /* Delete any comment. */ if (cplusplus_comments && ibp[0] == '/') { /* Comments are equivalent to spaces. */ obp[-1] = ' '; ibp++; while (ibp < limit) { if (*ibp == '\n') break; if (*ibp == '\\' && ibp + 1 < limit && ibp[1] == '\n') ibp++; else { #ifdef MULTIBYTE_CHARS int length = local_mblen (ibp, limit - ibp); if (length > 1) ibp += (length - 1); #endif } ibp++; } break; } if (ibp[0] != '*' || ibp + 1 >= limit) break; /* Comments are equivalent to spaces. For -traditional, a comment is equivalent to nothing. */ if (traditional) obp--; else obp[-1] = ' '; while (++ibp < limit) { if (ibp[0] == '*') { if (ibp[1] == '\\' && ibp[2] == '\n') newline_fix (ibp + 1); if (ibp[1] == '/') { ibp += 2; break; } } else { #ifdef MULTIBYTE_CHARS int length = local_mblen (ibp, limit - ibp); if (length > 1) ibp += (length - 1); #endif } } break; case '\'': case '\"': /* Notice and skip strings, so that we don't think that comments start inside them, and so we don't duplicate newlines in them. */ { int quotec = c; while (ibp < limit) { *obp++ = c = *ibp++; if (c == quotec) break; if (c == '\n') { if (quotec == '\'') break; } else if (c == '\\') { if (ibp < limit && *ibp == '\n') { ibp++; obp--; } else { while (*ibp == '\\' && ibp[1] == '\n') ibp += 2; if (ibp < limit) *obp++ = *ibp++; } } else { #ifdef MULTIBYTE_CHARS int length; ibp--; length = local_mblen (ibp, limit - ibp); if (length > 1) { obp--; bcopy (ibp, obp, length); ibp += length; obp += length; } else ibp++; #endif } } } break; } } return obp - start; } /* Turn newlines to spaces in the string of length LENGTH at START, except inside of string constants. The string is copied into itself with its beginning staying fixed. */ static int change_newlines (start, length) U_CHAR *start; int length; { register U_CHAR *ibp; register U_CHAR *obp; register U_CHAR *limit; register int c; ibp = start; limit = start + length; obp = start; while (ibp < limit) { *obp++ = c = *ibp++; switch (c) { case '\n': /* If this is a NEWLINE NEWLINE, then this is a real newline in the string. Skip past the newline and its duplicate. Put a space in the output. */ if (*ibp == '\n') { ibp++; obp--; *obp++ = ' '; } break; case '\'': case '\"': /* Notice and skip strings, so that we don't delete newlines in them. */ { int quotec = c; while (ibp < limit) { *obp++ = c = *ibp++; if (c == quotec) break; else if (c == '\\' && ibp < limit && *ibp == '\n') *obp++ = *ibp++; else if (c == '\n') { if (quotec == '\'') break; } else { #ifdef MULTIBYTE_CHARS int length; ibp--; length = local_mblen (ibp, limit - ibp); if (length > 1) { obp--; bcopy (ibp, obp, length); ibp += length; obp += length; } else ibp++; #endif } } } break; } } return obp - start; } /* my_strerror - return the descriptive text associated with an `errno' code. */ static char * my_strerror (errnum) int errnum; { char *result; #ifndef VMS #ifndef HAVE_STRERROR result = (char *) ((errnum < sys_nerr) ? sys_errlist[errnum] : 0); #else result = strerror (errnum); #endif #else /* VMS */ /* VAXCRTL's strerror() takes an optional second argument, which only matters when the first argument is EVMSERR. However, it's simplest just to pass it unconditionally. `vaxc$errno' is declared in , and maintained by the library in parallel with `errno'. We assume that caller's `errnum' either matches the last setting of `errno' by the library or else does not have the value `EVMSERR'. */ result = strerror (errnum, vaxc$errno); #endif if (!result) result = "errno = ?"; return result; } /* notice - output message to stderr */ static void notice VPROTO ((const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, const char *); #endif vnotice (msgid, args); va_end (args); } static void vnotice (msgid, args) const char *msgid; va_list args; { vfprintf (stderr, _(msgid), args); } /* error - print error message and increment count of errors. */ void error VPROTO ((const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, const char *); #endif verror (msgid, args); va_end (args); } void verror (msgid, args) const char *msgid; va_list args; { int i; FILE_BUF *ip = NULL; print_containing_files (); for (i = indepth; i >= 0; i--) if (instack[i].fname != NULL) { ip = &instack[i]; break; } if (ip != NULL) { eprint_string (ip->nominal_fname, ip->nominal_fname_len); fprintf (stderr, ":%d: ", ip->lineno); } vnotice (msgid, args); fprintf (stderr, "\n"); errors++; } /* Error including a message from `errno'. */ static void error_from_errno (name) char *name; { int e = errno; int i; FILE_BUF *ip = NULL; print_containing_files (); for (i = indepth; i >= 0; i--) if (instack[i].fname != NULL) { ip = &instack[i]; break; } if (ip != NULL) { eprint_string (ip->nominal_fname, ip->nominal_fname_len); fprintf (stderr, ":%d: ", ip->lineno); } fprintf (stderr, "%s: %s\n", name, my_strerror (e)); errors++; } /* Print error message but don't count it. */ void warning VPROTO ((const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, const char *); #endif vwarning (msgid, args); va_end (args); } static void vwarning (msgid, args) const char *msgid; va_list args; { int i; FILE_BUF *ip = NULL; if (inhibit_warnings) return; if (warnings_are_errors) errors++; print_containing_files (); for (i = indepth; i >= 0; i--) if (instack[i].fname != NULL) { ip = &instack[i]; break; } if (ip != NULL) { eprint_string (ip->nominal_fname, ip->nominal_fname_len); fprintf (stderr, ":%d: ", ip->lineno); } notice ("warning: "); vnotice (msgid, args); fprintf (stderr, "\n"); } static void error_with_line VPROTO ((int line, const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES int line; const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES line = va_arg (args, int); msgid = va_arg (args, const char *); #endif verror_with_line (line, msgid, args); va_end (args); } static void verror_with_line (line, msgid, args) int line; const char *msgid; va_list args; { int i; FILE_BUF *ip = NULL; print_containing_files (); for (i = indepth; i >= 0; i--) if (instack[i].fname != NULL) { ip = &instack[i]; break; } if (ip != NULL) { eprint_string (ip->nominal_fname, ip->nominal_fname_len); fprintf (stderr, ":%d: ", line); } vnotice (msgid, args); fprintf (stderr, "\n"); errors++; } static void warning_with_line VPROTO ((int line, const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES int line; const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES line = va_arg (args, int); msgid = va_arg (args, const char *); #endif vwarning_with_line (line, msgid, args); va_end (args); } static void vwarning_with_line (line, msgid, args) int line; const char *msgid; va_list args; { int i; FILE_BUF *ip = NULL; if (inhibit_warnings) return; if (warnings_are_errors) errors++; print_containing_files (); for (i = indepth; i >= 0; i--) if (instack[i].fname != NULL) { ip = &instack[i]; break; } if (ip != NULL) { eprint_string (ip->nominal_fname, ip->nominal_fname_len); fprintf (stderr, line ? ":%d: " : ": ", line); } notice ("warning: "); vnotice (msgid, args); fprintf (stderr, "\n"); } /* Print an error message and maybe count it. */ void pedwarn VPROTO ((const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, const char *); #endif if (pedantic_errors) verror (msgid, args); else vwarning (msgid, args); va_end (args); } void pedwarn_with_line VPROTO ((int line, const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES int line; const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES line = va_arg (args, int); msgid = va_arg (args, const char *); #endif if (pedantic_errors) verror_with_line (line, msgid, args); else vwarning_with_line (line, msgid, args); va_end (args); } /* Report a warning (or an error if pedantic_errors) giving specified file name and line number, not current. */ static void pedwarn_with_file_and_line VPROTO ((const char *file, size_t file_len, int line, const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES const char *file; size_t file_len; int line; const char * msgid; #endif va_list args; if (!pedantic_errors && inhibit_warnings) return; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES file = va_arg (args, const char *); file_len = va_arg (args, size_t); line = va_arg (args, int); msgid = va_arg (args, const char *); #endif if (file) { eprint_string (file, file_len); fprintf (stderr, ":%d: ", line); } if (pedantic_errors) errors++; if (!pedantic_errors) notice ("warning: "); vnotice (msgid, args); va_end (args); fprintf (stderr, "\n"); } static void pedwarn_strange_white_space (ch) int ch; { switch (ch) { case '\f': pedwarn ("formfeed in preprocessing directive"); break; case '\r': pedwarn ("carriage return in preprocessing directive"); break; case '\v': pedwarn ("vertical tab in preprocessing directive"); break; default: abort (); } } /* Print the file names and line numbers of the #include directives which led to the current file. */ static void print_containing_files () { FILE_BUF *ip = NULL; int i; int first = 1; /* If stack of files hasn't changed since we last printed this info, don't repeat it. */ if (last_error_tick == input_file_stack_tick) return; for (i = indepth; i >= 0; i--) if (instack[i].fname != NULL) { ip = &instack[i]; break; } /* Give up if we don't find a source file. */ if (ip == NULL) return; /* Find the other, outer source files. */ for (i--; i >= 0; i--) if (instack[i].fname != NULL) { ip = &instack[i]; if (first) { first = 0; notice ( "In file included from "); } else { notice (",\n from "); } eprint_string (ip->nominal_fname, ip->nominal_fname_len); fprintf (stderr, ":%d", ip->lineno); } if (! first) fprintf (stderr, ":\n"); /* Record we have printed the status as of this time. */ last_error_tick = input_file_stack_tick; } /* Return the line at which an error occurred. The error is not necessarily associated with the current spot in the input stack, so LINE says where. LINE will have been copied from ip->lineno for the current input level. If the current level is for a file, we return LINE. But if the current level is not for a file, LINE is meaningless. In that case, we return the lineno of the innermost file. */ static int line_for_error (line) int line; { int i; int line1 = line; for (i = indepth; i >= 0; ) { if (instack[i].fname != 0) return line1; i--; if (i < 0) return 0; line1 = instack[i].lineno; } abort (); /*NOTREACHED*/ return 0; } /* * If OBUF doesn't have NEEDED bytes after OPTR, make it bigger. * * As things stand, nothing is ever placed in the output buffer to be * removed again except when it's KNOWN to be part of an identifier, * so flushing and moving down everything left, instead of expanding, * should work ok. */ /* You might think void was cleaner for the return type, but that would get type mismatch in check_expand in strict ANSI. */ static int grow_outbuf (obuf, needed) register FILE_BUF *obuf; register int needed; { register U_CHAR *p; int minsize; if (obuf->length - (obuf->bufp - obuf->buf) > needed) return 0; /* Make it at least twice as big as it is now. */ obuf->length *= 2; /* Make it have at least 150% of the free space we will need. */ minsize = (3 * needed) / 2 + (obuf->bufp - obuf->buf); if (minsize > obuf->length) obuf->length = minsize; if ((p = (U_CHAR *) xrealloc (obuf->buf, obuf->length)) == NULL) memory_full (); obuf->bufp = p + (obuf->bufp - obuf->buf); obuf->buf = p; return 0; } /* Symbol table for macro names and special symbols */ /* * install a name in the main hash table, even if it is already there. * name stops with first non alphanumeric, except leading '#'. * caller must check against redefinition if that is desired. * delete_macro () removes things installed by install () in fifo order. * this is important because of the `defined' special symbol used * in #if, and also if pushdef/popdef directives are ever implemented. * * If LEN is >= 0, it is the length of the name. * Otherwise, compute the length by scanning the entire name. * * If HASH is >= 0, it is the precomputed hash code. * Otherwise, compute the hash code. */ static HASHNODE * install (name, len, type, value, hash) U_CHAR *name; int len; enum node_type type; char *value; int hash; { register HASHNODE *hp; register int i, bucket; register U_CHAR *p, *q; if (len < 0) { p = name; while (is_idchar[*p]) p++; len = p - name; } if (hash < 0) hash = hashf (name, len, HASHSIZE); i = sizeof (HASHNODE) + len + 1; hp = (HASHNODE *) xmalloc (i); bucket = hash; hp->bucket_hdr = &hashtab[bucket]; hp->next = hashtab[bucket]; hashtab[bucket] = hp; hp->prev = NULL; if (hp->next != NULL) hp->next->prev = hp; hp->type = type; hp->length = len; hp->value.cpval = value; hp->name = ((U_CHAR *) hp) + sizeof (HASHNODE); p = hp->name; q = name; for (i = 0; i < len; i++) *p++ = *q++; hp->name[len] = 0; return hp; } /* * find the most recent hash node for name "name" (ending with first * non-identifier char) installed by install * * If LEN is >= 0, it is the length of the name. * Otherwise, compute the length by scanning the entire name. * * If HASH is >= 0, it is the precomputed hash code. * Otherwise, compute the hash code. */ HASHNODE * lookup (name, len, hash) U_CHAR *name; int len; int hash; { register U_CHAR *bp; register HASHNODE *bucket; if (len < 0) { for (bp = name; is_idchar[*bp]; bp++) ; len = bp - name; } if (hash < 0) hash = hashf (name, len, HASHSIZE); bucket = hashtab[hash]; while (bucket) { if (bucket->length == len && bcmp (bucket->name, name, len) == 0) return bucket; bucket = bucket->next; } return NULL; } /* * Delete a hash node. Some weirdness to free junk from macros. * More such weirdness will have to be added if you define more hash * types that need it. */ /* Note that the DEFINITION of a macro is removed from the hash table but its storage is not freed. This would be a storage leak except that it is not reasonable to keep undefining and redefining large numbers of macros many times. In any case, this is necessary, because a macro can be #undef'd in the middle of reading the arguments to a call to it. If #undef freed the DEFINITION, that would crash. */ static void delete_macro (hp) HASHNODE *hp; { if (hp->prev != NULL) hp->prev->next = hp->next; if (hp->next != NULL) hp->next->prev = hp->prev; /* Make sure that the bucket chain header that the deleted guy was on points to the right thing afterwards. */ if (hp == *hp->bucket_hdr) *hp->bucket_hdr = hp->next; #if 0 if (hp->type == T_MACRO) { DEFINITION *d = hp->value.defn; struct reflist *ap, *nextap; for (ap = d->pattern; ap != NULL; ap = nextap) { nextap = ap->next; free (ap); } free (d); } #endif free (hp); } /* * return hash function on name. must be compatible with the one * computed a step at a time, elsewhere */ static int hashf (name, len, hashsize) register U_CHAR *name; register int len; int hashsize; { register int r = 0; while (len--) r = HASHSTEP (r, *name++); return MAKE_POS (r) % hashsize; } /* Dump the definition of a single macro HP to OF. */ static void dump_single_macro (hp, of) register HASHNODE *hp; FILE *of; { register DEFINITION *defn = hp->value.defn; struct reflist *ap; int offset; int concat; /* Print the definition of the macro HP. */ fprintf (of, "#define %s", hp->name); if (defn->nargs >= 0) { int i; fprintf (of, "("); for (i = 0; i < defn->nargs; i++) { dump_arg_n (defn, i, of); if (i + 1 < defn->nargs) fprintf (of, ", "); } fprintf (of, ")"); } fprintf (of, " "); offset = 0; concat = 0; for (ap = defn->pattern; ap != NULL; ap = ap->next) { dump_defn_1 (defn->expansion, offset, ap->nchars, of); offset += ap->nchars; if (!traditional) { if (ap->nchars != 0) concat = 0; if (ap->stringify) { switch (ap->stringify) { case SHARP_TOKEN: fprintf (of, "#"); break; case WHITE_SHARP_TOKEN: fprintf (of, "# "); break; case PERCENT_COLON_TOKEN: fprintf (of, "%%:"); break; case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%: "); break; default: abort (); } } if (ap->raw_before != 0) { if (concat) { switch (ap->raw_before) { case WHITE_SHARP_TOKEN: case WHITE_PERCENT_COLON_TOKEN: fprintf (of, " "); break; default: break; } } else { switch (ap->raw_before) { case SHARP_TOKEN: fprintf (of, "##"); break; case WHITE_SHARP_TOKEN: fprintf (of, "## "); break; case PERCENT_COLON_TOKEN: fprintf (of, "%%:%%:"); break; case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%:%%: "); break; default: abort (); } } } concat = 0; } dump_arg_n (defn, ap->argno, of); if (!traditional && ap->raw_after != 0) { switch (ap->raw_after) { case SHARP_TOKEN: fprintf (of, "##"); break; case WHITE_SHARP_TOKEN: fprintf (of, " ##"); break; case PERCENT_COLON_TOKEN: fprintf (of, "%%:%%:"); break; case WHITE_PERCENT_COLON_TOKEN: fprintf (of, " %%:%%:"); break; default: abort (); } concat = 1; } } dump_defn_1 (defn->expansion, offset, defn->length - offset, of); fprintf (of, "\n"); } /* Dump all macro definitions as #defines to stdout. */ static void dump_all_macros () { int bucket; for (bucket = 0; bucket < HASHSIZE; bucket++) { register HASHNODE *hp; for (hp = hashtab[bucket]; hp; hp= hp->next) { if (hp->type == T_MACRO) dump_single_macro (hp, stdout); } } } /* Output to OF a substring of a macro definition. BASE is the beginning of the definition. Output characters START thru LENGTH. Unless traditional, discard newlines outside of strings, thus converting funny-space markers to ordinary spaces. */ static void dump_defn_1 (base, start, length, of) U_CHAR *base; int start; int length; FILE *of; { U_CHAR *p = base + start; U_CHAR *limit = base + start + length; if (traditional) fwrite (p, sizeof (*p), length, of); else { while (p < limit) { if (*p == '\"' || *p =='\'') { U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR, NULL_PTR, NULL_PTR); fwrite (p, sizeof (*p), p1 - p, of); p = p1; } else { if (*p != '\n') putc (*p, of); p++; } } } } /* Print the name of argument number ARGNUM of macro definition DEFN to OF. Recall that DEFN->args.argnames contains all the arg names concatenated in reverse order with comma-space in between. */ static void dump_arg_n (defn, argnum, of) DEFINITION *defn; int argnum; FILE *of; { register U_CHAR *p = defn->args.argnames; while (argnum + 1 < defn->nargs) { p = (U_CHAR *) index ((char *) p, ' ') + 1; argnum++; } while (*p && *p != ',') { putc (*p, of); p++; } } /* Initialize syntactic classifications of characters. */ static void initialize_char_syntax () { register int i; /* * Set up is_idchar and is_idstart tables. These should be * faster than saying (is_alpha (c) || c == '_'), etc. * Set up these things before calling any routines tthat * refer to them. */ for (i = 'a'; i <= 'z'; i++) { is_idchar[i - 'a' + 'A'] = 1; is_idchar[i] = 1; is_idstart[i - 'a' + 'A'] = 1; is_idstart[i] = 1; } for (i = '0'; i <= '9'; i++) is_idchar[i] = 1; is_idchar['_'] = 1; is_idstart['_'] = 1; is_idchar['$'] = 1; is_idstart['$'] = 1; /* horizontal space table */ is_hor_space[' '] = 1; is_hor_space['\t'] = 1; is_hor_space['\v'] = 1; is_hor_space['\f'] = 1; is_hor_space['\r'] = 1; is_space[' '] = 1; is_space['\t'] = 1; is_space['\v'] = 1; is_space['\f'] = 1; is_space['\n'] = 1; is_space['\r'] = 1; } /* Initialize the built-in macros. */ static void initialize_builtins (inp, outp) FILE_BUF *inp; FILE_BUF *outp; { install ((U_CHAR *) "__LINE__", -1, T_SPECLINE, NULL_PTR, -1); install ((U_CHAR *) "__DATE__", -1, T_DATE, NULL_PTR, -1); install ((U_CHAR *) "__FILE__", -1, T_FILE, NULL_PTR, -1); install ((U_CHAR *) "__BASE_FILE__", -1, T_BASE_FILE, NULL_PTR, -1); install ((U_CHAR *) "__INCLUDE_LEVEL__", -1, T_INCLUDE_LEVEL, NULL_PTR, -1); /* Don't setup the standard #defines - AMB install ((U_CHAR *) "__VERSION__", -1, T_VERSION, NULL_PTR, -1); #ifndef NO_BUILTIN_SIZE_TYPE install ((U_CHAR *) "__SIZE_TYPE__", -1, T_SIZE_TYPE, NULL_PTR, -1); #endif #ifndef NO_BUILTIN_PTRDIFF_TYPE install ((U_CHAR *) "__PTRDIFF_TYPE__ ", -1, T_PTRDIFF_TYPE, NULL_PTR, -1); #endif install ((U_CHAR *) "__WCHAR_TYPE__", -1, T_WCHAR_TYPE, NULL_PTR, -1); install ((U_CHAR *) "__USER_LABEL_PREFIX__", -1, T_USER_LABEL_PREFIX_TYPE, NULL_PTR, -1); install ((U_CHAR *) "__REGISTER_PREFIX__", -1, T_REGISTER_PREFIX_TYPE, NULL_PTR, -1); install ((U_CHAR *) "__IMMEDIATE_PREFIX__", -1, T_IMMEDIATE_PREFIX_TYPE, NULL_PTR, -1); */ install ((U_CHAR *) "__TIME__", -1, T_TIME, NULL_PTR, -1); if (!traditional) { install ((U_CHAR *) "__STDC__", -1, T_CONST, "1", -1); install ((U_CHAR *) "__STDC_VERSION__", -1, T_CONST, "199409L", -1); } /* This is supplied using a -D by the compiler driver so that it is present only when truly compiling with GNU C. */ /* install ((U_CHAR *) "__GNUC__", -1, T_CONST, "2", -1); */ /* Don't setup the standard #defines - AMB install ((U_CHAR *) "__HAVE_BUILTIN_SETJMP__", -1, T_CONST, "1", -1); */ if (debug_output) { char directive[2048]; U_CHAR *udirective = (U_CHAR *) directive; register struct directive *dp = &directive_table[0]; struct tm *timebuf = timestamp (); sprintf (directive, " __BASE_FILE__ \"%s\"\n", instack[0].nominal_fname); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); /* Don't setup the standard #defines - AMB sprintf (directive, " __VERSION__ \"%s\"\n", version_string); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); #ifndef NO_BUILTIN_SIZE_TYPE sprintf (directive, " __SIZE_TYPE__ %s\n", SIZE_TYPE); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); #endif #ifndef NO_BUILTIN_PTRDIFF_TYPE sprintf (directive, " __PTRDIFF_TYPE__ %s\n", PTRDIFF_TYPE); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); #endif sprintf (directive, " __WCHAR_TYPE__ %s\n", wchar_type); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); */ sprintf (directive, " __DATE__ \"%s %2d %4d\"\n", monthnames[timebuf->tm_mon], timebuf->tm_mday, timebuf->tm_year + 1900); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); sprintf (directive, " __TIME__ \"%02d:%02d:%02d\"\n", timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); if (!traditional) { sprintf (directive, " __STDC__ 1"); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); } if (objc) { sprintf (directive, " __OBJC__ 1"); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); } } } /* * process a given definition string, for initialization * If STR is just an identifier, define it with value 1. * If STR has anything after the identifier, then it should * be identifier=definition. */ static void make_definition (str) char *str; { FILE_BUF *ip; struct directive *kt; U_CHAR *buf, *p; p = buf = (U_CHAR *) str; if (!is_idstart[*p]) { error ("malformed option `-D %s'", str); return; } while (is_idchar[*++p]) ; if (*p == '(') { while (is_idchar[*++p] || *p == ',' || is_hor_space[*p]) ; if (*p++ != ')') p = (U_CHAR *) str; /* Error */ } if (*p == 0) { buf = (U_CHAR *) alloca (p - buf + 4); strcpy ((char *)buf, str); strcat ((char *)buf, " 1"); } else if (*p != '=') { error ("malformed option `-D %s'", str); return; } else { U_CHAR *q; /* Copy the entire option so we can modify it. */ buf = (U_CHAR *) alloca (2 * strlen (str) + 1); strncpy ((char *) buf, str, p - (U_CHAR *) str); /* Change the = to a space. */ buf[p - (U_CHAR *) str] = ' '; /* Scan for any backslash-newline and remove it. */ p++; q = &buf[p - (U_CHAR *) str]; while (*p) { if (*p == '\"' || *p == '\'') { int unterminated = 0; U_CHAR *p1 = skip_quoted_string (p, p + strlen ((char *) p), 0, NULL_PTR, NULL_PTR, &unterminated); if (unterminated) return; while (p != p1) *q++ = *p++; } else if (*p == '\\' && p[1] == '\n') p += 2; /* Change newline chars into newline-markers. */ else if (*p == '\n') { *q++ = '\n'; *q++ = '\n'; p++; } else *q++ = *p++; } *q = 0; } ip = &instack[++indepth]; ip->nominal_fname = ip->fname = "*Initialization*"; ip->nominal_fname_len = strlen (ip->nominal_fname); ip->buf = ip->bufp = buf; ip->length = strlen ((char *) buf); ip->lineno = 1; ip->macro = 0; ip->free_ptr = 0; ip->if_stack = if_stack; ip->system_header_p = 0; for (kt = directive_table; kt->type != T_DEFINE; kt++) ; /* Pass NULL instead of OP, since this is a "predefined" macro. */ do_define (buf, buf + strlen ((char *) buf), NULL_PTR, kt); --indepth; } /* JF, this does the work for the -U option */ static void make_undef (str, op) char *str; FILE_BUF *op; { FILE_BUF *ip; struct directive *kt; ip = &instack[++indepth]; ip->nominal_fname = ip->fname = "*undef*"; ip->nominal_fname_len = strlen (ip->nominal_fname); ip->buf = ip->bufp = (U_CHAR *) str; ip->length = strlen (str); ip->lineno = 1; ip->macro = 0; ip->free_ptr = 0; ip->if_stack = if_stack; ip->system_header_p = 0; for (kt = directive_table; kt->type != T_UNDEF; kt++) ; do_undef ((U_CHAR *) str, (U_CHAR *) str + strlen (str), op, kt); --indepth; } /* Process the string STR as if it appeared as the body of a #assert. OPTION is the option name for which STR was the argument. */ static void make_assertion (option, str) const char *option; const char *str; { FILE_BUF *ip; struct directive *kt; U_CHAR *buf, *p, *q; /* Copy the entire option so we can modify it. */ buf = (U_CHAR *) alloca (strlen (str) + 2); /* Change to handle gcc 3.x "-Afoo=bar" - AMB */ strcpy ((char *) buf, str); /* Scan for any backslash-newline and remove it. */ p = q = buf; while (*p) { if (*p == '\\' && p[1] == '\n') p += 2; else *q++ = *p++; } *q = 0; p = buf; if (!is_idstart[*p]) { error ("malformed option `%s %s'", option, str); return; } while (is_idchar[*++p]) ; SKIP_WHITE_SPACE (p); if (! (*p == 0 || *p == '(' || *p == '=')) { /* Change to handle gcc 3.x "-Afoo=bar" - AMB */ error ("malformed option `%s %s'", option, str); return; } /* Start change to handle gcc 3.x "-Afoo=bar" - AMB */ if(*p=='=') { *p='('; strcat((char*)p,")"); } /* End change to handle gcc 3.x "-Afoo=bar" - AMB */ ip = &instack[++indepth]; ip->nominal_fname = ip->fname = "*Initialization*"; ip->nominal_fname_len = strlen (ip->nominal_fname); ip->buf = ip->bufp = buf; ip->length = strlen ((char *) buf); ip->lineno = 1; ip->macro = 0; ip->free_ptr = 0; ip->if_stack = if_stack; ip->system_header_p = 0; for (kt = directive_table; kt->type != T_ASSERT; kt++) ; /* Pass NULL as output ptr to do_define since we KNOW it never does any output.... */ do_assert (buf, buf + strlen ((char *) buf) , NULL_PTR, kt); --indepth; } /* The previous include prefix, if any, is PREV_FILE_NAME. Translate any pathnames with COMPONENT. Allocate a new include prefix whose name is the simplified concatenation of PREFIX and NAME, with a trailing / added if needed. But return 0 if the include prefix should be ignored, e.g. because it is a duplicate of PREV_FILE_NAME. */ static struct file_name_list * new_include_prefix (prev_file_name, component, prefix, name) struct file_name_list *prev_file_name; const char *component; const char *prefix; const char *name; { if (name == 0) fatal ("Directory name missing after command line option"); if (*name == 0) /* Ignore the empty string. */ return 0; prefix = update_path (prefix, component); name = update_path (name, component); { struct file_name_list *dir = ((struct file_name_list *) xmalloc (sizeof (struct file_name_list) + strlen (prefix) + strlen (name) + 2)); size_t len; strcpy (dir->fname, prefix); strcat (dir->fname, name); len = simplify_filename (dir->fname); /* Convert directory name to a prefix. */ if (len && dir->fname[len - 1] != DIR_SEPARATOR) { if (len == 1 && dir->fname[len - 1] == '.') len = 0; else #ifdef VMS /* must be '/', hack_vms_include_specification triggers on it. */ dir->fname[len++] = '/'; #else dir->fname[len++] = DIR_SEPARATOR; #endif dir->fname[len] = 0; } /* Ignore a directory whose name matches the previous one. */ if (prev_file_name && !strcmp (prev_file_name->fname, dir->fname)) { /* But treat `-Idir -I- -Idir' as `-I- -Idir'. */ if (!first_bracket_include) first_bracket_include = prev_file_name; free (dir); return 0; } #ifndef VMS /* VMS can't stat dir prefixes, so skip these optimizations in VMS. */ /* Add a trailing "." if there is a filename. This increases the number of systems that can stat directories. We remove it below. */ if (len != 0) { dir->fname[len] = '.'; dir->fname[len + 1] = 0; } /* Ignore a nonexistent directory. */ if (stat (len ? dir->fname : ".", &dir->st) != 0) { if (errno != ENOENT && errno != ENOTDIR) error_from_errno (dir->fname); free (dir); return 0; } if (len != 0) dir->fname[len] = 0; /* Ignore a directory whose identity matches the previous one. */ if (prev_file_name && INO_T_EQ (prev_file_name->st.st_ino, dir->st.st_ino) && prev_file_name->st.st_dev == dir->st.st_dev) { /* But treat `-Idir -I- -Idir' as `-I- -Idir'. */ if (!first_bracket_include) first_bracket_include = prev_file_name; free (dir); return 0; } #endif /* ! VMS */ dir->next = 0; dir->c_system_include_path = 0; dir->got_name_map = 0; return dir; } } /* Append a chain of `struct file_name_list's to the end of the main include chain. FIRST is the beginning of the chain to append, and LAST is the end. */ static void append_include_chain (first, last) struct file_name_list *first, *last; { struct file_name_list *dir; if (!first || !last) return; if (include == 0) include = first; else last_include->next = first; if (first_bracket_include == 0) first_bracket_include = first; for (dir = first; ; dir = dir->next) { int len = strlen (dir->fname) + INCLUDE_LEN_FUDGE; if (len > max_include_len) max_include_len = len; if (dir == last) break; } last->next = NULL; last_include = last; } /* Place into DST a representation of the file named SRC that is suitable for `make'. Do not null-terminate DST. Return its length. */ static int quote_string_for_make (dst, src) char *dst; const char *src; { const char *p = src; int i = 0; for (;;) { char c = *p++; switch (c) { case '\0': case ' ': case '\t': { /* GNU make uses a weird quoting scheme for white space. A space or tab preceded by 2N+1 backslashes represents N backslashes followed by space; a space or tab preceded by 2N backslashes represents N backslashes at the end of a file name; and backslashes in other contexts should not be doubled. */ const char *q; for (q = p - 1; src < q && q[-1] == '\\'; q--) { if (dst) dst[i] = '\\'; i++; } } if (!c) return i; if (dst) dst[i] = '\\'; i++; goto ordinary_char; case '$': if (dst) dst[i] = c; i++; /* Fall through. This can mishandle things like "$(" but there's no easy fix. */ default: ordinary_char: /* This can mishandle characters in the string "\0\n%*?[\\~"; exactly which chars are mishandled depends on the `make' version. We know of no portable solution for this; even GNU make 3.76.1 doesn't solve the problem entirely. (Also, '\0' is mishandled due to our calling conventions.) */ if (dst) dst[i] = c; i++; break; } } } /* Add output to `deps_buffer' for the -M switch. STRING points to the text to be output. SPACER is ':' for targets, ' ' for dependencies. */ static void deps_output (string, spacer) const char *string; int spacer; { int size = quote_string_for_make ((char *) 0, string); if (size == 0) return; #ifndef MAX_OUTPUT_COLUMNS #define MAX_OUTPUT_COLUMNS 72 #endif if (MAX_OUTPUT_COLUMNS - 1 /*spacer*/ - 2 /*` \'*/ < deps_column + size && 1 < deps_column) { bcopy (" \\\n ", &deps_buffer[deps_size], 4); deps_size += 4; deps_column = 1; if (spacer == ' ') spacer = 0; } if (deps_size + 2 * size + 8 > deps_allocated_size) { deps_allocated_size = (deps_size + 2 * size + 50) * 2; deps_buffer = xrealloc (deps_buffer, deps_allocated_size); } if (spacer == ' ') { deps_buffer[deps_size++] = ' '; deps_column++; } quote_string_for_make (&deps_buffer[deps_size], string); deps_size += size; deps_column += size; if (spacer == ':') { deps_buffer[deps_size++] = ':'; deps_column++; } deps_buffer[deps_size] = 0; } void fatal VPROTO ((const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES const char * msgid; #endif va_list args; fprintf (stderr, "%s: ", progname); VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, const char *); #endif vnotice (msgid, args); va_end (args); fprintf (stderr, "\n"); exit (FATAL_EXIT_CODE); } /* More 'friendly' abort that prints the line and file. config.h can #define abort fancy_abort if you like that sort of thing. */ void fancy_abort () { fatal ("Internal gcc abort."); } static void perror_with_name (name) char *name; { fprintf (stderr, "%s: %s: %s\n", progname, name, my_strerror (errno)); errors++; } static void pfatal_with_name (name) char *name; { perror_with_name (name); #ifdef VMS exit (vaxc$errno); #else exit (FATAL_EXIT_CODE); #endif } /* Handler for SIGPIPE. */ static void pipe_closed (signo) /* If this is missing, some compilers complain. */ int signo ATTRIBUTE_UNUSED; { fatal ("output pipe has been closed"); } static void memory_full () { fatal ("Memory exhausted."); } PTR xmalloc (size) size_t size; { register PTR ptr = (PTR) malloc (size); if (!ptr) memory_full (); return ptr; } PTR xrealloc (old, size) PTR old; size_t size; { register PTR ptr; if (old) ptr = (PTR) realloc (old, size); else ptr = (PTR) malloc (size); if (!ptr) memory_full (); return ptr; } PTR xcalloc (number, size) size_t number, size; { register size_t total = number * size; register PTR ptr = (PTR) malloc (total); if (!ptr) memory_full (); bzero (ptr, total); return ptr; } char * xstrdup (input) const char *input; { register size_t len = strlen (input) + 1; register char *output = xmalloc (len); memcpy (output, input, len); return output; } #ifdef VMS /* Under VMS we need to fix up the "include" specification filename. Rules for possible conversions fullname tried paths name name ./dir/name [.dir]name /dir/name dir:name /name [000000]name, name dir/name dir:[000000]name, dir:name, dir/name dir1/dir2/name dir1:[dir2]name, dir1:[000000.dir2]name path:/name path:[000000]name, path:name path:/dir/name path:[000000.dir]name, path:[dir]name path:dir/name path:[dir]name [path]:[dir]name [path.dir]name path/[dir]name [path.dir]name The path:/name input is constructed when expanding <> includes. return 1 if name was changed, 0 else. */ static int hack_vms_include_specification (fullname, vaxc_include) char *fullname; int vaxc_include; { register char *basename, *unixname, *local_ptr, *first_slash; int f, check_filename_before_returning, must_revert; char Local[512]; check_filename_before_returning = 0; must_revert = 0; /* See if we can find a 1st slash. If not, there's no path information. */ first_slash = index (fullname, '/'); if (first_slash == 0) return 0; /* Nothing to do!!! */ /* construct device spec if none given. */ if (index (fullname, ':') == 0) { /* If fullname has a slash, take it as device spec. */ if (first_slash == fullname) { first_slash = index (fullname+1, '/'); /* 2nd slash ? */ if (first_slash) *first_slash = ':'; /* make device spec */ for (basename = fullname; *basename != 0; basename++) *basename = *(basename+1); /* remove leading slash */ } else if ((first_slash[-1] != '.') /* keep ':/', './' */ && (first_slash[-1] != ':') && (first_slash[-1] != ']')) /* or a vms path */ { *first_slash = ':'; } else if ((first_slash[1] == '[') /* skip './' in './[dir' */ && (first_slash[-1] == '.')) fullname += 2; } /* Get part after first ':' (basename[-1] == ':') or last '/' (basename[-1] == '/'). */ basename = base_name (fullname); /* * Check if we have a vax-c style '#include filename' * and add the missing .h */ if (vaxc_include && !index (basename,'.')) strcat (basename, ".h"); local_ptr = Local; /* initialize */ /* We are trying to do a number of things here. First of all, we are trying to hammer the filenames into a standard format, such that later processing can handle them. If the file name contains something like [dir.], then it recognizes this as a root, and strips the ".]". Later processing will add whatever is needed to get things working properly. If no device is specified, then the first directory name is taken to be a device name (or a rooted logical). */ /* Point to the UNIX filename part (which needs to be fixed!) but skip vms path information. [basename != fullname since first_slash != 0]. */ if ((basename[-1] == ':') /* vms path spec. */ || (basename[-1] == ']') || (basename[-1] == '>')) unixname = basename; else unixname = fullname; if (*unixname == '/') unixname++; /* If the directory spec is not rooted, we can just copy the UNIX filename part and we are done. */ if (((basename - fullname) > 1) && ( (basename[-1] == ']') || (basename[-1] == '>'))) { if (basename[-2] != '.') { /* The VMS part ends in a `]', and the preceding character is not a `.'. -> PATH]:/name (basename = '/name', unixname = 'name') We strip the `]', and then splice the two parts of the name in the usual way. Given the default locations for include files in cccp.c, we will only use this code if the user specifies alternate locations with the /include (-I) switch on the command line. */ basename -= 1; /* Strip "]" */ unixname--; /* backspace */ } else { /* The VMS part has a ".]" at the end, and this will not do. Later processing will add a second directory spec, and this would be a syntax error. Thus we strip the ".]", and thus merge the directory specs. We also backspace unixname, so that it points to a '/'. This inhibits the generation of the 000000 root directory spec (which does not belong here in this case). */ basename -= 2; /* Strip ".]" */ unixname--; /* backspace */ } } else { /* We drop in here if there is no VMS style directory specification yet. If there is no device specification either, we make the first dir a device and try that. If we do not do this, then we will be essentially searching the users default directory (as if they did a #include "asdf.h"). Then all we need to do is to push a '[' into the output string. Later processing will fill this in, and close the bracket. */ if ((unixname != fullname) /* vms path spec found. */ && (basename[-1] != ':')) *local_ptr++ = ':'; /* dev not in spec. take first dir */ *local_ptr++ = '['; /* Open the directory specification */ } if (unixname == fullname) /* no vms dir spec. */ { must_revert = 1; if ((first_slash != 0) /* unix dir spec. */ && (*unixname != '/') /* not beginning with '/' */ && (*unixname != '.')) /* or './' or '../' */ *local_ptr++ = '.'; /* dir is local ! */ } /* at this point we assume that we have the device spec, and (at least the opening "[" for a directory specification. We may have directories specified already. If there are no other slashes then the filename will be in the "root" directory. Otherwise, we need to add directory specifications. */ if (index (unixname, '/') == 0) { /* if no directories specified yet and none are following. */ if (local_ptr[-1] == '[') { /* Just add "000000]" as the directory string */ strcpy (local_ptr, "000000]"); local_ptr += strlen (local_ptr); check_filename_before_returning = 1; /* we might need to fool with this later */ } } else { /* As long as there are still subdirectories to add, do them. */ while (index (unixname, '/') != 0) { /* If this token is "." we can ignore it if it's not at the beginning of a path. */ if ((unixname[0] == '.') && (unixname[1] == '/')) { /* remove it at beginning of path. */ if ( ((unixname == fullname) /* no device spec */ && (fullname+2 != basename)) /* starts with ./ */ /* or */ || ((basename[-1] == ':') /* device spec */ && (unixname-1 == basename))) /* and ./ afterwards */ *local_ptr++ = '.'; /* make '[.' start of path. */ unixname += 2; continue; } /* Add a subdirectory spec. Do not duplicate "." */ if ( local_ptr[-1] != '.' && local_ptr[-1] != '[' && local_ptr[-1] != '<') *local_ptr++ = '.'; /* If this is ".." then the spec becomes "-" */ if ( (unixname[0] == '.') && (unixname[1] == '.') && (unixname[2] == '/')) { /* Add "-" and skip the ".." */ if ((local_ptr[-1] == '.') && (local_ptr[-2] == '[')) local_ptr--; /* prevent [.- */ *local_ptr++ = '-'; unixname += 3; continue; } /* Copy the subdirectory */ while (*unixname != '/') *local_ptr++= *unixname++; unixname++; /* Skip the "/" */ } /* Close the directory specification */ if (local_ptr[-1] == '.') /* no trailing periods */ local_ptr--; if (local_ptr[-1] == '[') /* no dir needed */ local_ptr--; else *local_ptr++ = ']'; } /* Now add the filename. */ while (*unixname) *local_ptr++ = *unixname++; *local_ptr = 0; /* Now append it to the original VMS spec. */ strcpy ((must_revert==1)?fullname:basename, Local); /* If we put a [000000] in the filename, try to open it first. If this fails, remove the [000000], and return that name. This provides flexibility to the user in that they can use both rooted and non-rooted logical names to point to the location of the file. */ if (check_filename_before_returning) { f = open (fullname, O_RDONLY, 0666); if (f >= 0) { /* The file name is OK as it is, so return it as is. */ close (f); return 1; } /* The filename did not work. Try to remove the [000000] from the name, and return it. */ basename = index (fullname, '['); local_ptr = index (fullname, ']') + 1; strcpy (basename, local_ptr); /* this gets rid of it */ } return 1; } #endif /* VMS */ #ifdef VMS /* The following wrapper functions supply additional arguments to the VMS I/O routines to optimize performance with file handling. The arguments are: "mbc=16" - Set multi-block count to 16 (use a 8192 byte buffer). "deq=64" - When extending the file, extend it in chunks of 32Kbytes. "fop=tef"- Truncate unused portions of file when closing file. "shr=nil"- Disallow file sharing while file is open. */ static FILE * VMS_freopen (fname, type, oldfile) char *fname; char *type; FILE *oldfile; { #undef freopen /* Get back the real freopen routine. */ if (strcmp (type, "w") == 0) return freopen (fname, type, oldfile, "mbc=16", "deq=64", "fop=tef", "shr=nil"); return freopen (fname, type, oldfile, "mbc=16"); } static FILE * VMS_fopen (fname, type) char *fname; char *type; { #undef fopen /* Get back the real fopen routine. */ /* The gcc-vms-1.42 distribution's header files prototype fopen with two fixed arguments, which matches ANSI's specification but not VAXCRTL's pre-ANSI implementation. This hack circumvents the mismatch problem. */ FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen; if (*type == 'w') return (*vmslib_fopen) (fname, type, "mbc=32", "deq=64", "fop=tef", "shr=nil"); else return (*vmslib_fopen) (fname, type, "mbc=32"); } static int VMS_open (fname, flags, prot) char *fname; int flags; int prot; { #undef open /* Get back the real open routine. */ return open (fname, flags, prot, "mbc=16", "deq=64", "fop=tef"); } /* more VMS hackery */ #include #include extern unsigned long SYS$PARSE(), SYS$SEARCH(); /* Work around another library bug. If a file is located via a searchlist, and if the device it's on is not the same device as the one specified in the first element of that searchlist, then both stat() and fstat() will fail to return info about it. `errno' will be set to EVMSERR, and `vaxc$errno' will be set to SS$_NORMAL due yet another bug in stat()! We can get around this by fully parsing the filename and then passing that absolute name to stat(). Without this fix, we can end up failing to find header files, which is bad enough, but then compounding the problem by reporting the reason for failure as "normal successful completion." */ #undef fstat /* Get back to the library version. */ static int VMS_fstat (fd, statbuf) int fd; struct stat *statbuf; { int result = fstat (fd, statbuf); if (result < 0) { FILE *fp; char nambuf[NAM$C_MAXRSS+1]; if ((fp = fdopen (fd, "r")) != 0 && fgetname (fp, nambuf) != 0) result = VMS_stat (nambuf, statbuf); /* No fclose(fp) here; that would close(fd) as well. */ } return result; } static int VMS_stat (name, statbuf) const char *name; struct stat *statbuf; { int result = stat (name, statbuf); if (result < 0) { struct FAB fab; struct NAM nam; char exp_nam[NAM$C_MAXRSS+1], /* expanded name buffer for SYS$PARSE */ res_nam[NAM$C_MAXRSS+1]; /* resultant name buffer for SYS$SEARCH */ fab = cc$rms_fab; fab.fab$l_fna = (char *) name; fab.fab$b_fns = (unsigned char) strlen (name); fab.fab$l_nam = (void *) &nam; nam = cc$rms_nam; nam.nam$l_esa = exp_nam, nam.nam$b_ess = sizeof exp_nam - 1; nam.nam$l_rsa = res_nam, nam.nam$b_rss = sizeof res_nam - 1; nam.nam$b_nop = NAM$M_PWD | NAM$M_NOCONCEAL; if (SYS$PARSE (&fab) & 1) { if (SYS$SEARCH (&fab) & 1) { res_nam[nam.nam$b_rsl] = '\0'; result = stat (res_nam, statbuf); } /* Clean up searchlist context cached by the system. */ nam.nam$b_nop = NAM$M_SYNCHK; fab.fab$l_fna = 0, fab.fab$b_fns = 0; (void) SYS$PARSE (&fab); } } return result; } #endif /* VMS */ cxref-1.6d/cpp/cccp.c.diff 644 233 144 21264 11506070537 10601 0Index: cccp.c =================================================================== --- cccp.c (revision 533) +++ cccp.c (revision 590) @@ -4,6 +4,10 @@ Written by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 +Modfied for use as cxref-cpp by Andrew M. Bishop 2004. +Changes marked with 'AMB' in the code. + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any @@ -373,6 +377,9 @@ char fname[1]; }; +#define GCC_INCLUDE_DIR "." /* Not used - AMB */ +#define INCLUDE_DEFAULTS { { 0, 0, 0, 0, 0 } } /* No built-in include dirs - AMB */ + /* #include "file" looks in source file dir, then stack. */ /* #include just looks in the stack. */ /* -I directories are added to the end, then the defaults are added. */ @@ -457,6 +464,9 @@ include file directories. */ static char *include_prefix; +/* File to include that contains the gcc definitions for cxref-cpp - AMB */ +static char *cxref_cpp_defines=CXREF_CPP_DEFINES; + /* Maintain and search list of included files. */ struct include_file { @@ -1024,7 +1034,8 @@ retrying if necessary. If MAX_READ_LEN is defined, read at most that bytes at a time. Return a negative value if an error occurs, otherwise return the actual number of bytes read, - which must be LEN unless end-of-file was reached. */ + which may be < LEN if CRs have been skipped, though we try not to do + that. */ static int safe_read (desc, ptr, len) @@ -1033,6 +1044,7 @@ int len; { int left, rcount, nchars; + char *rptr; left = len; while (left > 0) { @@ -1052,8 +1064,20 @@ } if (nchars == 0) break; - ptr += nchars; + + /* CRLF pairs, found with Unix when processing DOS files, + throw off backslash-newline removal. + Therefore, CRs are thrown away here. */ left -= nchars; + rptr = ptr; + while(nchars--) + { + if(*rptr == '\r' && *(rptr+1) == '\n') + left++; + else + *ptr++ = *rptr; + rptr++; + } } return len - left; } @@ -1707,6 +1731,17 @@ } break; +/* Option for runtime cxref-cpp configuration file - AMB */ + case 'c': + if (!strcmp (argv[i], "-cxref-cpp-defines")) { + if (i + 1 == argc) + fatal ("Filename missing after `-cxref-cpp-defines' option"); + else + cxref_cpp_defines = argv[i+1], i++; + } + break; +/* Option for runtime cxref-cpp configuration file - AMB */ + case 'n': if (!strcmp (argv[i], "-nostdinc")) /* -nostdinc causes no default include directories. @@ -1774,6 +1809,83 @@ and option processing. */ initialize_builtins (fp, &outbuf); + /* Start of setup for the cxref paths and definitions from runtime config - AMB */ + + { + int fd; + struct stat sbuf; + char *buf,*p; + struct include_file *inc; + + if(stat(cxref_cpp_defines,&sbuf)<0) + {perror_with_name(cxref_cpp_defines); exit(FATAL_EXIT_CODE);} + + if(!S_ISREG(sbuf.st_mode)) + {perror_with_name(cxref_cpp_defines); exit(FATAL_EXIT_CODE);} + + fd=open_include_file(cxref_cpp_defines, NULL_PTR, NULL_PTR, &inc); + if(fd==-1) + {perror_with_name(cxref_cpp_defines); exit(FATAL_EXIT_CODE);} + + buf=(char *)xmalloc(sbuf.st_size+2); /* AMB - remove gcc-4.0 warning */ + + if(safe_read(fd,buf,sbuf.st_size)<0) + {perror_with_name(cxref_cpp_defines); exit(FATAL_EXIT_CODE);} + + p=buf; + + while(!strncmp(p,"//",2)) + { + char *oldp=p; + + while(*p && (*p!='\r' && *p!='\n')) p++; + while(*p && (*p=='\r' || *p=='\n')) *p++=0; + + if(!strncmp(oldp,"// -",4) && *(oldp+=4)) + switch(*oldp) + { + case 'A': + make_assertion("-A",oldp+1); + break; + + case 'D': + make_definition(oldp+1); + break; + + case 'I': /* treat like -isystem */ + { + struct file_name_list *dirtmp; + + dirtmp = new_include_prefix(NULL_PTR,NULL_PTR,"",oldp+1); + if(!dirtmp) + fatal ("File %s specifies invalid -I path",cxref_cpp_defines); + + dirtmp->c_system_include_path = 1; + + if (before_system == 0) + before_system = dirtmp; + else + last_before_system->next = dirtmp; + last_before_system = dirtmp; /* Tail follows the last one */ + } + break; + + default: + ; + } + } + + free(buf); + + lseek(fd,0,SEEK_SET); + + no_output++; no_record_file++; + finclude(fd,inc,&outbuf,0,NULL_PTR); + no_output--; no_record_file--; + } + + /* End of setup for the cxref paths and definitions from runtime config - AMB */ + /* Now handle the command line options. */ /* Do -U's, -D's and -A's in the order they were seen. */ @@ -2086,8 +2198,8 @@ for (;;) { cnt = safe_read (f, (char *) fp->buf + size, bsize - size); if (cnt < 0) goto perror; /* error! */ + if (cnt == 0) break; /* End of file */ size += cnt; - if (size != bsize) break; /* End of file */ bsize *= 2; fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2); } @@ -2421,6 +2533,7 @@ register U_CHAR *numptr; /* temp for arg parsing */ *arglen = 0; + *argstart=NULL; /* AMB - remove gcc-4.0 warning */ SKIP_WHITE_SPACE (ibp); @@ -5027,6 +5140,8 @@ map_list_ptr->map_list_map = ptr; while ((ch = getc (f)) != '\n') + if (ch == '\r') + continue; if (ch == EOF) break; } @@ -5259,9 +5374,9 @@ i = safe_read (f, (char *) fp->buf + st_size, bsize - st_size); if (i < 0) goto nope; /* error! */ + if (i == 0) + break; /* End of file */ st_size += i; - if (st_size != bsize) - break; /* End of file */ bsize *= 2; fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2); } @@ -5881,6 +5996,8 @@ return mdef; nope: + mdef.symnam = NULL; /* AMB - remove gcc-4.0 warning */ + mdef.symlen = 0; /* AMB - remove gcc-4.0 warning */ mdef.defn = 0; return mdef; } @@ -10102,6 +10219,7 @@ install ((U_CHAR *) "__FILE__", -1, T_FILE, NULL_PTR, -1); install ((U_CHAR *) "__BASE_FILE__", -1, T_BASE_FILE, NULL_PTR, -1); install ((U_CHAR *) "__INCLUDE_LEVEL__", -1, T_INCLUDE_LEVEL, NULL_PTR, -1); + /* Don't setup the standard #defines - AMB install ((U_CHAR *) "__VERSION__", -1, T_VERSION, NULL_PTR, -1); #ifndef NO_BUILTIN_SIZE_TYPE install ((U_CHAR *) "__SIZE_TYPE__", -1, T_SIZE_TYPE, NULL_PTR, -1); @@ -10116,6 +10234,7 @@ NULL_PTR, -1); install ((U_CHAR *) "__IMMEDIATE_PREFIX__", -1, T_IMMEDIATE_PREFIX_TYPE, NULL_PTR, -1); + */ install ((U_CHAR *) "__TIME__", -1, T_TIME, NULL_PTR, -1); if (!traditional) { install ((U_CHAR *) "__STDC__", -1, T_CONST, "1", -1); @@ -10124,7 +10243,9 @@ /* This is supplied using a -D by the compiler driver so that it is present only when truly compiling with GNU C. */ /* install ((U_CHAR *) "__GNUC__", -1, T_CONST, "2", -1); */ + /* Don't setup the standard #defines - AMB install ((U_CHAR *) "__HAVE_BUILTIN_SETJMP__", -1, T_CONST, "1", -1); + */ if (debug_output) { @@ -10139,6 +10260,7 @@ pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); + /* Don't setup the standard #defines - AMB sprintf (directive, " __VERSION__ \"%s\"\n", version_string); output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], @@ -10162,6 +10284,7 @@ output_line_directive (inp, outp, 0, same_file); pass_thru_directive (udirective, &udirective[strlen (directive)], outp, dp); + */ sprintf (directive, " __DATE__ \"%s %2d %4d\"\n", monthnames[timebuf->tm_mon], @@ -10324,7 +10447,7 @@ U_CHAR *buf, *p, *q; /* Copy the entire option so we can modify it. */ - buf = (U_CHAR *) alloca (strlen (str) + 1); + buf = (U_CHAR *) alloca (strlen (str) + 2); /* Change to handle gcc 3.x "-Afoo=bar" - AMB */ strcpy ((char *) buf, str); /* Scan for any backslash-newline and remove it. */ p = q = buf; @@ -10344,10 +10467,18 @@ while (is_idchar[*++p]) ; SKIP_WHITE_SPACE (p); - if (! (*p == 0 || *p == '(')) { + if (! (*p == 0 || *p == '(' || *p == '=')) { /* Change to handle gcc 3.x "-Afoo=bar" - AMB */ error ("malformed option `%s %s'", option, str); return; } + +/* Start change to handle gcc 3.x "-Afoo=bar" - AMB */ + if(*p=='=') + { + *p='('; + strcat((char*)p,")"); + } +/* End change to handle gcc 3.x "-Afoo=bar" - AMB */ ip = &instack[++indepth]; ip->nominal_fname = ip->fname = "*Initialization*"; cxref-1.6d/cpp/cexp.c 644 233 144 232322 11506067140 7734 0 /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ #include "config.h" #include "system.h" #include "intl.h" #include /* #define YYDEBUG 1 */ #ifdef MULTIBYTE_CHARS #include "mbchar.h" #include #endif /* MULTIBYTE_CHARS */ typedef unsigned char U_CHAR; /* This is used for communicating lists of keywords with cccp.c. */ struct arglist { struct arglist *next; U_CHAR *name; int length; int argno; }; HOST_WIDEST_INT parse_c_expression PROTO((char *, int)); static int yylex PROTO((void)); static void yyerror PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; static HOST_WIDEST_INT expression_value; #ifdef TEST_EXP_READER static int expression_signedp; #endif static jmp_buf parse_return_error; /* Nonzero means count most punctuation as part of a name. */ static int keyword_parsing = 0; /* Nonzero means do not evaluate this expression. This is a count, since unevaluated expressions can nest. */ static int skip_evaluation; /* Nonzero means warn if undefined identifiers are evaluated. */ static int warn_undef; /* some external tables of character types */ extern unsigned char is_idstart[], is_idchar[], is_space[]; /* Flag for -pedantic. */ extern int pedantic; /* Flag for -traditional. */ extern int traditional; /* Flag for -lang-c89. */ extern int c89; #ifndef CHAR_TYPE_SIZE #define CHAR_TYPE_SIZE BITS_PER_UNIT #endif #ifndef INT_TYPE_SIZE #define INT_TYPE_SIZE BITS_PER_WORD #endif #ifndef LONG_TYPE_SIZE #define LONG_TYPE_SIZE BITS_PER_WORD #endif #ifndef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE INT_TYPE_SIZE #endif #ifndef MAX_CHAR_TYPE_SIZE #define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE #endif #ifndef MAX_INT_TYPE_SIZE #define MAX_INT_TYPE_SIZE INT_TYPE_SIZE #endif #ifndef MAX_LONG_TYPE_SIZE #define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE #endif #ifndef MAX_WCHAR_TYPE_SIZE #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE #endif #define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \ ? (~ (~ (HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \ : ~ (HOST_WIDEST_INT) 0) #define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \ ? ~ (~ (HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \ : ~ (HOST_WIDEST_INT) 0) /* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow. Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1. Suppose SIGNEDP is negative if the result is signed, zero if unsigned. Then this yields nonzero if overflow occurred during the addition. Overflow occurs if A and B have the same sign, but A and SUM differ in sign, and SIGNEDP is negative. Use `^' to test whether signs differ, and `< 0' to isolate the sign. */ #define overflow_sum_sign(a, b, sum, signedp) \ ((~((a) ^ (b)) & ((a) ^ (sum)) & (signedp)) < 0) struct constant; HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT)); int check_assertion PROTO((U_CHAR *, int, int, struct arglist *)); struct hashnode *lookup PROTO((U_CHAR *, int, int)); void error PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; void verror PROTO((const char *, va_list)); void pedwarn PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; void warning PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; static int parse_number PROTO((int)); static HOST_WIDEST_INT left_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT)); static HOST_WIDEST_INT right_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT)); static void integer_overflow PROTO((void)); /* `signedp' values */ #define SIGNED (~0) #define UNSIGNED 0 /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { INT = 258, CHAR = 259, NAME = 260, ERROR = 261, OR = 262, AND = 263, NOTEQUAL = 264, EQUAL = 265, GEQ = 266, LEQ = 267, RSH = 268, LSH = 269, UNARY = 270 }; #endif /* Tokens. */ #define INT 258 #define CHAR 259 #define NAME 260 #define ERROR 261 #define OR 262 #define AND 263 #define NOTEQUAL 264 #define EQUAL 265 #define GEQ 266 #define LEQ 267 #define RSH 268 #define LSH 269 #define UNARY 270 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { struct constant {HOST_WIDEST_INT value; int signedp;} integer; struct name {U_CHAR *address; int length;} name; struct arglist *keywords; } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif /* Copy the second part of user declarations. */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 19 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 190 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 34 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 10 /* YYNRULES -- Number of rules. */ #define YYNRULES 41 /* YYNRULES -- Number of states. */ #define YYNSTATES 77 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 270 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 29, 2, 31, 2, 27, 14, 2, 32, 33, 25, 23, 9, 24, 2, 26, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8, 2, 17, 2, 18, 7, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, 30, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 10, 11, 15, 16, 19, 20, 21, 22, 28 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 7, 11, 14, 17, 20, 23, 26, 27, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98, 102, 103, 108, 109, 114, 115, 116, 124, 126, 128, 130, 131, 136 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 35, 0, -1, 36, -1, 37, -1, 36, 9, 37, -1, 24, 37, -1, 29, 37, -1, 23, 37, -1, 30, 37, -1, 31, 5, -1, -1, 31, 5, 38, 32, 43, 33, -1, 32, 36, 33, -1, 37, 25, 37, -1, 37, 26, 37, -1, 37, 27, 37, -1, 37, 23, 37, -1, 37, 24, 37, -1, 37, 22, 37, -1, 37, 21, 37, -1, 37, 16, 37, -1, 37, 15, 37, -1, 37, 20, 37, -1, 37, 19, 37, -1, 37, 17, 37, -1, 37, 18, 37, -1, 37, 14, 37, -1, 37, 13, 37, -1, 37, 12, 37, -1, -1, 37, 11, 39, 37, -1, -1, 37, 10, 40, 37, -1, -1, -1, 37, 7, 41, 37, 8, 42, 37, -1, 3, -1, 4, -1, 5, -1, -1, 32, 43, 33, 43, -1, 5, 43, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 184, 184, 194, 195, 202, 207, 210, 212, 215, 220, 219, 226, 231, 244, 261, 274, 280, 286, 292, 298, 301, 304, 311, 318, 325, 332, 335, 338, 342, 341, 348, 347, 354, 356, 353, 361, 363, 365, 374, 375, 388 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "INT", "CHAR", "NAME", "ERROR", "'?'", "':'", "','", "OR", "AND", "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ", "RSH", "LSH", "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY", "'!'", "'~'", "'#'", "'('", "')'", "$accept", "start", "exp1", "exp", "$@1", "$@2", "$@3", "$@4", "$@5", "keywords", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 63, 58, 44, 262, 263, 124, 94, 38, 264, 265, 60, 62, 266, 267, 268, 269, 43, 45, 42, 47, 37, 270, 33, 126, 35, 40, 41 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 34, 35, 36, 36, 37, 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 39, 37, 40, 37, 41, 42, 37, 37, 37, 37, 43, 43, 43 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 3, 2, 2, 2, 2, 2, 0, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 4, 0, 4, 0, 0, 7, 1, 1, 1, 0, 4, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 36, 37, 38, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7, 5, 6, 8, 9, 0, 1, 0, 33, 31, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 4, 0, 0, 0, 28, 27, 26, 21, 20, 24, 25, 23, 22, 19, 18, 16, 17, 13, 14, 15, 39, 0, 32, 30, 39, 39, 0, 34, 41, 0, 11, 0, 39, 35, 40 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 10, 11, 12, 40, 45, 44, 43, 73, 68 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -63 static const yytype_int16 yypact[] = { 14, -63, -63, -63, 14, 14, 14, 14, 5, 14, 11, 6, 81, -63, -63, -63, -63, -18, 33, -63, 14, -63, -63, -63, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 32, -63, 81, 14, 14, 14, 112, 126, 139, 150, 150, 157, 157, 157, 157, 162, 162, -19, -19, -63, -63, -63, 4, 60, 36, 97, 4, 4, -20, -63, -63, 56, -63, 14, 4, 81, -63 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -63, -63, 181, -4, -63, -63, -63, -63, -63, -62 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -11 static const yytype_int8 yytable[] = { 13, 14, 15, 16, 70, 71, 37, 38, 39, 66, 17, 19, 76, 72, -10, 20, 42, 1, 2, 3, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 67, 4, 5, 63, 64, 65, 20, 6, 7, 8, 9, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 62, 0, 41, 21, 69, 75, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 21, 74, 0, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 33, 34, 35, 36, 37, 38, 39, 35, 36, 37, 38, 39, 18 }; static const yytype_int8 yycheck[] = { 4, 5, 6, 7, 66, 67, 25, 26, 27, 5, 5, 0, 74, 33, 32, 9, 20, 3, 4, 5, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 32, 23, 24, 43, 44, 45, 9, 29, 30, 31, 32, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 32, -1, 33, 7, 8, 73, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 7, 33, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 21, 22, 23, 24, 25, 26, 27, 23, 24, 25, 26, 27, 9 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 23, 24, 29, 30, 31, 32, 35, 36, 37, 37, 37, 37, 37, 5, 36, 0, 9, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 38, 33, 37, 41, 40, 39, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 32, 37, 37, 37, 5, 32, 43, 8, 43, 43, 33, 42, 33, 37, 43 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*-------------------------. | yyparse or yypush_parse. | `-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: { expression_value = (yyvsp[(1) - (1)].integer).value; #ifdef TEST_EXP_READER expression_signedp = (yyvsp[(1) - (1)].integer).signedp; #endif } break; case 4: { if (pedantic) pedwarn ("comma operator in operand of `#if'"); (yyval.integer) = (yyvsp[(3) - (3)].integer); } break; case 5: { (yyval.integer).value = - (yyvsp[(2) - (2)].integer).value; (yyval.integer).signedp = (yyvsp[(2) - (2)].integer).signedp; if (((yyval.integer).value & (yyvsp[(2) - (2)].integer).value & (yyval.integer).signedp) < 0) integer_overflow (); } break; case 6: { (yyval.integer).value = ! (yyvsp[(2) - (2)].integer).value; (yyval.integer).signedp = SIGNED; } break; case 7: { (yyval.integer) = (yyvsp[(2) - (2)].integer); } break; case 8: { (yyval.integer).value = ~ (yyvsp[(2) - (2)].integer).value; (yyval.integer).signedp = (yyvsp[(2) - (2)].integer).signedp; } break; case 9: { (yyval.integer).value = check_assertion ((yyvsp[(2) - (2)].name).address, (yyvsp[(2) - (2)].name).length, 0, NULL_PTR); (yyval.integer).signedp = SIGNED; } break; case 10: { keyword_parsing = 1; } break; case 11: { (yyval.integer).value = check_assertion ((yyvsp[(2) - (6)].name).address, (yyvsp[(2) - (6)].name).length, 1, (yyvsp[(5) - (6)].keywords)); keyword_parsing = 0; (yyval.integer).signedp = SIGNED; } break; case 12: { (yyval.integer) = (yyvsp[(2) - (3)].integer); } break; case 13: { (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp; if ((yyval.integer).signedp) { (yyval.integer).value = (yyvsp[(1) - (3)].integer).value * (yyvsp[(3) - (3)].integer).value; if ((yyvsp[(1) - (3)].integer).value && ((yyval.integer).value / (yyvsp[(1) - (3)].integer).value != (yyvsp[(3) - (3)].integer).value || ((yyval.integer).value & (yyvsp[(1) - (3)].integer).value & (yyvsp[(3) - (3)].integer).value) < 0)) integer_overflow (); } else (yyval.integer).value = ((unsigned HOST_WIDEST_INT) (yyvsp[(1) - (3)].integer).value * (yyvsp[(3) - (3)].integer).value); } break; case 14: { if ((yyvsp[(3) - (3)].integer).value == 0) { if (!skip_evaluation) error ("division by zero in #if"); (yyvsp[(3) - (3)].integer).value = 1; } (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp; if ((yyval.integer).signedp) { (yyval.integer).value = (yyvsp[(1) - (3)].integer).value / (yyvsp[(3) - (3)].integer).value; if (((yyval.integer).value & (yyvsp[(1) - (3)].integer).value & (yyvsp[(3) - (3)].integer).value) < 0) integer_overflow (); } else (yyval.integer).value = ((unsigned HOST_WIDEST_INT) (yyvsp[(1) - (3)].integer).value / (yyvsp[(3) - (3)].integer).value); } break; case 15: { if ((yyvsp[(3) - (3)].integer).value == 0) { if (!skip_evaluation) error ("division by zero in #if"); (yyvsp[(3) - (3)].integer).value = 1; } (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp; if ((yyval.integer).signedp) (yyval.integer).value = (yyvsp[(1) - (3)].integer).value % (yyvsp[(3) - (3)].integer).value; else (yyval.integer).value = ((unsigned HOST_WIDEST_INT) (yyvsp[(1) - (3)].integer).value % (yyvsp[(3) - (3)].integer).value); } break; case 16: { (yyval.integer).value = (yyvsp[(1) - (3)].integer).value + (yyvsp[(3) - (3)].integer).value; (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp; if (overflow_sum_sign ((yyvsp[(1) - (3)].integer).value, (yyvsp[(3) - (3)].integer).value, (yyval.integer).value, (yyval.integer).signedp)) integer_overflow (); } break; case 17: { (yyval.integer).value = (yyvsp[(1) - (3)].integer).value - (yyvsp[(3) - (3)].integer).value; (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp; if (overflow_sum_sign ((yyval.integer).value, (yyvsp[(3) - (3)].integer).value, (yyvsp[(1) - (3)].integer).value, (yyval.integer).signedp)) integer_overflow (); } break; case 18: { (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp; if (((yyvsp[(3) - (3)].integer).value & (yyvsp[(3) - (3)].integer).signedp) < 0) (yyval.integer).value = right_shift (&(yyvsp[(1) - (3)].integer), -(yyvsp[(3) - (3)].integer).value); else (yyval.integer).value = left_shift (&(yyvsp[(1) - (3)].integer), (yyvsp[(3) - (3)].integer).value); } break; case 19: { (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp; if (((yyvsp[(3) - (3)].integer).value & (yyvsp[(3) - (3)].integer).signedp) < 0) (yyval.integer).value = left_shift (&(yyvsp[(1) - (3)].integer), -(yyvsp[(3) - (3)].integer).value); else (yyval.integer).value = right_shift (&(yyvsp[(1) - (3)].integer), (yyvsp[(3) - (3)].integer).value); } break; case 20: { (yyval.integer).value = ((yyvsp[(1) - (3)].integer).value == (yyvsp[(3) - (3)].integer).value); (yyval.integer).signedp = SIGNED; } break; case 21: { (yyval.integer).value = ((yyvsp[(1) - (3)].integer).value != (yyvsp[(3) - (3)].integer).value); (yyval.integer).signedp = SIGNED; } break; case 22: { (yyval.integer).signedp = SIGNED; if ((yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp) (yyval.integer).value = (yyvsp[(1) - (3)].integer).value <= (yyvsp[(3) - (3)].integer).value; else (yyval.integer).value = ((unsigned HOST_WIDEST_INT) (yyvsp[(1) - (3)].integer).value <= (yyvsp[(3) - (3)].integer).value); } break; case 23: { (yyval.integer).signedp = SIGNED; if ((yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp) (yyval.integer).value = (yyvsp[(1) - (3)].integer).value >= (yyvsp[(3) - (3)].integer).value; else (yyval.integer).value = ((unsigned HOST_WIDEST_INT) (yyvsp[(1) - (3)].integer).value >= (yyvsp[(3) - (3)].integer).value); } break; case 24: { (yyval.integer).signedp = SIGNED; if ((yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp) (yyval.integer).value = (yyvsp[(1) - (3)].integer).value < (yyvsp[(3) - (3)].integer).value; else (yyval.integer).value = ((unsigned HOST_WIDEST_INT) (yyvsp[(1) - (3)].integer).value < (yyvsp[(3) - (3)].integer).value); } break; case 25: { (yyval.integer).signedp = SIGNED; if ((yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp) (yyval.integer).value = (yyvsp[(1) - (3)].integer).value > (yyvsp[(3) - (3)].integer).value; else (yyval.integer).value = ((unsigned HOST_WIDEST_INT) (yyvsp[(1) - (3)].integer).value > (yyvsp[(3) - (3)].integer).value); } break; case 26: { (yyval.integer).value = (yyvsp[(1) - (3)].integer).value & (yyvsp[(3) - (3)].integer).value; (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp; } break; case 27: { (yyval.integer).value = (yyvsp[(1) - (3)].integer).value ^ (yyvsp[(3) - (3)].integer).value; (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp; } break; case 28: { (yyval.integer).value = (yyvsp[(1) - (3)].integer).value | (yyvsp[(3) - (3)].integer).value; (yyval.integer).signedp = (yyvsp[(1) - (3)].integer).signedp & (yyvsp[(3) - (3)].integer).signedp; } break; case 29: { skip_evaluation += !(yyvsp[(1) - (2)].integer).value; } break; case 30: { skip_evaluation -= !(yyvsp[(1) - (4)].integer).value; (yyval.integer).value = ((yyvsp[(1) - (4)].integer).value && (yyvsp[(4) - (4)].integer).value); (yyval.integer).signedp = SIGNED; } break; case 31: { skip_evaluation += !!(yyvsp[(1) - (2)].integer).value; } break; case 32: { skip_evaluation -= !!(yyvsp[(1) - (4)].integer).value; (yyval.integer).value = ((yyvsp[(1) - (4)].integer).value || (yyvsp[(4) - (4)].integer).value); (yyval.integer).signedp = SIGNED; } break; case 33: { skip_evaluation += !(yyvsp[(1) - (2)].integer).value; } break; case 34: { skip_evaluation += !!(yyvsp[(1) - (5)].integer).value - !(yyvsp[(1) - (5)].integer).value; } break; case 35: { skip_evaluation -= !!(yyvsp[(1) - (7)].integer).value; (yyval.integer).value = (yyvsp[(1) - (7)].integer).value ? (yyvsp[(4) - (7)].integer).value : (yyvsp[(7) - (7)].integer).value; (yyval.integer).signedp = (yyvsp[(4) - (7)].integer).signedp & (yyvsp[(7) - (7)].integer).signedp; } break; case 36: { (yyval.integer) = yylval.integer; } break; case 37: { (yyval.integer) = yylval.integer; } break; case 38: { if (warn_undef && !skip_evaluation) warning ("`%.*s' is not defined", (yyvsp[(1) - (1)].name).length, (yyvsp[(1) - (1)].name).address); (yyval.integer).value = 0; (yyval.integer).signedp = SIGNED; } break; case 39: { (yyval.keywords) = 0; } break; case 40: { struct arglist *temp; (yyval.keywords) = (struct arglist *) xmalloc (sizeof (struct arglist)); (yyval.keywords)->next = (yyvsp[(2) - (4)].keywords); (yyval.keywords)->name = (U_CHAR *) "("; (yyval.keywords)->length = 1; temp = (yyval.keywords); while (temp != 0 && temp->next != 0) temp = temp->next; temp->next = (struct arglist *) xmalloc (sizeof (struct arglist)); temp->next->next = (yyvsp[(4) - (4)].keywords); temp->next->name = (U_CHAR *) ")"; temp->next->length = 1; } break; case 41: { (yyval.keywords) = (struct arglist *) xmalloc (sizeof (struct arglist)); (yyval.keywords)->name = (yyvsp[(1) - (2)].name).address; (yyval.keywords)->length = (yyvsp[(1) - (2)].name).length; (yyval.keywords)->next = (yyvsp[(2) - (2)].keywords); } break; default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* During parsing of a C expression, the pointer to the next character is in this variable. */ static char *lexptr; /* Take care of parsing a number (anything that starts with a digit). Set yylval and return the token type; update lexptr. LEN is the number of characters in it. */ /* maybe needs to actually deal with floating point numbers */ static int parse_number (olen) int olen; { register char *p = lexptr; register int c; register unsigned HOST_WIDEST_INT n = 0, nd, max_over_base; register int base = 10; register int len = olen; register int overflow = 0; register int digit, largest_digit = 0; int spec_long = 0; yylval.integer.signedp = SIGNED; if (*p == '0') { base = 8; if (len >= 3 && (p[1] == 'x' || p[1] == 'X')) { p += 2; base = 16; len -= 2; } } max_over_base = (unsigned HOST_WIDEST_INT) -1 / base; for (; len > 0; len--) { c = *p++; if (c >= '0' && c <= '9') digit = c - '0'; else if (base == 16 && c >= 'a' && c <= 'f') digit = c - 'a' + 10; else if (base == 16 && c >= 'A' && c <= 'F') digit = c - 'A' + 10; else { /* `l' means long, and `u' means unsigned. */ while (1) { if (c == 'l' || c == 'L') { if (!pedantic < spec_long) yyerror ("too many `l's in integer constant"); spec_long++; } else if (c == 'u' || c == 'U') { if (! yylval.integer.signedp) yyerror ("two `u's in integer constant"); yylval.integer.signedp = UNSIGNED; } else { if (c == '.' || c == 'e' || c == 'E' || c == 'p' || c == 'P') yyerror ("Floating point numbers not allowed in #if expressions"); else yyerror ("missing white space after number `%.*s'", (int) (p - lexptr - 1), lexptr); } if (--len == 0) break; c = *p++; } /* Don't look for any more digits after the suffixes. */ break; } if (largest_digit < digit) largest_digit = digit; nd = n * base + digit; overflow |= (max_over_base < n) | (nd < n); n = nd; } if (base <= largest_digit) pedwarn ("integer constant contains digits beyond the radix"); if (overflow) pedwarn ("integer constant out of range"); /* If too big to be signed, consider it unsigned. */ if (((HOST_WIDEST_INT) n & yylval.integer.signedp) < 0) { if (base == 10) warning ("integer constant is so large that it is unsigned"); yylval.integer.signedp = UNSIGNED; } lexptr = p; yylval.integer.value = n; return INT; } struct token { const char *operator; int token; }; static struct token tokentab2[] = { {"&&", AND}, {"||", OR}, {"<<", LSH}, {">>", RSH}, {"==", EQUAL}, {"!=", NOTEQUAL}, {"<=", LEQ}, {">=", GEQ}, {"++", ERROR}, {"--", ERROR}, {NULL, ERROR} }; /* Read one token, getting characters through lexptr. */ static int yylex () { register int c; register int namelen; register unsigned char *tokstart; register struct token *toktab; int wide_flag; HOST_WIDEST_INT mask; retry: tokstart = (unsigned char *) lexptr; c = *tokstart; /* See if it is a special token of length 2. */ if (! keyword_parsing) for (toktab = tokentab2; toktab->operator != NULL; toktab++) if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) { lexptr += 2; if (toktab->token == ERROR) yyerror ("`%s' not allowed in operand of `#if'", toktab->operator); return toktab->token; } switch (c) { case '\n': return 0; case ' ': case '\t': case '\r': lexptr++; goto retry; case 'L': /* Capital L may start a wide-string or wide-character constant. */ if (lexptr[1] == '\'') { lexptr++; wide_flag = 1; mask = MAX_WCHAR_TYPE_MASK; goto char_constant; } if (lexptr[1] == '"') { lexptr++; wide_flag = 1; mask = MAX_WCHAR_TYPE_MASK; goto string_constant; } break; case '\'': wide_flag = 0; mask = MAX_CHAR_TYPE_MASK; char_constant: lexptr++; if (keyword_parsing) { char *start_ptr = lexptr - 1; while (1) { c = *lexptr++; if (c == '\\') c = parse_escape (&lexptr, mask); else if (c == '\'') break; } yylval.name.address = tokstart; yylval.name.length = lexptr - start_ptr; return NAME; } /* This code for reading a character constant handles multicharacter constants and wide characters. It is mostly copied from c-lex.c. */ { register HOST_WIDEST_INT result = 0; register int num_chars = 0; int chars_seen = 0; unsigned width = MAX_CHAR_TYPE_SIZE; int max_chars; #ifdef MULTIBYTE_CHARS int longest_char = local_mb_cur_max (); char *token_buffer = (char *) alloca (longest_char); (void) local_mbtowc (NULL_PTR, NULL_PTR, 0); #endif max_chars = MAX_LONG_TYPE_SIZE / width; if (wide_flag) width = MAX_WCHAR_TYPE_SIZE; while (1) { c = *lexptr++; if (c == '\'' || c == EOF) break; ++chars_seen; if (c == '\\') { c = parse_escape (&lexptr, mask); } else { #ifdef MULTIBYTE_CHARS wchar_t wc; int i; int char_len = -1; for (i = 1; i <= longest_char; ++i) { token_buffer[i - 1] = c; char_len = local_mbtowc (& wc, token_buffer, i); if (char_len != -1) break; c = *lexptr++; } if (char_len > 1) { /* mbtowc sometimes needs an extra char before accepting */ if (char_len < i) lexptr--; if (! wide_flag) { /* Merge character into result; ignore excess chars. */ for (i = 1; i <= char_len; ++i) { if (i > max_chars) break; if (width < HOST_BITS_PER_INT) result = (result << width) | (token_buffer[i - 1] & ((1 << width) - 1)); else result = token_buffer[i - 1]; } num_chars += char_len; continue; } } else { if (char_len == -1) warning ("Ignoring invalid multibyte character"); } if (wide_flag) c = wc; #endif /* ! MULTIBYTE_CHARS */ } if (wide_flag) { if (chars_seen == 1) /* only keep the first one */ result = c; continue; } /* Merge character into result; ignore excess chars. */ num_chars++; if (num_chars <= max_chars) { if (width < HOST_BITS_PER_INT) result = (result << width) | (c & ((1 << width) - 1)); else result = c; } } if (c != '\'') error ("malformatted character constant"); else if (chars_seen == 0) error ("empty character constant"); else if (num_chars > max_chars) { num_chars = max_chars; error ("character constant too long"); } else if (chars_seen != 1 && ! traditional) warning ("multi-character character constant"); /* If char type is signed, sign-extend the constant. */ if (! wide_flag) { int num_bits = num_chars * width; if (num_bits == 0) /* We already got an error; avoid invalid shift. */ yylval.integer.value = 0; else if (lookup ((U_CHAR *) "__CHAR_UNSIGNED__", sizeof ("__CHAR_UNSIGNED__") - 1, -1) || ((result >> (num_bits - 1)) & 1) == 0) yylval.integer.value = result & (~ (unsigned HOST_WIDEST_INT) 0 >> (HOST_BITS_PER_WIDEST_INT - num_bits)); else yylval.integer.value = result | ~(~ (unsigned HOST_WIDEST_INT) 0 >> (HOST_BITS_PER_WIDEST_INT - num_bits)); } else { yylval.integer.value = result; } } /* This is always a signed type. */ yylval.integer.signedp = SIGNED; return CHAR; /* some of these chars are invalid in constant expressions; maybe do something about them later */ case '/': case '+': case '-': case '*': case '%': case '|': case '&': case '^': case '~': case '!': case '@': case '<': case '>': case '[': case ']': case '.': case '?': case ':': case '=': case '{': case '}': case ',': case '#': if (keyword_parsing) break; case '(': case ')': lexptr++; return c; case '"': mask = MAX_CHAR_TYPE_MASK; string_constant: if (keyword_parsing) { char *start_ptr = lexptr; lexptr++; while (1) { c = *lexptr++; if (c == '\\') c = parse_escape (&lexptr, mask); else if (c == '"') break; } yylval.name.address = tokstart; yylval.name.length = lexptr - start_ptr; return NAME; } yyerror ("string constants not allowed in #if expressions"); return ERROR; } if (c >= '0' && c <= '9' && !keyword_parsing) { /* It's a number */ for (namelen = 1; ; namelen++) { int d = tokstart[namelen]; if (! ((is_idchar[d] || d == '.') || ((d == '-' || d == '+') && (c == 'e' || c == 'E' || ((c == 'p' || c == 'P') && ! c89)) && ! traditional))) break; c = d; } return parse_number (namelen); } /* It is a name. See how long it is. */ if (keyword_parsing) { for (namelen = 0;; namelen++) { if (is_space[tokstart[namelen]]) break; if (tokstart[namelen] == '(' || tokstart[namelen] == ')') break; if (tokstart[namelen] == '"' || tokstart[namelen] == '\'') break; } } else { if (!is_idstart[c]) { yyerror ("Invalid token in expression"); return ERROR; } for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++) ; } lexptr += namelen; yylval.name.address = tokstart; yylval.name.length = namelen; return NAME; } /* Parse a C escape sequence. STRING_PTR points to a variable containing a pointer to the string to parse. That pointer is updated past the characters we use. The value of the escape sequence is returned. RESULT_MASK is used to mask out the result; an error is reported if bits are lost thereby. A negative value means the sequence \ newline was seen, which is supposed to be equivalent to nothing at all. If \ is followed by a null character, we return a negative value and leave the string pointer pointing at the null character. If \ is followed by 000, we return 0 and leave the string pointer after the zeros. A value of 0 does not mean end of string. */ HOST_WIDEST_INT parse_escape (string_ptr, result_mask) char **string_ptr; HOST_WIDEST_INT result_mask; { register int c = *(*string_ptr)++; switch (c) { case 'a': return TARGET_BELL; case 'b': return TARGET_BS; case 'e': case 'E': if (pedantic) pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c); return 033; case 'f': return TARGET_FF; case 'n': return TARGET_NEWLINE; case 'r': return TARGET_CR; case 't': return TARGET_TAB; case 'v': return TARGET_VT; case '\n': return -2; case 0: (*string_ptr)--; return 0; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { register HOST_WIDEST_INT i = c - '0'; register int count = 0; while (++count < 3) { c = *(*string_ptr)++; if (c >= '0' && c <= '7') i = (i << 3) + c - '0'; else { (*string_ptr)--; break; } } if (i != (i & result_mask)) { i &= result_mask; pedwarn ("octal escape sequence out of range"); } return i; } case 'x': { register unsigned HOST_WIDEST_INT i = 0, overflow = 0; register int digits_found = 0, digit; for (;;) { c = *(*string_ptr)++; if (c >= '0' && c <= '9') digit = c - '0'; else if (c >= 'a' && c <= 'f') digit = c - 'a' + 10; else if (c >= 'A' && c <= 'F') digit = c - 'A' + 10; else { (*string_ptr)--; break; } overflow |= i ^ (i << 4 >> 4); i = (i << 4) + digit; digits_found = 1; } if (!digits_found) yyerror ("\\x used with no following hex digits"); if (overflow | (i != (i & result_mask))) { i &= result_mask; pedwarn ("hex escape sequence out of range"); } return i; } default: return c; } } static void integer_overflow () { if (!skip_evaluation && pedantic) pedwarn ("integer overflow in preprocessor expression"); } static HOST_WIDEST_INT left_shift (a, b) struct constant *a; unsigned HOST_WIDEST_INT b; { /* It's unclear from the C standard whether shifts can overflow. The following code ignores overflow; perhaps a C standard interpretation ruling is needed. */ if (b >= HOST_BITS_PER_WIDEST_INT) return 0; else return (unsigned HOST_WIDEST_INT) a->value << b; } static HOST_WIDEST_INT right_shift (a, b) struct constant *a; unsigned HOST_WIDEST_INT b; { if (b >= HOST_BITS_PER_WIDEST_INT) return a->signedp ? a->value >> (HOST_BITS_PER_WIDEST_INT - 1) : 0; else if (a->signedp) return a->value >> b; else return (unsigned HOST_WIDEST_INT) a->value >> b; } /* This page contains the entry point to this file. */ /* Parse STRING as an expression, and complain if this fails to use up all of the contents of STRING. STRING may contain '\0' bytes; it is terminated by the first '\n' outside a string constant, so that we can diagnose '\0' properly. If WARN_UNDEFINED is nonzero, warn if undefined identifiers are evaluated. We do not support C comments. They should be removed before this function is called. */ HOST_WIDEST_INT parse_c_expression (string, warn_undefined) char *string; int warn_undefined; { lexptr = string; warn_undef = warn_undefined; /* if there is some sort of scanning error, just return 0 and assume the parsing routine has printed an error message somewhere. there is surely a better thing to do than this. */ if (setjmp (parse_return_error)) return 0; if (yyparse () != 0) abort (); if (*lexptr != '\n') error ("Junk after end of expression."); return expression_value; /* set by yyparse () */ } static void yyerror VPROTO ((const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, const char *); #endif verror (msgid, args); va_end (args); skip_evaluation = 0; longjmp (parse_return_error, 1); } #ifdef TEST_EXP_READER #if YYDEBUG extern int yydebug; #endif int pedantic; int traditional; int c89; int main PROTO((int, char **)); static void initialize_random_junk PROTO((void)); static void print_unsigned_host_widest_int PROTO((unsigned HOST_WIDEST_INT)); /* Main program for testing purposes. */ int main (argc, argv) int argc; char **argv; { int n, c; char buf[1024]; unsigned HOST_WIDEST_INT u; pedantic = 1 < argc; traditional = 2 < argc; c89 = 3 < argc; #if YYDEBUG yydebug = 4 < argc; #endif initialize_random_junk (); for (;;) { printf ("enter expression: "); n = 0; while ((buf[n] = c = getchar ()) != '\n' && c != EOF) n++; if (c == EOF) break; parse_c_expression (buf, 1); printf ("parser returned "); u = (unsigned HOST_WIDEST_INT) expression_value; if (expression_value < 0 && expression_signedp) { u = -u; printf ("-"); } if (u == 0) printf ("0"); else print_unsigned_host_widest_int (u); if (! expression_signedp) printf("u"); printf ("\n"); } return 0; } static void print_unsigned_host_widest_int (u) unsigned HOST_WIDEST_INT u; { if (u) { print_unsigned_host_widest_int (u / 10); putchar ('0' + (int) (u % 10)); } } /* table to tell if char can be part of a C identifier. */ unsigned char is_idchar[256]; /* table to tell if char can be first char of a c identifier. */ unsigned char is_idstart[256]; /* table to tell if c is horizontal or vertical space. */ unsigned char is_space[256]; /* * initialize random junk in the hash table and maybe other places */ static void initialize_random_junk () { register int i; /* * Set up is_idchar and is_idstart tables. These should be * faster than saying (is_alpha (c) || c == '_'), etc. * Must do set up these things before calling any routines tthat * refer to them. */ for (i = 'a'; i <= 'z'; i++) { ++is_idchar[i - 'a' + 'A']; ++is_idchar[i]; ++is_idstart[i - 'a' + 'A']; ++is_idstart[i]; } for (i = '0'; i <= '9'; i++) ++is_idchar[i]; ++is_idchar['_']; ++is_idstart['_']; ++is_idchar['$']; ++is_idstart['$']; ++is_space[' ']; ++is_space['\t']; ++is_space['\v']; ++is_space['\f']; ++is_space['\n']; ++is_space['\r']; } void error VPROTO ((char * msgid, ...)) { #ifndef ANSI_PROTOTYPES char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, char *); #endif fprintf (stderr, "error: "); vfprintf (stderr, _(msgid), args); fprintf (stderr, "\n"); va_end (args); } void pedwarn VPROTO ((char * msgid, ...)) { #ifndef ANSI_PROTOTYPES char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, char *); #endif fprintf (stderr, "pedwarn: "); vfprintf (stderr, _(msgid), args); fprintf (stderr, "\n"); va_end (args); } void warning VPROTO ((char * msgid, ...)) { #ifndef ANSI_PROTOTYPES char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, char *); #endif fprintf (stderr, "warning: "); vfprintf (stderr, _(msgid), args); fprintf (stderr, "\n"); va_end (args); } int check_assertion (name, sym_length, tokens_specified, tokens) U_CHAR *name; int sym_length; int tokens_specified; struct arglist *tokens; { return 0; } struct hashnode * lookup (name, len, hash) U_CHAR *name; int len; int hash; { return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1); } PTR xmalloc (size) size_t size; { return (PTR) malloc (size); } #endif cxref-1.6d/cpp/cexp.y 444 233 144 70401 6673544312 7730 0/* Parse C expressions for CCCP. Copyright (C) 1987, 92, 94-98, 1999 Free Software Foundation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! Adapted from expread.y of GDB by Paul Rubin, July 1986. */ /* Parse a C expression from text in a string */ %{ #include "config.h" #include "system.h" #include "intl.h" #include /* #define YYDEBUG 1 */ #ifdef MULTIBYTE_CHARS #include "mbchar.h" #include #endif /* MULTIBYTE_CHARS */ typedef unsigned char U_CHAR; /* This is used for communicating lists of keywords with cccp.c. */ struct arglist { struct arglist *next; U_CHAR *name; int length; int argno; }; HOST_WIDEST_INT parse_c_expression PROTO((char *, int)); static int yylex PROTO((void)); static void yyerror PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; static HOST_WIDEST_INT expression_value; #ifdef TEST_EXP_READER static int expression_signedp; #endif static jmp_buf parse_return_error; /* Nonzero means count most punctuation as part of a name. */ static int keyword_parsing = 0; /* Nonzero means do not evaluate this expression. This is a count, since unevaluated expressions can nest. */ static int skip_evaluation; /* Nonzero means warn if undefined identifiers are evaluated. */ static int warn_undef; /* some external tables of character types */ extern unsigned char is_idstart[], is_idchar[], is_space[]; /* Flag for -pedantic. */ extern int pedantic; /* Flag for -traditional. */ extern int traditional; /* Flag for -lang-c89. */ extern int c89; #ifndef CHAR_TYPE_SIZE #define CHAR_TYPE_SIZE BITS_PER_UNIT #endif #ifndef INT_TYPE_SIZE #define INT_TYPE_SIZE BITS_PER_WORD #endif #ifndef LONG_TYPE_SIZE #define LONG_TYPE_SIZE BITS_PER_WORD #endif #ifndef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE INT_TYPE_SIZE #endif #ifndef MAX_CHAR_TYPE_SIZE #define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE #endif #ifndef MAX_INT_TYPE_SIZE #define MAX_INT_TYPE_SIZE INT_TYPE_SIZE #endif #ifndef MAX_LONG_TYPE_SIZE #define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE #endif #ifndef MAX_WCHAR_TYPE_SIZE #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE #endif #define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \ ? (~ (~ (HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \ : ~ (HOST_WIDEST_INT) 0) #define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \ ? ~ (~ (HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \ : ~ (HOST_WIDEST_INT) 0) /* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow. Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1. Suppose SIGNEDP is negative if the result is signed, zero if unsigned. Then this yields nonzero if overflow occurred during the addition. Overflow occurs if A and B have the same sign, but A and SUM differ in sign, and SIGNEDP is negative. Use `^' to test whether signs differ, and `< 0' to isolate the sign. */ #define overflow_sum_sign(a, b, sum, signedp) \ ((~((a) ^ (b)) & ((a) ^ (sum)) & (signedp)) < 0) struct constant; HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT)); int check_assertion PROTO((U_CHAR *, int, int, struct arglist *)); struct hashnode *lookup PROTO((U_CHAR *, int, int)); void error PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; void verror PROTO((const char *, va_list)); void pedwarn PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; void warning PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; static int parse_number PROTO((int)); static HOST_WIDEST_INT left_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT)); static HOST_WIDEST_INT right_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT)); static void integer_overflow PROTO((void)); /* `signedp' values */ #define SIGNED (~0) #define UNSIGNED 0 %} %union { struct constant {HOST_WIDEST_INT value; int signedp;} integer; struct name {U_CHAR *address; int length;} name; struct arglist *keywords; } %type exp exp1 start %type keywords %token INT CHAR %token NAME %token ERROR %right '?' ':' %left ',' %left OR %left AND %left '|' %left '^' %left '&' %left EQUAL NOTEQUAL %left '<' '>' LEQ GEQ %left LSH RSH %left '+' '-' %left '*' '/' '%' %right UNARY /* %expect 40 */ %% start : exp1 { expression_value = $1.value; #ifdef TEST_EXP_READER expression_signedp = $1.signedp; #endif } ; /* Expressions, including the comma operator. */ exp1 : exp | exp1 ',' exp { if (pedantic) pedwarn ("comma operator in operand of `#if'"); $$ = $3; } ; /* Expressions, not including the comma operator. */ exp : '-' exp %prec UNARY { $$.value = - $2.value; $$.signedp = $2.signedp; if (($$.value & $2.value & $$.signedp) < 0) integer_overflow (); } | '!' exp %prec UNARY { $$.value = ! $2.value; $$.signedp = SIGNED; } | '+' exp %prec UNARY { $$ = $2; } | '~' exp %prec UNARY { $$.value = ~ $2.value; $$.signedp = $2.signedp; } | '#' NAME { $$.value = check_assertion ($2.address, $2.length, 0, NULL_PTR); $$.signedp = SIGNED; } | '#' NAME { keyword_parsing = 1; } '(' keywords ')' { $$.value = check_assertion ($2.address, $2.length, 1, $5); keyword_parsing = 0; $$.signedp = SIGNED; } | '(' exp1 ')' { $$ = $2; } ; /* Binary operators in order of decreasing precedence. */ exp : exp '*' exp { $$.signedp = $1.signedp & $3.signedp; if ($$.signedp) { $$.value = $1.value * $3.value; if ($1.value && ($$.value / $1.value != $3.value || ($$.value & $1.value & $3.value) < 0)) integer_overflow (); } else $$.value = ((unsigned HOST_WIDEST_INT) $1.value * $3.value); } | exp '/' exp { if ($3.value == 0) { if (!skip_evaluation) error ("division by zero in #if"); $3.value = 1; } $$.signedp = $1.signedp & $3.signedp; if ($$.signedp) { $$.value = $1.value / $3.value; if (($$.value & $1.value & $3.value) < 0) integer_overflow (); } else $$.value = ((unsigned HOST_WIDEST_INT) $1.value / $3.value); } | exp '%' exp { if ($3.value == 0) { if (!skip_evaluation) error ("division by zero in #if"); $3.value = 1; } $$.signedp = $1.signedp & $3.signedp; if ($$.signedp) $$.value = $1.value % $3.value; else $$.value = ((unsigned HOST_WIDEST_INT) $1.value % $3.value); } | exp '+' exp { $$.value = $1.value + $3.value; $$.signedp = $1.signedp & $3.signedp; if (overflow_sum_sign ($1.value, $3.value, $$.value, $$.signedp)) integer_overflow (); } | exp '-' exp { $$.value = $1.value - $3.value; $$.signedp = $1.signedp & $3.signedp; if (overflow_sum_sign ($$.value, $3.value, $1.value, $$.signedp)) integer_overflow (); } | exp LSH exp { $$.signedp = $1.signedp; if (($3.value & $3.signedp) < 0) $$.value = right_shift (&$1, -$3.value); else $$.value = left_shift (&$1, $3.value); } | exp RSH exp { $$.signedp = $1.signedp; if (($3.value & $3.signedp) < 0) $$.value = left_shift (&$1, -$3.value); else $$.value = right_shift (&$1, $3.value); } | exp EQUAL exp { $$.value = ($1.value == $3.value); $$.signedp = SIGNED; } | exp NOTEQUAL exp { $$.value = ($1.value != $3.value); $$.signedp = SIGNED; } | exp LEQ exp { $$.signedp = SIGNED; if ($1.signedp & $3.signedp) $$.value = $1.value <= $3.value; else $$.value = ((unsigned HOST_WIDEST_INT) $1.value <= $3.value); } | exp GEQ exp { $$.signedp = SIGNED; if ($1.signedp & $3.signedp) $$.value = $1.value >= $3.value; else $$.value = ((unsigned HOST_WIDEST_INT) $1.value >= $3.value); } | exp '<' exp { $$.signedp = SIGNED; if ($1.signedp & $3.signedp) $$.value = $1.value < $3.value; else $$.value = ((unsigned HOST_WIDEST_INT) $1.value < $3.value); } | exp '>' exp { $$.signedp = SIGNED; if ($1.signedp & $3.signedp) $$.value = $1.value > $3.value; else $$.value = ((unsigned HOST_WIDEST_INT) $1.value > $3.value); } | exp '&' exp { $$.value = $1.value & $3.value; $$.signedp = $1.signedp & $3.signedp; } | exp '^' exp { $$.value = $1.value ^ $3.value; $$.signedp = $1.signedp & $3.signedp; } | exp '|' exp { $$.value = $1.value | $3.value; $$.signedp = $1.signedp & $3.signedp; } | exp AND { skip_evaluation += !$1.value; } exp { skip_evaluation -= !$1.value; $$.value = ($1.value && $4.value); $$.signedp = SIGNED; } | exp OR { skip_evaluation += !!$1.value; } exp { skip_evaluation -= !!$1.value; $$.value = ($1.value || $4.value); $$.signedp = SIGNED; } | exp '?' { skip_evaluation += !$1.value; } exp ':' { skip_evaluation += !!$1.value - !$1.value; } exp { skip_evaluation -= !!$1.value; $$.value = $1.value ? $4.value : $7.value; $$.signedp = $4.signedp & $7.signedp; } | INT { $$ = yylval.integer; } | CHAR { $$ = yylval.integer; } | NAME { if (warn_undef && !skip_evaluation) warning ("`%.*s' is not defined", $1.length, $1.address); $$.value = 0; $$.signedp = SIGNED; } ; keywords : { $$ = 0; } | '(' keywords ')' keywords { struct arglist *temp; $$ = (struct arglist *) xmalloc (sizeof (struct arglist)); $$->next = $2; $$->name = (U_CHAR *) "("; $$->length = 1; temp = $$; while (temp != 0 && temp->next != 0) temp = temp->next; temp->next = (struct arglist *) xmalloc (sizeof (struct arglist)); temp->next->next = $4; temp->next->name = (U_CHAR *) ")"; temp->next->length = 1; } | NAME keywords { $$ = (struct arglist *) xmalloc (sizeof (struct arglist)); $$->name = $1.address; $$->length = $1.length; $$->next = $2; } ; %% /* During parsing of a C expression, the pointer to the next character is in this variable. */ static char *lexptr; /* Take care of parsing a number (anything that starts with a digit). Set yylval and return the token type; update lexptr. LEN is the number of characters in it. */ /* maybe needs to actually deal with floating point numbers */ static int parse_number (olen) int olen; { register char *p = lexptr; register int c; register unsigned HOST_WIDEST_INT n = 0, nd, max_over_base; register int base = 10; register int len = olen; register int overflow = 0; register int digit, largest_digit = 0; int spec_long = 0; yylval.integer.signedp = SIGNED; if (*p == '0') { base = 8; if (len >= 3 && (p[1] == 'x' || p[1] == 'X')) { p += 2; base = 16; len -= 2; } } max_over_base = (unsigned HOST_WIDEST_INT) -1 / base; for (; len > 0; len--) { c = *p++; if (c >= '0' && c <= '9') digit = c - '0'; else if (base == 16 && c >= 'a' && c <= 'f') digit = c - 'a' + 10; else if (base == 16 && c >= 'A' && c <= 'F') digit = c - 'A' + 10; else { /* `l' means long, and `u' means unsigned. */ while (1) { if (c == 'l' || c == 'L') { if (!pedantic < spec_long) yyerror ("too many `l's in integer constant"); spec_long++; } else if (c == 'u' || c == 'U') { if (! yylval.integer.signedp) yyerror ("two `u's in integer constant"); yylval.integer.signedp = UNSIGNED; } else { if (c == '.' || c == 'e' || c == 'E' || c == 'p' || c == 'P') yyerror ("Floating point numbers not allowed in #if expressions"); else yyerror ("missing white space after number `%.*s'", (int) (p - lexptr - 1), lexptr); } if (--len == 0) break; c = *p++; } /* Don't look for any more digits after the suffixes. */ break; } if (largest_digit < digit) largest_digit = digit; nd = n * base + digit; overflow |= (max_over_base < n) | (nd < n); n = nd; } if (base <= largest_digit) pedwarn ("integer constant contains digits beyond the radix"); if (overflow) pedwarn ("integer constant out of range"); /* If too big to be signed, consider it unsigned. */ if (((HOST_WIDEST_INT) n & yylval.integer.signedp) < 0) { if (base == 10) warning ("integer constant is so large that it is unsigned"); yylval.integer.signedp = UNSIGNED; } lexptr = p; yylval.integer.value = n; return INT; } struct token { const char *operator; int token; }; static struct token tokentab2[] = { {"&&", AND}, {"||", OR}, {"<<", LSH}, {">>", RSH}, {"==", EQUAL}, {"!=", NOTEQUAL}, {"<=", LEQ}, {">=", GEQ}, {"++", ERROR}, {"--", ERROR}, {NULL, ERROR} }; /* Read one token, getting characters through lexptr. */ static int yylex () { register int c; register int namelen; register unsigned char *tokstart; register struct token *toktab; int wide_flag; HOST_WIDEST_INT mask; retry: tokstart = (unsigned char *) lexptr; c = *tokstart; /* See if it is a special token of length 2. */ if (! keyword_parsing) for (toktab = tokentab2; toktab->operator != NULL; toktab++) if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) { lexptr += 2; if (toktab->token == ERROR) yyerror ("`%s' not allowed in operand of `#if'", toktab->operator); return toktab->token; } switch (c) { case '\n': return 0; case ' ': case '\t': case '\r': lexptr++; goto retry; case 'L': /* Capital L may start a wide-string or wide-character constant. */ if (lexptr[1] == '\'') { lexptr++; wide_flag = 1; mask = MAX_WCHAR_TYPE_MASK; goto char_constant; } if (lexptr[1] == '"') { lexptr++; wide_flag = 1; mask = MAX_WCHAR_TYPE_MASK; goto string_constant; } break; case '\'': wide_flag = 0; mask = MAX_CHAR_TYPE_MASK; char_constant: lexptr++; if (keyword_parsing) { char *start_ptr = lexptr - 1; while (1) { c = *lexptr++; if (c == '\\') c = parse_escape (&lexptr, mask); else if (c == '\'') break; } yylval.name.address = tokstart; yylval.name.length = lexptr - start_ptr; return NAME; } /* This code for reading a character constant handles multicharacter constants and wide characters. It is mostly copied from c-lex.c. */ { register HOST_WIDEST_INT result = 0; register int num_chars = 0; int chars_seen = 0; unsigned width = MAX_CHAR_TYPE_SIZE; int max_chars; #ifdef MULTIBYTE_CHARS int longest_char = local_mb_cur_max (); char *token_buffer = (char *) alloca (longest_char); (void) local_mbtowc (NULL_PTR, NULL_PTR, 0); #endif max_chars = MAX_LONG_TYPE_SIZE / width; if (wide_flag) width = MAX_WCHAR_TYPE_SIZE; while (1) { c = *lexptr++; if (c == '\'' || c == EOF) break; ++chars_seen; if (c == '\\') { c = parse_escape (&lexptr, mask); } else { #ifdef MULTIBYTE_CHARS wchar_t wc; int i; int char_len = -1; for (i = 1; i <= longest_char; ++i) { token_buffer[i - 1] = c; char_len = local_mbtowc (& wc, token_buffer, i); if (char_len != -1) break; c = *lexptr++; } if (char_len > 1) { /* mbtowc sometimes needs an extra char before accepting */ if (char_len < i) lexptr--; if (! wide_flag) { /* Merge character into result; ignore excess chars. */ for (i = 1; i <= char_len; ++i) { if (i > max_chars) break; if (width < HOST_BITS_PER_INT) result = (result << width) | (token_buffer[i - 1] & ((1 << width) - 1)); else result = token_buffer[i - 1]; } num_chars += char_len; continue; } } else { if (char_len == -1) warning ("Ignoring invalid multibyte character"); } if (wide_flag) c = wc; #endif /* ! MULTIBYTE_CHARS */ } if (wide_flag) { if (chars_seen == 1) /* only keep the first one */ result = c; continue; } /* Merge character into result; ignore excess chars. */ num_chars++; if (num_chars <= max_chars) { if (width < HOST_BITS_PER_INT) result = (result << width) | (c & ((1 << width) - 1)); else result = c; } } if (c != '\'') error ("malformatted character constant"); else if (chars_seen == 0) error ("empty character constant"); else if (num_chars > max_chars) { num_chars = max_chars; error ("character constant too long"); } else if (chars_seen != 1 && ! traditional) warning ("multi-character character constant"); /* If char type is signed, sign-extend the constant. */ if (! wide_flag) { int num_bits = num_chars * width; if (num_bits == 0) /* We already got an error; avoid invalid shift. */ yylval.integer.value = 0; else if (lookup ((U_CHAR *) "__CHAR_UNSIGNED__", sizeof ("__CHAR_UNSIGNED__") - 1, -1) || ((result >> (num_bits - 1)) & 1) == 0) yylval.integer.value = result & (~ (unsigned HOST_WIDEST_INT) 0 >> (HOST_BITS_PER_WIDEST_INT - num_bits)); else yylval.integer.value = result | ~(~ (unsigned HOST_WIDEST_INT) 0 >> (HOST_BITS_PER_WIDEST_INT - num_bits)); } else { yylval.integer.value = result; } } /* This is always a signed type. */ yylval.integer.signedp = SIGNED; return CHAR; /* some of these chars are invalid in constant expressions; maybe do something about them later */ case '/': case '+': case '-': case '*': case '%': case '|': case '&': case '^': case '~': case '!': case '@': case '<': case '>': case '[': case ']': case '.': case '?': case ':': case '=': case '{': case '}': case ',': case '#': if (keyword_parsing) break; case '(': case ')': lexptr++; return c; case '"': mask = MAX_CHAR_TYPE_MASK; string_constant: if (keyword_parsing) { char *start_ptr = lexptr; lexptr++; while (1) { c = *lexptr++; if (c == '\\') c = parse_escape (&lexptr, mask); else if (c == '"') break; } yylval.name.address = tokstart; yylval.name.length = lexptr - start_ptr; return NAME; } yyerror ("string constants not allowed in #if expressions"); return ERROR; } if (c >= '0' && c <= '9' && !keyword_parsing) { /* It's a number */ for (namelen = 1; ; namelen++) { int d = tokstart[namelen]; if (! ((is_idchar[d] || d == '.') || ((d == '-' || d == '+') && (c == 'e' || c == 'E' || ((c == 'p' || c == 'P') && ! c89)) && ! traditional))) break; c = d; } return parse_number (namelen); } /* It is a name. See how long it is. */ if (keyword_parsing) { for (namelen = 0;; namelen++) { if (is_space[tokstart[namelen]]) break; if (tokstart[namelen] == '(' || tokstart[namelen] == ')') break; if (tokstart[namelen] == '"' || tokstart[namelen] == '\'') break; } } else { if (!is_idstart[c]) { yyerror ("Invalid token in expression"); return ERROR; } for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++) ; } lexptr += namelen; yylval.name.address = tokstart; yylval.name.length = namelen; return NAME; } /* Parse a C escape sequence. STRING_PTR points to a variable containing a pointer to the string to parse. That pointer is updated past the characters we use. The value of the escape sequence is returned. RESULT_MASK is used to mask out the result; an error is reported if bits are lost thereby. A negative value means the sequence \ newline was seen, which is supposed to be equivalent to nothing at all. If \ is followed by a null character, we return a negative value and leave the string pointer pointing at the null character. If \ is followed by 000, we return 0 and leave the string pointer after the zeros. A value of 0 does not mean end of string. */ HOST_WIDEST_INT parse_escape (string_ptr, result_mask) char **string_ptr; HOST_WIDEST_INT result_mask; { register int c = *(*string_ptr)++; switch (c) { case 'a': return TARGET_BELL; case 'b': return TARGET_BS; case 'e': case 'E': if (pedantic) pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c); return 033; case 'f': return TARGET_FF; case 'n': return TARGET_NEWLINE; case 'r': return TARGET_CR; case 't': return TARGET_TAB; case 'v': return TARGET_VT; case '\n': return -2; case 0: (*string_ptr)--; return 0; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { register HOST_WIDEST_INT i = c - '0'; register int count = 0; while (++count < 3) { c = *(*string_ptr)++; if (c >= '0' && c <= '7') i = (i << 3) + c - '0'; else { (*string_ptr)--; break; } } if (i != (i & result_mask)) { i &= result_mask; pedwarn ("octal escape sequence out of range"); } return i; } case 'x': { register unsigned HOST_WIDEST_INT i = 0, overflow = 0; register int digits_found = 0, digit; for (;;) { c = *(*string_ptr)++; if (c >= '0' && c <= '9') digit = c - '0'; else if (c >= 'a' && c <= 'f') digit = c - 'a' + 10; else if (c >= 'A' && c <= 'F') digit = c - 'A' + 10; else { (*string_ptr)--; break; } overflow |= i ^ (i << 4 >> 4); i = (i << 4) + digit; digits_found = 1; } if (!digits_found) yyerror ("\\x used with no following hex digits"); if (overflow | (i != (i & result_mask))) { i &= result_mask; pedwarn ("hex escape sequence out of range"); } return i; } default: return c; } } static void integer_overflow () { if (!skip_evaluation && pedantic) pedwarn ("integer overflow in preprocessor expression"); } static HOST_WIDEST_INT left_shift (a, b) struct constant *a; unsigned HOST_WIDEST_INT b; { /* It's unclear from the C standard whether shifts can overflow. The following code ignores overflow; perhaps a C standard interpretation ruling is needed. */ if (b >= HOST_BITS_PER_WIDEST_INT) return 0; else return (unsigned HOST_WIDEST_INT) a->value << b; } static HOST_WIDEST_INT right_shift (a, b) struct constant *a; unsigned HOST_WIDEST_INT b; { if (b >= HOST_BITS_PER_WIDEST_INT) return a->signedp ? a->value >> (HOST_BITS_PER_WIDEST_INT - 1) : 0; else if (a->signedp) return a->value >> b; else return (unsigned HOST_WIDEST_INT) a->value >> b; } /* This page contains the entry point to this file. */ /* Parse STRING as an expression, and complain if this fails to use up all of the contents of STRING. STRING may contain '\0' bytes; it is terminated by the first '\n' outside a string constant, so that we can diagnose '\0' properly. If WARN_UNDEFINED is nonzero, warn if undefined identifiers are evaluated. We do not support C comments. They should be removed before this function is called. */ HOST_WIDEST_INT parse_c_expression (string, warn_undefined) char *string; int warn_undefined; { lexptr = string; warn_undef = warn_undefined; /* if there is some sort of scanning error, just return 0 and assume the parsing routine has printed an error message somewhere. there is surely a better thing to do than this. */ if (setjmp (parse_return_error)) return 0; if (yyparse () != 0) abort (); if (*lexptr != '\n') error ("Junk after end of expression."); return expression_value; /* set by yyparse () */ } static void yyerror VPROTO ((const char * msgid, ...)) { #ifndef ANSI_PROTOTYPES const char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, const char *); #endif verror (msgid, args); va_end (args); skip_evaluation = 0; longjmp (parse_return_error, 1); } #ifdef TEST_EXP_READER #if YYDEBUG extern int yydebug; #endif int pedantic; int traditional; int c89; int main PROTO((int, char **)); static void initialize_random_junk PROTO((void)); static void print_unsigned_host_widest_int PROTO((unsigned HOST_WIDEST_INT)); /* Main program for testing purposes. */ int main (argc, argv) int argc; char **argv; { int n, c; char buf[1024]; unsigned HOST_WIDEST_INT u; pedantic = 1 < argc; traditional = 2 < argc; c89 = 3 < argc; #if YYDEBUG yydebug = 4 < argc; #endif initialize_random_junk (); for (;;) { printf ("enter expression: "); n = 0; while ((buf[n] = c = getchar ()) != '\n' && c != EOF) n++; if (c == EOF) break; parse_c_expression (buf, 1); printf ("parser returned "); u = (unsigned HOST_WIDEST_INT) expression_value; if (expression_value < 0 && expression_signedp) { u = -u; printf ("-"); } if (u == 0) printf ("0"); else print_unsigned_host_widest_int (u); if (! expression_signedp) printf("u"); printf ("\n"); } return 0; } static void print_unsigned_host_widest_int (u) unsigned HOST_WIDEST_INT u; { if (u) { print_unsigned_host_widest_int (u / 10); putchar ('0' + (int) (u % 10)); } } /* table to tell if char can be part of a C identifier. */ unsigned char is_idchar[256]; /* table to tell if char can be first char of a c identifier. */ unsigned char is_idstart[256]; /* table to tell if c is horizontal or vertical space. */ unsigned char is_space[256]; /* * initialize random junk in the hash table and maybe other places */ static void initialize_random_junk () { register int i; /* * Set up is_idchar and is_idstart tables. These should be * faster than saying (is_alpha (c) || c == '_'), etc. * Must do set up these things before calling any routines tthat * refer to them. */ for (i = 'a'; i <= 'z'; i++) { ++is_idchar[i - 'a' + 'A']; ++is_idchar[i]; ++is_idstart[i - 'a' + 'A']; ++is_idstart[i]; } for (i = '0'; i <= '9'; i++) ++is_idchar[i]; ++is_idchar['_']; ++is_idstart['_']; ++is_idchar['$']; ++is_idstart['$']; ++is_space[' ']; ++is_space['\t']; ++is_space['\v']; ++is_space['\f']; ++is_space['\n']; ++is_space['\r']; } void error VPROTO ((char * msgid, ...)) { #ifndef ANSI_PROTOTYPES char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, char *); #endif fprintf (stderr, "error: "); vfprintf (stderr, _(msgid), args); fprintf (stderr, "\n"); va_end (args); } void pedwarn VPROTO ((char * msgid, ...)) { #ifndef ANSI_PROTOTYPES char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, char *); #endif fprintf (stderr, "pedwarn: "); vfprintf (stderr, _(msgid), args); fprintf (stderr, "\n"); va_end (args); } void warning VPROTO ((char * msgid, ...)) { #ifndef ANSI_PROTOTYPES char * msgid; #endif va_list args; VA_START (args, msgid); #ifndef ANSI_PROTOTYPES msgid = va_arg (args, char *); #endif fprintf (stderr, "warning: "); vfprintf (stderr, _(msgid), args); fprintf (stderr, "\n"); va_end (args); } int check_assertion (name, sym_length, tokens_specified, tokens) U_CHAR *name; int sym_length; int tokens_specified; struct arglist *tokens; { return 0; } struct hashnode * lookup (name, len, hash) U_CHAR *name; int len; int hash; { return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1); } PTR xmalloc (size) size_t size; { return (PTR) malloc (size); } #endif cxref-1.6d/cpp/config.h 644 233 144 4217 11506061166 10211 0/*************************************** $Header: /home/amb/CVS/cxref/cpp/config.h,v 1.11 2004-11-06 17:30:46 amb Exp $ System configuration header file config.h. ******************/ /****************** Written by Andrew M. Bishop This file consists of parts taken from GCC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ***************************************/ #ifndef CONFIG_H #define CONFIG_H /*+ To stop multiple inclusions. +*/ /* The configure script output. */ #include "autoconfig.h" /* An unmodified file from the gcc distribution. */ #include "gansidecl.h" /* The package name for internationalisation. */ #define PACKAGE "gcc" /* This describes the machine the compiler is hosted on (to sufficient accuracy for the pre-processor to compile). */ #define BITS_PER_UNIT 8 #define HOST_BITS_PER_INT (SIZEOF_INT*BITS_PER_UNIT) #define HOST_BITS_PER_LONG (SIZEOF_LONG*BITS_PER_UNIT) #define HOST_BITS_PER_LONGLONG (SIZEOF_LONG_LONG*BITS_PER_UNIT) #define BITS_PER_WORD (SIZEOF_LONG*BITS_PER_UNIT) /* Define results of standard character escape sequences. */ #if defined(mvs) #define TARGET_BELL 47 #define TARGET_BS 22 #define TARGET_TAB 5 #define TARGET_NEWLINE 21 #define TARGET_VT 11 #define TARGET_FF 12 #define TARGET_CR 13 #else #define TARGET_BELL 007 #define TARGET_BS 010 #define TARGET_TAB 011 #define TARGET_NEWLINE 012 #define TARGET_VT 013 #define TARGET_FF 014 #define TARGET_CR 015 #endif /* Need this for AIX apparently. */ #if defined(_AIX) #pragma alloca #endif /* Exit codes. */ #ifndef FATAL_EXIT_CODE #define FATAL_EXIT_CODE 33 /* gcc command understands this. */ #endif #ifndef SUCCESS_EXIT_CODE #define SUCCESS_EXIT_CODE 0 /* 0 means success on Unix. */ #endif /* Function prototypes for cccp.c malloc wrapper etc. */ #include PTR xmalloc PROTO((size_t)); PTR xrealloc PROTO((PTR, size_t)); PTR xcalloc PROTO((size_t, size_t)); char *xstrdup PROTO((const char *)); #endif /* CONFIG_H */ cxref-1.6d/cpp/configure 755 233 144 567561 11642330500 10552 0#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for cxref-cpp 1/6. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cxref-cpp' PACKAGE_TARNAME='cxref-cpp' PACKAGE_VERSION='1/6' PACKAGE_STRING='cxref-cpp 1/6' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS GCC CXREF_CPP EGREP GREP SET_MAKE LN_S INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP YFLAGS YACC OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_cxref_cpp ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS YACC YFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures cxref-cpp 1/6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/cxref-cpp] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of cxref-cpp 1/6:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-cxref-cpp use the supplied cpp instead of trying to use gcc Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF cxref-cpp configure 1/6 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by cxref-cpp $as_me 1/6, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers autoconfig.h" WITH_CXREF_CPP=test # Check whether --with-cxref-cpp was given. if test "${with_cxref_cpp+set}" = set; then : withval=$with_cxref_cpp; if test "$withval" = "yes"; then WITH_CXREF_CPP=yes; fi if test "$withval" = "no"; then WITH_CXREF_CPP=no; fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h locale.h stdlib.h string.h strings.h time.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/param.h sys/stat.h sys/time.h sys/wait.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF for ac_func in bcmp bcopy bzero index rindex strerror strsignal do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test ! "x$GCC" = "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if installed gcc is new enough to use instead of cxref-cpp" >&5 $as_echo_n "checking if installed gcc is new enough to use instead of cxref-cpp... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main() { #if defined(__GNUC__) && ( ( __GNUC__==2 && __GNUC_MINOR__>=8 ) || __GNUC__>=3 ) exit(0); #else exit(1); #endif } _ACEOF if ac_fn_c_try_run "$LINENO"; then : newGCC=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test "$WITH_CXREF_CPP" = "no" ; then if test "x$newGCC" = "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "the '--without-cxref-cpp' option was used but gcc is not suitable" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, ignoring further checks due to '--without-cxref-cpp' option" >&5 $as_echo "yes, ignoring further checks due to '--without-cxref-cpp' option" >&6; } fi elif test "x$newGCC" = "x" || test "$WITH_CXREF_CPP" = "yes" ; then if test "x$newGCC" = "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using cxref-cpp" >&5 $as_echo "no, using cxref-cpp" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, but '--with-cxref-cpp' option overrides this" >&5 $as_echo "yes, but '--with-cxref-cpp' option overrides this" >&6; } fi CXREF_CPP=cxref-cpp else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if installed gcc preserves comments after define statements" >&5 $as_echo_n "checking if installed gcc preserves comments after define statements... " >&6; } echo "#define foo bar /* FIND-ME */" | $CC -E -C - > ./conftest.gcc if $EGREP -e FIND-ME ./conftest.gcc > /dev/null 2>&1 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using cxref-cpp" >&5 $as_echo "no, using cxref-cpp" >&6; } CXREF_CPP=cxref-cpp fi rm ./conftest.gcc { $as_echo "$as_me:${as_lineno-$LINENO}: checking if installed gcc preserves comments after include statements" >&5 $as_echo_n "checking if installed gcc preserves comments after include statements... " >&6; } touch conftest.h echo "#include \"conftest.h\" /* FIND-ME */" | $CC -E -C - > ./conftest.gcc if $EGREP -e FIND-ME ./conftest.gcc > /dev/null 2>&1 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using cxref-cpp" >&5 $as_echo "no, using cxref-cpp" >&6; } CXREF_CPP=cxref-cpp fi rm ./conftest.h ./conftest.gcc fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: -----------------------------------------------------" >&5 $as_echo "$as_me: WARNING: -----------------------------------------------------" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The C compiler is not gcc" >&5 $as_echo "$as_me: WARNING: The C compiler is not gcc" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: read the file cpp/README and cpp/cxref-cpp-configure." >&5 $as_echo "$as_me: WARNING: read the file cpp/README and cpp/cxref-cpp-configure." >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: -----------------------------------------------------" >&5 $as_echo "$as_me: WARNING: -----------------------------------------------------" >&2;} CXREF_CPP=cxref-cpp fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by cxref-cpp $as_me 1/6, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ cxref-cpp config.status 1/6 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "autoconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS autoconfig.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ac_config_files="$ac_config_files cxref-cpp-configure" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by cxref-cpp $as_me 1/6, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ cxref-cpp config.status 1/6 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "autoconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS autoconfig.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "cxref-cpp-configure") CONFIG_FILES="$CONFIG_FILES cxref-cpp-configure" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi chmod 755 cxref-cpp-configure cxref-1.6d/cpp/configure.in 644 233 144 6324 11506061166 11105 0dnl Process this file with autoconf to produce a configure script. AC_INIT(cxref-cpp,1/6) dnl Specify the autoconf file. AC_CONFIG_HEADER(autoconfig.h) dnl Check if we are forced to use the cxref-cpp WITH_CXREF_CPP=test AC_ARG_WITH(cxref-cpp, [ --with-cxref-cpp use the supplied cpp instead of trying to use gcc], [if test "$withval" = "yes"; then WITH_CXREF_CPP=yes; fi if test "$withval" = "no"; then WITH_CXREF_CPP=no; fi]) dnl Checks for programs. AC_PROG_CC AC_PROG_YACC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_EGREP dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(fcntl.h locale.h stdlib.h string.h strings.h time.h unistd.h) AC_CHECK_HEADERS(sys/param.h sys/stat.h sys/time.h sys/wait.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_STRUCT_TM AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) dnl Checks for library functions. AC_CHECK_FUNCS(bcmp bcopy bzero index rindex strerror strsignal) dnl Check the gcc version if test ! "x$GCC" = "x" ; then AC_MSG_CHECKING([if installed gcc is new enough to use instead of cxref-cpp]) AC_TRY_RUN([ int main() { #if defined(__GNUC__) && ( ( __GNUC__==2 && __GNUC_MINOR__>=8 ) || __GNUC__>=3 ) exit(0); #else exit(1); #endif } ], [newGCC=yes]) if test "$WITH_CXREF_CPP" = "no" ; then if test "x$newGCC" = "x" ; then AC_MSG_RESULT([no]) AC_MSG_ERROR([the '--without-cxref-cpp' option was used but gcc is not suitable]) else AC_MSG_RESULT([yes, ignoring further checks due to '--without-cxref-cpp' option]) fi elif test "x$newGCC" = "x" || test "$WITH_CXREF_CPP" = "yes" ; then if test "x$newGCC" = "x" ; then AC_MSG_RESULT([no, using cxref-cpp]) else AC_MSG_RESULT([yes, but '--with-cxref-cpp' option overrides this]) fi CXREF_CPP=cxref-cpp else AC_MSG_RESULT(yes) AC_MSG_CHECKING([if installed gcc preserves comments after define statements]) echo "#define foo bar /* FIND-ME */" | $CC -E -C - > ./conftest.gcc if $EGREP -e FIND-ME ./conftest.gcc > /dev/null 2>&1 ; then AC_MSG_RESULT(yes) else AC_MSG_RESULT([no, using cxref-cpp]) CXREF_CPP=cxref-cpp fi rm ./conftest.gcc AC_MSG_CHECKING([if installed gcc preserves comments after include statements]) touch conftest.h echo "#include \"conftest.h\" /* FIND-ME */" | $CC -E -C - > ./conftest.gcc if $EGREP -e FIND-ME ./conftest.gcc > /dev/null 2>&1 ; then AC_MSG_RESULT(yes) else AC_MSG_RESULT([no, using cxref-cpp]) CXREF_CPP=cxref-cpp fi rm ./conftest.h ./conftest.gcc fi else AC_MSG_WARN(-----------------------------------------------------) AC_MSG_WARN(The C compiler is not gcc, you may have problems! ) AC_MSG_WARN(read the file cpp/README and cpp/cxref-cpp-configure.) AC_MSG_WARN(-----------------------------------------------------) CXREF_CPP=cxref-cpp fi AC_SUBST(CXREF_CPP) AC_SUBST(GCC) dnl Create the output files. AC_OUTPUT(Makefile) AC_OUTPUT(cxref-cpp-configure) chmod 755 cxref-cpp-configure cxref-1.6d/cpp/cxref-cpp-configure.in 755 233 144 4361 11506061166 12774 0#!/bin/sh # # $Header: /home/amb/CVS/cxref/cpp/cxref-cpp-configure.in,v 1.3 2010-10-19 18:18:54 amb Exp $ # # C Cross Referencing & Documentation tool. Version 1.6d. # # A script to generate the runtime configuration information for # cxref-cpp so that it can imitate gcc. # # Written by Andrew M. Bishop # # This file Copyright 2004-2010 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # # Programs and paths # (Default to the ones from the configure script). EGREP="@EGREP@" prefix="@prefix@" datarootdir="@datarootdir@" cxref_cpp_defines="@datadir@/cxref/cxref-cpp.defines" # Chose the C compiler and output file to use if not specified. # (Defaults to compiler found by configure script). while [ ! $# = 0 ]; do case $1 in -o) shift cxref_cpp_defines=$1 ;; *) CC=$1 ;; esac shift done if [ "$CC" = "" ]; then CC=@CC@ fi # Check if this is gcc or not. # (Defaults to check made by configure script) GCC=@GCC@ if [ "$GCC" = "" ]; then echo "" echo "cxref-cpp-configure" echo "" echo "You are not using gcc, it is not possible to create the configuration file." echo "Read the README file and create $cxref_cpp_defines manually." echo "" exit 0 fi # Get the predefines. PREDEFINES=`$CC -E -v - < /dev/null 2>&1 | $EGREP -e -D__GNUC | tr ' ' '\012' | $EGREP -e '^-[AD]' | tr '\012' ' '` # Get the paths. INCLUDES=`$CC -E -v - < /dev/null 2>&1 | awk '/include <.+> search/,/End of search/ {print $1}'` # Get the defines. DEFINES=`$CC -E -dM - < /dev/null 2>/dev/null | sort | tr '\012' '\015'` # Create the output file. echo "// cxref-cpp runtime configuration file" > $cxref_cpp_defines # Write the predefines to the file. for define in $PREDEFINES; do echo "// $define" >> $cxref_cpp_defines done # Write the include paths to the file. for include in $INCLUDES; do test -d $include && echo "// -I$include" >> $cxref_cpp_defines done # Write the built-in #defines to the file. IFS= export IFS for define in $DEFINES; do echo $define >> $cxref_cpp_defines done cxref-1.6d/cpp/cxref-cpp-configure.man 644 233 144 2430 11506061166 13131 0.\" $Header: /home/amb/CVS/cxref/cpp/cxref-cpp-configure.man,v 1.1 2004-05-09 08:47:10 amb Exp $ .\" .\" C Cross Referencing & Documenting tool - Version 1.5g .\" .\" Manual page for cxref-cpp-configure .\" .\" Written by Andrew M. Bishop .\" .\" This file Copyright 2004 Andrew M. Bishop .\" It may be distributed under the GNU Public License, version 2, or .\" any higher version. See section COPYING of the GNU Public license .\" for conditions under which this file may be redistributed. .\" .TH cxref-cpp-configure 1 "May 9, 2004" .SH NAME cxref-cpp-configure - A program to generate the cxref-cpp.defines file for cxref-cpp. .SH SYNOPSIS .B cxref-cpp-configure .I [-o output] .I cc .SH DESCRIPTION The cxref-cpp program will take on the personality of the installed version of gcc so that the gcc header files can be parsed. This means that it includes the same default include directory paths and macro definitions. The file that contains these definitions is called cxref-cpp.defines and is installed by the cxref-cpp-configure program. .LP .SH OPTIONS .TP .BR \-o output Specifies the name of the output file (default is to use the compiled in file name). .TP .BR cc The name of the C compiler executable that cxref-cpp should pretend to be. .SH SEE ALSO cxref(1), cxref-cpp(1) cxref-1.6d/cpp/cxref-cpp.man 644 233 144 4071 11506061166 11155 0.\" $Header: /home/amb/CVS/cxref/cpp/cxref-cpp.man,v 1.4 2004-05-09 08:58:32 amb Exp $ .\" .\" C Cross Referencing & Documenting tool - Version 1.5g .\" .\" Manual page for cxref-cpp .\" .\" Written by Andrew M. Bishop .\" .\" This file Copyright 1996,1997,2004 Andrew M. Bishop .\" It may be distributed under the GNU Public License, version 2, or .\" any higher version. See section COPYING of the GNU Public license .\" for conditions under which this file may be redistributed. .\" .TH cxref-cpp 1 "May 9, 2004" .SH NAME cxref-cpp - A modified C preprocessor to use with cxref. .SH SYNOPSIS .B cxref-cpp .I ... .SH DESCRIPTION To improve the output that is available for the source code for cross-referencing a modified version of the GNU CPP v2.7.2 is supplied (named cxref-cpp). This modified C preprocessor allows for a finer control over some features of the preprocessing that are not important for a compiler. In a standard preprocessor, the preprocessor directives are intended for use only by the preprocessor, so passing the information through is not important. With cxref-cpp, there are some features that are different to the standard GNU CPP: .IP Compared to gcc versions earlier than version 2.8.0 there is an extra option that will output the #include lines from the source file. In version 2.8.0 and later this option is present. .IP Comments trailing a #include or a #define are not preserved by all versions of gcc even if the -C option is used. This is not important while compiling, but is useful for documenting. .IP The cxref-cpp program will take on the personality of the installed version of gcc so that the gcc header files can be parsed. This means that it includes the same default include directory paths and macro definitions. The file that contains these definitions is called cxref-cpp.defines and is installed by the cxref-cpp-configure program or specified by the -cxref-cpp-defines command line option. .LP .SH OPTIONS The same as for gcc, apart from '-cxref-cpp-defines' described above. .SH SEE ALSO cxref(1), cxref-cpp-configure(1), gcc(1) cxref-1.6d/cpp/gansidecl.h 444 233 144 5623 6670406345 10665 0/* ANSI and traditional C compatibility macros. Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file mimics some of the support provided by include/ansidecl.h in binutils and gdb releases. ??? Over time the two should be merged into one. */ #ifndef __GANSIDECL_H__ #define __GANSIDECL_H__ #include "ansidecl.h" /* Undef ansidecl.h's "obsolete" version. */ #undef PROTO /* These macros are deprecated, use ansidecl.h's PARAMS style instead. */ #define PROTO(ARGS) PARAMS(ARGS) #define VPROTO(ARGS) VPARAMS(ARGS) #define PVPROTO(ARGS) PARAMS(ARGS) /* Autoconf will possibly define the `inline' or `const' keywords as macros, however this is only valid for the stage1 compiler. If we detect a modern version of gcc, unconditionally reset the values. This makes sure the right thing happens in stage2 and later. We need to do this very early; i.e. before any systems header files or gcc header files in case they use these keywords. Otherwise conflicts might occur. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) # undef const # undef inline # define inline __inline__ /* Modern gcc can use `__inline__' freely. */ #endif /* GCC >= 2.7 */ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # define __attribute__(x) #endif #ifndef ATTRIBUTE_UNUSED_LABEL # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 93) # define ATTRIBUTE_UNUSED_LABEL # else # define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED # endif /* GNUC < 2.93 */ #endif /* ATTRIBUTE_UNUSED_LABEL */ #ifndef ATTRIBUTE_UNUSED #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #endif /* ATTRIBUTE_UNUSED */ #ifndef ATTRIBUTE_NORETURN #define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) #endif /* ATTRIBUTE_NORETURN */ #ifndef ATTRIBUTE_PRINTF #define ATTRIBUTE_PRINTF(m, n) __attribute__ ((format (__printf__, m, n))) #define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) #define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) #define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) #define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) #define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) #endif /* ATTRIBUTE_PRINTF */ #define GENERIC_PTR PTR #ifndef NULL_PTR #define NULL_PTR ((PTR) 0) #endif #endif /* __GANSIDECL_H__ */ cxref-1.6d/cpp/intl.h 444 233 144 2563 6636123756 7706 0/* intl.h - internationalization Copyright 1998 Free Software Foundation, Inc. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_LOCALE_H # include #endif #ifndef HAVE_SETLOCALE # define setlocale(category, locale) (locale) #endif #ifdef ENABLE_NLS # include extern const char localedir[]; #else /* Stubs that do something close enough. */ # ifdef textdomain # undef textdomain # endif # define textdomain(domain) (domain) # ifdef bindtextdomain # undef bindtextdomain # endif # define bindtextdomain(domain, directory) (domain) # ifdef gettext # undef gettext # endif # define gettext(msgid) (msgid) #endif #ifndef _ # define _(msgid) gettext (msgid) #endif #ifndef N_ # define N_(msgid) (msgid) #endif cxref-1.6d/cpp/libiberty.h 644 233 144 241 10064775577 10722 0#ifndef LIBIBERTY_H #define LIBIBERTY_H /*+ To stop multiple inclusions. +*/ /* Dummy to satisfy system.h without modification. */ #endif /* LIBIBERTY_H */ cxref-1.6d/cpp/pcp.h 444 233 144 6104 5770017725 7511 0/* pcp.h -- Describes the format of a precompiled file Copyright (C) 1990 Free Software Foundation, Inc. This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Structure allocated for every string in a precompiled file */ typedef struct stringdef STRINGDEF; struct stringdef { U_CHAR *contents; /* String to include */ int len; /* Its length */ int writeflag; /* Whether we write this */ int lineno; /* Linenumber of source file */ U_CHAR *filename; /* Name of source file */ STRINGDEF *chain; /* Global list of strings in natural order */ int output_mark; /* Where in the output this goes */ }; typedef struct keydef KEYDEF; struct keydef { STRINGDEF *str; KEYDEF *chain; }; /* Format: */ /* A precompiled file starts with a series of #define and #undef statements: #define MAC DEF --- Indicates MAC must be defined with defn DEF #define MAC --- Indicates MAC must be defined with any defn #undef MAC --- Indicates MAC cannot be defined These preconditions must be true for a precompiled file to be used. The preconditions section is null terminated. */ /* Then, there is a four byte number (in network byte order) which */ /* indicates the number of strings the file contains. */ /* Each string contains a STRINGDEF structure. The only component of */ /* the STRINGDEF structure which is used is the lineno field, which */ /* should hold the line number in the original header file. */ /* Then follows the string, followed by a null. Then comes a four */ /* byte number (again, in network byte order) indicating the number */ /* of keys for this string. Each key is a KEYDEF structure, with */ /* irrelevant contents, followed by the null-terminated string. */ /* If the number of keys is 0, then there are no keys for the string, */ /* in other words, the string will never be included. If the number */ /* of keys is -1, this is a special flag indicating there are no keys */ /* in the file, and the string is mandatory (that is, it must be */ /* included regardless in the included output). */ /* A file, then, looks like this: Precondition 1 Precondition 2 . . . Number of strings STRINGDEF String . . . Number of keys KEYDEF Key . . . KEYDEF Key . . . . . . STRINGDEF String . . . Number of keys KEYDEF Key . . . . . . . . . */ cxref-1.6d/cpp/prefix.c 644 233 144 20614 11506071362 10252 0/* Utility to update paths from internal to external forms. Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file contains routines to update a path, both to canonicalize the directory format and to handle any prefix translation. This file must be compiled with -DPREFIX= to specify the "prefix" value used by configure. If a filename does not begin with this prefix, it will not be affected other than by directory canonicalization. Each caller of 'update_path' may specify both a filename and a translation prefix and consist of the name of the package that contains the file ("@GCC", "@BINUTIL", "@GNU", etc). If the prefix is not specified, the filename will only undergo directory canonicalization. If it is specified, the string given by PREFIX will be replaced by the specified prefix (with a '@' in front unless the prefix begins with a '$') and further translation will be done as follows until none of the two conditions below are met: 1) If the filename begins with '@', the string between the '@' and the end of the name or the first '/' or directory separator will be considered a "key" and looked up as follows: -- If this is a Win32 OS, then the Registry will be examined for an entry of "key" in HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\ if found, that value will be used. -- If not found (or not a Win32 OS), the environment variable key_ROOT (the value of "key" concatenated with the constant "_ROOT") is tried. If that fails, then PREFIX (see above) is used. 2) If the filename begins with a '$', the rest of the string up to the end or the first '/' or directory separator will be used as an environment variable, whose value will be returned. Once all this is done, any '/' will be converted to DIR_SEPARATOR, if they are different. NOTE: using resolve_keyed_path under Win32 requires linking with advapi32.dll. */ #include "config.h" #include "system.h" #ifdef _WIN32 #include #endif #include "prefix.h" static const char *std_prefix = PREFIX; static const char *get_key_value PROTO((char *)); static const char *translate_name PROTO((const char *)); static char *save_string PROTO((const char *, int)); #ifdef _WIN32 static char *lookup_key PROTO((char *)); static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE; #endif #ifndef DIR_SEPARATOR # define IS_DIR_SEPARATOR(ch) ((ch) == '/') #else /* DIR_SEPARATOR */ # ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) # else /* DIR_SEPARATOR && DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) # endif /* DIR_SEPARATOR && DIR_SEPARATOR_2 */ #endif /* DIR_SEPARATOR */ char * concat PROTO((const char *, ...)); /* Need prototype to remove compile warning - AMB */ /* Given KEY, as above, return its value. */ static const char * get_key_value (key) char *key; { const char *prefix = 0; char *temp = 0; #ifdef _WIN32 prefix = lookup_key (key); #endif if (prefix == 0) prefix = getenv (temp = concat (key, "_ROOT", NULL_PTR)); if (prefix == 0) prefix = std_prefix; if (temp) free (temp); return prefix; } /* Concatenate a sequence of strings, returning the result. This function is based on the one in libiberty. */ char * concat VPROTO((const char *first, ...)) { register int length; register char *newstr; register char *end; register const char *arg; va_list args; #ifndef ANSI_PROTOTYPES const char *first; #endif /* First compute the size of the result and get sufficient memory. */ VA_START (args, first); #ifndef ANSI_PROTOTYPES first = va_arg (args, const char *); #endif arg = first; length = 0; while (arg != 0) { length += strlen (arg); arg = va_arg (args, const char *); } newstr = (char *) malloc (length + 1); va_end (args); /* Now copy the individual pieces to the result string. */ VA_START (args, first); #ifndef ANSI_PROTOTYPES first = va_arg (args, char *); #endif end = newstr; arg = first; while (arg != 0) { while (*arg) *end++ = *arg++; arg = va_arg (args, const char *); } *end = '\000'; va_end (args); return (newstr); } /* Return a copy of a string that has been placed in the heap. */ static char * save_string (s, len) const char *s; int len; { register char *result = xmalloc (len + 1); bcopy (s, result, len); result[len] = 0; return result; } #ifdef _WIN32 /* Look up "key" in the registry, as above. */ static char * lookup_key (key) char *key; { char *dst; DWORD size; DWORD type; LONG res; if (reg_key == (HKEY) INVALID_HANDLE_VALUE) { res = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ, ®_key); if (res == ERROR_SUCCESS) res = RegOpenKeyExA (reg_key, "Free Software Foundation", 0, KEY_READ, ®_key); if (res != ERROR_SUCCESS) { reg_key = (HKEY) INVALID_HANDLE_VALUE; return 0; } } size = 32; dst = (char *) malloc (size); res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size); if (res == ERROR_MORE_DATA && type == REG_SZ) { dst = (char *) realloc (dst, size); res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size); } if (type != REG_SZ || res != ERROR_SUCCESS) { free (dst); dst = 0; } return dst; } #endif /* If NAME starts with a '@' or '$', apply the translation rules above and return a new name. Otherwise, return the given name. */ static const char * translate_name (name) const char *name; { char code = name[0]; char *key; const char *prefix = 0; int keylen; if (code != '@' && code != '$') return name; for (keylen = 0; (name[keylen + 1] != 0 && !IS_DIR_SEPARATOR (name[keylen + 1])); keylen++) ; key = (char *) alloca (keylen + 1); strncpy (key, &name[1], keylen); key[keylen] = 0; name = &name[keylen + 1]; if (code == '@') { prefix = get_key_value (key); if (prefix == 0) prefix = std_prefix; } else prefix = getenv (key); if (prefix == 0) prefix = PREFIX; /* Remove any trailing directory separator from what we got. */ if (IS_DIR_SEPARATOR (prefix[strlen (prefix) - 1])) { char * temp = save_string (prefix, strlen (prefix)); temp[strlen (temp) - 1] = 0; prefix = temp; } return concat (prefix, name, NULL_PTR); } /* Update PATH using KEY if PATH starts with PREFIX. */ const char * update_path (path, key) const char *path; const char *key; { if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0) { if (key[0] != '$') key = concat ("@", key, NULL_PTR); path = concat (key, &path[strlen (std_prefix)], NULL_PTR); while (path[0] == '@' || path[0] == '$') path = translate_name (path); } #ifdef DIR_SEPARATOR_2 /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */ if (DIR_SEPARATOR != DIR_SEPARATOR_2) { int i; int len = strlen (path); char *new_path = save_string (path, len); for (i = 0; i < len; i++) if (new_path[i] == DIR_SEPARATOR_2) new_path[i] = DIR_SEPARATOR; path = new_path; } #endif #if defined (DIR_SEPARATOR) && !defined (DIR_SEPARATOR_2) if (DIR_SEPARATOR != '/') { int i; int len = strlen (path); char *new_path = save_string (path, len); for (i = 0; i < len; i++) if (new_path[i] == '/') new_path[i] = DIR_SEPARATOR; path = new_path; } #endif return path; } /* Reset the standard prefix */ void set_std_prefix (prefix, len) const char *prefix; int len; { std_prefix = save_string (prefix, len); } cxref-1.6d/cpp/prefix.c.diff 644 233 144 624 11506071474 11124 0Index: prefix.c =================================================================== --- prefix.c (revision 624) +++ prefix.c (revision 625) @@ -92,6 +92,8 @@ # endif /* DIR_SEPARATOR && DIR_SEPARATOR_2 */ #endif /* DIR_SEPARATOR */ +char * concat PROTO((const char *, ...)); /* Need prototype to remove compile warning - AMB */ + /* Given KEY, as above, return its value. */ static const char * cxref-1.6d/cpp/prefix.h 444 233 144 2045 6644753030 10221 0/* Provide prototypes for functions exported from prefix.c. Copyright (C) 1999 Free Software Foundation, Inc. This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __GCC_PREFIX_H__ #define __GCC_PREFIX_H__ extern const char *update_path PARAMS ((const char *, const char *)); extern void set_std_prefix PARAMS ((const char *, int)); #endif /* ! __GCC_PREFIX_H__ */ cxref-1.6d/cpp/system.h 444 233 144 32272 7234031053 10263 0/* system.h - Get common system includes and various definitions and declarations based on autoconf macros. Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __GCC_SYSTEM_H__ #define __GCC_SYSTEM_H__ /* This is the location of the online document giving information how to report bugs. If you change this string, also check for strings not under control of the preprocessor. */ #define GCCBUGURL "" /* We must include stdarg.h/varargs.h before stdio.h. */ #ifdef ANSI_PROTOTYPES #include #else #include #endif #include /* Define a generic NULL if one hasn't already been defined. */ #ifndef NULL #define NULL 0 #endif /* The compiler is not a multi-threaded application and therefore we do not have to use the locking functions. NEED_DECLARATION_PUTC_UNLOCKED actually indicates whether or not the IO code is multi-thread safe by default. If it is not declared, then do not worry about using the _unlocked functions. fputs_unlocked is an extension and needs to be prototyped specially. */ #if defined HAVE_PUTC_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED # undef putc # define putc(C, Stream) putc_unlocked (C, Stream) #endif #if defined HAVE_FPUTC_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED # undef fputc # define fputc(C, Stream) fputc_unlocked (C, Stream) #endif #if defined HAVE_FPUTS_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED # undef fputs # define fputs(String, Stream) fputs_unlocked (String, Stream) # ifdef NEED_DECLARATION_FPUTS_UNLOCKED extern int fputs_unlocked PROTO ((const char *, FILE *)); # endif #endif #include /* Jim Meyering writes: "... Some ctype macros are valid only for character codes that isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when using /bin/cc or gcc but without giving an ansi option). So, all ctype uses should be through macros like ISPRINT... If STDC_HEADERS is defined, then autoconf has verified that the ctype macros don't need to be guarded with references to isascii. ... Defining isascii to 1 should let any compiler worth its salt eliminate the && through constant folding." Bruno Haible adds: "... Furthermore, isupper(c) etc. have an undefined result if c is outside the range -1 <= c <= 255. One is tempted to write isupper(c) with c being of type `char', but this is wrong if c is an 8-bit character >= 128 which gets sign-extended to a negative value. The macro ISUPPER protects against this as well." */ #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) # define IN_CTYPE_DOMAIN(c) 1 #else # define IN_CTYPE_DOMAIN(c) isascii(c) #endif #ifdef isblank # define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c)) #else # define ISBLANK(c) ((c) == ' ' || (c) == '\t') #endif #ifdef isgraph # define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c)) #else # define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c)) #endif #define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) #define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c)) #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) #define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c)) #define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c)) #define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c)) #define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) #define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c)) #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c)) #define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) /* ISDIGIT differs from ISDIGIT_LOCALE, as follows: - Its arg may be any int or unsigned int; it need not be an unsigned char. - It's guaranteed to evaluate its argument exactly once. - It's typically faster. Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless it's important to use the locale's definition of `digit' even when the host does not conform to Posix. */ #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) #include #include #ifndef errno extern int errno; #endif #ifdef STRING_WITH_STRINGS # include # include #else # ifdef HAVE_STRING_H # include # else # ifdef HAVE_STRINGS_H # include # endif # endif #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_SYS_PARAM_H # include #endif #if HAVE_LIMITS_H # include #endif /* Find HOST_WIDEST_INT and set its bit size, type and print macros. It will be the largest integer mode supported by the host which may (or may not) be larger than HOST_WIDE_INT. This must appear after since we only use `long long' if its bigger than a `long' and also if it is supported by macros in limits.h. For old hosts which don't have a limits.h (and thus won't include it in stage2 cause we don't rerun configure) we assume gcc supports long long.) Note, you won't get these defined if you don't include {ht}config.h before this file to set the HOST_BITS_PER_* macros. */ #ifndef HOST_WIDEST_INT # if defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_LONGLONG) # if (HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG) && (defined (LONG_LONG_MAX) || defined (LONGLONG_MAX) || defined (LLONG_MAX) || defined (__GNUC__)) # define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG # define HOST_WIDEST_INT long long # define HOST_WIDEST_INT_PRINT_DEC "%lld" # define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu" # define HOST_WIDEST_INT_PRINT_HEX "0x%llx" # else # define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONG # define HOST_WIDEST_INT long # define HOST_WIDEST_INT_PRINT_DEC "%ld" # define HOST_WIDEST_INT_PRINT_UNSIGNED "%lu" # define HOST_WIDEST_INT_PRINT_HEX "0x%lx" # endif /*(long long>long) && (LONG_LONG_MAX||LONGLONG_MAX||LLONG_MAX||GNUC)*/ # endif /* defined(HOST_BITS_PER_LONG) && defined(HOST_BITS_PER_LONGLONG) */ #endif /* ! HOST_WIDEST_INT */ #ifdef TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # ifdef HAVE_TIME_H # include # endif # endif #endif #ifdef HAVE_FCNTL_H # include #else # ifdef HAVE_SYS_FILE_H # include # endif #endif #ifndef SEEK_SET # define SEEK_SET 0 # define SEEK_CUR 1 # define SEEK_END 2 #endif #ifndef F_OK # define F_OK 0 # define X_OK 1 # define W_OK 2 # define R_OK 4 #endif #ifndef O_RDONLY # define O_RDONLY 0 #endif #ifndef O_WRONLY # define O_WRONLY 1 #endif /* Some systems define these in, e.g., param.h. We undefine these names here to avoid the warnings. We prefer to use our definitions since we know they are correct. */ #undef MIN #undef MAX #define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) #define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) #ifdef HAVE_SYS_WAIT_H #include #endif #ifndef WIFSIGNALED #define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f) #endif #ifndef WTERMSIG #define WTERMSIG(S) ((S) & 0x7f) #endif #ifndef WIFEXITED #define WIFEXITED(S) (((S) & 0xff) == 0) #endif #ifndef WEXITSTATUS #define WEXITSTATUS(S) (((S) & 0xff00) >> 8) #endif #ifndef WSTOPSIG #define WSTOPSIG WEXITSTATUS #endif #ifndef bcopy # ifdef HAVE_BCOPY # ifdef NEED_DECLARATION_BCOPY extern void bcopy (); # endif # else /* ! HAVE_BCOPY */ # define bcopy(src,dst,len) memmove((dst),(src),(len)) # endif #endif #ifndef bcmp # ifdef HAVE_BCMP # ifdef NEED_DECLARATION_BCMP extern int bcmp (); # endif # else /* ! HAVE_BCMP */ # define bcmp(left,right,len) memcmp ((left),(right),(len)) # endif #endif #ifndef bzero # ifdef HAVE_BZERO # ifdef NEED_DECLARATION_BZERO extern void bzero (); # endif # else /* ! HAVE_BZERO */ # define bzero(dst,len) memset ((dst),0,(len)) # endif #endif #ifndef index # ifdef HAVE_INDEX # ifdef NEED_DECLARATION_INDEX extern char *index (); # endif # else /* ! HAVE_INDEX */ # define index strchr # endif #endif #ifndef rindex # ifdef HAVE_RINDEX # ifdef NEED_DECLARATION_RINDEX extern char *rindex (); # endif # else /* ! HAVE_RINDEX */ # define rindex strrchr # endif #endif #ifdef NEED_DECLARATION_ATOF extern double atof (); #endif #ifdef NEED_DECLARATION_ATOL extern long atol(); #endif #ifdef NEED_DECLARATION_FREE extern void free (); #endif #ifdef NEED_DECLARATION_GETCWD extern char *getcwd (); #endif #ifdef NEED_DECLARATION_GETENV extern char *getenv (); #endif #ifdef NEED_DECLARATION_GETWD extern char *getwd (); #endif #ifdef NEED_DECLARATION_SBRK extern char *sbrk (); #endif #ifdef NEED_DECLARATION_STRSTR extern char *strstr (); #endif #ifdef HAVE_STRERROR # ifdef NEED_DECLARATION_STRERROR # ifndef strerror extern char *strerror (); # endif # endif #else /* ! HAVE_STRERROR */ extern int sys_nerr; extern char *sys_errlist[]; #endif /* HAVE_STRERROR */ #ifdef HAVE_STRSIGNAL # ifdef NEED_DECLARATION_STRSIGNAL # ifndef strsignal extern char * strsignal (); # endif # endif #else /* ! HAVE_STRSIGNAL */ # ifndef SYS_SIGLIST_DECLARED # ifndef NO_SYS_SIGLIST extern char * sys_siglist[]; # endif # endif #endif /* HAVE_STRSIGNAL */ #ifdef HAVE_GETRLIMIT # ifdef NEED_DECLARATION_GETRLIMIT # ifndef getrlimit extern int getrlimit (); # endif # endif #endif #ifdef HAVE_SETRLIMIT # ifdef NEED_DECLARATION_SETRLIMIT # ifndef setrlimit extern int setrlimit (); # endif # endif #endif /* HAVE_VOLATILE only refers to the stage1 compiler. We also check __STDC__ and assume gcc sets it and has volatile in stage >=2. */ #if !defined(HAVE_VOLATILE) && !defined(__STDC__) && !defined(volatile) #define volatile #endif /* Redefine abort to report an internal error w/o coredump, and reporting the location of the error in the source file. Some files undefine abort again, so we must prototype the real thing for their sake. */ #ifdef NEED_DECLARATION_ABORT extern void abort (); #endif extern void fatal PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) #define abort() fatal ("Internal compiler error at %s:%d\n", \ trim_filename (__FILE__), __LINE__) #else #define abort() fatal ("Internal compiler error in `%s', at %s:%d\n" \ "Please submit a full bug report.\n" \ "See %s for instructions.", \ __PRETTY_FUNCTION__, trim_filename (__FILE__), __LINE__, GCCBUGURL) #endif /* recent gcc */ /* trim_filename is in toplev.c. Define a stub macro for files that don't link toplev.c. toplev.h will reset it to the real version. */ #define trim_filename(x) (x) /* Define a STRINGIFY macro that's right for ANSI or traditional C. HAVE_CPP_STRINGIFY only refers to the stage1 compiler. Assume that (non-traditional) gcc used in stage2 or later has this feature. Note: if the argument passed to STRINGIFY is itself a macro, eg #define foo bar, STRINGIFY(foo) will produce "foo", not "bar". Although the __STDC__ case could be made to expand this via a layer of indirection, the traditional C case can not do so. Therefore this behavior is not supported. */ #ifndef STRINGIFY # if defined(HAVE_CPP_STRINGIFY) || (defined(__GNUC__) && defined(__STDC__)) # define STRINGIFY(STRING) #STRING # else # define STRINGIFY(STRING) "STRING" # endif #endif /* ! STRINGIFY */ #if HAVE_SYS_STAT_H # include #endif /* Test if something is a normal file. */ #ifndef S_ISREG #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif /* Test if something is a directory. */ #ifndef S_ISDIR #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif /* Test if something is a character special file. */ #ifndef S_ISCHR #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) #endif /* Test if something is a socket. */ #ifndef S_ISSOCK # ifdef S_IFSOCK # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) # else # define S_ISSOCK(m) 0 # endif #endif /* Test if something is a FIFO. */ #ifndef S_ISFIFO # ifdef S_IFIFO # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) # else # define S_ISFIFO(m) 0 # endif #endif /* Approximate O_NONBLOCK. */ #ifndef O_NONBLOCK #define O_NONBLOCK O_NDELAY #endif /* Approximate O_NOCTTY. */ #ifndef O_NOCTTY #define O_NOCTTY 0 #endif /* Define well known filenos if the system does not define them. */ #ifndef STDIN_FILENO # define STDIN_FILENO 0 #endif #ifndef STDOUT_FILENO # define STDOUT_FILENO 1 #endif #ifndef STDERR_FILENO # define STDERR_FILENO 2 #endif /* Some systems have mkdir that takes a single argument. */ #ifdef MKDIR_TAKES_ONE_ARG # define mkdir(a,b) mkdir(a) #endif /* Get libiberty declarations. */ #include "libiberty.h" #endif /* __GCC_SYSTEM_H__ */ cxref-1.6d/cpp/version.c 644 233 144 100 11506061166 10367 0char *version_string = "2.95.3 20010315 (release) (for cxref)"; cxref-1.6d/doc/ 40755 233 144 0 11642337067 6545 5cxref-1.6d/doc/ANNOUNCE 644 233 144 5743 11400674775 7725 0 C Cross Referencing & Documenting tool. Version 1.6c - cxref ============================================================ Cxref is a program that will produce documentation (in LaTeX, HTML, RTF or SGML) including cross-references from C program source code. Works for ANSI C, including most gcc extensions. The documentation for the program is produced from comments in the code that are appropriately formatted. The cross referencing comes from the code itself and requires no extra work. The documentation is produced for each of the following: Files - A comment that applies to the whole file. Functions - A comment for the function, including a description of each of the arguments and the return value. Variables - A comment for each of a group of variables and/or individual variables. #include - A comment for each included file. #define - A comment for each pre-processor symbol definition, and for macro arguments. Type definitions - A comment for each defined type and for each element of a structure or union type. Any or all of these comments can be present in suitable places in the source code. The cross referencing is performed for the following items Files - The files that the current file is included in (even when included via other files). #includes - Files included in the current file. - Files included by these files etc. Variables - The location of the definition of external variables. - The files that have visibility of global variables. - The files / functions that use the variable. Functions - The file that the function is prototyped in. - The functions that the function calls. - The functions that call the function. - The files and functions that reference the function. - The variables that are used in the function. Each of these items is cross referenced in the output. Includes extensive README and FAQ with details and examples on how to use the program. Changes ------- Since version 1.6b: Bug fixes Handle the gcc __builtin_offsetof() and offsetof() functions. Check that the lex/yacc programs actually exist at configure time. Handle ASM statements with named identifiers in them. Parsing changes Removed the char_varying type. Document changes Update web page links Availability ------------ Previous versions of this program have been tested on the following systems: Linux 1.[123].x, Linux 2.[01234].x, SunOS 4.1.x, Solaris 2.x, HPUX 10.x HTTP server: http://www.gedanken.demon.co.uk/download-cxref/cxref-1.6c.tgz Web page: http://www.gedanken.demon.co.uk/cxref/ Author & Copyright ------------------ This program is copyright Andrew M. Bishop 1995-2010 (amb@gedanken.demon.co.uk) and distributed under GPL. email: amb@gedanken.demon.co.uk [Please put cxref in the subject line] cxref-1.6d/doc/COPYING 644 233 144 43115 6770715602 7621 0 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cxref-1.6d/doc/FAQ 644 233 144 46414 11506061166 7135 0 CXREF VERSION 1.6 - FREQUENTLY ASKED QUESTIONS AND ANSWERS ========================================================== This file contains a list of frequently asked questions and their answers relating to cxref version 1.6. Not all of the questions here are real users questions, some of them have been made up to give some help to people trying to use the program who find that the README documentation is insufficient. -------------------------------------------------------------------------------- Section 0 - Why doesn't this FAQ answer my question? -------------------- Section 1 - What does cxref do (and what it doesn't) Q 1.1 Does cxref support C++? Q 1.2 Does cxref show which #includes that are not needed? Q 1.3 Can cxref document automatic function variables? Q 1.4 Does cxref run on systems other than UNIX? -------------------- Section 2 - When cxref does not work Q 2.1a How do I find out what is causing the parse error? Q 2.1b What does this parse error message mean? Q 2.2 Where is the file cxref.html referenced from README.html? Q 2.3 Why are half of the cross references missing? Q 2.4 Why can't cxref process my header file in isolation? Q 2.5 Why can't LaTeX process the output files? Q 2.6 Why does the include file name have the complete path name? Q 2.7 Why does the include file name have the wrong path name? Q 2.8 Why does cxref put in links to system include files? -------------------- Section 3 - How to make cxref do what you want Q 3.1 How do I use cxref to process source files in more than one directory? Q 3.2 How can I add my own information to the output files? Q 3.3 Can I get a subset of the cross-reference information? Q 3.4 Is there an easy way to generate the comments in the correct format? Q 3.5 How do I produce LaTeX output from a single source.c.tex output file? Q 3.6 How can I pass extra arguments to the C pre-processor? Q 3.7 Can I cross-reference my source code at the same time as compiling it? Q 3.8 What use is the .cxref configuration file? -------------------- Section 4 - More information about cxref Q 4.1 Who wrote cxref, When and Why? Q 4.2 How do I report bugs in cxref? -------------------------------------------------------------------------------- Section 0 - Why doesn't this FAQ answer my question? This FAQ is released with each new version of the cxref program, so if the question is one that is frequently asked about the new version then you will by definition not find the answer here. You can find the latest information about cxref at the cxref web-page, this contains among other things a list of bug-fixes for the latest version. http://www.gedanken.demon.co.uk/cxref/ -------------------------------------------------------------------------------- Section 1 - What does cxref do (and what it doesn't) -------------------- Q 1.1 Does cxref support C++? No. The cxref program only works for C, More specifically: 1) ANSI standard C with some leniency for common non-ANSI syntax. For example, the construct 'switch(foo) { case 1: ... default: }' is not ANSI, there must be a ';' after the default label, but it is accepted by cxref. 2) Traditional (K&R) function declarations, with implicit 'int' and 'void'. For example 'foo(){}' is parsed as if 'int foo(void){}' was specified. 3) The ability to parse GCC extensions. The GCC '__attribute__' and '__extension__' keywords and most of the other GCC extensions. The 'inline' keyword is allowed. -------------------- Q 1.2 Does cxref show which #includes that are not needed? No. The output of the cxref program cross-references all of the functions, variables, type definitions, included file etc. There is not a way of identifying files that are included in another source file that do not need to be. -------------------- Q 1.3 Can cxref document automatic function variables? No. The inclusion of automatic variables in the output is not included. This is because of the number of them in a typical function. In theory it could be made to do this. -------------------- Q 1.4 Does cxref run on systems other than UNIX? For example DOS / Win3 / Win95 / WinNT / OS/2. UNIX = Yes This is the system that the program way designed and initially written for, it should work on many versions of UNIX. I know that it works on Linux, SunOS 4.1.x, Solaris 2.x, AIX & HP-UX 10. DOS/Win3 = No The program was not designed for DOS, the filenames used and the multi-process nature of the program do not allow this. Win95/WinNT = Yes Using the Cygwin library and tools http://sourceware.cygnus.com/cygwin/ it is possible to compile and run the programs. OS/2 = Maybe I have reports that it is possible with OS/2 Warp with emx, but I do not support cxref for this OS. -------------------------------------------------------------------------------- Section 2 - When cxref does not work -------------------- Q 2.1a How do I find out what is causing the parse error? The following error message is generated by cxref when parsing a source file (with YYDEBUG set to 0 in parse-yy.h when cxref was compiled). test.c: 4: parse error, expecting `','' or `';'' ^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ file line type of error name number generated by yacc The error is on line 4 of the file test.c. In this case, the error message that the yacc parser is generating is of some help, more often the error message is just 'parse error'. If YYDEBUG was set to 1 in parse-yy.h, then a more detailed error message would be given (See Q 2.1b). Q 2.1b What does this parse error message mean? The following error message is generated by cxref when parsing a source file (with YYDEBUG set to 1 in parse-yy.h when cxref was compiled). test.c: 4: parse error, expecting `','' or `';'' The previous 10, current and next 10 symbols are: -8 | 296 : INT : int -7 | 258 : IDENTIFIER : foo -6 | 40 : : ( -5 | 292 : VOID : void -4 | 41 : : ) -3 | 123 : : { -2 | 296 : INT : int -1 | 258 : IDENTIFIER : a 0 | 296 : INT : int 1 | 258 : IDENTIFIER : b 2 | 59 : : ; 3 | 125 : : } END OF FILE ^^^ ^^^^^^^^^^ ^^^^^ symbol symbol symbol number type value From this we can reconstruct part of the file test.c, using the previous and next 10 symbol values from the lexer. int foo(void) { int a int b; } ^ This is where the parse error occurred, after 'int a' and before 'int b;'. The cause of the error is now clear, there is a ';' missing after the declaration of the variable a. The cxref program is intended to be used on source files that are known to compile with a C compiler. In this case a parse error message should not be seen except for either non-standard C, (and compiler) or a bug in cxref. -------------------- Q 2.2 Where is the file cxref.html referenced from README.html? The README.html file has a reference to the file cxref.html, this file is only present when 'make docs' has been run to generate the cross references for the cxref program itself. The file is in the example sub-directory of the doc directory. -------------------- Q 2.3 Why are half of the cross references missing? The way that cxref works is that it processes all of the source files for a program, one at a time and generates a cross reference database. A second pass of the program is required to generate all of the cross references from the database of cross reference information. For this reason, the Makefile for the doc directory of cxref uses 'cxref *.c -xref -Odoc' for the first pass and 'cxref *.c -xref -Odoc -html -latex' for the second pass. The first to build the database, the second to produce the outputs. The reason that the cross references are missing is that only one pass of the program has been done on all of the files. The later files to be be processed will have cross references for the earlier files processed. -------------------- Q 2.4 Why can't cxref process my header file in isolation? The cxref program needs to process the header files to enable a cross reference for them to be generated. In many cases, the header file will not have been written with this in mind, and may rely on other header files being included before the one being processed. The best solution to this is to modify the header file so that it includes all of the header files that it needs. Another option is to use '-- -include filename.h' on the command line. This will include the specified file (filename.h) into the source file that is being processed at the beginning. There is a Perl script supplied with the cxref source files called fixheader. This can be used to automatically determine what header files may be required. The decision is based on the header files that are used for the files that cxref can process and lots of test compilations. -------------------- Q 2.5 Why can't LaTeX process the output files? The LaTeX output is designed to work with LaTeX version 2e and the output files will not work with the much older LaTeX version 2.0.9. The file cxref.tex (or basename.tex if '-Nbasename' is used) is the file that must be processed by LaTeX. -------------------- Q 2.6 Why does the include file name have the complete path name? This is because a standard C preprocessor is being used instead of cxref-cpp or an appropriate version of gcc. Changes were made in version 2.8.0 of gcc that make it output the names of the include files as they are in the original source code and not after the files have been translated into an absolute pathname. -------------------- Q 2.7 Why does the include file name have the wrong path name? If the answer to this question is not the same as the answer to Q 2.6 then it could be the following. When the files that are being cross-referenced are in a directory that contains a symbolic link in the path then the current directory has two (or more) possible names. The way that the cxref program works is that it finds the current working directory (which is the real pathname, not using any links). If the name that you specify using -R is another name for the same directory then cxref will not realise that they are the same. This can cause the pathnames to become confused. Try using relative pathnames where possible for the -R and -I options. -------------------- Q 2.8 Why does cxref put in links to system include files? The way that cxref knows which include files are local to the program and which ones are system ones is by the way that they are included. Any that use double quotes '"' are local ones and wil have links to them included in the cross reference output. The include files that use the angle brackets '<>' are system files and do not have links to them included. The best solution is to change the include files so that the distinction is clear. An alternative is to use the '-isystem DIRNAME' option of gcc. This will cause gcc to treat files in this directory as if they are system files. Since cxref uses gcc for the pre-processing, this option can be passed through using 'cxref file.c -- -isystem DIRNAME'. -------------------------------------------------------------------------------- Section 3 - How to make cxref do what you want -------------------- Q 3.1 How do I use cxref to process source files in more than one directory? The cxref program depends on a database of cross references, these must all be consistent. This requires that all of the files to be cross referenced are in the same directory tree. Example: directory files - - - - - - - - basedir : f0.c f0.h ... |- s1 : f1.c f1.h ... |- s2 : f2.c f2.h ... ... -- f2.c -- #include <...> #include "f2.h" #include "../s1/f1.h" #include "f0.h" ---------- In the base directory 'basedir' run 'cxref -xref -Odoc s2/f2.c -html -I.'. This will create the file 'doc/s2/f2.c.html' for the file 'f2.c' and this will contain references to the files 'doc/s2/f2.h.html', 'doc/s1/f1.h.html' and 'doc/f0.h.html'. The subdirectories 'doc/s1', 'doc/s2' will be automatically created within the 'doc' directory to put the files into (the 'doc' directory must already exist). directory files - - - - - - - - basedir |- doc : f0.c.html f0.h.html ... cxref.html |- s1 : f1.c.html f1.h.html ... |- s2 : f2.c.html f2.h.html ... ... An alternative method is to use the -R option to cxref. In the directory 's2', cxref can be run as 'cxref -R.. -xref -Odoc f2.c -html -I.'. This will change directory to '..' ('basedir') before cxref is run, and will modify the cxref arguments so that it is equivalent to running cxref from 'basedir' as detailed above. -------------------- Q 3.2 How can I add my own information to the output files? The files cxref.html and cxref.tex (depending on whether using HTML or LaTeX format and the use of the '-Nbasename' option) are the ones to edit. These files contain the lines 'Begin-Of-Source-Files' and 'End-Of-Source-Files' as comments. The output files for each source file are automatically included between these lines if they do not already exist there. The order of these files and any other text between these lines is not important. Customisation of the files should be added here. The output files for each source file are automatically generated so any edits made to these will be lost when cxref is run. -------------------- Q 3.3 Can I get a subset of the cross-reference information? At the moment, the only one way to limit the amount of cross referencing is to use the '-xref-*' command line option (see README). There are plans for a future version of cxref to have an options file that would allow different amounts of information to be generated in the output. For example, only to display called and not calls information for each function. -------------------- Q 3.4 Is there an easy way to generate the comments in the correct format? The only easy way to do this is to use the cxref.el macro file and Emacs. This is what is used to generate the comments in the cxref source code itself. -------------------- Q 3.5 How do I produce LaTeX output from a single source.c.tex output file? The file cxref.tex (or basename.tex if '-Nbasename' is used) is the file that must be processed by LaTeX. All of the individual LaTeX files for the source files are included into this file. If an individual file source.c.tex needs to be processed then a copy of the file cxref.tex should be modified to include only the required source.c.tex file. -------------------- Q 3.6 How can I pass extra arguments to the C pre-processor? The cxref program itself has three ways that you can specify the arguments that are passed to the C pre-processor. a) The -CPP option allows the name of the pre-processor program itself to be changed. e.g. 'cxref -CPP "/usr/foo/cpp -C" foo.c' will use the cpp from /usr/foo instead of the compiled in default and pass it the option -C. b) The most common C pre-processor commands are recognised by cxref automatically, these are -D*, -U* and -I*. c) Any amount of extra options can be passed to the preprocessor by appending them to the command line after the end-of-arguments marker '--'. e.g. 'cxref foo.c -- -traditional' will pass -traditional to the pre-processor. -------------------- Q 3.7 Can I cross-reference my source code at the same time as compiling it? It is possible to cross-reference and document your source code at the same time as compiling it by using the cxref-cc script. This takes the same arguments as your usual C compiler and performs both functions. First it calls the C compiler and passes on all of the command line arguments. The real C compiler is specified by the CXREFCC environment variable, or the CC environment variable or it will use gcc if neither of these are set. Second the arguments that cxref needs to have are extracted from the arguments that the C compiler had and cxref is called. The arguments that are kept are the -D*, -U*, -I* arguments to specify #defines and #include paths, and the file name of the source file itself. Any other arguments are taken from the .cxref file (See Q 3.8). After doing this it will still be necessary to sort out the header files since these are not cross-referenced using this method. -------------------- Q 3.8 What use is the .cxref configuration file? The most obvious use is if you have a lot of command line options that you don't want to have to enter every time that you run the program. However the .cxref file is most useful when you have a multiple directory source tree (See< Q 3.1), or when you are using an existing Makefile to build documentation. When there are various subdirectories containing source code, a .cxref file in each sub-directory can be used just containing the line '-R..' or whatever is appropriate to point cxref to the root of the source tree. This means that there is no need to keep track of which directory you are in, they all will use the correct directory to work from. If you already have a Makefile that goes through all of the source code then you may want to modify it so that it calls cxref instead of calling the C compiler. This means that there is no room to put the extra arguments to cxref on the command line. A .cxref file can contain the command line arguments so that you only need to need the arguments that are already there for the C compiler (See Q 3.7). -------------------------------------------------------------------------------- Section 4 - More information about cxref -------------------- Q 4.1 Who wrote cxref, When and Why? The cxref program was written by Andrew M. Bishop (amb@gedanken.demon.co.uk) in 1995-2004 and maintained since then. There is a cxref home-page on the World Wide Web, available via the author's home-page at http://www.gedanken.demon.co.uk/ . This is kept updated with news about the program, as new versions become available. An earlier program by the same author using basically the same comment convention was written in Emacs Lisp in 1994. This version was slow, the amount of cross referencing was poor and the output was only in troff format. The current C program was written to replace this but has grown to become much better in the cross referencing that is done and the format of the output has increased greatly. The cxref program can be freely distributed according to the terms of the GNU General Public License (see the file `COPYING'). -------------------- Q 4.2 How do I report bugs in cxref? By e-mail, send them to me at amb@gedanken.demon.co.uk and put cxref somewhere in the subject line. Before doing this, you should check the FAQ and the cxref web-page to see if the answer is there. If it is not, and it is a parse error then check that it is a cxref problem and not a syntax error in the source file. When you are sure that it is a cxref bug, give me as much information as you can, about the error, when it happens, what system you are using etc. It is useful if you can provide a small example and the output of using the '-raw' option to provide the actual output that you are seeing. (If it is an HTML or LaTeX specific problem then send that file instead.) -------------------------------------------------------------------------------- cxref-1.6d/doc/FAQ-html.pl 755 233 144 4465 11506061166 10474 0#!/usr/bin/perl # # Copyright Andrew M. Bishop 1996.97,98,2001,02,03. # # Usage: FAQ-html.pl < FAQ > FAQ.html # $_=; s/^ *//; s/ *\n//; $first=$_; print "\n"; print "\n"; print "\n"; print "\n"; print "$first\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "

    $first

    \n"; print "\n"; print "

    \n"; $questions=0; $answers=0; $pre=0; $blank=1; while() { chop; s/&/&/g; s//>/g; s/ä/ä/g; s/ö/ö/g; s/ü/ü/g; s/Ä/Ä/g; s/Ö/Ö/g; s/Ü/Ü/g; s/ß/ß/g; next if(m/^ *=+ *$/); next if ($_ eq "--------------------"); $pre++,$blank=0,next if($pre==1 && $_ eq ""); $blank=1,next if($pre!=1 && $_ eq ""); $pre++ if($pre); if ($_ eq "--------------------------------------------------------------------------------") { $pre=0,print "\n" if($pre); print "


    \n"; $answers++ if( $answers); $questions=0,$answers=1 if( $questions); $questions=1 if(!$questions && !$answers); } elsif (m/^(Section [0-9]+)/) { $section = $1; $section =~ tr/ /-/; $pre=0,print "\n" if($pre); print "

    $_\n" if($questions); print "

    $_

    \n" if($answers); print "

    \n"; } elsif (m/^(Q [0-9]+.[0-9]+[a-z]*)/) { $question = $1; $question =~ tr/ /-/; $blank=0,$pre=0,print "\n" if($pre); print "

    $_\n" if($questions); print "

    $_

    \n" if($answers); $pre=1,print "
    \n" if($answers);
         }
       elsif (m/\((See Q [0-9]+.[0-9]+[a-z]*)\)/)
         {
          $question = substr($1,4);
          $question =~ tr/ /-/;
          $href=$1;
    
          s%$1%$href% if($answers);
          print "$_\n";
         }
       elsif (m%(^|[^\'\"])(http://[A-Za-z0-9-_.]+/[/A-Za-z0-9-_.~]*)%)
         {
          $href=$2;
    
          s%$2%$href%;
          print "$_\n";
         }
       else
         {
          $blank=0,print "\n" if($blank);
          print "$_\n";
         }
      }
    
    print "\n";
    print "\n";
    print "\n";
    cxref-1.6d/doc/FAQ.html   644    233    144       50550 11642337053  10076 0
    
    
    
    CXREF VERSION 1.6 - FREQUENTLY ASKED QUESTIONS AND ANSWERS
    
    
    
    
    

    CXREF VERSION 1.6 - FREQUENTLY ASKED QUESTIONS AND ANSWERS

    This file contains a list of frequently asked questions and their answers relating to cxref version 1.6. Not all of the questions here are real users questions, some of them have been made up to give some help to people trying to use the program who find that the README documentation is insufficient.


    Section 0 - Why doesn't this FAQ answer my question?

    Section 1 - What does cxref do (and what it doesn't)

    Q 1.1 Does cxref support C++?

    Q 1.2 Does cxref show which #includes that are not needed?

    Q 1.3 Can cxref document automatic function variables?

    Q 1.4 Does cxref run on systems other than UNIX?

    Section 2 - When cxref does not work

    Q 2.1a How do I find out what is causing the parse error?

    Q 2.1b What does this parse error message mean?

    Q 2.2 Where is the file cxref.html referenced from README.html?

    Q 2.3 Why are half of the cross references missing?

    Q 2.4 Why can't cxref process my header file in isolation?

    Q 2.5 Why can't LaTeX process the output files?

    Q 2.6 Why does the include file name have the complete path name?

    Q 2.7 Why does the include file name have the wrong path name?

    Q 2.8 Why does cxref put in links to system include files?

    Section 3 - How to make cxref do what you want

    Q 3.1 How do I use cxref to process source files in more than one directory?

    Q 3.2 How can I add my own information to the output files?

    Q 3.3 Can I get a subset of the cross-reference information?

    Q 3.4 Is there an easy way to generate the comments in the correct format?

    Q 3.5 How do I produce LaTeX output from a single source.c.tex output file?

    Q 3.6 How can I pass extra arguments to the C pre-processor?

    Q 3.7 Can I cross-reference my source code at the same time as compiling it?

    Q 3.8 What use is the .cxref configuration file?

    Section 4 - More information about cxref

    Q 4.1 Who wrote cxref, When and Why?

    Q 4.2 How do I report bugs in cxref?


    Section 0 - Why doesn't this FAQ answer my question?

    This FAQ is released with each new version of the cxref program, so if the question is one that is frequently asked about the new version then you will by definition not find the answer here. You can find the latest information about cxref at the cxref web-page, this contains among other things a list of bug-fixes for the latest version. http://www.gedanken.demon.co.uk/cxref/


    Section 1 - What does cxref do (and what it doesn't)

    Q 1.1 Does cxref support C++?

    No.
    
    The cxref program only works for C, More specifically:
    
    1) ANSI standard C with some leniency for common non-ANSI syntax.
            For example, the construct 'switch(foo) { case 1: ... default: }' is not
            ANSI, there must be a ';' after the default label, but it is accepted by
            cxref.
    
    2) Traditional (K&R) function declarations, with implicit 'int' and 'void'.
            For example 'foo(){}' is parsed as if 'int foo(void){}' was specified.
    
    3) The ability to parse GCC extensions.
            The GCC '__attribute__' and '__extension__' keywords and most of the
            other GCC extensions. The 'inline' keyword is allowed.
    

    Q 1.2 Does cxref show which #includes that are not needed?

    No.
    
    The output of the cxref program cross-references all of the functions,
    variables, type definitions, included file etc.  There is not a way of
    identifying files that are included in another source file that do not need to
    be.
    

    Q 1.3 Can cxref document automatic function variables?

    No.
    
    The inclusion of automatic variables in the output is not included.  This is
    because of the number of them in a typical function.  In theory it could be made
    to do this.
    

    Q 1.4 Does cxref run on systems other than UNIX?

    For example DOS / Win3 / Win95 / WinNT / OS/2.
    
    UNIX    = Yes
            This is the system that the program way designed and initially written
            for, it should work on many versions of UNIX.
            I know that it works on Linux, SunOS 4.1.x, Solaris 2.x, AIX & HP-UX 10.
    
    DOS/Win3 = No
            The program was not designed for DOS, the filenames used and the
            multi-process nature of the program do not allow this.
    
    Win95/WinNT = Yes
            Using the Cygwin library and tools http://sourceware.cygnus.com/cygwin/
            it is possible to compile and run the programs.
    
    OS/2    = Maybe
            I have reports that it is possible with OS/2 Warp with emx, but I do not
            support cxref for this OS.
    

    Section 2 - When cxref does not work

    Q 2.1a How do I find out what is causing the parse error?

    The following error message is generated by cxref when parsing a source file
    (with YYDEBUG set to 0 in parse-yy.h when cxref was compiled).
    
    test.c:   4: parse error, expecting `','' or `';''
    ^^^^^^  ^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    file    line            type of error
    name    number        generated by yacc
    
    The error is on line 4 of the file test.c.  In this case, the error message that
    the yacc parser is generating is of some help, more often the error message is
    just 'parse error'.
    
    If YYDEBUG was set to 1 in parse-yy.h, then a more detailed error message would
    be given (See Q 2.1b).
    

    Q 2.1b What does this parse error message mean?

    The following error message is generated by cxref when parsing a source file
    (with YYDEBUG set to 1 in parse-yy.h when cxref was compiled).
    
    test.c:   4: parse error, expecting `','' or `';''
    
    The previous 10, current and next 10 symbols are:
     -8 | 296 :              INT : int
     -7 | 258 :       IDENTIFIER : foo
     -6 |  40 :                  : (
     -5 | 292 :             VOID : void
     -4 |  41 :                  : )
     -3 | 123 :                  : {
     -2 | 296 :              INT : int
     -1 | 258 :       IDENTIFIER : a
      0 | 296 :              INT : int
      1 | 258 :       IDENTIFIER : b
      2 |  59 :                  : ;
      3 | 125 :                  : }
    END OF FILE
    ^^^               ^^^^^^^^^^  ^^^^^
    symbol              symbol    symbol
    number               type     value
    
    From this we can reconstruct part of the file test.c, using the previous and
    next 10 symbol values from the lexer.
    
    int foo(void) { int a   int b; }
                          ^
    This is where the parse error occurred, after 'int a' and before 'int b;'.
    The cause of the error is now clear, there is a ';' missing after the
    declaration of the variable a.
    
    The cxref program is intended to be used on source files that are known to
    compile with a C compiler.  In this case a parse error message should not be
    seen except for either non-standard C, (and compiler) or a bug in cxref.
    

    Q 2.2 Where is the file cxref.html referenced from README.html?

    The README.html file has a reference to the file cxref.html, this file is only
    present when 'make docs' has been run to generate the cross references for the
    cxref program itself.  The file is in the example sub-directory of the doc
    directory.
    

    Q 2.3 Why are half of the cross references missing?

    The way that cxref works is that it processes all of the source files for a
    program, one at a time and generates a cross reference database.  A second pass
    of the program is required to generate all of the cross references from the
    database of cross reference information.
    
    For this reason, the Makefile for the doc directory of cxref uses 'cxref *.c
    -xref -Odoc' for the first pass and 'cxref *.c -xref -Odoc -html -latex' for the
    second pass.  The first to build the database, the second to produce the
    outputs.
    
    The reason that the cross references are missing is that only one pass of the
    program has been done on all of the files.  The later files to be be processed
    will have cross references for the earlier files processed.
    

    Q 2.4 Why can't cxref process my header file in isolation?

    The cxref program needs to process the header files to enable a cross reference
    for them to be generated.  In many cases, the header file will not have been
    written with this in mind, and may rely on other header files being included
    before the one being processed.  The best solution to this is to modify the
    header file so that it includes all of the header files that it needs.
    
    Another option is to use '-- -include filename.h' on the command line.  This
    will include the specified file (filename.h) into the source file that is being
    processed at the beginning.
    
    There is a Perl script supplied with the cxref source files called fixheader.
    This can be used to automatically determine what header files may be required.
    The decision is based on the header files that are used for the files that cxref
    can process and lots of test compilations.
    

    Q 2.5 Why can't LaTeX process the output files?

    The LaTeX output is designed to work with LaTeX version 2e and the output files
    will not work with the much older LaTeX version 2.0.9.
    
    The file cxref.tex (or basename.tex if '-Nbasename' is used) is the file that
    must be processed by LaTeX.
    

    Q 2.6 Why does the include file name have the complete path name?

    This is because a standard C preprocessor is being used instead of cxref-cpp or
    an appropriate version of gcc.  Changes were made in version 2.8.0 of gcc that
    make it output the names of the include files as they are in the original source
    code and not after the files have been translated into an absolute pathname.
    

    Q 2.7 Why does the include file name have the wrong path name?

    If the answer to this question is not the same as the answer to Q 2.6 then it
    could be the following.  When the files that are being cross-referenced are in a
    directory that contains a symbolic link in the path then the current directory
    has two (or more) possible names.  The way that the cxref program works is that
    it finds the current working directory (which is the real pathname, not using
    any links).  If the name that you specify using -R is another name for the same
    directory then cxref will not realise that they are the same.  This can cause
    the pathnames to become confused.  Try using relative pathnames where possible
    for the -R and -I options.
    

    Q 2.8 Why does cxref put in links to system include files?

    The way that cxref knows which include files are local to the program and which
    ones are system ones is by the way that they are included.  Any that use double
    quotes '"' are local ones and wil have links to them included in the cross
    reference output.  The include files that use the angle brackets '<>' are system
    files and do not have links to them included.
    
    The best solution is to change the include files so that the distinction is
    clear.  An alternative is to use the '-isystem DIRNAME' option of gcc.  This
    will cause gcc to treat files in this directory as if they are system files.
    Since cxref uses gcc for the pre-processing, this option can be passed through
    using 'cxref file.c -- -isystem DIRNAME'.
    

    Section 3 - How to make cxref do what you want

    Q 3.1 How do I use cxref to process source files in more than one directory?

    The cxref program depends on a database of cross references, these must all be
    consistent.  This requires that all of the files to be cross referenced are in
    the same directory tree.
    
    Example:
    
    directory     files
    - - - - -     - - -
    basedir    :  f0.c f0.h ...
     |- s1     :  f1.c f1.h ...
     |- s2     :  f2.c f2.h ...
    ...
    
    -- f2.c --
    #include <...>
    #include "f2.h"
    #include "../s1/f1.h"
    #include "f0.h"
    ----------
    
    In the base directory 'basedir' run 'cxref -xref -Odoc s2/f2.c -html -I.'.  This
    will create the file 'doc/s2/f2.c.html' for the file 'f2.c' and this will
    contain references to the files 'doc/s2/f2.h.html', 'doc/s1/f1.h.html' and
    'doc/f0.h.html'.  The subdirectories 'doc/s1', 'doc/s2' will be automatically
    created within the 'doc' directory to put the files into (the 'doc' directory
    must already exist).
    
    directory        files
    - - - - -        - - -
    basedir
     |- doc       :  f0.c.html f0.h.html ... cxref.html
         |- s1    :  f1.c.html f1.h.html ...
         |- s2    :  f2.c.html f2.h.html ...
    ...
    
    An alternative method is to use the -R option to cxref.  In the directory 's2',
    cxref can be run as 'cxref -R.. -xref -Odoc f2.c -html -I.'.  This will change
    directory to '..' ('basedir') before cxref is run, and will modify the cxref
    arguments so that it is equivalent to running cxref from 'basedir' as detailed
    above.
    

    Q 3.2 How can I add my own information to the output files?

    The files cxref.html and cxref.tex (depending on whether using HTML or LaTeX
    format and the use of the '-Nbasename' option) are the ones to edit.  These
    files contain the lines 'Begin-Of-Source-Files' and 'End-Of-Source-Files' as
    comments.  The output files for each source file are automatically included
    between these lines if they do not already exist there.  The order of these
    files and any other text between these lines is not important.  Customisation of
    the files should be added here.  The output files for each source file are
    automatically generated so any edits made to these will be lost when cxref is
    run.
    

    Q 3.3 Can I get a subset of the cross-reference information?

    At the moment, the only one way to limit the amount of cross referencing is to
    use the '-xref-*' command line option (see README).  There are plans for a
    future version of cxref to have an options file that would allow different
    amounts of information to be generated in the output.  For example, only to
    display called and not calls information for each function.
    

    Q 3.4 Is there an easy way to generate the comments in the correct format?

    The only easy way to do this is to use the cxref.el macro file and Emacs.  This
    is what is used to generate the comments in the cxref source code itself.
    

    Q 3.5 How do I produce LaTeX output from a single source.c.tex output file?

    The file cxref.tex (or basename.tex if '-Nbasename' is used) is the file that
    must be processed by LaTeX.  All of the individual LaTeX files for the source
    files are included into this file.  If an individual file source.c.tex needs to
    be processed then a copy of the file cxref.tex should be modified to include
    only the required source.c.tex file.
    

    Q 3.6 How can I pass extra arguments to the C pre-processor?

    The cxref program itself has three ways that you can specify the arguments that
    are passed to the C pre-processor.
    
    a) The -CPP option allows the name of the pre-processor program itself to be
       changed.
       e.g. 'cxref -CPP "/usr/foo/cpp -C" foo.c' will use the cpp from /usr/foo
       instead of the compiled in default and pass it the option -C.
    
    b) The most common C pre-processor commands are recognised by cxref
       automatically, these are -D*, -U* and -I*.
    
    c) Any amount of extra options can be passed to the preprocessor by appending
       them to the command line after the end-of-arguments marker '--'.
       e.g. 'cxref foo.c -- -traditional' will pass -traditional to the
       pre-processor.
    

    Q 3.7 Can I cross-reference my source code at the same time as compiling it?

    It is possible to cross-reference and document your source code at the same time
    as compiling it by using the cxref-cc script.  This takes the same arguments as
    your usual C compiler and performs both functions.
    
    First it calls the C compiler and passes on all of the command line arguments.
    The real C compiler is specified by the CXREFCC environment variable, or the CC
    environment variable or it will use gcc if neither of these are set.
    
    Second the arguments that cxref needs to have are extracted from the arguments
    that the C compiler had and cxref is called.  The arguments that are kept are
    the -D*, -U*, -I* arguments to specify #defines and #include paths, and the file
    name of the source file itself.  Any other arguments are taken from the .cxref
    file (See Q 3.8).
    
    After doing this it will still be necessary to sort out the header files since
    these are not cross-referenced using this method.
    

    Q 3.8 What use is the .cxref configuration file?

    The most obvious use is if you have a lot of command line options that you don't
    want to have to enter every time that you run the program.
    
    However the .cxref file is most useful when you have a multiple directory source
    tree (See< Q 3.1), or when you are using an existing Makefile to build
    documentation.
    
    When there are various subdirectories containing source code, a .cxref file in
    each sub-directory can be used just containing the line '-R..' or whatever is
    appropriate to point cxref to the root of the source tree.  This means that
    there is no need to keep track of which directory you are in, they all will use
    the correct directory to work from.
    
    If you already have a Makefile that goes through all of the source code then you
    may want to modify it so that it calls cxref instead of calling the C compiler.
    This means that there is no room to put the extra arguments to cxref on the
    command line.  A .cxref file can contain the command line arguments so that you
    only need to need the arguments that are already there for the C compiler
    (See Q 3.7).
    

    Section 4 - More information about cxref

    Q 4.1 Who wrote cxref, When and Why?

    The cxref program was written by Andrew M. Bishop (amb@gedanken.demon.co.uk) in
    1995-2004 and maintained since then.
    
    There is a cxref home-page on the World Wide Web, available via the author's
    home-page at http://www.gedanken.demon.co.uk/ .  This is kept updated with news
    about the program, as new versions become available.
    
    An earlier program by the same author using basically the same comment
    convention was written in Emacs Lisp in 1994.  This version was slow, the amount
    of cross referencing was poor and the output was only in troff format.  The
    current C program was written to replace this but has grown to become much
    better in the cross referencing that is done and the format of the output has
    increased greatly.
    
    The cxref program can be freely distributed according to the terms of the GNU
    General Public License (see the file `COPYING').
    

    Q 4.2 How do I report bugs in cxref?

    By e-mail, send them to me at amb@gedanken.demon.co.uk and put cxref somewhere
    in the subject line.
    
    Before doing this, you should check the FAQ and the cxref web-page to see if the
    answer is there.  If it is not, and it is a parse error then check that it is a
    cxref problem and not a syntax error in the source file.
    When you are sure that it is a cxref bug, give me as much information as you
    can, about the error, when it happens, what system you are using etc.  It is
    useful if you can provide a small example and the output of using the '-raw'
    option to provide the actual output that you are seeing.  (If it is an HTML or
    LaTeX specific problem then send that file instead.)
    

    cxref-1.6d/doc/INSTALL 644 233 144 3543 11506061166 7610 0 C Cross Referencing & Documentation tool Version 1.6 ==================================================== To install the program, do the following: 1) Run ./configure The cxref specific options that you can use are: --enable-us-paper - Enable US paper size instead of A4 --with-cxref-cpp - This forces the cxref-cpp program to be compiled and used instead of gcc. --without-cxref-cpp - This forces the cxref-cpp program not to be compiled and gcc will be used instead. (Normally the configure script will check if the gcc version that you are using works the same as cxref-cpp and uses that if it is. The above two options allow forcing to either use cxref-cpp or gcc in all cases. See the README file in the cpp directory for details of the differences.) The list of generic configure options can be seen by using the --help option. The most useful one is --prefix which allows the installation directory to be specified. For example './configure --prefix=/usr/local' will install all of the files under 'bin' and 'man/man*' subdirectories of '/usr/local'. 2) Run 'make' in this directory to make all of the programs 'make docs' in this directory to make the README & documents 'make install' in this directory to install the program. To install the files with a different root directory you can use 'make install DESTDIR=/some/directory/'. This will prefix all of the installation directories with '/some/directory/'. If you are compiling cxref on Windows using the cygwin tools then use 'make install-win32' as the command to install cxref instead of 'make install'. 3) Print doc/README.ps, read doc/README.dvi or browse doc/README.html to understand how to use the program. cxref-1.6d/doc/Makefile.in 644 233 144 6053 11506061166 10623 0# $Header: /home/amb/CVS/cxref/doc/Makefile.in,v 1.11 2010-10-19 18:18:04 amb Exp $ # # C Cross Referencing & Documentation tool. Version 1.6d. # # Documentation Makefile. # # Written by Andrew M. Bishop # # This file Copyright 1995-2010 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # # autoconf things srcdir=@srcdir@ VPATH=@srcdir@ # The installation locations prefix=@prefix@ datarootdir=@datarootdir@ mandir=$(DESTDIR)@mandir@ # The installation program. INSTALL=@INSTALL@ # The Perl program PERL=@PERL@ # The LaTeX and dvips programs LATEX=@LATEX@ DVIPS=@DVIPS@ ######## SOURCE_FILES= \ cxref.c \ cxref.h \ autoconfig.h \ datatype.h \ comment.c \ file.c \ func.c \ preproc.c \ type.c \ var.c \ xref.c \ warn-raw.c \ latex.c \ latex-style.c \ html.c \ html-style.c \ rtf.c \ sgml.c \ parse-yacc.h \ parse-lex.c \ parse-yacc.c \ parse-yy.h \ slist.c \ memory.h \ memory.c \ version.h ######## docs : faq-html readme examples all : docs ######## install : [ -d $(mandir)/man1 ] || $(INSTALL) -d $(mandir)/man1 $(INSTALL) -m 644 $(srcdir)/README.man $(mandir)/man1/cxref.1 ######## clean : -rm -f *~ \ example/* #### distclean : clean -rm -f Makefile ######## faq-html : $(srcdir)/FAQ $(srcdir)/FAQ-html.pl [ "x$(PERL)" = "x" ] || $(PERL) $(srcdir)/FAQ-html.pl < $(srcdir)/FAQ > FAQ.html ######## readme : $(srcdir)/README.c [ -f README.c ] || cp $(srcdir)/README.c . ../src/cxref -O. -NREADME-TMP -xref README.c ../src/cxref -O. -NREADME-TMP -xref README.c -latex -html-src -rtf -sgml mv README.c.tex README_c.tex [ "x$(LATEX)" = "x" ] || $(LATEX) $(srcdir)/README.tex > /dev/null 2>&1 [ "x$(LATEX)" = "x" ] || $(LATEX) $(srcdir)/README.tex [ "x$(DVIPS)" = "x" ] || $(DVIPS) README.dvi -o README.ps @rm -f README.aux README.log README.toc @rm -f README-TMP.* ######## examples : -@[ ! "$(srcdir)" = "." ] && \ echo "CXREF: " && \ echo "CXREF: Not creating example cross-reference of cxref source code." && \ echo "CXREF: Compiling outside of source tree makes this too complex." && \ echo "CXREF: " # # Create the cross reference files, output files and index # @[ ! "$(srcdir)" = "." ] || \ ( cd ../src ; \ for file in $(SOURCE_FILES) ; do \ echo Cross referencing $$file ; \ ./cxref -xref -O../doc/example -Ncxref $$file; \ done ; \ for file in $(SOURCE_FILES) ; do \ echo Documenting $$file ; \ ./cxref -warn-xref -xref -O../doc/example -Ncxref -latex -html-src -rtf -sgml $$file; \ done ; \ echo Indexing ; \ ./cxref -index-all -O../doc/example -Ncxref -latex -html -rtf -sgml \ ) # # Create the final output and cross references using latex # @[ ! "$(srcdir)" = "." ] || [ "x$(LATEX)" = "x" ] || \ ( cd example ; \ echo Running LaTeX ; \ $(LATEX) cxref.tex > /dev/null 2>&1 ; \ $(LATEX) cxref.tex \ ) ######## cxref-1.6d/doc/NEWS 644 233 144 36526 11642330400 7274 0Version 1.6d of cxref released : Mon Oct 3 14:00:00 2011 -------------------------------------------------------- Bug fixes Updated for latest version of autoconf. Allow structure initialisers to have multiple components (e.g. a.b=1). Remove gcc warning messages. Change Makefile for better comptibility with FreeBSD. Version 1.6c of cxref released : Mon May 31 10:00:00 2010 --------------------------------------------------------- Bug fixes Handle the gcc __builtin_offsetof() and offsetof() functions. Check that the lex/yacc programs actually exist at configure time. Handle ASM statements with named identifiers in them. Parsing changes Removed the char_varying type. Document changes Update web page links *NOTE* The notes for version 1.6 below apply also. Version 1.6b of cxref released : Fri Feb 16 09:00:00 2007 --------------------------------------------------------- Bug fixes Define a value for PATH_MAX in case one is not already defined. Fix scope problem with declarations of pointers to functions. Remove some compilation warnings with gcc 4. *NOTE* The notes for version 1.6 below apply also. Version 1.6a of cxref released : Sun May 1 16:30:00 2005 -------------------------------------------------------- Bug fixes Added function prototypes to allow cxref-cpp to work on 64-bit machines. Fix bug reading from freed memory and small memory leak. Stop comments intended for functions appearing on #defines inside function. If cxref-cpp cannot find include directory from cxref-cpp.defines then abort. Fix installation of manual page. Parsing changes Allow variable declaration in for(;;) statements. Allow named initialisation of structure/union using named initialisers. Fix bad handling of some vararg macros in cxref-cpp. *NOTE* The notes for version 1.6 below apply also. Version 1.6 of cxref released : Sun Sep 26 11:30:00 2004 -------------------------------------------------------- Bug fixes Remove unwanted tag in HTML output for some variables. Added C99 Complex and Boolean types Handle a goto statement or a named label with a type name. Stop a structure pointer to function looking like a function declaration. cxref-cpp changes Now uses gcc-2.95.3 as the base for the pre-processor. Configure/Make changes Fix compilation outside of the source tree (except for example cxref docs). Change the directory layout by moving the source into src and READMEs into doc. Output changes Removed the -html20 and -html32 options, the -html output is now version 4.01. Removed the -latex209 and -latex2e options, the -latex output is version 2e. HTML option generates a cxref stylesheet and uses it. *NOTE* The -html[20|32] and -latex[209|2e] options have been removed, use -html and -latex for LaTeX 2e and HTML 4.01 format outputs. Version 1.5g of cxref released : Sun Jun 13 09:30:00 2004 --------------------------------------------------------- Bug fixes New fix allowing a mix of declarations and statements in compound statements. Fix handling of -Afoo=bar options again. Configure/Make changes Add a --without-cxref-cpp option to force using gcc instead of cxref-cpp. cxref-cpp changes cxref-cpp now gets gcc defines and include path at runtime from config file. There is a script cxref-cpp-configure to create this configuration file. Version 1.5f of cxref released : Sat Feb 14 15:00:00 2004 --------------------------------------------------------- Bug fixes Allow mixtures of variable declarations and statements in compound statements. Don't look for argument comment for functions with void arguments. Ensure that variables defined in header file and locally get comments. Fix the text printed for some warnings from the -warn option. Declaring a function as extern is the same as not declaring it local. GCC changes Handle better gcc-3.x putting all of its internal #defines in the output. Handle gcc 3.x style options in the cxref-cpp pre-processor. Compile cxref-cpp if using gcc-3.x that drops comment on same line as #include. Version 1.5e of cxref released : Sun Jun 29 10:30:00 2003 --------------------------------------------------------- Bug fixes Don't lose the comment or value when C++ style comments follow a #define. Updated to work with newer version of flex and SUN version of yacc. Handle references for local functions with the same name in several files. Remove some extra ';' from the HTML output. Handle macros with variable args like MACRO(a,b,...) as well as MACRO(a,b...). GCC changes Handle gcc-3.x putting all of its internal #defines in the output. Compile cxref-cpp if using gcc-3.x that drops comment on same line as #define. Version 1.5d of cxref released : Sun May 05 12:00:00 2002 --------------------------------------------------------- Bug fixes Fixes to HTML and SGML outputs (invalid character entities). Fix bug that stopped -R/ from working. Fix links to HTML source files in certain cases. Keep the sign of negative numbers in #define output. Improve the lex code (flex -s). Add some missing ';' to yacc code. Fix the bison debugging output. Change the use of IFS in cxref-ccc script. Configure/Make changes Fix Makefile to compile using non-GNU make programs. Add flex specific options to the Makefile if using it. Fixes for build/configure outside the source tree. Include DESTDIR in the Makefile to help installation. Configure makes a guess what to do with cxref-cpp if gcc is not installed. GCC changes Accept the gcc-3.0 __builtin_va_list type as-if it were a valid C type. Handle the GCC __builtin_va_arg extension keyword. Handle the GCC floating point hex extension data format. Allow the use of gcc-3.x instead of the cxref-cpp program. Version 1.5c of cxref released : Sat Apr 28 16:45:00 2001 --------------------------------------------------------- Bug fixes Better Comment handling. Allow the __restrict keyword. Allow bracketed function declarations. Remove gcc compilation warnings. Allow the configure script to be run from a different directory. Optimisation Speed up the lex code. Version 1.5b of cxref released : Sun Sep 26 10:00:00 1999 --------------------------------------------------------- Bug fixes Comments that use the '+html+' convention appear correctly in the HTML source output. More configurable Makefile (CFLAGS and LDFLAGS options to configure). Increase the length of static arrays for getcwd(). Fix NAME_MAX compilation problem. Fix deferencing NULL pointer problem. Optimisation Speed up the cross referencing, especially for the first pass with no outputs. Version 1.5a of cxref released : Fri Jun 18 19:15:00 1999 --------------------------------------------------------- Bug fixes Fix the "+html+" etc in comments. Make verbatim comments work in LaTeX output. Allow $ in function and variable names. Allow the configure to force cxref-cpp instead of gcc. Tidy the Makefiles. Increase the size of statically allocated arrays in cross referencing. Remove the problem of #line directives causing confusion. Handle more GNU C extensions. Fix references to the source file from the HTML. Handle C++ comments following #defines. Output The full cxref and cpp command lines are displayed as comments in output files. Version 1.5 of cxref released : Sun Feb 21 12:00:00 1999 -------------------------------------------------------- Bug fixes Fix the FAQ to HTML converter. Stop comments in header files leaking out. Configuration Use the GNU autoconf program to create a configure script. Now uses gcc instead of cxref-cpp if it is new enough (version >= 2.8.0). Now compiles and runs under MS Win32 with the cygwin library. Output Added SGML (Linuxdoc DTD) output. Added RTF (Rich Text Format) output. Added HTML 3.2 output (with tables). Added an HTML version of the source file with links into it. Tools Provided a Perl script to automatically determine required header files. *NOTE* The -html and -latex options are deprecated, use -html20 and -latex209 for the previous functionality. Version 1.4c of cxref not released : Sat Dec 6 14:30:00 1998 ------------------------------------------------------------ Bug fixes Miscellaneous parsing of C source code. Command line file/pathname parsing. More GNU extensions. More support for other operating systems. FAQ updates. Version 1.4b of cxref released : Sat Apr 18 19:30:00 1998 --------------------------------------------------------- The patches that made it onto the cxref bug-fix web-page. cxref-cpp fails to compile with new Linux. Memory hungry comment parsing. Missing comments on function pointer typedefs, missing directory on some included files. Allow empty structure/unions to be defined. Fix includes that use absolute path to subdir of -R root. Other bugs Fix the install.sh program. Added __typeof and __alignof. Be more careful about the child exit status. Improve cxref-cc error messages. Make the comment handling a lot more memory efficient. Ensure that there is never any memory that is not freed at the end. Version 1.4a of cxref released : Thu Nov 20 20:30:00 1997 --------------------------------------------------------- The patches that made it onto the cxref bug-fix web-page. bug in -CPP option, 'volatile const' and 'const volatile' types, stopped crashes due to NULL pointer access, made the makefile work better on certain UNIX versions. Added a -no-comments option. Make the comment mangler better so that lines with just whitespace are emptied. Allow blank lines and comments in the .cxref file. Version 1.4 of cxref released : Sat Jul 5 18:30:00 1997 ------------------------------------------------------- Included a shell script to replace gcc to compile and cross-reference in one go. Added in the option to change directory before running cxref. Added a config file called .cxref that can contain command line arguments. Changed the way that included variables and functions are dealt with. Functions and variables that are included as static or global so that they would be in the object file when compiled are listed as belonging to the file with a pointer to the header file that they were included from. Added in a way to allow extended markup (HTML or LaTeX) inside comments. Major re-write of the internals to increase maintainability & readability. Added in -verbatim-comments to preserve formatting of comments in output. Added in -block-comments to strip leading character from boxed comments. Added an option to allow files to be deleted from the cross reference output. Changed over to GCC V 2.7.2, reduced the patch size by moving stuff to cxref. Added in a new command line option to pass extra arguments to the pre-processor. Fixed the rest of the bug reports that made it onto the cxref bug-fix web-page. Version 1.3a of cxref unreleased : Wed Apr 23 20:00:00 1997 ----------------------------------------------------------- The patches that made it onto the cxref bug-fix web-page. Version 1.3 of cxref released : Sun Dec 8 10:30:00 1996 ------------------------------------------------------- Added manual pages for the programs. Use the Linux Kernel source code to test the parser. Added more GNU C extensions. Fixed more errors in type names used as identifiers. Added the ability to parse C++ comments (not for documenting). Version 1.3-beta of cxref released : Sat Nov 16 16:30:00 1996 ------------------------------------------------------------- This is a consolidation of versions 1.2, 1.2a, 1.2b plus trivial changes. Fixed some remaining problems with implicit integer types and type qualifiers. HTML output conforms to HTML 2.0 standard, and passes weblint test. HTML, LaTeX and raw outputs have ';'s added in structure defintions. Updated FAQ, added FAQ -> html conversion script, updated README, README.html and README.tex, added TODO. The cxref-cpp program now does not need machine specific hand customisation. Improved the Makefiles to simplify the installation: Fully automatic configuring of cxref-cpp, all build options in a single Makefile configuration file, installation included. Version 1.2b of cxref released : Sat Oct 5 13:30:00 1996 --------------------------------------------------------- Function definitions included from header files do not cause cxref to core dump. Removed dangling cross-references for referenced vars/funcs in the output. Function prototypes within function definitions do not cause loss of references. Typedefs of function types now recognised when used as prototypes. Comments for nested struct/union types now work and the output format changed. The option -warn-xref depends on -xref, warns user if used wrongly but works OK. The index in the cxref.html file is now always at the end in the correct place. The LaTeX output is centred on the page correctly. The cxref-cpp program no longer aborts on certain files in multi-directory source trees, and if the preprocessor does abort then cxref tidies up cleanly. The cxref-query program no longer core dumps on certain cross-references. Version 1.2a of cxref released : Sat Aug 17 13:00:00 1996 --------------------------------------------------------- Bug fixes in the parser for obscure C syntax: Type names used as identifiers, pointer to function used as a function argument, some K&R style function definitions, complete set of integer type names, more GCC extensions. Version 1.2 of cxref released : Sat Jul 6 20:00:00 1996 -------------------------------------------------------- A FAQ is provided with common questions and answers to provide help. Major revision of parsing code, especially for function definitions. Labeled statements do not need a ';' (e.g. default in switch statement). Better handling of traditional style function definitions Variables declared extern within a function recognised and referenced. Numerous minor bugs in parsing corrected. Line number and file name information available in case of parse error. Parse errors are handled gracefully, the program does not just exit. Create sub-directories of the output directory as needed. Better handling of include pathnames in cxref-cpp, for subdirectories. Added a cxref.sty LaTeX style file instead of at the top of the main file. The output files are not compatible with Version 1.1 output files. Version 1.1 of cxref released : Wed May 22 19:00:00 1996 -------------------------------------------------------- Fixed a number of bugs in the 'front-end' of the program. Makefile changed to make ANSI compatible latex-style.c source file. Lexical analyser code fixed to work with a POSIX lex program. GNU __attribute__ & __extension__ compiler directives handled better. Better debugging options for the parser. Bit-fields now parsed correctly and recognised as such in output. Enum typedefs allowed to have a trailing comma. Function definitions with no return type are now recognised as int and those with no arguments recognised as void. Allows the asm() GNU extension. Fixed a problem with #include confusion with mix of global and local files. Version 1.0 of cxref released : Sat Feb 24 16:30:00 1996 -------------------------------------------------------- A program that can automatically generate documentation and cross references for a C program. The input is any C program with appropriate comments and the output is LaTeX or HTML files. The documentation for the program is produced from comments in the code that are appropriately formatted. The cross referencing comes from the code itself and requires no extra work. cxref-1.6d/doc/README 644 233 144 44113 11642330446 7456 0 C Cross Referencing & Documenting tool. Version 1.6 - cxref =========================================================== A program that can automatically generate documentation and cross references for a C program. The input is any C program with appropriate comments and the output is LaTeX, HTML, RTF or SGML files. -------------------------------------------------------------------------------- ------------------------------- Program Options -------------------------------- -------------------------------------------------------------------------------- The name of the program is cxref. Usage: cxref filename [ ... filename] [-Odirname] [-Nbasename] [-Rdirname] [-all-comments] [-no-comments] [-verbatim-comments] [-block-comments] [-xref[-all][-file][-func][-var][-type]] [-warn[-all][-comment][-xref]] [-index[-all][-file][-func][-var][-type]] [-raw] [-latex] [-html[-src]] [-rtf] [-sgml] [-Idirname] [-Ddefine] [-Udefine] [-CPP cpp_program] [-- cpp_arg [ ... cpp_arg]] Usage: cxref filename [ ... filename] -delete [-Odirname] [-Nbasename] [-Rdirname] filename The name of the file to document, any number of files may be documented at a time. -delete The files named are to be deleted from the output directory and their entries in the cross reference database and main output files are to be removed. -Odirname The name of a directory to use for the output latex files and the location of the cross reference files that are created. -Nbasename The name to use for the first part of the output and cross reference files instead of cxref, the file extensions remain the same. -Rdirname When the source files are in more than one directory, set dirname to the name of the root directory of the source tree (use relative path if easier e.g. `-R../..'). This will then run cxref from that root directory and the `-Odirname' must be relative to that directory. -all-comments In case you think that the existing comments might work, (see below for description of special comments). [Danger! This option can produce weird results.] -no-comments Ignores all comments, useful if you just want the cross references and not the documentation. -verbatim-comments When the comments that you have in the code are formatted in a predetermined style that you want to preserve on the output, this option will force them not to be reformatted. [Note, this is for file and function comments only.] -block-comments When the comments in the program are formatted in the `block' style (with a leading `*' character on every line), this option will remove that character from the output. [Works for a single `*', `+', `|' or `:' on each line.] -xref Produce cross referencing information (see below). -all All cross references. -file Cross references for files. -func Cross references for functions. -var Cross references for variables. -type Cross references for types. -warn Produce warnings, the options must be concatenated together: -all All warnings. -comment Warn of missing comments. -xref Warn of missing cross references. -index Produce a cross reference index, the options must be concatenated together: -all All indexes. -file Index of files. -func Index of functions. -var Index of variables. -type Index of types. -raw Produce a raw form of output, not really of much use except with -warn. -latex Produce a LaTeX file to document each of the source files and also an extra file that includes each of these files. -html Produce an HTML 4.01 file to document each of the source files and a main file to reference each of these files. -html-src Produce the HTML output and an HTML version of the source file with links into it. -rtf Produce a Rich Text Format (RTF) file to document the source file. -sgml Produce an SGML file to document the source file. (Using the LinuxDoc DTD). -Idirname GCC option to specify the path for include files. -Ddefine GCC option to define a pre-processor symbol. -Udefine GCC option to undefine a pre-processor symbol. -CPP program The name of the program to use instead of the compile time default. The program must be able to perform all of the actions that `gcc -E -C -dD' does to work. If the program takes arguments then the whole thing needs to be in quotes so that it is interpreted as a single argument to cxref. -- arg ... arg Extra arguments to be passed to the pre-processor can be placed after the `--' separator. -------------------------------------------------------------------------------- ----------------------- C Compiler Replacement cxref-cc ------------------------ -------------------------------------------------------------------------------- To simplify using cxref on existing source code, there is now a shell script that will call the C compiler and then call cxref to process the source file. This means that it can be used as a drop in replacement for CC in Makefiles and the like. Usage: cxref-cc [usual cc options] The name of the source file is extracted from the list of options as well as the `-D*', `-I*', `-U*' flags and when the C compiler exits succesfully cxref will be called. The name of the C compiler to use is controlled by the CXREFCC environment variable, or if this is not set then the CC environment variable, or failing this just gcc. Using this script requires the use of a `.cxref' configuration file to contain the options since there is nowhere to put the options on the command line for the C compiler. This will only cross-reference and document the C source files since they are the only ones that are compiled, but it will make sure that they are cross-referenced with the correct options etc. -------------------------------------------------------------------------------- ----------------------- Cxref configuration File .cxref ------------------------ -------------------------------------------------------------------------------- These command line arguments can also be put into a file named `.cxref' instead of on the command line. When cxref is run the arguments to the program are interpreted in the following order. 1) Those on the command line. 2) Those in the `.cxref' file in the current directory. 3) Those in the `.cxref' file in the source tree root specified by `-R'. This means that in a multi-directory source tree, each sub-directory can have a `.cxref' file containing just the line `-R..' or appropriate. The main directory can have a `.cxref' file containing the remainder of the options. This removes completely the need to have any options on the command line apart from the source file names. The format of the `.cxref' file is any number of lines, each one containing a single command line argument (equivalent to one of the argv). The only options that cannot be used are the names of source files themselves and the `-delete' option. Blank lines are ignored and lines starting with a '#' are comments. -------------------------------------------------------------------------------- ------------------------ Program Documentation Comments ------------------------ -------------------------------------------------------------------------------- The documentation for the program is produced from comments in the code that are appropriately formatted. The cross referencing comes from the code itself and requires no extra work. The special comments are `/**** ****/' (for a file) and `/*++++ ++++*/' (for a data object) any number of `*' or `+' can be used inside of the standard `/*' and `*/' comment delimiters in the comments, they are ignored. If a comment line starts with whitespace and is followed by `+html+' then the rest of the line is included only in the HTML output, and is not processed so it can include HTML markup, `-html-' means that the rest of the line is included in all except the HTML output. The same also applies to the other output formats, `+none+' can be used for lines not to appear in any output. The exception to this is that the raw output does not do any checking and will output all lines. In any situation where a comment follows a `,', `;' or `)' separated only by spaces and tabs, the comment is pushed to before the punctuation to apply to object there. The program is implemented using a full ANSI C grammar parser with some GCC extensions, this means that the style of the code is unimportant, only the content and comments. -------------------------------------------------------------------------------- ------------------------- Automated Comment Insertion -------------------------- -------------------------------------------------------------------------------- To simplify the insertion of comments that will be parsed by cxref, the file cxref.el provides a number of Emacs lisp functions. To use them add the line `(load "cxref")' to your `.emacs' file or type `M-x load-file cxref.el' from within Emacs. The functions and key bindings are: Control-C Control-F - Adds file comments, a /** **/ header at the top of the file and if it is a .h file then it also adds a #ifndef, #define at the beginning and #endif at the end to stop multiple inclusions. Control-C f - Adds comments to a function, the cursor must be on the line containing the start of the function definition when this function is called. The /*+ ... +*/ comment that is added is of the header type (see the examples) not inline. Control-C v - Adds a leading comment to the variable or other definition on the current line. Control-C e - Adds a trailing comment at the end of the line. Control-C i - Adds an inline comment that is ignored by cxref. -------------------------------------------------------------------------------- -------------------------------- C Preprocessor -------------------------------- -------------------------------------------------------------------------------- To improve the output that is available a modified version of the GNU CPP V2.7.2 is supplied (named cxref-cpp). This modified C preprocessor allows for a finer control over some features of the preprocessing that are not important for a compiler. In a standard preprocessor, the preprocessor directives are intended for use only by the preprocessor, so passing the information through is not important. With cxref-cpp, there are two features that are different to the standard GNU CPP: 1) The #include directives from the file are output in the same way as the #defines are output. An extra flag has been added to cpp to do this, '-dI', it works in the same way as the existing '-dD' flag for #defines. 2) Comments trailing a #include or a #define are dropped with GNU CPP even if -C is used. This is not important while compiling but is useful for documenting. -------------------------------------------------------------------------------- ------------------------------ Cross Referencing ------------------------------- -------------------------------------------------------------------------------- The cross referencing is performed for the following items Files - The files that the current file is included in (even when included via other files). #includes - Files included in the current file. - Files included by these files etc. Variables - The location of the definition of external variables. - The files that have visibility of global variables. - The files / functions that use the variable. Functions - The file that the function is prototyped in. - The functions that the function calls. - The functions that call the function. - The files and functions that reference the function. - The variables that are used in the function. Each of these items is cross referenced in the output. The cross referencing uses files `cxref.variable', `cxref.function', `cxref.include' and `cxref.typedef' in the output directory. These are a complete list of the function and variable usage in the program and could be used to generate a function call hierarchy or variable usage diagram for example. Two cxref passes of each file is needed, the first to build up the cross referencing files and the second to use them. (The file names are different if the `-N' option is used.) -------------------------------------------------------------------------------- --------------------------------- LaTeX Output --------------------------------- -------------------------------------------------------------------------------- The default LaTeX output is a file for each of the source files with one extra file `cxref.tex' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.tex file has been written it can be modified by the user, any new files that are added are added at the end of the source code section, the rest of the file being unchanged. The index is written to a file called `cxref.apdx.tex' and cxref.tex is updated to refer to it. Also written out are three LaTeX style files `page.sty', `fonts.sty' and `cxref.sty'. These set up the page to use a smaller margin and smaller fonts to allow more to appear on a page and also define the new commands for typesetting the cxref output. (The file names `cxref.tex' and `cxref.apdx.tex' are different if the `-N' option is used.) -------------------------------------------------------------------------------- --------------------------------- HTML Output ---------------------------------- -------------------------------------------------------------------------------- The default HTML output is a file for each of the source files with one extra file `cxref.html' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.html file has been written it can be modified by the user, any new files that are added are added at the end before the table of contents, the rest of the file being unchanged. The index is written to a file called `cxref.apdx.html' and cxref.html is updated to refer to it. (The file names `cxref.html' and `cxref.apdx.html' are different if the `-N' option is used.) The HTML output uses the HTML 4.01 standard and all pages validate correctly. -------------------------------------------------------------------------------- --------------------------------- RTF Output ----------------------------------- -------------------------------------------------------------------------------- Rich Text Format is a fairly low level page description format devised by Microsoft. It is not a well defined and easy to understand standard as are the other formats, but it is popular for document exchange. There is a single output file for each of the source files and an index file. -------------------------------------------------------------------------------- --------------------------------- SGML Output ---------------------------------- -------------------------------------------------------------------------------- Since SGML is a meta-language it is necessary to define the layout elements as well as provide the information. The cxref output uses the LinuxDoc document format and is designed for use with the SGMLtools programs (http://www.sgmltools.org/). There is a single output file for each of the source files and an index file. -------------------------------------------------------------------------------- --------------------------- Example Special Comments --------------------------- -------------------------------------------------------------------------------- See the `README.c' file, to see that the comments are indeed seen in the code, run `cxref README.c -raw', the comments are indicated in chevrons `<<< >>>'. -------------------------------------------------------------------------------- ----------------------------- Further Information ------------------------------ -------------------------------------------------------------------------------- There is a list of frequently asked questions and their answers for the cxref program in the FAQ file. A list of improvements planned for future versions of the program are listed in the file TODO. More up-to-date information can be found on the World Wide Web at the cxref homepage, reached via the author's homepage http://www.gedanken.demon.co.uk/. If you wish to submit bug reports or other comments about the program then email the author amb@gedanken.demon.co.uk and put cxref in the subject line. -------------------------------------------------------------------------------- ----------------------------- Author and Copyright ----------------------------- -------------------------------------------------------------------------------- The cxref program was written by Andrew M. Bishop in 1995-2011. The cxref program is copyright Andrew M. Bishop 1995-2011. The cxref-cpp program is copyright Free Software Foundation, Inc. The cxref and cxref-cpp programs can be freely distributed according to the terms of the GNU General Public License (see the file `COPYING'). cxref-1.6d/doc/README.c 644 233 144 5113 11506061166 7653 0/***************** $Header: /home/amb/CVS/cxref/doc/README.c,v 1.4 1997-05-26 11:23:40 amb Exp $ A comment for the file, RCS header comments are treated specially when first. *****************/ /*+ A #include comment +*/ #include #include /*+ An alternative #include comment. +*/ /*+ A #define comment. +*/ #define def1 1 #define def2 2 /*+ An alternative #define comment. +*/ /*+++++++++++ A #define with args arg1 The first arg arg2 The second arg +++++++++++*/ #define def3(arg1,arg2) (arg1+arg2) /*+ An alternative #define with args. +*/ #define def4(arg1 /*+ The first arg +*/, \ arg2 /*+ The second arg +*/) \ (arg1+arg2) /*+ An example typedef comment +*/ typedef enum { one, /*+ one value +*/ two /*+ another value +*/ } type1; /*+ Another example typedef comment, +*/ typedef struct { int a; /*+ A variable in a struct. +*/ union bar { char a; /*+ Each element +*/ int b, /*+ of a struct +*/ c; /*+ or a union +*/ long d; /*+ can have a comment +*/ } e; /*+ Nested structs and unions also work. +*/ } type2, /*+ a type that is a struct. +*/ *ptype2; /*+ a pointer to a struct type. +*/ /*+ A leading comment only. +*/ int var1,var2; static int var3; /*+ A trailing comment only. +*/ /*+ A variable for +*/ int var4, /*+ one thing. +*/ var5, /*+ a second thing. +*/ var6; /*+ a third thing. +*/ /* Note: The leading comment is combined with each of the trailing comments. */ /* Note: the push through of the comment above on the ',' and ';', see README. */ /*+++++++++++ A function comment (the comments for the args need to be separated by a blank line). int function1 The return value. int arg1 The first argument. int arg2 The second argument. Some more comments +none+ Note: this line and the two below are processed specially. +html+ This comment is only visible in the HTML output, and can contain HTML markup. +latex+ This comment is only visible in the \LaTeX output, and can contain \LaTeX markup. +++++++++++*/ int function1(int arg1,int arg2) { /*+ An internal comment in a function that appears as a new paragraph at the end of the comment. +*/ var1=0; function2(var3,var4); } /*+ An alternative function comment +*/ int function2(int arg1, /*+ The first argument. +*/ int arg2) /*+ The second argument. +*/ /*+ Returns a value +*/ { int (*funcp)()=&function1; } /* Note: the push through of the comment above on the ',' and ')', see README. */ cxref-1.6d/doc/README.c.html 644 233 144 32322 11642337054 10643 0 Cross reference for README.c of README-TMP.

    File README.c

    RCS Header: /home/amb/CVS/cxref/doc/README.c,v 1.4 1997-05-26 11:23:40 amb Exp

    A comment for the file, RCS header comments are treated specially when first.


    Included Files

    A #include comment

    • #include <stdio.h>
    An alternative #include comment.

    • #include <math.h>

    Preprocessor definitions

    A #define comment.

    #define def1 1

    An alternative #define comment.

    #define def2 2

    A #define with args

    #define def3( arg1, arg2 )

    arg1
    The first arg
    arg2
    The second arg

    An alternative #define with args.

    #define def4( arg1, arg2 )

    arg1
    The first arg
    arg2
    The second arg

    Typedef type1

    An example typedef comment

    typedef enum {...} type1
    enum  
       {  
          one; one value
          two; another value
       }  


    Type union bar

    Nested structs and unions also work.

    union bar
    union bar  
       {  
          char a; Each element
          int b; of a struct
          int c; or a union
          long d; can have a comment
       }  


    Typedef type2

    Another example typedef comment, a type that is a struct.

    typedef struct {...} type2
    struct  
       {  
          int a; A variable in a struct.
          union bar  
            {  
                char a; Each element
                int b; of a struct
                int c; or a union
                long d; can have a comment
            }  
         e; Nested structs and unions also work.
       }  


    Typedef ptype2

    Another example typedef comment, a pointer to a struct type.

    typedef struct {...}* ptype2
    See: Typedef type2


    Global Variable var1

    A leading comment only.

    int var1
    Visible in:   README.c
    Used in: function1() README.c


    Global Variable var2

    A leading comment only.

    int var2
    Visible in:   README.c


    Global Variable var4

    A variable for one thing.

    int var4
    Visible in:   README.c
    Used in: function1() README.c


    Global Variable var5

    A variable for a second thing.

    int var5
    Visible in:   README.c


    Global Variable var6

    A variable for a third thing.

    int var6
    Visible in:   README.c


    Local Variables

    var3
    A trailing comment only.

    static int var3
    Used in: function1()  


    Global Function function1()

    A function comment (the comments for the args need to be separated by a blank line).

    int function1 ( int arg1, int arg2 )

    int function1
    The return value.
    int arg1
    The first argument.
    int arg2
    The second argument.
    Some more comments
    This comment is only visible in the HTML output, and can contain HTML markup.
    An internal comment in a function that appears as a new paragraph at the end of the comment.

    Calls: function2() README.c
    Used in: function2() README.c
    References Variables: var1 README.c
      var3 README.c
      var4 README.c


    Global Function function2()

    An alternative function comment

    int function2 ( int arg1, int arg2, void )

    int function2
    Returns a value
    int arg1
    The first argument.
    int arg2
    The second argument.
    void
     
    Called by: function1() README.c
    References Functions: function1() README.c
    cxref-1.6d/doc/README.c.rtf 644 233 144 16536 11642337054 10503 0{\rtf\ansi \deff0 {\fonttbl {\f0\froman Times New Roman;} {\f1\fmodern Courier New;} } {\stylesheet {\s0\f0\fs24 Normal;} {\s1\f0\fs40\b\sb400\sa200\keepn\keep Heading 1;} {\s2\f0\fs32\b\sb200\sa100\keepn\keep Heading 2;} {\s3\f0\fs28\b\sb100\sa100\keepn\keep Heading 3;} {\s4\f0\fs24\b\sb100\sa50\keepn\keep Heading 4;} {\s5\f1\fs20\ql\sb50\sa50 Code;} } {\info{\comment This RTF file generated by cxref (version 1.6d). cxref program (c) Andrew M. Bishop 1995-2011. Cxref: ../src/cxref -O. -NREADME-TMP -xref -latex -html-src -rtf -sgml README.c CPP : /home/amb/cxref/cpp/cxref-cpp -cxref-cpp-defines /home/amb/cxref/cpp/cxref-cpp.defines -lang-c -C -dD -dI }} \paperw11880\paperh16848\margl1440\margr1440\margt1440\margb1440 \sectd\plain \s0\f0\fs24 {\s1\f0\fs40\b\sb400\sa200\keepn\keep File README.c\par} {\b RCS Header: /home/amb/CVS/cxref/doc/README.c,v 1.4 1997-05-26 11:23:40 amb Exp}\par A comment for the file, RCS header comments are treated specially when first.\par {\s2\f0\fs32\b\sb200\sa100\keepn\keep Included Files\par} A #include comment\par {\s5\f1\fs20\ql\sb50\sa50 #include \par} An alternative #include comment.\par {\s5\f1\fs20\ql\sb50\sa50 #include \par} {\s2\f0\fs32\b\sb200\sa100\keepn\keep Preprocessor definitions\par} A #define comment.\par {\s5\f1\fs20\ql\sb50\sa50 #define def1 1\par} An alternative #define comment.\par {\s5\f1\fs20\ql\sb50\sa50 #define def2 2\par} A #define with args\par {\s5\f1\fs20\ql\sb50\sa50 #define def3( arg1, arg2 )\par} {\s5\f1\fs20\ql\sb50\sa50arg1\par} {\s6\f0\fs24\ql\li720 The first arg\par} {\s5\f1\fs20\ql\sb50\sa50arg2\par} {\s6\f0\fs24\ql\li720 The second arg\par} An alternative #define with args.\par {\s5\f1\fs20\ql\sb50\sa50 #define def4( arg1, arg2 )\par} {\s5\f1\fs20\ql\sb50\sa50arg1\par} {\s6\f0\fs24\ql\li720 The first arg\par} {\s5\f1\fs20\ql\sb50\sa50arg2\par} {\s6\f0\fs24\ql\li720 The second arg\par} {\s2\f0\fs32\b\sb200\sa100\keepn\keep Type definitions\par} {\s3\f0\fs28\b\sb100\sa100\keepn\keep Typedef type1\par} An example typedef comment\par {\s5\f1\fs20\ql\sb50\sa50 typedef enum \{...\} type1\par} \trowd\trgaph120\cellx2880\cellx9000 \intbl\plain {\s5\f1\fs20\ql\sb50\sa50 enum}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 \{}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 one;}\cell one value\cell\row {\s5\f1\fs20\ql\sb50\sa50 two;}\cell another value\cell\row {\s5\f1\fs20\ql\sb50\sa50 \}}\cell\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Type union bar\par} Nested structs and unions also work.\par \trowd\trgaph120\cellx2880\cellx9000 \intbl\plain {\s5\f1\fs20\ql\sb50\sa50 union bar}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 \{}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 char a;}\cell Each element\cell\row {\s5\f1\fs20\ql\sb50\sa50 int b;}\cell of a struct\cell\row {\s5\f1\fs20\ql\sb50\sa50 int c;}\cell or a union\cell\row {\s5\f1\fs20\ql\sb50\sa50 long d;}\cell can have a comment\cell\row {\s5\f1\fs20\ql\sb50\sa50 \}}\cell\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Typedef type2\par} Another example typedef comment, a type that is a struct.\par {\s5\f1\fs20\ql\sb50\sa50 typedef struct \{...\} type2\par} \trowd\trgaph120\cellx2880\cellx9000 \intbl\plain {\s5\f1\fs20\ql\sb50\sa50 struct}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 \{}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 int a;}\cell A variable in a struct.\cell\row {\s5\f1\fs20\ql\sb50\sa50 union bar}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 \{}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 char a;}\cell Each element\cell\row {\s5\f1\fs20\ql\sb50\sa50 int b;}\cell of a struct\cell\row {\s5\f1\fs20\ql\sb50\sa50 int c;}\cell or a union\cell\row {\s5\f1\fs20\ql\sb50\sa50 long d;}\cell can have a comment\cell\row {\s5\f1\fs20\ql\sb50\sa50 \}}\cell\cell\row {\s5\f1\fs20\ql\sb50\sa50 e;}\cell Nested structs and unions also work.\par {\s5\f1\fs20\ql\sb50\sa50 \}}\cell\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Typedef ptype2\par} Another example typedef comment, a pointer to a struct type.\par {\s5\f1\fs20\ql\sb50\sa50 typedef struct \{...\}* ptype2\par} See: Typedef type2\par {\s2\f0\fs32\b\sb200\sa100\keepn\keep Variables\par} {\s3\f0\fs28\b\sb100\sa100\keepn\keep Variable var1\par} A leading comment only.\par {\s5\f1\fs20\ql\sb50\sa50 int var1\par} \trowd\trgaph120\cellx1440\cellx5220\cellx9000 \intbl\plain Visible in:\cell README.c\cell\cell\row Used in:\cell function1()\cell README.c\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Variable var2\par} A leading comment only.\par {\s5\f1\fs20\ql\sb50\sa50 int var2\par} \trowd\trgaph120\cellx1440\cellx5220\cellx9000 \intbl\plain Visible in:\cell README.c\cell\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Variable var4\par} A variable for one thing.\par {\s5\f1\fs20\ql\sb50\sa50 int var4\par} \trowd\trgaph120\cellx1440\cellx5220\cellx9000 \intbl\plain Visible in:\cell README.c\cell\cell\row Used in:\cell function1()\cell README.c\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Variable var5\par} A variable for a second thing.\par {\s5\f1\fs20\ql\sb50\sa50 int var5\par} \trowd\trgaph120\cellx1440\cellx5220\cellx9000 \intbl\plain Visible in:\cell README.c\cell\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Variable var6\par} A variable for a third thing.\par {\s5\f1\fs20\ql\sb50\sa50 int var6\par} \trowd\trgaph120\cellx1440\cellx5220\cellx9000 \intbl\plain Visible in:\cell README.c\cell\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Local Variables\par} {\s4\f0\fs24\b\sb100\sa50\keepn\keep Variable var3\par} A trailing comment only.\par {\s5\f1\fs20\ql\sb50\sa50 static int var3\par} \trowd\trgaph120\cellx1440\cellx5220\cellx9000 \intbl\plain Used in:\cell function1()\cell\cell\row \intbl0 {\s2\f0\fs32\b\sb200\sa100\keepn\keep Functions\par} {\s3\f0\fs28\b\sb100\sa100\keepn\keep Global Function function1()\par} A function comment (the comments for the args need to be separated by a blank line). Some more comments An internal comment in a function that appears as a new paragraph at the end of the comment.\par {\s5\f1\fs20\ql\sb50\sa50 int function1 ( int arg1, int arg2 )\par} {\s5\f1\fs20\ql\sb50\sa50 int function1\par} {\s6\f0\fs24\ql\li720 The return value.\par} {\s5\f1\fs20\ql\sb50\sa50 int arg1\par} {\s6\f0\fs24\ql\li720 The first argument.\par} {\s5\f1\fs20\ql\sb50\sa50 int arg2\par} {\s6\f0\fs24\ql\li720 The second argument.\par} \trowd\trgaph120\cellx1440\cellx5220\cellx9000 \intbl\plain Calls: \cell function2()\cell README.c\cell\row Used in:\cell function2()\cell README.c\cell\row Refs Var:\cell var1\cell README.c\cell\row \cell var3\cell README.c\cell\row \cell var4\cell README.c\cell\row \intbl0 {\s3\f0\fs28\b\sb100\sa100\keepn\keep Global Function function2()\par} An alternative function comment\par {\s5\f1\fs20\ql\sb50\sa50 int function2 ( int arg1, int arg2, void )\par} {\s5\f1\fs20\ql\sb50\sa50 int function2\par} {\s6\f0\fs24\ql\li720 Returns a value\par} {\s5\f1\fs20\ql\sb50\sa50 int arg1\par} {\s6\f0\fs24\ql\li720 The first argument.\par} {\s5\f1\fs20\ql\sb50\sa50 int arg2\par} {\s6\f0\fs24\ql\li720 The second argument.\par} {\s5\f1\fs20\ql\sb50\sa50 void\par} {\s6\f0\fs24\ql\li720 \par} \trowd\trgaph120\cellx1440\cellx5220\cellx9000 \intbl\plain Called by:\cell function1()\cell README.c\cell\row Refs Func:\cell function1()\cell README.c\cell\row \intbl0 } cxref-1.6d/doc/README.c.sgml 644 233 144 12751 11642337054 10645 0
    Cross reference for README.c of README-TMP. <author>cxref <sect>File README.c <bf>RCS Header: /home/amb/CVS/cxref/doc/README.c,v 1.4 1997-05-26 11:23:40 amb Exp </bf> <p> A comment for the file, RCS header comments are treated specially when first. <p> <sect1>Included Files <p> A #include comment <p> <itemize> <item><tt>#include <stdio.h></tt> </itemize> An alternative #include comment. <p> <itemize> <item><tt>#include <math.h></tt> </itemize> <sect1>Preprocessor definitions <p> A #define comment. <p> <tt>#define def1 1</tt><newline> <p> An alternative #define comment. <p> <tt>#define def2 2</tt><newline> <p> A #define with args <p> <tt>#define def3( arg1, arg2 )</tt><newline> <descrip> <tag><tt>arg1</tt></tag> The first arg <tag><tt>arg2</tt></tag> The second arg </descrip> <p> An alternative #define with args. <p> <tt>#define def4( arg1, arg2 )</tt><newline> <descrip> <tag><tt>arg1</tt></tag> The first arg <tag><tt>arg2</tt></tag> The second arg </descrip> <sect1>Typedef type1 <p> An example typedef comment <p> <tt>typedef enum {...} type1</tt><newline> <itemize> <item><tt>enum</tt><newline> <itemize> <item><tt>{</tt><newline> <item><tt>one; </tt> one value <newline> <item><tt>two; </tt> another value <newline> <item><tt>}</tt><newline> </itemize> </itemize> <sect1>Type union bar <p> Nested structs and unions also work. <p> <itemize> <item><tt>union bar</tt><newline> <itemize> <item><tt>{</tt><newline> <item><tt>char a; </tt> Each element <newline> <item><tt>int b; </tt> of a struct <newline> <item><tt>int c; </tt> or a union <newline> <item><tt>long d; </tt> can have a comment <newline> <item><tt>}</tt><newline> </itemize> </itemize> <sect1>Typedef type2 <p> Another example typedef comment, a type that is a struct. <p> <tt>typedef struct {...} type2</tt><newline> <itemize> <item><tt>struct</tt><newline> <itemize> <item><tt>{</tt><newline> <item><tt>int a; </tt> A variable in a struct. <newline> <item><tt>union bar</tt><newline> <itemize> <item><tt>{</tt><newline> <item><tt>char a; </tt> Each element <newline> <item><tt>int b; </tt> of a struct <newline> <item><tt>int c; </tt> or a union <newline> <item><tt>long d; </tt> can have a comment <newline> <item><tt>}</tt><newline> </itemize> <item><tt>e; </tt> Nested structs and unions also work. <newline> <item><tt>}</tt><newline> </itemize> </itemize> <sect1>Typedef ptype2 <p> Another example typedef comment, a pointer to a struct type. <p> <tt>typedef struct {...}* ptype2</tt><newline> <descrip> <tag>See:</tag> <itemize> <item>Typedef type2 </itemize> </descrip> <sect1>Global Variable var1 <p> A leading comment only. <p> <tt>int var1</tt><newline> <descrip> <tag>Visible in:</tag> <itemize> <item>README.c </itemize> <tag>Used in:</tag> <itemize> <item>function1() : README.c </itemize> </descrip> <sect1>Global Variable var2 <p> A leading comment only. <p> <tt>int var2</tt><newline> <descrip> <tag>Visible in:</tag> <itemize> <item>README.c </itemize> </descrip> <sect1>Global Variable var4 <p> A variable for one thing. <p> <tt>int var4</tt><newline> <descrip> <tag>Visible in:</tag> <itemize> <item>README.c </itemize> <tag>Used in:</tag> <itemize> <item>function1() : README.c </itemize> </descrip> <sect1>Global Variable var5 <p> A variable for a second thing. <p> <tt>int var5</tt><newline> <descrip> <tag>Visible in:</tag> <itemize> <item>README.c </itemize> </descrip> <sect1>Global Variable var6 <p> A variable for a third thing. <p> <tt>int var6</tt><newline> <descrip> <tag>Visible in:</tag> <itemize> <item>README.c </itemize> </descrip> <sect1>Local Variables <p> <bf>var3</bf><newline> A trailing comment only. <p> <tt>static int var3</tt><newline> <descrip> <tag>Used in:</tag> <itemize> <item>function1() </itemize> </descrip> <sect1>Global Function function1() <p> A function comment (the comments for the args need to be separated by a blank line). <p> <tt>int function1 ( int arg1, int arg2 )</tt><newline> <descrip> <tag><tt>int function1</tt></tag> The return value. <tag><tt>int arg1</tt></tag> The first argument. <tag><tt>int arg2</tt></tag> The second argument. </descrip> Some more comments <newline> <newline> An internal comment in a function that appears as a new paragraph at the end of the comment. <p> <descrip> <tag>Calls:</tag> <itemize> <item>function2() : README.c </itemize> <tag>Used in:</tag> <itemize> <item>function2() : README.c </itemize> <tag>References Variables:</tag> <itemize> <item>var1 : README.c <item>var3 : README.c <item>var4 : README.c </itemize> </descrip> <sect1>Global Function function2() <p> An alternative function comment <p> <tt>int function2 ( int arg1, int arg2, void )</tt><newline> <descrip> <tag><tt>int function2</tt></tag> Returns a value <tag><tt>int arg1</tt></tag> The first argument. <tag><tt>int arg2</tt></tag> The second argument. <tag><tt>void</tt></tag>   </descrip> <descrip> <tag>Called by:</tag> <itemize> <item>function1() : README.c </itemize> <tag>References Functions:</tag> <itemize> <item>function1() : README.c </itemize> </descrip> </article> �����������������������cxref-1.6d/doc/README.c.src.html�������������������������������������������������������������������� 644 � 233 � 144 � 14653 11642337054 11440� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- This HTML file generated by cxref (version 1.6d). --> <!-- cxref program (c) Andrew M. Bishop 1995-2011. --> <!-- Cxref: ../src/cxref -O. -NREADME-TMP -xref -latex -html-src -rtf -sgml README.c CPP : /home/amb/cxref/cpp/cxref-cpp -cxref-cpp-defines /home/amb/cxref/cpp/cxref-cpp.defines -lang-c -C -dD -dI --> <HTML> <HEAD> <TITLE>Source File README.c
    1    | /*****************
    2    |   $Header: /home/amb/CVS/cxref/doc/README.c,v 1.4 1997-05-26 11:23:40 amb Exp $
    3    | 
    4    |   A comment for the file, RCS header comments are treated specially when first.
    5    |   *****************/
    6    | 
    7    | 
    8    | 
    9    | /*+ A #include comment +*/
    10   | #include <stdio.h>
    11   | 
    12   | 
    13   | #include <math.h>  /*+ An alternative #include comment. +*/
    14   | 
    15   | 
    16   | /*+ A #define comment. +*/
    17   | #define def1 1
    18   | 
    19   | 
    20   | #define def2 2  /*+ An alternative #define comment. +*/
    21   | 
    22   | 
    23   | /*+++++++++++
    24   |   A #define with args
    25   | 
    26   |   arg1 The first arg
    27   | 
    28   |   arg2 The second arg
    29   |   +++++++++++*/
    30   | 
    31   | #define def3(arg1,arg2) (arg1+arg2)
    32   | 
    33   | 
    34   | /*+ An alternative #define with args. +*/
    35   | 
    36   | #define def4(arg1 /*+ The first arg  +*/, \
    37   |              arg2 /*+ The second arg +*/) \
    38   |            (arg1+arg2)
    39   | 
    40   | 
    41   | /*+ An example typedef comment +*/
    42   | typedef enum
    43   | {
    44   |  one,            /*+ one value +*/
    45   |  two             /*+ another value +*/
    46   | }
    47   | type1;
    48   | 
    49   | 
    50   | /*+ Another example typedef comment, +*/
    51   | typedef struct
    52   | {
    53   |  int a;         /*+ A variable in a struct. +*/
    54   |  union bar
    55   |   {
    56   |    char a;      /*+ Each element +*/
    57   |    int  b,      /*+ of a struct +*/
    58   |         c;      /*+ or a union +*/
    59   |    long d;      /*+ can have a comment +*/
    60   |   }
    61   |  e;             /*+ Nested structs and unions also work. +*/
    62   | }
    63   | type2,          /*+ a type that is a struct. +*/
    64   | *ptype2;        /*+ a pointer to a struct type. +*/
    65   | 
    66   | 
    67   | /*+ A leading comment only. +*/
    68   | int var1,var2;
    69   | 
    70   | 
    71   | static int var3; /*+ A trailing comment only. +*/
    72   | 
    73   | 
    74   | /*+ A variable for +*/
    75   | int var4,    /*+ one thing. +*/
    76   |     var5,    /*+ a second thing. +*/
    77   |     var6;    /*+ a third thing. +*/
    78   | 
    79   | /* Note: The leading comment is combined with each of the trailing comments. */
    80   | /* Note: the push through of the comment above on the ',' and ';', see README. */
    81   | 
    82   | 
    83   | /*+++++++++++
    84   |   A function comment (the comments for the args need to be separated by a blank line).
    85   | 
    86   |   int function1 The return value.
    87   | 
    88   |   int arg1 The first argument.
    89   | 
    90   |   int arg2 The second argument.
    91   | 
    92   |   Some more comments
    93   | 
    94   |   +none+  Note: this line and the two below are processed specially.
    95   |   +html+  This comment is only visible in the HTML output, and can contain HTML markup.
    96   |   +latex+ This comment is only visible in the \LaTeX output, and can contain \LaTeX markup.
    97   |   +++++++++++*/
    98   | 
    99   | int function1(int arg1,int arg2)
    100  | {
    101  |  /*+ An internal comment in a function that appears as a
    102  |    new paragraph at the end of the comment. +*/
    103  | 
    104  |  var1=0;
    105  | 
    106  |  function2(var3,var4);
    107  | }
    108  | 
    109  | 
    110  | /*+ An alternative function comment +*/
    111  | 
    112  | int function2(int arg1,  /*+ The first argument.  +*/
    113  |               int arg2)  /*+ The second argument. +*/
    114  | /*+ Returns a value +*/
    115  | {
    116  |  int (*funcp)()=&function1;
    117  | }
    118  | 
    119  | /* Note: the push through of the comment above on the ',' and ')', see README. */
    
    cxref-1.6d/doc/README.dvi 644 233 144 117530 10150705036 10255 0÷ƒ’À;è TeX output 2004.11.23:1906‹ÿÿÿÿ Ï ýؤ Ï ý’û2óÂÖN ½q cmbx12ºChapter‘Ç 1ŽŸ-óÂÖN áH cmbx12»C‘ŒïCross–"Referencing“&“Do‘Ç cumen‘ÿ8õtingŽŸto‘Ç ol.‘ p¤V‘ýªáersion– T{1.6“-“cxrefŽŸ4óKñ`y cmr10²A–UUprogram“that“can“automatically“generate“doGcumen¸ãtation“and“cross“references“for“a“C“program.ޤ The–­sinput“is“anš¸ãy“C‘­Hprogram“with“appropriate“commen˜ts“and“the“output“is“LŸýó5‘üffóÙ“ Rcmr7±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxX,‘ÏHTML,“R‘ÿ*ªTF‘­Hor“SGMLŽ¡ les.ŽŸÁóÂÖN ff cmbx12½1.1Ž‘$æcProgram‘ffOptionsŽŸç²The–UUname“of“the“program“is“cxref.ŽŸbdýŸ«ædUsage:‘qÇóßêŸ'EŽ‘ãxX les“and“the“loGcation“of“the“crossŽ¡‘HEreference–UU les“that“are“created.ަ‘Å<¾-NbasenameŽŽ‘HE²The–Çname“to“use“for“the“ rst“part“of“the“output“and“cross“reference“ les“instead“of“cxref,Ž¡‘HEthe–UU le“extensions“remain“the“same.ަ‘9¾-RdirnameŽŽ‘HE²When–Ámthe“source“ les“are“in“more“than“one“directory‘ÿ*ª,‘Üsset“dirname“to“the“name“of“theŽ¡‘HEroGot–’directory“of“the“source“tree“(use“relativ¸ãe“path“if“easier“e.g.–©~\-R../..").“This‘’willŽ¡‘HEthen–‘Çrun“cxref“from“that“rošGot“directory“and“the“\-Odirname"“m¸ãust“b˜e“relativ¸ãe“to“thatŽ¡‘HEdirectory‘ÿ*ª.ަ‘ÿE¾-all-commentsŽŽ‘HE²In–>ªcase“yš¸ãou“think“that“the“existing“commen˜ts“migh˜t“w˜ork,‘C2(see“bGelo˜w“for“description“ofŽ¡‘HEspGecial‘UUcommen¸ãts).‘qÇóý': cmti10¿[Danger!‘™–This–“çoption“c›ÿ}'an“pr˜o˜duc˜e“weir˜d“r˜esults.]ŽŽŸG’ßX²1ŽŽŒ‹* Ï ýؤ’¾¯ÿ²2ŽŽ Ï ýLû2‘EB¾-no-commentsŽŽ‘HE²Ignores–þ@all“commenš¸ãts,‘«useful“if“y˜ou“just“w˜an˜t“the“cross“references“and“not“the“doGcumen-ޤ ‘HEtation.Ž©‘äÅT¾-verbatim-commentsŽŽ‘HE²When–j)the“commenš¸ãts“that“y˜ou“ha˜v˜e“in“the“coGde“are“formatted“in“a“predetermined“st˜yleŽ¡‘HEthat–òàyš¸ãou“w˜an˜t“to“preserv˜e“on“the“output,‘Bthis“option“will“force“them“not“to“bGe“refor-Ž¡‘HEmatted.‘qÇ¿[Note,–“çthis“is“for“ le“and“function“c‘ÿ}'omments“only.]ަ‘ô…K¾-block-commentsŽŽ‘HE²When–F›the“commenš¸ãts“in“the“program“are“formatted“in“the“\bloGc˜k"“st˜yle“(with“a“leadingŽ¡‘HE\*"– Ïcš¸ãharacter“on“ev˜ery“line),‘9nthis“option“will“remo˜v˜e“that“c˜haracter“from“the“output.Ž¡‘HE¿[Works–“çfor“a“single“\*",“\+",“\|"“or“\:"‘™–on“e‘ÿ}'ach“line.]ަ‘)-¾-xrefŽŽ‘HE²ProšGduce–UUcross“referencing“information“(see“b˜elo¸ãw).ަ‘vŠH¾-allŽŽ’Š<²All–UUcross“references.ޤ‘qJK¾-fileŽŽ’Š<²Cross–UUreferences“for“ les.Ž¡‘qJK¾-funcŽŽ’Š<²Cross–UUreferences“for“functions.Ž¡‘vŠH¾-varŽŽ’Š<²Cross–UUreferences“for“v‘ÿqÇariables.Ž¡‘qJK¾-typeŽŽ’Š<²Cross–UUreferences“for“t¸ãypGes.ަ‘)-¾-warnŽŽ‘HE²ProGduce–UUwš¸ãarnings,“the“options“m˜ust“bGe“concatenated“together:ަ‘vŠH¾-allŽŽ’Š<²All‘UUw¸ãarnings.Ž¡‘aŠT¾-commentŽŽ’Š<²W‘ÿ*ªarn–UUof“missing“commen¸ãts.Ž¡‘qJK¾-xrefŽŽ’Š<²W‘ÿ*ªarn–UUof“missing“cross“references.ަ‘#Å0¾-indexŽŽ‘HE²ProšGduce–UUa“cross“reference“index,“the“options“m¸ãust“b˜e“concatenated“together:ަ‘vŠH¾-allŽŽ’Š<²All‘UUindexes.Ž¡‘qJK¾-fileŽŽ’Š<²Index–UUof“ les.Ž¡‘qJK¾-funcŽŽ’Š<²Index–UUof“functions.Ž¡‘vŠH¾-varŽŽ’Š<²Index–UUof“v‘ÿqÇariables.Ž¡‘qJK¾-typeŽŽ’Š<²Index–UUof“t¸ãypGes.ަ‘.E*¾-rawŽŽ‘HE²ProGduce–UUa“raš¸ãw“form“of“output,“not“really“of“m˜uc˜h“use“except“with“-w˜arn.ަ‘#Å0¾-latexŽŽ‘HE²ProšGduce–ã‘a“LaT‘ÿ*ªeX‘ãm le“to“do˜cumenš¸ãt“eac˜h“of“the“source“ les“and“also“an“extra“ le“thatޤ ‘HEincludes–UUeac¸ãh“of“these“ les.ަ‘)-¾-htmlŽŽ‘HE²ProšGduce–n°an“HTML‘ng4.01“ le“to“do˜cumenš¸ãt“eac˜h“of“the“source“ les“and“a“main“ le“toŽ¡‘HEreference–UUeac¸ãh“of“these“ les.ަ‘9¾-html-srcŽŽ‘HE²ProGduce–UUthe“HTML“output“and“an“HTML“vš¸ãersion“of“the“source“ le“with“links“in˜to“it.ަ‘.E*¾-rtfŽŽ‘HE²ProGduce–UUa“Ric¸ãh“T›ÿ*ªext“F˜ormat“(R˜TF)“ le“to“doGcumen¸ãt“the“source“ le.ަ‘)-¾-sgmlŽŽ‘HE²ProšGduce–UUan“SGML“ le“to“do˜cumenš¸ãt“the“source“ le.‘qÇ(Using“the“Lin˜uxDoGc“DTD).ަ‘9¾-IdirnameŽŽ‘HE²GCC–UUoption“to“spGecify“the“path“for“include“ les.ަ‘E6¾-DdefineŽŽ‘HE²GCC–UUoption“to“de ne“a“pre-prošGcessor“sym¸ãb˜ol.ަ‘E6¾-UdefineŽŽ‘HE²GCC–UUoption“to“unde ne“a“pre-prošGcessor“sym¸ãb˜ol.ަ‘EB¾-CPP‘?ýprogramŽŽ‘HE²The–Äöname“of“the“program“to“use“instead“of“the“compile“time“default.‘A¨The“program“m¸ãustŽ¡‘HEbšGe– €able“to“p˜erform“all“of“the“actions“that“\gcc“-E– n-C“-dD"“do˜es– €to“w¸ãork.‘Y+If“the“programŽ¡‘HEtak•¸ães›V:argumen“ts˜then˜the˜whole˜thing˜needs˜to˜bGe˜in˜quotes˜so˜that˜it˜is˜in“terpreted˜asŽ¡‘HEa–UUsingle“argumen¸ãt“to“cxref.ަ‘ô…K¾--–?ýarg“...‘ úargŽŽ‘HE²Extra–‡argumen¸ãts“to“bšGe“passed“to“the“pre-pro˜cessor“can“b˜e“placed“after“the“\{"“separator.ŽŽŽŒ‹ ° Ï ýؤ’¾¯ÿ²3ŽŽ Ï ýLû2½1.2Ž‘$æcC–ffCompiler“ReplacemenŒÌt“cxref-ccŽ©ç²T‘ÿ*ªo–l#simplify“using“cxref“on“existing“source“coGde,‘qÖthere“is“no¸ãw“a“shell“script“that“will“call“the“C‘lcompilerޤ and–éthen“call“cxref“to“prošGcess“the“source“ le.‘ñƒThis“means“that“it“can“b˜e“used“as“a“drop“in“replacemen¸ãtŽ¡for–UUCC“in“Makš¸ãe les“and“the“lik˜e.Ž¡Usage:‘qÇcxref-cc–UU[usual“cc“options]Ž¡The–€¡name“of“the“source“ le“is“extracted“from“the“list“of“options“as“w¸ãell“as“the“\-D*",–Ët\-I*",“\-U*"Ž¡ ags–*—and“when“the“C›*`compiler“exits“succesfully“cxref“will“bGe“called.‘ñThe“name“of“the“C˜compiler“toŽ¡use–Qhis“conš¸ãtrolled“b˜y“the“CXREF˜CC‘Qgen˜vironmen˜t“v‘ÿqÇariable,‘R1or“if“this“is“not“set“then“the“CC‘Qgen˜vironmen˜tŽ¡v‘ÿqÇariable,–UUor“failing“this“just“gcc.Ž¡Using–]*this“script“requires“the“use“of“a“`.cxref‘Ç'“con guration“ le“to“con¸ãtain“the“options“since“there“isŽ¡no¸ãwhere–UUto“put“the“options“on“the“command“line“for“the“C“compiler.Ž¡This–Ywill“only“cross-reference“and“doGcumen¸ãt“the“C‘X½source“ les“since“they“are“the“only“ones“that“areŽ¡compiled,–UUbut“it“will“mak¸ãe“sure“that“they“are“cross-referenced“with“the“correct“options“etc.ŽŸĽ1.3Ž‘$æcCxref–ffcon guration“Fileަ²These–¡Äcommand“line“argumenš¸ãts“can“also“bGe“put“in˜to“a“ le“named“\.cxref‘Ç"“instead“of“on“the“commandŽ¡line.‘qÇWhen–UUcxref“is“run“the“argumenš¸ãts“to“the“program“are“in˜terpreted“in“the“follo˜wing“order.Ž©‘ 8â1.ŽŽŽ‘Those–UUon“the“command“line.ޤ‘ 8â2.ŽŽŽ‘Those–UUin“the“\.cxref‘Ç"“ le“in“the“curren¸ãt“directory‘ÿ*ª.Ž¡‘ 8â3.ŽŽŽ‘Those–UUin“the“\.cxref‘Ç"“ le“in“the“source“tree“rošGot“sp˜eci ed“b¸ãy“\-R".ަThis–p@means“that“in“a“mš¸ãulti-directory“source“tree,‘vúeac˜h“sub-directory“can“ha˜v˜e“a“\.cxref‘Ç"“ le“con˜tainingޤ just–ßÝthe“line“\-R.."›JŸor“appropriate.˜The“main“directory“can“ha•¸ãv“e–ßÝa“\.cxref‘Ç"“ le“con¸ãtaining“the“remainderŽ¡of–\¶the“options.‘‡ëThis“remo•¸ãv“es–\¶completely“the“need“to“ha•¸ãv“e›\¶an“y˜options˜on˜the˜command˜line˜apart˜fromŽ¡the–UUsource“ le“names.Ž¡The–íÀformat“of“the“.cxref“ le“is“anš¸ãy“n˜um˜bGer“of“lines,‘weac˜h“one“con˜taining“a“single“command“line“argumen˜tŽ¡(equiv‘ÿqÇalen¸ãt–IÛto“one“of“the“argv).‘OYThe“only“options“that“cannot“bGe“used“are“the“names“of“source“ lesŽ¡themselvš¸ães–×üand“the“\-delete"“option.‘GÿBlank“lines“are“ignored“and“lines“starting“with“a“`#'“are“commen˜ts.Ž©Ľ1.4Ž‘$æcProgram–ffDos3cumenšŒÌtation“Commen˜tsŽŸç²The–ІdošGcumen¸ãtation“for“the“program“is“pro˜duced“from“commen¸ãts“in“the“co˜de“that“are“appropriatelyŽ¡formatted.‘qÇThe–UUcross“referencing“comes“from“the“coGde“itself“and“requires“no“extra“w¸ãork.Ž¡The–zŠspGecial“commenš¸ãts“are“\/****“****/"“(for“a“ le)“and“\/*++++“++++*/"“(for“a“data“ob‘Ž8ject)“an˜yŽ¡n•¸ãum“bšGer–Q«of“\*"“or“\+"“can“b˜e“used“inside“of“the“standard“\/*"“and“\*/"“commen¸ãt“delimiters“in“theŽ¡commen¸ãts,–UUthey“are“ignored.Ž¡If–É a“commenš¸ãt“line“starts“with“whitespace“and“is“follo˜w˜ed“b˜y“`+h˜tml+'“then“the“rest“of“the“line“is“includedŽ¡only–¶Yin“the“HTML›¶@output,‘Κand“is“not“proGcessed“so“it“can“include“HTML˜markup,‘Κ`-h¸ãtml-'“means“thatŽ¡the–Õrest“of“the“line“is“included“in“all“except“the“HTML‘Ãpoutput.‘A2The“same“also“applies“to“the“other“outputŽ¡formats,‘mz`+none+'–h¦can“bšGe“used“for“lines“not“to“app˜ear“in“an¸ãy“output.‘«¹The“exception“to“this“is“that“theŽ¡raš¸ãw–UUoutput“doGes“not“do“an˜y“c˜hec˜king“and“will“output“all“lines.Ž¡In–Žanš¸ãy“situation“where“a“commen˜t“follo˜ws“a“\,",‘ÜP\;"‘*ƒor“\)"“separated“only“b˜y“spaces“and“tabs,‘ÜPtheŽ¡commen¸ãt–UUis“pushed“to“bGefore“the“punctuation“to“apply“to“the“ob‘Ž8ject“there.Ž¡The–£program“is“implemen¸ãted“using“a“full“ANSI–qC“grammar–£parser“with“some“GCC‘qextensions,‘µ”this“meansŽ¡that–UUthe“st¸ãyle“of“the“cošGde“is“unimp˜ortanš¸ãt,“only“the“con˜ten˜t“and“commen˜ts.ަ½1.5Ž‘$æcAutomated–ffCommenŒÌt“InsertionŽŸç²T‘ÿ*ªo–¶simplify“the“insertion“of“commenš¸ãts“that“will“bGe“parsed“b˜y“cxref,‘ÎIthe“ le“cxref.el“pro˜vides“a“n˜um˜bGerŽ¡of–Ñ Emacs“lisp“functions.‘å'T‘ÿ*ªo“use“them“add“the“line“¾(load‘?ý"cxref")“²to“yš¸ãour“\.emacs"“ le“or“t˜ypGe“¾M-xŽ¡load-file‘?ýcxref.el–UU²from“within“Emacs.Ž¡The–UUfunctions“and“k¸ãey“bindings“are:ŽŽŽŒ‹¡ Ï ýؤ’¾¯ÿ²4ŽŽ Ï ýLû2‘ÿ^Z¿Contr–ÿ}'ol-C‘“çContr“ol-FŽŽ‘]óƒ²Adds–ôå le“commen¸ãts,‘/a“/**“**/“header“at“the“top“of“the“ le“and“if“it“is“a“.h“ le“thenޤ ‘]óƒit–1§also“adds“a“#ifndef,‘h»#de ne“at“the“bGeginning“and“#endif“at“the“end“to“stopŽ¡‘]óƒm¸ãultiple‘UUinclusions.Ž©‘&ý¿Contr‘ÿ}'ol-C‘“çfŽŽ‘]óƒ²Adds–Xcommenš¸ãts“to“a“function,‘XÁthe“cursor“m˜ust“bGe“on“the“line“con˜taining“the“startŽ¡‘]óƒof–…8the“function“de nition“when“this“function“is“called.›qThe“/*+“...˜+*/“commen¸ãtŽ¡‘]óƒthat–UUis“added“is“of“the“header“t¸ãypGe“(see“the“examples)“not“inline.ަ‘%u ¿Contr‘ÿ}'ol-C‘“çvŽŽ‘]óƒ²Adds–UUa“leading“commenš¸ãt“to“the“v‘ÿqÇariable“or“other“de nition“on“the“curren˜t“line.ަ‘%u ¿Contr‘ÿ}'ol-C‘“çeŽŽ‘]óƒ²Adds–UUa“trailing“commen¸ãt“at“the“end“of“the“line.ަ‘&ý¿Contr‘ÿ}'ol-C‘“çiŽŽ‘]óƒ²Adds–UUan“inline“commenš¸ãt“that“is“ignored“b˜y“cxref.ŽŸĽ1.6Ž‘$æcC‘ffPrepros3cessorŽŸç²T‘ÿ*ªo›XÅimpro•¸ãv“e˜the˜output˜that˜is˜a“v‘ÿqÇailable˜a˜moGdi ed˜v“ersion˜of˜the˜GNU–XÄCPP“V2.7.2˜is˜supplied˜(namedŽ¡cxref-cpp).Ž¡This–VýmošGdi ed“C‘Vüprepro˜cessor“alloš¸ãws“for“a“ ner“con˜trol“o˜v˜er“some“features“of“the“preproGcessing“that“areŽ¡not–¼|impšGortan¸ãt“for“a“compiler.‘§=In“a“standard“prepro˜cessor,‘ÖFthe“prepro˜cessor“directivš¸ães“are“in˜tended“forŽ¡use–UUonly“b¸ãy“the“preprošGcessor,“so“passing“the“information“through“is“not“imp˜ortan¸ãt.Ž¡With–UUcxref-cpp,“there“are“t•¸ãw“o–UUfeatures“that“are“di eren¸ãt“to“the“standard“GNU“CPP:ŽŸ‘ 8â1.ŽŽŽ‘The–cÓ#include“directivš¸ães“from“the“ le“are“output“in“the“same“w˜a˜y“as“the“#de nes“are“output.‘BAnŽ¡‘extra–£2 ag“has“bGeen“added“to“cpp“to“do“this,‘¶©'-dI',“it“wš¸ãorks“in“the“same“w˜a˜y“as“the“existing“'-dD'Ž¡‘ ag–UUfor“#de nes.ަ‘ 8â2.ŽŽŽ‘Commenš¸ãts–ntrailing“a“#include“or“a“#de ne“are“droppGed“with“GNU–nCPP“ev˜en–nif“-C‘nis“used.‘¼&ThisŽ¡‘is–UUnot“impšGortan¸ãt“while“compiling“but“is“useful“for“do˜cumen¸ãting.ŽŸĽ1.7Ž‘$æcCross‘ffReferencingŽŸç²The–UUcross“referencing“is“pGerformed“for“the“follo¸ãwing“itemsަ‘.Ì8FilesŽ‘TEó !",š cmsy10¸ŽŽŽ‘^E²The–UU les“that“the“currenš¸ãt“ le“is“included“in“(ev˜en“when“included“via“other“ les).ަ‘áŠ#includesŽ‘TE¸ŽŽŽ‘^E²Files–UUincluded“in“the“curren¸ãt“ le.ޤ‘TE¸ŽŽŽ‘^E²Files–UUincluded“b¸ãy“these“ les“etc.ަ‘/ÄV‘ÿ*ªariablesŽ‘TE¸ŽŽŽ‘^E²The–UUloGcation“of“the“de nition“of“external“v‘ÿqÇariables.Ž¡‘TE¸ŽŽŽ‘^E²The–UU les“that“ha•¸ãv“e›UUvisibilit“y˜of˜global˜v‘ÿqÇariables.Ž¡‘TE¸ŽŽŽ‘^E²The–UU les“/“functions“that“use“the“v‘ÿqÇariable.ަ‘ÚmF‘ÿ*ªunctionsŽ‘TE¸ŽŽŽ‘^E²The–UU le“that“the“function“is“protot¸ãypGed“in.Ž¡‘TE¸ŽŽŽ‘^E²The–UUfunctions“that“the“function“calls.Ž¡‘TE¸ŽŽŽ‘^E²The–UUfunctions“that“call“the“function.Ž¡‘TE¸ŽŽŽ‘^E²The–UU les“and“functions“that“reference“the“function.Ž¡‘TE¸ŽŽŽ‘^E²The–UUv‘ÿqÇariables“that“are“used“in“the“function.ަEac¸ãh–UUof“these“items“is“cross“referenced“in“the“output.ޤ The–0?cross“referencing“uses“ les“`cxref.v‘ÿqÇariable',–7ª`cxref.function',“`cxref.include'–0?and“`cxref.t¸ãypGedef‘Ç'“in“theŽ¡output‘UUdirectory‘ÿ*ª.Ž¡These–are“a“complete“list“of“the“function“and“v‘ÿqÇariable“usage“in“the“program“and“could“bGe“used“to“generateŽ¡a–UUfunction“call“hierarc•¸ãh“y–UUor“v‘ÿqÇariable“usage“diagram“for“example.Ž¡Twš¸ão–7Écxref“passes“of“eac˜h“ le“is“needed,‘=²the“ rst“to“build“up“the“cross“referencing“ les“and“the“second“toŽ¡use‘UUthem.Ž¡¿(The–“ç le“names“ar›ÿ}'e“di er˜ent“if“the“\-N"“option“is“use˜d.)ŽŽŽŒ‹(é Ï ýؤ’¾¯ÿ²5ŽŽ Ï ýLû2½1.8Ž‘$æcLŸüû+‘ú+óò"V cmbx10ÃAŽŽn¹½T‘ýL¨Ÿ32EŽ‘èdXOutputŽ©ç²The–'Õdefault“LŸýó5‘üff±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxXoutput“is“a“ le“for“eac¸ãh“of“the“source“ les“with“one“extra“ le“\cxref.tex"“that“includesޤ eacš¸ãh–ËGof“the“other“ les.‘ÓžThis“is“to“allo˜w“a“mak˜e le“to“only“upGdate“the“c˜hanged“ les“(although“theŽ¡references–zmaš¸ãy“require“all“of“the“ les“to“bGe“c˜hec˜k˜ed“again).‘¸5When“the“cxref.tex“ le“has“bGeen“writtenŽ¡it–òÛcan“bšGe“mo˜di ed“bš¸ãy“the“user,‘Ÿ'EŽ‘ãxXstš¸ãyle“ les“\page.st˜y",‘ö¬\fon˜ts.st˜y"“and“\cxref.st˜y".‘JVThese“set“up“the“pageŽ¡to–×^use“a“smaller“margin“and“smaller“fonš¸ãts“to“allo˜w“more“to“appGear“on“a“page“and“also“de ne“the“newŽ¡commands–UUfor“t¸ãypGesetting“the“cxref“output.Ž¡¿(The–“ç le“names“\cxr›ÿ}'ef.tex"“and“\cxr˜ef.ap˜dx.tex"“ar˜e“di er˜ent“if“the“\-N"“option“is“use˜d.)ŽŸĽ1.9Ž‘$æcHTML‘ffOutputަ²The–{õdefault“HTML‘{©output“is“a“ le“for“eacš¸ãh“of“the“source“ les“with“one“extra“ le“\cxref.h˜tml"“thatŽ¡includes–Õ9eacš¸ãh“of“the“other“ les.‘GThis“is“to“allo˜w“a“mak˜e le“to“only“upGdate“the“c˜hanged“ les“(although“theŽ¡references–½§maš¸ãy“require“all“of“the“ les“to“bGe“c˜hec˜k˜ed“again).‘ª¼When“the“cxref.h˜tml“ le“has“bGeen“writtenŽ¡it–âËcan“bšGe“mo˜di ed“bš¸ãy“the“user,‘(an˜y“new“ les“that“are“added“are“added“at“the“end“bGefore“the“table“ofŽ¡con•¸ãten“ts,–UUthe“rest“of“the“ le“bGeing“unc¸ãhanged.Ž¡The–UUindex“is“written“to“a“ le“called“\cxref.apGdx.hš¸ãtml"“and“cxref.h˜tml“is“upGdated“to“refer“to“it.Ž¡¿(The–“ç le“names“\cxr›ÿ}'ef.html"“and“\cxr˜ef.ap˜dx.html"“ar˜e“di er˜ent“if“the“\-N"“option“is“use˜d.)Ž¡²The–UUHTML“output“uses“the“HTML“4.01“standard“and“all“pages“v‘ÿqÇalidate“correctly‘ÿ*ª.ŽŸĽ1.10Ž‘,ÿüR‘þ¦fTF‘ffOutputަ²Ric¸ãh–S¬T›ÿ*ªext“F˜ormat“is“a“fairly“loš¸ãw“lev˜el“page“description“format“devised“b˜y“Microsoft.‘åIt“is“not“a“w˜ell“de nedŽ¡and–UUeasy“to“understand“standard“as“are“the“other“formats,“but“it“is“pšGopular“for“do˜cumenš¸ãt“exc˜hange.Ž¡There–UUis“a“single“output“ le“for“eac¸ãh“of“the“source“ les“and“an“index“ le.ŽŸĽ1.11Ž‘,ÿüSGML‘ffOutputަ²Since–…SGML‘…>is“a“meta-language“it“is“necessary“to“de ne“the“la•¸ãy“out›…elemen“ts˜as˜w“ell˜as˜pro“vide˜theŽ¡information.‘ÔThe– ícxref“output“uses“the“Lin¸ãuxDošGc“do˜cumen¸ãt“format“and“is“designed“for“use“with“theŽ¡SGMLtošGols–UUprograms“(h¸ãttp://www.sgmlto˜ols.org/).Ž¡There–UUis“a“single“output“ le“for“eac¸ãh“of“the“source“ les“and“an“index“ le.ŽŸĽ1.12Ž‘,ÿüExample–ffSps3ecial“CommenŒÌtsަ²The–­å le“\README.c"“is“included“at“the“end“of“this“doGcumenš¸ãt“to“sho˜w“that“the“commen˜ts“are“indeedŽ¡seen–UUin“the“coGde,“the“result“of“running“this“through“cxref“is“also“included.ŽŸĽ1.13Ž‘,ÿüF‘þ¦further‘ffInformationަ²There–Yûis“a“list“of“frequenš¸ãtly“ask˜ed“questions“and“their“answ˜ers“for“the“cxref“program“in“the“F‘þãA˜Q‘Yú le.‘¹AŽ¡list–UUof“impro•¸ãv“emen“ts–UUplanned“for“future“v¸ãersions“of“the“program“are“listed“in“the“ le“TODO.Ž¡More–Nèup-to-date“information“can“bGe“found“on“the“W›ÿ*ªorld“Wide“W˜eb“at“the“cxref“homepage,‘P1reac¸ãhed“viaŽ¡the–UUauthor's“homepage“h•¸ãttp://www.gedank“en.demon.co.uk/.Ž¡If–q§yš¸ãou“wish“to“submit“bug“repGorts“or“other“commen˜ts“abGout“the“program“then“email“the“authorŽ¡am•¸ãb@gedank“en.demon.co.uk–UUand“put“cxref“in“the“sub‘Ž8ject“line.ŽŸĽ1.14Ž‘,ÿüAuthor–ffand“Cop•ŒÌyrigh“tަ²The–UUcxref“program“wš¸ãas“written“b˜y“Andrew“M.“Bishop“in“1995-2004.Ž¡The–UUcxref“program“is“cop•¸ãyrigh“t–UUAndrew“M.“Bishop“1995-2004.Ž¡The–UUcxref-cpp“program“is“cop•¸ãyrigh“t–UUF›ÿ*ªree“Soft•¸ãw“are–UUF˜oundation,“Inc.ŽŽŽŒ‹7X Ï ýؤ’¾¯ÿ²6ŽŽ Ï ýLû2The–:ýcxref“and“cxref-cpp“programs“can“bGe“freely“distributed“according“to“the“terms“of“the“GNU‘:öGeneralŽŸ Public–UULicense“(see“the“ le“`COPYING').ŽŽŽŒ‹G3 Ï ýؤ Ï ý’û2ºChapter‘Ç 2ŽŸ-»Example‘ T{\README.c"ŽŸ4¾/*****************ޤ ‘ ú$Header:–?ý/home/amb/cxref/doc/RCS/README.c“1.4“1997/05/26“11:23:40“amb“Exp“$Ž¡¡‘ úA–?ýcomment“for“the“file,“RCS“header“comments“are“treated“specially“when“first.Ž¡‘ ú*****************/Ž¡¡¡¡/*+–?ýA“#include“comment“+*/Ž¡#include‘?ýŽ¡¡¡#include–?ý‘ ú/*+“An“alternative“#include“comment.“+*/Ž¡¡¡/*+–?ýA“#define“comment.“+*/Ž¡#define–?ýdef1“1Ž¡¡¡#define–?ýdef2“2‘ ú/*+“An“alternative“#define“comment.“+*/Ž¡¡¡/*+++++++++++Ž¡‘ úA–?ý#define“with“argsŽ¡¡‘ úarg1–?ýThe“first“argŽ¡¡‘ úarg2–?ýThe“second“argŽ¡‘ ú+++++++++++*/Ž¡¡#define–?ýdef3(arg1,arg2)“(arg1+arg2)Ž¡¡¡/*+–?ýAn“alternative“#define“with“args.“+*/Ž¡¡#define–?ýdef4(arg1“/*+“The“first“arg‘ ú+*/,“\Ž¡‘D?Ùarg2–?ý/*+“The“second“arg“+*/)“\Ž¡‘9¿ß(arg1+arg2)Ž¡¡¡/*+–?ýAn“example“typedef“comment“+*/Ž¡typedef‘?ýenumŽ¡{Ž¡–?ýone,‘>ÿÜ/*+“one“value“+*/ŽŽŸG’ßX²7ŽŽŒ‹H# Ï ýؤ’¾¯ÿ²8ŽŽ Ï ýLû2–?ý¾two‘D?Ù/*+“another“value“+*/ޤ }Ž¡type1;Ž¡¡¡/*+–?ýAnother“example“typedef“comment,“+*/Ž¡typedef‘?ýstructŽ¡{Ž¡–?ýint“a;‘/?å/*+“A“variable“in“a“struct.“+*/Ž¡–?ýunion“barŽ¡‘ ú{Ž¡‘¿÷char–?ýa;‘î/*+“Each“element“+*/Ž¡‘¿÷int‘ úb,‘î/*+–?ýof“a“struct“+*/Ž¡‘)ÿèc;‘î/*+–?ýor“a“union“+*/Ž¡‘¿÷long–?ýd;‘î/*+“can“have“a“comment“+*/Ž¡‘ ú}Ž¡–?ýe;‘D?Ù/*+“Nested“structs“and“unions“also“work.“+*/Ž¡}Ž¡type2,‘4â/*+–?ýa“type“that“is“a“struct.“+*/Ž¡*ptype2;‘)ÿè/*+–?ýa“pointer“to“a“struct“type.“+*/Ž¡¡¡/*+–?ýA“leading“comment“only.“+*/Ž¡int‘?ývar1,var2;Ž¡¡¡static–?ýint“var3;“/*+“A“trailing“comment“only.“+*/Ž¡¡¡/*+–?ýA“variable“for“+*/Ž¡int–?ývar4,‘ÿô/*+“one“thing.“+*/Ž¡–ÿôvar5,“/*+–?ýa“second“thing.“+*/Ž¡–ÿôvar6;“/*+–?ýa“third“thing.“+*/Ž¡¡/*–?ýNote:“The“leading“comment“is“combined“with“each“of“the“trailing“comments.“*/Ž¡/*–?ýNote:“the“push“through“of“the“comment“above“on“the“','“and“';',“see“README.“*/Ž¡¡¡/*+++++++++++Ž¡‘ úA–?ýfunction“comment“(the“comments“for“the“args“need“to“be“separated“by“a“blank“line).Ž¡¡‘ úint–?ýfunction1“The“return“value.Ž¡¡‘ úint–?ýarg1“The“first“argument.Ž¡¡‘ úint–?ýarg2“The“second“argument.Ž¡¡‘ úSome–?ýmore“commentsŽ¡¡– ú+none+“Note:–?ýthis“line“and“the“two“below“are“processed“specially.Ž¡– ú+html+“This–?ýcomment“is“only“visible“in“the“HTML“output,“and“can“contain“HTML“markup.Ž¡‘ ú+latex+–?ýThis“comment“is“only“visible“in“the“\LaTeX“output,“and“can“contain“\LaTeX“markup.Ž¡‘ ú+++++++++++*/Ž¡¡int–?ýfunction1(int“arg1,int“arg2)Ž¡{Ž¡–?ý/*+“An“internal“comment“in“a“function“that“appears“as“aŽ¡‘¿÷new–?ýparagraph“at“the“end“of“the“comment.“+*/ŽŽŽŒ‹ L! Ï ýؤ’¾¯ÿ²9ŽŽ Ï ýLû2¤ ‘?ý¾var1=0;Ž¡¡‘?ýfunction2(var3,var4);Ž¡}Ž¡¡¡/*+–?ýAn“alternative“function“comment“+*/Ž¡¡int–?ýfunction2(int“arg1,› ú/*+“The“first“argument.˜+*/Ž¡‘IÖint–?ýarg2)‘ ú/*+“The“second“argument.“+*/Ž¡/*+–?ýReturns“a“value“+*/Ž¡{Ž¡–?ýint“(*funcp)()=&function1;Ž¡}Ž¡¡/*–?ýNote:“the“push“through“of“the“comment“above“on“the“','“and“')',“see“README.“*/ŽŽŽŒ‹ Rú Ï ýؤ Ï ý’û2ºChapter‘Ç 3ŽŸ-»Cxref– T{Output“F‘ýªáor“\README.c"ŽŸ7Öv½3.1Ž‘$æcFile‘ffREADME.cŽŸçÃR•®9CS‘‘Header:‘¾'/home/am“b/cxref/doQÇc/R“CS/README.c–Á1.4“1997/05/26“11:23:40“am®9b“Expޤ²A–UUcommenš¸ãt“for“the“ le,“R˜CS“header“commen˜ts“are“treated“spGecially“when“ rst.Ž©þ6óÂÖN  cmbx12ÅIncluded‘€FilesŽŸuT²A–UU#include“commen¸ãtŽ¡žædóߤN cmtt9Ç#include‘¹–ŽŽŽŽŽŽŽŸ²An–UUalternativš¸ãe“#include“commen˜t.Ž¡žædÇ#include‘¹–ŽŽŽŽŽŽŽ¦ÅPrepro`cessor‘€de nitionsŽŸuT²A–UU#de ne“commen¸ãt.Ž¡Ç#define–¹–def1“1Ž©²An–UUalternativš¸ãe“#de ne“commen˜t.Ž¡Ç#define–¹–def2“2ަ²A–UU#de ne“with“argsŽ¡Ç#define–¹–def3(“arg1,“arg2“)Ž©Ÿÿ?ÿ¸‘:9Çarg1ŽŽŽŽ’¢›…²The–UU rst“argŽ¡Ÿÿ?ÿ¸‘:9Çarg2ŽŽŽŽ’¢›…²The–UUsecond“argŽŸAn–UUalternativ¸ãe“#de ne“with“args.Ž¡Ç#define–¹–def4(“arg1,“arg2“)ަŸÿ?ÿ¸‘:9Çarg1ŽŽŽŽ’¢›…²The–UU rst“argŽ¡Ÿÿ?ÿ¸‘:9Çarg2ŽŽŽŽ’¢›…²The–UUsecond“argŽŸþ6Å3.1.1Ž‘)@T yp`e‘€de nitionsޤuTÃ3.1.1.1Ž‘,FT•®9ypšQÇedef‘ÕTt“yp˜e1Ž¡²An–UUexample“tš¸ãypGedef“commen˜tŽŸÇtypedef–¹–enum“ó©±Ê cmsy9ÈfÇ...Èg“Çtype1ŽŸ&ÀŸçædenumŽŽŽŽ¤ ‘:9ÈfŽŽŽŽ¡‘t*Çone;ŽŽŽ’´¬Ì²one‘UUv‘ÿqÇalueŽŽŽŽ¡‘t*Çtwo;ŽŽŽ’´¬Ì²another‘UUv‘ÿqÇalueŽŽŽŽ¡‘:9ÈgŽŽŽŽŽŽŽŽŸG’Ü×ÿ²10ŽŽŒ‹ T» Ï ýؤóp®0J cmsl10ÀFile‘UUREADME.c’qS„²11ŽŽ Ï ýLû2Ã3.1.1.2Ž‘,FT®9ypQÇe–ÕTunion“barޤuT²Nested–UUstructs“and“unions“also“w¸ãork.ŽŸ'€ŸçædÇunion‘¹–barŽŽŽŽ¤ ‘:9ÈfŽŽŽŽ¡‘t*Çchar‘¹–a;ŽŽŽ’´¬Ì²Eac•¸ãh‘UUelemen“tŽŽŽŽ¡‘t*Çint‘¹–b;ŽŽŽ’´¬Ì²of–UUa“structŽŽŽŽ¡‘t*Çint‘¹–c;ŽŽŽ’´¬Ì²or–UUa“unionŽŽŽŽŽŽŽŸ+Ÿùæd‘t*Çlong‘¹–d;ŽŽŽ’´¬Ì²can›UUha•¸ãv“e˜a˜commen“tŽŽŽŽŸ ‘:9ÈgŽŽŽŽŽŽŽŸoýÃ3.1.1.3Ž‘,FT•®9ypšQÇedef‘ÕTt“yp˜e2Ž¡²Another–UUexample“tš¸ãypGedef“commen˜t,“a“t˜ypGe“that“is“a“struct.Ž©Çtypedef–¹–struct“ÈfÇ...Èg“Çtype2ŽŸ,ÀŸáædstructŽŽŽŽ¤ ‘:9ÈfŽŽŽŽ¡‘t*Çint‘¹–a;ŽŽŽ’´¬Ì²A–UUv‘ÿqÇariable“in“a“struct.ŽŽŽŽ¡‘t*Çunion‘¹–barŽŽŽŽ¡‘®dÈfŽŽŽŽ¡‘èUÇchar‘¹–a;ŽŽŽ’´¬Ì²Eac•¸ãh‘UUelemen“tŽŽŽŽŽŽŽŸIŸáæd‘èUÇint‘¹–b;ŽŽŽ’´¬Ì²of–UUa“structŽŽŽŽ¤ ‘èUÇint‘¹–c;ŽŽŽ’´¬Ì²or–UUa“unionŽŽŽŽ¡‘èUÇlong‘¹–d;ŽŽŽ’´¬Ì²can›UUha•¸ãv“e˜a˜commen“tŽŽŽŽ¡‘®dÈgŽŽŽŽ¡‘®dÇe;ŽŽŽ’´¬Ì²Nested–UUstructs“and“unions“also“w¸ãork.ŽŽŽŽ¡‘:9ÈgŽŽŽŽŽŽŽŸ7oýÃ3.1.1.4Ž‘,FT•®9ypšQÇedef‘ÕTpt“yp˜e2Ž¡²Another–UUexample“tš¸ãypGedef“commen˜t,“a“pGoin˜ter“to“a“struct“t˜ypGe.ަÇtypedef–¹–struct“ÈfÇ...ÈgÇ*“ptype2ަžæd²See:ŽŽŽ‘63×T•¸ãypšGedef‘UUt“yp˜e2ŽŽŽ’iYšó¼j‘¹ cmti9É(Se‡ction‘N<3.1.1.3)ŽŽŽŽŽŸþ6Å3.1.2Ž‘)@V‘þàariablesŽ¡Ã3.1.2.1Ž‘,FV‘ÿ «ariable‘ÕTv‘ÿ\rar1Ž¡²A–UUleading“commen¸ãt“only‘ÿ*ª.ަÇint‘¹–var1ŽŸ€Ÿùæd²Visible‘UUin:ŽŽŽ‘63×README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1)ŽŽŸ ²Used‘UUin:ŽŽŽ‘63×function1()ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.3.1)ŽŽŽŽŽŸoýÃ3.1.2.2Ž‘,FV‘ÿ «ariable‘ÕTv‘ÿ\rar2Ž¡²A–UUleading“commen¸ãt“only‘ÿ*ª.ަÇint‘¹–var2ަžæd²Visible‘UUin:ŽŽŽ‘63×README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1)ŽŽŽŽŽŸþ6Ã3.1.2.3Ž‘,FV‘ÿ «ariable‘ÕTv‘ÿ\rar4Ž¡²A–UUv‘ÿqÇariable“for“one“thing.ަÇint‘¹–var4ŽŸ€Ÿùæd²Visible‘UUin:ŽŽŽ‘63×README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1)ŽŽŸ ²Used‘UUin:ŽŽŽ‘63×function1()ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.3.1)ŽŽŽŽŽŽŽŒ‹ Z= Ï ýؤÀCon•¸ãten“ts’’¾3²12ŽŽ Ï ýLû2Ã3.1.2.4Ž‘,FV‘ÿ «ariable‘ÕTv‘ÿ\rar5Ž©uT²A–UUv‘ÿqÇariable“for“a“second“thing.ޤÇint‘¹–var5Ž¡žæd²Visible‘UUin:ŽŽŽ‘63×README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1)ŽŽŽŽŽŸþ6Ã3.1.2.5Ž‘,FV‘ÿ «ariable‘ÕTv‘ÿ\rar6ަ²A–UUv‘ÿqÇariable“for“a“third“thing.Ž¡Çint‘¹–var6Ž¡žæd²Visible‘UUin:ŽŽŽ‘63×README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1)ŽŽŽŽŽŸþ6Ã3.1.2.6Ž‘,FLoQÇcal‘ÕTV‘ÿ «ariablesަv‘ÿ\rar3ŽŸ ²A–UUtrailing“commen¸ãt“only‘ÿ*ª.Ž¡Çstatic–¹–int“var3Ž¡žæd²Used‘UUin:ŽŽŽ‘63×function1()ŽŽŽ’iYšÉ(Se‡ction‘N<3.1.3.1)ŽŽŽŽŽŸþ6Å3.1.3Ž‘)@F‘þàunctionsަÃ3.1.3.1Ž‘,FGlobal–ÕTF‘ÿ «unction“function1()ަ²A–UUfunction“commenš¸ãt“(the“commen˜ts“for“the“args“need“to“bGe“separated“b˜y“a“blank“line).Ž¡Çint–¹–function1“(“int“arg1,“int“arg2“)Ž©ž?ÿ¸‘:9Çint‘¹–function1ŽŽŽŽ’¢›…²The–UUreturn“v‘ÿqÇalue.Ž¡Ÿÿ?ÿ¸‘:9Çint‘¹–arg1ŽŽŽŽ’¢›…²The–UU rst“argumen¸ãt.Ž¡Ÿÿ?ÿ¸‘:9Çint‘¹–arg2ŽŽŽŽ’¢›…²The–UUsecond“argumen¸ãt.ަSome–UUmore“commen¸ãtsޤ This–UUcommenš¸ãt“is“only“visible“in“the“LŸýó5‘üff±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxXoutput,“and“can“con˜tain“LŸýó5‘üff±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxXmarkup.Ž¡An–UUinš¸ãternal“commen˜t“in“a“function“that“appGears“as“a“new“paragraph“at“the“end“of“the“commen˜t.ŽŸ qÇŸíædCalls:ŽŽŽ‘63×function2()ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.3.2)ŽŽ¡²Used‘UUin:ŽŽŽ‘63×function2()ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.3.2)ŽŽ¡²Refs‘UUV‘ÿ*ªar:ŽŽŽ‘63×v‘ÿqÇar1ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.2.1)ŽŽ¡‘63ײv‘ÿqÇar3ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.2.6)ŽŽŽŽŽŸžæd‘63ײv‘ÿqÇar4ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.2.3)ŽŽŽŽŽŸþ6Ã3.1.3.2Ž‘,FGlobal–ÕTF‘ÿ «unction“function2()ŽŸuT²An–UUalternativš¸ãe“function“commen˜tޤÇint–¹–function2“(“int“arg1,“int“arg2,“void“)ަž?ÿ¸‘:9Çint‘¹–function2ŽŽŽŽ’¢›…²Returns–UUa“v‘ÿqÇalueŽ¡Ÿÿ?ÿ¸‘:9Çint‘¹–arg1ŽŽŽŽ’¢›…²The–UU rst“argumen¸ãt.Ž¡Ÿÿ?ÿ¸‘:9Çint‘¹–arg2ŽŽŽŽ’¢›…²The–UUsecond“argumen¸ãt.Ž¡ž?ÿ¸‘:9ÇvoidŽŽŽŽŽŸ¿ÿŸùæd²Called‘UUb¸ãy:ŽŽŽ‘63×function1()ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.3.1)ŽŽŸ ²Refs‘UUF‘ÿ*ªunc:ŽŽŽ‘63×function1()ŽŽŽ’ØÏ\README.cŽŽŽ’iYšÉ(Se‡ction‘N<3.1.3.1)ŽŽŽŽŽŽŽŒ‹ b· Ï ýؤ Ï ý—û2»Con–ÿ8õten“tsŽŸ>Ã1Ž‘C–ÕTCross“Referencing“&“DošQÇcumen®9ting“to˜ol.‘pV‘ÿ «ersion“1.6“-“cxref‘wâç1ŽŽ¤ ‘²1.1Ž‘&Program‘UUOptions‘Ûñ‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|1ŽŽ¡‘1.2Ž‘&C–UUCompiler“Replacemen¸ãt“cxref-cc‘‘‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|3ŽŽ¡‘1.3Ž‘&Cxref–UUcon guration“File‘j ‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|3ŽŽ¡‘1.4Ž‘&Program–UUDoGcumenš¸ãtation“Commen˜ts‘ \‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|3ŽŽ¡‘1.5Ž‘&Automated–UUCommen¸ãt“Insertion‘Û¯‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|3ŽŽ¡‘1.6Ž‘&C‘UUPreproGcessor‘¸q‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|4ŽŽ¡‘1.7Ž‘&Cross‘UUReferencingM¾‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|4ŽŽ¡‘1.8Ž‘&LŸýó5‘üff±AŽŽ‘͉²T‘þU>Ÿ'EŽ‘ãxXOutput‘9;‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|5ŽŽ¡‘1.9Ž‘&HTML‘UUOutput‘1P‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|5ŽŽ¡‘1.10Ž‘&R‘ÿ*ªTF‘UUOutput‘F¯‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|5ŽŽ¡‘1.11Ž‘&SGML‘UUOutput‘ƒ‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|5ŽŽ¡‘1.12Ž‘&Example–UUSpGecial“Commen¸ãts‘1‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|5ŽŽ¡‘1.13Ž‘&F‘ÿ*ªurther‘UUInformation‘8R‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|5ŽŽ¡‘1.14Ž‘&Author–UUand“Cop•¸ãyrigh“t‘*‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ê|5ŽŽ¤Ã2Ž‘Example‘ÕT\README.c"’6ì7ŽŽ¡3Ž‘Cxref–ÕTOutput“F‘ÿ «or“\README.c"’À:10ŽŽ¤ ‘²3.1Ž‘&File‘UUREADME.c‘M¼‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{10ŽŽ¡‘&3.1.1Ž‘FT¸ãypGe‘UUde nitions‘âñ‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{10ŽŽ¡‘F3.1.1.1Ž‘oT•¸ãypšGedef‘UUt“yp˜e1‘Ô’‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{10ŽŽ¡‘F3.1.1.2Ž‘oT¸ãypGe–UUunion“bar‘”Š‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{11ŽŽ¡‘F3.1.1.3Ž‘oT•¸ãypšGedef‘UUt“yp˜e2‘Ô’‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{11ŽŽ¡‘F3.1.1.4Ž‘oT•¸ãypšGedef‘UUpt“yp˜e2‘ m‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{11ŽŽ¡‘&3.1.2Ž‘FV‘ÿ*ªariables‘”Û‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{11ŽŽ¡‘F3.1.2.1Ž‘oV‘ÿ*ªariable‘UUv‘ÿqÇar1‘ÿE‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{11ŽŽ¡‘F3.1.2.2Ž‘oV‘ÿ*ªariable‘UUv‘ÿqÇar2‘ÿE‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{11ŽŽ¡‘F3.1.2.3Ž‘oV‘ÿ*ªariable‘UUv‘ÿqÇar4‘ÿE‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{11ŽŽ¡‘F3.1.2.4Ž‘oV‘ÿ*ªariable‘UUv‘ÿqÇar5‘ÿE‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{12ŽŽ¡‘F3.1.2.5Ž‘oV‘ÿ*ªariable‘UUv‘ÿqÇar6‘ÿE‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{12ŽŽ¡‘F3.1.2.6Ž‘oLoGcal‘UUV‘ÿ*ªariables‘¸!‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{12ŽŽ¡‘&3.1.3Ž‘FF‘ÿ*ªunctions‘?„‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{12ŽŽ¡‘F3.1.3.1Ž‘oGlobal–UUF‘ÿ*ªunction“function1()‘f‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{12ŽŽ¡‘F3.1.3.2Ž‘oGlobal–UUF‘ÿ*ªunction“function2()‘f‘ü.ŽŽ–Ç‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ“‘ü.ŽŽ‘ ê{12ŽŽŽŸG’Ü×ÿ13ŽŽŒølƒ’À;èÏð ó¼j‘¹ cmti9ó©±Ê cmsy9óߤN cmtt9óÂÖN  cmbx12óò"V cmbx10óp®0J cmsl10óý': cmti10óßê C Cross Referencing & Documenting tool. Version 1.6.

    C Cross Referencing & Documenting tool. Version 1.6 - cxref

    A program that can automatically generate documentation and cross references for a C program.
    The input is any C program with appropriate comments and the output is LaTeX, HTML, RTF or SGML files.

    Program Options

    The name of the program is cxref.
    Usage: cxref filename [ ... filename]
                 [-Odirname] [-Nbasename] [-Rdirname]
                 [-all-comments] [-no-comments]
                 [-verbatim-comments] [-block-comments]
                 [-xref[-all][-file][-func][-var][-type]]
                 [-warn[-all][-comment][-xref]]
                 [-index[-all][-file][-func][-var][-type]]
                 [-raw]
                 [-latex]
                 [-html[-src]]
                 [-rtf]
                 [-sgml]
                 [-Idirname] [-Ddefine] [-Udefine]
                 [-CPP cpp_program] [-- cpp_arg [ ... cpp_arg]]
    
    Usage: cxref filename [ ... filename] -delete
                 [-Odirname] [-Nbasename] [-Rdirname]
    
    filename
    The name of the file to document, any number of files may be documented at a time.
    -delete
    The files named are to be deleted from the output directory and their entries in the cross reference database and main output files are to be removed.
    -Odirname
    The name of a directory to use for the output latex files and the location of the cross reference files that are created.
    -Nbasename
    The name to use for the first part of the output and cross reference files instead of cxref, the file extensions remain the same.
    -Rdirname
    When the source files are in more than one directory, set dirname to the name of the root directory of the source tree (use relative path if easier e.g. `-R../..'). This will then run cxref from that root directory and the `-Odirname' must be relative to that directory.
    -all-comments
    In case you think that the existing comments might work, (see below for description of special comments).
    [Danger! This option can produce weird results.]
    -no-comments
    Ignores all comments, useful if you just want the cross references and not the documentation.
    -verbatim-comments
    When the comments that you have in the code are formatted in a predetermined style that you want to preserve on the output, this option will force them not to be reformatted.
    [Note, this is for file and function comments only.]
    -block-comments
    When the comments in the program are formatted in the `block' style (with a leading `*' character on every line), this option will remove that character from the output.
    [Works for a single `*', `+', `|' or `:' on each line.]
    -xref
    Produce cross referencing information (see below).
    -all
    All cross references.
    -file
    Cross references for files.
    -func
    Cross references for functions.
    -var
    Cross references for variables.
    -type
    Cross references for types.
    -warn
    Produce warnings, the options must be concatenated together:
    -all
    All warnings.
    -comment
    Warn of missing comments.
    -xref
    Warn of missing cross references.
    -index
    Produce a cross reference index, the options must be concatenated together:
    -all
    All indexes.
    -file
    Index of files.
    -func
    Index of functions.
    -var
    Index of variables.
    -type
    Index of types.
    -raw
    Produce a raw form of output, not really of much use except with -warn.
    -latex
    Produce a LaTeX file to document each of the source files and also an extra file that includes each of these files.
    -html
    Produce an HTML 4.01 file to document each of the source files and a main file to reference each of these files.
    -html-src
    Produce the HTML output and an HTML version of the source file with links into it.
    -rtf
    Produce a Rich Text Format (RTF) file to document the source file.
    -sgml
    Produce an SGML file to document the source file. (Using the LinuxDoc DTD).
    -Idirname
    GCC option to specify the path for include files.
    -Ddefine
    GCC option to define a pre-processor symbol.
    -Udefine
    GCC option to undefine a pre-processor symbol.
    -CPP program
    The name of the program to use instead of the compile time default. The program must be able to perform all of the actions that `gcc -E -C -dD' does to work. If the program takes arguments then the whole thing needs to be in quotes so that it is interpreted as a single argument to cxref.
    -- arg ... arg
    Extra arguments to be passed to the pre-processor can be placed after the `--' separator.

    C Compiler Replacement cxref-cc

    To simplify using cxref on existing source code, there is now a shell script that will call the C compiler and then call cxref to process the source file. This means that it can be used as a drop in replacement for CC in Makefiles and the like.
    Usage: cxref-cc [usual cc options]
    
    The name of the source file is extracted from the list of options as well as the `-D*', `-I*', `-U*' flags and when the C compiler exits succesfully cxref will be called. The name of the C compiler to use is controlled by the CXREFCC environment variable, or if this is not set then the CC environment variable, or failing this just gcc. Using this script requires the use of a `.cxref' configuration file to contain the options since there is nowhere to put the options on the command line for the C compiler. This will only cross-reference and document the C source files since they are the only ones that are compiled, but it will make sure that they are cross-referenced with the correct options etc.

    Cxref configuration File

    These command line arguments can also be put into a file named `.cxref' instead of on the command line. When cxref is run the arguments to the program are interpreted in the following order.
    1. Those on the command line.
    2. Those in the `.cxref' file in the current directory.
    3. Those in the `.cxref' file in the source tree root specified by `-R'.
    This means that in a multi-directory source tree, each sub-directory can have a `.cxref' file containing just the line `-R..' or appropriate. The main directory can have a `.cxref' file containing the remainder of the options. This removes completely the need to have any options on the command line apart from the source file names. The format of the `.cxref' file is any number of lines, each one containing a single command line argument (equivalent to one of the argv). The only options that cannot be used are the names of source files themselves and the `-delete' option. Blank lines are ignored and lines starting with a '#' are comments.

    Program Documentation Comments

    The documentation for the program is produced from comments in the code that are appropriately formatted. The cross referencing comes from the code itself and requires no extra work.
    The special comments are `/**** ****/' (for a file) and `/*++++ ++++*/' (for a data object) any number of `*' or `+' can be used inside of the standard `/*' and `*/' comment delimiters in the comments, they are ignored.
    If a comment line starts with whitespace and is followed by `+html+' then the rest of the line is included only in the HTML output, and is not processed so it can include HTML markup, `-html-' means that the rest of the line is included in all except the HTML output. The same also applies to the other output formats, `+none+' can be used for lines not to appear in any output. The exception to this is that the raw output does not do any checking and will output all lines.
    In any situation where a comment follows a `,', `;' or `)' separated only by spaces and tabs, the comment is pushed to before the punctuation to apply to object there.
    The program is implemented using a full ANSI C grammar parser with some GCC extensions, this means that the style of the code is unimportant, only the content and comments.

    Automated Comment Insertion

    To simplify the insertion of comments that will be parsed by cxref, the file cxref.el provides a number of Emacs lisp functions. To use them add the line (load "cxref") to your `.emacs' file or type M-x load-file cxref.el from within Emacs.

    The functions and key bindings are:

    Control-C Control-F
    Adds file comments, a /** **/ header at the top of the file and if it is a .h file then it also adds a #ifndef, #define at the beginning and #endif at the end to stop multiple inclusions.
    Control-C f
    Adds comments to a function, the cursor must be on the line containing the start of the function definition when this function is called. The /*+ ... +*/ comment that is added is of the header type (see the examples) not inline.
    Control-C v
    Adds a leading comment to the variable or other definition on the current line.
    Control-C e
    Adds a trailing comment at the end of the line.
    Control-C i
    Adds an inline comment that is ignored by cxref.

    C Preprocessor

    To improve the output that is available a modified version of the GNU CPP V2.7.2 is supplied (named cxref-cpp).
    This modified C preprocessor allows for a finer control over some features of the preprocessing that are not important for a compiler. In a standard preprocessor, the preprocessor directives are intended for use only by the preprocessor, so passing the information through is not important.
    With cxref-cpp, there are two features that are different to the standard GNU CPP:
    1. The #include directives from the file are output in the same way as the #defines are output. An extra flag has been added to cpp to do this, '-dI', it works in the same way as the existing '-dD' flag for #defines.
    2. Comments trailing a #include or a #define are dropped with GNU CPP even if -C is used. This is not important while compiling but is useful for documenting.

    Cross Referencing

    The cross referencing is performed for the following items
    Files
  • The files that the current file is included in (even when included via other files).
  • #includes
  • Files included in the current file.
  • Files included by these files etc.
  • Variables
  • The location of the definition of external variables.
  • The files that have visibility of global variables.
  • The files / functions that use the variable.
  • Functions
  • The file that the function is prototyped in.
  • The functions that the function calls.
  • The functions that call the function.
  • The files and functions that reference the function.
  • The variables that are used in the function.
  • Each of these items is cross referenced in the output.
    The cross referencing uses files `cxref.variable', `cxref.function', `cxref.include' and `cxref.typedef' in the output directory.
    These are a complete list of the function and variable usage in the program and could be used to generate a function call hierarchy or variable usage diagram for example.
    Two cxref passes of each file is needed, the first to build up the cross referencing files and the second to use them.
    (The file names are different if the `-N' option is used.)

    LaTeX Output

    The default LaTeX output is a file for each of the source files with one extra file `cxref.tex' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.tex file has been written it can be modified by the user, any new files that are added are added at the end of the source code section, the rest of the file being unchanged.
    The index is written to a file called `cxref.apdx.tex' and cxref.tex is updated to refer to it.
    Also written out are three LaTeX style files `page.sty', `fonts.sty' and `cxref.sty'. These set up the page to use a smaller margin and smaller fonts to allow more to appear on a page and also define the new commands for typesetting the cxref output.
    (The file names `cxref.tex' and `cxref.apdx.tex' are different if the `-N' option is used.)

    HTML Output

    The default HTML output is a file for each of the source files with one extra file `cxref.html' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.html file has been written it can be modified by the user, any new files that are added are added at the end before the table of contents, the rest of the file being unchanged.
    The index is written to a file called `cxref.apdx.html' and cxref.html is updated to refer to it.
    (The file names `cxref.html' and `cxref.apdx.html' are different if the `-N' option is used.)
    The HTML output uses the HTML 4.01 standard and all pages validate correctly.

    As an example, the cross referencing produced by cxref for the cxref program itself starts in the file example/cxref.html. This is a good example of the type of output that can be produced using cxref.

    RTF Output

    Rich Text Format is a fairly low level page description format devised by Microsoft. It is not a well defined and easy to understand standard as are the other formats, but it is popular for document exchange.
    There is a single output file for each of the source files and an index file.

    SGML Output

    Since SGML is a meta-language it is necessary to define the layout elements as well as provide the information. The cxref output uses the LinuxDoc document format and is designed for use with the SGMLtools programs (http://www.sgmltools.org/).
    There is a single output file for each of the source files and an index file.

    Example Special Comments

    See the README.c file, to see that the comments are indeed seen in the code,
    The result of running this through cxref is in README.c.html.

    Further Information

    There is a list of frequently asked questions and their answers for the cxref program in the FAQ file (also available in HTML format). A list of improvements planned for future versions of the program are listed in the file TODO. More up-to-date information can be found on the World Wide Web at the cxref homepage, reached via the author's homepage http://www.gedanken.demon.co.uk/. If you wish to submit bug reports or other comments about the program then email the author amb@gedanken.demon.co.uk and put cxref in the subject line.

    Author and Copyright

    The cxref program was written by Andrew M. Bishop in 1995-2011.
    The cxref program is copyright Andrew M. Bishop 1995-2011.
    The cxref-cpp program is copyright Free Software Foundation, Inc.
    The cxref and cxref-cpp programs can be freely distributed according to the terms of the GNU General Public License (see the file `COPYING'). cxref-1.6d/doc/README.man 644 233 144 31206 11506061166 10226 0.\" $Header: /home/amb/CVS/cxref/doc/README.man,v 1.14 2004-06-16 18:39:17 amb Exp $ .\" .\" C Cross Referencing & Documenting tool - Version 1.6. .\" .\" Manual page for cxref .\" .\" Written by Andrew M. Bishop .\" .\" This file Copyright 1996,97,98,99,2000,01,02,03,04 Andrew M. Bishop .\" It may be distributed under the GNU Public License, version 2, or .\" any higher version. See section COPYING of the GNU Public license .\" for conditions under which this file may be redistributed. .\" .TH cxref 1 "June 15 2004" .SH NAME cxref - C Cross Referencing & Documenting tool. .SH SYNOPSIS .B cxref .I filename \ [ \ ... \ filename] .BI [\-O dirname ] .BI [\-N basename ] .BI [\-R basename ] .B [\-all\-comments] [\-no\-comments] .B [\-verbatim\-comments] [\-block\-comments] .B [\-xref[\-all][\-file][\-func][\-var][\-type]] .B [\-warn[\-all][\-comment][\-xref]] .B [\-index[\-all][\-file][\-func][\-var][\-type]] .B [\-raw] .B [\-latex] .B [\-html[\-src]] .B [\-rtf] .B [\-sgml] .BI [\-I dirname ] .BI [\-D define ] .BI [\-U define ] .BI [\-CPP \ cpp_program] .BI [\-\- \ cpp_args \ ... \ cpp_args] .LP .B cxref .I filename \ [ \ ... \ filename] .B \-delete .BI [\-O dirname ] .BI [\-N basename ] .BI [\-R basename ] .SH DESCRIPTION A program that can automatically generate documentation and cross references for a C program. The input is any C program with appropriate comments and the output is LaTeX, HTML, RTF or SGML files. .SH OPTIONS .TP .BR filename The name of the file to document, any number of files may be documented at a time. .TP .BR \-delete The files named are to be deleted from the output directory and their entries in the cross reference database and main output files are to be removed. .TP .BR \-Odirname The name of a directory to use for the output latex files and the location of the cross reference files that are created. .TP .BR \-Nbasename The name to use for the first part of the output and cross reference files instead of cxref, the file extensions remain the same. .TP .BR \-Rdirname When the source files are in more than one directory, set dirname to the name of the root directory of the source tree (use relative path if easier e.g. `-R../..'). This will then run cxref from that root directory and the `-Odirname' must be relative to that directory. .TP .BR \-all\-comments In case you think that the existing comments might work, (see above for description of special comments). [Danger! This option can produce weird results.] .TP .BR \-no\-comments Ignores all comments, useful if you just want the cross references and not the documentation. .TP .BR \-verbatim\-comments When the comments that you have in the code are formatted in a predetermined style that you want to preserve on the output, this option will force them not to be reformatted. [Note, this is for file and function comments only.] .TP .BR \-block\-comments When the comments in the program are formatted in the `block' style (with a leading '*' character on every line), this option will remove that character from the output. [Works for a single `*', `+', `|' or `:' on each line.] .TP .BR \-xref Produce cross referencing information (see below). -all All cross references. -file Cross references for files. -func Cross references for functions. -var Cross references for variables. -type Cross references for types. .TP .BR \-warn Produce warnings, the options must be concatenated together: -all All warnings. -comment Warn of missing comments. -xref Warn of missing cross references. .TP .BR \-index Produce a cross reference index, the options must be concatenated together: -all All indexes. -file Index of files. -func Index of functions. -var Index of variables. -type Index of types. .TP .BR \-raw Produce a raw form of output, not really of much use except with -warn. .TP .BR \-latex Produce a LaTeX file to document each of the source files and also an extra file that includes each of these files. .TP .BR \-html Produce an HTML 4.01 file to document each of the source files and a main file to reference each of these files. .TP .BR \-html-src Produce the HTML output and an HTML version of the source file with links into it. .TP .BR \-rtf Produce a Rich Text Format (RTF) file to document the source file. .TP .BR \-sgml Produce an SGML file to document the source file. (Using the LinuxDoc DTD). .TP .BR \-Idirname GCC option to specify the path for include files. .TP .BR \-Ddefine GCC option to define a pre-processor symbol. .TP .BR \-Udefine GCC option to undefine a pre-processor symbol. .TP .BR \-CPP \ program The name of the program to use instead of the compile time default. The program must be able to perform all of the actions that `gcc -E -C -dD' does to work. If the program takes arguments then the whole thing needs to be in quotes so that it is interpreted as a single argument to cxref. .TP .BR \-\- arg \ ... \ arg Extra arguments to be passed to the pre-processor can be placed after the `--' separator. .SS C Compiler Replacement cxref-cc To simplify using cxref on existing source code, there is now a shell script that will call the C compiler and then call cxref to process the source file. This means that it can be used as a drop in replacement for CC in Makefiles and the like. Usage: cxref-cc [usual cc options] The name of the source file is extracted from the list of options as well as the `-D*', `-I*', `-U*' flags and when the C compiler exits succesfully cxref will be called. The name of the C compiler to use is controlled by the CXREFCC environment variable, or if this is not set then the CC environment variable, or failing this just gcc. Using this script requires the use of a `.cxref' configuration file to contain the options since there is nowhere to put the options on the command line for the C compiler. This will only cross-reference and document the C source files since they are the only ones that are compiled, but it will make sure that they are cross-referenced with the correct options etc. .SS Cxref Configuration File These command line arguments can also be put into a file named `.cxref' instead of on the command line. When cxref is run the arguments to the program are interpreted in the following order. (1) Those on the command line. (2) Those in the `.cxref' file in the current directory. (3) Those in the `.cxref' file in the source tree root specified by `-R'. This means that in a multi-directory source tree, each sub-directory can have a `.cxref' file containing just the line `-R..' or appropriate. The main directory can have a `.cxref' file containing the remainder of the options. This removes completely the need to have any options on the command line apart from the source file names. The format of the `.cxref' file is any number of lines, each one containing a single command line argument (equivalent to one of the argv). The only options that cannot be used are the names of source files themselves and the `-delete' option. Blank lines are ignored and lines starting with a '#' are comments. .SS Program Documentation Comments The documentation for the program is produced from comments in the code that are appropriately formatted. The cross referencing comes from the code itself and requires no extra work. The special comments are `/**** ****/' (for a file) and `/*++++ ++++*/' (for a data object) any number of `*' or `+' can be used inside of the standard `/*' and `*/' comment delimiters in the comments, they are ignored. If a comment line starts with whitespace and is followed by `+html+' then the rest of the line is included only in the HTML output, and is not processed so it can include HTML markup, `-html-' means that the rest of the line is included in all except the HTML output. The same also applies to the other output formats, `+none+' can be used for lines not to appear in any output. The exception to this is that the raw output does not do any checking and will output all lines. In any situation where a comment follows a `,', `;' or `)' separated only by spaces and tabs, the comment is pushed to before the punctuation to apply to object there. The program is implemented using a full ANSI C grammar parser with some GCC extensions, this means that the style of the code is unimportant, only the content and comments. .SS Cross Referencing The cross referencing is performed for the following items Files The files that the current file is included in (even when included via other files). #includes Files included in the current file. Files included by these files etc. Variables The location of the definition of external variables. The files that have visibility of global variables. The files / functions that use the variable. Functions The file that the function is prototyped in. The functions that the function calls. The functions that call the function. The files and functions that reference the function. The variables that are used in the function. Each of these items is cross referenced in the output. The cross referencing uses files `cxref.variable', `cxref.function', `cxref.include' and `cxref.typedef' in the output directory. These are a complete list of the function and variable usage in the program and could be used to generate a function call hierarchy or variable usage diagram for example. Two cxref passes of each file is needed, the first to build up the cross referencing files and the second to use them. (The file names are different if the `-N' option is used.) .SS LaTeX Output The default LaTeX output is a file for each of the source files with one extra file `cxref.tex' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.tex file has been written it can be modified by the user, any new files that are added are added at the end of the source code section, the rest of the file being unchanged. The index is written to a file called `cxref.apdx.tex' and cxref.tex is updated to refer to it. Also written out are three LaTeX style files `page.sty', `fonts.sty' and `cxref.sty'. These set up the page to use a smaller margin and smaller fonts to allow more to appear on a page and also define the new commands for typesetting the cxref output. (The file names `cxref.tex' and `cxref.apdx.tex' are different if the `-N' option is used.) .SS HTML Output The default HTML output is a file for each of the source files with one extra file `cxref.html' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.html file has been written it can be modified by the user, any new files that are added are added at the end before the table of contents, the rest of the file being unchanged. The index is written to a file called `cxref.apdx.html' and cxref.html is updated to refer to it. (The file names `cxref.html' and `cxref.apdx.html' are different if the `-N' option is used.) The HTML output uses the HTML 4.01 standard and all pages validate correctly. .SS RTF Output Rich Text Format is a fairly low level page description format devised by Microsoft. It is not a well defined and easy to understand standard as are the other formats, but it is popular for document exchange. There is a single output file for each of the source files and an index file. .SS SGML Output Since SGML is a meta-language it is necessary to define the layout elements as well as provide the information. The cxref output uses the LinuxDoc document format and is designed for use with the SGMLtools programs (http://www.sgmltools.org/). There is a single output file for each of the source files and an index file. .SH SEE ALSO The files that come with the cxref source code distribution give more information. The README file gives examples of how to use the comments in source code. There is a list of frequently asked questions and their answers for the cxref program in the FAQ file. A list of improvements planned for future versions of the program are listed in the file TODO. More up-to-date information can be found on the World Wide Web at the cxref homepage, reached via the author's homepage http://www.gedanken.demon.co.uk/. .SH BUGS If you wish to submit bug reports or other comments about the program then email the author amb@gedanken.demon.co.uk and put cxref in the subject line. .SH AUTHOR The cxref program was written by Andrew M. Bishop in 1995-2004. The cxref program is copyright Andrew M. Bishop 1995-2004. The cxref-cpp program is copyright Free Software Foundation, Inc. The cxref and cxref-cpp programs can be freely distributed according to the terms of the GNU General Public License (see the file `COPYING'). cxref-1.6d/doc/README.ps 644 233 144 142721 10150705036 10115 0%!PS-Adobe-2.0 %%Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %%Title: README.dvi %%Pages: 13 %%PageOrder: Ascend %%BoundingBox: 0 0 596 842 %%DocumentFonts: CMBX12 CMR10 CMR7 CMTT10 CMTI10 CMSY10 CMBX10 CMTT9 %%+ CMSY9 CMSL10 CMTI9 %%EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips README.dvi -o README.ps %DVIPSParameters: dpi=600, compressed %DVIPSSource: TeX output 2004.11.23:1906 %%BeginProcSet: texc.pro %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B /chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ /cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 {2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ 1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) (LaserWriter 16/600)]{A length product length le{A length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet %%BeginProcSet: texps.pro %! TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2 index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]FontType 0 ne{/Metrics exch def dict begin Encoding{exch dup type/integertype ne{ pop pop 1 sub dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def}ifelse}forall Metrics/Metrics currentdict end def}{{1 index type /nametype eq{exit}if exch pop}loop}ifelse[2 index currentdict end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def dup[ exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}if} forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}def end %%EndProcSet %%BeginFont: CMTI9 %%EndFont %%BeginFont: CMSL10 %%EndFont %%BeginFont: CMSY9 %%EndFont %%BeginFont: CMTT9 %%EndFont %%BeginFont: CMBX12 %%EndFont %%BeginFont: CMBX10 %%EndFont %%BeginFont: CMSY10 %%EndFont %%BeginFont: CMTI10 %%EndFont %%BeginFont: CMTT10 %%EndFont %%BeginFont: CMR7 %%EndFont %%BeginFont: CMR10 %%EndFont TeXDict begin 39158280 55380996 1000 600 600 (README.dvi) @start /Fa 139[25 4[39 43 4[24 3[35 1[35 15[43 28[39 2[39 39 39 2[24 4[31 31 40[{}14 74.7198 /CMTI9 rf /Fb 139[32 33 3[42 46 1[23 2[23 3[37 1[37 16[61 4[76 6[54 57 63 60 1[62 18[23 46[{}16 83.022 /CMSL10 rf /Fc 152[38 38 102[{}2 74.7198 /CMSY9 rf /Fd 134[39 1[39 39 39 39 39 39 1[39 39 39 39 39 2[39 39 39 39 39 39 39 39 39 34[39 1[39 39 4[39 39 39 39 39 39 2[39 1[39 1[39 39 39 4[39 35[{}36 74.7198 /CMTT9 rf /Fe 134[59 3[62 44 44 46 1[62 56 62 1[31 2[31 3[51 62 50 62 54 10[85 1[78 3[77 6[42 2[70 18[56 56 56 2[31 33[62 12[{}25 99.6264 /CMBX12 rf /Ff 134[50 50 1[50 53 37 38 39 1[53 48 53 80 27 2[27 53 48 29 44 53 42 53 46 4[50 5[72 1[66 53 72 2[72 1[91 57 3[75 75 60 63 73 69 1[72 6[27 48 1[48 48 48 48 48 48 48 48 48 27 32 3[37 37 1[74 3[50 34[{}53 83.022 /CMBX10 rf /Fg 240[42 13[23 1[{}2 83.022 /CMSY10 rf /Fh 131[85 2[40 39 55 38 45 28 34 35 1[42 42 47 68 21 38 1[25 42 38 25 38 42 38 1[42 3[25 43 25 3[83 2[59 5[62 7[54 1[63 59 8[25 11[25 30 25 64 42 34 34 5[43 25 20[47 51 11[{}44 83.022 /CMTI10 rf /Fi 130[44 1[44 1[44 44 44 44 44 44 44 44 1[44 44 44 44 44 44 1[44 44 44 44 44 44 44 44 44 3[44 44 44 2[44 2[44 44 44 44 1[44 44 44 44 44 2[44 44 2[44 44 44 1[44 2[44 44 44 44 44 44 1[44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 1[44 44 44 34[{}71 83.022 /CMTT10 rf /Fj 134[71 71 2[75 52 53 55 1[75 67 75 112 37 2[37 75 67 41 61 75 60 1[65 8[102 3[94 75 100 1[92 101 1[128 81 2[50 105 106 85 88 103 97 1[102 7[67 67 67 67 67 67 67 67 67 67 1[37 45 32[75 12[{}48 119.552 /CMBX12 rf /Fk 190[49 65[{}1 58.1154 /CMR7 rf /Fl 132[42 1[44 44 60 44 46 32 33 33 44 46 42 46 69 23 44 25 23 46 42 25 37 46 37 46 42 23 2[23 42 23 1[62 62 85 62 62 60 46 61 65 57 65 62 76 52 2[30 62 65 54 57 63 60 59 62 65 4[23 23 42 42 42 42 42 42 42 42 42 42 42 23 28 23 65 42 32 32 23 3[69 42 20[46 46 48 11[{}80 83.022 /CMR10 rf /Fm 135[123 2[129 90 92 95 1[129 116 129 194 65 2[65 1[116 71 106 1[103 1[113 4[120 5[175 3[173 2[175 1[220 6[146 153 178 168 1[175 10[116 4[116 2[65 77 6[181 3[120 34[{}32 206.559 /CMBX12 rf /Fn 139[75 1[79 1[108 7[108 2[88 3[94 29[140 15[97 97 97 49[{}10 172.188 /CMBX12 rf end %%EndProlog %%BeginSetup %%Feature: *Resolution 600dpi TeXDict begin %%PaperSize: A4 end %%EndSetup %%Page: 1 1 TeXDict begin 1 0 bop 0 664 a Fn(Chapter)65 b(1)0 1038 y Fm(C)71 b(Cross)f(Referencing)i(&)e(Do)6 b(cumen)-6 b(ting)0 1245 y(to)6 b(ol.)104 b(V)-19 b(ersion)77 b(1.6)g(-)h(cxref)0 1677 y Fl(A)28 b(program)d(that)j(can)g(automatically)e(generate)g(do)r (cumen)n(tation)i(and)f(cross)f(references)h(for)g(a)g(C)h(program.)0 1777 y(The)22 b(input)h(is)f(an)n(y)g(C)g(program)e(with)j(appropriate) d(commen)n(ts)i(and)g(the)g(output)h(is)f(L)2691 1760 y Fk(A)2728 1777 y Fl(T)2774 1795 y(E)2820 1777 y(X,)h(HTML,)g(R)-7 b(TF)22 b(or)g(SGML)0 1876 y(\014les.)0 2117 y Fj(1.1)135 b(Program)46 b(Options)0 2299 y Fl(The)28 b(name)f(of)h(the)g(program)d (is)j(cxref.)0 2418 y(Usage:)36 b Fi(cxref)493 2517 y(filename)k([)j (...)86 b(filename])493 2617 y([-Odirname])39 b([-Nbasename])f ([-Rdirname])493 2717 y([-all-comments])f([-no-comments])493 2816 y([-verbatim-comme)o(nt)o(s])g([-block-comments])493 2916 y([-xref[-all][-fi)o(le)o(][-)o(fu)o(nc)o(][-)o(va)o(r][)o(-t)o (ype)o(]])493 3016 y([-warn[-all][-co)o(mm)o(ent)o(][)o(-x)o(ref)o(]]) 493 3115 y([-index[-all][-f)o(il)o(e][)o(-f)o(un)o(c][)o(-v)o(ar])o([-) o(typ)o(e])o(])493 3215 y([-raw])493 3314 y([-latex])493 3414 y([-html[-src]])493 3514 y([-rtf])493 3613 y([-sgml])493 3713 y([-Idirname])i([-Ddefine])g([-Udefine])493 3813 y([-CPP)i(cpp)p 891 3813 27 4 v 30 w(program])g([--)h(cpp)p 1620 3813 V 30 w(arg)h([)g(...)86 b(cpp)p 2262 3813 V 30 w(arg]])0 3920 y Fl(Usage:)36 b Fi(cxref)493 4020 y(filename)k([)j(...)86 b(filename])40 b(-delete)493 4120 y([-Odirname])f([-Nbasename])f([-Rdirname])210 4297 y(filename)g Fl(The)28 b(name)f(of)h(the)g(\014le)f(to)h(do)r(cumen)n (t,)g(an)n(y)f(n)n(um)n(b)r(er)g(of)g(\014les)h(ma)n(y)f(b)r(e)h(do)r (cumen)n(ted)g(at)f(a)g(time.)253 4462 y Fi(-delete)39 b Fl(The)c(\014les)f(named)g(are)g(to)g(b)r(e)h(deleted)g(from)f(the)h (output)g(directory)e(and)i(their)f(en)n(tries)g(in)h(the)600 4561 y(cross)26 b(reference)h(database)f(and)i(main)f(output)h(\014les) g(are)e(to)i(b)r(e)g(remo)n(v)n(ed.)166 4727 y Fi(-Odirname)38 b Fl(The)30 b(name)g(of)g(a)g(directory)f(to)h(use)f(for)h(the)h (output)f(L)2343 4710 y Fk(A)2380 4727 y Fl(T)2426 4744 y(E)2472 4727 y(X\014les)g(and)g(the)h(lo)r(cation)e(of)h(the)h(cross) 600 4826 y(reference)c(\014les)g(that)h(are)f(created.)123 4991 y Fi(-Nbasename)37 b Fl(The)23 b(name)g(to)g(use)g(for)f(the)h (\014rst)g(part)g(of)g(the)g(output)g(and)g(cross)f(reference)g (\014les)h(instead)f(of)h(cxref,)600 5091 y(the)28 b(\014le)g (extensions)f(remain)g(the)h(same.)166 5256 y Fi(-Rdirname)38 b Fl(When)32 b(the)f(source)f(\014les)h(are)f(in)h(more)g(than)g(one)g (directory)-7 b(,)31 b(set)g(dirname)f(to)h(the)h(name)f(of)g(the)600 5356 y(ro)r(ot)i(directory)f(of)i(the)g(source)f(tree)g(\(use)h (relativ)n(e)f(path)g(if)i(easier)d(e.g.)55 b(\\-R../.."\).)f(This)34 b(will)600 5456 y(then)c(run)f(cxref)h(from)f(that)h(ro)r(ot)e (directory)h(and)g(the)h(\\-Odirname")d(m)n(ust)j(b)r(e)g(relativ)n(e)e (to)i(that)600 5555 y(directory)-7 b(.)-8 5720 y Fi(-all-comments)36 b Fl(In)27 b(case)f(y)n(ou)g(think)h(that)h(the)f(existing)f(commen)n (ts)h(migh)n(t)g(w)n(ork,)e(\(see)i(b)r(elo)n(w)f(for)h(description)f (of)600 5820 y(sp)r(ecial)h(commen)n(ts\).)37 b Fh([Danger!)i(This)31 b(option)g(c)l(an)f(pr)l(o)l(duc)l(e)g(weir)l(d)h(r)l(esults.])1854 5970 y Fl(1)p eop end %%Page: 2 2 TeXDict begin 2 1 bop 3708 -150 a Fl(2)35 83 y Fi(-no-comments)37 b Fl(Ignores)23 b(all)i(commen)n(ts,)g(useful)g(if)g(y)n(ou)f(just)h(w) n(an)n(t)g(the)g(cross)e(references)h(and)g(not)h(the)g(do)r(cumen-)600 183 y(tation.)-226 349 y Fi(-verbatim-commen)o(ts)35 b Fl(When)29 b(the)f(commen)n(ts)g(that)h(y)n(ou)e(ha)n(v)n(e)h(in)g (the)h(co)r(de)f(are)f(formatted)h(in)h(a)e(predetermined)h(st)n(yle) 600 448 y(that)33 b(y)n(ou)f(w)n(an)n(t)g(to)h(preserv)n(e)d(on)j(the)g (output,)i(this)e(option)f(will)h(force)f(them)h(not)g(to)f(b)r(e)i (refor-)600 548 y(matted.)j Fh([Note,)31 b(this)f(is)g(for)h(\014le)e (and)i(function)e(c)l(omments)h(only.])-95 714 y Fi(-block-comments)35 b Fl(When)28 b(the)f(commen)n(ts)g(in)g(the)h(program)d(are)h (formatted)h(in)g(the)h(\\blo)r(c)n(k")d(st)n(yle)i(\(with)h(a)f (leading)600 814 y(\\*")32 b(c)n(haracter)g(on)h(ev)n(ery)f(line\),)k (this)d(option)h(will)f(remo)n(v)n(e)f(that)i(c)n(haracter)d(from)j (the)f(output.)600 913 y Fh([Works)e(for)f(a)g(single)h(\\*",)f(\\+",)f (\\|")g(or)h(\\:")38 b(on)30 b(e)l(ach)h(line.])341 1079 y Fi(-xref)39 b Fl(Pro)r(duce)27 b(cross)f(referencing)g(information)h (\(see)h(b)r(elo)n(w\).)984 1245 y Fi(-all)40 b Fl(All)28 b(cross)e(references.)941 1378 y Fi(-file)39 b Fl(Cross)26 b(references)h(for)g(\014les.)941 1511 y Fi(-func)39 b Fl(Cross)26 b(references)h(for)g(functions.)984 1644 y Fi(-var)40 b Fl(Cross)26 b(references)h(for)g(v)-5 b(ariables.)941 1777 y Fi(-type)39 b Fl(Cross)26 b(references)h(for)g (t)n(yp)r(es.)341 1943 y Fi(-warn)39 b Fl(Pro)r(duce)27 b(w)n(arnings,)f(the)i(options)f(m)n(ust)g(b)r(e)h(concatenated)f (together:)984 2109 y Fi(-all)40 b Fl(All)28 b(w)n(arnings.)810 2242 y Fi(-comment)38 b Fl(W)-7 b(arn)27 b(of)h(missing)f(commen)n(ts.) 941 2374 y Fi(-xref)39 b Fl(W)-7 b(arn)27 b(of)h(missing)f(cross)f (references.)297 2540 y Fi(-index)39 b Fl(Pro)r(duce)27 b(a)g(cross)f(reference)h(index,)g(the)h(options)f(m)n(ust)h(b)r(e)g (concatenated)f(together:)984 2707 y Fi(-all)40 b Fl(All)28 b(indexes.)941 2839 y Fi(-file)39 b Fl(Index)28 b(of)f(\014les.)941 2972 y Fi(-func)39 b Fl(Index)28 b(of)f(functions.)984 3105 y Fi(-var)40 b Fl(Index)28 b(of)f(v)-5 b(ariables.)941 3238 y Fi(-type)39 b Fl(Index)28 b(of)f(t)n(yp)r(es.)384 3404 y Fi(-raw)40 b Fl(Pro)r(duce)27 b(a)g(ra)n(w)f(form)h(of)h (output,)g(not)g(really)e(of)i(m)n(uc)n(h)f(use)h(except)f(with)h(-w)n (arn.)297 3570 y Fi(-latex)39 b Fl(Pro)r(duce)31 b(a)h(LaT)-7 b(eX)32 b(\014le)g(to)g(do)r(cumen)n(t)h(eac)n(h)e(of)h(the)h(source)e (\014les)h(and)g(also)f(an)h(extra)f(\014le)i(that)600 3670 y(includes)28 b(eac)n(h)f(of)g(these)h(\014les.)341 3836 y Fi(-html)39 b Fl(Pro)r(duce)d(an)g(HTML)h(4.01)f(\014le)g(to)h (do)r(cumen)n(t)g(eac)n(h)f(of)h(the)g(source)e(\014les)i(and)f(a)h (main)f(\014le)h(to)600 3935 y(reference)27 b(eac)n(h)f(of)i(these)g (\014les.)166 4101 y Fi(-html-src)38 b Fl(Pro)r(duce)27 b(the)h(HTML)f(output)i(and)e(an)g(HTML)h(v)n(ersion)e(of)i(the)g (source)e(\014le)i(with)g(links)f(in)n(to)h(it.)384 4267 y Fi(-rtf)40 b Fl(Pro)r(duce)27 b(a)g(Ric)n(h)g(T)-7 b(ext)28 b(F)-7 b(ormat)27 b(\(R)-7 b(TF\))29 b(\014le)e(to)h(do)r (cumen)n(t)g(the)g(source)e(\014le.)341 4433 y Fi(-sgml)39 b Fl(Pro)r(duce)27 b(an)g(SGML)h(\014le)g(to)f(do)r(cumen)n(t)h(the)g (source)e(\014le.)37 b(\(Using)28 b(the)g(Lin)n(uxDo)r(c)f(DTD\).)166 4599 y Fi(-Idirname)38 b Fl(GCC)28 b(option)f(to)h(sp)r(ecify)f(the)h (path)g(for)f(include)h(\014les.)210 4765 y Fi(-Ddefine)38 b Fl(GCC)28 b(option)f(to)h(de\014ne)f(a)h(pre-pro)r(cessor)c(sym)n(b)r (ol.)210 4932 y Fi(-Udefine)38 b Fl(GCC)28 b(option)f(to)h(unde\014ne)g (a)f(pre-pro)r(cessor)d(sym)n(b)r(ol.)35 5098 y Fi(-CPP)42 b(program)d Fl(The)23 b(name)g(of)g(the)g(program)e(to)i(use)f(instead) h(of)g(the)g(compile)g(time)g(default.)36 b(The)23 b(program)e(m)n(ust) 600 5197 y(b)r(e)26 b(able)e(to)i(p)r(erform)e(all)h(of)g(the)h (actions)e(that)i(\\gcc)e(-E)g(-C)h(-dD")g(do)r(es)g(to)g(w)n(ork.)35 b(If)26 b(the)f(program)600 5297 y(tak)n(es)i(argumen)n(ts)f(then)i (the)g(whole)f(thing)h(needs)g(to)f(b)r(e)h(in)g(quotes)f(so)g(that)h (it)g(is)g(in)n(terpreted)f(as)600 5396 y(a)g(single)g(argumen)n(t)g (to)g(cxref.)-95 5562 y Fi(--)42 b(arg)h(...)86 b(arg)40 b Fl(Extra)20 b(argumen)n(ts)f(to)i(b)r(e)g(passed)f(to)h(the)h (pre-pro)r(cessor)17 b(can)k(b)r(e)g(placed)g(after)g(the)g(\\{")e (separator.)p eop end %%Page: 3 3 TeXDict begin 3 2 bop 3708 -150 a Fl(3)0 83 y Fj(1.2)135 b(C)45 b(Compiler)h(Replacemen)l(t)h(cxref-cc)0 265 y Fl(T)-7 b(o)28 b(simplify)h(using)f(cxref)g(on)g(existing)g(source)f (co)r(de,)h(there)g(is)h(no)n(w)e(a)h(shell)g(script)h(that)f(will)h (call)f(the)g(C)h(compiler)0 364 y(and)g(then)g(call)g(cxref)f(to)h (pro)r(cess)f(the)h(source)f(\014le.)41 b(This)29 b(means)g(that)g(it)h (can)e(b)r(e)i(used)e(as)h(a)f(drop)h(in)g(replacemen)n(t)0 464 y(for)e(CC)h(in)g(Mak)n(e\014les)e(and)h(the)h(lik)n(e.)0 564 y(Usage:)36 b(cxref-cc)27 b([usual)g(cc)g(options])0 663 y(The)37 b(name)g(of)h(the)f(source)f(\014le)i(is)f(extracted)g (from)g(the)g(list)h(of)f(options)g(as)g(w)n(ell)g(as)f(the)i(\\-D*",)g (\\-I*",)h(\\-U*")0 763 y(\015ags)33 b(and)i(when)g(the)f(C)h(compiler) f(exits)g(succesfully)h(cxref)f(will)g(b)r(e)h(called.)58 b(The)34 b(name)g(of)h(the)g(C)f(compiler)g(to)0 863 y(use)27 b(is)h(con)n(trolled)e(b)n(y)h(the)h(CXREF)n(CC)f(en)n (vironmen)n(t)g(v)-5 b(ariable,)26 b(or)h(if)h(this)f(is)h(not)f(set)h (then)g(the)g(CC)f(en)n(vironmen)n(t)0 962 y(v)-5 b(ariable,)27 b(or)f(failing)i(this)g(just)g(gcc.)0 1062 y(Using)36 b(this)g(script)g(requires)f(the)i(use)f(of)g(a)f(`.cxref)6 b(')37 b(con\014guration)d(\014le)j(to)f(con)n(tain)f(the)i(options)e (since)h(there)g(is)0 1162 y(no)n(where)26 b(to)i(put)g(the)g(options)f (on)g(the)h(command)g(line)f(for)g(the)h(C)g(compiler.)0 1261 y(This)36 b(will)g(only)g(cross-reference)d(and)j(do)r(cumen)n(t)g (the)h(C)f(source)e(\014les)i(since)g(they)g(are)f(the)i(only)e(ones)h (that)g(are)0 1361 y(compiled,)28 b(but)g(it)g(will)g(mak)n(e)e(sure)h (that)h(they)g(are)f(cross-referenced)e(with)j(the)g(correct)e(options) h(etc.)0 1602 y Fj(1.3)135 b(Cxref)46 b(con\014guration)f(File)0 1784 y Fl(These)30 b(command)f(line)i(argumen)n(ts)e(can)g(also)g(b)r (e)i(put)f(in)n(to)g(a)g(\014le)g(named)g(\\.cxref)6 b(")29 b(instead)h(of)g(on)g(the)g(command)0 1884 y(line.)37 b(When)28 b(cxref)f(is)h(run)f(the)h(argumen)n(ts)f(to)g(the)h(program) e(are)g(in)n(terpreted)h(in)h(the)g(follo)n(wing)f(order.)101 2066 y(1.)42 b(Those)26 b(on)i(the)g(command)f(line.)101 2232 y(2.)42 b(Those)26 b(in)i(the)g(\\.cxref)6 b(")27 b(\014le)h(in)g(the)g(curren)n(t)e(directory)-7 b(.)101 2398 y(3.)42 b(Those)26 b(in)i(the)g(\\.cxref)6 b(")27 b(\014le)h(in)g(the)g(source)e(tree)h(ro)r(ot)g(sp)r(eci\014ed)h(b)n(y) f(\\-R".)0 2581 y(This)h(means)g(that)h(in)g(a)f(m)n(ulti-directory)f (source)h(tree,)g(eac)n(h)g(sub-directory)e(can)j(ha)n(v)n(e)e(a)h (\\.cxref)6 b(")27 b(\014le)i(con)n(taining)0 2681 y(just)24 b(the)h(line)f(\\-R..")34 b(or)23 b(appropriate.)34 b(The)24 b(main)f(directory)g(can)g(ha)n(v)n(e)g(a)g(\\.cxref)6 b(")23 b(\014le)h(con)n(taining)f(the)h(remainder)0 2780 y(of)k(the)g(options.)37 b(This)28 b(remo)n(v)n(es)e(completely)h(the)i (need)f(to)f(ha)n(v)n(e)g(an)n(y)g(options)g(on)h(the)g(command)f(line) i(apart)d(from)0 2880 y(the)i(source)e(\014le)i(names.)0 2979 y(The)c(format)g(of)g(the)h(.cxref)f(\014le)g(is)g(an)n(y)g(n)n (um)n(b)r(er)g(of)g(lines,)h(eac)n(h)e(one)h(con)n(taining)f(a)h (single)g(command)g(line)g(argumen)n(t)0 3079 y(\(equiv)-5 b(alen)n(t)36 b(to)f(one)g(of)h(the)g(argv\).)59 b(The)35 b(only)h(options)f(that)g(cannot)g(b)r(e)h(used)g(are)e(the)i(names)f (of)h(source)e(\014les)0 3179 y(themselv)n(es)23 b(and)g(the)h (\\-delete")f(option.)35 b(Blank)23 b(lines)g(are)g(ignored)f(and)i (lines)f(starting)g(with)h(a)f(`#')h(are)e(commen)n(ts.)0 3420 y Fj(1.4)135 b(Program)46 b(Do)t(cumen)l(tation)g(Commen)l(ts)0 3602 y Fl(The)38 b(do)r(cumen)n(tation)f(for)g(the)h(program)e(is)h (pro)r(duced)h(from)f(commen)n(ts)g(in)h(the)g(co)r(de)f(that)h(are)f (appropriately)0 3702 y(formatted.)g(The)27 b(cross)f(referencing)h (comes)g(from)g(the)h(co)r(de)f(itself)i(and)e(requires)f(no)i(extra)e (w)n(ork.)0 3801 y(The)j(sp)r(ecial)f(commen)n(ts)h(are)f(\\/****)e (****/")f(\(for)k(a)f(\014le\))i(and)e(\\/*++++)e(++++*/")g(\(for)i(a)h (data)f(ob)5 b(ject\))29 b(an)n(y)0 3901 y(n)n(um)n(b)r(er)36 b(of)f(\\*")g(or)g(\\+")f(can)h(b)r(e)i(used)e(inside)h(of)g(the)g (standard)f(\\/*")f(and)h(\\*/")f(commen)n(t)i(delimiters)g(in)g(the)0 4000 y(commen)n(ts,)27 b(they)h(are)f(ignored.)0 4100 y(If)c(a)g(commen)n(t)g(line)g(starts)g(with)g(whitespace)g(and)g(is)g (follo)n(w)n(ed)f(b)n(y)g(`+h)n(tml+')h(then)h(the)f(rest)g(of)g(the)g (line)h(is)f(included)0 4200 y(only)30 b(in)h(the)g(HTML)h(output,)g (and)e(is)h(not)g(pro)r(cessed)e(so)h(it)h(can)g(include)g(HTML)g (markup,)g(`-h)n(tml-')g(means)f(that)0 4299 y(the)23 b(rest)g(of)f(the)i(line)f(is)g(included)g(in)g(all)g(except)g(the)g (HTML)g(output.)36 b(The)23 b(same)f(also)g(applies)g(to)h(the)g(other) g(output)0 4399 y(formats,)28 b(`+none+')f(can)h(b)r(e)g(used)h(for)e (lines)h(not)h(to)f(app)r(ear)f(in)i(an)n(y)e(output.)39 b(The)29 b(exception)e(to)i(this)f(is)g(that)h(the)0 4499 y(ra)n(w)d(output)i(do)r(es)g(not)f(do)h(an)n(y)e(c)n(hec)n(king)h (and)g(will)h(output)g(all)g(lines.)0 4598 y(In)38 b(an)n(y)f (situation)g(where)h(a)f(commen)n(t)h(follo)n(ws)e(a)i(\\,",)h(\\;")j (or)37 b(\\\)")g(separated)g(only)g(b)n(y)g(spaces)g(and)h(tabs,)i(the) 0 4698 y(commen)n(t)27 b(is)h(pushed)g(to)f(b)r(efore)h(the)g (punctuation)f(to)h(apply)f(to)h(the)g(ob)5 b(ject)27 b(there.)0 4797 y(The)21 b(program)e(is)i(implemen)n(ted)h(using)f(a)f (full)i(ANSI)g(C)f(grammar)e(parser)h(with)i(some)e(GCC)h(extensions,)h (this)g(means)0 4897 y(that)28 b(the)g(st)n(yle)f(of)h(the)g(co)r(de)f (is)g(unimp)r(ortan)n(t,)h(only)f(the)h(con)n(ten)n(t)f(and)h(commen)n (ts.)0 5138 y Fj(1.5)135 b(Automated)46 b(Commen)l(t)g(Insertion)0 5320 y Fl(T)-7 b(o)30 b(simplify)i(the)f(insertion)f(of)h(commen)n(ts)f (that)h(will)g(b)r(e)g(parsed)f(b)n(y)g(cxref,)h(the)g(\014le)g (cxref.el)g(pro)n(vides)e(a)h(n)n(um)n(b)r(er)0 5420 y(of)i(Emacs)e(lisp)i(functions.)49 b(T)-7 b(o)31 b(use)h(them)g(add)f (the)h(line)g Fi(\(load)42 b("cxref"\))28 b Fl(to)k(y)n(our)e (\\.emacs")g(\014le)i(or)e(t)n(yp)r(e)i Fi(M-x)0 5519 y(load-file)40 b(cxref.el)24 b Fl(from)j(within)i(Emacs.)0 5619 y(The)f(functions)g(and)f(k)n(ey)g(bindings)g(are:)p eop end %%Page: 4 4 TeXDict begin 4 3 bop 3708 -150 a Fl(4)-5 83 y Fh(Contr)l(ol-C)30 b(Contr)l(ol-F)42 b Fl(Adds)25 b(\014le)f(commen)n(ts,)h(a)f(/**)f(**/) g(header)h(at)g(the)h(top)g(of)f(the)h(\014le)g(and)f(if)h(it)g(is)f(a) g(.h)h(\014le)g(then)780 183 y(it)35 b(also)f(adds)g(a)g(#ifndef,)k (#de\014ne)d(at)g(the)g(b)r(eginning)g(and)f(#endif)i(at)f(the)g(end)g (to)f(stop)780 282 y(m)n(ultiple)28 b(inclusions.)324 448 y Fh(Contr)l(ol-C)i(f)42 b Fl(Adds)28 b(commen)n(ts)f(to)h(a)f (function,)h(the)h(cursor)d(m)n(ust)h(b)r(e)i(on)e(the)h(line)g(con)n (taining)f(the)h(start)780 548 y(of)h(the)h(function)f(de\014nition)h (when)f(this)h(function)f(is)g(called.)42 b(The)29 b(/*+)f(...)41 b(+*/)28 b(commen)n(t)780 648 y(that)g(is)f(added)h(is)f(of)h(the)g (header)f(t)n(yp)r(e)g(\(see)h(the)g(examples\))f(not)h(inline.)311 814 y Fh(Contr)l(ol-C)i(v)42 b Fl(Adds)28 b(a)f(leading)g(commen)n(t)h (to)f(the)h(v)-5 b(ariable)27 b(or)f(other)h(de\014nition)h(on)g(the)g (curren)n(t)e(line.)311 980 y Fh(Contr)l(ol-C)k(e)42 b Fl(Adds)28 b(a)f(trailing)g(commen)n(t)g(at)h(the)g(end)g(of)f(the)h (line.)324 1146 y Fh(Contr)l(ol-C)i(i)42 b Fl(Adds)28 b(an)f(inline)h(commen)n(t)g(that)g(is)f(ignored)f(b)n(y)i(cxref.)0 1387 y Fj(1.6)135 b(C)45 b(Prepro)t(cessor)0 1569 y Fl(T)-7 b(o)27 b(impro)n(v)n(e)g(the)h(output)g(that)g(is)g(a)n(v)-5 b(ailable)26 b(a)h(mo)r(di\014ed)h(v)n(ersion)f(of)g(the)h(GNU)h(CPP)e (V2.7.2)f(is)i(supplied)g(\(named)0 1669 y(cxref-cpp\).)0 1768 y(This)g(mo)r(di\014ed)g(C)f(prepro)r(cessor)e(allo)n(ws)i(for)g (a)g(\014ner)g(con)n(trol)g(o)n(v)n(er)f(some)h(features)g(of)g(the)h (prepro)r(cessing)e(that)i(are)0 1868 y(not)j(imp)r(ortan)n(t)g(for)f (a)h(compiler.)46 b(In)31 b(a)f(standard)g(prepro)r(cessor,)g(the)h (prepro)r(cessor)d(directiv)n(es)i(are)g(in)n(tended)i(for)0 1967 y(use)27 b(only)h(b)n(y)f(the)h(prepro)r(cessor,)d(so)i(passing)f (the)i(information)f(through)g(is)h(not)f(imp)r(ortan)n(t.)0 2067 y(With)h(cxref-cpp,)g(there)f(are)g(t)n(w)n(o)f(features)h(that)h (are)f(di\013eren)n(t)h(to)f(the)h(standard)f(GNU)h(CPP:)101 2250 y(1.)42 b(The)28 b(#include)g(directiv)n(es)f(from)h(the)h(\014le) f(are)f(output)i(in)f(the)g(same)g(w)n(a)n(y)f(as)g(the)h(#de\014nes)h (are)e(output.)39 b(An)208 2349 y(extra)29 b(\015ag)g(has)h(b)r(een)g (added)g(to)g(cpp)h(to)f(do)f(this,)j('-dI',)e(it)g(w)n(orks)f(in)h (the)h(same)e(w)n(a)n(y)g(as)g(the)i(existing)f('-dD')208 2449 y(\015ag)c(for)h(#de\014nes.)101 2615 y(2.)42 b(Commen)n(ts)28 b(trailing)f(a)h(#include)h(or)f(a)g(#de\014ne)h(are)e(dropp)r(ed)h (with)h(GNU)g(CPP)f(ev)n(en)g(if)g(-C)h(is)f(used.)39 b(This)208 2715 y(is)27 b(not)h(imp)r(ortan)n(t)f(while)h(compiling)f (but)h(is)g(useful)g(for)f(do)r(cumen)n(ting.)0 2956 y Fj(1.7)135 b(Cross)46 b(Referencing)0 3138 y Fl(The)28 b(cross)e(referencing)g(is)i(p)r(erformed)f(for)g(the)h(follo)n(wing)e (items)389 3304 y(Files)141 b Fg(\017)41 b Fl(The)27 b(\014les)h(that)g(the)g(curren)n(t)e(\014le)i(is)g(included)g(in)g (\(ev)n(en)f(when)h(included)g(via)f(other)g(\014les\).)198 3470 y(#includes)142 b Fg(\017)41 b Fl(Files)27 b(included)h(in)g(the)g (curren)n(t)f(\014le.)700 3603 y Fg(\017)41 b Fl(Files)27 b(included)h(b)n(y)g(these)f(\014les)h(etc.)226 3769 y(V)-7 b(ariables)140 b Fg(\017)41 b Fl(The)27 b(lo)r(cation)g(of)h (the)g(de\014nition)g(of)f(external)g(v)-5 b(ariables.)700 3902 y Fg(\017)41 b Fl(The)27 b(\014les)h(that)g(ha)n(v)n(e)e (visibilit)n(y)i(of)f(global)g(v)-5 b(ariables.)700 4034 y Fg(\017)41 b Fl(The)27 b(\014les)h(/)f(functions)h(that)g(use)f(the)h (v)-5 b(ariable.)206 4200 y(F)e(unctions)142 b Fg(\017)41 b Fl(The)27 b(\014le)h(that)g(the)g(function)g(is)g(protot)n(yp)r(ed)e (in.)700 4333 y Fg(\017)41 b Fl(The)27 b(functions)h(that)g(the)g (function)g(calls.)700 4466 y Fg(\017)41 b Fl(The)27 b(functions)h(that)g(call)f(the)h(function.)700 4599 y Fg(\017)41 b Fl(The)27 b(\014les)h(and)f(functions)h(that)g (reference)f(the)h(function.)700 4732 y Fg(\017)41 b Fl(The)27 b(v)-5 b(ariables)27 b(that)g(are)g(used)h(in)g(the)g (function.)0 4898 y(Eac)n(h)e(of)i(these)g(items)f(is)h(cross)e (referenced)h(in)h(the)g(output.)0 4997 y(The)e(cross)f(referencing)h (uses)g(\014les)g(`cxref.v)-5 b(ariable',)25 b(`cxref.function',)i (`cxref.include')g(and)f(`cxref.t)n(yp)r(edef)6 b(')27 b(in)g(the)0 5097 y(output)h(directory)-7 b(.)0 5197 y(These)21 b(are)g(a)g(complete)h(list)g(of)f(the)h(function)g(and)g(v) -5 b(ariable)20 b(usage)h(in)h(the)g(program)d(and)j(could)f(b)r(e)h (used)g(to)f(generate)0 5296 y(a)27 b(function)h(call)g(hierarc)n(h)n (y)d(or)i(v)-5 b(ariable)26 b(usage)h(diagram)f(for)h(example.)0 5396 y(Tw)n(o)f(cxref)g(passes)g(of)g(eac)n(h)g(\014le)h(is)f(needed,)h (the)g(\014rst)g(to)f(build)h(up)g(the)g(cross)f(referencing)f(\014les) i(and)f(the)h(second)f(to)0 5496 y(use)h(them.)0 5595 y Fh(\(The)k(\014le)e(names)h(ar)l(e)g(di\013er)l(ent)g(if)h(the)f (\\-N")e(option)j(is)f(use)l(d.\))p eop end %%Page: 5 5 TeXDict begin 5 4 bop 3708 -150 a Fl(5)0 83 y Fj(1.8)135 b(L)339 58 y Ff(A)391 83 y Fj(T)463 110 y(E)533 83 y(XOutput)0 265 y Fl(The)26 b(default)h(L)469 248 y Fk(A)506 265 y Fl(T)552 283 y(E)598 265 y(Xoutput)f(is)g(a)g(\014le)g(for)g(eac)n(h) f(of)h(the)h(source)e(\014les)h(with)h(one)e(extra)g(\014le)i (\\cxref.tex")e(that)h(includes)0 364 y(eac)n(h)39 b(of)h(the)g(other)f (\014les.)73 b(This)40 b(is)f(to)h(allo)n(w)f(a)g(mak)n(e\014le)g(to)g (only)h(up)r(date)g(the)g(c)n(hanged)f(\014les)g(\(although)h(the)0 464 y(references)33 b(ma)n(y)g(require)g(all)g(of)h(the)g(\014les)g(to) g(b)r(e)g(c)n(hec)n(k)n(ed)f(again\).)55 b(When)34 b(the)h(cxref.tex)e (\014le)h(has)g(b)r(een)g(written)0 564 y(it)f(can)f(b)r(e)i(mo)r (di\014ed)f(b)n(y)f(the)h(user,)h(an)n(y)e(new)g(\014les)h(that)g(are)f (added)g(are)g(added)g(at)h(the)g(end)g(of)g(the)g(source)e(co)r(de)0 663 y(section,)c(the)h(rest)f(of)h(the)g(\014le)g(b)r(eing)f(unc)n (hanged.)0 763 y(The)h(index)f(is)h(written)g(to)f(a)g(\014le)h(called) f(\\cxref.ap)r(dx.tex")f(and)i(cxref.tex)f(is)h(up)r(dated)g(to)f (refer)g(to)h(it.)0 863 y(Also)23 b(written)h(out)g(are)f(three)g(L)979 846 y Fk(A)1016 863 y Fl(T)1062 880 y(E)1108 863 y(Xst)n(yle)h(\014les) g(\\page.st)n(y",)e(\\fon)n(ts.st)n(y")g(and)i(\\cxref.st)n(y".)33 b(These)24 b(set)g(up)g(the)g(page)0 962 y(to)32 b(use)f(a)h(smaller)f (margin)f(and)i(smaller)f(fon)n(ts)h(to)f(allo)n(w)g(more)g(to)h(app)r (ear)f(on)g(a)g(page)g(and)h(also)f(de\014ne)h(the)g(new)0 1062 y(commands)27 b(for)g(t)n(yp)r(esetting)h(the)g(cxref)f(output.)0 1162 y Fh(\(The)k(\014le)e(names)h(\\cxr)l(ef.tex")f(and)i(\\cxr)l (ef.ap)l(dx.tex")f(ar)l(e)g(di\013er)l(ent)g(if)g(the)g(\\-N")f(option) h(is)g(use)l(d.\))0 1403 y Fj(1.9)135 b(HTML)44 b(Output)0 1585 y Fl(The)37 b(default)h(HTML)f(output)h(is)f(a)g(\014le)g(for)g (eac)n(h)f(of)h(the)h(source)e(\014les)h(with)g(one)g(extra)f(\014le)i (\\cxref.h)n(tml")e(that)0 1684 y(includes)24 b(eac)n(h)e(of)i(the)f (other)g(\014les.)36 b(This)23 b(is)g(to)h(allo)n(w)e(a)h(mak)n (e\014le)g(to)g(only)g(up)r(date)h(the)g(c)n(hanged)e(\014les)i (\(although)f(the)0 1784 y(references)30 b(ma)n(y)g(require)g(all)h(of) g(the)g(\014les)g(to)g(b)r(e)g(c)n(hec)n(k)n(ed)f(again\).)46 b(When)32 b(the)f(cxref.h)n(tml)g(\014le)g(has)f(b)r(een)i(written)0 1884 y(it)h(can)e(b)r(e)i(mo)r(di\014ed)g(b)n(y)e(the)i(user,)g(an)n(y) e(new)h(\014les)h(that)f(are)f(added)h(are)f(added)h(at)h(the)f(end)h (b)r(efore)e(the)i(table)f(of)0 1983 y(con)n(ten)n(ts,)27 b(the)h(rest)f(of)h(the)g(\014le)f(b)r(eing)h(unc)n(hanged.)0 2083 y(The)g(index)f(is)h(written)g(to)f(a)g(\014le)h(called)f (\\cxref.ap)r(dx.h)n(tml")g(and)g(cxref.h)n(tml)h(is)f(up)r(dated)i(to) e(refer)g(to)g(it.)0 2182 y Fh(\(The)k(\014le)e(names)h(\\cxr)l (ef.html")g(and)g(\\cxr)l(ef.ap)l(dx.html")h(ar)l(e)f(di\013er)l(ent)g (if)h(the)f(\\-N")e(option)j(is)f(use)l(d.\))0 2282 y Fl(The)e(HTML)g(output)g(uses)f(the)h(HTML)g(4.01)e(standard)h(and)g (all)g(pages)g(v)-5 b(alidate)27 b(correctly)-7 b(.)0 2523 y Fj(1.10)136 b(R)-11 b(TF)44 b(Output)0 2705 y Fl(Ric)n(h)19 b(T)-7 b(ext)20 b(F)-7 b(ormat)18 b(is)h(a)g(fairly)g(lo) n(w)f(lev)n(el)h(page)f(description)h(format)g(devised)g(b)n(y)g (Microsoft.)33 b(It)20 b(is)f(not)g(a)g(w)n(ell)g(de\014ned)0 2805 y(and)27 b(easy)g(to)h(understand)f(standard)f(as)h(are)g(the)h (other)f(formats,)g(but)h(it)g(is)g(p)r(opular)e(for)i(do)r(cumen)n(t)f (exc)n(hange.)0 2905 y(There)g(is)h(a)f(single)g(output)h(\014le)g(for) f(eac)n(h)g(of)g(the)h(source)e(\014les)i(and)f(an)h(index)f(\014le.)0 3146 y Fj(1.11)136 b(SGML)43 b(Output)0 3328 y Fl(Since)38 b(SGML)f(is)h(a)f(meta-language)e(it)j(is)f(necessary)f(to)h(de\014ne)h (the)g(la)n(y)n(out)e(elemen)n(ts)i(as)e(w)n(ell)i(as)e(pro)n(vide)h (the)0 3427 y(information.)56 b(The)34 b(cxref)g(output)h(uses)f(the)g (Lin)n(uxDo)r(c)g(do)r(cumen)n(t)h(format)e(and)h(is)g(designed)g(for)g (use)g(with)h(the)0 3527 y(SGMLto)r(ols)27 b(programs)f(\(h)n (ttp://www.sgmlto)r(ols.org/\).)0 3627 y(There)h(is)h(a)f(single)g (output)h(\014le)g(for)f(eac)n(h)g(of)g(the)h(source)e(\014les)i(and)f (an)h(index)f(\014le.)0 3868 y Fj(1.12)136 b(Example)46 b(Sp)t(ecial)f(Commen)l(ts)0 4050 y Fl(The)31 b(\014le)f(\\README.c")g (is)g(included)h(at)f(the)h(end)g(of)f(this)h(do)r(cumen)n(t)g(to)f (sho)n(w)g(that)g(the)h(commen)n(ts)f(are)g(indeed)0 4149 y(seen)d(in)h(the)g(co)r(de,)g(the)g(result)f(of)h(running)f(this) h(through)f(cxref)g(is)g(also)g(included.)0 4391 y Fj(1.13)136 b(F)-11 b(urther)44 b(Information)0 4573 y Fl(There)27 b(is)h(a)f(list)h(of)g(frequen)n(tly)f(ask)n(ed)g(questions)g(and)h (their)f(answ)n(ers)f(for)i(the)g(cxref)f(program)f(in)i(the)g(F)-9 b(A)n(Q)27 b(\014le.)38 b(A)0 4672 y(list)28 b(of)f(impro)n(v)n(emen)n (ts)f(planned)i(for)f(future)h(v)n(ersions)e(of)i(the)g(program)d(are)i (listed)h(in)f(the)h(\014le)g(TODO.)0 4772 y(More)e(up-to-date)h (information)g(can)g(b)r(e)h(found)f(on)h(the)f(W)-7 b(orld)27 b(Wide)h(W)-7 b(eb)28 b(at)f(the)h(cxref)f(homepage,)f(reac)n (hed)h(via)0 4871 y(the)h(author's)f(homepage)f(h)n(ttp://www.gedank)n (en.demon.co.uk/.)0 4971 y(If)46 b(y)n(ou)e(wish)h(to)g(submit)h(bug)f (rep)r(orts)f(or)g(other)h(commen)n(ts)f(ab)r(out)h(the)h(program)d (then)j(email)e(the)i(author)0 5071 y(am)n(b@gedank)n(en.demon.co.uk)25 b(and)i(put)h(cxref)g(in)g(the)f(sub)5 b(ject)28 b(line.)0 5312 y Fj(1.14)136 b(Author)44 b(and)h(Cop)l(yrigh)l(t)0 5494 y Fl(The)28 b(cxref)f(program)e(w)n(as)i(written)h(b)n(y)f(Andrew) h(M.)f(Bishop)h(in)f(1995-2004.)0 5593 y(The)h(cxref)f(program)e(is)j (cop)n(yrigh)n(t)e(Andrew)h(M.)h(Bishop)f(1995-2004.)0 5693 y(The)h(cxref-cpp)f(program)e(is)j(cop)n(yrigh)n(t)e(F)-7 b(ree)27 b(Soft)n(w)n(are)f(F)-7 b(oundation,)27 b(Inc.)p eop end %%Page: 6 6 TeXDict begin 6 5 bop 3708 -150 a Fl(6)0 83 y(The)27 b(cxref)f(and)h(cxref-cpp)f(programs)e(can)j(b)r(e)g(freely)f (distributed)h(according)e(to)i(the)g(terms)g(of)f(the)h(GNU)h(General) 0 183 y(Public)f(License)h(\(see)f(the)h(\014le)g(`COPYING'\).)p eop end %%Page: 7 7 TeXDict begin 7 6 bop 0 664 a Fn(Chapter)65 b(2)0 1038 y Fm(Example)76 b(\\README.c")0 1469 y Fi(/***************)o(**)87 1569 y($Header:)40 b(/home/amb/cxref/d)o(oc/)o(RC)o(S/R)o(EA)o(DM)o (E.c)d(1.4)42 b(1997/05/26)e(11:23:40)g(amb)i(Exp)h($)87 1768 y(A)g(comment)e(for)h(the)h(file,)e(RCS)i(header)e(comments)f(are) i(treated)f(specially)f(when)i(first.)87 1868 y(*****************)o(/)0 2267 y(/*+)g(A)i(#include)c(comment)g(+*/)0 2366 y(#include)g ()0 2665 y(#include)g()84 b(/*+)42 b(An)h(alternative) c(#include)i(comment.)f(+*/)0 2964 y(/*+)i(A)i(#define)c(comment.)g (+*/)0 3064 y(#define)h(def1)h(1)0 3362 y(#define)f(def2)h(2)86 b(/*+)43 b(An)f(alternative)e(#define)g(comment.)g(+*/)0 3661 y(/*+++++++++++)87 3761 y(A)j(#define)e(with)h(args)87 3960 y(arg1)g(The)g(first)g(arg)87 4159 y(arg2)g(The)g(second)g(arg)87 4259 y(+++++++++++*/)0 4458 y(#define)f(def3\(arg1,arg2\))c (\(arg1+arg2\))0 4757 y(/*+)42 b(An)h(alternative)c(#define)i(with)h (args.)f(+*/)0 4956 y(#define)g(def4\(arg1)f(/*+)i(The)g(first)g(arg)86 b(+*/,)42 b(\\)567 5056 y(arg2)g(/*+)g(The)g(second)f(arg)i(+*/\))f(\\) 479 5156 y(\(arg1+arg2\))0 5455 y(/*+)g(An)h(example)e(typedef)f (comment)h(+*/)0 5554 y(typedef)g(enum)0 5654 y({)44 5753 y(one,)521 b(/*+)42 b(one)h(value)e(+*/)1854 5970 y Fl(7)p eop end %%Page: 8 8 TeXDict begin 8 7 bop 3708 -150 a Fl(8)44 83 y Fi(two)565 b(/*+)42 b(another)f(value)h(+*/)0 183 y(})0 282 y(type1;)0 581 y(/*+)g(Another)f(example)g(typedef)f(comment,)h(+*/)0 681 y(typedef)g(struct)0 780 y({)44 880 y(int)h(a;)391 b(/*+)43 b(A)g(variable)d(in)j(a)g(struct.)e(+*/)44 980 y(union)g(bar)87 1079 y({)131 1179 y(char)h(a;)260 b(/*+)43 b(Each)f(element)e(+*/)131 1279 y(int)86 b(b,)260 b(/*+)43 b(of)f(a)i(struct)d(+*/)349 1378 y(c;)260 b(/*+)43 b(or)f(a)i(union)d (+*/)131 1478 y(long)h(d;)260 b(/*+)43 b(can)f(have)g(a)h(comment)e (+*/)87 1577 y(})44 1677 y(e;)565 b(/*+)43 b(Nested)e(structs)g(and)h (unions)f(also)h(work.)f(+*/)0 1777 y(})0 1876 y(type2,)433 b(/*+)43 b(a)g(type)f(that)g(is)h(a)g(struct.)d(+*/)0 1976 y(*ptype2;)345 b(/*+)43 b(a)g(pointer)e(to)h(a)i(struct)d(type.)g (+*/)0 2275 y(/*+)h(A)i(leading)c(comment)h(only.)g(+*/)0 2374 y(int)h(var1,var2;)0 2673 y(static)f(int)h(var3;)g(/*+)g(A)h (trailing)e(comment)f(only.)i(+*/)0 2972 y(/*+)g(A)i(variable)c(for)i (+*/)0 3072 y(int)g(var4,)173 b(/*+)42 b(one)g(thing.)f(+*/)174 3171 y(var5,)173 b(/*+)42 b(a)h(second)e(thing.)g(+*/)174 3271 y(var6;)173 b(/*+)42 b(a)h(third)f(thing.)f(+*/)0 3470 y(/*)i(Note:)e(The)i(leading)d(comment)h(is)i(combined)d(with)i (each)g(of)h(the)f(trailing)e(comments.)g(*/)0 3570 y(/*)j(Note:)e(the) i(push)f(through)e(of)j(the)f(comment)f(above)h(on)g(the)h(',')f(and)g (';',)g(see)h(README.)d(*/)0 3869 y(/*+++++++++++)87 3968 y(A)j(function)e(comment)f(\(the)i(comments)f(for)h(the)g(args)g (need)g(to)h(be)g(separated)c(by)k(a)g(blank)f(line\).)87 4168 y(int)h(function1)c(The)k(return)e(value.)87 4367 y(int)i(arg1)e(The)i(first)e(argument.)87 4566 y(int)i(arg2)e(The)i (second)e(argument.)87 4765 y(Some)h(more)g(comments)87 4965 y(+none+)85 b(Note:)41 b(this)h(line)g(and)h(the)f(two)g(below)g (are)g(processed)e(specially.)87 5064 y(+html+)85 b(This)42 b(comment)e(is)j(only)f(visible)f(in)i(the)f(HTML)g(output,)f(and)h (can)g(contain)f(HTML)h(markup.)87 5164 y(+latex+)f(This)h(comment)e (is)j(only)f(visible)f(in)i(the)f(\\LaTeX)f(output,)g(and)h(can)g (contain)f(\\LaTeX)g(markup.)87 5264 y(+++++++++++*/)0 5463 y(int)h(function1\(int)d(arg1,int)h(arg2\))0 5562 y({)44 5662 y(/*+)i(An)h(internal)d(comment)h(in)h(a)i(function)c(that) i(appears)e(as)j(a)131 5762 y(new)f(paragraph)e(at)j(the)f(end)g(of)h (the)g(comment.)d(+*/)p eop end %%Page: 9 9 TeXDict begin 9 8 bop 3708 -150 a Fl(9)44 183 y Fi(var1=0;)44 382 y(function2\(var3,)o(var)o(4\))o(;)0 482 y(})0 780 y(/*+)42 b(An)h(alternative)c(function)h(comment)h(+*/)0 980 y(int)h(function2\(int)d(arg1,)85 b(/*+)42 b(The)g(first)g (argument.)83 b(+*/)610 1079 y(int)43 b(arg2\))85 b(/*+)42 b(The)g(second)f(argument.)f(+*/)0 1179 y(/*+)i(Returns)f(a)i(value)f (+*/)0 1279 y({)44 1378 y(int)g(\(*funcp\)\(\)=&func)o(ti)o(on1)o(;)0 1478 y(})0 1677 y(/*)h(Note:)e(the)i(push)f(through)e(of)j(the)f (comment)f(above)h(on)g(the)h(',')f(and)g('\)',)g(see)h(README.)d(*/)p eop end %%Page: 10 10 TeXDict begin 10 9 bop 0 664 a Fn(Chapter)65 b(3)0 1038 y Fm(Cxref)77 b(Output)h(F)-19 b(or)77 b(\\README.c")0 1501 y Fj(3.1)135 b(File)46 b(README.c)0 1683 y Ff(R)m(CS)26 b(Header:)39 b(/home/am)m(b/cxref/do)s(c/R)m(CS/README.c)23 b(1.4)i(1997/05/26)e(11:23:40)g(am)m(b)j(Exp)0 1808 y Fl(A)i(commen)n(t)f(for)g(the)h(\014le,)g(R)n(CS)g(header)f(commen)n (ts)g(are)f(treated)i(sp)r(ecially)f(when)h(\014rst.)0 2024 y Fe(Included)38 b(Files)0 2177 y Fl(A)28 b(#include)g(commen)n(t) 0 2300 y Fd(#include)41 b()0 2451 y Fl(An)28 b(alternativ)n(e)e(#include)j(commen)n(t.)0 2574 y Fd(#include)41 b()0 2791 y Fe(Prepro)s(cessor)c(de\014nitions)0 2944 y Fl(A)28 b(#de\014ne)g(commen)n(t.)0 3069 y Fd(#define)41 b(def1)f(1)0 3218 y Fl(An)28 b(alternativ)n(e)e(#de\014ne)i(commen)n (t.)0 3343 y Fd(#define)41 b(def2)f(2)0 3492 y Fl(A)28 b(#de\014ne)g(with)g(args)0 3617 y Fd(#define)41 b(def3\()f(arg1,)h (arg2)f(\))0 3777 y Fg(\001)60 b Fd(arg1)1350 3783 y Fl(The)28 b(\014rst)f(arg)0 3901 y Fg(\001)60 b Fd(arg2)1350 3907 y Fl(The)28 b(second)f(arg)0 4098 y(An)h(alternativ)n(e)e (#de\014ne)i(with)h(args.)0 4223 y Fd(#define)41 b(def4\()f(arg1,)h (arg2)f(\))0 4383 y Fg(\001)60 b Fd(arg1)1350 4389 y Fl(The)28 b(\014rst)f(arg)0 4507 y Fg(\001)60 b Fd(arg2)1350 4513 y Fl(The)28 b(second)f(arg)0 4729 y Fe(3.1.1)112 b(T)m(yp)s(e)38 b(de\014nitions)0 4882 y Ff(3.1.1.1)93 b(T)m(yp)s(edef)32 b(t)m(yp)s(e1)0 5036 y Fl(An)c(example)f(t)n(yp)r (edef)h(commen)n(t)0 5160 y Fd(typedef)41 b(enum)f Fc(f)p Fd(...)p Fc(g)h Fd(type1)0 5282 y(enum)60 5382 y Fc(f)120 5481 y Fd(one;)1224 b Fl(one)27 b(v)-5 b(alue)120 5581 y Fd(two;)1224 b Fl(another)27 b(v)-5 b(alue)60 5680 y Fc(g)1833 5970 y Fl(10)p eop end %%Page: 11 11 TeXDict begin 11 10 bop 0 -150 a Fb(File)28 b(README.c)3066 b Fl(11)0 83 y Ff(3.1.1.2)93 b(T)m(yp)s(e)32 b(union)g(bar)0 236 y Fl(Nested)c(structs)f(and)h(unions)f(also)f(w)n(ork.)0 364 y Fd(union)40 b(bar)60 464 y Fc(f)120 563 y Fd(char)g(a;)1106 b Fl(Eac)n(h)26 b(elemen)n(t)120 663 y Fd(int)40 b(b;)1145 b Fl(of)28 b(a)f(struct)120 763 y Fd(int)40 b(c;)1145 b Fl(or)27 b(a)g(union)120 871 y Fd(long)40 b(d;)1106 b Fl(can)27 b(ha)n(v)n(e)g(a)g(commen)n(t)60 970 y Fc(g)0 1182 y Ff(3.1.1.3)93 b(T)m(yp)s(edef)32 b(t)m(yp)s(e2)0 1335 y Fl(Another)27 b(example)h(t)n(yp)r(edef)g(commen)n(t,)f(a)g(t)n (yp)r(e)h(that)g(is)g(a)f(struct.)0 1460 y Fd(typedef)41 b(struct)f Fc(f)p Fd(...)p Fc(g)h Fd(type2)0 1582 y(struct)60 1681 y Fc(f)120 1781 y Fd(int)f(a;)1145 b Fl(A)28 b(v)-5 b(ariable)27 b(in)g(a)h(struct.)120 1880 y Fd(union)40 b(bar)180 1980 y Fc(f)240 2080 y Fd(char)g(a;)986 b Fl(Eac)n(h)26 b(elemen)n(t)240 2188 y Fd(int)40 b(b;)1025 b Fl(of)28 b(a)f(struct)240 2287 y Fd(int)40 b(c;)1025 b Fl(or)27 b(a)g(union)240 2387 y Fd(long)40 b(d;)986 b Fl(can)27 b(ha)n(v)n(e)g(a)g(commen)n(t)180 2487 y Fc(g)180 2586 y Fd(e;)1242 b Fl(Nested)28 b(structs)f(and)h(unions)f(also)f(w)n(ork.) 60 2686 y Fc(g)0 2898 y Ff(3.1.1.4)93 b(T)m(yp)s(edef)32 b(pt)m(yp)s(e2)0 3051 y Fl(Another)27 b(example)h(t)n(yp)r(edef)g (commen)n(t,)f(a)g(p)r(oin)n(ter)h(to)f(a)g(struct)h(t)n(yp)r(e.)0 3176 y Fd(typedef)41 b(struct)f Fc(f)p Fd(...)p Fc(g)p Fd(*)h(ptype2)0 3299 y Fl(See:)307 b(T)n(yp)r(edef)28 b(t)n(yp)r(e2)2026 b Fa(\(Se)l(ction)29 b(3.1.1.3\))0 3516 y Fe(3.1.2)112 b(V)-9 b(ariables)0 3669 y Ff(3.1.2.1)93 b(V)-8 b(ariable)32 b(v)-5 b(ar1)0 3822 y Fl(A)28 b(leading)f(commen)n (t)g(only)-7 b(.)0 3947 y Fd(int)40 b(var1)0 4050 y Fl(Visible)28 b(in:)83 b(README.c)2114 b Fa(\(Se)l(ction)29 b(3.1\))0 4150 y Fl(Used)f(in:)152 b(function1\(\))947 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.3.1\))0 4362 y Ff(3.1.2.2)93 b(V)-8 b(ariable)32 b(v)-5 b(ar2)0 4515 y Fl(A)28 b(leading)f(commen)n (t)g(only)-7 b(.)0 4639 y Fd(int)40 b(var2)0 4763 y Fl(Visible)28 b(in:)83 b(README.c)2114 b Fa(\(Se)l(ction)29 b(3.1\))0 4980 y Ff(3.1.2.3)93 b(V)-8 b(ariable)32 b(v)-5 b(ar4)0 5133 y Fl(A)28 b(v)-5 b(ariable)27 b(for)g(one)g(thing.)0 5257 y Fd(int)40 b(var4)0 5360 y Fl(Visible)28 b(in:)83 b(README.c)2114 b Fa(\(Se)l(ction)29 b(3.1\))0 5460 y Fl(Used)f(in:)152 b(function1\(\))947 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.3.1\))p eop end %%Page: 12 12 TeXDict begin 12 11 bop 0 -150 a Fb(Con)n(ten)n(ts)3343 b Fl(12)0 83 y Ff(3.1.2.4)93 b(V)-8 b(ariable)32 b(v)-5 b(ar5)0 236 y Fl(A)28 b(v)-5 b(ariable)27 b(for)g(a)g(second)g(thing.)0 361 y Fd(int)40 b(var5)0 484 y Fl(Visible)28 b(in:)83 b(README.c)2114 b Fa(\(Se)l(ction)29 b(3.1\))0 701 y Ff(3.1.2.5)93 b(V)-8 b(ariable)32 b(v)-5 b(ar6)0 854 y Fl(A)28 b(v)-5 b(ariable)27 b(for)g(a)g(third)h(thing.)0 979 y Fd(int)40 b(var6)0 1102 y Fl(Visible)28 b(in:)83 b(README.c)2114 b Fa(\(Se)l(ction)29 b(3.1\))0 1319 y Ff(3.1.2.6)93 b(Lo)s(cal)32 b(V)-8 b(ariables)0 1472 y(v)j(ar3)0 1572 y Fl(A)28 b(trailing)f(commen)n(t)g(only)-7 b(.)0 1697 y Fd(static)41 b(int)f(var3)0 1820 y Fl(Used)28 b(in:)152 b(function1\(\))2147 b Fa(\(Se)l(ction)29 b(3.1.3.1\))0 2037 y Fe(3.1.3)112 b(F)-9 b(unctions)0 2190 y Ff(3.1.3.1)93 b(Global)31 b(F)-8 b(unction)32 b(function1\(\))0 2343 y Fl(A)c(function)g(commen)n(t)g(\(the)g(commen)n(ts)f(for)g(the)h (args)e(need)i(to)f(b)r(e)h(separated)f(b)n(y)g(a)g(blank)g(line\).)0 2468 y Fd(int)40 b(function1)h(\()f(int)g(arg1,)g(int)g(arg2)g(\))0 2636 y Fg(\001)60 b Fd(int)40 b(function1)1350 2634 y Fl(The)28 b(return)f(v)-5 b(alue.)0 2753 y Fg(\001)60 b Fd(int)40 b(arg1)1350 2759 y Fl(The)28 b(\014rst)f(argumen)n(t.)0 2877 y Fg(\001)60 b Fd(int)40 b(arg2)1350 2883 y Fl(The)28 b(second)f(argumen)n(t.)0 3049 y(Some)g(more)g(commen)n(ts)0 3149 y(This)h(commen)n(t)f(is)h(only)f(visible)g(in)h(the)g(L)1331 3132 y Fk(A)1368 3149 y Fl(T)1414 3167 y(E)1460 3149 y(Xoutput,)g(and)g(can)f(con)n(tain)g(L)2446 3132 y Fk(A)2483 3149 y Fl(T)2529 3167 y(E)2575 3149 y(Xmarkup.)0 3248 y(An)h(in)n(ternal)f(commen)n(t)g(in)h(a)g(function)g(that)g(app)r (ears)e(as)h(a)g(new)h(paragraph)d(at)i(the)h(end)g(of)g(the)g(commen)n (t.)0 3367 y(Calls:)246 b(function2\(\))947 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.3.2\))0 3467 y Fl(Used)f(in:)152 b(function2\(\))947 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.3.2\))0 3567 y Fl(Refs)f(V)-7 b(ar:)113 b(v)-5 b(ar1)1194 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.2.1\))450 3666 y Fl(v)-5 b(ar3)1194 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.2.6\))450 3774 y Fl(v)-5 b(ar4)1194 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.2.3\))0 3991 y Ff(3.1.3.2)93 b(Global)31 b(F)-8 b(unction)32 b(function2\(\))0 4144 y Fl(An)c(alternativ)n(e)e(function)j(commen)n(t)0 4269 y Fd(int)40 b(function2)h(\()f(int)g(arg1,)g(int)g(arg2,)g(void)g(\))0 4437 y Fg(\001)60 b Fd(int)40 b(function2)1350 4435 y Fl(Returns)27 b(a)h(v)-5 b(alue)0 4553 y Fg(\001)60 b Fd(int)40 b(arg1)1350 4559 y Fl(The)28 b(\014rst)f(argumen)n(t.)0 4678 y Fg(\001)60 b Fd(int)40 b(arg2)1350 4684 y Fl(The)28 b(second)f(argumen)n(t.)0 4810 y Fg(\001)60 b Fd(void)0 4955 y Fl(Called)27 b(b)n(y:)81 b(function1\(\))947 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.3.1\))0 5055 y Fl(Refs)f(F)-7 b(unc:)67 b(function1\(\))947 b(README.c)764 b Fa(\(Se)l(ction)29 b(3.1.3.1\))p eop end %%Page: 13 13 TeXDict begin 13 12 bop 0 706 a Fm(Con)-6 b(ten)g(ts)0 1220 y Ff(1)77 b(C)31 b(Cross)g(Referencing)g(&)i(Do)s(cumen)m(ting)e (to)s(ol.)40 b(V)-8 b(ersion)31 b(1.6)g(-)h(cxref)996 b(1)125 1320 y Fl(1.1)83 b(Program)25 b(Options)44 b(.)e(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)113 b(1)125 1420 y(1.2)83 b(C)28 b(Compiler)f(Replacemen)n(t)g (cxref-cc)37 b(.)42 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)113 b(3)125 1519 y(1.3)83 b(Cxref)28 b(con\014guration)e(File)66 b(.)41 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)113 b(3)125 1619 y(1.4)83 b(Program)25 b(Do)r(cumen)n (tation)j(Commen)n(ts)71 b(.)41 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)113 b(3)125 1719 y(1.5)83 b(Automated)28 b(Commen)n(t)g (Insertion)52 b(.)41 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)113 b(3)125 1818 y(1.6)83 b(C)28 b(Prepro)r(cessor)57 b(.)41 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)113 b(4)125 1918 y(1.7)83 b(Cross)27 b(Referencing)22 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)113 b(4)125 2017 y(1.8)83 b(L)337 2000 y Fk(A)374 2017 y Fl(T)420 2035 y(E)466 2017 y(XOutput)65 b(.)42 b(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)113 b(5)125 2117 y(1.9)83 b(HTML)28 b(Output)65 b(.)41 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)h(.)g(.)f(.)113 b(5)125 2217 y(1.10)41 b(R)-7 b(TF)29 b(Output)81 b(.)42 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)113 b(5)125 2316 y(1.11)41 b(SGML)28 b(Output)76 b(.)41 b(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)113 b(5)125 2416 y(1.12)41 b(Example)27 b(Sp)r(ecial)h(Commen)n (ts)47 b(.)41 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)113 b(5)125 2516 y(1.13)41 b(F)-7 b(urther)28 b(Information)71 b(.)42 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)113 b(5)125 2615 y(1.14)41 b(Author)28 b(and)f(Cop)n(yrigh)n(t)54 b(.)42 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)113 b(5)0 2798 y Ff(2)77 b(Example)31 b(\\README.c")2580 b(7)0 2980 y(3)77 b(Cxref)32 b(Output)g(F)-8 b(or)32 b(\\README.c")2156 b(10)125 3080 y Fl(3.1)83 b(File)28 b(README.c)73 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(10)315 3180 y(3.1.1)94 b(T)n(yp)r(e)28 b(de\014nitions)78 b(.)41 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)72 b(10)581 3279 y(3.1.1.1)104 b(T)n(yp)r(edef)27 b(t)n(yp)r(e1)61 b(.)41 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)72 b(10)581 3379 y(3.1.1.2)104 b(T)n(yp)r(e)27 b(union)h(bar)82 b(.)42 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)72 b(11)581 3479 y(3.1.1.3)104 b(T)n(yp)r(edef)27 b(t)n(yp)r(e2)61 b(.)41 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)72 b(11)581 3578 y(3.1.1.4)104 b(T)n(yp)r(edef)27 b(pt)n(yp)r(e2)79 b(.)42 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)72 b(11)315 3678 y(3.1.2)94 b(V)-7 b(ariables)74 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(11)581 3778 y(3.1.2.1)104 b(V)-7 b(ariable)26 b(v)-5 b(ar1)36 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(11)581 3877 y(3.1.2.2)104 b(V)-7 b(ariable)26 b(v)-5 b(ar2)36 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(11)581 3977 y(3.1.2.3)104 b(V)-7 b(ariable)26 b(v)-5 b(ar4)36 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(11)581 4076 y(3.1.2.4)104 b(V)-7 b(ariable)26 b(v)-5 b(ar5)36 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(12)581 4176 y(3.1.2.5)104 b(V)-7 b(ariable)26 b(v)-5 b(ar6)36 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(12)581 4276 y(3.1.2.6)104 b(Lo)r(cal)26 b(V)-7 b(ariables)26 b(.)41 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(12)315 4375 y(3.1.3)94 b(F)-7 b(unctions)56 b(.)42 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(12)581 4475 y(3.1.3.1)104 b(Global)27 b(F)-7 b(unction)28 b(function1\(\))82 b(.)42 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(12)581 4575 y(3.1.3.2)104 b(Global)27 b(F)-7 b(unction)28 b(function2\(\))82 b(.)42 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)72 b(12)1833 5970 y(13)p eop end %%Trailer userdict /end-hook known{end-hook}if %%EOF cxref-1.6d/doc/README.sgml 644 233 144 36476 11506061166 10433 0
    C Cross Referencing & Documenting tool. Version 1.6. <author>Andrew M. Bishop <sect>C Cross Referencing & Documenting tool. Version 1.6 - cxref <p> A program that can automatically generate documentation and cross references for a C program. <newline> The input is any C program with appropriate comments and the output is LaTeX, HTML, RTF or SGML files. <sect1>Program Options <p> The name of the program is cxref. <tscreen><verb> Usage: cxref filename [ ... filename] [-Odirname] [-Nbasename] [-Rdirname] [-all-comments] [-no-comments] [-verbatim-comments] [-block-comments] [-xref[-all][-file][-func][-var][-type]] [-warn[-all][-comment][-xref]] [-index[-all][-file][-func][-var][-type]] [-raw] [-latex] [-html[-src]] [-rtf] [-sgml] [-Idirname] [-Ddefine] [-Udefine] [-CPP cpp_program] [-- cpp_arg [ ... cpp_arg]] Usage: cxref filename [ ... filename] -delete [-Odirname] [-Nbasename] [-Rdirname] </verb></tscreen> <descrip> <tag><tt>filename</tt></tag> The name of the file to document, any number of files may be documented at a time. <tag><tt>-delete</tt></tag> The files named are to be deleted from the output directory and their entries in the cross reference database and main output files are to be removed. <tag><tt>-Odirname</tt></tag> The name of a directory to use for the output latex files and the location of the cross reference files that are created. <tag><tt>-Nbasename</tt></tag> The name to use for the first part of the output and cross reference files instead of cxref, the file extensions remain the same. <tag><tt>-Rdirname</tt></tag> When the source files are in more than one directory, set dirname to the name of the root directory of the source tree (use relative path if easier e.g. `-R../..'). This will then run cxref from that root directory and the `-Odirname' must be relative to that directory. <tag><tt>-all-comments</tt></tag> In case you think that the existing comments might work, (see below for description of special comments). <newline><it>[Danger! This option can produce weird results.]</it> <tag><tt>-no-comments</tt></tag> Ignores all comments, useful if you just want the cross references and not the documentation. <tag><tt>-verbatim-comments</tt></tag> When the comments that you have in the code are formatted in a predetermined style that you want to preserve on the output, this option will force them not to be reformatted. <newline><it>[Note, this is for file and function comments only.]</it> <tag><tt>-block-comments</tt></tag> When the comments in the program are formatted in the `block' style (with a leading `*' character on every line), this option will remove that character from the output. <newline><it>[Works for a single `*', `+', `|' or `:' on each line.]</it> <tag><tt>-xref</tt></tag> Produce cross referencing information (see below). <descrip> <tag><tt>-all</tt></tag> All cross references. <tag><tt>-file</tt></tag>Cross references for files. <tag><tt>-func</tt></tag>Cross references for functions. <tag><tt>-var</tt></tag> Cross references for variables. <tag><tt>-type</tt></tag>Cross references for types. </descrip> <tag><tt>-warn</tt></tag> Produce warnings, the options must be concatenated together: <descrip> <tag><tt>-all</tt></tag> All warnings. <tag><tt>-comment</tt></tag>Warn of missing comments. <tag><tt>-xref</tt></tag> Warn of missing cross references. </descrip> <tag><tt>-index</tt></tag> Produce a cross reference index, the options must be concatenated together: <descrip> <tag><tt>-all</tt></tag> All indexes. <tag><tt>-file</tt></tag>Index of files. <tag><tt>-func</tt></tag>Index of functions. <tag><tt>-var</tt></tag> Index of variables. <tag><tt>-type</tt></tag>Index of types. </descrip> <tag><tt>-raw</tt></tag> Produce a raw form of output, not really of much use except with -warn. <tag><tt>-latex</tt></tag> Produce a LaTeX file to document each of the source files and also an extra file that includes each of these files. <tag><tt>-html</tt></tag> Produce an HTML 4.01 file to document each of the source files and a main file to reference each of these files. <tag><tt>-html-src</tt></tag> Produce the HTML output and an HTML version of the source file with links into it. <tag><tt>-rtf</tt></tag> Produce a Rich Text Format (RTF) file to document the source file. <tag><tt>-sgml</tt></tag> Produce an SGML file to document the source file. (Using the LinuxDoc DTD). <tag><tt>-Idirname</tt></tag> GCC option to specify the path for include files. <tag><tt>-Ddefine</tt></tag> GCC option to define a pre-processor symbol. <tag><tt>-Udefine</tt></tag> GCC option to undefine a pre-processor symbol. <tag><tt>-CPP program</tt></tag> The name of the program to use instead of the compile time default. The program must be able to perform all of the actions that `gcc -E -C -dD' does to work. If the program takes arguments then the whole thing needs to be in quotes so that it is interpreted as a single argument to cxref. <tag><tt>-- arg ... arg</tt></tag> Extra arguments to be passed to the pre-processor can be placed after the `--' separator. </descrip> <sect1>C Compiler Replacement cxref-cc <p> To simplify using cxref on existing source code, there is now a shell script that will call the C compiler and then call cxref to process the source file. This means that it can be used as a drop in replacement for CC in Makefiles and the like. <tscreen><verb> Usage: cxref-cc [usual cc options] </verb></tscreen> The name of the source file is extracted from the list of options as well as the `-D*', `-I*', `-U*' flags and when the C compiler exits succesfully cxref will be called. The name of the C compiler to use is controlled by the CXREFCC environment variable, or if this is not set then the CC environment variable, or failing this just gcc. Using this script requires the use of a `.cxref' configuration file to contain the options since there is nowhere to put the options on the command line for the C compiler. This will only cross-reference and document the C source files since they are the only ones that are compiled, but it will make sure that they are cross-referenced with the correct options etc. <sect1>Cxref configuration File <p> These command line arguments can also be put into a file named `.cxref' instead of on the command line. When cxref is run the arguments to the program are interpreted in the following order. <enum> <item>Those on the command line. <item>Those in the `.cxref' file in the current directory. <item>Those in the `.cxref' file in the source tree root specified by `-R'. </enum> This means that in a multi-directory source tree, each sub-directory can have a `.cxref' file containing just the line `-R..' or appropriate. The main directory can have a `.cxref' file containing the remainder of the options. This removes completely the need to have any options on the command line apart from the source file names. The format of the `.cxref' file is any number of lines, each one containing a single command line argument (equivalent to one of the argv). The only options that cannot be used are the names of source files themselves and the `-delete' option. Blank lines are ignored and lines starting with a '#' are comments. <sect1>Program Documentation Comments <p> The documentation for the program is produced from comments in the code that are appropriately formatted. The cross referencing comes from the code itself and requires no extra work. <newline> The special comments are `/**** ****/' (for a file) and `/*++++ ++++*/' (for a data object) any number of `*' or `+' can be used inside of the standard `/*' and `*/' comment delimiters in the comments, they are ignored. <newline> If a comment line starts with whitespace and is followed by `+html+' then the rest of the line is included only in the HTML output, and is not processed so it can include HTML markup, `-html-' means that the rest of the line is included in all except the HTML output. The same also applies to the other output formats, `+none+' can be used for lines not to appear in any output. The exception to this is that the raw output does not do any checking and will output all lines. <newline> In any situation where a comment follows a `,', `;' or `)' separated only by spaces and tabs, the comment is pushed to before the punctuation to apply to object there. <newline> The program is implemented using a full ANSI C grammar parser with some GCC extensions, this means that the style of the code is unimportant, only the content and comments. <sect1>Automated Comment Insertion <p> To simplify the insertion of comments that will be parsed by cxref, the file <tt>cxref.el</tt> provides a number of Emacs lisp functions. To use them add the line <tt>(load "cxref")</tt> to your `.emacs' file or type <tt>M-x load-file cxref.el</tt> from within Emacs. <p> The functions and key bindings are: <descrip> <tag><it>Control-C Control-F</it></tag> Adds file comments, a /** **/ header at the top of the file and if it is a .h file then it also adds a #ifndef, #define at the beginning and #endif at the end to stop multiple inclusions. <tag><it>Control-C f</it></tag> Adds comments to a function, the cursor must be on the line containing the start of the function definition when this function is called. The /*+ ... +*/ comment that is added is of the header type (see the examples) not inline. <tag><it>Control-C v</it></tag> Adds a leading comment to the variable or other definition on the current line. <tag><it>Control-C e</it></tag> Adds a trailing comment at the end of the line. <tag><it>Control-C i</it></tag> Adds an inline comment that is ignored by cxref. </descrip> <sect1>C Preprocessor <p> To improve the output that is available a modified version of the GNU CPP V2.7.2 is supplied (named cxref-cpp). <newline> This modified C preprocessor allows for a finer control over some features of the preprocessing that are not important for a compiler. In a standard preprocessor, the preprocessor directives are intended for use only by the preprocessor, so passing the information through is not important. <newline> With cxref-cpp, there are two features that are different to the standard GNU CPP: <enum> <item>The #include directives from the file are output in the same way as the #defines are output. An extra flag has been added to cpp to do this, '-dI', it works in the same way as the existing '-dD' flag for #defines. <item>Comments trailing a #include or a #define are dropped with GNU CPP even if -C is used. This is not important while compiling but is useful for documenting. </enum> <sect1>Cross Referencing <p> The cross referencing is performed for the following items <descrip> <tag>Files</tag> <itemize> <item>The files that the current file is included in <it>(even when included via other files).</it> </itemize> <tag>#includes</tag> <itemize> <item>Files included in the current file. <item>Files included by these files etc. </itemize> <tag>Variables</tag> <itemize> <item>The location of the definition of external variables. <item>The files that have visibility of global variables. <item>The files / functions that use the variable. </itemize> <tag>Functions</tag> <itemize> <item>The file that the function is prototyped in. <item>The functions that the function calls. <item>The functions that call the function. <item>The files and functions that reference the function. <item>The variables that are used in the function. </itemize> </descrip> Each of these items is cross referenced in the output. <newline> The cross referencing uses files `cxref.variable', `cxref.function', `cxref.include' and `cxref.typedef' in the output directory.<newline> These are a complete list of the function and variable usage in the program and could be used to generate a function call hierarchy or variable usage diagram for example.<newline> Two cxref passes of each file is needed, the first to build up the cross referencing files and the second to use them. <newline> <it>(The file names are different if the `-N' option is used.)</it> <sect1>LaTeX Output <p> The default LaTeX output is a file for each of the source files with one extra file `cxref.tex' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.tex file has been written it can be modified by the user, any new files that are added are added at the end of the source code section, the rest of the file being unchanged. <newline> The index is written to a file called `cxref.apdx.tex' and cxref.tex is updated to refer to it. <newline> Also written out are three LaTeX style files `page.sty', `fonts.sty' and `cxref.sty'. These set up the page to use a smaller margin and smaller fonts to allow more to appear on a page and also define the new commands for typesetting the cxref output. <newline> <it>(The file names `cxref.tex' and `cxref.apdx.tex' are different if the `-N' option is used.)</it> <sect1>HTML Output <p> The default HTML output is a file for each of the source files with one extra file `cxref.html' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.html file has been written it can be modified by the user, any new files that are added are added at the end before the table of contents, the rest of the file being unchanged. <newline> The index is written to a file called `cxref.apdx.html' and cxref.html is updated to refer to it. <newline> <it>(The file names `cxref.html' and `cxref.apdx.html' are different if the `-N' option is used.)</it> <newline> The HTML output uses the HTML 4.01 standard and all pages validate correctly. <sect1>RTF Output <p> Rich Text Format is a fairly low level page description format devised by Microsoft. It is not a well defined and easy to understand standard as are the other formats, but it is popular for document exchange. <newline> There is a single output file for each of the source files and an index file. <sect1>SGML Output <p> Since SGML is a meta-language it is necessary to define the layout elements as well as provide the information. The cxref output uses the LinuxDoc document format and is designed for use with the SGMLtools programs (http://www.sgmltools.org/). <newline> There is a single output file for each of the source files and an index file. <sect1>Further Information <p> There is a list of frequently asked questions and their answers for the cxref program in the FAQ file. A list of improvements planned for future versions of the program are listed in the file TODO. More up-to-date information can be found on the World Wide Web at the cxref homepage, reached via the author's homepage http://www.gedanken.demon.co.uk/. If you wish to submit bug reports or other comments about the program then email the author amb@gedanken.demon.co.uk and put cxref in the subject line. <sect1>Author and Copyright <p> The cxref program was written by Andrew M. Bishop in 1995-2004. <newline> The cxref program is copyright Andrew M. Bishop 1995-2004. <newline> The cxref-cpp program is copyright Free Software Foundation, Inc. <newline> The cxref and cxref-cpp programs can be freely distributed according to the terms of the GNU General Public License (see the file `COPYING'). </article> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/doc/README.tex��������������������������������������������������������������������������� 644 � 233 � 144 � 37443 11506061166 10264� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������\documentclass{report} \usepackage{fonts,page,cxref} \pagestyle{myheadings} \begin{document} \chapter{C Cross Referencing \& Documenting tool. Version 1.6 - cxref} A program that can automatically generate documentation and cross references for a C program. The input is any C program with appropriate comments and the output is \LaTeX , HTML, RTF or SGML files. \section{Program Options} The name of the program is cxref. \smallskip \begin{tabular}{ll} Usage: {\tt cxref} & \\ & {\tt filename [ ... filename]} \\ & {\tt [-Odirname] [-Nbasename] [-Rdirname]} \\ & {\tt [-all-comments] [-no-comments]} \\ & {\tt [-verbatim-comments] [-block-comments]} \\ & {\tt [-xref[-all][-file][-func][-var][-type]]} \\ & {\tt [-warn[-all][-comment][-xref]]} \\ & {\tt [-index[-all][-file][-func][-var][-type]]} \\ & {\tt [-raw]} \\ & {\tt [-latex]} \\ & {\tt [-html[-src]]} \\ & {\tt [-rtf]} \\ & {\tt [-sgml]} \\ & {\tt [-Idirname] [-Ddefine] [-Udefine]} \\ & {\tt [-CPP cpp\_program] [-- cpp\_arg [ ... cpp\_arg]]} \\ \end{tabular} \begin{tabular}{ll} Usage: {\tt cxref} & \\ & {\tt filename [ ... filename] -delete} \\ & {\tt [-Odirname] [-Nbasename] [-Rdirname]} \\ \end{tabular} \begin{list}{}{\leftmargin=1in \labelwidth=2.5in} \item[{\tt filename}] The name of the file to document, any number of files may be documented at a time. \item[{\tt -delete}] The files named are to be deleted from the output directory and their entries in the cross reference database and main output files are to be removed. \item[{\tt -Odirname}] The name of a directory to use for the output \LaTeX files and the location of the cross reference files that are created. \item[{\tt -Nbasename}] The name to use for the first part of the output and cross reference files instead of cxref, the file extensions remain the same. \item[{\tt -Rdirname}] When the source files are in more than one directory, set dirname to the name of the root directory of the source tree (use relative path if easier e.g. ``-R../..''). This will then run cxref from that root directory and the ``-Odirname'' must be relative to that directory. \item[{\tt -all-comments}] In case you think that the existing comments might work, (see below for description of special comments). {\it[Danger! This option can produce weird results.]} \item[{\tt -no-comments}] Ignores all comments, useful if you just want the cross references and not the documentation. \item[{\tt -verbatim-comments}] When the comments that you have in the code are formatted in a predetermined style that you want to preserve on the output, this option will force them not to be reformatted. {\it[Note, this is for file and function comments only.]} \item[{\tt -block-comments}] When the comments in the program are formatted in the ``block'' style (with a leading ``*'' character on every line), this option will remove that character from the output. {\it[Works for a single ``*'', ``+'', ``|'' or ``:'' on each line.]} \item[{\tt -xref}] Produce cross referencing information (see below). \begin{list}{}{\leftmargin=1in \labelwidth=1in} \item[{\tt -all}] All cross references. \item[{\tt -file}] Cross references for files. \item[{\tt -func}] Cross references for functions. \item[{\tt -var}] Cross references for variables. \item[{\tt -type}] Cross references for types. \end{list} \item[{\tt -warn}] Produce warnings, the options must be concatenated together: \begin{list}{}{\leftmargin=1in \labelwidth=1in} \item[{\tt -all}] All warnings. \item[{\tt -comment}] Warn of missing comments. \item[{\tt -xref}] Warn of missing cross references. \end{list} \item[{\tt -index}] Produce a cross reference index, the options must be concatenated together: \begin{list}{}{\leftmargin=1in \labelwidth=1in} \item[{\tt -all}] All indexes. \item[{\tt -file}] Index of files. \item[{\tt -func}] Index of functions. \item[{\tt -var}] Index of variables. \item[{\tt -type}] Index of types. \end{list} \item[{\tt -raw}] Produce a raw form of output, not really of much use except with -warn. \item[{\tt -latex}] Produce a LaTeX file to document each of the source files and also an extra file that includes each of these files. \item[{\tt -html}] Produce an HTML 4.01 file to document each of the source files and a main file to reference each of these files. \item[{\tt -html-src}] Produce the HTML output and an HTML version of the source file with links into it. \item[{\tt -rtf}] Produce a Rich Text Format (RTF) file to document the source file. \item[{\tt -sgml}] Produce an SGML file to document the source file. (Using the LinuxDoc DTD). \item[{\tt -Idirname}] GCC option to specify the path for include files. \item[{\tt -Ddefine}] GCC option to define a pre-processor symbol. \item[{\tt -Udefine}] GCC option to undefine a pre-processor symbol. \item[{\tt -CPP program}] The name of the program to use instead of the compile time default. The program must be able to perform all of the actions that ``gcc -E -C -dD'' does to work. If the program takes arguments then the whole thing needs to be in quotes so that it is interpreted as a single argument to cxref. \item[{\tt-- arg ... arg}] Extra arguments to be passed to the pre-processor can be placed after the ``--'' separator. \end{list} \section{C Compiler Replacement cxref-cc} To simplify using cxref on existing source code, there is now a shell script that will call the C compiler and then call cxref to process the source file. This means that it can be used as a drop in replacement for CC in Makefiles and the like. Usage: cxref-cc [usual cc options] The name of the source file is extracted from the list of options as well as the ``-D*'', ``-I*'', ``-U*'' flags and when the C compiler exits succesfully cxref will be called. The name of the C compiler to use is controlled by the CXREFCC environment variable, or if this is not set then the CC environment variable, or failing this just gcc. Using this script requires the use of a `.cxref' configuration file to contain the options since there is nowhere to put the options on the command line for the C compiler. This will only cross-reference and document the C source files since they are the only ones that are compiled, but it will make sure that they are cross-referenced with the correct options etc. \section{Cxref configuration File} These command line arguments can also be put into a file named ``.cxref'' instead of on the command line. When cxref is run the arguments to the program are interpreted in the following order. \begin{enumerate} \item Those on the command line. \item Those in the ``.cxref'' file in the current directory. \item Those in the ``.cxref'' file in the source tree root specified by ``-R''. \end{enumerate} This means that in a multi-directory source tree, each sub-directory can have a ``.cxref'' file containing just the line ``-R..'' or appropriate. The main directory can have a ``.cxref'' file containing the remainder of the options. This removes completely the need to have any options on the command line apart from the source file names. The format of the .cxref file is any number of lines, each one containing a single command line argument (equivalent to one of the argv). The only options that cannot be used are the names of source files themselves and the ``-delete'' option. Blank lines are ignored and lines starting with a `\#' are comments. \section{Program Documentation Comments} The documentation for the program is produced from comments in the code that are appropriately formatted. The cross referencing comes from the code itself and requires no extra work. The special comments are ``/**** ****/'' (for a file) and ``/*++++ ++++*/'' (for a data object) any number of ``*'' or ``+'' can be used inside of the standard ``/*'' and ``*/'' comment delimiters in the comments, they are ignored. If a comment line starts with whitespace and is followed by `+html+' then the rest of the line is included only in the HTML output, and is not processed so it can include HTML markup, `-html-' means that the rest of the line is included in all except the HTML output. The same also applies to the other output formats, `+none+' can be used for lines not to appear in any output. The exception to this is that the raw output does not do any checking and will output all lines. In any situation where a comment follows a ``,'', ``;'' or ``)'' separated only by spaces and tabs, the comment is pushed to before the punctuation to apply to the object there. The program is implemented using a full ANSI C grammar parser with some GCC extensions, this means that the style of the code is unimportant, only the content and comments. \section{Automated Comment Insertion} To simplify the insertion of comments that will be parsed by cxref, the file cxref.el provides a number of Emacs lisp functions. To use them add the line {\tt (load "cxref")} to your ``.emacs'' file or type {\tt M-x load-file cxref.el} from within Emacs. The functions and key bindings are: \begin{list}{}{\leftmargin=1.3in \labelwidth=2.5in} \item[{\it Control-C Control-F}] Adds file comments, a /** **/ header at the top of the file and if it is a .h file then it also adds a \#ifndef, \#define at the beginning and \#endif at the end to stop multiple inclusions. \item[{\it Control-C f}] Adds comments to a function, the cursor must be on the line containing the start of the function definition when this function is called. The /*+ ... +*/ comment that is added is of the header type (see the examples) not inline. \item[{\it Control-C v}] Adds a leading comment to the variable or other definition on the current line. \item[{\it Control-C e}] Adds a trailing comment at the end of the line. \item[{\it Control-C i}] Adds an inline comment that is ignored by cxref. \end{list} \section{C Preprocessor} To improve the output that is available a modified version of the GNU CPP V2.7.2 is supplied (named cxref-cpp). This modified C preprocessor allows for a finer control over some features of the preprocessing that are not important for a compiler. In a standard preprocessor, the preprocessor directives are intended for use only by the preprocessor, so passing the information through is not important. With cxref-cpp, there are two features that are different to the standard GNU CPP: \begin{enumerate} \item The \#include directives from the file are output in the same way as the \#defines are output. An extra flag has been added to cpp to do this, '-dI', it works in the same way as the existing '-dD' flag for \#defines. \item Comments trailing a \#include or a \#define are dropped with GNU CPP even if -C is used. This is not important while compiling but is useful for documenting. \end{enumerate} \section{Cross Referencing} The cross referencing is performed for the following items \begin{list}{}{\leftmargin=1in \labelwidth=1.5in} \item[Files] \begin{itemize} \item The files that the current file is included in (even when included via other files). \end{itemize} \item[\#includes] \begin{itemize} \item Files included in the current file. \item Files included by these files etc. \end{itemize} \item[Variables] \begin{itemize} \item The location of the definition of external variables. \item The files that have visibility of global variables. \item The files / functions that use the variable. \end{itemize} \item[Functions] \begin{itemize} \item The file that the function is prototyped in. \item The functions that the function calls. \item The functions that call the function. \item The files and functions that reference the function. \item The variables that are used in the function. \end{itemize} \end{list} Each of these items is cross referenced in the output. The cross referencing uses files `cxref.variable', `cxref.function', `cxref.include' and `cxref.typedef' in the output directory. These are a complete list of the function and variable usage in the program and could be used to generate a function call hierarchy or variable usage diagram for example. Two cxref passes of each file is needed, the first to build up the cross referencing files and the second to use them. {\it (The file names are different if the ``-N'' option is used.)} \section{\LaTeX Output} The default \LaTeX output is a file for each of the source files with one extra file ``cxref.tex'' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.tex file has been written it can be modified by the user, any new files that are added are added at the end of the source code section, the rest of the file being unchanged. The index is written to a file called ``cxref.apdx.tex'' and cxref.tex is updated to refer to it. Also written out are three \LaTeX style files ``page.sty'', ``fonts.sty'' and ``cxref.sty''. These set up the page to use a smaller margin and smaller fonts to allow more to appear on a page and also define the new commands for typesetting the cxref output. {\it (The file names ``cxref.tex'' and ``cxref.apdx.tex'' are different if the ``-N'' option is used.)} \section{HTML Output} The default HTML output is a file for each of the source files with one extra file ``cxref.html'' that includes each of the other files. This is to allow a makefile to only update the changed files (although the references may require all of the files to be checked again). When the cxref.html file has been written it can be modified by the user, any new files that are added are added at the end before the table of contents, the rest of the file being unchanged. The index is written to a file called ``cxref.apdx.html'' and cxref.html is updated to refer to it. {\it (The file names ``cxref.html'' and ``cxref.apdx.html'' are different if the ``-N'' option is used.)} The HTML output uses the HTML 4.01 standard and all pages validate correctly. \section{RTF Output} Rich Text Format is a fairly low level page description format devised by Microsoft. It is not a well defined and easy to understand standard as are the other formats, but it is popular for document exchange. There is a single output file for each of the source files and an index file. \section{SGML Output} Since SGML is a meta-language it is necessary to define the layout elements as well as provide the information. The cxref output uses the LinuxDoc document format and is designed for use with the SGMLtools programs (http://www.sgmltools.org/). There is a single output file for each of the source files and an index file. \section{Example Special Comments} The file ``README.c'' is included at the end of this document to show that the comments are indeed seen in the code, the result of running this through cxref is also included. \section{Further Information} There is a list of frequently asked questions and their answers for the cxref program in the FAQ file. A list of improvements planned for future versions of the program are listed in the file TODO. More up-to-date information can be found on the World Wide Web at the cxref homepage, reached via the author's homepage http://www.gedanken.demon.co.uk/. If you wish to submit bug reports or other comments about the program then email the author amb@gedanken.demon.co.uk and put cxref in the subject line. \section{Author and Copyright} The cxref program was written by Andrew M. Bishop in 1995-2004. The cxref program is copyright Andrew M. Bishop 1995-2004. The cxref-cpp program is copyright Free Software Foundation, Inc. The cxref and cxref-cpp programs can be freely distributed according to the terms of the GNU General Public License (see the file `COPYING'). \chapter{Example ``README.c''} % What a hack to load a file into a verbatim section! % I have also had to rename README.c.tex to README_c.tex % so that \input{README.c} does not do \input{README.c.tex} instead. \def\endverbatim{\input{README.c}\endtrivlist} \begin{verbatim} \end{verbatim} \chapter{Cxref Output For ``README.c''} \input{README_c.tex} \markboth{Contents}{Contents} \tableofcontents \end{document} �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/doc/README_c.tex������������������������������������������������������������������������� 644 � 233 � 144 � 14522 11642337054 10562� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% This LaTeX file generated by cxref (version 1.6d). % cxref program (c) Andrew M. Bishop 1995-2011. % Cxref: ../src/cxref -O. -NREADME-TMP -xref -latex -html-src -rtf -sgml README.c % CPP : /home/amb/cxref/cpp/cxref-cpp -cxref-cpp-defines /home/amb/cxref/cpp/cxref-cpp.defines -lang-c -C -dD -dI \markboth{File README.c}{File README.c} \section{File README.c} \label{file_README.c} {\bf RCS Header: /home/amb/CVS/cxref/doc/README.c,v 1.4 1997-05-26 11:23:40 amb Exp } \smallskip A comment for the file, RCS header comments are treated specially when first. \subsection*{Included Files} A \#include comment \smallskip \begin{cxreftabi} {\stt \#include <stdio.h>} &\\ \end{cxreftabi} \medskip An alternative \#include comment. \smallskip \begin{cxreftabi} {\stt \#include <math.h>} &\\ \end{cxreftabi} \subsection*{Preprocessor definitions} A \#define comment. \smallskip {\stt \#define def1 1} \medskip An alternative \#define comment. \smallskip {\stt \#define def2 2} \medskip A \#define with args \smallskip {\stt \#define def3( arg1, arg2 )} \smallskip \begin{cxrefarglist} \cxrefargitem{arg1} The first arg \cxrefargitem{arg2} The second arg \end{cxrefarglist} \medskip An alternative \#define with args. \smallskip {\stt \#define def4( arg1, arg2 )} \smallskip \begin{cxrefarglist} \cxrefargitem{arg1} The first arg \cxrefargitem{arg2} The second arg \end{cxrefarglist} \subsection{Type definitions} \subsubsection{Typedef type1} \label{type_type1_README.c} An example typedef comment \smallskip {\stt typedef enum \{...\} type1} \smallskip \begin{cxreftabiia} \hspace*{0.0in}{\stt enum} &\\ \hspace*{0.1in}{\stt \{} &\\ \hspace*{0.2in}{\stt one;} & one value \\ \hspace*{0.2in}{\stt two;} & another value \\ \hspace*{0.1in}{\stt \}} &\\ \end{cxreftabiia} \subsubsection{Type union bar} \label{type_union_bar_README.c} Nested structs and unions also work. \smallskip \smallskip \begin{cxreftabiia} \hspace*{0.0in}{\stt union bar} &\\ \hspace*{0.1in}{\stt \{} &\\ \hspace*{0.2in}{\stt char a;} & Each element \\ \hspace*{0.2in}{\stt int b;} & of a struct \\ \hspace*{0.2in}{\stt int c;} & or a union \\ \cxreftabbreak{cxreftabiia} \hspace*{0.2in}{\stt long d;} & can have a comment \\ \hspace*{0.1in}{\stt \}} &\\ \end{cxreftabiia} \subsubsection{Typedef type2} \label{type_type2_README.c} Another example typedef comment, a type that is a struct. \smallskip {\stt typedef struct \{...\} type2} \smallskip \begin{cxreftabiia} \hspace*{0.0in}{\stt struct} &\\ \hspace*{0.1in}{\stt \{} &\\ \hspace*{0.2in}{\stt int a;} & A variable in a struct. \\ \hspace*{0.2in}{\stt union bar} &\\ \hspace*{0.3in}{\stt \{} &\\ \hspace*{0.4in}{\stt char a;} & Each element \\ \cxreftabbreak{cxreftabiia} \hspace*{0.4in}{\stt int b;} & of a struct \\ \hspace*{0.4in}{\stt int c;} & or a union \\ \hspace*{0.4in}{\stt long d;} & can have a comment \\ \hspace*{0.3in}{\stt \}} &\\ \hspace*{0.3in}{\stt e;} & Nested structs and unions also work. \\ \hspace*{0.1in}{\stt \}} &\\ \end{cxreftabiia} \subsubsection{Typedef ptype2} \label{type_ptype2_README.c} Another example typedef comment, a pointer to a struct type. \smallskip {\stt typedef struct \{...\}* ptype2} \smallskip \begin{cxreftabii} See:& Typedef type2 & \cxreftype{type2}{README.c}\\ \end{cxreftabii} \subsection{Variables} \subsubsection{Variable var1} \label{var_var1_README.c} A leading comment only. \smallskip {\stt int var1} \smallskip \begin{cxreftabiii} Visible in:\ & README.c & \ & \cxreffile{README.c}\\ Used in:\ & function1() & README.c & \cxreffunc{function1}{README.c}\\ \end{cxreftabiii} \subsubsection{Variable var2} \label{var_var2_README.c} A leading comment only. \smallskip {\stt int var2} \smallskip \begin{cxreftabiii} Visible in:\ & README.c & \ & \cxreffile{README.c}\\ \end{cxreftabiii} \subsubsection{Variable var4} \label{var_var4_README.c} A variable for one thing. \smallskip {\stt int var4} \smallskip \begin{cxreftabiii} Visible in:\ & README.c & \ & \cxreffile{README.c}\\ Used in:\ & function1() & README.c & \cxreffunc{function1}{README.c}\\ \end{cxreftabiii} \subsubsection{Variable var5} \label{var_var5_README.c} A variable for a second thing. \smallskip {\stt int var5} \smallskip \begin{cxreftabiii} Visible in:\ & README.c & \ & \cxreffile{README.c}\\ \end{cxreftabiii} \subsubsection{Variable var6} \label{var_var6_README.c} A variable for a third thing. \smallskip {\stt int var6} \smallskip \begin{cxreftabiii} Visible in:\ & README.c & \ & \cxreffile{README.c}\\ \end{cxreftabiii} \subsubsection{Local Variables} {\bf var3} \label{var_var3_README.c} A trailing comment only. \smallskip {\stt static int var3} \smallskip \begin{cxreftabiii} Used in:\ & function1() & \ & \cxreffunc{function1}{README.c}\\ \end{cxreftabiii} \subsection{Functions} \subsubsection{Global Function function1()} \label{func_function1_README.c} A function comment (the comments for the args need to be separated by a blank line). \smallskip {\stt int function1 ( int arg1, int arg2 )} \smallskip \begin{cxrefarglist} \cxrefargitem{int function1} The return value. \cxrefargitem{int arg1} The first argument. \cxrefargitem{int arg2} The second argument. \end{cxrefarglist} \smallskip Some more comments This comment is only visible in the \LaTeX output, and can contain \LaTeX markup. An internal comment in a function that appears as a new paragraph at the end of the comment. \smallskip \begin{cxreftabiii} Calls:\ & function2() & README.c & \cxreffunc{function2}{README.c}\\ Used in:\ & function2() & README.c & \cxreffunc{function2}{README.c}\\ Refs Var:\ & var1 & README.c & \cxrefvar{var1}{README.c}\\ \ & var3 & README.c & \cxrefvar{var3}{README.c}\\ \cxreftabbreak{cxreftabiii} \ & var4 & README.c & \cxrefvar{var4}{README.c}\\ \end{cxreftabiii} \subsubsection{Global Function function2()} \label{func_function2_README.c} An alternative function comment \smallskip {\stt int function2 ( int arg1, int arg2, void )} \smallskip \begin{cxrefarglist} \cxrefargitem{int function2} Returns a value \cxrefargitem{int arg1} The first argument. \cxrefargitem{int arg2} The second argument. \cxrefargitem{void} \ \end{cxrefarglist} \smallskip \begin{cxreftabiii} Called by:\ & function1() & README.c & \cxreffunc{function1}{README.c}\\ Refs Func:\ & function1() & README.c & \cxreffunc{function1}{README.c}\\ \end{cxreftabiii} ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/doc/cxref.css���������������������������������������������������������������������������� 644 � 233 � 144 � 1103 10065624162 10366� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------*/ /* */ /* Cxref Version 1.6 - Style Sheet */ /* */ /* Using CSS2 - (Cascading Style Sheets, level 2) */ /* */ /*------------------------------------------------*/ /*-------------------------*/ /* Generic HTML formatting */ /*-------------------------*/ /*--------------------------------*/ /* Cxref specific HTML formatting */ /*--------------------------------*/ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/doc/cxref.sty���������������������������������������������������������������������������� 644 � 233 � 144 � 4536 10065624162 10432� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% % cxref.sty - Copyright 1996 Andrew M. Bishop % % New commands that are defined to use in typesetting cxref. % \typeout{Cxref Style-sheet -- By A. M. Bishop. (Custom commands)} % Stop LaTeX from printing all of the annoying error messages about under/over-full boxes. \tolerance=10000 \hbadness=10000 \emergencystretch=100pt % Set the section number depth to 3. \setcounter{secnumdepth}{3} % Set the table of contents number depth to 3. \setcounter{tocdepth}{3} % Set the parindent and table column separator to zero. \setlength{\parindent}{0in} \setlength{\tabcolsep}{0in} % Define a command to display the 'computer format' text, a small teletype font. \newcommand{\stt}{\small\tt} % The command argument list and items to use in it. \newenvironment{cxrefarglist}{\begin{list}{}{\leftmargin=2.25in \labelsep=0in \labelwidth=2.25in \itemsep=0pt \parsep=3pt \topsep=3pt}}{\end{list}} \newcommand{\cxrefargitem}[1]{\item[\parbox{2.25in}{$\cdot$\hspace*{0.1in}{\stt #1}}]} % A table with one wide column and a cross reference (Include files). \newenvironment{cxreftabi}{\begin{tabular}{{p{5.0in}l}}}{\end{tabular}} % A table with a narrow column, a wide column and a cross reference (Included in). \newenvironment{cxreftabii}{\begin{tabular}{{p{0.75in}p{4.25in}l}}}{\end{tabular}} % A table with two approximately equal columns (2nd is wider) and a cross reference (Struct / Union). \newenvironment{cxreftabiia}{\begin{tabular}{{p{2.5in}p{3.5in}}}}{\end{tabular}} % A table with two exactly equal columns and a cross reference (Appendix). \newenvironment{cxreftabiib}{\begin{tabular}{{p{2.5in}p{2.5in}l}}}{\end{tabular}} % A table with a narrow column, two approximately equal columns and a cross reference (Used in, Calls, Called etc.). \newenvironment{cxreftabiii}{\begin{tabular}{{p{0.75in}p{2.25in}p{2.0in}l}}}{\end{tabular}} \newcommand{\cxreftabiiispan}[1]{\multicolumn{2}{p{4.25in}}{#1}} % Break the above tables by stopping the current table and starting a new one. \newcommand{\cxreftabbreak}[1]{\end{#1}\vskip 0pt\begin{#1}} % Cross references for Files, Functions, Variables and Typedefs. \newcommand{\cxreffile}[1]{{\small\it (Section \ref{file_#1})\/}} \newcommand{\cxreffunc}[2]{{\small\it (Section \ref{func_#1_#2})\/}} \newcommand{\cxrefvar}[2]{{\small\it (Section \ref{var_#1_#2})\/}} \newcommand{\cxreftype}[2]{{\small\it (Section \ref{type_#1_#2})\/}} ������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/doc/example/����������������������������������������������������������������������������� 40755 � 233 � 144 � 0 11642337067 10200� 5�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/doc/fonts.sty���������������������������������������������������������������������������� 644 � 233 � 144 � 11266 10065624162 10472� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% % fonts.sty - A modified version of 10pt.sty from the standard LaTeX 2.0.9 distribution. % Original author / copyright unknown. % % Fonts for cxref, smaller than usual to get more on a page (cxref *is* rather verbose). % \typeout{Fonts Style-sheet -- By A. M. Bishop. (smaller than default)} \lineskip 1pt \normallineskip 1pt \def\baselinestretch{1} \def\@normalsize{\@setsize\normalsize{10pt}\xpt\@xpt \abovedisplayskip 10pt plus2pt minus5pt\belowdisplayskip \abovedisplayskip \abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6pt plus3pt minus3pt\let\@listi\@listI} \def\small{\@setsize\small{9pt}\ixpt\@ixpt \abovedisplayskip 8.5pt plus 3pt minus 4pt\belowdisplayskip \abovedisplayskip \abovedisplayshortskip \z@ plus2pt\belowdisplayshortskip 4pt plus2pt minus 2pt \def\@listi{\leftmargin\leftmargini \topsep 4pt plus 2pt minus 2pt\parsep 2pt plus 1pt minus 1pt \itemsep \parsep}} \def\footnotesize{\@setsize\footnotesize{8pt}\viiipt\@viiipt \abovedisplayskip 6pt plus 2pt minus 4pt\belowdisplayskip \abovedisplayskip \abovedisplayshortskip \z@ plus 1pt\belowdisplayshortskip 3pt plus 1pt minus 2pt \def\@listi{\leftmargin\leftmargini \topsep 3pt plus 1pt minus 1pt\parsep 2pt plus 1pt minus 1pt \itemsep \parsep}} \def\scriptsize{\@setsize\scriptsize{6pt}\viipt\@viipt} \def\tiny{\@setsize\tiny{5pt}\vpt\@vpt} \def\large{\@setsize\large{12pt}\xiipt\@xiipt} \def\Large{\@setsize\Large{14pt}\xivpt\@xivpt} \def\LARGE{\@setsize\LARGE{17pt}\xviipt\@xviipt} \def\huge{\@setsize\huge{20pt}\xxpt\@xxpt} \def\Huge{\@setsize\Huge{25pt}\xxvpt\@xxvpt} \normalsize \if@twoside \oddsidemargin 44pt \evensidemargin 82pt \marginparwidth 107pt \else \oddsidemargin 63pt \evensidemargin 63pt \marginparwidth 90pt \fi \marginparsep 11pt \topmargin 27pt \headheight 12pt \headsep 25pt \footskip 30pt \textheight = 43\baselineskip \advance\textheight by \topskip \textwidth 345pt \columnsep 10pt \columnseprule 0pt \footnotesep 6.65pt \skip\footins 9pt plus 4pt minus 2pt \floatsep 12pt plus 2pt minus 2pt \textfloatsep 20pt plus 2pt minus 4pt \intextsep 12pt plus 2pt minus 2pt \dblfloatsep 12pt plus 2pt minus 2pt \dbltextfloatsep 20pt plus 2pt minus 4pt \@fptop 0pt plus 1fil \@fpsep 8pt plus 2fil \@fpbot 0pt plus 1fil \@dblfptop 0pt plus 1fil \@dblfpsep 8pt plus 2fil \@dblfpbot 0pt plus 1fil \marginparpush 5pt \parskip 0pt plus 1pt \parindent 15pt \partopsep 2pt plus 1pt minus 1pt \@lowpenalty 51 \@medpenalty 151 \@highpenalty 301 \@beginparpenalty -\@lowpenalty \@endparpenalty -\@lowpenalty \@itempenalty -\@lowpenalty \def\part{\par \addvspace{4ex} \@afterindentfalse \secdef\@part\@spart} \def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne \refstepcounter{part} \addcontentsline{toc}{part}{\thepart \hspace{1em}#1}\else \addcontentsline{toc}{part}{#1}\fi { \parindent 0pt \raggedright \ifnum \c@secnumdepth >\m@ne \Large \bf Part \thepart \par \nobreak \fi \huge \bf #2\markboth{}{}\par } \nobreak \vskip 3ex \@afterheading } \def\@spart#1{{\parindent 0pt \raggedright \huge \bf #1\par} \nobreak \vskip 3ex \@afterheading } \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus .2ex}{\Large\bf}} \def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus -.2ex}{1.5ex plus .2ex}{\large\bf}} \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}} \def\paragraph{\@startsection {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}} \def\subparagraph{\@startsection {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}} \setcounter{secnumdepth}{3} \def\appendix{\par \setcounter{section}{0} \setcounter{subsection}{0} \def\thesection{\Alph{section}}} \leftmargini 25pt \leftmarginii 22pt \leftmarginiii 18.7pt \leftmarginiv 17pt \leftmarginv 10pt \leftmarginvi 10pt \leftmargin\leftmargini \labelsep 5pt \labelwidth\leftmargini\advance\labelwidth-\labelsep \def\@listI{\leftmargin\leftmargini \parsep 4pt plus 2pt minus 1pt\topsep 8pt plus 2pt minus 4pt\itemsep 4pt plus 2pt minus 1pt} \let\@listi\@listI \@listi \def\@listii{\leftmargin\leftmarginii \labelwidth\leftmarginii\advance\labelwidth-\labelsep \topsep 4pt plus 2pt minus 1pt \parsep 2pt plus 1pt minus 1pt \itemsep \parsep} \def\@listiii{\leftmargin\leftmarginiii \labelwidth\leftmarginiii\advance\labelwidth-\labelsep \topsep 2pt plus 1pt minus 1pt \parsep \z@ \partopsep 1pt plus 0pt minus 1pt \itemsep \topsep} \def\@listiv{\leftmargin\leftmarginiv \labelwidth\leftmarginiv\advance\labelwidth-\labelsep} \def\@listv{\leftmargin\leftmarginv \labelwidth\leftmarginv\advance\labelwidth-\labelsep} \def\@listvi{\leftmargin\leftmarginvi \labelwidth\leftmarginvi\advance\labelwidth-\labelsep} ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/doc/page.sty����������������������������������������������������������������������������� 644 � 233 � 144 � 1617 10065624162 10234� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% % page.sty - Copyright 1995,1996 Andrew M. Bishop % % Page layout for cxref, smaller margins than usual to get more on a page (cxref *is* rather verbose). % \typeout{Page Style-sheet (A4) -- By A. M. Bishop. (1 inch margins)} % % Physical paper size. % \vsize=11.7 in % Page height (A4) \hsize=8.25 in % Page width (A4) % % Margins etc. Vertically % \topmargin=-0.5in % Between (top of page + 1 inch) & top of header \headheight=0.25in % Height of the header \headsep=0.25in % Between header and text \textheight=9.7in % Height of text (A4) \footskip=0.25in % Between bottom of text and bottom of footer % % Margins etc. Horizontally % \oddsidemargin=0.0in % Between (left side of page + 1 inch) & left edge of text \evensidemargin=0.0in % Between (left side of page + 1 inch) & left edge of text \textwidth=6.25in % Width of text (A4) �����������������������������������������������������������������������������������������������������������������cxref-1.6d/query/����������������������������������������������������������������������������������� 40755 � 233 � 144 � 0 11642337067 7145� 5�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/query/Makefile.in������������������������������������������������������������������������ 644 � 233 � 144 � 4031 11506061166 11215� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# $Header: /home/amb/CVS/cxref/query/Makefile.in,v 1.10 2010-10-19 18:18:28 amb Exp $ # # C Cross Referencing & Documentation tool. Version 1.6d. # # Query Program Makefile. # # Written by Andrew M. Bishop # # This file Copyright 1995-2010 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # # autoconf things srcdir=@srcdir@ VPATH=@srcdir@ # The installation locations prefix=@prefix@ exec_prefix=@exec_prefix@ datarootdir=@datarootdir@ bindir=$(DESTDIR)@bindir@ mandir=$(DESTDIR)@mandir@ # The installation program. INSTALL=@INSTALL@ # The C compiler and linker CC=@CC@ LD=@CC@ CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ ######## INCLUDE=-I@srcdir@/../src LIBRARY=@LIBS@ ######## programs : cxref-query ######## install : cxref-query [ -d $(bindir) ] || $(INSTALL) -d $(bindir) $(INSTALL) -m 755 cxref-query $(bindir) [ -d $(mandir)/man1 ] || $(INSTALL) -d $(mandir)/man1 $(INSTALL) -m 644 $(srcdir)/README.man $(mandir)/man1/cxref-query.1 install-win32 : cxref-query [ -d $(bindir) ] || $(INSTALL) -d $(bindir) $(INSTALL) -m 755 cxref-query.exe $(bindir) ######## clean : -rm -f cxref-query core *.o *~ #### distclean : clean -rm -f Makefile ######## OBJ_FILES=query.o \ input.o output.o \ ../src/memory.o ../src/slist.o #### cxref-query : $(OBJ_FILES) $(LD) $(LDFLAGS) $(OBJ_FILES) -o $@ $(LIBRARY) ######## .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) -c $(CFLAGS) $< -o $@ $(INCLUDE) query.o : query.c query.h ../src/cxref.h ../src/datatype.h ../src/memory.h input.o : input.c query.h ../src/cxref.h ../src/datatype.h ../src/memory.h output.o : output.c query.h ../src/cxref.h ../src/datatype.h ../src/memory.h ../src/memory.o: ../src/memory.c ../src/memory.h cd ../src && $(MAKE) memory.o ../src/slist.o : ../src/slist.c ../src/cxref.h ../src/datatype.h ../src/memory.h cd ../src && $(MAKE) slist.o ######## �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/query/README����������������������������������������������������������������������������� 644 � 233 � 144 � 3570 11506061166 10037� 0������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� C Cross Referencing & Documenting tool. Version 1.4 - cxref-query ================================================================= A very simple program to query the cross-reference database that is created by the cxref program. This is intended to be an example of the information that is in the database and how to use it rather than a fully featured tool. Usage: cxref-query [name [ ... name]] [-Odirname] [-Nbasename] [-xref[-all][-file][-func][-var][-type]] name Names of objects to query. The names that it looks up are the names of: Files Variables Functions Typedefs If there are no names on the command line then the program enters interactive mode and prompts for names until an end of file (^D) is seen. -Odirname Use dirname as the input directory -Nbasename Use basename.* as the input filenames -xref Produce cross referencing information (see below). -all All cross references. -file Cross references for files. -func Cross references for functions. -var Cross references for variables. -type Cross references for types. The output depends on the -xref options but basically gives what is seen in the section of the document for the named object. Author and Copyright -------------------- The cxref-query program was written by Andrew M. Bishop in 1995,96,97. The cxref-query program is copyright Andrew M. Bishop 1995,96,97. email: amb@gedanken.demon.co.uk [Please put cxref in the subject line] The cxref-query program can be freely distributed according to the terms of the GNU General Public License (see the file `COPYING'). ����������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/query/README.man������������������������������������������������������������������������� 644 � 233 � 144 � 3015 11506061166 10603� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������.TH cxref-query 1 "July 5, 1997" .SH NAME cxref-query - A program to query the cross reference database from cxref. .SH SYNOPSIS .B cxref-query .I [name \ [ \ ... \ name]] .BI [\-O dirname ] .BI [\-N basename ] .B [\-xref[\-all][\-file][\-func][\-var][\-type]] .SH DESCRIPTION A very simple program to query the cross-reference database that is created by the cxref program. This is intended to be an example of the information that is in the database and how to use it rather than a fully featured tool. .SH OPTIONS .TP .BR name Names of objects to query. The names that it looks up are the names of: Files, Variables, Functions, Typedefs If there are no names on the command line then the program enters interactive mode and prompts for names until an end of file (^D) is seen. .TP .BR \-Odirname Use dirname as the input directory .TP .BR \-Nbasename Use basename.* as the input filenames .TP .BR \-xref Produce cross referencing information (see below). -all All cross references. -file Cross references for files. -func Cross references for functions. -var Cross references for variables. -type Cross references for types. .LP The output depends on the -xref options but basically gives what is seen in the section of the document for the named object. .SH SEE ALSO cxref(1) .SH BUGS If you wish to submit bug reports or other comments about the program then email the author amb@gedanken.demon.co.uk and put cxref in the subject line. .SH AUTHOR The cxref-query program is copyright Andrew M. Bishop 1995,96,97. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/query/input.c���������������������������������������������������������������������������� 644 � 233 � 144 � 35224 11506061166 10503� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/query/input.c,v 1.10 2004-06-22 17:31:18 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,99,2004 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #define TYPE_MAX_LEN 256 /*+ The maximum type definition length +*/ #define FUNC_MAX_LEN 64 /*+ The maximum function name length. +*/ #if defined(PATH_MAX) && defined(NAME_MAX) #define FILE_MAX_LEN (PATH_MAX+NAME_MAX) /*+ The maximum filename length. +*/ #elif defined(PATH_MAX) #define FILE_MAX_LEN (PATH_MAX+256) /*+ The maximum filename length. +*/ #else #define FILE_MAX_LEN 512 /*+ The maximum filename length. +*/ #endif #include "memory.h" #include "datatype.h" #include "cxref.h" #include "query.h" /*+ The names of the function cross reference files. +*/ #define XREF_FUNC_FILE ".function" /*+ The names of the variable cross reference files. +*/ #define XREF_VAR_FILE ".variable" /*+ The names of the include cross reference files. +*/ #define XREF_INC_FILE ".include" /*+ The names of the type cross reference files. +*/ #define XREF_TYPE_FILE ".typedef" /*+ The command line switch that sets the amount of cross referencing to do. +*/ extern int option_xref; /*+ The command line switch for the output name, +*/ extern char *option_odir, /*+ The directory to use. +*/ *option_name; /*+ The base part of the name. +*/ extern File *files; /*+ The files that are queried. +*/ extern int n_files; /*+ The number of files referenced. +*/ extern Function *functions; /*+ The functions that are queried. +*/ extern int n_functions; /*+ The number of functions referenced. +*/ extern Variable *variables; /*+ The variables that are queried. +*/ extern int n_variables; /*+ The number of variables referenced. +*/ extern Typedef *typedefs; /*+ The type definitions that are queried. +*/ extern int n_typedefs; /*+ The number of typedefs referenced. +*/ /* Local functions */ static void cross_reference_files(void); static void cross_reference_functions(void); static void cross_reference_variables(void); /*++++++++++++++++++++++++++++++++++++++ Read in all the information from the cross reference files. ++++++++++++++++++++++++++++++++++++++*/ void LoadInCrossRefs(void) { FILE *in; char *ifile; /* Format: filename [[%]include1] [[%]include2] ... : Files include1, include2, ... are included in filename; those with a % are local. */ /* First do the files */ { char include[FILE_MAX_LEN],filename[FILE_MAX_LEN+1],ch; ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_INC_FILE); in =fopen(ifile,"r"); if(!in) {fprintf(stderr,"cxref-query: Failed to open the include cross reference file '%s'\n",ifile);exit(1);} while(fscanf(in,"%s%c",filename,&ch)==2) { if(n_files) files=(File*)Realloc(files,(n_files+1)*sizeof(File*)); else files=(File*)Malloc(sizeof(File*)); files[n_files]=(File)Calloc(1,sizeof(struct _File)); files[n_files]->name=MallocString(filename); files[n_files]->inc_in=NewStringList(); files[n_files]->f_refs=NewStringList2(); files[n_files]->v_refs=NewStringList2(); while(ch==' ') { Include inc=(Include)Calloc(1,sizeof(struct _Include)); fscanf(in,"%s%c",include,&ch); if(include[0]=='%') {inc->scope=LOCAL; inc->name=MallocString(&include[1]);} else {inc->scope=GLOBAL; inc->name=MallocString(include);} AddToLinkedList(files[n_files]->includes,Include,inc); } n_files++; } cross_reference_files(); fclose(in); } /* Format: filename funcname scope [[%][&]funcname1] [[%][&]funcname2] ... : The function funcname in file filename calls or references functions funcname1, funcname2 ... ; those with a % are local, with a & are references. */ /* Format: filename $ 0 [[%]&funcname1] [[%]&funcname2] ... : The file references functions funcname1, funcname2 ... ; those with a % are local. */ /* Now do the functions */ { char ch,funcname[FUNC_MAX_LEN+1],filename[FILE_MAX_LEN+1],called[FUNC_MAX_LEN+1]; int scope; ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_FUNC_FILE); in =fopen(ifile,"r"); if(!in) {fprintf(stderr,"cxref-query: Failed to open the functional cross reference file '%s'\n",ifile);exit(1);} while(fscanf(in,"%s %s %d%c",filename,funcname,&scope,&ch)==4) { int i; StringList2 f_refs; for(i=0;i<n_files;i++) if(!strcmp(files[i]->name,filename)) break; if(funcname[0]=='$') f_refs=files[i]->f_refs; else { if(n_functions) functions=(Function*)Realloc(functions,(n_functions+1)*sizeof(Function*)); else functions=(Function*)Malloc(sizeof(Function*)); functions[n_functions]=(Function)Calloc(1,sizeof(struct _Function)); AddToLinkedList(files[i]->functions,Function,functions[n_functions]); functions[n_functions]->comment=MallocString(filename); /* Use comment field for filename */ functions[n_functions]->name=MallocString(funcname); functions[n_functions]->scope=scope; functions[n_functions]->used=NewStringList2(); functions[n_functions]->calls=NewStringList2(); functions[n_functions]->called=NewStringList2(); functions[n_functions]->f_refs=NewStringList2(); functions[n_functions]->v_refs=NewStringList2(); f_refs=functions[n_functions]->f_refs; } while(ch==' ') { char* c; fscanf(in,"%s%c",called,&ch); c=called; if(c[0]=='%') c++; if(c[0]=='&') { if(c==called) AddToStringList2(f_refs,c+1,NULL,1,1); else AddToStringList2(f_refs,c+1,filename,1,1); } else { if(c==called) AddToStringList2(functions[n_functions]->calls,c,NULL,1,1); else AddToStringList2(functions[n_functions]->calls,c,filename,1,1); } } if(funcname[0]!='$') n_functions++; } cross_reference_functions(); fclose(in); } /* Format: filename varname scope [$] [[%]funcname1] [[%]funcname2] ... : variable varname is used in the file filename if $, and functions funcname1, funcname2 ... Those with a % are local. */ /* Now do the variables */ { char varname[FUNC_MAX_LEN+1],filename[FILE_MAX_LEN+1],funcname[FUNC_MAX_LEN+1],ch; int scope; ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_VAR_FILE); in =fopen(ifile,"r"); if(!in) {fprintf(stderr,"cxref-query: Failed to open the variable cross reference file '%s'\n",ifile);exit(1);} while(fscanf(in,"%s %s %d%c",filename,varname,&scope,&ch)==4) { int i; if(n_variables) variables=(Variable*)Realloc(variables,(n_variables+1)*sizeof(Variable*)); else variables=(Variable*)Malloc(sizeof(Variable*)); variables[n_variables]=(Variable)Calloc(1,sizeof(struct _Variable)); for(i=0;i<n_files;i++) if(!strcmp(files[i]->name,filename)) AddToLinkedList(files[i]->variables,Variable,variables[n_variables]); variables[n_variables]->comment=MallocString(filename); /* Use comment field for filename */ variables[n_variables]->name=MallocString(varname); variables[n_variables]->visible=NewStringList2(); variables[n_variables]->used=NewStringList2(); variables[n_variables]->scope=scope; while(ch==' ') { fscanf(in,"%s%c",funcname,&ch); if(funcname[0]=='$') AddToStringList2(variables[n_variables]->used,"$",filename,1,0); else if(funcname[0]=='%') AddToStringList2(variables[n_variables]->used,&funcname[1],filename,1,1); else AddToStringList2(variables[n_variables]->used,funcname,NULL,1,1); } n_variables++; } cross_reference_variables(); fclose(in); } /* Format: filename typename type... : For a typedef type. */ /* Format: filename # type... : For a non typedef type. */ /* Now do the types */ { char typename[FILE_MAX_LEN+1],filename[FILE_MAX_LEN+1],typetype[TYPE_MAX_LEN+1]; ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_TYPE_FILE); in =fopen(ifile,"r"); if(!in) {fprintf(stderr,"cxref-query: Failed to open the typedef reference file '%s'\n",ifile);exit(1);} while(fscanf(in,"%s %s",filename,typename)==2) { int i; fgets(typetype,TYPE_MAX_LEN,in); typetype[strlen(typetype)-1]=0; if(n_typedefs) typedefs=(Typedef*)Realloc(typedefs,(n_typedefs+1)*sizeof(Typedef*)); else typedefs=(Typedef*)Malloc(sizeof(Typedef*)); typedefs[n_typedefs]=(Typedef)Calloc(1,sizeof(struct _Typedef)); for(i=0;i<n_files;i++) if(!strcmp(files[i]->name,filename)) AddToLinkedList(files[i]->typedefs,Typedef,typedefs[n_typedefs]); typedefs[n_typedefs]->comment=MallocString(filename); /* Use comment field for filename */ if(typename[0]!='#') { typedefs[n_typedefs]->name=MallocString(typename); typedefs[n_typedefs]->type=MallocString(&typetype[1]); } else { typedefs[n_typedefs]->name=MallocString(&typetype[1]); typedefs[n_typedefs]->type=NULL; } n_typedefs++; } fclose(in); } } /*++++++++++++++++++++++++++++++++++++++ Performs all of the cross referencing between files, includes and included in. ++++++++++++++++++++++++++++++++++++++*/ static void cross_reference_files(void) { int i; for(i=0;i<n_files;i++) { int j; Include inc=files[i]->includes; while(inc) { for(j=0;j<n_files;j++) if(!strcmp(inc->name,files[j]->name)) { inc->includes=files[j]->includes; AddToStringList(files[j]->inc_in,files[i]->name,1,1); } inc=inc->next; } } } /*++++++++++++++++++++++++++++++++++++++ Performs all of the cross referencing between global functions and functions that they call. ++++++++++++++++++++++++++++++++++++++*/ static void cross_reference_functions(void) { int i1,j1,i2; for(i1=0;i1<n_functions;i1++) { Function func1=functions[i1]; for(j1=0;j1<func1->calls->n;j1++) { if(!func1->calls->s2[j1]) for(i2=0;i2<n_functions;i2++) { Function func2=functions[i2]; if(!strcmp(func1->calls->s1[j1],func2->name)) { func1->calls->s2[j1]=MallocString(func2->comment); break; } } if(func1->calls->s2[j1]) for(i2=0;i2<n_functions;i2++) { Function func2=functions[i2]; if(!strcmp(func1->calls->s1[j1],func2->name) && !strcmp(func1->calls->s2[j1],func2->comment)) { AddToStringList2(func2->called,func1->name,func1->comment,1,1); break; } } } for(j1=0;j1<func1->f_refs->n;j1++) { if(!func1->f_refs->s2[j1]) for(i2=0;i2<n_functions;i2++) { Function func2=functions[i2]; if(!strcmp(func1->f_refs->s1[j1],func2->name)) { func1->f_refs->s2[j1]=MallocString(func2->comment); break; } } if(func1->f_refs->s2[j1]) for(i2=0;i2<n_functions;i2++) { Function func2=functions[i2]; if(!strcmp(func1->f_refs->s1[j1],func2->name) && !strcmp(func1->f_refs->s2[j1],func2->comment)) { AddToStringList2(func2->used,func1->name,func1->comment,1,1); break; } } } } for(i1=0;i1<n_files;i1++) { File file1=files[i1]; for(j1=0;j1<file1->f_refs->n;j1++) { if(!file1->f_refs->s2[j1]) for(i2=0;i2<n_functions;i2++) { Function func2=functions[i2]; if(!strcmp(file1->f_refs->s1[j1],func2->name)) { file1->f_refs->s2[j1]=MallocString(func2->comment); break; } } if(file1->f_refs->s2[j1]) for(i2=0;i2<n_functions;i2++) { Function func2=functions[i2]; if(!strcmp(file1->f_refs->s1[j1],func2->name) && !strcmp(file1->f_refs->s2[j1],func2->comment)) { AddToStringList2(func2->used,"$",file1->name,1,1); break; } } } } } /*++++++++++++++++++++++++++++++++++++++ Performs all of the cross referencing between global variables and functions that use them. ++++++++++++++++++++++++++++++++++++++*/ static void cross_reference_variables(void) { int i1,j1,i2; for(i1=0;i1<n_variables;i1++) { Variable var1=variables[i1]; for(j1=0;j1<var1->used->n;j1++) { if(var1->used->s1[j1][0]!='$' && !var1->used->s2[j1]) for(i2=0;i2<n_functions;i2++) { Function func2=functions[i2]; if(!strcmp(var1->used->s1[j1],func2->name)) { var1->used->s2[j1]=MallocString(func2->comment); break; } } if(var1->used->s1[j1][0]=='$') for(i2=0;i2<n_files;i2++) { File file2=files[i2]; if(!strcmp(var1->used->s2[j1],file2->name)) { AddToStringList2(file2->v_refs,var1->name,var1->comment,1,1); break; } } else if(var1->used->s2[j1]) for(i2=0;i2<n_functions;i2++) { Function func2=functions[i2]; if(!strcmp(var1->used->s1[j1],func2->name) && !strcmp(var1->used->s2[j1],func2->comment)) { AddToStringList2(func2->v_refs,var1->name,var1->comment,1,1); break; } } } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/query/output.c��������������������������������������������������������������������������� 644 � 233 � 144 � 17317 11506061166 10707� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/query/output.c,v 1.6 2004-06-22 17:31:24 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,2004 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "memory.h" #include "datatype.h" #include "cxref.h" #include "query.h" /*+ The command line switch that sets the amount of cross referencing to do. +*/ extern int option_xref; extern File *files; /*+ The files that are queried. +*/ extern int n_files; /*+ The number of files referenced. +*/ extern Function *functions; /*+ The functions that are queried. +*/ extern int n_functions; /*+ The number of functions referenced. +*/ extern Variable *variables; /*+ The variables that are queried. +*/ extern int n_variables; /*+ The number of variables referenced. +*/ extern Typedef *typedefs; /*+ The type definitions that are queried. +*/ extern int n_typedefs; /*+ The number of typedefs referenced. +*/ /* Local fuctions */ static void OutputFile(File file); static void OutputInclude(Include incl,int depth); static void OutputFunction(Function func); static void OutputVariable(Variable var); static void OutputTypedef(Typedef type); /*++++++++++++++++++++++++++++++++++++++ Ouput the cross references for the named thing. char* name The name of the object to ouput the cross references for. ++++++++++++++++++++++++++++++++++++++*/ void OutputCrossRef(char* name) { int i,any=0; for(i=0;i<n_files;i++) if(!strcmp(name,files[i]->name)) {OutputFile(files[i]);any++;} for(i=0;i<n_typedefs;i++) if(!strcmp(name,typedefs[i]->name)) {OutputTypedef(typedefs[i]);any++;} for(i=0;i<n_variables;i++) if(!strcmp(name,variables[i]->name)) {OutputVariable(variables[i]);any++;} for(i=0;i<n_functions;i++) if(!strcmp(name,functions[i]->name)) {OutputFunction(functions[i]);any++;} if(!any) printf("cxref-query: No match for '%s'.\n",name); } /*++++++++++++++++++++++++++++++++++++++ Print out the information for a file. File file The file to output the information for. ++++++++++++++++++++++++++++++++++++++*/ static void OutputFile(File file) { int i; Include inc; Function func; Variable var; Typedef type; printf("File: %s\n\n",file->name); for(inc=file->includes,i=0;inc;inc=inc->next,i++) { printf(" %s %c%s%c\n",i?" ":"Includes: ",inc->scope==GLOBAL?'<':'"',inc->name,inc->scope==GLOBAL?'>':'"'); OutputInclude(inc,1); } if(file->includes) printf("\n"); for(func=file->functions,i=0;func;func=func->next,i++) printf(" %s %s\n",i?" ":"Functions:",func->name); if(file->functions) printf("\n"); for(var=file->variables,i=0;var;var=var->next,i++) printf(" %s %s\n",i?" ":"Variables:",var->name); if(file->variables) printf("\n"); for(type=file->typedefs,i=0;type;type=type->next,i++) printf(" %s %s\n",i?" ":"Types: ",type->name); if(file->typedefs) printf("\n"); if(option_xref&XREF_FILE) { for(i=0;i<file->inc_in->n;i++) printf(" %s %s\n",i?" ":"Included in:",file->inc_in->s[i]); if(file->inc_in->n) printf("\n"); } if(option_xref&XREF_FUNC) { for(i=0;i<file->f_refs->n;i++) printf(" %s %s : %s\n",i?" ":"Refs func: ",file->f_refs->s1[i],file->f_refs->s2[i]); if(file->f_refs->n) printf("\n"); } if(option_xref&XREF_VAR) { for(i=0;i<file->v_refs->n;i++) printf(" %s %s : %s\n",i?" ":"Refs var: ",file->v_refs->s1[i],file->v_refs->s2[i]); if(file->v_refs->n) printf("\n"); } } /*++++++++++++++++++++++++++++++++++++++ Print out the information for an include file. Include incl The include file to output the information for. int depth The depth of the includes. ++++++++++++++++++++++++++++++++++++++*/ static void OutputInclude(Include incl,int depth) { int c,i; Include inc; for(inc=incl->includes,c=0;inc;inc=inc->next,c++) { for(i=0;i<depth;i++) fputs(" ",stdout); printf(" %c%s%c\n",inc->scope==GLOBAL?'<':'"',inc->name,inc->scope==GLOBAL?'>':'"'); OutputInclude(inc,depth+1); } } /*++++++++++++++++++++++++++++++++++++++ Print out the information for a typedef. Typedef type The typedef to output the information for. ++++++++++++++++++++++++++++++++++++++*/ static void OutputTypedef(Typedef type) { printf("In file: %s\n",type->comment); if(type->type) printf("Typedef: %s = %s\n",type->name,type->type); else printf("Type: %s\n",type->name); printf("\n"); } /*++++++++++++++++++++++++++++++++++++++ Print out the information for a variable. Variable var The variable to output the information for. ++++++++++++++++++++++++++++++++++++++*/ static void OutputVariable(Variable var) { int i,done=0; printf("In file: %s\n",var->comment); printf("Variable: %s [",var->name); if(var->scope&LOCAL) done=printf("Local"); if(var->scope&GLOBAL) done=printf("%sGlobal definition",done?" and ":""); if(var->scope&EXTERNAL) done=printf("%sExternal",done?" and ":""); if(var->scope&EXTERN_H) done=printf("%sExternal from header file",done?" and ":""); if(var->scope&EXTERN_F) done=printf("%sExternal within function",done?" and ":""); printf("]\n"); if(option_xref&XREF_VAR) { if(var->scope&(GLOBAL|LOCAL)) for(i=0;i<var->visible->n;i++) printf(" %s %s : %s\n",i?" ":"Visible in: ",var->visible->s1[i],var->visible->s2[i]); for(i=0;i<var->used->n;i++) if(var->used->s1[i][0]=='$') printf(" %s %s\n",i?" ":"Used in: ",var->used->s2[i]); else printf(" %s %s : %s\n",i?" ":"Used in: ",var->used->s1[i],var->used->s2[i]); } printf("\n"); } /*++++++++++++++++++++++++++++++++++++++ Print out the information for a function. Function func The function to output the information for. ++++++++++++++++++++++++++++++++++++++*/ static void OutputFunction(Function func) { int i; printf("In file: %s\n",func->comment); printf("Function: %s ",func->name); switch(func->scope) { case LOCAL: printf("[Local]\n"); break; case GLOBAL: printf("[Global]\n"); break; case LOCAL+INLINED: printf("[Local inline]\n"); break; case INLINED: printf("[inline]\n"); break; default: ; } if(option_xref&XREF_FUNC) { for(i=0;i<func->calls->n;i++) printf(" %s %s : %s\n",i?" ":"Calls: ",func->calls->s1[i],func->calls->s2[i]?func->calls->s2[i]:"?unknown?"); for(i=0;i<func->called->n;i++) printf(" %s %s : %s\n",i?" ":"Called from:",func->called->s1[i],func->called->s2[i]); for(i=0;i<func->used->n;i++) { if(func->used->s1[i][0]=='$') printf(" %s %s\n",i?" ":"Used in: ",func->used->s2[i]); else printf(" %s %s : %s\n",i?" ":"Used in: ",func->used->s1[i],func->used->s2[i]); } for(i=0;i<func->f_refs->n;i++) printf(" %s %s : %s\n",i?" ":"Refs func: ",func->f_refs->s1[i],func->f_refs->s2[i]?func->f_refs->s2[i]:"?unknown?"); } if(option_xref&XREF_VAR) for(i=0;i<func->v_refs->n;i++) printf(" %s %s : %s\n",i?" ":"Refs var: ",func->v_refs->s1[i],func->v_refs->s2[i]?func->v_refs->s2[i]:"?unknown?"); printf("\n"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/query/query.c���������������������������������������������������������������������������� 644 � 233 � 144 � 10447 11506061166 10511� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/query/query.c,v 1.5 2004-06-22 17:31:30 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,2004 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "memory.h" #include "datatype.h" #include "cxref.h" #include "query.h" /*+ The command line switch that sets the amount of cross referencing to do. +*/ int option_xref=0; /*+ The command line switch for the output name, +*/ char *option_odir=".", /*+ The directory to use. +*/ *option_name="cxref"; /*+ The base part of the name. +*/ File *files=NULL; /*+ The files that are queried. +*/ int n_files=0; /*+ The number of files referenced. +*/ Function *functions=NULL; /*+ The functions that are queried. +*/ int n_functions=0; /*+ The number of functions referenced. +*/ Variable *variables=NULL; /*+ The variables that are queried. +*/ int n_variables=0; /*+ The number of variables referenced. +*/ Typedef *typedefs=NULL; /*+ The type definitions that are queried. +*/ int n_typedefs=0; /*+ The number of typedefs referenced. +*/ /*++++++++++++++++++++++++++++++++++++++ The main function that does it all. int main Returns the status, zero for normal termination, else an error. int argc The command line number of arguments. char** argv The actual command line arguments ++++++++++++++++++++++++++++++++++++++*/ int main(int argc,char** argv) { int i,args=0; if(argc==1) { fputs("Usage: cxref-query [name [ ... name]] ; Names of objects to query.\n" " [-Odirname] ; Use dirname as the input directory\n" " [-Nbasename] ; Use basename.* as the input filenames\n" " [-xref[-all][-file][-func][-var][-type]] ; Use cross reference files (default -xref-all).\n" ,stderr); exit(1); } for(i=1;i<argc;i++) { if(!strncmp(argv[i],"-O",2)) { if(argv[i][2]==0) { argv[i++]=NULL; if(i==argc) {fprintf(stderr,"cxref-query: The -O option requires a following argument.\n");return(1);} option_odir=argv[i]; } else option_odir=&argv[i][2]; argv[i]=NULL; continue; } if(!strncmp(argv[i],"-N",2)) { if(argv[i][2]==0) { argv[i++]=NULL; if(i==argc) {fprintf(stderr,"cxref-query: The -N option requires a following argument.\n");return(1);} option_name=argv[i]; } else option_name=&argv[i][2]; argv[i]=NULL; continue; } if(!strncmp(argv[i],"-xref",5)) { char* p=&argv[i][5]; if(!*p) option_xref=XREF_ALL; else while(*p) { if(!strncmp(p,"-all" ,4)) {option_xref|=XREF_ALL ; p=&p[4]; continue;} if(!strncmp(p,"-file",5)) {option_xref|=XREF_FILE; p=&p[5]; continue;} if(!strncmp(p,"-func",5)) {option_xref|=XREF_FUNC; p=&p[5]; continue;} if(!strncmp(p,"-var" ,4)) {option_xref|=XREF_VAR ; p=&p[4]; continue;} if(!strncmp(p,"-type",5)) {option_xref|=XREF_TYPE; p=&p[5]; continue;} break; } argv[i]=NULL;continue; } args++; if(!strncmp(argv[i],"./",2)) argv[i]+=2; } LoadInCrossRefs(); if(args) { for(i=1;i<argc;i++) if(argv[i]) { printf("cxref-query> %s\n\n",argv[i]); OutputCrossRef(argv[i]); } } else { while(1) { char input[128]; printf("cxref-query> "); if(!fgets(input,128,stdin)) {printf("\n\n");break;} printf("\n"); input[strlen(input)-1]=0; OutputCrossRef(input); } } PrintMemoryStatistics(); return(0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/query/query.h���������������������������������������������������������������������������� 644 � 233 � 144 � 1340 11506061166 10466� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/query/query.h,v 1.3 1996-02-24 14:53:52 amb Exp $ C Cross Referencing & Documentation tool. Version 1.0 ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #ifndef QUERY_H #define QUERY_H /*+ To stop multiple inclusions. +*/ /* In input.c */ void LoadInCrossRefs(void); /* In output.c */ void OutputCrossRef(char* name); #endif /* QUERY_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/������������������������������������������������������������������������������������� 40755 � 233 � 144 � 0 11642337067 6567� 5�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/Makefile.in�������������������������������������������������������������������������� 644 � 233 � 144 � 14535 11625756327 10705� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # C Cross Referencing & Documentation tool. Version 1.6d. # # Program Makefile. # # Written by Andrew M. Bishop # # This file Copyright 1995-2011 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # # autoconf things srcdir=@srcdir@ VPATH=@srcdir@ # The installation locations prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=$(DESTDIR)@bindir@ # The installation program. INSTALL=@INSTALL@ # The C compiler and linker CC=@CC@ LD=@CC@ CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ # The Yacc program YACC=@YACC@ YACCFLAGS=-d BISONFLAGS=-d # The Lex Program LEX=@LEX@ LEXFLAGS= FLEXFLAGS=-p -B -F -8 -s # The page size (for LaTeX and RTF). # (A4 or US only.) PAGE=@PAGE@ ######## INCLUDE=-I. -I$(srcdir) LIBRARY=@LIBS@ ######## programs : cxref cxref-inst all : programs ######## install : programs [ -d $(bindir) ] || $(INSTALL) -d $(bindir) $(INSTALL) -m 755 cxref-inst $(bindir)/cxref $(INSTALL) -m 755 $(srcdir)/cxref-cc $(bindir) install-win32 : programs [ -d $(bindir) ] || $(INSTALL) -d $(bindir) $(INSTALL) -m 755 cxref-inst.exe $(bindir)/cxref.exe $(INSTALL) -m 755 cxref-cc $(bindir) ######## clean : -rm -f cxref cxref-inst core *.o *~ \ lex.*.c y.tab.* latex-style.c html-style.c \ parse-yacc.c parse-yacc.h parse-lex.c #### distclean : clean -rm -f Makefile autoconfig.h ######## OBJ_FILES=func.o type.o var.o preproc.o comment.o file.o \ slist.o memory.o \ xref.o \ warn-raw.o latex.o latex-style.o html.o html-style.o rtf.o sgml.o \ parse-lex.o parse-yacc.o cxref : cxref.o $(OBJ_FILES) $(LD) $(LDFLAGS) cxref.o $(OBJ_FILES) -o $@ $(LIBRARY) cxref-inst : cxref-inst.o $(OBJ_FILES) $(LD) $(LDFLAGS) cxref-inst.o $(OBJ_FILES) -o $@ $(LIBRARY) ######## parse-yacc.c parse-yacc.h : parse.y [ ! "$(YACC)" = "bison" ] || $(YACC) $(BISONFLAGS) $(srcdir)/parse.y [ "$(YACC)" = "bison" ] || $(YACC) $(YACCFLAGS) $(srcdir)/parse.y -@if cmp -s parse-yacc.c y.tab.c ; then \ rm y.tab.c ; \ else \ mv y.tab.c parse-yacc.c ; \ echo Created parse-yacc.c ; \ fi -@if cmp -s parse-yacc.h y.tab.h ; then \ rm y.tab.h ; \ else \ mv y.tab.h parse-yacc.h ; \ echo Created parse-yacc.h ; \ fi #### parse-lex.c : parse.l [ ! "$(LEX)" = "flex" ] || $(LEX) $(FLEXFLAGS) $(srcdir)/parse.l [ "$(LEX)" = "flex" ] || $(LEX) $(LEXFLAGS) $(srcdir)/parse.l -@mv lex.yy.c parse-lex.c @echo Created parse-lex.c #### latex-style.c : $(srcdir)/fonts.sty.in $(srcdir)/page.sty.in $(srcdir)/cxref.sty.in @echo '/** The style files needed for LaTeX. **/' > latex-style.c @echo '' >> latex-style.c @echo '/*+ The fonts style file as a string. +*/' >> latex-style.c @echo 'char *latex_fonts_style=' >> latex-style.c @sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' $(srcdir)/fonts.sty.in \ |awk '{print "\"" $$0 "\\n\""}' >> latex-style.c @echo ';' >> latex-style.c @echo '' >> latex-style.c @echo '/*+ The page style file as a string. +*/' >> latex-style.c @echo 'char *latex_page_style=' >> latex-style.c @sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' $(srcdir)/page.sty.in \ |sed 's/ CONFIG-ONLY PAGE=$(PAGE)//g' \ |grep -v 'CONFIG-ONLY' \ |awk '{print "\"" $$0 "\\n\""}' >> latex-style.c @echo ';' >> latex-style.c @echo '' >> latex-style.c @echo '/*+ The cxref style file as a string. +*/' >> latex-style.c @echo 'char *latex_cxref_style=' >> latex-style.c @sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' $(srcdir)/cxref.sty.in \ |awk '{print "\"" $$0 "\\n\""}' >> latex-style.c @echo ';' >> latex-style.c @echo Created latex-style.c #### html-style.c : $(srcdir)/cxref.css.in @echo '/** The Cascading Style Sheet for HTML. **/' > html-style.c @echo '' >> html-style.c @echo '/*+ The cxref CSS file as a string. +*/' >> html-style.c @echo 'char *html_cxref_style=' >> html-style.c @sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' $(srcdir)/cxref.css.in \ |awk '{print "\"" $$0 "\\n\""}' >> html-style.c @echo ';' >> html-style.c @echo Created html-style.c #### cpp_dir=@abs_top_builddir@/cpp .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) -c $(CFLAGS) $< -o $@ $(INCLUDE) cxref.o : cxref.c cxref.h datatype.h memory.h parse-yy.h version.h [ ! -f ../cpp/cxref-cpp ] || $(CC) -c $(CFLAGS) cxref.c -o $@ $(INCLUDE) "-DCXREF_CPP=\"$(cpp_dir)/cxref-cpp -cxref-cpp-defines $(cpp_dir)/cxref-cpp.defines -lang-c -C -dD -dI\"" [ -f ../cpp/cxref-cpp ] || $(CC) -c $(CFLAGS) cxref.c -o $@ $(INCLUDE) cxref-inst.o : cxref.c cxref.h datatype.h memory.h parse-yy.h [ ! -f ../cpp/cxref-cpp ] || $(CC) -c $(CFLAGS) cxref.c -o $@ $(INCLUDE) '-DCXREF_CPP="cxref-cpp -lang-c -C -dD -dI"' [ -f ../cpp/cxref-cpp ] || $(CC) -c $(CFLAGS) cxref.c -o $@ $(INCLUDE) func.o : func.c cxref.h datatype.h memory.h parse-yy.h type.o : type.c cxref.h datatype.h memory.h parse-yy.h var.o : var.c cxref.h datatype.h memory.h parse-yy.h comment.o : comment.c cxref.h datatype.h memory.h file.o : file.c cxref.h datatype.h memory.h preproc.o : preproc.c cxref.h datatype.h memory.h parse-yy.h slist.o : slist.c cxref.h datatype.h memory.h memory.o : memory.c memory.h xref.o : xref.c cxref.h datatype.h memory.h warn-raw.o : warn-raw.c cxref.h datatype.h memory.h latex.o : latex.c cxref.h datatype.h memory.h version.h latex-style.o: latex-style.c html.o : html.c cxref.h datatype.h memory.h version.h html-style.o : html-style.c rtf.o : rtf.c cxref.h datatype.h memory.h version.h $(CC) -c $(CFLAGS) $< -o $@ -DPAGE=\"$(PAGE)\" $(INCLUDE) sgml.o : sgml.c cxref.h datatype.h memory.h version.h parse-yacc.o : parse-yacc.c cxref.h datatype.h memory.h parse-yy.h parse-yacc.h parse-lex.o : parse-lex.c cxref.h datatype.h memory.h parse-yy.h parse-yacc.h ######## �������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/autoconfig.h.in���������������������������������������������������������������������� 644 � 233 � 144 � 2447 11506061166 11517� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/autoconfig.h.in,v 1.2 2004-06-20 13:13:29 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1999,2004 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /* Misc */ /* Define to empty if the keyword does not work. */ #undef const /* Define to `int' if <sys/types.h> doesn't define. */ #undef pid_t /* Functions */ /* Define if you have the getcwd function. */ #undef HAVE_GETCWD /* Define if you have the mkdir function. */ #undef HAVE_MKDIR /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the strstr function. */ #undef HAVE_STRSTR /* Include files */ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you have the <malloc.h> header file. */ #undef HAVE_MALLOC_H /* Define if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/comment.c���������������������������������������������������������������������������� 644 � 233 � 144 � 17611 11506061166 10430� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/comment.c,v 1.22 2003-01-17 19:07:56 amb Exp $ C Cross Referencing & Documentation tool. Version 1.5e. Collects the comments from the parser. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,98 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /*+ Turn on the debugging in this file. +*/ #define DEBUG 0 #include <stdlib.h> #include <stdio.h> #include <string.h> #include "memory.h" #include "datatype.h" #include "cxref.h" static void TidyCommentString(char **string,int spaces); /*+ The option to insert the comments verbatim into the output. +*/ extern int option_verbatim_comments; /*+ The file that is currently being processed. +*/ extern File CurFile; /*+ The name of the current file. +*/ extern char* parse_file; /*+ The current (latest) comment. +*/ static char* current_comment=NULL; /*+ The malloced string for the current comment. +*/ static char* malloc_comment=NULL; /*+ The status of the current comment. +*/ static int comment_ended=0; /*++++++++++++++++++++++++++++++++++++++ Function that is called when a comment or part of one is seen. The comment is built up until an end of comment is signaled. char* c The comment text. int flag A flag to indicate the type of comment that it is. if flag==0 then it is a comment of some sort. If flag==1 then it is the end of a file (/ * * comment * * /) comment if flag==2 then it is the end of the other special comment (/ * + comment + * /). if flag==3 then it is the end of a normal comment (/ * comment * /). ++++++++++++++++++++++++++++++++++++++*/ void SeenComment(char* c,int flag) { switch(flag) { case 1: #if DEBUG printf("#Comment.c# Seen comment /**\n%s\n**/\n",current_comment); #endif TidyCommentString(¤t_comment,0); if(!CurFile->comment && !strcmp(CurFile->name,parse_file)) SeenFileComment(current_comment); current_comment=NULL; if(malloc_comment) *malloc_comment=0; comment_ended=1; break; case 2: #if DEBUG printf("#Comment.c# Seen comment /*+\n%s\n+*/\n",current_comment); #endif TidyCommentString(¤t_comment,0); if(SeenFuncIntComment(current_comment)) { current_comment=NULL; if(malloc_comment) *malloc_comment=0; } comment_ended=1; break; case 3: #if DEBUG printf("#Comment.c# Seen comment /*\n%s\n*/\n",current_comment); #endif TidyCommentString(¤t_comment,!option_verbatim_comments); if(!CurFile->comment && !strcmp(CurFile->name,parse_file)) { SeenFileComment(current_comment); current_comment=NULL; if(malloc_comment) *malloc_comment=0; } comment_ended=1; break; default: if(comment_ended) { comment_ended=0; current_comment=NULL; if(malloc_comment) *malloc_comment=0; } if(malloc_comment==NULL) { malloc_comment=Malloc(strlen(c)+1); strcpy(malloc_comment,c); } else { malloc_comment=Realloc(malloc_comment,strlen(c)+strlen(malloc_comment)+1); strcat(malloc_comment,c); } current_comment=malloc_comment; } } /*++++++++++++++++++++++++++++++++++++++ Provide the current (latest) comment. char* GetCurrentComment Returns the current (latest) comment. ++++++++++++++++++++++++++++++++++++++*/ char* GetCurrentComment(void) { char* comment=current_comment; #if DEBUG printf("#Comment.c# GetCurrentComment returns <<<%s>>>\n",comment); #endif current_comment=NULL; return(comment); } /*++++++++++++++++++++++++++++++++++++++ Set the current (latest) comment. char* comment The comment. ++++++++++++++++++++++++++++++++++++++*/ void SetCurrentComment(char* comment) { #if DEBUG printf("#Comment.c# SetCurrentComment set to <<<%s>>>\n",comment); #endif if(comment) { if(malloc_comment!=comment) { malloc_comment=Realloc(malloc_comment,strlen(comment)+1); strcpy(malloc_comment,comment); } current_comment=malloc_comment; } else { current_comment=NULL; if(malloc_comment) *malloc_comment=0; } } /*++++++++++++++++++++++++++++++++++++++ A function to split out the arguments etc from a comment, for example the function argument comments are separated using this. char* SplitComment Returns the required comment. char** original A pointer to the original comment, this is altered in the process. char* name The name that is to be cut out from the comment. A most clever function that ignores spaces so that 'char* b' and 'char *b' match. ++++++++++++++++++++++++++++++++++++++*/ char* SplitComment(char** original,char* name) { char* c=NULL; if(*original) { int l=strlen(name); c=*original; do{ int i,j,failed=0; char* start=c; while(c[0]=='\n') c++; for(i=j=0;i<l;i++,j++) { while(name[i]==' ') i++; while(c[j]==' ') j++; if(!c[j] || name[i]!=c[j]) {failed=1;break;} } if(!failed) { char* old=*original; char* end=strstr(c,"\n\n"); *start=0; if(end) *original=MallocString(ConcatStrings(2,*original,end)); else if(start==*original) *original=NULL; else *original=MallocString(*original); if(end) *end=0; if(end && &c[j+1]>=end) c=NULL; else { c=CopyString(&c[j+1]); TidyCommentString(&c,1); if(!*c) c=NULL; } Free(old); break; } } while((c=strstr(c,"\n\n"))); } return(c); } /*++++++++++++++++++++++++++++++++++++++ Tidy up the current comment string by snipping off trailing and leading junk. char **string The string that is to be tidied. int spaces Indicates that leading and trailing whitespace are to be removed as well. ++++++++++++++++++++++++++++++++++++++*/ static void TidyCommentString(char **string,int spaces) { int whitespace; char *to=*string,*from=*string,*str; if(!*string) return; /* Remove CR characters. */ while(*from) { if(*from=='\r') from++; else *to++=*from++; } *to=0; /* Remove leading blank lines. */ whitespace=1; str=*string; do { if(*str!='\n') do { if(*str!=' ' && *str!='\t') whitespace=0; } while(whitespace && *str && *++str!='\n'); if(whitespace) *string=++str; else if(spaces) *string=str; } while(whitespace); /* Remove trailing blank lines. */ whitespace=1; str=*string+strlen(*string)-1; do { if(*str!='\n') do { if(*str!=' ' && *str!='\t') whitespace=0; } while(whitespace && str>*string && *--str!='\n'); if(whitespace) *str--=0; else if(spaces) *(str+1)=0; } while(whitespace); /* Replace lines containing just whitespace with empty lines. */ str=*string; do { char *start; whitespace=1; while(*str=='\n') str++; start=str; while(*str && *++str!='\n') { if(*str!=' ' && *str!='\t') whitespace=0; } if(whitespace) { char *copy=start; while((*start++=*str++)); str=copy; } } while(*str); } /*++++++++++++++++++++++++++++++++++++++ Delete the malloced string for the comment ++++++++++++++++++++++++++++++++++++++*/ void DeleteComment(void) { current_comment=NULL; if(malloc_comment) Free(malloc_comment); malloc_comment=NULL; comment_ended=0; } �����������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/cxref-cc����������������������������������������������������������������������������� 755 � 233 � 144 � 6305 11506061166 10220� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # $Header: /home/amb/CVS/cxref/src/cxref-cc,v 1.4 2002-01-19 14:35:28 amb Exp $ # # C Cross Referencing & Documentation tool. Version 1.5d. # # C compiler replacement to compile program and cross reference it. # # Written by Andrew M. Bishop # # This file Copyright 1997,98,2002 Andrew M. Bishop # It may be distributed under the GNU Public License, version 2, or # any higher version. See section COPYING of the GNU Public license # for conditions under which this file may be redistributed. # # Print a usage statement. if [ $# = 0 ]; then echo 'Usage: cxref-cc filename [CC-arguments]' 1>&2 echo '' 1>&2 echo 'filename : The name of the file to compile and cross reference.' 1>&2 echo 'CC-arguments : Any number of arguments to the C compiler.' 1>&2 echo '' 1>&2 echo 'The C compiler is called first, and if this succeeds then cxref is called.' 1>&2 echo 'You require a .cxref file to contain the cxref options.' 1>&2 exit 1 fi # Check for a .cxref file. if [ ! -r .cxref ]; then echo 'cxref-cc: Error a .cxref file is required to use cxref-cc.' 1>&2 echo ' If you do not need any arguments an empty file will work.' 1>&2 exit 1 fi # The variables that we are going to use. if [ "x$CXREFCC" = x ]; then if [ "x$CC" = x ]; then CXREFCC=gcc else CXREFCC=`echo $CC | cut -d' ' -f1` if [ `basename $CXREFCC` = cxref-cc ]; then echo 'cxref-cc: Warning the CC variable points to cxref-cc, set CXREFCC instead.' 1>&2 CXREFCC=gcc fi fi fi CXREF=cxref FILE= FILESTDIN= CXREFFLAGS= # Call the C compiler $CXREFCC "$@" if [ ! $? = 0 ]; then echo 'cxref-cc: The C compiler failed with an error status.' 1>&2 exit 1 fi # Loop over the arguments and sort them out. # Note: Need to be careful because "-DFOO=BAR BAR" loses its quotes on parameter # expansion, but must be passed to cxref as a single word. We need to use # a word separator since there are no arrays, so we use ^M. while [ ! $# = 0 ]; do case $1 in # The arguments to keep -D) CXREFFLAGS="$CXREFFLAGS $1 $2"; shift;; -D*) CXREFFLAGS="$CXREFFLAGS $1";; -U) CXREFFLAGS="$CXREFFLAGS $1 $2"; shift;; -U*) CXREFFLAGS="$CXREFFLAGS $1";; -I) CXREFFLAGS="$CXREFFLAGS $1 $2"; shift;; -I*) CXREFFLAGS="$CXREFFLAGS $1";; # The filename (perhaps) *.c) if [ "x$FILE" = x -a -r $1 ]; then FILE=" $1"; fi;; -) FILESTDIN=yes;; # The arguments to throw away *) ;; esac shift done # Check that a real file was specified if [ "x$FILE" = x ]; then if [ "x$FILESTDIN" = xyes ]; then echo 'cxref-cc: Cannot use stdin "-" as a filename with cxref-cc' 1>&2 else echo 'cxref-cc: Warning no file specified on the command line' 1>&2 fi exit 0 fi # Call cxref # Note: We are using ^M as the word separator, as detailed above. IFS= export IFS $CXREF$FILE$CXREFFLAGS if [ ! $? = 0 ]; then echo 'cxref-cc: Cxref exited with error status' 1>&2 exit 1 fi ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/cxref.c������������������������������������������������������������������������������ 644 � 233 � 144 � 73363 11506061166 10103� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/cxref.c,v 1.68 2006-03-11 14:39:23 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6b. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,98,99,2000,01,02,03,04 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> #include <unistd.h> #include "version.h" #include "parse-yy.h" #include "memory.h" #include "datatype.h" #include "cxref.h" #ifndef PATH_MAX #define PATH_MAX 4096 /*+ The maximum pathname length. +*/ #endif /*+ The default value of the CPP command. +*/ #ifdef CXREF_CPP #define CPP_COMMAND CXREF_CPP #else #define CPP_COMMAND "gcc -E -C -dD -dI" #endif /*+ The name of the file to read the configuration from. +*/ #define CXREF_CONFIG_FILE ".cxref" static void Usage(int verbose); static int ParseConfigFile(void); static int ParseOptions(int nargs,char **args,int fromfile); static int DocumentTheFile(char* name); static FILE* popen_execvp(char** command); static int pclose_execvp(FILE* f); static char** cpp_command; /*+ The actual cpp command that is built up, adding -D, -U and -I options. +*/ static int cpp_command_num=0; /*+ The number of arguments to the cpp command. +*/ static int cpp_argument_num=0; /*+ The number of arguments to the -CPP argument. +*/ /*+ The command line switch that sets the format of the output, +*/ int option_all_comments=0, /*+ use all comments. +*/ option_verbatim_comments=0, /*+ insert the comments verbatim into the output. +*/ option_block_comments=0, /*+ remove the leading block comment marker. +*/ option_no_comments=0, /*+ ignore all comments. +*/ option_xref=0, /*+ do cross referencing. +*/ option_warn=0, /*+ produce warnings. +*/ option_index=0, /*+ produce an index. +*/ option_raw=0, /*+ produce raw output. +*/ option_latex=0, /*+ produce LaTeX output. +*/ option_html=0, /*+ produce HTML output. +*/ option_rtf=0, /*+ produce RTF output. +*/ option_sgml=0; /*+ produce SGML output. +*/ /*+ The option to control the mode of operation. +*/ static int option_delete=0; /*+ The command line switch for the output name, +*/ char *option_odir=NULL, /*+ the directory to use. +*/ *option_name=NULL, /*+ the base part of the name. +*/ *option_root=NULL; /*+ the source tree root directory. +*/ /*+ The name of the include directories specified on the command line. +*/ char **option_incdirs=NULL; /*+ The information about the cxref run, +*/ char *run_command=NULL, /*+ the command line options. +*/ *run_cpp_command=NULL; /*+ the cpp command and options. +*/ /*+ The number of include directories on the command line. +*/ int option_nincdirs=0; /*+ The names of the files to process. +*/ static char **option_files=NULL; /*+ The number of files to process. +*/ static int option_nfiles=0; /*+ The current file that is being processed. +*/ File CurFile=NULL; /*++++++++++++++++++++++++++++++++++++++ The main function that calls the parser. int main Returns the status, zero for normal termination, else an error. int argc The command line number of arguments. char** argv The actual command line arguments ++++++++++++++++++++++++++++++++++++++*/ int main(int argc,char** argv) { int i; char *root_prefix=NULL; char here[PATH_MAX+1],there[PATH_MAX+1]; if(argc==1) Usage(1); /* Setup the variables. */ cpp_command=(char**)Malloc(8*sizeof(char*)); cpp_command[cpp_command_num++]=MallocString(CPP_COMMAND); for(i=1;cpp_command[cpp_command_num-1][i];i++) if(cpp_command[cpp_command_num-1][i]==' ') { cpp_command[cpp_command_num-1][i]=0; if((cpp_command_num%8)==6) cpp_command=(char**)Realloc(cpp_command,(cpp_command_num+10)*sizeof(char*)); cpp_command[cpp_command_num]=MallocString(&cpp_command[cpp_command_num-1][i+1]); cpp_command_num++; i=1; } cpp_argument_num=cpp_command_num; option_incdirs=(char**)Malloc(8*sizeof(char*)); option_incdirs[0]=MallocString("."); option_nincdirs=1; option_odir=MallocString("."); option_name=MallocString("cxref"); option_files=(char**)Malloc(8*sizeof(char*)); run_command=argv[0]; /* Parse the command line options. */ if(ParseOptions(argc-1,&argv[1],0)) Usage(0); /* Parse the options in .cxref in this directory. */ if(ParseConfigFile()) Usage(0); /* Change directory. */ if(option_root) { if(!getcwd(there,PATH_MAX)) {fprintf(stderr,"cxref: Error cannot get current working directory (1).\n");exit(1);} if(chdir(option_root)) {fprintf(stderr,"cxref: Error cannot change directory to '%s'.\n",option_root);exit(1);} } if(!getcwd(here,PATH_MAX)) {fprintf(stderr,"cxref: Error cannot get current working directory (2).\n");exit(1);} if(option_root) { if(!strcmp(here,there)) root_prefix="."; else if(!strcmp(here,"/")) root_prefix=there+1; else if(!strncmp(here,there,strlen(here))) root_prefix=there+strlen(here)+1; else {fprintf(stderr,"cxref: Error the -R option has not specified a parent directory of the current one.\n");exit(1);} } /* Modify the -I options for the new root directory. */ for(i=1;i<cpp_command_num;i++) if(cpp_command[i][0]=='-' && cpp_command[i][1]=='I') { if(cpp_command[i][2]==0) { char *old=cpp_command[++i]; if(cpp_command[i][0]!='/' && root_prefix) cpp_command[i]=MallocString(CanonicaliseName(ConcatStrings(3,root_prefix,"/",cpp_command[i]))); else if(cpp_command[i][0]=='/' && !strcmp(cpp_command[i],here)) cpp_command[i]=MallocString("."); else if(cpp_command[i][0]=='/' && !strcmp(here,"/")) cpp_command[i]=MallocString(cpp_command[i]+1); else if(cpp_command[i][0]=='/' && !strncmp(cpp_command[i],here,strlen(here))) cpp_command[i]=MallocString(cpp_command[i]+strlen(here)+1); else cpp_command[i]=MallocString(CanonicaliseName(cpp_command[i])); Free(old); } else { char *old=cpp_command[i]; if(cpp_command[i][2]!='/' && root_prefix) cpp_command[i]=MallocString(ConcatStrings(2,"-I",CanonicaliseName(ConcatStrings(3,root_prefix,"/",cpp_command[i]+2)))); else if(cpp_command[i][2]=='/' && !strcmp(&cpp_command[i][2],here)) cpp_command[i]=MallocString("-I."); else if(cpp_command[i][2]=='/' && !strcmp(here,"/")) cpp_command[i]=MallocString(ConcatStrings(2,"-I",cpp_command[i]+2+1)); else if(cpp_command[i][2]=='/' && !strncmp(&cpp_command[i][2],here,strlen(here))) cpp_command[i]=MallocString(ConcatStrings(2,"-I",cpp_command[i]+2+strlen(here)+1)); else cpp_command[i]=MallocString(ConcatStrings(2,"-I",CanonicaliseName(cpp_command[i]+2))); Free(old); } } for(i=0;i<option_nincdirs;i++) { char *old=option_incdirs[i]; if(*option_incdirs[i]!='/' && root_prefix) option_incdirs[i]=MallocString(CanonicaliseName(ConcatStrings(3,root_prefix,"/",option_incdirs[i]))); else if(*option_incdirs[i]=='/' && !strcmp(option_incdirs[i],here)) option_incdirs[i]=MallocString("."); else if(*option_incdirs[i]=='/' && !strcmp(here,"/")) option_incdirs[i]=MallocString(option_incdirs[i]+strlen(here)+1); else if(*option_incdirs[i]=='/' && !strncmp(option_incdirs[i],here,strlen(here))) option_incdirs[i]=MallocString(option_incdirs[i]+strlen(here)+1); else option_incdirs[i]=MallocString(CanonicaliseName(option_incdirs[i])); Free(old); } /* Parse the options in .cxref in the root directory. */ if(option_root) if(ParseConfigFile()) Usage(0); run_command=MallocString(run_command); run_cpp_command=cpp_command[0]; for(i=1;i<cpp_command_num;i++) run_cpp_command=ConcatStrings(3,run_cpp_command," ",cpp_command[i]); run_cpp_command=MallocString(run_cpp_command); TidyMemory(); /* Check the options for validity */ if(option_warn&WARN_XREF && !option_xref) fprintf(stderr,"cxref: Warning using '-warn-xref' without '-xref'.\n"); /* Process each file. */ if(option_files) for(i=0;i<option_nfiles;i++) { char *filename=CanonicaliseName(root_prefix?ConcatStrings(3,root_prefix,"/",option_files[i]):option_files[i]); if(!strncmp(filename,"../",3) || *filename=='/') fprintf(stderr,"cxref: Error the file %s is outside the cxref root directory.\n",filename); else if(!option_delete) { CurFile=NewFile(filename); ResetLexer(); ResetParser(); if(!DocumentTheFile(filename)) { if(option_xref) CrossReference(CurFile,option_warn||option_raw||option_latex||option_html||option_rtf||option_sgml); if(option_raw || option_warn) WriteWarnRawFile(CurFile); if(option_latex) WriteLatexFile(CurFile); if(option_html) WriteHTMLFile(CurFile); if(option_rtf) WriteRTFFile(CurFile); if(option_sgml) WriteSGMLFile(CurFile); } ResetLexer(); ResetParser(); ResetPreProcAnalyser(); ResetTypeAnalyser(); ResetVariableAnalyser(); ResetFunctionAnalyser(); DeleteComment(); DeleteFile(CurFile); CurFile=NULL; } else { CrossReferenceDelete(filename); WriteLatexFileDelete(filename); WriteHTMLFileDelete(filename); WriteRTFFileDelete(filename); WriteSGMLFileDelete(filename); } TidyMemory(); } /* Create the index */ if(option_index) { StringList files; StringList2 funcs,vars,types; files=NewStringList(); funcs=NewStringList2(); vars=NewStringList2(); types=NewStringList2(); CreateAppendix(files,funcs,vars,types); if(option_raw||option_warn) WriteWarnRawAppendix(files,funcs,vars,types); if(option_latex) WriteLatexAppendix(files,funcs,vars,types); if(option_html) WriteHTMLAppendix(files,funcs,vars,types); if(option_rtf) WriteRTFAppendix(files,funcs,vars,types); if(option_sgml) WriteSGMLAppendix(files,funcs,vars,types); DeleteStringList(files); DeleteStringList2(funcs); DeleteStringList2(vars); DeleteStringList2(types); TidyMemory(); } /* Tidy up */ Free(option_odir); Free(option_name); if(option_root) Free(option_root); for(i=0;i<cpp_command_num;i++) Free(cpp_command[i]); Free(cpp_command); for(i=0;i<option_nincdirs;i++) Free(option_incdirs[i]); Free(option_incdirs); for(i=0;i<option_nfiles;i++) Free(option_files[i]); Free(option_files); Free(run_command); Free(run_cpp_command); PrintMemoryStatistics(); return(0); } /*++++++++++++++++++++++++++++++++++++++ Print out the usage instructions. int verbose If true then output a long version of the information. ++++++++++++++++++++++++++++++++++++++*/ static void Usage(int verbose) { fputs("\n" " C Cross Referencing & Documenting tool - Version " CXREF_VERSION "\n" " -----------------------------------------------------\n" "\n" "[ cxref " CXREF_COPYRIGHT ". ]\n" "[ amb@gedanken.demon.co.uk / http://www.gedanken.demon.co.uk/cxref/ ]\n" "\n" "Usage: cxref filename [ ... filename]\n" " [-Odirname] [-Nbasename] [-Rdirname]\n" " [-all-comments] [-no-comments]\n" " [-verbatim-comments] [-block-comments]\n" " [-xref[-all][-file][-func][-var][-type]]\n" " [-warn[-all][-comment][-xref]]\n" " [-index[-all][-file][-func][-var][-type]]\n" " [-latex] [-html[-src]] [-rtf] [-sgml] [-raw]\n" " [-Idirname] [-Ddefine] [-Udefine]\n" " [-CPP cpp_program] [-- cpp_arg [ ... cpp_arg]]\n" "\n" "Usage: cxref filename [ ... filename] -delete\n" " [-Odirname] [-Nbasename] [-Rdirname]\n" "\n", stderr); if(verbose) fputs("filename ... : Files to document.\n" "-delete : Delete all references to the named files.\n" "\n" "-Odirname : The output directory for the documentation.\n" "-Nbasename : The base filename for the output documentation.\n" "-Rdirname : The root directory of the source tree.\n" "\n" "-all-comments : Use all comments.\n" "-verbatim-comments : Insert the comments verbatim in the output.\n" "-block-comments : The comments are in block style.\n" "-no-comments : Ignore all of the comments.\n" "\n" "-xref[-*] : Do cross referencing (of specified types).\n" "-warn[-*] : Produce warnings (of comments or cross references).\n" "\n" "-index[-*] : Produce a cross reference index (of specified types).\n" "\n" "-latex : Produce LaTeX output.\n" "-html[-src] : Produce HTML output (HTML 4.01).\n" "-rtf : Produce RTF output.\n" "-sgml : Produce SGML output (DocBook format).\n" "-raw : Produce raw output .\n" "\n" "-I*, -D*, -U* : The usual compiler switches.\n" "-CPP cpp_program : The cpp program to use.\n" " : (default '" CPP_COMMAND "')\n" "-- cpp_arg ... : All arguments after the '--' are passed to cpp.\n" "\n" "The file .cxref in the current directory can also contain any of these arguments\n" "one per line, (except for filename and -delete).\n", stderr); else fputs("Run cxref with no arguments to get more verbose help\n", stderr); exit(1); } /*++++++++++++++++++++++++++++++++++++++ Read in the options from the configuration file. int ParseConfigFile Returns the value returned by ParseOptions(). ++++++++++++++++++++++++++++++++++++++*/ static int ParseConfigFile(void) { FILE *file=fopen(CXREF_CONFIG_FILE,"r"); char **lines=NULL; int nlines=0; char data[257]; if(file) { while(fgets(data,256,file)) { char *d=data+strlen(data)-1; if(*data=='#') continue; while(d>=data && (*d=='\r' || *d=='\n' || *d==' ')) *d--=0; if(d<data) continue; if(!lines) lines=(char**)Malloc(8*sizeof(char*)); else if((nlines%8)==7) lines=(char**)Realloc(lines,(nlines+9)*sizeof(char*)); if((!strncmp(data,"-I",2) || !strncmp(data,"-D",2) || !strncmp(data,"-U",2) || !strncmp(data,"-O",2) || !strncmp(data,"-N",2) || !strncmp(data,"-R",2)) && (data[2]==' ' || data[2]=='\t')) { int i=2; while(data[i]==' ' || data[i]=='\t') data[i++]=0; lines[nlines++]=CopyString(data); lines[nlines++]=CopyString(data+i); } else if(!strncmp(data,"-CPP",4) && (data[4]==' ' || data[4]=='\t')) { int i=4; while(data[i]==' ' || data[i]=='\t') data[i++]=0; lines[nlines++]=CopyString(data); lines[nlines++]=CopyString(data+i); } else if(*data) lines[nlines++]=CopyString(data); } if(nlines) { int n_files=option_nfiles; if(ParseOptions(nlines,lines,1)) { fprintf(stderr,"cxref: Error parsing the .cxref file\n"); return(1); } Free(lines); if(n_files!=option_nfiles) { for(;n_files<option_nfiles;n_files++) fprintf(stderr,"cxref: File names '%s' only allowed on command line.\n",option_files[n_files]); return(1); } } fclose(file); } return(0); } /*++++++++++++++++++++++++++++++++++++++ Parse the options from the command line or from the .cxref file. int ParseOptions Return 1 if there is an error. int nargs The number of arguments. char **args The actual arguments int fromfile A flag indicating that they are read from the .cxref file. ++++++++++++++++++++++++++++++++++++++*/ static int ParseOptions(int nargs,char **args,int fromfile) { int i,end_of_args=0; for(i=0;i<nargs;i++) { if(end_of_args) { if((cpp_command_num%8)==6) cpp_command=(char**)Realloc(cpp_command,(cpp_command_num+10)*sizeof(char*)); cpp_command[cpp_command_num++]=MallocString(args[i]); run_command=ConcatStrings(3,run_command," ",args[i]); continue; } if(!strncmp(args[i],"-I",2) || !strncmp(args[i],"-D",2) || !strncmp(args[i],"-U",2)) { char *incdir=NULL; if((cpp_command_num%8)==6) cpp_command=(char**)Realloc(cpp_command,(cpp_command_num+10)*sizeof(char*)); cpp_command[cpp_command_num++]=MallocString(args[i]); if(args[i][2]==0) { if(args[i][1]=='I') incdir=args[i+1]; if(i==nargs-1) {fprintf(stderr,"cxref: The -%c option requires a following argument.\n",args[i][1]);return(1);} if((cpp_command_num%8)==6) cpp_command=(char**)Realloc(cpp_command,(cpp_command_num+10)*sizeof(char*)); run_command=ConcatStrings(3,run_command," ",args[i]); cpp_command[cpp_command_num++]=MallocString(args[++i]); } else if(args[i][1]=='I') incdir=&args[i][2]; if(incdir) { if((option_nincdirs%8)==0) option_incdirs=(char**)Realloc(option_incdirs,(option_nincdirs+8)*sizeof(char*)); option_incdirs[option_nincdirs++]=MallocString(incdir); } run_command=ConcatStrings(3,run_command," ",args[i]); continue; } if(!strcmp(args[i],"-CPP")) { char **old=cpp_command,*command; int j,old_com_num=cpp_command_num,old_arg_num=cpp_argument_num; if(i==nargs-1) {fprintf(stderr,"cxref: The -CPP option requires a following argument.\n");return(1);} command=args[++i]; cpp_command_num=0; cpp_command=(char**)Malloc(8*sizeof(char*)); cpp_command[cpp_command_num++]=MallocString(command); for(j=1;cpp_command[cpp_command_num-1][j];j++) if(cpp_command[cpp_command_num-1][j]==' ') { cpp_command[cpp_command_num-1][j]=0; if((cpp_command_num%8)==6) cpp_command=(char**)Realloc(cpp_command,(cpp_command_num+10)*sizeof(char*)); cpp_command[cpp_command_num]=MallocString(&cpp_command[cpp_command_num-1][j+1]); cpp_command_num++; j=1; } cpp_argument_num=cpp_command_num; for(j=old_arg_num;j<old_com_num;j++) { if((cpp_command_num%8)==6) cpp_command=(char**)Realloc(cpp_command,(cpp_command_num+10)*sizeof(char*)); cpp_command[cpp_command_num++]=old[j]; } for(j=0;j<old_arg_num;j++) Free(old[j]); Free(old); run_command=ConcatStrings(4,run_command,"-CPP \"",args[i],"\""); continue; } if(!strncmp(args[i],"-O",2)) { if(option_odir) Free(option_odir); if(args[i][2]==0) { if(i==nargs-1) {fprintf(stderr,"cxref: The -O option requires a following argument.\n");return(1);} run_command=ConcatStrings(3,run_command," ",args[i]); option_odir=MallocString(args[++i]); } else option_odir=MallocString(&args[i][2]); run_command=ConcatStrings(3,run_command," ",args[i]); continue; } if(!strncmp(args[i],"-N",2)) { if(option_name) Free(option_name); if(args[i][2]==0) { if(i==nargs-1) {fprintf(stderr,"cxref: The -N option requires a following argument.\n");return(1);} run_command=ConcatStrings(3,run_command," ",args[i]); option_name=MallocString(args[++i]); } else option_name=MallocString(&args[i][2]); run_command=ConcatStrings(3,run_command," ",args[i]); continue; } if(!strncmp(args[i],"-R",2)) { if(option_root) Free(option_root); if(args[i][2]==0) { if(i==nargs-1) {fprintf(stderr,"cxref: The -R option requires a following argument.\n");return(1);} run_command=ConcatStrings(3,run_command," ",args[i]); option_root=MallocString(args[++i]); } else option_root=MallocString(&args[i][2]); if(*option_root=='.' && !*(option_root+1)) option_root=NULL; run_command=ConcatStrings(3,run_command," ",args[i]); continue; } if(!strcmp(args[i],"-delete")) {if(fromfile) {fprintf(stderr,"cxref: The -delete option cannot be used in the .cxref file.\n");return(1);} option_delete=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strcmp(args[i],"-all-comments")) {option_all_comments=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strcmp(args[i],"-verbatim-comments")) {option_verbatim_comments=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strcmp(args[i],"-block-comments")) {option_block_comments=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strcmp(args[i],"-no-comments")) {option_no_comments=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strncmp(args[i],"-xref",5)) { char* p=&args[i][5]; if(!*p) option_xref=XREF_ALL; else while(*p) { if(!strncmp(p,"-all" ,4)) {option_xref|=XREF_ALL ; p=&p[4]; continue;} if(!strncmp(p,"-file",5)) {option_xref|=XREF_FILE; p=&p[5]; continue;} if(!strncmp(p,"-func",5)) {option_xref|=XREF_FUNC; p=&p[5]; continue;} if(!strncmp(p,"-var" ,4)) {option_xref|=XREF_VAR ; p=&p[4]; continue;} if(!strncmp(p,"-type",5)) {option_xref|=XREF_TYPE; p=&p[5]; continue;} break; } run_command=ConcatStrings(3,run_command," ",args[i]); continue; } if(!strncmp(args[i],"-warn",5)) { char* p=&args[i][5]; if(!*p) option_warn=WARN_ALL; else while(*p) { if(!strncmp(p,"-all" ,4)) {option_warn|=WARN_ALL ; p=&p[4]; continue;} if(!strncmp(p,"-comment",8)) {option_warn|=WARN_COMMENT; p=&p[8]; continue;} if(!strncmp(p,"-xref" ,5)) {option_warn|=WARN_XREF ; p=&p[5]; continue;} break; } run_command=ConcatStrings(3,run_command," ",args[i]); continue; } if(!strncmp(args[i],"-index",6)) { char* p=&args[i][6]; if(!*p) option_index=INDEX_ALL; else while(*p) { if(!strncmp(p,"-all" ,4)) {option_index|=INDEX_ALL ; p=&p[4]; continue;} if(!strncmp(p,"-file",5)) {option_index|=INDEX_FILE; p=&p[5]; continue;} if(!strncmp(p,"-func",5)) {option_index|=INDEX_FUNC; p=&p[5]; continue;} if(!strncmp(p,"-var" ,4)) {option_index|=INDEX_VAR ; p=&p[4]; continue;} if(!strncmp(p,"-type",5)) {option_index|=INDEX_TYPE; p=&p[5]; continue;} break; } run_command=ConcatStrings(3,run_command," ",args[i]); continue; } if(!strcmp(args[i],"-raw")) {option_raw=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strcmp(args[i],"-latex209")) fprintf(stderr,"cxref: The '-latex209' option is obsolete, assuming '-latex'.\n"); if(!strcmp(args[i],"-latex2e")) fprintf(stderr,"cxref: The '-latex2e' option is obsolete, assuming '-latex'.\n"); if(!strncmp(args[i],"-latex",6)) {option_latex=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strncmp(args[i],"-html20",7)) fprintf(stderr,"cxref: The '-html20' option is obsolete, assuming '-html'.\n"); if(!strncmp(args[i],"-html32",7)) fprintf(stderr,"cxref: The '-html32' option is obsolete, assuming '-html'.\n"); if(!strncmp(args[i],"-html",5)) {option_html=1; if(strstr(args[i],"-src")) option_html+=16; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strcmp(args[i],"-rtf")) {option_rtf=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strcmp(args[i],"-sgml")) {option_sgml=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(!strcmp(args[i],"--")) {end_of_args=1; run_command=ConcatStrings(3,run_command," ",args[i]); continue;} if(args[i][0]=='-') {fprintf(stderr,"cxref: Unknown option '%s'.\n",args[i]);return(1);} if(fromfile) {fprintf(stderr,"cxref: File names '%s' only allowed on command line.\n",args[i]);return(1);} if(option_files && (option_nfiles%8)==0) option_files=(char**)Realloc(option_files,(option_nfiles+8)*sizeof(char*)); option_files[option_nfiles++]=MallocString(args[i]); } return(0); } /*++++++++++++++++++++++++++++++++++++++ Canonicalise a file name by removing '/../', '/./' and '//' references. char *CanonicaliseName Returns the argument modified. char *name The original name The same function is used in WWWOFFLE and cxref with changes for files or URLs. ++++++++++++++++++++++++++++++++++++++*/ char *CanonicaliseName(char *name) { char *match,*name2; match=name; while((match=strstr(match,"/./")) || !strncmp(match=name,"./",2)) { char *prev=match, *next=match+2; while((*prev++=*next++)); } match=name; while((match=strstr(match,"//"))) { char *prev=match, *next=match+1; while((*prev++=*next++)); } match=name2=name; while((match=strstr(match,"/../"))) { char *prev=match, *next=match+4; if((prev-name2)==2 && !strncmp(name2,"../",3)) {name2+=3;match++;continue;} while(prev>name2 && *--prev!='/'); match=prev; if(*prev=='/')prev++; while((*prev++=*next++)); } match=&name[strlen(name)-2]; if(match>=name && !strcmp(match,"/.")) *match=0; match=&name[strlen(name)-3]; if(match>=name && !strcmp(match,"/..")) { if(match==name) *++match=0; else while(match>name && *--match!='/') *match=0; } #if 1 /* as used in cxref */ match=&name[strlen(name)-1]; if(match>name && !strcmp(match,"/")) *match=0; if(!*name) *name='.',*(name+1)=0; #else /* as used in wwwoffle */ if(!*name || !strncmp(name,"../",3)) *name='/',*(name+1)=0; #endif return(name); } /*++++++++++++++++++++++++++++++++++++++ Calls CPP for the file to get all of the needed information. int DocumentTheFile Returns 1 in case of error, else 0. char* name The name of the file to document. The CPP is started as a sub-process, (using popen to return a FILE* for lex to use). ++++++++++++++++++++++++++++++++++++++*/ static int DocumentTheFile(char* name) { struct stat stat_buf; int error1,error2; static int first=1; if(stat(name,&stat_buf)==-1) {fprintf(stderr,"cxref: Cannot access the file '%s'\n",name);return(1);} cpp_command[cpp_command_num ]=name; cpp_command[cpp_command_num+1]=NULL; yyin=popen_execvp(cpp_command); if(!yyin) {fprintf(stderr,"cxref: Failed to start the cpp command '%s'\n",cpp_command[0]);exit(1);} if(!first) yyrestart(yyin); first=0; #if YYDEBUG yydebug=(YYDEBUG==3); #endif error1=yyparse(); error2=pclose_execvp(yyin); if(error2) fprintf(stderr,"cxref: The preprocessor exited abnormally on '%s'\n",name); return(error1||error2); } /*+ The process id of the pre-processor. +*/ static pid_t popen_pid; /*++++++++++++++++++++++++++++++++++++++ A popen function that takes a list of arguments not a string. FILE* popen_execvp Returns a file descriptor. char** command The command arguments. ++++++++++++++++++++++++++++++++++++++*/ static FILE* popen_execvp(char** command) { int fdr[2]; if(pipe(fdr)==-1) {fprintf(stderr,"cxref: Can not pipe for the cpp command '%s'.\n",command[0]);exit(1);} if((popen_pid=fork())==-1) {fprintf(stderr,"cxref: Can not fork for the cpp command '%s.\n",command[0]);exit(1);} if(popen_pid) /* The parent */ { close(fdr[1]); } else /* The child */ { close(1); dup(fdr[1]); close(fdr[1]); close(fdr[0]); execvp(command[0],command); fprintf(stderr,"cxref: Can not execvp for the cpp command '%s', is it on the path?\n",command[0]); exit(1); } return(fdopen(fdr[0],"r")); } /*++++++++++++++++++++++++++++++++++++++ Close the file to the to the preprocessor int pclose_execvp Return the error status. FILE* f The file to close. ++++++++++++++++++++++++++++++++++++++*/ static int pclose_execvp(FILE* f) { int status,ret; waitpid(popen_pid,&status,0); fclose(f); if(WIFEXITED(status)) ret=WEXITSTATUS(status); else ret=-1; return(ret); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/cxref.css.in������������������������������������������������������������������������� 644 � 233 � 144 � 3561 11506061166 11027� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*------------------------------------------------*/ /* */ /* Cxref Version 1.6 - Style Sheet */ /* */ /* Using CSS2 - (Cascading Style Sheets, level 2) */ /* */ /*------------------------------------------------*/ /*-------------------------*/ /* Generic HTML formatting */ /*-------------------------*/ /*--------------------------------*/ /* Cxref specific HTML formatting */ /*--------------------------------*/ /* File definitions */ SPAN.cxref-file-comment { font-style: normal; } /* Include files */ SPAN.cxref-include-comment { font-style: normal; } UL.cxref-include { padding: 0; margin: 0; margin-left: 2em; } /* Local include files */ LI.cxref-include-local { list-style-type: none; list-style-position: inside; } SPAN.cxref-include-local { font-family: monospace; font-style: normal; } /* System include files */ LI.cxref-include-system { list-style-type: none; list-style-position: inside; } SPAN.cxref-include-system { font-family: monospace; font-style: italic; } /* Pre-processor definitions */ SPAN.cxref-define-comment { font-style: normal; } SPAN.cxref-define { font-family: monospace; font-style: normal; } /* Type definitions */ SPAN.cxref-type-comment { font-style: normal; } SPAN.cxref-type { font-family: monospace; font-style: normal; } /* Variable definitions */ SPAN.cxref-variable-comment { font-style: normal; } SPAN.cxref-variable { font-family: monospace; font-style: normal; } /* Function definitions */ SPAN.cxref-function-comment { font-style: normal; } SPAN.cxref-function { font-family: monospace; font-style: normal; } /* References */ SPAN.cxref-reference-local { font-style: normal; } SPAN.cxref-reference-system { font-style: italic; } �����������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/cxref.h������������������������������������������������������������������������������ 644 � 233 � 144 � 14335 11506061166 10102� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/cxref.h,v 1.30 1999-11-16 18:58:13 amb Exp $ C Cross Referencing & Documentation tool. Version 1.5c. Prototypes for general functions. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,98,99 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #ifndef CXREF_H #define CXREF_H /*+ To stop multiple inclusions. +*/ #include "datatype.h" /* Definitions for variable / function / file types */ #define LOCAL 1 /*+ Signifies a LOCAL function / variable / include file. +*/ #define GLOBAL 2 /*+ Signifies a GLOBAL fuction / variable / include file. +*/ #define EXTERNAL 4 /*+ Signifies an EXTERNAL variable. +*/ #define EXTERN_H 8 /*+ Signifies an EXTERNAL variable seen in a header file. +*/ #define EXTERN_F 16 /*+ Signifies an EXTERNAL variable seen in a function file. +*/ #define INLINED 32 /*+ Signifies an INLINED function. +*/ /* Definitions for -xref options */ #define XREF_FILE 1 /*+ Signifies that file cross references are required. +*/ #define XREF_FUNC 2 /*+ Signifies that function cross references are required. +*/ #define XREF_VAR 4 /*+ Signifies that variable cross references are required. +*/ #define XREF_TYPE 8 /*+ Signifies that type definition cross references are required. +*/ #define XREF_ALL 15 /*+ Signifies that all the above cross references are required. +*/ /* Definitions for -warn options */ #define WARN_COMMENT 1 /*+ Signifies that warnings for commetns are required. +*/ #define WARN_XREF 2 /*+ Signifies that warnings for cross references are required. +*/ #define WARN_ALL 3 /*+ Signifies that all of the above warnings are required. +*/ /* Definitions for -index options */ #define INDEX_FILE 1 /*+ Signifies that an index of files is needed. +*/ #define INDEX_FUNC 2 /*+ Signifies that an index of global functions is needed. +*/ #define INDEX_VAR 3 /*+ Signifies that an index of global variables is needed. +*/ #define INDEX_TYPE 4 /*+ Signifies that an index of type definitions is needed. +*/ #define INDEX_ALL 15 /*+ Signifies that a complete index of all of the above is needed. +*/ /* in cxref.c */ char *CanonicaliseName(char *name); /* In parse.l */ void ResetLexer(void); /* In parse.y */ void ResetParser(void); /* in file.c */ File NewFile(char* name); void DeleteFile(File file); void SeenFileComment(char* comment); /* in comment.c */ void SeenComment(char* c,int flag); char* GetCurrentComment(void); void SetCurrentComment(char* comment); char* SplitComment(char** original,char* name); void DeleteComment(void); /* in preproc.c */ void SeenInclude(char *name); void SeenIncludeComment(void); char *SeenFileChange(char *name,int flag); void SeenDefine(char* name); void SeenDefineComment(void); void SeenDefineValue(char* value); void SeenDefineFunctionArg(char* name); void SeenDefineFuncArgComment(void); void ResetPreProcAnalyser(void); void DeleteIncludeType(Include inc); void DeleteDefineType(Define inc); /* in type.c */ void SeenTypedefName(char* name,int what_type); int IsATypeName(char* name); void SeenTypedef(char* name,char* type); void SeenStructUnionStart(char* name); void SeenStructUnionComp(char* name,int depth); void SeenStructUnionEnd(void); void ResetTypeAnalyser(void); void DeleteTypedefType(Typedef type); /* in var.c */ void SeenVariableDefinition(char* name,char* type,int scope); void UpScope(void); void DownScope(void); void SeenScopeVariable(char* name); int IsAScopeVariable(char* name); void ResetVariableAnalyser(void); void DeleteVariableType(Variable var); /* in func.c */ void SeenFunctionProto(char* name,int in_a_function); void SeenFunctionDeclaration(char* name,int scope); void SeenFunctionDefinition(char* type); void SeenFunctionArg(char* name,char* type); void SeenFunctionCall(char* name); void CheckFunctionVariableRef(char* name,int in_a_function); int SeenFuncIntComment(char* comment); void ResetFunctionAnalyser(void); void DeleteFunctionType(Function func); /* In slist.c */ StringList NewStringList(void); void AddToStringList(StringList sl,char* str,int alphalist,int uniqlist); void DeleteStringList(StringList sl); StringList2 NewStringList2(void); void AddToStringList2(StringList2 sl,char* str1,char* str2,int alphalist,int uniqlist); void DeleteStringList2(StringList2 sl); /* In xref.c */ void CrossReference(File file,int outputs); void CreateAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types); void CrossReferenceDelete(char *name); /* In warn-raw.c */ void WriteWarnRawFile(File file); void WriteWarnRawAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types); int CopyOrSkip(char *string,char *type,int *copy,int *skip); /* In latex.c */ void WriteLatexFile(File file); void WriteLatexAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types); void WriteLatexFileDelete(char *name); /* In html.c */ void WriteHTMLFile(File file); void WriteHTMLAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types); void WriteHTMLFileDelete(char *name); /* In rtf.c */ void WriteRTFFile(File file); void WriteRTFAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types); void WriteRTFFileDelete(char *name); /* In sgml.c */ void WriteSGMLFile(File file); void WriteSGMLAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types); void WriteSGMLFileDelete(char *name); /* Not defined on Suns */ #if defined(__sun__) && !defined(__svr4__) #include <stdio.h> int fputs(const char *s, FILE *stream); int fprintf(FILE*, const char*,...); int pclose( FILE *stream); int fscanf( FILE *stream, const char *format, ...); int fclose(FILE*); int rename(const char *oldpath, const char *newpath); int printf(const char*,...); int fwrite(const void*,unsigned int,unsigned int, FILE*); int fread(void*,unsigned int,unsigned int, FILE*); int isatty(int desc); int fflush( FILE *stream); #endif /* Suns */ #endif /* CXREF_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/cxref.sty.in������������������������������������������������������������������������� 644 � 233 � 144 � 4536 11506061166 11061� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% % cxref.sty - Copyright 1996 Andrew M. Bishop % % New commands that are defined to use in typesetting cxref. % \typeout{Cxref Style-sheet -- By A. M. Bishop. (Custom commands)} % Stop LaTeX from printing all of the annoying error messages about under/over-full boxes. \tolerance=10000 \hbadness=10000 \emergencystretch=100pt % Set the section number depth to 3. \setcounter{secnumdepth}{3} % Set the table of contents number depth to 3. \setcounter{tocdepth}{3} % Set the parindent and table column separator to zero. \setlength{\parindent}{0in} \setlength{\tabcolsep}{0in} % Define a command to display the 'computer format' text, a small teletype font. \newcommand{\stt}{\small\tt} % The command argument list and items to use in it. \newenvironment{cxrefarglist}{\begin{list}{}{\leftmargin=2.25in \labelsep=0in \labelwidth=2.25in \itemsep=0pt \parsep=3pt \topsep=3pt}}{\end{list}} \newcommand{\cxrefargitem}[1]{\item[\parbox{2.25in}{$\cdot$\hspace*{0.1in}{\stt #1}}]} % A table with one wide column and a cross reference (Include files). \newenvironment{cxreftabi}{\begin{tabular}{{p{5.0in}l}}}{\end{tabular}} % A table with a narrow column, a wide column and a cross reference (Included in). \newenvironment{cxreftabii}{\begin{tabular}{{p{0.75in}p{4.25in}l}}}{\end{tabular}} % A table with two approximately equal columns (2nd is wider) and a cross reference (Struct / Union). \newenvironment{cxreftabiia}{\begin{tabular}{{p{2.5in}p{3.5in}}}}{\end{tabular}} % A table with two exactly equal columns and a cross reference (Appendix). \newenvironment{cxreftabiib}{\begin{tabular}{{p{2.5in}p{2.5in}l}}}{\end{tabular}} % A table with a narrow column, two approximately equal columns and a cross reference (Used in, Calls, Called etc.). \newenvironment{cxreftabiii}{\begin{tabular}{{p{0.75in}p{2.25in}p{2.0in}l}}}{\end{tabular}} \newcommand{\cxreftabiiispan}[1]{\multicolumn{2}{p{4.25in}}{#1}} % Break the above tables by stopping the current table and starting a new one. \newcommand{\cxreftabbreak}[1]{\end{#1}\vskip 0pt\begin{#1}} % Cross references for Files, Functions, Variables and Typedefs. \newcommand{\cxreffile}[1]{{\small\it (Section \ref{file_#1})\/}} \newcommand{\cxreffunc}[2]{{\small\it (Section \ref{func_#1_#2})\/}} \newcommand{\cxrefvar}[2]{{\small\it (Section \ref{var_#1_#2})\/}} \newcommand{\cxreftype}[2]{{\small\it (Section \ref{type_#1_#2})\/}} ������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/datatype.h��������������������������������������������������������������������������� 644 � 233 � 144 � 21373 11506061166 10606� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/datatype.h,v 1.14 1999-01-24 16:53:48 amb Exp $ C Cross Referencing & Documentation tool. Version 1.5. Definition of the different variables types that are used. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,99 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #ifndef DATA_TYPE_H #define DATA_TYPE_H /*+ To stop multiple inclusions. +*/ /*+ A pointer type to file information. +*/ typedef struct _File *File; /*+ A pointer type to #include information. +*/ typedef struct _Include *Include; /*+ A pointer type to #define information. +*/ typedef struct _Define *Define; /*+ A pointer type to typedef information. +*/ typedef struct _Typedef *Typedef; /*+ A pointer type to variable information. +*/ typedef struct _Variable *Variable; /*+ A pointer type to function information. +*/ typedef struct _Function *Function; /*+ A pointer type to struct and union information. +*/ typedef struct _StructUnion *StructUnion; /*+ A data structure to contain lists of strings, eg functions that are called. +*/ typedef struct _StringList { int n; /*+ The number of strings in the list. +*/ char** s; /*+ The strings. +*/ } *StringList; /*+ A data structure to contain two lists of strings, eg arguments and comments. +*/ typedef struct _StringList2 { int n; /*+ The number of strings in the list. +*/ char** s1; /*+ The first set of strings. +*/ char** s2; /*+ The second set of strings. +*/ } *StringList2; /*+ A data structure to contain a complete file worth of information. +*/ struct _File { char* comment; /*+ The file comment. +*/ char* name; /*+ The name of the file. +*/ Include includes; /*+ A linked list of include files. +*/ Define defines; /*+ A linked list of #defines. +*/ Typedef typedefs; /*+ A linked list of type definitions. +*/ Variable variables; /*+ A linked list of variable definitions. +*/ Function functions; /*+ A linked list of function prototypes. +*/ StringList inc_in; /*+ The files that this file is included in. +*/ StringList2 f_refs; /*+ The functions that are referenced. +*/ StringList2 v_refs; /*+ The variables that are referenced. +*/ }; /*+ A data structure to contain information about a #include. +*/ struct _Include { char* comment; /*+ The comment for the include file. +*/ char* name; /*+ The name of the included file. +*/ int scope; /*+ The type of file, LOCAL or GLOBAL. +*/ Include includes; /*+ The files that are include by this file. +*/ Include next; /*+ A pointer to the next item. +*/ }; /*+ A data structure to contain information about a #define. +*/ struct _Define { char* comment; /*+ The comment for the #define. +*/ char* name; /*+ The name that is defined. +*/ char* value; /*+ The value that is defined (if simple). +*/ StringList2 args; /*+ The arguments to the #define function. +*/ int lineno; /*+ The line number that this definition appears on. +*/ Define next; /*+ A pointer to the next item. +*/ }; /*+ A data structure to contain the information for a typedef. +*/ struct _Typedef { char* comment; /*+ The comment for the type definition. +*/ char* name; /*+ The name of the defined type. +*/ char* type; /*+ The type of the definition. +*/ StructUnion sutype; /*+ The type of the definition if it is a locally declared struct / union. +*/ Typedef typexref; /*+ The type of the definition if it is not locally declared or a repeat definition. +*/ int lineno; /*+ The line number that this type definition appears on. +*/ Typedef next; /*+ A pointer to the next item. +*/ }; /*+ A data structure to contain the information for a variable. +*/ struct _Variable { char* comment; /*+ The comment for the variable. +*/ char* name; /*+ The name of the variable. +*/ char* type; /*+ The type of the variable. +*/ int scope; /*+ The scope of the variable, STATIC, GLOBAL or EXTERNAL +*/ char* defined; /*+ The name of the file that the variable is defined in as global if extern here. +*/ char* incfrom; /*+ The name of the file that the variable is included from if any. +*/ StringList2 visible; /*+ The names of the files that the variable is visible in. +*/ StringList2 used; /*+ The names of the files that the variable is used in. +*/ int lineno; /*+ The line number that this variable definition appears on. +*/ Variable next; /*+ A pointer to the next item. +*/ }; /*+ A data structure to contain information for a function definition. +*/ struct _Function { char* comment; /*+ The comment for the function. +*/ char* name; /*+ The name of the function. +*/ char* type; /*+ The return type of the function. +*/ char* cret; /*+ A comment for the returned value. +*/ char* protofile; /*+ The name of the file where the function is prototyped +*/ char* incfrom; /*+ The name of the file that the function is included from if any. +*/ StringList2 args; /*+ The arguments to the function. +*/ int scope; /*+ The scope of the function, LOCAL or GLOBAL. +*/ StringList protos; /*+ The functions that are prototyped within this function. +*/ StringList2 calls; /*+ The functions that are called from this function. +*/ StringList2 called; /*+ The names of the functions that call this one. +*/ StringList2 used; /*+ The places that the function is used, (references not direct calls). +*/ StringList2 v_refs; /*+ The variables that are referenced from this function. +*/ StringList2 f_refs; /*+ The functions that are referenced from this function. +*/ int lineno; /*+ The line number that this function definition appears on. +*/ Function next; /*+ A pointer to the next item. +*/ }; /*+ A data structure to contain a structure definition to allow structures to be matched to their typedefs (if any). +*/ struct _StructUnion { char* comment; /*+ The comment for the struct or union or simple component. +*/ char* name; /*+ The name of the struct or union or simple component. +*/ int n_comp; /*+ The number of sub-components (if none then it is simple). +*/ StructUnion* comps; /*+ The sub-components. +*/ }; /*++++++++++++++++++++++++++++++++++++++ A function to add a pointer to the end of a linked list. dst The destination, where the pointer is to be added to. type The type of the pointer. src The pointer that is to be added to the end of the linked list. ++++++++++++++++++++++++++++++++++++++*/ #define AddToLinkedList(dst,type,src) { \ if(dst) \ { \ type temp=dst; \ while(temp && temp->next) \ temp=temp->next; \ temp->next=src; \ } \ else \ dst=src; \ } #endif /* DATA_TYPE_H */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/file.c������������������������������������������������������������������������������� 644 � 233 � 144 � 5676 11506061166 7675� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/file.c,v 1.10 1997-05-17 15:06:01 amb Exp $ C Cross Referencing & Documentation tool. Version 1.4. Sets up the top level File structure. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /*+ To control the debugging in this file. +*/ #define DEBUG 0 #include <stdlib.h> #include <stdio.h> #include <string.h> #include "memory.h" #include "datatype.h" #include "cxref.h" /*+ This contains the File that is currently being documented to allow the other functions access to it. +*/ extern File CurFile; /*++++++++++++++++++++++++++++++++++++++ Creates a new File structure. File NewFile Returns the new file structure. char* name The name of the file. ++++++++++++++++++++++++++++++++++++++*/ File NewFile(char* name) { File file=(File)Calloc(1,sizeof(struct _File)); file->name=MallocString(name); file->inc_in=NewStringList(); file->f_refs=NewStringList2(); file->v_refs=NewStringList2(); return(file); } /*++++++++++++++++++++++++++++++++++++++ Called when a file comment has been seen. Only the first of multiple comments in a file are used. char* comment The comment for the file. ++++++++++++++++++++++++++++++++++++++*/ void SeenFileComment(char* comment) { if(!CurFile->comment) CurFile->comment=MallocString(comment); } /*++++++++++++++++++++++++++++++++++++++ Deletes a file structure. File file The file structure to be deleted. This is required to go through each of the elements in the File structure and delete each of them in turn. ++++++++++++++++++++++++++++++++++++++*/ void DeleteFile(File file) { if(file->comment) Free(file->comment); if(file->name) Free(file->name); if(file->inc_in) DeleteStringList(file->inc_in); if(file->f_refs) DeleteStringList2(file->f_refs); if(file->v_refs) DeleteStringList2(file->v_refs); if(file->includes) { Include p=file->includes; do{ Include n=p->next; DeleteIncludeType(p); p=n; } while(p); } if(file->defines) { Define p=file->defines; do{ Define n=p->next; DeleteDefineType(p); p=n; } while(p); } if(file->typedefs) { Typedef p=file->typedefs; do{ Typedef n=p->next; DeleteTypedefType(p); p=n; } while(p); } if(file->variables) { Variable p=file->variables; do{ Variable n=p->next; DeleteVariableType(p); p=n; } while(p); } if(file->functions) { Function p=file->functions; do{ Function n=p->next; DeleteFunctionType(p); p=n; } while(p); } Free(file); } ������������������������������������������������������������������cxref-1.6d/src/fonts.sty.in������������������������������������������������������������������������� 644 � 233 � 144 � 11266 11506061166 11121� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% % fonts.sty - A modified version of 10pt.sty from the standard LaTeX 2.0.9 distribution. % Original author / copyright unknown. % % Fonts for cxref, smaller than usual to get more on a page (cxref *is* rather verbose). % \typeout{Fonts Style-sheet -- By A. M. Bishop. (smaller than default)} \lineskip 1pt \normallineskip 1pt \def\baselinestretch{1} \def\@normalsize{\@setsize\normalsize{10pt}\xpt\@xpt \abovedisplayskip 10pt plus2pt minus5pt\belowdisplayskip \abovedisplayskip \abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6pt plus3pt minus3pt\let\@listi\@listI} \def\small{\@setsize\small{9pt}\ixpt\@ixpt \abovedisplayskip 8.5pt plus 3pt minus 4pt\belowdisplayskip \abovedisplayskip \abovedisplayshortskip \z@ plus2pt\belowdisplayshortskip 4pt plus2pt minus 2pt \def\@listi{\leftmargin\leftmargini \topsep 4pt plus 2pt minus 2pt\parsep 2pt plus 1pt minus 1pt \itemsep \parsep}} \def\footnotesize{\@setsize\footnotesize{8pt}\viiipt\@viiipt \abovedisplayskip 6pt plus 2pt minus 4pt\belowdisplayskip \abovedisplayskip \abovedisplayshortskip \z@ plus 1pt\belowdisplayshortskip 3pt plus 1pt minus 2pt \def\@listi{\leftmargin\leftmargini \topsep 3pt plus 1pt minus 1pt\parsep 2pt plus 1pt minus 1pt \itemsep \parsep}} \def\scriptsize{\@setsize\scriptsize{6pt}\viipt\@viipt} \def\tiny{\@setsize\tiny{5pt}\vpt\@vpt} \def\large{\@setsize\large{12pt}\xiipt\@xiipt} \def\Large{\@setsize\Large{14pt}\xivpt\@xivpt} \def\LARGE{\@setsize\LARGE{17pt}\xviipt\@xviipt} \def\huge{\@setsize\huge{20pt}\xxpt\@xxpt} \def\Huge{\@setsize\Huge{25pt}\xxvpt\@xxvpt} \normalsize \if@twoside \oddsidemargin 44pt \evensidemargin 82pt \marginparwidth 107pt \else \oddsidemargin 63pt \evensidemargin 63pt \marginparwidth 90pt \fi \marginparsep 11pt \topmargin 27pt \headheight 12pt \headsep 25pt \footskip 30pt \textheight = 43\baselineskip \advance\textheight by \topskip \textwidth 345pt \columnsep 10pt \columnseprule 0pt \footnotesep 6.65pt \skip\footins 9pt plus 4pt minus 2pt \floatsep 12pt plus 2pt minus 2pt \textfloatsep 20pt plus 2pt minus 4pt \intextsep 12pt plus 2pt minus 2pt \dblfloatsep 12pt plus 2pt minus 2pt \dbltextfloatsep 20pt plus 2pt minus 4pt \@fptop 0pt plus 1fil \@fpsep 8pt plus 2fil \@fpbot 0pt plus 1fil \@dblfptop 0pt plus 1fil \@dblfpsep 8pt plus 2fil \@dblfpbot 0pt plus 1fil \marginparpush 5pt \parskip 0pt plus 1pt \parindent 15pt \partopsep 2pt plus 1pt minus 1pt \@lowpenalty 51 \@medpenalty 151 \@highpenalty 301 \@beginparpenalty -\@lowpenalty \@endparpenalty -\@lowpenalty \@itempenalty -\@lowpenalty \def\part{\par \addvspace{4ex} \@afterindentfalse \secdef\@part\@spart} \def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne \refstepcounter{part} \addcontentsline{toc}{part}{\thepart \hspace{1em}#1}\else \addcontentsline{toc}{part}{#1}\fi { \parindent 0pt \raggedright \ifnum \c@secnumdepth >\m@ne \Large \bf Part \thepart \par \nobreak \fi \huge \bf #2\markboth{}{}\par } \nobreak \vskip 3ex \@afterheading } \def\@spart#1{{\parindent 0pt \raggedright \huge \bf #1\par} \nobreak \vskip 3ex \@afterheading } \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus .2ex}{\Large\bf}} \def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus -.2ex}{1.5ex plus .2ex}{\large\bf}} \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}} \def\paragraph{\@startsection {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}} \def\subparagraph{\@startsection {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}} \setcounter{secnumdepth}{3} \def\appendix{\par \setcounter{section}{0} \setcounter{subsection}{0} \def\thesection{\Alph{section}}} \leftmargini 25pt \leftmarginii 22pt \leftmarginiii 18.7pt \leftmarginiv 17pt \leftmarginv 10pt \leftmarginvi 10pt \leftmargin\leftmargini \labelsep 5pt \labelwidth\leftmargini\advance\labelwidth-\labelsep \def\@listI{\leftmargin\leftmargini \parsep 4pt plus 2pt minus 1pt\topsep 8pt plus 2pt minus 4pt\itemsep 4pt plus 2pt minus 1pt} \let\@listi\@listI \@listi \def\@listii{\leftmargin\leftmarginii \labelwidth\leftmarginii\advance\labelwidth-\labelsep \topsep 4pt plus 2pt minus 1pt \parsep 2pt plus 1pt minus 1pt \itemsep \parsep} \def\@listiii{\leftmargin\leftmarginiii \labelwidth\leftmarginiii\advance\labelwidth-\labelsep \topsep 2pt plus 1pt minus 1pt \parsep \z@ \partopsep 1pt plus 0pt minus 1pt \itemsep \topsep} \def\@listiv{\leftmargin\leftmarginiv \labelwidth\leftmarginiv\advance\labelwidth-\labelsep} \def\@listv{\leftmargin\leftmarginv \labelwidth\leftmarginv\advance\labelwidth-\labelsep} \def\@listvi{\leftmargin\leftmarginvi \labelwidth\leftmarginvi\advance\labelwidth-\labelsep} ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/func.c������������������������������������������������������������������������������� 644 � 233 � 144 � 25120 11506061166 7713� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/func.c,v 1.20 2003-12-02 19:51:08 amb Exp $ C Cross Referencing & Documentation tool. Version 1.5f. Handle Function stuff. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,99,2001 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /*+ Control the debugging information from this file. +*/ #define DEBUG 0 #include <stdlib.h> #include <stdio.h> #include <string.h> #include "memory.h" #include "datatype.h" #include "parse-yy.h" #include "cxref.h" /*+ The current parsing options. +*/ extern int option_xref; /*+ The current file that is being processed. +*/ extern File CurFile; /*+ When in a header file include functions from that file (except inline functions). +*/ extern int in_header; /*+ The current function, this is initialised by the start of a possible declaration and maintained until all of the arguments have been added and confirmation that it is a definition and not a prototype is seen. +*/ static Function cur_func=NULL; /*+ The list of function prototypes and the files that they are defined in. +*/ static StringList2 prototypes=NULL; static Function NewFunctionType(char *name,char *type); /*++++++++++++++++++++++++++++++++++++++ Function that is called when a function prototype is seen. char* name The name of the function. int in_a_function Whether the reference is from within a function or at the top level of the file. ++++++++++++++++++++++++++++++++++++++*/ void SeenFunctionProto(char* name,int in_a_function) { if(!(option_xref&XREF_FUNC)) return; #if DEBUG printf("#Func.c# Function prototype '%s'\n",name); #endif if(!in_a_function) { if(!prototypes) prototypes=NewStringList2(); AddToStringList2(prototypes,name,parse_file,0,1); } else AddToStringList(cur_func->protos,name,0,1); } /*++++++++++++++++++++++++++++++++++++++ Function that is called when a function declaration is seen. This may or may not be a function defintion, we will need to wait and see. char* name The name of the function. int scope The scope of the function definition. ++++++++++++++++++++++++++++++++++++++*/ void SeenFunctionDeclaration(char* name,int scope) { #if DEBUG printf("#Func.c# Function declaration for '%s()'\n",name); #endif if(cur_func) DeleteFunctionType(cur_func); cur_func=NewFunctionType(name,NULL); cur_func->comment=MallocString(GetCurrentComment()); cur_func->scope=scope; cur_func->lineno=parse_line; if(in_header) cur_func->incfrom=MallocString(parse_file); } /*++++++++++++++++++++++++++++++++++++++ Called when a possible function definition is confirmed. char* type The type of the function, or NULL at the end of a definition. ++++++++++++++++++++++++++++++++++++++*/ void SeenFunctionDefinition(char* type) { Function *func=&CurFile->functions; int i; if(cur_func->scope&INLINED && cur_func->incfrom) return; #if DEBUG printf("#Func.c# Function definition %s for '%s()'\n",type?"start":"end",cur_func->name); #endif if(!type) {cur_func=NULL;return;} cur_func->type=MallocString(type); cur_func->cret=MallocString(SplitComment(&cur_func->comment,type)); if(!cur_func->cret) cur_func->cret=MallocString(GetCurrentComment()); if(option_xref&XREF_FUNC) if(prototypes) for(i=0;i<prototypes->n;i++) if(!strcmp(cur_func->name,prototypes->s1[i])) {cur_func->protofile=MallocString(prototypes->s2[i]); break;} for(i=0;i<cur_func->args->n;i++) if(strcmp(cur_func->args->s1[i],"void") && strcmp(cur_func->args->s1[i],"...") && !strchr(cur_func->args->s1[i],' ')) { char *old=cur_func->args->s1[i]; cur_func->args->s1[i]=MallocString(ConcatStrings(2,"int ",old)); cur_func->args->s2[i]=MallocString(SplitComment(&cur_func->comment,cur_func->args->s1[i])); Free(old); } while(*func) { if(strcmp(cur_func->name,(*func)->name)<0) { Function temp=*func; *func=cur_func; cur_func->next=temp; break; } func=&(*func)->next; } if(!cur_func->next) *func=cur_func; } /*++++++++++++++++++++++++++++++++++++++ Function that is called when a function argument is seen in the current function declaration. char* name The name of the argument. char* type The type of the argument, or NULL if a traditional style function definition. ++++++++++++++++++++++++++++++++++++++*/ void SeenFunctionArg(char* name,char *type) { #if DEBUG printf("#Func.c# Function arg %s '%s' in %s()\n",name?name:"K&R",type?type:"K&R",cur_func->name); #endif if(name) { if(type && strcmp(type,"void")) { int i; for(i=0;i<cur_func->args->n;i++) if(!strcmp(cur_func->args->s1[i],name)) { Free(cur_func->args->s1[i]); cur_func->args->s1[i]=MallocString(type); cur_func->args->s2[i]=MallocString(SplitComment(&cur_func->comment,type)); break; } if(i==cur_func->args->n) AddToStringList2(cur_func->args,type,SplitComment(&cur_func->comment,type),0,0); if(!cur_func->args->s2[i]) cur_func->args->s2[i]=MallocString(GetCurrentComment()); } else AddToStringList2(cur_func->args,name,NULL,0,0); } } /*++++++++++++++++++++++++++++++++++++++ Function that is called when a comment is seen, that may be in a function body. int SeenFuncIntComment Returns a true value if the comment was accepted as an function internal comment. char* comment The comment that has been seen. ++++++++++++++++++++++++++++++++++++++*/ int SeenFuncIntComment(char* comment) { if(!cur_func || !cur_func->type) return(0); #if DEBUG printf("#Func.c# Function internal comment '%s' in %s()\n",comment,cur_func->name); #endif if(cur_func->comment) { char* c=cur_func->comment; cur_func->comment=MallocString(ConcatStrings(3,c,"\n\n",comment)); Free(c); } else cur_func->comment=MallocString(comment); return(1); } /*++++++++++++++++++++++++++++++++++++++ Function that is called when a function call is seen in the current function. char* name The name of the function that is called. ++++++++++++++++++++++++++++++++++++++*/ void SeenFunctionCall(char* name) { if(!(option_xref&XREF_FUNC)) return; #if DEBUG printf("#Func.c# Function call for '%s()' in %s()\n",name,cur_func->name); #endif AddToStringList2(cur_func->calls,name,NULL,1,1); } /*++++++++++++++++++++++++++++++++++++++ Function that is called when a function or variable is referenced in the current function. char* name The name of the function or variable that is referenced. int in_a_function Whether the reference is from within a function or at the top level of the file. ++++++++++++++++++++++++++++++++++++++*/ void CheckFunctionVariableRef(char* name,int in_a_function) { Variable var =CurFile->variables; Function func=CurFile->functions; StringList2 sl=NULL; if(!(option_xref&(XREF_VAR|XREF_FUNC))) return; if(IsAScopeVariable(name)) return; #if DEBUG printf("#Func.c# Function/Variable reference for '%s' in %s\n",name,in_a_function?cur_func->name:CurFile->name); #endif if(option_xref&XREF_VAR) while(var) { if(!strcmp(var->name,name)) { if(in_a_function) sl=cur_func->v_refs; else sl=CurFile->v_refs; break; } var=var->next; } if(!sl && option_xref&XREF_FUNC) while(func) { if(!strcmp(func->name,name)) { if(in_a_function) sl=cur_func->f_refs; else sl=CurFile->f_refs; break; } func=func->next; } if(!sl && option_xref&XREF_FUNC) { int i; if(in_a_function) for(i=0;i<cur_func->protos->n;i++) if(!strcmp(name,cur_func->protos->s[i])) { sl=cur_func->f_refs; break; } if(!sl && prototypes) for(i=0;i<prototypes->n;i++) if(!strcmp(name,prototypes->s1[i])) { if(in_a_function) sl=cur_func->f_refs; else sl=CurFile->f_refs; break; } } /* Now add the function or variable to the Function / File structure. */ if(sl) AddToStringList2(sl,name,NULL,1,1); } /*++++++++++++++++++++++++++++++++++++++ Tidy up all of the local variables in case of a problem and abnormal parser termination. ++++++++++++++++++++++++++++++++++++++*/ void ResetFunctionAnalyser(void) { if(prototypes) DeleteStringList2(prototypes); prototypes=NULL; if(cur_func) { Function func=CurFile->functions; int delete_cur_func=1; while(func) { if(func==cur_func) delete_cur_func=0; func=func->next; } if(delete_cur_func) DeleteFunctionType(cur_func); cur_func=NULL; } } /*++++++++++++++++++++++++++++++++++++++ Create a new Function Type variable. Function NewFunctionType Returns the new Function variable. char *name The name of the function. char *type The type of the function. ++++++++++++++++++++++++++++++++++++++*/ static Function NewFunctionType(char *name,char *type) { Function func=(Function)Calloc(1,sizeof(struct _Function)); /* clear unused pointers */ func->name =MallocString(name); func->type =MallocString(type); func->args =NewStringList2(); func->protos=NewStringList(); func->calls =NewStringList2(); func->called=NewStringList2(); func->used =NewStringList2(); func->v_refs=NewStringList2(); func->f_refs=NewStringList2(); return(func); } /*++++++++++++++++++++++++++++++++++++++ Delete the specified Function type. Function func The Function type to be deleted. ++++++++++++++++++++++++++++++++++++++*/ void DeleteFunctionType(Function func) { if(func->comment) Free(func->comment); if(func->name) Free(func->name); if(func->type) Free(func->type); if(func->cret) Free(func->cret); if(func->protofile) Free(func->protofile); if(func->incfrom) Free(func->incfrom); if(func->args) DeleteStringList2(func->args); if(func->protos) DeleteStringList(func->protos); if(func->calls) DeleteStringList2(func->calls); if(func->called) DeleteStringList2(func->called); if(func->used) DeleteStringList2(func->used); if(func->v_refs) DeleteStringList2(func->v_refs); if(func->f_refs) DeleteStringList2(func->f_refs); Free(func); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/html.c������������������������������������������������������������������������������� 644 � 233 � 144 � 130455 11506061166 7754� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/html.c,v 1.46 2004-11-19 19:35:47 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6a. Writes the HTML output. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,98,99,2001,02,04 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include "version.h" #include "memory.h" #include "datatype.h" #include "cxref.h" /*+ The file extension to use for the output files. +*/ #define HTML_FILE ".html" #define HTML_FILE_BACKUP ".html~" /*+ The file extension to use for the output source files. +*/ #define HTML_SRC_FILE ".src.html" /*+ The name of the output tex file that contains the appendix. +*/ #define HTML_APDX ".apdx" /*+ The comments are to be inserted verbatim. +*/ extern int option_verbatim_comments; /*+ The type of HTML output to produce. +*/ extern int option_html; /*+ The name of the directory for the output. +*/ extern char* option_odir; /*+ The base name of the file for the output. +*/ extern char* option_name; /*+ The information about the cxref run, +*/ extern char *run_command, /*+ the command line options. +*/ *run_cpp_command; /*+ the cpp command and options. +*/ /*+ The directories to go back to get to the base output directory. +*/ static char* goback=NULL; /*+ The built-in style sheet. +*/ extern char *html_cxref_style; /* Local functions */ static void WriteHTMLFilePart(File file); static void WriteHTMLInclude(Include inc); static void WriteHTMLSubInclude(Include inc,int depth); static void WriteHTMLDefine(Define def); static void WriteHTMLTypedef(Typedef type); static void WriteHTMLStructUnion(StructUnion su,int depth); static void WriteHTMLVariable(Variable var); static void WriteHTMLFunction(Function func); static void WriteHTMLDocument(char* name,int appendix); static void WriteHTMLPreamble(FILE* f,char* title,int sourcefile); static void WriteHTMLPostamble(FILE* f,int sourcefile); void WriteHTMLSource(char *name); static char* html(char* c,int verbatim); /*+ The output file for the HTML. +*/ static FILE* of; /*+ The name of the file. +*/ static char *filename; /*++++++++++++++++++++++++++++++++++++++ Write an html file for a complete File structure and all components. File file The File structure to output. ++++++++++++++++++++++++++++++++++++++*/ void WriteHTMLFile(File file) { char* ofile; int i; filename=file->name; /* Write the including file. */ goback=""; WriteHTMLDocument(file->name,0); /* Open the file */ ofile=ConcatStrings(4,option_odir,"/",file->name,HTML_FILE); of=fopen(ofile,"w"); if(!of) { struct stat stat_buf; int i,ofl=strlen(ofile); for(i=strlen(option_odir)+1;i<ofl;i++) if(ofile[i]=='/') { ofile[i]=0; if(stat(ofile,&stat_buf)) mkdir(ofile,S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); ofile[i]='/'; } of=fopen(ofile,"w"); } if(!of) {fprintf(stderr,"cxref: Failed to open the HTML output file '%s'\n",ofile);exit(1);} for(goback="",i=strlen(file->name);i>0;i--) if(file->name[i]=='/') goback=ConcatStrings(2,goback,"../"); /* Write out a header. */ WriteHTMLPreamble(of,ConcatStrings(5,"Cross reference for ",file->name," of ",option_name,"."),0); /*+ The file structure is broken into its components and they are each written out. +*/ WriteHTMLFilePart(file); if(file->includes) { Include inc =file->includes; fprintf(of,"\n<hr>\n<h2>Included Files</h2>\n\n"); do{ WriteHTMLInclude(inc); } while((inc=inc->next)); } if(file->defines) { Define def =file->defines; fprintf(of,"\n<hr>\n<h2>Preprocessor definitions</h2>\n\n"); do{ if(def!=file->defines) fprintf(of,"<p>\n"); WriteHTMLDefine(def); } while((def=def->next)); } if(file->typedefs) { Typedef type=file->typedefs; do{ WriteHTMLTypedef(type); } while((type=type->next)); } if(file->variables) { int any_to_mention=0; Variable var=file->variables; do{ if(var->scope&(GLOBAL|LOCAL|EXTERNAL|EXTERN_F)) any_to_mention=1; } while((var=var->next)); if(any_to_mention) { int first_ext=1,first_local=1; Variable var=file->variables; do{ if(var->scope&GLOBAL) WriteHTMLVariable(var); } while((var=var->next)); var=file->variables; do{ if(var->scope&(EXTERNAL|EXTERN_F) && !(var->scope&GLOBAL)) { if(first_ext) {fprintf(of,"\n<hr>\n<h2>External Variables</h2>\n\n"); first_ext=0;} else fprintf(of,"<p>\n"); WriteHTMLVariable(var); } } while((var=var->next)); var=file->variables; do{ if(var->scope&LOCAL) { if(first_local) {fprintf(of,"\n<hr>\n<h2>Local Variables</h2>\n\n"); first_local=0;} else fprintf(of,"<p>\n"); WriteHTMLVariable(var); } } while((var=var->next)); } } if(file->functions) { Function func=file->functions; do{ if(func->scope&(GLOBAL|EXTERNAL)) WriteHTMLFunction(func); } while((func=func->next)); func=file->functions; do{ if(func->scope&LOCAL) WriteHTMLFunction(func); } while((func=func->next)); } WriteHTMLPostamble(of,0); fclose(of); /* Write out the source file. */ if(option_html&16) WriteHTMLSource(file->name); /* Clear the memory in html() */ html(NULL,0); html(NULL,0); html(NULL,0); html(NULL,0); } /*++++++++++++++++++++++++++++++++++++++ Write a File structure out. File file The File to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLFilePart(File file) { int i; if(option_html&16) fprintf(of,"<h1><a name=\"file\" href=\"%s%s%s\">File %s</a></h1>\n",goback,file->name,HTML_SRC_FILE,html(file->name,0)); else fprintf(of,"<h1><a name=\"file\">File %s</a></h1>\n",html(file->name,0)); if(file->comment) { if(option_verbatim_comments) fprintf(of,"<pre>\n%s\n</pre>\n\n",html(file->comment,0)); else { char *rcs1=strstr(file->comment,"$Header"),*rcs2=NULL; if(rcs1) { rcs2=strstr(&rcs1[1],"$"); if(rcs2) { rcs2[0]=0; fprintf(of,"<b>RCS %s</b>\n<p>\n",html(&rcs1[1],0)); rcs2[0]='$'; } } if(rcs2) fprintf(of,"<span class=\"cxref-file-comment\">%s</span>\n<p>\n",html(&rcs2[2],0)); else fprintf(of,"<span class=\"cxref-file-comment\">%s</span>\n<p>\n",html(file->comment,0)); } } if(file->inc_in->n) { int i; fprintf(of,"<table>\n"); for(i=0;i<file->inc_in->n;i++) { fprintf(of," <tr>\n"); if(i==0) fprintf(of," <td>Included in:\n"); else fprintf(of," <td> \n"); fprintf(of," <td><a href=\"%s%s"HTML_FILE"#file\">%s</a>\n",goback,file->inc_in->s[i],html(file->inc_in->s[i],0)); fprintf(of," </tr>\n"); } fprintf(of,"</table>\n"); } if(file->f_refs->n || file->v_refs->n) fprintf(of,"<table>\n"); if(file->f_refs->n) { int others=0; fprintf(of," <tr>\n"); fprintf(of," <td>References Functions:\n"); for(i=0;i<file->f_refs->n;i++) if(file->f_refs->s2[i]) { if(i!=others) { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } fprintf(of," <td><a href=\"%s%s"HTML_FILE"#func-%s\">%s()</a>\n",goback,file->f_refs->s2[i],file->f_refs->s1[i],html(file->f_refs->s1[i],0)); fprintf(of," <td><a href=\"%s%s"HTML_FILE"#func-%s\">%s</a>\n",goback,file->f_refs->s2[i],file->f_refs->s1[i],html(file->f_refs->s2[i],0)); fprintf(of," </tr>\n"); } else others++; if(others) { if(i==others) fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); else { fprintf(of," </tr>\n"); fprintf(of," <tr>\n"); fprintf(of," <td> \n"); fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); } for(i=0;i<file->f_refs->n;i++) if(!file->f_refs->s2[i]) fprintf(of,--others?" %s(),":" %s()",html(file->f_refs->s1[i],0)); fprintf(of,"</span>\n"); fprintf(of," </tr>\n"); } } if(file->v_refs->n) { int others=0; fprintf(of," <tr>\n"); fprintf(of," <td>References Variables:\n"); for(i=0;i<file->v_refs->n;i++) if(file->v_refs->s2[i]) { if(i!=others) { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } fprintf(of," <td><a href=\"%s%s"HTML_FILE"#var-%s\">%s</a>\n",goback,file->v_refs->s2[i],file->v_refs->s1[i],html(file->v_refs->s1[i],0)); fprintf(of," <td><a href=\"%s%s"HTML_FILE"#var-%s\">%s</a>\n",goback,file->v_refs->s2[i],file->v_refs->s1[i],html(file->v_refs->s2[i],0)); fprintf(of," </tr>\n"); } else others++; if(others) { if(i==others) fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); else { fprintf(of," </tr>\n"); fprintf(of," <tr>\n"); fprintf(of," <td> \n"); fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); } for(i=0;i<file->v_refs->n;i++) if(!file->v_refs->s2[i]) fprintf(of,--others?" %s,":" %s",html(file->v_refs->s1[i],0)); fprintf(of,"</span>\n"); fprintf(of," </tr>\n"); } } if(file->f_refs->n || file->v_refs->n) fprintf(of,"</table>\n"); } /*++++++++++++++++++++++++++++++++++++++ Write an Include structure out. Include inc The Include structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLInclude(Include inc) { if(inc->comment) fprintf(of,"<span class=\"cxref-include-comment\">%s</span>\n<p>\n",html(inc->comment,0)); fprintf(of,"<ul class=\"cxref-include\">\n"); if(inc->scope==LOCAL) fprintf(of," <li class=\"cxref-include-local\"><tt><span class=\"cxref-include-local\"><a href=\"%s%s"HTML_FILE"#file\">#include \"%s\"</a></span></tt>\n",goback,inc->name,html(inc->name,0)); else fprintf(of," <li class=\"cxref-include-system\"><tt><span class=\"cxref-include-system\">#include <%s></span></tt>\n",html(inc->name,0)); if(inc->includes) WriteHTMLSubInclude(inc->includes,1); fprintf(of,"</ul>\n"); } /*++++++++++++++++++++++++++++++++++++++ Write an Sub Include structure out. (An include structure that is included from another file.) Include inc The Include structure to output. int depth The depth of the include hierarchy. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLSubInclude(Include inc,int depth) { int i; for(i=0;i<depth;i++) fprintf(of," "); fprintf(of,"<ul class=\"cxref-include\">\n"); while(inc) { for(i=0;i<depth;i++) fprintf(of," "); if(inc->scope==LOCAL) fprintf(of," <li class=\"cxref-include-local\"><tt><span class=\"cxref-include-local\"><a href=\"%s%s"HTML_FILE"#file\">#include \"%s\"</a></span></tt>\n",goback,inc->name,html(inc->name,0)); else fprintf(of," <li class=\"cxref-include-system\"><tt><span class=\"cxref-include-system\">#include <%s></span></tt>\n",html(inc->name,0)); if(inc->includes) WriteHTMLSubInclude(inc->includes,depth+1); inc=inc->next; } for(i=0;i<depth;i++) fprintf(of," "); fprintf(of,"</ul>\n"); } /*++++++++++++++++++++++++++++++++++++++ Write a Define structure out. Define def The Define structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLDefine(Define def) { int i; int pargs=0; if(def->comment) fprintf(of,"<span class=\"cxref-define-comment\">%s</span>\n<p>\n",html(def->comment,0)); if(option_html&16) fprintf(of,"<tt><span class=\"cxref-define\"><a href=\"%s%s%s#line%d\">#define %s</a>",goback,filename,HTML_SRC_FILE,def->lineno,html(def->name,0)); else fprintf(of,"<tt><span class=\"cxref-define\">#define %s",html(def->name,0)); if(def->value) fprintf(of," %s",html(def->value,0)); if(def->args->n) { fprintf(of,"( "); for(i=0;i<def->args->n;i++) fprintf(of,i?", %s":"%s",html(def->args->s1[i],0)); fprintf(of," )"); } fprintf(of,"</span></tt><br>\n"); for(i=0;i<def->args->n;i++) if(def->args->s2[i]) pargs=1; if(pargs) { fprintf(of,"<dl compact>\n"); for(i=0;i<def->args->n;i++) { fprintf(of," <dt><tt><span class=\"cxref-define\">%s</span></tt>\n",html(def->args->s1[i],0)); fprintf(of," <dd><span class=\"cxref-define-comment\">%s</span>\n",def->args->s2[i]?html(def->args->s2[i],0):""); } fprintf(of,"</dl>\n"); } } /*++++++++++++++++++++++++++++++++++++++ Write a Typedef structure out. Typedef type The Typedef structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLTypedef(Typedef type) { fprintf(of,"\n<hr>\n<h2>"); if(!strncmp("enum",type->name,4)) fprintf(of,"<a name=\"type-enum-%s\">",&type->name[5]); else if(!strncmp("union",type->name,5)) fprintf(of,"<a name=\"type-union-%s\">",&type->name[6]); else if(!strncmp("struct",type->name,6)) fprintf(of,"<a name=\"type-struct-%s\">",&type->name[7]); else fprintf(of,"<a name=\"type-%s\">",type->name); if(type->type) fprintf(of,"Typedef %s",html(type->name,0)); else fprintf(of,"Type %s",html(type->name,0)); fprintf(of,"</a></h2>\n"); if(type->comment) fprintf(of,"<span class=\"cxref-type-comment\">%s</span>\n<p>\n",html(type->comment,0)); if(type->type) { if(option_html&16) fprintf(of,"<tt><span class=\"cxref-type\"><a href=\"%s%s%s#line%d\">typedef %s</a></span></tt><br>\n",goback,filename,HTML_SRC_FILE,type->lineno,html(type->type,0)); else fprintf(of,"<tt><span class=\"cxref-type\">typedef %s</span></tt><br>\n",html(type->type,0)); } else if(type->sutype) { if(option_html&16) fprintf(of,"<tt><span class=\"cxref-type\"><a href=\"%s%s%s#line%d\">%s</a></span></tt><br>\n",goback,filename,HTML_SRC_FILE,type->lineno,html(type->sutype->name,0)); else fprintf(of,"<tt><span class=\"cxref-type\">%s</span></tt><br>\n",html(type->sutype->name,0)); } if(type->sutype) { fprintf(of,"<table>\n"); WriteHTMLStructUnion(type->sutype,0); fprintf(of,"</table>\n"); } else if(type->typexref) { fprintf(of,"<table>\n"); fprintf(of," <tr>\n"); fprintf(of," <td>See:\n"); if(type->typexref->type) fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"#type-%s\">Typedef %s</a></span>\n",type->typexref->name,html(type->typexref->name,0)); else if(!strncmp("enum",type->typexref->name,4)) fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"#type-enum-%s\">Type %s</a></span>\n",&type->typexref->name[5],html(type->typexref->name,0)); else if(!strncmp("union",type->typexref->name,5)) fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"#type-union-%s\">Type %s</a></span>\n",&type->typexref->name[6],html(type->typexref->name,0)); else if(!strncmp("struct",type->typexref->name,6)) fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"#type-struct-%s\">Type %s</a></span>\n",&type->typexref->name[7],html(type->typexref->name,0)); fprintf(of," </tr>\n"); fprintf(of,"</table>\n"); } } /*++++++++++++++++++++++++++++++++++++++ Write a structure / union structure out. StructUnion su The structure / union to write. int depth The current depth within the structure. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLStructUnion(StructUnion su, int depth) { int i; char* splitsu=NULL; splitsu=strstr(su->name,"{...}"); if(splitsu) splitsu[-1]=0; fprintf(of," <tr>\n"); fprintf(of," <td>"); for(i=0;i<depth;i++) fprintf(of,"     \n"); if(!depth || su->comps) fprintf(of,"<tt><span class=\"cxref-type\">%s</span></tt>\n",html(su->name,0)); else fprintf(of,"<tt><span class=\"cxref-type\">%s;</span></tt>\n",html(su->name,0)); fprintf(of," <td>"); if(depth && su->comment && !su->comps) fprintf(of,"<span class=\"cxref-type-comment\">%s</span>\n",html(su->comment,0)); else fprintf(of," \n"); fprintf(of," </tr>\n"); if(!depth || su->comps) { fprintf(of," <tr>\n"); fprintf(of," <td>"); for(i=0;i<depth;i++) fprintf(of,"     "); fprintf(of,"   <tt><span class=\"cxref-type\">{</span></tt>\n"); fprintf(of," <td> \n"); fprintf(of," </tr>\n"); for(i=0;i<su->n_comp;i++) WriteHTMLStructUnion(su->comps[i],depth+1); fprintf(of," <tr>\n"); fprintf(of," <td>"); for(i=0;i<depth;i++) fprintf(of,"     "); fprintf(of,"   <tt><span class=\"cxref-type\">}</span></tt>\n"); fprintf(of," <td> \n"); fprintf(of," </tr>\n"); if(splitsu) { fprintf(of," <tr>\n"); fprintf(of," <td>"); for(i=0;i<depth;i++) fprintf(of,"     "); fprintf(of,"<tt><span class=\"cxref-type\">%s;</span></tt>\n",splitsu[5]?html(&splitsu[6],0):""); if(depth && su->comment) fprintf(of," <td><span class=\"cxref-type-comment\">%s</span>\n",html(su->comment,0)); else fprintf(of," <td> \n"); fprintf(of," </tr>\n"); } } if(splitsu) splitsu[-1]=' '; } /*++++++++++++++++++++++++++++++++++++++ Write a Variable structure out. Variable var The Variable structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLVariable(Variable var) { int i; if(var->scope&GLOBAL) fprintf(of,"\n<hr>\n<h2><a name=\"var-%s\">Global Variable %s</a></h2>\n",var->name,html(var->name,0)); else fprintf(of,"<b><a name=\"var-%s\">%s</a></b><br>\n",var->name,html(var->name,0)); if(var->comment) fprintf(of,"<span class=\"cxref-variable-comment\">%s</span>\n<p>\n",html(var->comment,0)); if(option_html&16 && var->scope&(GLOBAL|LOCAL)) { if(var->incfrom) fprintf(of,"<tt><span class=\"cxref-variable\"><a href=\"%s%s%s#line%d\">",goback,var->incfrom,HTML_SRC_FILE,var->lineno); else fprintf(of,"<tt><span class=\"cxref-variable\"><a href=\"%s%s%s#line%d\">",goback,filename,HTML_SRC_FILE,var->lineno); } else fprintf(of,"<tt><span class=\"cxref-variable\">"); if(var->scope&LOCAL) fprintf(of,"static "); else if(!(var->scope&GLOBAL) && var->scope&(EXTERNAL|EXTERN_F)) fprintf(of,"extern "); fprintf(of,"%s",html(var->type,0)); if(option_html&16 && var->scope&(GLOBAL|LOCAL)) fprintf(of,"</a></span></tt><br>\n"); else fprintf(of,"</span></tt><br>\n"); if(var->scope&(GLOBAL|LOCAL)) { if(var->incfrom || var->visible->n || var->used->n) fprintf(of,"<table>\n"); if(var->incfrom) { fprintf(of," <tr>\n"); fprintf(of," <td>Included from\n"); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#var-%s\">%s</a></span>\n",goback,var->incfrom,var->name,html(var->incfrom,0)); fprintf(of," </tr>\n"); } if(var->visible->n) { for(i=0;i<var->visible->n;i++) { if(i==0) { fprintf(of," <tr>\n"); fprintf(of," <td>Visible in:\n"); } else { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } if(var->visible->s1[i][0]=='$' && !var->visible->s1[i][1]) { fprintf(of," <td> \n"); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#file\">%s</a></span>\n",goback,var->visible->s2[i],html(var->visible->s2[i],0)); } else { fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s()</a></span>\n",goback,var->visible->s2[i],var->visible->s1[i],html(var->visible->s1[i],0)); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s</a></span>\n",goback,var->visible->s2[i],var->visible->s1[i],html(var->visible->s2[i],0)); } fprintf(of," </tr>\n"); } } if(var->used->n) { for(i=0;i<var->used->n;i++) { if(i==0) { fprintf(of," <tr>\n"); fprintf(of," <td>Used in:\n"); } else { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } if(var->used->s1[i][0]=='$' && !var->used->s1[i][1]) fprintf(of," <td>  <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#file\">%s</a></span>\n",goback,var->used->s2[i],html(var->used->s2[i],0)); else { if(var->scope&LOCAL) { fprintf(of," <td><a href=\"#func-%s\">%s()</a>\n",var->used->s1[i],html(var->used->s1[i],0)); fprintf(of," <td> \n"); } else { fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s()</a></span>\n",goback,var->used->s2[i],var->used->s1[i],html(var->used->s1[i],0)); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s</a></span>\n",goback,var->used->s2[i],var->used->s1[i],html(var->used->s2[i],0)); } } fprintf(of," </tr>\n"); } } if(var->incfrom || var->visible->n || var->used->n) fprintf(of,"</table>\n"); } else if(var->scope&(EXTERNAL|EXTERN_F) && var->defined) { fprintf(of,"<table>\n"); fprintf(of," <tr>\n"); fprintf(of," <td>Defined in:\n"); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#var-%s\">%s</a></span>\n",goback,var->defined,html(var->name,0),var->defined); fprintf(of," </tr>\n"); fprintf(of,"</table>\n"); } } /*++++++++++++++++++++++++++++++++++++++ Write a Function structure out. Function func The Function structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLFunction(Function func) { int i,pret,pargs; char* comment2=NULL,*type; if(func->scope&(GLOBAL|EXTERNAL)) fprintf(of,"\n<hr>\n<h2><a name=\"func-%s\">Global Function %s()</a></h2>\n",func->name,html(func->name,0)); else fprintf(of,"\n<hr>\n<h2><a name=\"func-%s\">Local Function %s()</a></h2>\n",func->name,html(func->name,0)); if(func->comment) { if(option_verbatim_comments) fprintf(of,"<pre>\n%s\n</pre>\n\n",html(func->comment,0)); else { comment2=strstr(func->comment,"\n\n"); if(comment2) comment2[0]=0; fprintf(of,"<span class=\"cxref-function-comment\">%s</span>\n<p>\n",html(func->comment,0)); } } if(option_html&16) { if(func->incfrom) fprintf(of,"<tt><span class=\"cxref-function\"><a href=\"%s%s%s#line%d\">",goback,func->incfrom,HTML_SRC_FILE,func->lineno); else fprintf(of,"<tt><span class=\"cxref-function\"><a href=\"%s%s%s#line%d\">",goback,filename,HTML_SRC_FILE,func->lineno); } else fprintf(of,"<tt><span class=\"cxref-function\">"); if(func->scope&LOCAL) fprintf(of,"static "); if(func->scope&INLINED) fprintf(of,"inline "); if((type=strstr(func->type,"()"))) type[0]=0; fprintf(of,"%s ( ",html(func->type,0)); for(i=0;i<func->args->n;i++) fprintf(of,i?", %s":"%s",html(func->args->s1[i],0)); if(type) {fprintf(of," %s",html(&type[1],0));type[0]='(';} else fprintf(of," )"); if(option_html&16) fprintf(of,"</a></span></tt><br>\n"); else fprintf(of,"</span></tt><br>\n"); pret =strncmp("void ",func->type,5) && func->cret; for(pargs=0,i=0;i<func->args->n;i++) pargs = pargs || ( strcmp("void",func->args->s1[i]) && func->args->s2[i] ); if(pret || pargs) { fprintf(of,"<dl compact>\n"); if(pret) { fprintf(of," <dt><tt><span class=\"cxref-function\">%s</span></tt>\n",html(func->type,0)); fprintf(of," <dd><span class=\"cxref-function-comment\">%s</span>\n",func->cret?html(func->cret,0):" "); } if(pargs) for(i=0;i<func->args->n;i++) { fprintf(of," <dt><tt><span class=\"cxref-function\">%s</span></tt>\n",html(func->args->s1[i],0)); fprintf(of," <dd><span class=\"cxref-function-comment\">%s</span>\n",func->args->s2[i]?html(func->args->s2[i],0):" "); } fprintf(of,"</dl>\n"); } if(comment2) { fprintf(of,"<span class=\"cxref-function-comment\">%s</span>\n<p>\n",html(&comment2[2],0)); comment2[0]='\n'; } if(func->protofile || func->incfrom || func->calls->n || func->called->n || func->used->n || func->f_refs->n || func->v_refs->n) fprintf(of,"<table>\n"); if(func->protofile) { fprintf(of," <tr>\n"); fprintf(of," <td>Prototyped in:\n"); fprintf(of," <td colspan=2><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#file\">%s</a></span>\n",goback,func->protofile,html(func->protofile,0)); fprintf(of," </tr>\n"); } if(func->incfrom) { fprintf(of," <tr>\n"); fprintf(of," <td>Included from:\n"); fprintf(of," <td colspan=2><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s</a></span>\n",goback,func->incfrom,func->name,html(func->incfrom,0)); fprintf(of," </tr>\n"); } if(func->calls->n) { int others=0; fprintf(of," <tr>\n"); fprintf(of," <td>Calls:\n"); for(i=0;i<func->calls->n;i++) if(func->calls->s2[i]) { if(i!=others) { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s()</a></span>\n",goback,func->calls->s2[i],func->calls->s1[i],html(func->calls->s1[i],0)); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s</a></span>\n",goback,func->calls->s2[i],func->calls->s1[i],html(func->calls->s2[i],0)); fprintf(of," </tr>\n"); } else others++; if(others) { if(i==others) fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); else { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); } for(i=0;i<func->calls->n;i++) if(!func->calls->s2[i]) fprintf(of,--others?"%s(), ":"%s()",html(func->calls->s1[i],0)); fprintf(of,"</span>\n"); fprintf(of," </tr>\n"); } } if(func->called->n) { fprintf(of," <tr>\n"); fprintf(of," <td>Called by:\n"); for(i=0;i<func->called->n;i++) { if(i!=0) { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s()</a></span>\n",goback,func->called->s2[i],func->called->s1[i],html(func->called->s1[i],0)); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s</a></span>\n",goback,func->called->s2[i],func->called->s1[i],html(func->called->s2[i],0)); fprintf(of," </tr>\n"); } } if(func->used->n) { fprintf(of," <tr>\n"); fprintf(of," <td>Used in:\n"); for(i=0;i<func->used->n;i++) { if(i!=0) { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } if(func->used->s1[i][0]=='$' && !func->used->s1[i][1]) { fprintf(of," <td> \n"); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#file\">%s</a></span>\n",goback,func->used->s2[i],html(func->used->s2[i],0)); } else { fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s()</a></span>\n",goback,func->used->s2[i],func->used->s1[i],html(func->used->s1[i],0)); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s</a></span>\n",goback,func->used->s2[i],func->used->s1[i],html(func->used->s2[i],0)); } fprintf(of," </tr>\n"); } } if(func->f_refs->n) { int others=0; fprintf(of," <tr>\n"); fprintf(of," <td>References Functions:\n"); for(i=0;i<func->f_refs->n;i++) if(func->f_refs->s2[i]) { if(i!=others) { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s()</a></span>\n",goback,func->f_refs->s2[i],func->f_refs->s1[i],html(func->f_refs->s1[i],0)); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#func-%s\">%s</a></span>\n",goback,func->f_refs->s2[i],func->f_refs->s1[i],html(func->f_refs->s2[i],0)); fprintf(of," </tr>\n"); } else others++; if(others) { if(i==others) fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); else { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); } for(i=0;i<func->f_refs->n;i++) if(!func->f_refs->s2[i]) fprintf(of,--others?"%s(), ":"%s()",html(func->f_refs->s1[i],0)); fprintf(of,"</span>\n"); fprintf(of," </tr>\n"); } } if(func->v_refs->n) { int others=0; fprintf(of," <tr>\n"); fprintf(of," <td>References Variables:\n"); for(i=0;i<func->v_refs->n;i++) if(func->v_refs->s2[i]) { if(i!=others) { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); } fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#var-%s\">%s</a></span>\n",goback,func->v_refs->s2[i],func->v_refs->s1[i],html(func->v_refs->s1[i],0)); fprintf(of," <td><span class=\"cxref-reference-local\"><a href=\"%s%s"HTML_FILE"#var-%s\">%s</a></span>\n",goback,func->v_refs->s2[i],func->v_refs->s1[i],html(func->v_refs->s2[i],0)); fprintf(of," </tr>\n"); } else others++; if(others) { if(i==others) fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); else { fprintf(of," <tr>\n"); fprintf(of," <td> \n"); fprintf(of," <td colspan=2><span class=\"cxref-reference-system\">"); } for(i=0;i<func->v_refs->n;i++) if(!func->v_refs->s2[i]) fprintf(of,--others?"%s, ":"%s",html(func->v_refs->s1[i],0)); fprintf(of,"</span>\n"); fprintf(of," </tr>\n"); } } if(func->protofile || func->incfrom || func->calls->n || func->called->n || func->used->n || func->f_refs->n || func->v_refs->n) fprintf(of,"</table>\n"); } /*++++++++++++++++++++++++++++++++++++++ Write out a file that will include the current information. char* name The name of the file. int appendix set to non-zero if the appendix file is to be added, else a normal source file. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLDocument(char* name,int appendix) { FILE *in,*out; char line[256]; int seen=0; char *inc_file,*ofile,*ifile; char *fname; struct stat stat_buf; if(appendix) inc_file=ConcatStrings(4,"<a href=\"",name,HTML_FILE,"\">Appendix</a><br>\n"); else inc_file=ConcatStrings(6,"<a href=\"",name,HTML_FILE,"#file\">",name,"</a><br>\n"); ifile=ConcatStrings(4,option_odir,"/",option_name,HTML_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,HTML_FILE_BACKUP); in=fopen(ifile,"r"); if(!in) { in =fopen(ifile,"w"); if(!in) {fprintf(stderr,"cxref: Failed to open the main HTML output file '%s'\n",ifile);exit(1);} WriteHTMLPreamble(in,ConcatStrings(3,"Cross Reference Of ",option_name,"."),1); WriteHTMLPostamble(in,1); fclose(in); in =fopen(ifile,"r"); } out=fopen(ofile,"w"); if(!out) {fprintf(stderr,"cxref: Failed to open the main HTML output file '%s'\n",ofile);exit(1);} while(fgets(line,256,in)) { if(!strcmp(inc_file,line) || (!strncmp("<!--",line,4) && !strncmp(inc_file,line+4,strlen(inc_file))) || (!strncmp("<!-- ",line,5) && !strncmp(inc_file,line+5,strlen(inc_file)))) {seen=1;break;} if(line[0]=='<' && !strcmp("<!-- End-Of-Source-Files -->\n",line)) { if(appendix) { fputs(line,out); fputs("\n",out); fputs("<!-- Appendix -->\n",out); fputs("\n",out); fputs("<hr>\n",out); fputs("<h1>Appendix</h1>\n",out); fputs("\n",out); fputs(inc_file,out); } else { fputs(inc_file,out); fputs("\n",out); fputs(line,out); } } else fputs(line,out); } fclose(in); fclose(out); if(!seen) { unlink(ifile); rename(ofile,ifile); } else unlink(ofile); /* Style file */ fname=ConcatStrings(2,option_odir,"/cxref.css"); if(stat(fname,&stat_buf)) { FILE* file=fopen(fname,"w"); if(!file) {fprintf(stderr,"cxref: Cannot write the HTML style file '%s'\n",fname);exit(1);} fputs(html_cxref_style,file); fclose(file); } } /*++++++++++++++++++++++++++++++++++++++ Write out a standard pre-amble. FILE* f The file to write the pre amble to. char* title The title of the file. int sourcefile True if the Source-Files line is to be included. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLPreamble(FILE* f,char* title,int sourcefile) { fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n",f); fputs("\n",f); fputs("<!-- This HTML file generated by cxref (version " CXREF_VERSION "). -->\n",f); fputs("<!-- cxref program " CXREF_COPYRIGHT ". -->\n",f); fputs("\n",f); if(!sourcefile) { fputs("<!--\n",f); if(filename) fprintf(f,"Cxref: %s %s\n",run_command,filename); else fprintf(f,"Cxref: %s\n",run_command); fprintf(f,"CPP : %s\n",run_cpp_command); fputs("-->\n",f); fputs("\n",f); } fputs("<HTML>\n",f); fputs("\n",f); fputs("<HEAD>\n",f); fprintf(f,"<TITLE>%s\n",title); fprintf(f,"\n",goback); fputs("\n",f); fputs("\n",f); fputs("\n",f); fputs("\n",f); if(sourcefile) { fputs("

    Source Files

    \n",f); fputs("\n",f); fputs("\n",f); } } /*++++++++++++++++++++++++++++++++++++++ Write out a standard post-amble. This includes the end of document marker. FILE* f The file to write the post amble to. int sourcefile True if the Source-Files line is to be included. ++++++++++++++++++++++++++++++++++++++*/ static void WriteHTMLPostamble(FILE* f,int sourcefile) { if(sourcefile) { fputs("\n",f); fputs("\n",f); } fputs("\n",f); fputs("\n",f); fputs("\n",f); } /*++++++++++++++++++++++++++++++++++++++ Write out the appendix information. StringList files The list of files to write. StringList2 funcs The list of functions to write. StringList2 vars The list of variables to write. StringList2 types The list of types to write. ++++++++++++++++++++++++++++++++++++++*/ void WriteHTMLAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types) { char* ofile; int i; filename=NULL; /* Write the bits to the including file. */ goback=""; WriteHTMLDocument(ConcatStrings(2,option_name,HTML_APDX),1); /* Open the file */ ofile=ConcatStrings(5,option_odir,"/",option_name,HTML_APDX,HTML_FILE); of=fopen(ofile,"w"); if(!of) {fprintf(stderr,"cxref: Failed to open the HTML appendix file '%s'\n",ofile);exit(1);} /* Write the file structure out */ WriteHTMLPreamble(of,ConcatStrings(3,"Cross reference index of ",option_name,"."),0); fprintf(of,"

    Cross References

    \n"); if(files->n || funcs->n || vars->n || types->n) { fprintf(of,"\n"); } /* Write out the appendix of files. */ if(files->n) { fprintf(of,"\n
    \n

    Files

    \n"); fprintf(of,"
      \n"); for(i=0;in;i++) fprintf(of,"
    • %s
    • \n",files->s[i],html(files->s[i],0)); fprintf(of,"
    \n"); } /* Write out the appendix of functions. */ if(funcs->n) { fprintf(of,"\n
    \n

    Global Functions

    \n"); fprintf(of,"
      \n"); for(i=0;in;i++) fprintf(of,"
    • %s() : %s
    • \n",funcs->s2[i],funcs->s1[i],html(funcs->s1[i],0),html(funcs->s2[i],0)); fprintf(of,"
    \n"); } /* Write out the appendix of variables. */ if(vars->n) { fprintf(of,"\n
    \n

    Global Variables

    \n"); fprintf(of,"
      \n"); for(i=0;in;i++) fprintf(of,"
    • %s : %s
    • \n",vars->s2[i],vars->s1[i],html(vars->s1[i],0),html(vars->s2[i],0)); fprintf(of,"
    \n"); } /* Write out the appendix of types. */ if(types->n) { fprintf(of,"\n
    \n

    Defined Types

    \n"); fprintf(of,"
      \n"); for(i=0;in;i++) if(!strncmp("enum",types->s1[i],4)) fprintf(of,"
    • %s : %s
    • \n",types->s2[i],&types->s1[i][5],html(types->s1[i],0),html(types->s2[i],0)); else if(!strncmp("union",types->s1[i],5)) fprintf(of,"
    • %s : %s
    • \n",types->s2[i],&types->s1[i][6],html(types->s1[i],0),html(types->s2[i],0)); else if(!strncmp("struct",types->s1[i],6)) fprintf(of,"
    • %s : %s
    • \n",types->s2[i],&types->s1[i][7],html(types->s1[i],0),html(types->s2[i],0)); else fprintf(of,"
    • %s : %s
    • \n",types->s2[i],types->s1[i],html(types->s1[i],0),html(types->s2[i],0)); fprintf(of,"
    \n"); } WriteHTMLPostamble(of,0); fclose(of); /* Clear the memory in html(,0) */ html(NULL,0); html(NULL,0); html(NULL,0); html(NULL,0); } /*++++++++++++++++++++++++++++++++++++++ Delete the HTML file and main file reference that belong to the named file. char *name The name of the file to delete. ++++++++++++++++++++++++++++++++++++++*/ void WriteHTMLFileDelete(char *name) { FILE *in,*out; char line[256]; int seen=0; char *inc_file,*ofile,*ifile; ofile=ConcatStrings(4,option_odir,"/",name,HTML_FILE); unlink(ofile); inc_file=ConcatStrings(6,"",name,"
    \n"); ifile=ConcatStrings(4,option_odir,"/",option_name,HTML_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,HTML_FILE_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(in && !out) {fprintf(stderr,"cxref: Failed to open the main HTML output file '%s'\n",ofile);fclose(in);} else if(in) { while(fgets(line,256,in)) { if(!strcmp(inc_file,line) || (!strncmp("\n",f); fputs("\n",f); fputs("\n",f); fputs("\n",f); fputs("\n",f); fputs("
    \n",f); fputs("\n",f); fputs("",f); fputs(title,f); fputs("\n",f); fputs("<author>cxref\n",f); fputs("\n",f); } /*++++++++++++++++++++++++++++++++++++++ Write out a standard post-amble. This includes the end of document marker. FILE* f The file to write the post amble to. ++++++++++++++++++++++++++++++++++++++*/ static void WriteSGMLPostamble(FILE* f) { fputs("\n",f); fputs("</article>\n",f); } /*++++++++++++++++++++++++++++++++++++++ Write out the appendix information. StringList files The list of files to write. StringList2 funcs The list of functions to write. StringList2 vars The list of variables to write. StringList2 types The list of types to write. ++++++++++++++++++++++++++++++++++++++*/ void WriteSGMLAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types) { char* ofile; int i; filename=NULL; /* Open the file */ ofile=ConcatStrings(5,option_odir,"/",option_name,SGML_APDX,SGML_FILE); of=fopen(ofile,"w"); if(!of) {fprintf(stderr,"cxref: Failed to open the SGML appendix file '%s'\n",ofile);exit(1);} /* Write the file structure out */ WriteSGMLPreamble(of,ConcatStrings(3,"Cross reference index of ",option_name,".")); fprintf(of,"<sect>Cross References\n"); /* Write out the appendix of files. */ if(files->n) { fprintf(of,"\n<sect1>Files\n\n<p>\n"); fprintf(of,"<itemize>\n"); for(i=0;i<files->n;i++) fprintf(of,"<item>%s>\n",sgml(files->s[i],0)); fprintf(of,"</itemize>\n"); } /* Write out the appendix of functions. */ if(funcs->n) { fprintf(of,"\n<sect1>Global Functions\n\n<p>\n"); fprintf(of,"<itemize>\n"); for(i=0;i<funcs->n;i++) fprintf(of,"<item>%s() : %s\n",sgml(funcs->s1[i],0),sgml(funcs->s2[i],0)); fprintf(of,"</itemize>\n"); } /* Write out the appendix of variables. */ if(vars->n) { fprintf(of,"\n<sect1>Global Variables\n\n<p>\n"); fprintf(of,"<itemize>\n"); for(i=0;i<vars->n;i++) fprintf(of,"<item>%s : %s\n",sgml(vars->s1[i],0),sgml(vars->s2[i],0)); fprintf(of,"</itemize>\n"); } /* Write out the appendix of types. */ if(types->n) { fprintf(of,"\n<sect1>Defined Types\n\n<p>\n"); fprintf(of,"<itemize>\n"); for(i=0;i<types->n;i++) if(!strncmp("enum",types->s1[i],4)) fprintf(of,"<item>%s : %s\n",sgml(types->s1[i],0),sgml(types->s2[i],0)); else if(!strncmp("union",types->s1[i],5)) fprintf(of,"<item>%s : %s\n",sgml(types->s1[i],0),sgml(types->s2[i],0)); else if(!strncmp("struct",types->s1[i],6)) fprintf(of,"<item>%s : %s\n",sgml(types->s1[i],0),sgml(types->s2[i],0)); else fprintf(of,"<item>%s : %s\n",sgml(types->s1[i],0),sgml(types->s2[i],0)); fprintf(of,"</itemize>\n"); } WriteSGMLPostamble(of); fclose(of); /* Clear the memory in sgml(,0) */ sgml(NULL,0); sgml(NULL,0); sgml(NULL,0); sgml(NULL,0); } /*++++++++++++++++++++++++++++++++++++++ Delete the SGML file and main file reference that belong to the named file. char *name The name of the file to delete. ++++++++++++++++++++++++++++++++++++++*/ void WriteSGMLFileDelete(char *name) { char *ofile; ofile=ConcatStrings(4,option_odir,"/",name,SGML_FILE); unlink(ofile); } /*++++++++++++++++++++++++++++++++++++++ Make the input string safe to output as SGML ( not <, >, &, ", $, #, % or ~ ). char* sgml Returns a safe SGML string. char* c A non-safe SGML string. int verbatim Set to true inside a verbatim environment. The function can only be called four times in each fprintf() since it returns one of only four static strings. ++++++++++++++++++++++++++++++++++++++*/ static char* sgml(char* c,int verbatim) { static char safe[4][256],*malloced[4]={NULL,NULL,NULL,NULL}; static int which=0; int copy=0,skip=0; int i=0,j=0,delta=10,len=256-delta; char* ret; which=(which+1)%4; ret=safe[which]; safe[which][0]=0; if(malloced[which]) {Free(malloced[which]);malloced[which]=NULL;} if(c) { i=CopyOrSkip(c,"sgml",©,&skip); while(1) { for(;j<len && c[i];i++) { if(copy) {ret[j++]=c[i]; if(c[i]=='\n') copy=0;} else if(skip) { if(c[i]=='\n') skip=0;} else if(verbatim) switch(c[i]) { case '&': strcpy(&ret[j],"&ero;");j+=5; break; case '<': if(c[i+1]=='/') {strcpy(&ret[j],"&etago;");j+=7; break;} default: ret[j++]=c[i]; } else switch(c[i]) { case '<': if(c[i+1]=='/') {strcpy(&ret[j],"&etago;");j+=7;} else {strcpy(&ret[j],"<");j+=4;} break; case '>': strcpy(&ret[j],">");j+=4; break; case '"': strcpy(&ret[j],""");j+=6; break; case '&': strcpy(&ret[j],"&");j+=5; break; case '$': strcpy(&ret[j],"$");j+=8; break; case '#': strcpy(&ret[j],"#");j+=5; break; case '%': strcpy(&ret[j],"%");j+=8; break; case '~': strcpy(&ret[j],"˜");j+=7; break; case '\n': if(j && ret[j-1]=='\n') { strcpy(&ret[j],"<newline>");j+=9; } ret[j++]=c[i]; break; default: ret[j++]=c[i]; } if(c[i]=='\n') i+=CopyOrSkip(c+i,"sgml",©,&skip); } if(c[i]) /* Not finished */ { if(malloced[which]) malloced[which]=Realloc(malloced[which],len+delta+256); else {malloced[which]=Malloc(len+delta+256); strncpy(malloced[which],ret,(unsigned)j);} ret=malloced[which]; len+=256; } else {ret[j]=0; break;} } } return(ret); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/slist.c������������������������������������������������������������������������������ 644 � 233 � 144 � 12606 11506061166 10123� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/slist.c,v 1.3 1997-05-11 15:23:11 amb Exp $ C Cross Referencing & Documentation tool. Version 1.4. Handle lists of strings. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /*+ Control the debugging information from this file. +*/ #define DEBUG 0 #include <stdlib.h> #include <stdio.h> #include <string.h> #include "memory.h" #include "datatype.h" #include "cxref.h" /*++++++++++++++++++++++++++++++++++++++ Called to initialise a new string list. StringList NewStringList Returns an initialised string list. ++++++++++++++++++++++++++++++++++++++*/ StringList NewStringList(void) { StringList sl=(StringList)Calloc(1,sizeof(struct _StringList)); #if DEBUG printf("#Slist.c# Initialise string list\n"); #endif return(sl); } /*++++++++++++++++++++++++++++++++++++++ Called to initialise a new string list 2. StringList2 NewStringList2 Returns an initialised string list 2. ++++++++++++++++++++++++++++++++++++++*/ StringList2 NewStringList2(void) { StringList2 sl=(StringList2)Calloc(1,sizeof(struct _StringList2)); #if DEBUG printf("#Slist.c# Initialise string list 2\n"); #endif return(sl); } /*++++++++++++++++++++++++++++++++++++++ Add a string to the string list, the list stores a Malloced copy of str. StringList sl The string list to add to. char* str The string to add. int alphalist If true then the list is sorted into alphabetical order. int uniqlist If true then duplicated entries are not allowed to be added. ++++++++++++++++++++++++++++++++++++++*/ void AddToStringList(StringList sl,char* str,int alphalist,int uniqlist) { int i; #if DEBUG printf("#Slist.c# Add string %s to the string list\n",str); #endif if(uniqlist) for(i=0;i<sl->n;i++) if(!strcmp(str,sl->s[i])) return; if(!sl->n) sl->s=(char**)Malloc(8*sizeof(char*)); else if(sl->n%8==0) sl->s=(char**)Realloc(sl->s,(sl->n+8)*sizeof(char*)); if(alphalist) { char *shuffle=NULL; for(i=0;i<sl->n;i++) if(shuffle) { char* temp=sl->s[i]; sl->s[i]=shuffle; shuffle=temp; } else if(strcmp(str,sl->s[i])<0) { shuffle=sl->s[i]; sl->s[i]=MallocString(str); } if(shuffle) sl->s[sl->n]=shuffle; else sl->s[sl->n]=MallocString(str); } else sl->s[sl->n]=MallocString(str); sl->n++; } /*++++++++++++++++++++++++++++++++++++++ Add a pair of strings to the string list 2, the list stores a Malloced copy of the arguments. StringList2 sl The string list 2 to add to. char* str1 The first string to add. char* str2 The second string to add. int alphalist If true then the list is sorted into alphabetical order of the first string, then second string. int uniqlist If true then duplicated entries of the first string are not allowed to be added. ++++++++++++++++++++++++++++++++++++++*/ void AddToStringList2(StringList2 sl,char* str1,char* str2,int alphalist,int uniqlist) { int i; #if DEBUG printf("#Slist.c# Add strings %s and %s to the string list 2\n",str1,str2); #endif if(uniqlist) for(i=0;i<sl->n;i++) if(!strcmp(str1,sl->s1[i])) return; if(!sl->n) { sl->s1=(char**)Malloc(8*sizeof(char*)); sl->s2=(char**)Malloc(8*sizeof(char*)); } else if(sl->n%8==0) { sl->s1=(char**)Realloc(sl->s1,(sl->n+8)*sizeof(char*)); sl->s2=(char**)Realloc(sl->s2,(sl->n+8)*sizeof(char*)); } if(alphalist) { char *shuffle1=NULL; char *shuffle2=NULL; for(i=0;i<sl->n;i++) if(shuffle1) { char* temp1=sl->s1[i]; char* temp2=sl->s2[i]; sl->s1[i]=shuffle1; sl->s2[i]=shuffle2; shuffle1=temp1; shuffle2=temp2; } else if(strcmp(str1,sl->s1[i])<0 || (str2 && sl->s2[i] && strcmp(str1,sl->s1[i])==0 && strcmp(str2,sl->s2[i])<0)) { shuffle1=sl->s1[i]; shuffle2=sl->s2[i]; sl->s1[i]=MallocString(str1); sl->s2[i]=MallocString(str2); } if(shuffle1) { sl->s1[sl->n]=shuffle1; sl->s2[sl->n]=shuffle2; } else { sl->s1[sl->n]=MallocString(str1); sl->s2[sl->n]=MallocString(str2); } } else { sl->s1[sl->n]=MallocString(str1); sl->s2[sl->n]=MallocString(str2); } sl->n++; } /*++++++++++++++++++++++++++++++++++++++ Delete a string list. StringList sl The string list to delete. ++++++++++++++++++++++++++++++++++++++*/ void DeleteStringList(StringList sl) { int i; for(i=0;i<sl->n;i++) Free(sl->s[i]); if(sl->s) Free(sl->s); Free(sl); } /*++++++++++++++++++++++++++++++++++++++ Delete a string list 2. StringList2 sl The string list 2 to delete. ++++++++++++++++++++++++++++++++++++++*/ void DeleteStringList2(StringList2 sl) { int i; for(i=0;i<sl->n;i++) { Free(sl->s1[i]); if(sl->s2[i]) Free(sl->s2[i]); } if(sl->s1) Free(sl->s1); if(sl->s2) Free(sl->s2); Free(sl); } ��������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/type.c������������������������������������������������������������������������������� 644 � 233 � 144 � 22641 11506061166 7746� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/type.c,v 1.18 2004-11-20 14:14:53 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6a. Collects the typedef stuff. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,99 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /*+ Control the output of debugging information in this file. +*/ #define DEBUG 0 #include <stdlib.h> #include <stdio.h> #include <string.h> #include "memory.h" #include "datatype.h" #include "parse-yy.h" #include "cxref.h" /*+ The file that is currently being processed. +*/ extern File CurFile; /*+ Whether we are parsing a typedef or not. +*/ extern int in_typedef; /*+ The defined types that we have seen. +*/ static StringList2 typedefs=NULL; /*+ The current struct / union or enum definition. +*/ static StructUnion cur_su=NULL; /*+ The current struct / union if seen in a typedef. +*/ static StructUnion cur_type_su=NULL; /*+ The last typedef seen, used when two types share a typedef statement. +*/ static Typedef last_typedef=NULL; /*+ The line number that a typedef or structure was seen on. +*/ static int type_lineno=0; static Typedef NewTypedefType(char *name,char *type); static StructUnion NewStructUnionType(char *name); static void DeleteStructUnionType(StructUnion su); static StructUnion CopyStructUnion(StructUnion su); /*++++++++++++++++++++++++++++++++++++++ Function that is called when a typedef is seen in the current file. The name of the typedef is stored for future reference. char* name The name of the defined type. int what_type Set to 1 for normal types or -1 for a function type (not pointer to function). ++++++++++++++++++++++++++++++++++++++*/ void SeenTypedefName(char* name,int what_type) { #if DEBUG printf("#Type.c# Type defined '%s'\n",name); #endif if(!typedefs) typedefs=NewStringList2(); AddToStringList2(typedefs,name,what_type==0?"\0":what_type>0?"n":"f",0,1); } /*++++++++++++++++++++++++++++++++++++++ Function that is called when an IDENTIFIER is seen in the current file, it may be a defined type. int IsATypeName Returns 1 if the argument is a type that has been defined. char* name The name of the possible defined type. ++++++++++++++++++++++++++++++++++++++*/ int IsATypeName(char* name) { int i; if(typedefs) for(i=0;i<typedefs->n;i++) if(!strcmp(name,typedefs->s1[i])) return((int)*typedefs->s2[i]); return(0); } /*++++++++++++++++++++++++++++++++++++++ Function that is called when the start of a struct or union or enum definition is seen. char* name The name of the struct type. ++++++++++++++++++++++++++++++++++++++*/ void SeenStructUnionStart(char* name) { #if DEBUG printf("#Type.c# Start Struct / Union '%s'\n",name); #endif if(cur_su) DeleteStructUnionType(cur_su); cur_su=NewStructUnionType(name); if(!in_typedef) cur_su->comment=MallocString(GetCurrentComment()); type_lineno=parse_line; } /*++++++++++++++++++++++++++++++++++++++ Function called when a component of a struct / union / enum is seen. char* name The name of the struct / union / enum component. int depth The depth within the nested struct / union / enum. ++++++++++++++++++++++++++++++++++++++*/ void SeenStructUnionComp(char* name,int depth) { StructUnion s,t=cur_su; int i; #if DEBUG printf("#Type.c# Struct / Union Component (%d) '%s'\n",depth,name); #endif for(i=1;i<depth;i++,t=s) s=t->comps[t->n_comp-1]; if(t->comps && strchr(name,'{')) { char* ob=strchr(name,'{'); char* cb=strchr(name,'}'),*nb; while((nb=strchr(cb+1,'}'))) cb=nb; ob[1]=0; if(strcmp(name,"enum {") && strcmp(name,"union {") && strcmp(name,"struct {")) { Typedef typdef=NewTypedefType(t->comps[t->n_comp-1]->name,NULL); typdef->comment=MallocString(GetCurrentComment()); t->comps[t->n_comp-1]->comment=MallocString(typdef->comment); typdef->sutype=CopyStructUnion(t->comps[t->n_comp-1]); AddToLinkedList(CurFile->typedefs,Typedef,typdef); } else t->comps[t->n_comp-1]->comment=MallocString(GetCurrentComment()); Free(t->comps[t->n_comp-1]->name); t->comps[t->n_comp-1]->name=MallocString(ConcatStrings(3,name,"...",cb)); } else { if(!t->comps) t->comps=(StructUnion*)Malloc(8*sizeof(StructUnion)); else if(t->n_comp%8==0) t->comps=(StructUnion*)Realloc(t->comps,(t->n_comp+8)*sizeof(StructUnion)); s=NewStructUnionType(name); s->comment=MallocString(GetCurrentComment()); t->comps[t->n_comp++]=s; } } /*++++++++++++++++++++++++++++++++++++++ Function that is called when the end of a struct or union or enum definition is seen. ++++++++++++++++++++++++++++++++++++++*/ void SeenStructUnionEnd(void) { #if DEBUG printf("#Type.c# End Struct / Union\n"); #endif if(in_typedef) cur_type_su=cur_su; else { Typedef xref=CurFile->typedefs; Typedef typdef=NewTypedefType(cur_su->name,NULL); while(xref) { if(xref->type && !strncmp(cur_su->name,xref->type,strlen(cur_su->name))) xref->typexref=typdef; xref=xref->next; } typdef->comment=cur_su->comment; cur_su->comment=NULL; typdef->sutype=cur_su; typdef->lineno=type_lineno; AddToLinkedList(CurFile->typedefs,Typedef,typdef); } cur_su=NULL; } /*++++++++++++++++++++++++++++++++++++++ Function that is called when a typedef is seen in the current file. This is recorded fully for later output. char* name The name of the defined type. char* type The type that it is defined to be. ++++++++++++++++++++++++++++++++++++++*/ void SeenTypedef(char* name,char* type) { Typedef typdef; if(!name) { last_typedef=NULL; type_lineno=parse_line; return; } #if DEBUG printf("#Type.c# Typedef '%s' '%s'\n",name,type); #endif typdef=NewTypedefType(name,type); typdef->comment=MallocString(GetCurrentComment()); if(!cur_type_su) { Typedef xref=CurFile->typedefs; typdef->sutype=NULL; typdef->typexref=NULL; while(xref) { if(!strncmp(xref->name,typdef->type,strlen(xref->name))) typdef->typexref=xref; xref=xref->next; } if(!typdef->typexref) typdef->typexref=last_typedef; } else { typdef->sutype=cur_type_su; cur_type_su=NULL; typdef->typexref=NULL; } typdef->lineno=type_lineno; if(!typdef->typexref) last_typedef=typdef; AddToLinkedList(CurFile->typedefs,Typedef,typdef); } /*++++++++++++++++++++++++++++++++++++++ Tidy up all of the local variables in case of a problem and abnormal parser termination. ++++++++++++++++++++++++++++++++++++++*/ void ResetTypeAnalyser(void) { if(typedefs) DeleteStringList2(typedefs); typedefs=NULL; if(cur_su) DeleteStructUnionType(cur_su); cur_su=NULL; cur_type_su=NULL; last_typedef=NULL; } /*++++++++++++++++++++++++++++++++++++++ Create a new Typedef type. Typedef NewTypedefType Returns the new type. char *name The name of the type. char *type The type of the type. ++++++++++++++++++++++++++++++++++++++*/ static Typedef NewTypedefType(char *name,char *type) { Typedef typed=(Typedef)Calloc(1,sizeof(struct _Typedef)); /* clear unused pointers */ typed->name=MallocString(name); typed->type=MallocString(type); return(typed); } /*++++++++++++++++++++++++++++++++++++++ Delete the specified Typedef type. Typedef type The Typedef type to be deleted. ++++++++++++++++++++++++++++++++++++++*/ void DeleteTypedefType(Typedef type) { if(type->comment) Free(type->comment); if(type->name) Free(type->name); if(type->type) Free(type->type); if(type->sutype) DeleteStructUnionType(type->sutype); Free(type); } /*++++++++++++++++++++++++++++++++++++++ Create a new struct / union type. StructUnion NewStructUnionType Return the new StructUnion type. char *name The name of the new struct / union. ++++++++++++++++++++++++++++++++++++++*/ static StructUnion NewStructUnionType(char *name) { StructUnion su=(StructUnion)Calloc(1,sizeof(struct _StructUnion)); su->name=MallocString(name); return(su); } /*++++++++++++++++++++++++++++++++++++++ Free the memory associated with a Struct / Union structure. StructUnion su The struct / union to delete. This needs to call itself recursively. ++++++++++++++++++++++++++++++++++++++*/ static void DeleteStructUnionType(StructUnion su) { int i; if(su->name) Free(su->name); if(su->comment) Free(su->comment); for(i=0;i<su->n_comp;i++) if(su->comps[i]) DeleteStructUnionType(su->comps[i]); if(su->comps) Free(su->comps); Free(su); } /*++++++++++++++++++++++++++++++++++++++ Make a copy of the specified Struct / Union structure. StructUnion CopyStructUnion Returns a malloced copy of the specified struct / union. StructUnion su The struct / union to copy. This needs to call itself recursively. ++++++++++++++++++++++++++++++++++++++*/ static StructUnion CopyStructUnion(StructUnion su) { StructUnion new; int i; new=NewStructUnionType(su->name); new->comment=MallocString(su->comment); new->n_comp=su->n_comp; if(su->n_comp) { new->comps=(StructUnion*)Malloc(su->n_comp*sizeof(StructUnion)); for(i=0;i<su->n_comp;i++) new->comps[i]=CopyStructUnion(su->comps[i]); } return(new); } �����������������������������������������������������������������������������������������������cxref-1.6d/src/var.c�������������������������������������������������������������������������������� 644 � 233 � 144 � 12630 11506061166 7552� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/var.c,v 1.14 2004-01-10 20:43:06 amb Exp $ C Cross Referencing & Documentation tool. Version 1.5f. Collects the variable definition stuff. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,99,2004 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /*+ Control the output of debugging information from this file. +*/ #define DEBUG 0 #include <stdlib.h> #include <stdio.h> #include <string.h> #include "memory.h" #include "datatype.h" #include "parse-yy.h" #include "cxref.h" /*+ The file that is currently being documented. +*/ extern File CurFile; /*+ When in a header file make a note of which one for the included variables. +*/ extern int in_header; /*+ A list of the variables found at each level of the scope. +*/ static StringList2 *variable; /*+ The number of levels of scope depth allocated. +*/ static int max_scope=0; /*+ The current scope depth. +*/ static int cur_scope=-1; static Variable NewVariableType(char *name,char *type); /*++++++++++++++++++++++++++++++++++++++ Function that is called when a variable definition is seen. char* name The name of the variable. char* type The type of the variable. int scope The scope of variable that has been seen. ++++++++++++++++++++++++++++++++++++++*/ void SeenVariableDefinition(char* name,char* type,int scope) { Variable var; int seen=0; #if DEBUG printf("#Var.c# Variable definition for '%s'\n",name); #endif for(var=CurFile->variables;var;var=var->next) if(!strcmp(var->name,name)) { var->scope|=scope; seen=1; if(!in_header && var->scope&EXTERN_H) { if(var->comment) Free(var->comment); var->comment=MallocString(GetCurrentComment()); var->lineno=parse_line; } break; } if(!seen) { var=NewVariableType(name,type); var->comment=MallocString(GetCurrentComment()); var->scope=scope; var->lineno=parse_line; if(in_header && !(scope&EXTERN_H)) var->incfrom=MallocString(parse_file); AddToLinkedList(CurFile->variables,Variable,var); } } /*++++++++++++++++++++++++++++++++++++++ Called when a new scope is entered. ++++++++++++++++++++++++++++++++++++++*/ void UpScope(void) { cur_scope++; #if DEBUG printf("#Var.c# Scope ++ (%2d)\n",cur_scope); #endif if(cur_scope>=max_scope) { if(max_scope==0) variable=Malloc(16*sizeof(StringList2)); else variable=Realloc(variable,(max_scope+16)*sizeof(StringList2)); max_scope+=16; } variable[cur_scope]=NewStringList2(); } /*++++++++++++++++++++++++++++++++++++++ Called when an old scope is exited. ++++++++++++++++++++++++++++++++++++++*/ void DownScope(void) { #if DEBUG printf("#Var.c# Scope -- (%2d)\n",cur_scope); #endif DeleteStringList2(variable[cur_scope]); cur_scope--; } /*++++++++++++++++++++++++++++++++++++++ Add a variable to the list of known variables. char* name The name of the variable. ++++++++++++++++++++++++++++++++++++++*/ void SeenScopeVariable(char* name) { #if DEBUG printf("#Var.c# Scope Variable depth %2d '%s'\n",cur_scope,name); #endif AddToStringList2(variable[cur_scope],name,NULL,0,0); } /*++++++++++++++++++++++++++++++++++++++ Check through the scope variables to look for the named one. int IsAScopeVariable Returns 1 if the name does refer to a variable that is scoped. char* name The name of the variable to search for. ++++++++++++++++++++++++++++++++++++++*/ int IsAScopeVariable(char* name) { int i,scope; #if DEBUG printf("#Var.c# Lookup variable '%s'\n",name); #endif for(scope=cur_scope;scope>=0;scope--) for(i=0;i<variable[scope]->n;i++) if(!strcmp(variable[scope]->s1[i],name)) return(1); return(0); } /*++++++++++++++++++++++++++++++++++++++ Tidy up all of the local variables in case of a problem and abnormal parser termination. ++++++++++++++++++++++++++++++++++++++*/ void ResetVariableAnalyser(void) { while(cur_scope>=0) { DeleteStringList2(variable[cur_scope]); cur_scope--; } if(variable) Free(variable); variable=NULL; max_scope=0; cur_scope=-1; } /*++++++++++++++++++++++++++++++++++++++ Create a new variable type. Variable NewVariableType Returns a new Variable type. char *name The name of the variable. char *type The type of the variable. ++++++++++++++++++++++++++++++++++++++*/ static Variable NewVariableType(char *name,char *type) { Variable var=(Variable)Calloc(1,sizeof(struct _Variable)); /* clear unused pointers */ var->name =MallocString(name); var->type =MallocString(type); var->visible=NewStringList2(); var->used =NewStringList2(); return(var); } /*++++++++++++++++++++++++++++++++++++++ Delete the specified Variable type. Variable var The Variable type to be deleted. ++++++++++++++++++++++++++++++++++++++*/ void DeleteVariableType(Variable var) { if(var->comment) Free(var->comment); if(var->name) Free(var->name); if(var->type) Free(var->type); if(var->defined) Free(var->defined); if(var->incfrom) Free(var->incfrom); if(var->visible) DeleteStringList2(var->visible); if(var->used) DeleteStringList2(var->used); Free(var); } ��������������������������������������������������������������������������������������������������������cxref-1.6d/src/version.h���������������������������������������������������������������������������� 644 � 233 � 144 � 1337 11642330012 10424� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/version.h,v 1.5 2010-05-31 08:42:12 amb Exp $ C Cross Referencing & Documentation tool. Version 1.6d. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 2005-2011 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #ifndef VERSION_H #define VERSION_H /*+ To stop multiple inclusions. +*/ #define CXREF_VERSION "1.6d" #define CXREF_COPYRIGHT "(c) Andrew M. Bishop 1995-2011" #endif /* VERSION_H */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cxref-1.6d/src/warn-raw.c��������������������������������������������������������������������������� 644 � 233 � 144 � 50757 11506061166 10534� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/warn-raw.c,v 1.31 2004-01-24 19:20:25 amb Exp $ C Cross Referencing & Documentation tool. Version 1.5f. Writes the raw information and / or warnings out. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,99,2001,04 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ #include <stdlib.h> #include <stdio.h> #include <string.h> #include "datatype.h" #include "cxref.h" #include "memory.h" static void WriteWarnRawFilePart(File file); static void WriteWarnRawInclude(Include inc); static void WriteWarnRawSubInclude(Include inc,int depth); static void WriteWarnRawDefine(Define def); static void WriteWarnRawTypedef(Typedef type); static void WriteWarnRawStructUnion(StructUnion su, int depth,StructUnion base); static void WriteWarnRawVariable(Variable var); static void WriteWarnRawFunction(Function func); /*+ Output option. +*/ extern int option_warn,option_raw,option_xref,option_index; /*+ The name of the current file. +*/ static char* filename=NULL; /*++++++++++++++++++++++++++++++++++++++ Write the raw / warning output for a complete File structure and all components. File file The File structure to output. ++++++++++++++++++++++++++++++++++++++*/ void WriteWarnRawFile(File file) { Include inc =file->includes; Define def =file->defines; Typedef type=file->typedefs; Variable var=file->variables; Function func=file->functions; filename=file->name; /*+ The file structure is broken into its components and they are each written out. +*/ if(option_raw) printf("----------------------------------------\n"); WriteWarnRawFilePart(file); while(inc) { WriteWarnRawInclude(inc); inc=inc->next; } while(def) { WriteWarnRawDefine(def); def=def->next; } while(type) { WriteWarnRawTypedef(type); type=type->next; } while(var) { WriteWarnRawVariable(var); var=var->next; } while(func) { WriteWarnRawFunction(func); func=func->next; } if(option_raw) printf("----------------------------------------\n\n"); } /*++++++++++++++++++++++++++++++++++++++ Write a File structure out. File file The File structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteWarnRawFilePart(File file) { int i; if(option_raw) printf("FILE : '%s'\n",file->name); if(file->comment && option_raw) printf("<<<\n%s\n>>>\n",file->comment); if(option_warn&WARN_COMMENT && !file->comment) printf("Warning %16s : File does not have a comment.\n",filename); if(option_xref&XREF_FILE) { if(option_raw) for(i=0;i<file->inc_in->n;i++) printf("Included in %s\n",file->inc_in->s[i]); if(option_warn&WARN_XREF) { int len=strlen(file->name)-2; if(!file->inc_in->n && !strcmp(&file->name[len],".h")) printf("Warning %16s : Header file '%s' is not included in any files.\n",filename,file->name); if( file->inc_in->n && !strcmp(&file->name[len],".c")) printf("Warning %16s : Source file '%s' is included in another file.\n",filename,file->name); } } if(option_xref&XREF_FUNC) for(i=0;i<file->f_refs->n;i++) { if(option_raw) { if(file->f_refs->s2[i]) printf("References Function %s : %s\n",file->f_refs->s1[i],file->f_refs->s2[i]); else printf("References Function %s\n",file->f_refs->s1[i]); } if(option_warn&WARN_XREF && !file->f_refs->s2[i]) printf("Warning %16s : File references function '%s()' whose definition is unknown.\n",filename,file->f_refs->s1[i]); } if(option_xref&XREF_VAR) for(i=0;i<file->v_refs->n;i++) { if(option_raw) { if(file->v_refs->s2[i]) printf("References Variable %s : %s\n",file->v_refs->s1[i],file->v_refs->s2[i]); else printf("References Variable %s\n",file->v_refs->s1[i]); } if(option_warn&WARN_XREF && !file->v_refs->s2[i]) printf("Warning %16s : File references variable '%s' whose definition is unknown.\n",filename,file->v_refs->s1[i]); } } /*++++++++++++++++++++++++++++++++++++++ Write an Include structure out. Include inc The Include structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteWarnRawInclude(Include inc) { if(option_raw) printf("\nINCLUDES : '%s' [%s file]\n",inc->name,(inc->scope==GLOBAL?"System":"Local")); if(inc->comment && option_raw) printf("<<<\n%s\n>>>\n",inc->comment); if(option_warn&WARN_COMMENT && !inc->comment) printf("Warning %16s : #Include '%s' does not have a comment.\n",filename,inc->name); if(option_raw && inc->includes) WriteWarnRawSubInclude(inc->includes,1); } /*++++++++++++++++++++++++++++++++++++++ Write an Sub-Include structure out. Include inc The Include structure to output. int depth The depth of the include hierarchy. ++++++++++++++++++++++++++++++++++++++*/ static void WriteWarnRawSubInclude(Include inc,int depth) { int i; while(inc) { for(i=0;i<depth;i++) printf(" "); printf("INCLUDES : '%s' [%s file]\n",inc->name,(inc->scope==GLOBAL?"System":"Local")); if(inc->includes) WriteWarnRawSubInclude(inc->includes,depth+1); inc=inc->next; } } /*++++++++++++++++++++++++++++++++++++++ Write a Define structure out. Define def The Define structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteWarnRawDefine(Define def) { int i; if(option_raw) { printf("\nDEFINES : '%s' ",def->name); if(def->value) printf("= %s",def->value); if(def->args->n) { printf("("); for(i=0;i<def->args->n;i++) printf(i?",%s":"%s",def->args->s1[i]); printf(")"); } printf("\n"); } if(def->comment && option_raw) printf("<<<\n%s\n>>>\n",def->comment); if(option_warn&WARN_COMMENT && !def->comment) printf("Warning %16s : #Define '%s' does not have a comment.\n",filename,def->name); if(option_raw) printf("Defined: %s:%d\n",filename,def->lineno); for(i=0;i<def->args->n;i++) { if(option_raw) { if(def->args->s2[i]) printf("Arguments: %s <<<%s>>>\n",def->args->s1[i],def->args->s2[i]); else printf("Arguments: %s\n",def->args->s1[i]); } if(option_warn&WARN_COMMENT && !def->args->s2[i]) printf("Warning %16s : #Define '%s' has an argument '%s' with no comment.\n",filename,def->name,def->args->s1[i]); } } /*++++++++++++++++++++++++++++++++++++++ Write a Typedef structure out. Typedef type The Typedef structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteWarnRawTypedef(Typedef type) { if(option_raw) { if(type->type) printf("\nTYPEDEF : '%s'\n",type->name); else printf("\nTYPE : '%s'\n",type->name); } if(type->comment && option_raw) printf("<<<\n%s\n>>>\n",type->comment); if(option_warn&WARN_COMMENT && !type->comment) printf("Warning %16s : Type '%s' does not have a comment.\n",filename,type->name); if(option_raw) printf("Defined: %s:%d\n",filename,type->lineno); if(option_raw) if(type->type) printf("Type: %s\n",type->type); if(option_raw) if(type->typexref) printf("See: %s %s\n",type->typexref->type?"Typedef":"Type",type->typexref->name); if(type->sutype) WriteWarnRawStructUnion(type->sutype,0,type->sutype); } /*++++++++++++++++++++++++++++++++++++++ Write a structure / union / enum out. StructUnion su The structure / union / enum to write. int depth The depth within the structure. StructUnion base The base struct union that this one is part of. ++++++++++++++++++++++++++++++++++++++*/ static void WriteWarnRawStructUnion(StructUnion su, int depth,StructUnion base) { int i; char* splitsu=NULL; if(option_warn&WARN_COMMENT && depth && !su->comment) printf("Warning %16s : Struct/Union component '%s' in '%s' does not have a comment.\n",filename,su->name,base->name); splitsu=strstr(su->name,"{...}"); if(splitsu) splitsu[-1]=0; if(option_raw) { for(i=0;i<depth;i++) printf(" "); if(depth && su->comment && !su->comps) printf("%s; <<<%s>>>\n",su->name,su->comment); else if(!depth || su->comps) printf("%s\n",su->name); else printf("%s;\n",su->name); } if(!depth || su->comps) { if(option_raw) { for(i=0;i<depth;i++) printf(" "); printf(" {\n"); } for(i=0;i<su->n_comp;i++) WriteWarnRawStructUnion(su->comps[i],depth+1,base); if(option_raw) { for(i=0;i<depth;i++) printf(" "); printf(" }\n"); if(splitsu) { for(i=0;i<depth;i++) printf(" "); if(depth && su->comment) printf("%s; <<<%s>>>\n",splitsu[5]?&splitsu[6]:"",su->comment); else printf("%s;\n",splitsu[5]?&splitsu[6]:""); } } } if(splitsu) splitsu[-1]=' '; } /*++++++++++++++++++++++++++++++++++++++ Write a Variable structure out. Variable var The Variable structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteWarnRawVariable(Variable var) { int i; if(option_raw) { int done=0; printf("\nVARIABLE : %s [",var->name); if(var->scope&LOCAL) done=printf("Local"); if(var->scope&GLOBAL) done=printf("Global"); if(var->scope&EXTERNAL) done=printf("%sExternal",done?" and ":""); if(var->scope&EXTERN_H) done=printf("%sExternal from header file",done?" and ":""); if(var->scope&EXTERN_F) printf("%sExternal within function",done?" and ":""); printf("]\n"); if(var->comment) printf("<<<\n%s\n>>>\n",var->comment); } if(option_warn&WARN_COMMENT && !var->comment && (var->scope&(GLOBAL|LOCAL|EXTERNAL|EXTERN_F) || option_raw)) printf("Warning %16s : Variable '%s' does not have a comment.\n",filename,var->name); if(option_raw) printf("Defined: %s:%d\n",var->incfrom?var->incfrom:filename,var->lineno); if(option_raw) printf("Type: %s\n",var->type); if(option_raw && var->incfrom) printf("Included from: %s\n",var->incfrom); if(option_xref&XREF_VAR) { if(option_raw) { if(var->scope&(EXTERNAL|EXTERN_F) && var->defined) printf("Declared global in '%s'\n",var->defined); if(var->scope&(GLOBAL|LOCAL)) { for(i=0;i<var->visible->n;i++) if(var->visible->s1[i][0]=='$' && !var->visible->s1[i][1]) printf("Visible in %s\n",var->visible->s2[i]); else printf("Visible in %s : %s\n",var->visible->s1[i],var->visible->s2[i]); for(i=0;i<var->used->n;i++) if(var->used->s1[i][0]=='$' && !var->used->s1[i][1]) printf("Used in %s\n",var->used->s2[i]); else printf("Used in %s : %s\n",var->used->s1[i],var->used->s2[i]); } } if(option_warn&WARN_XREF) { if(var->scope&(EXTERNAL|EXTERN_F) && !var->defined) printf("Warning %16s : Variable '%s' has an unknown global definition.\n",filename,var->name); if(var->scope&(GLOBAL|LOCAL|EXTERNAL|EXTERN_F) && !var->used->n) printf("Warning %16s : Variable '%s' is not used anywhere.\n",filename,var->name); if(var->scope&(GLOBAL|EXTERNAL|EXTERN_F) && var->used->n) { int is_used_elsewhere=0,is_used_here=0; for(i=0;i<var->used->n;i++) if(!strcmp(filename,var->used->s2[i])) is_used_here=1; else is_used_elsewhere=1; if(!is_used_elsewhere) printf("Warning %16s : Variable '%s' is %s but only used in this file.\n",filename,var->name,var->scope&GLOBAL?"global":"extern"); if(!is_used_here) printf("Warning %16s : Variable '%s' is %s but not used in this file.\n",filename,var->name,var->scope&GLOBAL?"global":"extern"); } } } } /*++++++++++++++++++++++++++++++++++++++ Write a Function structure out. Function func The Function structure to output. ++++++++++++++++++++++++++++++++++++++*/ static void WriteWarnRawFunction(Function func) { int i; if(option_raw) { int done=0; printf("\nFUNCTION : %s [",func->name); if(func->scope&LOCAL) done=printf("Local"); if(func->scope&GLOBAL) done=printf("Global"); if(func->scope&EXTERNAL) done=printf("External"); if(func->scope&INLINED) printf("%sInline",done?" and ":""); printf("]\n"); if(func->comment) printf("<<<\n%s\n>>>\n",func->comment); } if(option_warn&WARN_COMMENT && !func->comment) printf("Warning %16s : Function '%s()' does not have a comment.\n",filename,func->name); if(option_raw) printf("Defined: %s:%d\n",func->incfrom?func->incfrom:filename,func->lineno); if(option_xref&XREF_FUNC) { if(func->protofile && option_raw) printf("Prototyped in %s\n",func->protofile); if(option_warn&WARN_XREF && !func->protofile) printf("Warning %16s : Function '%s()' is not prototyped.\n",filename,func->name); } if(option_raw) { if(func->cret) printf("Type: %s <<<%s>>>\n",func->type,func->cret); else printf("Type: %s\n",func->type); } if(option_warn&WARN_COMMENT && !func->cret && strncmp("void ",func->type,5)) printf("Warning %16s : Function '%s()' has a return value with no comment.\n",filename,func->name); for(i=0;i<func->args->n;i++) { if(option_raw) { if(func->args->s2[i]) printf("Arguments: %s <<<%s>>>\n",func->args->s1[i],func->args->s2[i]); else printf("Arguments: %s\n",func->args->s1[i]); } if(option_warn&WARN_COMMENT && !func->args->s2[i] && strcmp("void",func->args->s1[i])) printf("Warning %16s : Function '%s()' has an argument '%s' with no comment.\n",filename,func->name,func->args->s1[i]); } if(option_raw && func->incfrom) printf("Included from: %s\n",func->incfrom); if(option_xref&XREF_FUNC) { for(i=0;i<func->calls->n;i++) { if(option_raw) { if(func->calls->s2[i]) printf("Calls %s : %s\n",func->calls->s1[i],func->calls->s2[i]); else printf("Calls %s\n",func->calls->s1[i]); } #if 0 /* Too verbose */ if(option_warn&WARN_XREF && !func->calls->s2[i]) printf("Warning %16s : Function '%s()' calls function '%s()' whose definition is unknown.\n",filename,func->name,func->calls->s1[i]); #endif } if(option_raw) for(i=0;i<func->called->n;i++) printf("Called from %s : %s\n",func->called->s1[i],func->called->s2[i]); if(option_raw) for(i=0;i<func->used->n;i++) { if(func->used->s1[i][0]=='$' && !func->used->s1[i][1]) printf("Used in %s\n",func->used->s2[i]); else printf("Used in %s : %s\n",func->used->s1[i],func->used->s2[i]); } for(i=0;i<func->f_refs->n;i++) { if(option_raw) { if(func->f_refs->s2[i]) printf("References Function %s : %s\n",func->f_refs->s1[i],func->f_refs->s2[i]); else printf("References Function %s\n",func->f_refs->s1[i]); } if(option_warn&WARN_XREF && !func->f_refs->s2[i]) printf("Warning %16s : Function '%s()' references function '%s()' whose definition is unknown.\n",filename,func->name,func->f_refs->s1[i]); } } if(option_xref&XREF_VAR) for(i=0;i<func->v_refs->n;i++) { if(option_raw) { if(func->v_refs->s2[i]) printf("References Variable %s : %s\n",func->v_refs->s1[i],func->v_refs->s2[i]); else printf("References Variable %s\n",func->v_refs->s1[i]); } if(option_warn&WARN_XREF && !func->v_refs->s2[i]) printf("Warning %16s : Function '%s()' references variable '%s' whose definition is unknown.\n",filename,func->name,func->v_refs->s1[i]); } if(option_warn&WARN_XREF) { if(!func->used->n && !func->called->n) printf("Warning %16s : Function '%s()' is not used anywhere.\n",filename,func->name); if(func->scope&(GLOBAL|EXTERNAL) && (func->called->n || func->used->n)) { int is_used_elsewhere=0; for(i=0;i<func->called->n;i++) if(strcmp(func->called->s2[i],filename)) {is_used_elsewhere=1;break;} for(i=0;i<func->used->n;i++) if(strcmp(func->used->s2[i],filename)) {is_used_elsewhere=1;break;} if(!is_used_elsewhere) printf("Warning %16s : Function '%s()' is global but is only used in this file.\n",filename,func->name); } } } /*++++++++++++++++++++++++++++++++++++++ Write out a raw version of the appendix. StringList files The list of files to write. StringList2 funcs The list of functions to write. StringList2 vars The list of variables to write. StringList2 types The list of types to write. ++++++++++++++++++++++++++++++++++++++*/ void WriteWarnRawAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types) { int i; /* Write out the appendix of files. */ if(option_index&INDEX_FILE) { if(files->n) { printf("\nAppendix - Files\n\n"); for(i=0;i<files->n;i++) printf("%s\n",files->s[i]); } else if(option_warn&WARN_XREF) printf("Warning Index : No global files to index.\n"); } /* Write out the appendix of functions. */ if(option_index&INDEX_FUNC) { if(funcs->n) { printf("\nAppendix - Global Functions\n\n"); for(i=0;i<funcs->n;i++) printf("%s : %s\n",funcs->s1[i],funcs->s2[i]); } else if(option_warn&WARN_XREF) printf("Warning Index : No global functions to index.\n"); } /* Write out the appendix of variables. */ if(option_index&INDEX_VAR) { if(vars->n) { printf("\nAppendix - Global Variables\n\n"); for(i=0;i<vars->n;i++) printf("%s : %s\n",vars->s1[i],vars->s2[i]); } else if(option_warn&WARN_XREF) printf("Warning Index : No global variables to index.\n"); } /* Write out the appendix of types. */ if(option_index&INDEX_TYPE) { if(types->n) { printf("\nAppendix - Defined Types\n\n"); for(i=0;i<types->n;i++) printf("%s : %s\n",types->s1[i],types->s2[i]); } else if(option_warn&WARN_XREF) printf("Warning Index : No types to index.\n"); } } /*++++++++++++++++++++++++++++++++++++++ Decide if to copy or skip the next line. int CopyOrSkip Returns the number of characters to skip. char *string The string that starts the next line. char *type The type of file we are outputing. int *copy Returns true if we are to copy the line verbatim. int *skip Returns true if we are to skip the line. ++++++++++++++++++++++++++++++++++++++*/ int CopyOrSkip(char *string,char *type,int *copy,int *skip) { char *p=string; int s=0; if(*p=='\n') p++; while(*p==' ' || *p=='\t') p++; *copy=*skip=0; switch(*type) { case 'h': /* html */ if(!strncmp(p,"+html+",s=6) || !strncmp(p,"-latex-",s=7) || !strncmp(p,"-sgml-",s=6) || !strncmp(p,"-rtf-",s=5)) *copy=1; if(!strncmp(p,"-html-",s=6) || !strncmp(p,"+latex+",s=7) || !strncmp(p,"+sgml+",s=6) || !strncmp(p,"+rtf+",s=5) || !strncmp(p,"+none+",s=6)) *skip=1; break; case 'l': /* latex */ if(!strncmp(p,"-html-",s=6) || !strncmp(p,"+latex+",s=7) || !strncmp(p,"-sgml-",s=6) || !strncmp(p,"-rtf-",s=5)) *copy=1; if(!strncmp(p,"+html+",s=6) || !strncmp(p,"-latex-",s=7) || !strncmp(p,"+sgml+",s=6) || !strncmp(p,"+rtf+",s=5) || !strncmp(p,"+none+",s=6)) *skip=1; break; case 's': /* sgml */ if(!strncmp(p,"-html-",s=6) || !strncmp(p,"-latex-",s=7) || !strncmp(p,"+sgml+",s=6) || !strncmp(p,"-rtf-",s=5)) *copy=1; if(!strncmp(p,"+html+",s=6) || !strncmp(p,"+latex+",s=7) || !strncmp(p,"-sgml-",s=6) || !strncmp(p,"+rtf+",s=5) || !strncmp(p,"+none+",s=6)) *skip=1; break; case 'r': /* rtf */ if(!strncmp(p,"-html-",s=6) || !strncmp(p,"-latex-",s=7) || !strncmp(p,"-sgml-",s=6) || !strncmp(p,"+rtf+",s=5)) *copy=1; if(!strncmp(p,"+html+",s=6) || !strncmp(p,"+latex+",s=7) || !strncmp(p,"+sgml+",s=6) || !strncmp(p,"-rtf-",s=5) || !strncmp(p,"+none+",s=6)) *skip=1; break; } if(*copy) return(p-string+s); else return(0); } �����������������cxref-1.6d/src/xref.c������������������������������������������������������������������������������� 644 � 233 � 144 � 60474 11506061166 7737� 0�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************** $Header: /home/amb/CVS/cxref/src/xref.c,v 1.21 2002-06-23 15:57:36 amb Exp $ C Cross Referencing & Documentation tool. Version 1.5e. Cross referencing of functions. ******************/ /****************** Written by Andrew M. Bishop This file Copyright 1995,96,97,98,99,2000,01,02 Andrew M. Bishop It may be distributed under the GNU Public License, version 2, or any higher version. See section COPYING of the GNU Public license for conditions under which this file may be redistributed. ***************************************/ /*+ The names of the function cross reference files. +*/ #define XREF_FUNC_FILE ".function" #define XREF_FUNC_BACKUP ".function~" /*+ The names of the variable cross reference files. +*/ #define XREF_VAR_FILE ".variable" #define XREF_VAR_BACKUP ".variable~" /*+ The names of the include cross reference files. +*/ #define XREF_INC_FILE ".include" #define XREF_INC_BACKUP ".include~" /*+ The names of the type cross reference files. +*/ #define XREF_TYPE_FILE ".typedef" #define XREF_TYPE_BACKUP ".typedef~" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <limits.h> #define TYPE_MAX_LEN 256 /*+ The maximum type definition length +*/ #define FUNC_MAX_LEN 64 /*+ The maximum function name length. +*/ #if defined(PATH_MAX) && defined(NAME_MAX) #define FILE_MAX_LEN (PATH_MAX+NAME_MAX) /*+ The maximum filename length. +*/ #elif defined(PATH_MAX) #define FILE_MAX_LEN (PATH_MAX+256) /*+ The maximum filename length. +*/ #else #define FILE_MAX_LEN 512 /*+ The maximum filename length. +*/ #endif #include "memory.h" #include "datatype.h" #include "cxref.h" /*+ The name of the directory for the output. +*/ extern char* option_odir; /*+ The base name of the file for the output. +*/ extern char* option_name; /*+ The option for cross referencing. +*/ extern int option_xref; /*+ The option for indexing. +*/ extern int option_index; static void check_for_called(File file,char* called,char* caller,char* filename); static void check_for_caller(File file,char* called,char* filename); static void check_for_var(File file,char* variable,char* filename,int scope,char* funcname); static int check_for_var_func(File file,Variable var,Function func); static void fixup_extern_var(Variable var,StringList2 refs); /*++++++++++++++++++++++++++++++++++++++ Cross reference the functions, variables and includes that are used in this file with the global functions, variables and includes. The types that are defined are also listed here. File file The file structure containing the information. int outputs Set to true if any cross referencing to produce outputs is required. ++++++++++++++++++++++++++++++++++++++*/ void CrossReference(File file,int outputs) { FILE *in,*out; char *ifile,*ofile; /* Format: filename [[%]include1] [[%]include2] ... : Files include1, include2, ... are included in filename; those with a % are local. */ if(option_xref&XREF_FILE) /* First do the files */ { Include inc; ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_INC_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,XREF_INC_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(!out) {fprintf(stderr,"cxref: Failed to open the include cross reference file '%s'\n",ofile);exit(1);} fprintf(out,"%s",file->name); for(inc=file->includes;inc;inc=inc->next) fprintf(out," %s%s",inc->scope==LOCAL?"%":"",inc->name); fprintf(out,"\n"); if(in) { char include[FILE_MAX_LEN+1],filename[FILE_MAX_LEN+1],ch; while(fscanf(in,"%s%c",filename,&ch)==2) { int diff_file=strcmp(filename,file->name); if(diff_file) fprintf(out,"%s",filename); while(ch==' ') { fscanf(in,"%s%c",include,&ch); if(diff_file) fprintf(out," %s",include); if(outputs) if(include[0]=='%' && !strcmp(&include[1],file->name)) AddToStringList(file->inc_in,filename,1,1); } if(diff_file) fprintf(out,"\n"); } fclose(in); unlink(ifile); } fclose(out); rename(ofile,ifile); } /* Format: filename funcname scope [[%][&]funcname1] [[%][&]funcname2] ... : The function funcname in file filename calls or references functions funcname1, funcname2 ... ; those with a % are local, with a & are references. */ /* Format: filename $ 0 [[%]&funcname1] [[%]&funcname2] ... : The file references functions funcname1, funcname2 ... ; those with a % are local. */ if(option_xref&XREF_FUNC) /* Now do the functions */ { Function func; int i; ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_FUNC_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,XREF_FUNC_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(!out) {fprintf(stderr,"cxref: Failed to open the functional cross reference file '%s'\n",ofile);exit(1);} for(i=0;i<file->f_refs->n;i++) check_for_called(file,ConcatStrings(2,"&",file->f_refs->s1[i]),NULL,file->name); for(func=file->functions;func;func=func->next) { for(i=0;i<func->calls->n;i++) check_for_called(file,func->calls->s1[i],func->name,file->name); for(i=0;i<func->f_refs->n;i++) check_for_called(file,ConcatStrings(2,"&",func->f_refs->s1[i]),func->name,file->name); } for(func=file->functions;func;func=func->next) check_for_caller(file,func->name,file->name); if(file->f_refs->n) { fprintf(out,"%s $ 0",file->name); for(i=0;i<file->f_refs->n;i++) { if(file->f_refs->s2[i]) fprintf(out," %%&%s",file->f_refs->s1[i]); else fprintf(out," &%s",file->f_refs->s1[i]); } fprintf(out,"\n"); } for(func=file->functions;func;func=func->next) { fprintf(out,"%s %s %d",file->name,func->name,func->scope); for(i=0;i<func->calls->n;i++) { if(func->calls->s2[i]) fprintf(out," %%%s",func->calls->s1[i]); else fprintf(out," %s",func->calls->s1[i]); } for(i=0;i<func->f_refs->n;i++) { if(func->f_refs->s2[i]) fprintf(out," %%&%s",func->f_refs->s1[i]); else fprintf(out," &%s",func->f_refs->s1[i]); } fprintf(out,"\n"); } if(in) { char ch,funcname[FUNC_MAX_LEN+1],filename[FILE_MAX_LEN+1],called[FUNC_MAX_LEN+1]; int scope; while(fscanf(in,"%s %s %d%c",filename,funcname,&scope,&ch)==4) { int diff_file=strcmp(filename,file->name); if(diff_file) { if(outputs) if(funcname[0]!='$' || funcname[1]!=0) check_for_caller(file,funcname,filename); fprintf(out,"%s %s %d",filename,funcname,scope); } while(ch==' ') { fscanf(in,"%s%c",called,&ch); if(diff_file) { if(outputs) { if(called[0]!='%') { if(funcname[0]!='$' || funcname[1]!=0) check_for_called(file,called,funcname,filename); else check_for_called(file,called,NULL,filename); } } fprintf(out," %s",called); } } if(diff_file) fprintf(out,"\n"); } fclose(in); unlink(ifile); } fclose(out); rename(ofile,ifile); } /* Format: filename varname scope [$] [[%]funcname1] [[%]funcname2] ... : variable varname is used in the file filename if $, and functions funcname1, funcname2 ... Those with a % are local. */ if(option_xref&XREF_VAR) /* Now do the variables */ { Variable var; Function func; ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_VAR_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,XREF_VAR_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(!out) {fprintf(stderr,"cxref: Failed to open the variable cross reference file '%s'\n",ofile);exit(1);} for(var=file->variables;var;var=var->next) { check_for_var(file,var->name,file->name,var->scope,NULL); fprintf(out,"%s %s %d",file->name,var->name,var->scope); if(check_for_var_func(file,var,NULL)) fprintf(out," $"); for(func=file->functions;func;func=func->next) if(check_for_var_func(file,var,func)) fprintf(out," %s%s",func->scope==LOCAL?"%":"",func->name); fprintf(out,"\n"); } if(in) { char varname[FUNC_MAX_LEN+1],filename[FILE_MAX_LEN+1],funcname[FUNC_MAX_LEN+1],ch; int scope; while(fscanf(in,"%s %s %d%c",filename,varname,&scope,&ch)==4) { int diff_file=strcmp(filename,file->name); if(diff_file) { if(outputs) if(!(scope&LOCAL)) check_for_var(file,varname,filename,scope,NULL); fprintf(out,"%s %s %d",filename,varname,scope); } while(ch==' ') { fscanf(in,"%s%c",funcname,&ch); if(diff_file) { if(outputs) { if(!(scope&LOCAL)) { if(funcname[0]=='%') check_for_var(file,varname,filename,scope,&funcname[1]); else check_for_var(file,varname,filename,scope,funcname); } } fprintf(out," %s",funcname); } } if(diff_file) fprintf(out,"\n"); } fclose(in); unlink(ifile); } /* We must fix the location of the extern variables now since it was not known earlier. */ if(outputs) { fixup_extern_var(file->variables,file->v_refs); for(func=file->functions;func;func=func->next) fixup_extern_var(file->variables,func->v_refs); } fclose(out); rename(ofile,ifile); } /* Format: filename typename type... : For a typedef type. */ /* Format: filename # type... : For a non typedef type. */ if(option_xref&XREF_TYPE) /* Now do the types */ { Typedef type; ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_TYPE_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,XREF_TYPE_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(!out) {fprintf(stderr,"cxref: Failed to open the typedef reference file '%s'\n",ofile);exit(1);} for(type=file->typedefs;type;type=type->next) if(type->type) fprintf(out,"%s %s %s\n",file->name,type->name,type->type); else fprintf(out,"%s # %s\n",file->name,type->name); if(in) { char typename[TYPE_MAX_LEN+1],filename[FILE_MAX_LEN+1]; while(fscanf(in,"%s %s",filename,typename)==2) { int diff_file=strcmp(filename,file->name); if(diff_file) fprintf(out,"%s %s",filename,typename); fgets(typename,TYPE_MAX_LEN,in); if(diff_file) fputs(typename,out); } fclose(in); unlink(ifile); } fclose(out); rename(ofile,ifile); } } /*++++++++++++++++++++++++++++++++++++++ Check through all of the functions in this file to see if any of them are called or referenced. File file The file structure. char* called The function that is called. char* caller The function that the called function is called from. char* filename The file that the function is called from. ++++++++++++++++++++++++++++++++++++++*/ static void check_for_called(File file,char* called,char* caller,char* filename) { Function func; /* Check for function calls */ if(called[0]!='&') for(func=file->functions;func;func=func->next) { if(!strcmp(called,func->name)) AddToStringList2(func->called,caller,filename,1,1); } /* Check for function references */ else for(func=file->functions;func;func=func->next) { if(!strcmp(&called[1],func->name)) { if(caller) AddToStringList2(func->used,caller,filename,1,1); else AddToStringList2(func->used,"$",filename,1,0); } } } /*++++++++++++++++++++++++++++++++++++++ Check through all of the functions in this file to see if any of them are callers or referencers. File file The file structure. char* called The function that is called. char* filename The file that the called function is in. ++++++++++++++++++++++++++++++++++++++*/ static void check_for_caller(File file,char* called,char* filename) { int i; Function func; /* Check the functions that are called. */ for(func=file->functions;func;func=func->next) for(i=0;i<func->calls->n;i++) if(!strcmp(called,func->calls->s1[i])) if(!func->calls->s2[i]) func->calls->s2[i]=MallocString(filename); /* Check the functions that are referenced. */ for(i=0;i<file->f_refs->n;i++) if(!strcmp(called,file->f_refs->s1[i])) if(!file->f_refs->s2[i]) file->f_refs->s2[i]=MallocString(filename); for(func=file->functions;func;func=func->next) for(i=0;i<func->f_refs->n;i++) if(!strcmp(called,func->f_refs->s1[i])) if(!func->f_refs->s2[i]) func->f_refs->s2[i]=MallocString(filename); } /*++++++++++++++++++++++++++++++++++++++ Check through all of the variables in this file to see if any of them are extern usage of others. File file The file structure. char* variable The global variable name. char* filename The file that the variable is used in. int scope The scope of the variable in the foreign file. char* funcname The name of a function that uses the variable. ++++++++++++++++++++++++++++++++++++++*/ static void check_for_var(File file,char* variable,char* filename,int scope,char* funcname) { Variable var; if(!funcname) { if(!(scope&(GLOBAL|EXTERNAL|EXTERN_H))) return; for(var=file->variables;var;var=var->next) if((scope&GLOBAL && var->scope&(EXTERNAL|EXTERN_H|EXTERN_F)) || (scope&(GLOBAL|EXTERNAL|EXTERN_H) && var->scope&GLOBAL)) if(!strcmp(variable,var->name)) { if(scope&GLOBAL && var->scope&(EXTERNAL|EXTERN_H|EXTERN_F)) var->defined=MallocString(filename); if(scope&(GLOBAL|EXTERNAL|EXTERN_H) && var->scope&GLOBAL) AddToStringList2(var->visible,"$",filename,1,0); } } else { for(var=file->variables;var;var=var->next) if(!strcmp(variable,var->name)) { if(funcname[0]=='$' && !funcname[1]) AddToStringList2(var->used,"$",filename,1,0); else { AddToStringList2(var->used,funcname,filename,1,1); if(scope&EXTERN_F && var->scope&GLOBAL) AddToStringList2(var->visible,funcname,filename,1,1); } } } } /*++++++++++++++++++++++++++++++++++++++ Check through the function to see if it uses the variable, if func is NULL then check the file. int check_for_var_func Returns 1 if the variable is referenced from the function or file. File file The file that the function belongs to. Variable var The variable that may be referenced. Function func The function that is to be checked. ++++++++++++++++++++++++++++++++++++++*/ static int check_for_var_func(File file,Variable var,Function func) { int i; if(func) { for(i=0;i<func->v_refs->n;i++) if(!strcmp(var->name,func->v_refs->s1[i])) { AddToStringList2(var->used,func->name,file->name,1,1); if(var->scope&(GLOBAL|LOCAL)) func->v_refs->s2[i]=MallocString(file->name); else { if(func->v_refs->s2[i]) Free(func->v_refs->s2[i]); func->v_refs->s2[i]=MallocString("$"); } return(1); } } else { for(i=0;i<file->v_refs->n;i++) if(!strcmp(var->name,file->v_refs->s1[i])) { AddToStringList2(var->used,"$",file->name,1,0); if(var->scope&(GLOBAL|LOCAL)) file->v_refs->s2[i]=MallocString(file->name); else { if(file->v_refs->s2[i]) Free(file->v_refs->s2[i]); file->v_refs->s2[i]=MallocString("$"); } return(1); } } return(0); } /*++++++++++++++++++++++++++++++++++++++ We can only now put in the location of the external variables that we found were used. Previously we did not know the location of their global definition. Variable var The list of variables for this file. StringList2 refs A list of variable references from a file or a function. ++++++++++++++++++++++++++++++++++++++*/ static void fixup_extern_var(Variable var,StringList2 refs) { int i; Variable v; for(i=0;i<refs->n;i++) { if(refs->s2[i][0]=='$' && !refs->s2[i][1]) for(v=var;v;v=v->next) if(v->scope&(EXTERNAL|EXTERN_H|EXTERN_F) && !strcmp(refs->s1[i],v->name)) { if(v->defined) { Free(refs->s2[i]); refs->s2[i]=MallocString(v->defined); } else { Free(refs->s1[i]); refs->s1[i]=MallocString(v->name); Free(refs->s2[i]); refs->s2[i]=NULL; } break; } } } /*++++++++++++++++++++++++++++++++++++++ Create the appendix of files, global functions, global variables and types. StringList files The list of files to create. StringList2 funcs The list of functions to create. StringList2 vars The list of variables to create. StringList2 types The list of types to create. ++++++++++++++++++++++++++++++++++++++*/ void CreateAppendix(StringList files,StringList2 funcs,StringList2 vars,StringList2 types) { FILE *in; char *ifile; if(option_index&INDEX_FILE) /* First do the files */ { ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_INC_FILE); in =fopen(ifile,"r"); if(in) { char include[FILE_MAX_LEN+1],filename[FILE_MAX_LEN+1],ch; while(fscanf(in,"%s%c",filename,&ch)==2) { AddToStringList(files,filename,1,1); while(ch==' ') fscanf(in,"%s%c",include,&ch); } fclose(in); } } if(option_index&INDEX_FUNC) /* Now do the functions */ { ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_FUNC_FILE); in =fopen(ifile,"r"); if(in) { char ch,caller[FUNC_MAX_LEN+1],filename[FILE_MAX_LEN+1],called[FUNC_MAX_LEN+1]; int scope; while(fscanf(in,"%s %s %d%c",filename,caller,&scope,&ch)==4) { if(scope&GLOBAL) AddToStringList2(funcs,caller,filename,1,1); while(ch==' ') fscanf(in,"%s%c",called,&ch); } fclose(in); } } if(option_index&INDEX_VAR) /* Now do the variables */ { ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_VAR_FILE); in =fopen(ifile,"r"); if(in) { char variable[FUNC_MAX_LEN+1],filename[FILE_MAX_LEN+1],funcname[FUNC_MAX_LEN+1],ch; int scope; while(fscanf(in,"%s %s %d%c",filename,variable,&scope,&ch)==4) { if(scope&GLOBAL) AddToStringList2(vars,variable,filename,1,1); while(ch==' ') fscanf(in,"%s%c",funcname,&ch); } fclose(in); } } if(option_index&INDEX_TYPE) /* Now do the types */ { ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_TYPE_FILE); in =fopen(ifile,"r"); if(in) { char typename[TYPE_MAX_LEN],filename[FILE_MAX_LEN+1]; while(fscanf(in,"%s %s",filename,typename)==2) { if(typename[0]=='#') { fgets(typename,TYPE_MAX_LEN,in); typename[strlen(typename)-1]=0; AddToStringList2(types,&typename[1],filename,1,1); } else { AddToStringList2(types,typename,filename,1,1); fgets(typename,TYPE_MAX_LEN,in); } } fclose(in); } } } /*++++++++++++++++++++++++++++++++++++++ Delete the named file from the cross reference database. char *name The name of the file that is to be deleted. ++++++++++++++++++++++++++++++++++++++*/ void CrossReferenceDelete(char *name) { FILE *in,*out; char *ifile,*ofile; /* First do the files */ ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_INC_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,XREF_INC_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(in && !out) {fprintf(stderr,"cxref: Failed to open the include cross reference file '%s'\n",ofile);fclose(in);} else if(in) { char include[FILE_MAX_LEN+1],filename[FILE_MAX_LEN+1],ch; while(fscanf(in,"%s%c",filename,&ch)==2) { int diff_file=strcmp(filename,name); if(diff_file) fprintf(out,"%s",filename); while(ch==' ') { fscanf(in,"%s%c",include,&ch); if(diff_file) fprintf(out," %s",include); } if(diff_file) fprintf(out,"\n"); } fclose(in); unlink(ifile); fclose(out); rename(ofile,ifile); } else if(out) { fclose(out); unlink(ofile); } /* Now do the functions */ ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_FUNC_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,XREF_FUNC_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(in && !out) {fprintf(stderr,"cxref: Failed to open the functional cross reference file '%s'\n",ofile);fclose(in);} else if(in) { char ch,funcname[FUNC_MAX_LEN+1],filename[FILE_MAX_LEN+1],called[FUNC_MAX_LEN+1]; int scope; while(fscanf(in,"%s %s %d%c",filename,funcname,&scope,&ch)==4) { int diff_file=strcmp(filename,name); if(diff_file) fprintf(out,"%s %s %d",filename,funcname,scope); while(ch==' ') { fscanf(in,"%s%c",called,&ch); if(diff_file) fprintf(out," %s",called); } if(diff_file) fprintf(out,"\n"); } fclose(in); unlink(ifile); fclose(out); rename(ofile,ifile); } else if(out) { fclose(out); unlink(ofile); } /* Now do the variables */ ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_VAR_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,XREF_VAR_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(in && !out) {fprintf(stderr,"cxref: Failed to open the variable cross reference file '%s'\n",ofile);fclose(in);} else if(in) { char varname[FUNC_MAX_LEN+1],filename[FILE_MAX_LEN+1],funcname[FUNC_MAX_LEN+1],ch; int scope; while(fscanf(in,"%s %s %d%c",filename,varname,&scope,&ch)==4) { int diff_file=strcmp(filename,name); if(diff_file) fprintf(out,"%s %s %d",filename,varname,scope); while(ch==' ') { fscanf(in,"%s%c",funcname,&ch); if(diff_file) fprintf(out," %s",funcname); } if(diff_file) fprintf(out,"\n"); } fclose(in); unlink(ifile); fclose(out); rename(ofile,ifile); } else if(out) { fclose(out); unlink(ofile); } /* Now do the types */ ifile=ConcatStrings(4,option_odir,"/",option_name,XREF_TYPE_FILE); ofile=ConcatStrings(4,option_odir,"/",option_name,XREF_TYPE_BACKUP); in =fopen(ifile,"r"); out=fopen(ofile,"w"); if(in && !out) {fprintf(stderr,"cxref: Failed to open the typedef reference file '%s'\n",ofile);fclose(in);} else if(in) { char typename[TYPE_MAX_LEN+1],filename[FILE_MAX_LEN+1]; while(fscanf(in,"%s %s",filename,typename)==2) { int diff_file=strcmp(filename,name); if(diff_file) fprintf(out,"%s %s",filename,typename); fgets(typename,TYPE_MAX_LEN,in); if(diff_file) fputs(typename,out); } fclose(in); unlink(ifile); fclose(out); rename(ofile,ifile); } else if(out) { fclose(out); unlink(ofile); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������