Cxref produces documentation (in HTML, LaTeX, 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.
For more information see the project home page: http://www.gedanken.org.uk/software/cxref License: GPL-2.0-only I would like to provide a Cygwin package for cxref, as I noticed it is defined in POSIX 2024 but not available under Cygwin. It is packaged by Debian, OpenSuSE, other minor Linux, Free/NetBSD, and MacPorts distros: https://repology.org/project/cxref/versions Attached cygport and at: https://cygwin.com/cgit/cygwin-packages/playground/tree/cxref.cygport?h=playground package job: https://cygwin.com/cgi-bin2/jobs.cgi?id=8913&srcpkg=playground&user=Brian+Inglis log at: https://github.com/cygwin/scallywag/actions/runs/10909728566/job/30278868009 The package builds and cxrefs itself successfully both locally and under scallywag GitHub CI. For changes see below: 2022-04-30 667 Handle "restrict" like other type qualifiers ("const" & "volatile"). 2018-08-01 666 Use '-Wall' and '-Wextra' options if the compiler accepts them. 665 Add some more additional extended float types (including GCC extensions). 664 Add a comment to mark a fall-through in a switch statement. 2017-09-08 663 Add support for extended floating point formats (e.g. _Float128). 2016-03-06 662 Change version number so that it reflects last release plus updates. 2016-02-28 661 Simplify the HTML output. 660 Fix a signed/unsigned comparison found by gcc. 2014-06-05 659 Ignore some new local diff files. 658 Change cexp.c and cexp.y so that the definition of 'struct arglist' matches the one in cccp.c. 657 Add cexp.c to SVN (as it was in the distributed cxref versions). 2014-01-22 1.6e Bug Fixes Don't package up unused LSM and ANNOUNCE files. Pass the CPPFLAGS through to the C compiler Don't crash on invalid CPP options Handle the special filename that gcc-4.x uses. Don't crash on unparseable function declaration Don't report line number 0 for structures/unions defined within other ones. Make the HTML 4.01 output use the strict DTD rather than the transitional one. Handle the gcc _Pragma(...) compiler directives. Allow gcc 4.8 to be used instead of cxref-cpp (ignore internal #defines). 2011-10-03 1.6d 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. 2010-05-31 1.6c 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 2007-02-16 1.6b 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. 2005-05-01 1.6a 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. 2004-09-26 1.6 Bug fixes Remove unwanted </a> 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.
#|/usr/bin/cygport # cxref.cygport - cxref Cygwin package build control script definitions # converted by rpmspec2cygport.sh 1.3 2024-08-15 02:20:47+0000 NAME=cxref VERSION=1.6e+667 # +SVN_REV as 2022 SVN_DATE would have to be actual + 1 RELEASE=1 CATEGORY="Devel Text" SUMMARY="C cross referencing and documenting tool" DESCRIPTION="Cxref produces documentation (in HTML, LaTeX, 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." HOMEPAGE=http://www.gedanken.org.uk/software/$NAME OPENSUSE=https://raw.githubusercontent.com/bmwiedemann/openSUSE/master/packages/${NAME:0:1}/$NAME SRC_URI=$HOMEPAGE/download/$NAME-$VERSION.tgz SRC_URI+=" $SRC_URI.asc" SRC_URI+=" $OPENSUSE/$NAME.keyring" SVN_URI=http://gedanken.org.uk/svn/$NAME SVN_BRANCH= SVN_DATE= SVN_REV=${VERSION##*+} # +SVN_REV as 2022 SVN_DATE would have to be actual + 1 inherit emacs svn DEBIAN=https://sources.debian.org/data/main/${NAME:0:1}/$NAME/$VERSION-$RELEASE/debian/patches FEDORA=https://src.fedoraproject.org/rpms/$NAME/raw/master/f PATCH_URI=" $OPENSUSE/allow_redirect_of_cxref_cpp_configure_output_in_postinst.patch cxref-1.6-src-Makefile-in-cxref-srcdir.patch cxref-1.6-doc-Makefile-in-add-cpp-D_Noreturn.patch " # $OPENSUSE/cxref-new_float_types.patch BUILD_REQUIRES="gettext-devel autoconf automake bison emacs flex gawk gcc-core make perl subversion texlive-collection-latex" DIFF_EXCLUDES=install-sh USE_DESTDIR=1 CYGCONF_ARGS= LICENSE="GPL-2.0-only" # SPDX-License-Identifier: GPL-2.0-only LICENSE_SPDX="SPDX-License-Identifier: $LICENSE" LICENSE_URI="COPYING" DOCS="ChangeLog README $LICENCE_URI" src_compile() { cd $S cygautoreconf cd $B cygconf cygmake cygmake docs } src_install() { cd $B cyginstall dodoc doc/*.* dodir $EMACS_SITE doemacs $S/contrib/*.el exeinto /usr/share/$NAME/contrib doexe $S/contrib/*.p[ly] insinto /usr/share/$NAME/contrib for f in $S/contrib/* do case $f in *.el | *.pl | *.py) ;; *) doins $f ;; esac done } src_test() { cd $B # cygtest mkdir -p $T/$NAME/doc/example/ ln -sv -t $T/$NAME/src/ $B/doc/Makefile $B/src/$NAME $B/src/*.[ch] || true ln -sv -t $T/$NAME/src/ $T/$NAME/doc/example || true cd $T/$NAME/src/ make srcdir=. examples } CYGWIN_MAINTAINER=Brian%20Inglis CYGWIN_MAINTAINER_EMAIL=brian.ing...@systematicsw.ab.ca UPSTREAM_MAINTAINER=Andrew%20M.Bishop UPSTREAM_MAINTAINER_EMAIL=a...@gedanken.org.uk SUBJECT=${OSTYPE^}%20Package%20$NAME%20$VERSION MAILTO=mailto:$UPSTREAM_MAINTAINER%20%3C$UPSTREAM_MAINTAINER_EMAIL%3E\ ?from=$CYGWIN_MAINTAINER%20%3C$CYGWIN_MAINTAINER_EMAIL%3E\ \&subject=$SUBJECT\&body=$SUBJECT