oxref-2.02.00/build0000775000175000017500000001077714641432744013036 0ustar frankfrank#!/usr/bin/icmake -t. #include "icmconf" string g_logPath, g_cwd = chdir(""); // initial working directory, ends in / int g_echo = ON; #include "icmake/cuteoln" #include "icmake/backtick" #include "icmake/setopt" #include "icmake/run" #include "icmake/md" #include "icmake/special" #include "icmake/pathfile" #include "icmake/findall" #include "icmake/loginstall" #include "icmake/logrecursive" #include "icmake/logzip" #include "icmake/logfile" #include "icmake/uninstall" #include "icmake/clean" #include "icmake/manpage" #include "icmake/gitlab" #include "icmake/destinstall" #include "icmake/loginstalled" #include "icmake/install" void main(int argc, list argv) { string option; string psType; // program or strip int idx; // int precomp = 1; for (idx = listlen(argv); idx--; ) { if (argv[idx] == "-q") { g_echo = OFF; argv -= (list)"-q"; } // else if (argv[idx] == "-P") // { // precomp = 0; // argv -= (list)"-P"; // } else if (strfind(argv[idx], "LOG:") == 0) { g_logPath = argv[idx]; argv -= (list)g_logPath; g_logPath = substr(g_logPath, 4, strlen(g_logPath)); } } echo(g_echo); option = argv[1]; if (option == "clean") clean(0); if (option == "distclean") clean(1); if (option != "") special(); if (option == "install") install(argv[2], argv[3]); if (option == "uninstall") uninstall(argv[2]); if (option == "gitlab") gitlab(); if (option == "man") manpage(); // if (precomp) // exec(P_NOCHECK, // "sed -i 's,^//#define SPCH,#define SPCH,' icmconf"); // else // { // exec(P_NOCHECK, // "sed -i 's,^#define SPCH,//#define SPCH,' icmconf"); // exec(P_NOCHECK, "rm -f *.ih.gch */*.ih.gch"); // } if (option == "library") { system("icmbuild library"); exit(0); } if (argv[2] == "strip") psType = "strip"; else psType = "program"; if (option == "program") { system("icmbuild " + psType); exit(0); } if (option == "oxref") { system("icmbuild " + psType); run("oxref -t main -r replace -fxs tmp/main.o tmp/lib" LIBRARY ".a > " PROGRAM ".xref"); exit(0); } printf("Usage: build [-q -P] what\n" "Where\n" " -q: run quietly, do not show executed commands\n" // " -P: do not use precompiled headers\n" "`what' is one of:\n" " clean - clean up remnants of previous compilations\n" " distclean - clean + fully remove tmp/\n" " library - build " PROGRAM "'s library\n" " man - build the man-page (requires Yodl)\n" " program [strip] - build " PROGRAM " (optionally strip the " "executable)\n" " oxref [strip] - same a `program', also builds xref file using " "oxref\n" " scanner [strip] - build new scanner, then 'build program'\n" " install [LOG:path] selection [base] -\n" " to install the software in the locations " "defined \n" " in the INSTALL.im file, optionally below " "base.\n" " LOG:path is optional: if specified `path' " "is the\n" " logfile on which the installation log is " "written.\n" " selection can be\n" " x, to install all components,\n" " or a combination of:\n" " b (binary program),\n" " d (documentation),\n" " m (man-pages)\n" " uninstall logfile - remove files and empty directories listed\n" " in the file 'logfile'\n" " gitlab - prepare gitlab's web-pages update\n" " (internal use only)\n" "\n" ); exit(0); } oxref-2.02.00/changelog0000644000175000017500000001340714641433421013643 0ustar frankfrankoxref (2.02.00) * Building oxref using icmake requires icmake >= 12.01.00 * Flag -P was dropped: to avoid using a single precompiled header undefine SPCH in icmconf * Adapted store/checkglobals.cc to g++ >= 14.0.1 -- Frank B. Brokken Thu, 04 Jul 2024 07:45:41 +0200 oxref (2.01.00) * 'build program' c.s. use ICMAKE_CXXFLAGS. The file c++std was removed. * Added option '--callled-by (-c) spec' showing the (recursive) functions calling 'spec', where 'spec' is a pattern as used by the --select-pattern option. * Replaced the Affero Gnu Public License by the Gnu General Public License -- Frank B. Brokken Thu, 26 Oct 2023 10:57:39 +0200 oxref (2.00.03) * Ready for libbobcat6 * ObjDump::const_iterator was redesigned according to the requirements covered in the C++ Annotations 12.2.0, section 22.14 * Added 'c++std' defining the c++ standard to use for compilation. Compilation commands also use -Werror -- Frank B. Brokken Sun, 11 Sep 2022 09:41:39 +0200 oxref (2.00.02) * On request of the FSF the files agpl-3.0.txt and LICENSE.txt were added to oxref's repo. -- Frank B. Brokken Sat, 25 Jun 2022 11:22:09 +0200 oxref (2.00.01) * Removed -q from oxref's build script * Removed tar.gz references from the man-page * Repaired a flaw in the icmake/finall function -- Frank B. Brokken Mon, 28 Jun 2021 21:28:15 +0200 oxref (2.00.00) * Version 2.00.00 adds several new options (--no-xref, --objdump, --replace, --replace-file --tree), and can produce (using --tree) call trees of functions directly or indirectly called from (c.q. global data used by) programs or from a specified function. * The cross-reference listing can optionally be omitted from the program's output * Variable type definitions produced by the compiler are sometimes very complex, and differ from the way these types are normally specified in source files. E.g., in C++ a string is referred to by the compiler as (on one line): std::__cxx11::basic_string, std::allocator > Instead, in source files std::string is commonly used. Oxref >= V.2.00.00 accepts replacement specifications to change the former specification into the latter in oxref's output. -- Frank B. Brokken Thu, 14 Mar 2019 12:26:12 +0530 oxref (1.00.07) * Migrated from Github to Gitlab -- Frank B. Brokken Sat, 16 Jun 2018 10:24:38 +0200 oxref (1.00.06) * Updated entries in the 'required' file. -- Frank B. Brokken Sun, 20 Dec 2015 13:02:43 +0100 oxref (1.00.05) * Updated the icmake build scripts to icmake 8.00.04 -- Frank B. Brokken Mon, 14 Dec 2015 14:18:32 +0100 oxref (1.00.04) * Kevin Brodsky observed that the installation scripts used 'chdir' rather than 'cd'. Fixed in this release. * Kevin Brodsky also observed that the combined size of all precompiled headers might exceed some disks capacities. The option -P was added to the ./build script to prevent the use of precompiled headers. -- Frank B. Brokken Mon, 05 Oct 2015 21:11:58 +0200 oxref (1.00.03) * Standardized the (de)installation procedures -- Frank B. Brokken Sat, 03 Oct 2015 11:11:25 +0200 oxref (1.00.02) * Fixed compilation errors that emerged with g++-5, reported by Matthias Klose. * Added the file 'required' to the source distribution summarizing the required software for building oxref. -- Frank B. Brokken Thu, 12 Feb 2015 18:13:30 +0100 oxref (1.00.01) * Since oxref's been around for over a year without encountering any serious problems, its version was bumped to slightly over 1.00. * Oxref no longer depends on bobcat's A2x and X2a classes * Oxref's no longer uses (deprecated) FBB::Errno exceptions. Instead, FBB::Exception exceptions are now used. * 'build oxref' uses the newly built tmp/bin/binary (= oxref) program to create its cross-reference listing. -- Frank B. Brokken Thu, 26 Dec 2013 12:33:38 +0100 oxref (0.91.00) * oxref now returns 0 when called with the -h or -v flags * catching FBB::Errno in main.cc is superfluous: removed. -- Frank B. Brokken Fri, 25 Jan 2013 10:38:42 +0100 oxref (0.90.11) * The following #defines in INSTALL.im can be overruled by defining identically named environment variables: CXX defines the name of the compiler to use. By default `g++' CXXFLAGS the options passed to the compiler. By default `-Wall --std=c++0x -O2 -g' LDFLAGS the options passed to the linker. By default no options are passed to the linker. -- Frank B. Brokken Wed, 18 Jul 2012 15:19:38 +0200 oxref (0.90.10) * Depends on Bobcat 3.00.02 * Removed superfluous header (undoing the needless 0.90.04 modification). -- Frank B. Brokken Thu, 10 May 2012 14:02:07 +0200 oxref (0.90.04) * Added missing header -- Frank B. Brokken Wed, 09 May 2012 13:45:58 +0200 oxref (0.90.03) * Fixed an out-of check placed newline insertion -- Frank B. Brokken Mon, 09 Jan 2012 21:35:03 +0100 oxref (0.90.01) * Replaced FnWrap* calls by lambda functions * `build' script now recognizes CXXFLAGS and LDFLAGS for, resp. g++ and ld flags. Default values are in INSTALL.im, as before. -- Frank B. Brokken Fri, 24 Jun 2011 21:15:18 +0200 oxref (0.90.00) * Initial release -- Frank B. Brokken Wed, 16 Feb 2011 11:50:25 +0100 oxref-2.02.00/CLASSES0000644000175000017500000000004414516432277013013 0ustar frankfrankstorage store xrefdata objdump tree oxref-2.02.00/documentation/0000755000175000017500000000000014516432277014646 5ustar frankfrankoxref-2.02.00/documentation/man/0000755000175000017500000000000014641433662015417 5ustar frankfrankoxref-2.02.00/documentation/man/oxref.yo0000644000175000017500000004375114516432277017127 0ustar frankfrankNOUSERMACRO(oxref function tree) includefile(../../release.yo) htmlbodyopt(text)(#27408B) htmlbodyopt(bgcolor)(#FFFAF0) whenhtml(mailto(Frank B. Brokken: f.b.brokken@rug.nl)) DEFINEMACRO(lsoption)(3)(\ bf(--ARG1)=tt(ARG3) (bf(-ARG2))\ ) DEFINEMACRO(laoption)(2)(\ bf(--ARG1)=tt(ARG2)\ ) DEFINEMACRO(loption)(1)(\ bf(--ARG1)\ ) DEFINEMACRO(soption)(1)(\ bf(-ARG1)\ ) DELETEMACRO(tt) DEFINEMACRO(tt)(1)(em(ARG1)) COMMENT( man-request, section, date, distribution file, general name) manpage(oxref)(1)(_CurYrs_)(oxref._CurVers_) (oxref - cross reference utility) COMMENT( man-request, larger title ) manpagename(oxref)(cross reference utility for various languages) COMMENT( all other: add after () ) manpagesynopsis() bf(oxref) [OPTIONS] tt(arguments) nl() [OPTIONS] - see the bf(OPTIONS) section below nl() arguments - object files and/or libraries to process nl() The cross reference listing is written to the standard output stram. manpagedescription() The program bf(oxref) generates cross reference listings, program or function call-trees, and/or (recursive) called-by overviews of specified functions using non-stripped object files and/or libraries. Cross reference listings contain the names and source files of functions defined in the specified object files and/or libraries, as well as an overview of the functions calling these functions. Call-trees show the (nested) tree of functions directly or indirectly called from the top-level (main program) function. Called-by overviews start from a specified function name, and (recursively) show the functions calling the specified function. Brief examples of these three modes of operation are shown below. Especially the 'called-by' overview is useful information during program development and debugging phases, as it immediately provides the hierarchy of functions directly or indirectly calling the specified function name. E.g., assuming that the signature; the pre-conditions or the post-conditions of a function must be changed it is important to know from what function(s) the function-to-modify is called to verify that the changes to the modified function do not break its calling functions. bf(Oxref)'s output starts with a header showing information about the program, a time stamp and the arguments passed to tt(oxref). E.g., verb( oxref by Frank B. Brokken (f.b.brokken@rug.nl) oxref V 2.01.00 2012-2023 CREATED Wed, 25 Oct 2023 11:56:44 +0000 OXREF ARGUMENTS: -t main -r replace -fxs tmp/main.o tmp/libmodules.a ---------------------------------------------------------------------- ) The header is (depending on the specified options) followed by the cross reference information, the call tree and/or the called-by overview. bf(Cross reference listings) show the symbols, as well as (optionally) their full names (e.g., prefixed by class-names), source files and the source files and names of functions using the symbols. The cross reference listings of a global variable and a function looks like this: verb( author Full name: Icmbuild::author Source: version.cc Used By: header.cc: header(int, char**) usage.cc: usage(std::string const&) calledFrom(unsigned long) Full name: XrefData::calledFrom(unsigned long) Source: calledfrom.cc Used By: undefined.cc: Store::undefined(std::string const&) ) bf(Call trees) show the names of all entities used or called from a certain starting point. For bf(C) and bf(C++) programs the starting point tt(main) produces the program's full call tree. A (partially shown) call tree might look like this: verb( CALL TREE FOR: main main +-usage(std::string const&) | +-Icmbuild::version +-Storage::Storage() | +-Store::Store() | +-Storage::patternFile(std::string const&) +-Storage::tree() const +-Store::tree(std::string const&) const +-Tree::print(unsigned long, unsigned long) +-Tree::calls(unsigned long, unsigned long) | +-Tree::calls(unsigned long, XrefData const&) +-Tree::indent(unsigned long) const ) Calling levels are indented using +- indicators, continuation at identical levels are indicated by vertical lines, using | characters. In the shown call tree tt(main) calls tt(usage), the tt(Storage) constructor and the tt(Storage::tree()) member. Likewise, the tt(Storage) constructor calls the tt(Store) constructor and the member tt(Storage::patternFile). Recursively called functions appear in the overview where their names are followed by tt(==> nr) arrows where tt(nr) refers to the call-level where the function is defined. The top level (e.g. tt(main)) is referred to as level 0. Here is an example showing recursion in the call-tree of the tt(bisonc++) program: verb( main ... +-Grammar::deriveSentence() | +-Rules::s_startSymbol | +-Grammar::derivable(Symbol const*) | +-Grammar::becomesDerivable(Production const*) | | +-Grammar::derivable(Symbol const*) ==> 2 | +-Grammar::isDerivable(Production const*) ... ) Indirect recursion is shown this way as well. Caveat: in order to produce the program's call tree the object file containing the program's starting point (e.g., tt(main)) must be available to tt(oxref). If tt(main.o) is the object file of the function tt(main) then tt(main.o) must explicitly be specified as tt(oxref's) command-line argument (see, e.g., the command specification shown above in the header line of tt(oxref's) output). bf(Called-by listings) start from a specified function (specified as a regular expression but usually simply specified as tt(ClassName::memberFunction), showing (recursively) the functions calling the specified function (see option tt(--called-by) below): verb( CALLED-BY LISTING: Store::define(std::string const&, bool) (define.cc): called by Store::setFunction(std::string const&) (setfunction.cc) Store::setObject(std::string const&) (setobject.cc) Store::setSource(std::string const&) (setsource.cc) Store::setFunction(std::string const&) (setfunction.cc): called by Storage::function(std::string const&) (function.cc) Store::setObject(std::string const&) (setobject.cc): called by Storage::object(std::string const&) (object.cc) Store::setSource(std::string const&) (setsource.cc): called by Storage::sourceFile(std::string const&) (sourcefile.cc) Storage::function(std::string const&) (function.cc): called by Storage::push_back(std::string) (pushback.cc) Storage::object(std::string const&) (object.cc): called by Storage::push_back(std::string) (pushback.cc) Storage::sourceFile(std::string const&) (sourcefile.cc): called by Storage::push_back(std::string) (pushback.cc) Storage::push_back(std::string) (pushback.cc): called by main (main.cc) ) manpagesection(RETURN VALUE) bf(Oxref) returns 1 to the operating system if an error occurs or if bf(oxref) automatically shows its usage info. bf(Oxref) returns 0 if the requested action was successfully completed, or if the tt(--version) or tt(--help) options are specified. manpageoptions() Where available, single letter options are listed between parentheses following their associated long-option variants. Single letter options require arguments if their associated long options require arguments as well. itemization( it() lsoption(arg)(a)(mode)nl() Mode specifies the way the output is abbreviated:nl() bf(count) - function parameters are suppressed; instead the number of arguments required by a function is shown in its parameter list. Example: verb( usage(1) ) instead of verb( usage(std::string const&) ) bf(first) - only show the first word of parameters. Example: verb( insertDefined(unsigned, std::ostream&, std::vector&) ) instead of verb( insertDefined(unsigned int, std::ostream&, std::vector > const&) ) bf(len) - where tt(len) is a positive integral number (5 is used if tt(len) is less than 5). The value tt(len) specifies the maximum length of parameter names. If parameter names need to be truncated, an ellipsis replaces the truncated characters. Example using tt(-a 12): verb( insertDefined(unsigned int, std::ostream&, std::vect...&) ) instead of verb( insertDefined(unsigned int, std::ostream&, std::vector > const&) ) it() lsoption(called-by)(c)(spec)nl() tt(spec) is a regular expression showing (recursively) the function(s) and the functions calling those functions. Although tt(spec) can refer to multiple functions, a single function can be specified as, e.g., its name, prefixed by the function's class. E.g., tt(Store::define) (which is a member function of bf(oxref)'s tt(Store) class, see the bf(DESCRIPTION) section). When specifying the tt(--called-by) option the tt(-f) and tt(-s) options do not have to be specified. If only the called-by hierarchy is requested the tt(--no-xref) option can be specified to prevent writing the cross-reference listing to the standard output stream. As an example: to generated the tt(called-by) listing for bf(oxref)'s tt(Store::define) function the following command was issued: verb( oxref -Xc Store::define -r replacements tmp/main.o tmp/libmodules.a ) (with tt(replacements) being the file containing bf(oxref)'s type replacements, see option tt(--replace-file) below). it() loption(full-symbol) soption(f)nl() The full names of the symbols are shown, in addition to the plain symbol names (see also options tt(object-files, source-files) and tt(xref-source-files)).nl() Full names include class names and/or namespace identifiers. Example: verb( insertDefined(unsigned int, std::ostream&, std::vector > const&) Full name: Store::insertDefined(unsigned int, std::ostream&, std::vector > const&) ) it() loption(help) (soption(h))nl() Basic usage information is written to the standard error stream. it() loption(no-xref) (soption(X))nl() The tt(no-xref) option prevents the cross-reference information from being written to the standard output stream. It can be useful in situations where you're only interested in the program's call-tree (cf. option tt(--tree)). it() laoption(objdump)(command)nl() The tt(command) option value specifies how the object-dumping program is called. By default it is called as tt(/usr/bin/objdump -C -t). In practice there's probably no reason for using this option. it() loption(object-files) (soption(o))nl() Include in the cross reference listing the name of object files in which symbols (data, functions) are defined (see also options tt(full-symbol, source-files) and tt(xref-source-files)) it() laoption(replace)(spec) (soption(R))nl() Output generated by tt(objdump) may show the compiler's ideas of what, e.g., a bf(C++) tt(std::string) is. Thus, instead of a parameter tt(std::sting const &) it may show verb( std::__cxx11::basic_string const & ) tt(R) options are used to specify text replacements of the form verb( #find#replace# ) where tt(#) can be any character not used in either the tt(find) text or the tt(replace) text. For example: verb( #std::__cxx11::basic_string#std::string# ) Multiple tt(R) options may be specified, which are applied in sequence line-by-line to all output lines of tt(objdump). E.g, after replacing the above long definition of a string into tt(std::string) subsequent replacements should use tt(std::string) rather than the original long definition provided by the compiler. In practice replacement specifications are specified after initially running tt(oxref) without any specifications. The required replacements are then derived from the obtained output it() laoption(replace-file)(fname) (soption(r))nl() Replacement specifications can also be stored in a file. Specifications read from file are handled like those obtained from tt(replace) options with the tt(replace) options being processed before the replacement specifications read from the file specified with the tt(replace_file) are processed. it() laoption(select)(name)nl() Only display the cross-reference of tt(name), where tt(name) is the (case sensitive) initial substring of a symbol it() laoption(select-pattern)(regex)nl() Only display the cross-reference of symbols matching the regular expression tt(regex), where tt(regex) is a regular expression matching the bf(regex)(7) specification, including the extensions offered by the bf(pattern)(3bobcat) bf(Pattern) class. Case sensitive matching is used here, too. it() loption(source-files) (soption(s))nl() Include in the cross reference listing the names of the source files in which symbols are defined (see also options tt(full-symbol, object-files) and tt(xref-source-files)) it() laoption(tree)(fname) (soption(t))nl() The tt(tree) option generates a call tree for function tt(fname). The argument tt(fname) defines the starting point of the call tree. Note that the program's starting point (usually tt(main)) does not normally appear in a cross-reference listing, as it is not used by other parts of the program. To obtain the call tree for the program's starting function in these cases specify tt(--tree main). Otherwise, if the call tree of another function is requested its `Full name' specification as used in the cross-reference listing must be used. it() loption(xref-source-files) (soption(x))nl() Include in the cross reference listing the name of source files in which used symbols are defined (see also options tt(full-symbol, object-files) and tt(source-files)) it() loption(version) (soption(v))nl() tt(Oxref)'s version number is written to the standard error stream. ) manpagesection(EXAMPLES) The examples show how tt(oxref) was called, followed by a representative example of a cross-reference listing for a symbol. tt(Oxref)'s own cross reference listing was used: verb( called as: oxref liboxref define(std::string const&, bool) Used By: Store::setFunction(std::string const&) Store::setObject(std::string const&) Store::setSource(std::string const&) -------------------- called as: oxref -foxs liboxref define(std::string const&, bool) Full name: Store::define(std::string const&, bool) Source: define.cc (1define.o) Used By: setfunction.cc: Store::setFunction(std::string const&) setobject.cc: Store::setObject(std::string const&) setsource.cc: Store::setSource(std::string const&) ) manpagebugs() No bugs reported manpagesection(ABOUT) In theory, creating cross reference listings is a complex matter as it requires a full syntax analysis of the sources defining a program. Especially with complex languages like bf(C++) this is a difficult hurdle to pass. Looking for `cross reference programs' using a search engine returns remarkably few hits. LXR is a promising cross referencing program (see lurl(http://lxr.linux.no/)), but it requires the use of data base packages, making it somewhat complex to use. Other links refer to cross-reference programs for textual documents, not programs. The complexity of developing a program generating a cross reference listing has baffled me for a long time. Eventually I realized that in practice the essential information has already been generated by the compiler, when it compiles our source files. So why do it all again? Once a program has been compiled one or (usually) more object files are available. The linker uses tables of defined and external symbols embedded in the object files to connect the various functions. If all requirements can be satisfied the linker is able to create a running program. Programs like bf(nm)(1) and bf(objdump)(1) can be used to produce human readable output from the information embedded in object files. tt(Oxref) reads this information and organizes it, creating a cross reference listing. Since all compilable program languages generate identically organized object files (or maybe better: generate object files that can be interpreted by bf(objdump)(1)), tt(oxref) can broadly be applied. As long as bf(objdump)(1) produces sensible output tt(oxref) should be able to generate a cross reference listing. tt(Oxref)'s name consists of two syllables: tt(o) and tt(xref). The tt(o) represents the program bf(objdump)(1), called from tt(oxref) as a child program. The important part is of course the cross-referencing of symbols. Like the common abbreviation of em(rail-road crossing), em(rail-road xing), cross referencing is abbreviated to tt(xref). Hence tt(oxref). Of course, nearly everybody will read tt(oxref) as tt(ox-ref). Fortunately, here too we're on familiar ground: Bison, Cow, Gnu, Yacc: all are bovine animals. To that important list tt(oxref) adds the Ox. manpagefiles() An example of tt(oxref)'s own cross reference listing is provided (on Debian systems) in the file verb( /usr/share/doc/oxref/oxref.xref.gz ) manpageseealso() bf(nm)(1), bf(objdump)(1), bf(pattern)(3bobcat), bf(regex)(7) manpageauthor() Frank B. Brokken (f.b.brokken@rug.nl). oxref-2.02.00/gpl-3.0.txt0000644000175000017500000010451514516432277013624 0ustar frankfrank GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS 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 state 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) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program 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, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU 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 Lesser General Public License instead of this License. But first, please read . oxref-2.02.00/header.cc0000644000175000017500000000100414516432277013527 0ustar frankfrank#include "main.ih" void header(int argc, char **argv) { Arg &arg = Arg::instance(); cout << arg.basename() << " by " << Icmbuild::author << '\n' << arg.basename() << " V " << Icmbuild::version << ' ' << Icmbuild::years << "\n" "\n" "CREATED " << DateTime().rfc2822() << "\n" "OXREF ARGUMENTS: "; copy(argv + 1, argv + argc, ostream_iterator(cout, " ")); cout << "\n" "\n"; } oxref-2.02.00/icmake/0000775000175000017500000000000014641275571013231 5ustar frankfrankoxref-2.02.00/icmake/destinstall0000664000175000017500000000072114641274472015501 0ustar frankfrankvoid destInstall(string dest, string base) { chdir(g_cwd + base); // go to the base directory // (e.g., install/b) // install the entries under the base directory to (= below) dest, // which could be / or /tmp/whatever/ // They are not yet logged: to log installed entries call // logInstalled(dest, section) run(g_cwd + "icmake/installer " + dest + "/ "); // install the files } oxref-2.02.00/icmake/setopt0000664000175000017500000000034114641274472014467 0ustar frankfrankstring setOpt(string install_im, string envvar) { list optvar; string ret; optvar = getenv(envvar); if (optvar[0] == "1") ret = optvar[1]; else ret = install_im; return ret; } oxref-2.02.00/icmake/installer0000775000175000017500000000050714641274472015155 0ustar frankfrank#!/bin/bash if [ $# -eq 0 ] ; then echo destination path, ending in /, must be provided exit 0 fi for src in `find -mindepth 1 -type d` # create missing target dirs do [ ! -e $1$src ] && mkdir -p $1$src done for file in `find -type f -or -type l` do cp -d --preserve=timestamps $file $1$file done oxref-2.02.00/icmake/manpage0000664000175000017500000000044514641275254014565 0ustar frankfrank#define MANPAGE "../../tmp/man/" #define MANHTML "../../tmp/manhtml/" void manpage() { md("tmp/man tmp/manhtml"); chdir("documentation/man"); run("yodl2man -o " MANPAGE "oxref.1 oxref.yo"); run("yodl2html -o " MANHTML "oxrefman.html oxref.yo"); exit(0); } oxref-2.02.00/icmake/findall0000664000175000017500000000144614641274472014571 0ustar frankfrank// assuming we're in g_cwd, all entries of type 'type' matching source/pattern // are returned w/o final \n list findAll(string type, string source, string pattern) { string cmd; list entries; list ret; int idx; chdir(source); cmd = "find ./ -mindepth 1 -maxdepth 1 -type " + type; if (pattern != "") pattern = "-name '" + pattern + "'"; entries = backtick(cmd + " " + pattern + " -printf \"%f\\n\""); idx = listlen(entries); // get # entries, if (idx > 0 && strlen(entries[0]) > 0) // failure: idx = 0, none { // found: entries[0] is empty for (idx = listlen(entries); idx--; ) ret += (list)cutEoln(entries[idx]); } chdir(g_cwd); return ret; } oxref-2.02.00/icmake/log0000775000175000017500000000064714641274472013746 0ustar frankfrank#!/bin/bash find tmp/install/$1 -type f -exec md5sum "{}" \; | sed 's|tmp/install/'$1'|'$2'|' >> $3 find tmp/install/$1 -type l -exec printf "link %s\n" "{}" \; | sed 's|tmp/install/'$1'|'$2'|' >> $3 find tmp/install/$1 -type d -exec printf "dir %s\n" "{}" \; | sed 's|tmp/install/'$1'|'$2'|' >> $3 oxref-2.02.00/icmake/adddir0000664000175000017500000000112514641274472014401 0ustar frankfranklist addDir(list dir, string entry) { list ret; int idx; int keep = 1; string elem; for (idx = listlen(dir); idx--; ) { elem = dir[idx]; if (strfind(entry, elem) != -1) // entry contains dir, ignore dir ret += (list)entry; else if (strfind(elem, entry) != -1) // dir contains entry { ret += (list)elem; keep = 0; } else // new unique entry, keep dir[idx] ret += (list)elem; } if (keep) ret += (list)entry; return ret; } oxref-2.02.00/icmake/pathfile0000664000175000017500000000055214641274472014751 0ustar frankfranklist path_file(string path) { list ret; int len; int idx; for (len = strlen(path), idx = len; idx--; ) { if (path[idx] == "/") { ret = (list)substr(path, 0, idx) + (list)substr(path, idx + 1, len); return ret; } } ret = (list)"" + (list)path; return ret; } oxref-2.02.00/icmake/loginstalled0000664000175000017500000000060014641274472015630 0ustar frankfrankvoid logInstalled(string dest, string section) { if (g_logPath != "") { chdir(g_cwd); // The log-script is a bash script writing the log-info of // files, links and dirs to g_logpath // Files to install are under tmp/install/section. // backtick("icmake/log " + section + " " + dest + " " + g_logPath); } } oxref-2.02.00/icmake/clean0000664000175000017500000000113314641274472014233 0ustar frankfrankvoid clean(int dist) { run("rm -rf " "build-stamp configure-stamp " "options/SKEL " "tmp/*.o" + " o */o release.yo tmp/lib*.a " "parser/grammar.output " "spch main.ih.gch */*.ih.gch" ); if (dist) run("rm -rf tmp a */a" ); chdir("documentation"); run("rm -rf " "man/*.1 " "man/*.3* " "man/*.html " "manual/*.html " "manual/invoking/usage " "manual/invoking/usage.txt " "usage/usage " ); exit(0); } oxref-2.02.00/icmake/uninstall0000664000175000017500000000045614641274472015171 0ustar frankfrankvoid uninstall(string logfile) { int idx; list entry; string dir; list line; if (!exists(logfile)) { printf("installation log file " + logfile + " not found\n"); exit(0); } run("icmake/remove " + logfile + " " + (string)g_echo); exit(0); } oxref-2.02.00/icmake/cuteoln0000664000175000017500000000011314641274472014617 0ustar frankfrankstring cutEoln(string text) { return resize(text, strlen(text) - 1); } oxref-2.02.00/icmake/run0000664000175000017500000000015114641274472013754 0ustar frankfrankvoid run(string cmd) { if (g_echo == OFF) cmd += "> /dev/null 2>&1"; system(0, cmd); } oxref-2.02.00/icmake/logfiles0000664000175000017500000000034214641274472014756 0ustar frankfrankvoid logFiles(string source, string dest) { list files; int idx; echo(OFF); files = `"(chdir " + source + ";find ./ -type f)"`; for (idx = listlen(files); idx--; ) log(dest + "/" + files[idx]); } oxref-2.02.00/icmake/md0000664000175000017500000000074014641274472013554 0ustar frankfrank// md: target should be a series of blank-delimited directories to be created // If an element is a whildcard, the directory will always be created, // using mkdir -p. // // uses: run() void md(string target) { int idx; list paths; string dir; if (!exists(target)) run("mkdir -p " + target); else if (((int)stat(target)[0] & S_IFDIR) == 0) { printf(target + " exists, but is not a directory\n"); exit(1); } } oxref-2.02.00/icmake/gitlab0000664000175000017500000000023014641274472014410 0ustar frankfrankvoid gitlab() { run("cp -r release.yo tmp/manhtml/*.html tmp/manual " "../../wip"); run("cp changelog ../../wip/changelog.txt"); exit(0); } oxref-2.02.00/icmake/remove0000775000175000017500000000117014641274472014452 0ustar frankfrank#!/bin/bash g_echo=$2 rm_f() { [ $g_echo -ne 0 ] && echo rm $1 rm -f $1 } rm_dir() { [ $g_echo -ne 0 ] && echo rmdir $1 rmdir --ignore-fail-on-non-empty -p $1 } IFS=" " for line in `cat $1` do field1=`echo $line | awk '{printf $1}'` field2=`echo $line | awk '{printf $2}'` if [ $field1 == "link" ] ; then rm_f $field2 elif [ $field1 == "dir" ] ; then rm_dir $field2 elif [ -e "$field2" ] ; then if [ "$field1" != "`md5sum $field2 | awk '{printf $1}'`" ] ; then echo $field2 changed, not removed else rm_f $field2 fi fi done rm_f $1 oxref-2.02.00/icmake/backtick0000664000175000017500000000016014641274472014723 0ustar frankfranklist backtick(string arg) { list ret; echo(OFF); ret = `arg`; echo(g_echo); return ret; } oxref-2.02.00/icmake/install0000664000175000017500000000546214641275571014631 0ustar frankfrankint g_components; string testRequest(string request, string key, int value) { int idx = strfind(request, key); if (idx == -1) return request; int len = strlen(request); string ret; if (idx > 0) ret = substr(request, 0, idx); if (++idx < len) ret += substr(request, idx, len); g_components |= value; return ret; } void install(string request, string dest) { string target; list pathsplit; string base; base = "tmp/install/"; md(base); if (request == "x") { g_components = 63; request = ""; } else { request = testRequest(request, "a", 1); // additional info request = testRequest(request, "b", 2); // binary program request = testRequest(request, "d", 4); // std documentation request = testRequest(request, "m", 8); // man-pages request = testRequest(request, "s", 16); // skeleton files request = testRequest(request, "u", 32); // use guide } if (g_components == 0 || strlen(request) != 0) { printf("'build install selection ...': 'selection' must be x or " "chars. of [abdsmu]\n"); exit(1); } chdir(g_cwd); // determine the destination path if (dest == "") dest = "/"; else md(dest); dest = cutEoln(backtick("readlink -f " + dest)[0]); if (g_logPath != "") exec(P_NOCHECK, "rm -f " + g_logPath); if (g_components & 2) { target = base + "b/" BINARY; pathsplit = path_file(target); // copy srdir/src to destdir/dest, where destdir also contains // the topic-icentifier (e.g., b in tmp/install/b) logFile("tmp/bin", "binary", pathsplit[0], pathsplit[1]); destInstall(dest, base + "b"); logInstalled(dest, "b"); } if (g_components & (4 | 8)) { target = base + "d/" DOC "/"; if (g_components & 4) { printf(" installing the changelog at `", target, "\n"); logZip("", "changelog", target ); destInstall(dest, base + "d"); } if (g_components & 8) { printf(" installing the html-manual pages at `", target, "\n"); logInstall("tmp/manhtml", "", target); destInstall(dest, base + "d"); } logInstalled(dest, "d"); } if (g_components & 8) { target = base + "m/" MAN; printf(" installing the manual pages below `", target, "'\n"); target = base + "m/" MAN "/man1/"; logZip("tmp/man", "oxref.1", target); destInstall(dest, base + "m"); logInstalled(dest, "m"); } printf("\n Installation completed\n"); exit(0); } oxref-2.02.00/icmake/logfile0000664000175000017500000000045214641274472014575 0ustar frankfrankvoid logFile(string srcdir, string src, string destdir, string dest) { chdir(g_cwd); md(destdir); // copy srdir/src to destdir/dest, where destdir also contains the // topic-icentifier (e.g., b in tmp/install/b) run("cp " + srcdir + "/" + src + " " + destdir + "/" + dest); } oxref-2.02.00/icmake/loginstall0000664000175000017500000000156514641274472015332 0ustar frankfrank// source and dest, absolute or reachable from g_cwd, should exist. // files and links in source matching dest (if empty: all) are copied to dest // and are logged in g_log // Before they are logged, dest is created void logInstall(string src, string pattern, string dest) { list entries; int idx; chdir(g_cwd); md(dest); src += "/"; dest += "/"; if (listlen(makelist(O_DIR, src)) == 0) { printf("Warning: ", src, " not found: can't install ", src, pattern, " at ", dest, "\n"); return; } entries = findAll("f", src, pattern); for (idx = listlen(entries); idx--; ) run("cp " + src + entries[idx] + " " + dest); chdir(g_cwd); entries = findAll("l", src, pattern); for (idx = listlen(entries); idx--; ) run("cp " CPOPTS " " + src + entries[idx] + " " + dest); } oxref-2.02.00/icmake/logrecursive0000664000175000017500000000111114641274472015656 0ustar frankfrank// log recursively all files and directories in src as entries in dest // dest is created if necessary void logRecursive(string src, string dest) { list dirs; string next; int idx; chdir(g_cwd); if (!exists(src)) { printf("skipping unavailable directory `", src, "'\n"); return; } dirs = findAll("d", src, ""); // find all subdirs for (idx = listlen(dirs); idx--; ) // visit all subdirs { next = "/" + dirs[idx]; logRecursive(src + next, dest + next); } logInstall(src, "", dest); } oxref-2.02.00/icmake/special0000664000175000017500000000042114641275422014564 0ustar frankfrankvoid special() { if (! exists("release.yo") || "VERSION" newer "release.yo") { system("touch version.cc"); run("gcc -E VERSION.h | grep -v '#' | sed 's/\\\"//g' > " "release.yo"); } } oxref-2.02.00/icmake/logzip0000664000175000017500000000165614641274472014467 0ustar frankfrank// names may be a series of files in src, not a wildcard. // if it's empty then all files in src are used. // the files are gzipped and logged in dest. // src and dest do not have to end in / void logZip(string src, string names, string dest) { list files; int idx; string file; chdir(g_cwd); md(dest); dest += "/"; if (src != "") { if (listlen(makelist(O_DIR, src)) == 0) { printf("Warning: ", src, " not found: can't install ", src, names, " at ", dest, "\n"); return; } chdir(src); } if (names == "") files = makelist("*"); else files = strtok(names, " "); for (idx = listlen(files); idx--; ) { file = files[idx]; run("gzip -n -9 < " + file + " > " + file + ".gz"); } run("tar cf - *.gz | (cd " + g_cwd + "; cd " + dest + "; tar xf -)"); run("rm *.gz"); } oxref-2.02.00/icmconf0000644000175000017500000000113114641430242013317 0ustar frankfrank#include "INSTALL.im" #define MAIN "main.cc" #define ADD_LIBRARIES "bobcat" #define ADD_LIBRARY_PATHS "" #define REFRESH #define LIBRARY "modules" #define SHAREDREQ "" #define USE_ALL "a" #define SOURCES "*.cc" #define USE_ECHO ON #define TMP_DIR "tmp" #define OBJ_EXT ".o" #define USE_VERSION #define DEFCOM "program" #define IH ".ih" //#define PRECOMP "-x c++-header" #define MULTICOMP "jobs -q" #define SPCH "-k xerr/xerr.ih" oxref-2.02.00/INSTALL0000644000175000017500000000746314516432277013040 0ustar frankfrankTo install oxref by hand instead of using a binary distribution perform the following steps: 0. oxref and its construction depends, in addition to the normally standard available system software on specific software and versions which is documented in the file `required'. (If you compile the bobcat library yourself, note that oxref does not use the SSL, Milter and Xpointer classes; they may --as far as oxref is concerned-- be left out of the library by running './build light') 1. It is expected you use icmake for the package construction. For this a top-level script (build) and support scripts in the ./icmake/ directory are available. By default, the 'build' script echoes the commands it executes to the standard output stream. By specifying the option -q (e.g., ./build -q ...) this is prevented, significantly reducing the output generated by 'build'. 2. Inspect the values of the variables in the file INSTALL.im Modify these when necessary. 3. Run ./build program [strip] to compile oxref. The argument `strip' is optional and strips symbolic information from the final executable. 4. If you installed Yodl then you can create the documentation: ./build man builds the man-page. 5. Before installing the components of oxref, consider defining the environment variable OXREF, defining its value as the (preferably absolute) filename of a file on which installed files and directories are logged. Defining the OXREF environment variable as ~/.oxref usually works well. 6. Run (probably as root) ./build install 'what' 'base' to install. Here, 'what' specifies what you want to install. Specify: x, to install all components, or specify a combination of: b (binary program), d (standard documentation), m (man-pages) E.g., use ./build install bm 'base' if you only want to be able to run oxref, and want its man-page to be installed below 'base'. ./build install's last argument 'base' is optional: the base directory below which the requested files are installed. This base directory is prepended to the paths #defined in the INSTALL.im file. If 'base' is not specified, then INSTALL.im's #defined paths are used as-is. When requesting non-existing elements (e.g., './build install x' was requested, but the man-pages weren't constructed) then these non-existing elements are silently ignored by the installation process. If the environment variable OXREF was defined when issuing the `./build install ...' command then a log of all installed files is written to the file indicated by the OXREF environment variable (see also the next item). Defining the OXREF environment variable as ~/.oxref usually works well. 7. Uninstalling previously installed components of oxref is easy if the environment variable OXREF was defined before issuing the `./build install ...' command. In that case, run the command ./build uninstall logfile where 'logfile' is the file that was written by ./build install. Modified files and non-empty directories are not removed, but the logfile itself is removed following the uninstallation. 8. Following the installation nothing in the directory tree which contains this file (i.e., INSTALL) is required for the proper functioning of oxref, so consider removing it. If you only want to remove left-over files from the build-process, just run ./build distclean oxref-2.02.00/INSTALL.im0000644000175000017500000000054714516432277013440 0ustar frankfrank#define PROGRAM "oxref" #define CXX "g++" #define CXXFLAGS "-Wall -Werror -O2 -fdiagnostics-color=never" #define LDFLAGS "" #define CPOPTS // ABSOLUTE DIRECTORY NAMES: #define BINARY "/usr/bin/"${PROGRAM} #define DOC "/usr/share/doc/"${PROGRAM} #define MAN "/usr/share/man/man1" oxref-2.02.00/LICENSE0000644000175000017500000010451514641433750013004 0ustar frankfrank GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS 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 state 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) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program 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, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU 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 Lesser General Public License instead of this License. But first, please read . oxref-2.02.00/LICENSE.txt0000644000175000017500000000035214516432277013620 0ustar frankfrankOxref is made available under the copyright rules of the Gnu Public License (GPL version 3 -or later-. The GPL text is available in oxref's repository/distribution as the file gpl.txt. (cf. https://www.gnu.org/licenses/gpl-3.0.txt) oxref-2.02.00/main.cc0000644000175000017500000000344314516432277013234 0ustar frankfrank#include "main.ih" namespace { Arg::LongOption longOptions[] = { {"arg", 'a'}, {"called-by", 'c'}, {"full-symbol", 'f'}, {"help", 'h'}, {"no-xref", 'X'}, {"objdump", Arg::Required}, {"object-files", 'o'}, {"replace", 'R'}, // single replacements {"replace-file", 'r'}, // replacements on file {"select", Arg::Required}, {"select-pattern", Arg::Required}, {"source-files", 's'}, {"tree", 't'}, {"version", 'v'}, {"xref-source-files", 'x'}, }; Arg::LongOption const *const longEnd = longOptions + size(longOptions); } int main(int argc, char **argv) try { Arg &arg = Arg::initialize("a:c:fhor:R:st:vxX", longOptions, longEnd, argc, argv); arg.versionHelp(usage, version, 1); ObjDump odump; Storage storage; odump.start(); // generate objdump's output // insert objdump's lines into Storage, whose // push_back member does all the hard work. copy(odump.begin(), odump.end(), back_inserter(storage)); header(argc, argv); // output the program's header storage.xref(); // maybe show the cross-reference info storage.tree(); // maybe show the call-tree storage.calledBy(); // maybe show the called-by hierarchy } catch (std::exception const &e) { cout << e.what() << '\n'; return 1; } catch (int x) { return Arg::instance().option("hv") ? 0 : x; } catch (...) { cout << "Caught unaccounted for exception\n"; return 1; } oxref-2.02.00/main.ih0000644000175000017500000000071414641275600013237 0ustar frankfrank#include #include #include #include #include #include #include "storage/storage.h" #include "objdump/objdump.h" namespace Icmbuild { extern char version[]; extern char years[]; extern char author[]; }; void header(int argc, char **argv); void usage(std::string const &progname); #ifndef SPCH_ using namespace std; using namespace FBB; using namespace Icmbuild; #endif oxref-2.02.00/objdump/0000755000175000017500000000000014641433710013425 5ustar frankfrankoxref-2.02.00/objdump/objdump.ih0000644000175000017500000000023614641275600015412 0ustar frankfrank#include "objdump.h" #include #include #include #ifndef SPCH_ using namespace std; using namespace FBB; #endif oxref-2.02.00/objdump/constiterator1.cc0000644000175000017500000000024514516432277016726 0ustar frankfrank#include "objdump.ih" ObjDump::const_iterator::const_iterator(Process *process, bool iterate) : d_process(process), d_iterate(iterate) { ++*this; } oxref-2.02.00/objdump/objdump1.cc0000644000175000017500000000066614516432277015475 0ustar frankfrank#include "objdump.ih" ObjDump::ObjDump() : d_process(Process::COUT) { Arg &arg = Arg::instance(); string odump; if (!arg.option(&odump, "objdump")) odump = "/usr/bin/objdump -C -t"; d_process.setCommand(odump); for_each( arg.argPointers(), arg.argPointers() + arg.nArgs(), [&](string const &arg) { d_process += " "; d_process += arg; } ); } oxref-2.02.00/objdump/objdump.h0000644000175000017500000000367314516432277015257 0ustar frankfrank#ifndef INCLUDED_OBJDUMP_ #define INCLUDED_OBJDUMP_ #include #include class ObjDump // merely calls 'objdump', { // the iterator range produces all FBB::Process d_process; // of objdump's output public: class const_iterator; const_iterator begin(); // called in main, passed the output line const_iterator end(); // to Storage::push_back ObjDump(); void start(); }; struct ObjDump::const_iterator { friend const_iterator ObjDump::begin(); friend const_iterator ObjDump::end(); using iterator_category = std::input_iterator_tag; using difference_type = std::ptrdiff_t; using value_type = std::string; using pointer = value_type *; using reference = value_type &; private: FBB::Process *d_process; mutable bool d_iterate; mutable std::string d_line; const_iterator(FBB::Process *process, bool iterate); public: const_iterator &operator++(); bool operator==(const_iterator const &other) const; bool operator!=(const_iterator const &other) const; std::string const &operator*() const; std::string const *operator->() const; }; inline void ObjDump::start() { d_process.start(); } inline ObjDump::const_iterator ObjDump::begin() { return const_iterator(&d_process, true); } inline ObjDump::const_iterator ObjDump::end() { return const_iterator(&d_process, false); } inline bool ObjDump::const_iterator::operator!=(const_iterator const &rhs) const { return not (*this == rhs); } inline std::string const &ObjDump::const_iterator::operator*() const { return d_line; } inline std::string const *ObjDump::const_iterator::operator->() const { return &d_line; } #endif oxref-2.02.00/objdump/prefixinc.cc0000644000175000017500000000076514516432277015743 0ustar frankfrank#include "objdump.ih" ObjDump::const_iterator &ObjDump::const_iterator::operator++() { if (d_iterate) d_iterate = std::getline(*d_process, d_line).good(); return *this; } /* begin: initialize to true end: initialize to false while (begin != end) // if d_iterate is true: reassign by // getline(*d_process, ...), then compare both // d_iterate-s, { cout << *begin; ++begin; } */ oxref-2.02.00/objdump/operatorequal.cc0000644000175000017500000000026014516432277016625 0ustar frankfrank#include "objdump.ih" bool ObjDump::const_iterator::operator==(const_iterator const &other) const { return d_iterate == other.d_iterate && d_process == other.d_process; } oxref-2.02.00/oxref.xref0000644000175000017500000003043414516432277014012 0ustar frankfrankbinary by Frank B. Brokken (f.b.brokken@rug.nl) binary V2.00.03 2012-2022 CREATED Sun, 11 Sep 2022 07:37:11 +0000 CROSS REFERENCE FOR: -t main -r replacements -fxs tmp/main.o tmp/libmodules.a ---------------------------------------------------------------------- CROSS REFERENCE LISTING: author Full name: Icmbuild::author Source: version.cc Used By: header.cc: header(int, char**) usage.cc: usage(std::string const&) calledFrom(unsigned long) Full name: XrefData::calledFrom(unsigned long) Source: calledfrom.cc Used By: undefined.cc: Store::undefined(std::string const&) calls(unsigned long, unsigned long) Full name: Tree::calls(unsigned long, unsigned long) Source: calls1.cc Used By: print.cc: Tree::print(unsigned long, unsigned long) calls(unsigned long, XrefData const&) Full name: Tree::calls(unsigned long, XrefData const&) Source: calls2.cc Used By: calls1.cc: Tree::calls(unsigned long, unsigned long) const_iterator(FBB::Process*, bool) Full name: ObjDump::const_iterator::const_iterator(FBB::Process*, bool) Source: constiterator1.cc Used By: main.cc: main ctor() Full name: XrefData::ctor() Source: ctor.cc Used By: xrefdata2.cc: XrefData::XrefData(std::string const&, std::string const&, bool, std::string const&) xrefdata3.cc: XrefData::XrefData(std::string const&) define(std::string const&, bool) Full name: Store::define(std::string const&, bool) Source: define.cc Used By: setfunction.cc: Store::setFunction(std::string const&) setobject.cc: Store::setObject(std::string const&) setsource.cc: Store::setSource(std::string const&) defined(std::ostream&) const Full name: XrefData::defined(std::ostream&) const Source: defined.cc Used By: insertdefined.cc: Store::insertDefined(unsigned long, std::ostream&, std::vector const&) eraseParam(unsigned long) Full name: XrefData::eraseParam(unsigned long) Source: eraseparam.cc Used By: keepfirst.cc: XrefData::keepFirst(unsigned long) eraseParam(unsigned long, unsigned long) Full name: XrefData::eraseParam(unsigned long, unsigned long) Source: eraseparam2.cc Used By: reducelen.cc: XrefData::reduceLen(unsigned long, unsigned long) findSymbol(XrefData const&, std::string const&) Full name: Store::findSymbol(XrefData const&, std::string const&) Source: findsymbol.cc Used By: symbolidx.cc: Store::symbolIdx(std::string const&) const function(std::string const&) Full name: Storage::function(std::string const&) Source: function.cc Used By: pushback.cc: Storage::push_back(std::string) hasSymbol(std::string const&) const Full name: XrefData::hasSymbol(std::string const&) const Source: hassymbol.cc Used By: define.cc: Store::define(std::string const&, bool) undefined.cc: Store::undefined(std::string const&) header(int, char**) Full name: header(int, char**) Source: header.cc Used By: main.cc: main indent(unsigned long) const Full name: Tree::indent(unsigned long) const Source: indent.cc Used By: print.cc: Tree::print(unsigned long, unsigned long) insert(std::ostream&, std::string const&, bool) const Full name: Store::insert(std::ostream&, std::string const&, bool) const Source: insert.cc Used By: insertinto.cc: Store::insertInto(std::ostream&) const insertDefined(unsigned long, std::ostream&, std::vector const&) Full name: Store::insertDefined(unsigned long, std::ostream&, std::vector const&) Source: insertdefined.cc Used By: insert.cc: Store::insert(std::ostream&, std::string const&, bool) const insertinto.cc: Store::insertInto(std::ostream&) const insertInto(std::ostream&) const Full name: Store::insertInto(std::ostream&) const Source: insertinto.cc Used By: xref.cc: Storage::xref() const isDefined(std::string const&) const Full name: XrefData::isDefined(std::string const&) const Source: isdefined.cc Used By: define.cc: Store::define(std::string const&, bool) keepFirst(unsigned long) Full name: XrefData::keepFirst(unsigned long) Source: keepfirst.cc Used By: setcooked.cc: XrefData::setCooked() ObjDump() Full name: ObjDump::ObjDump() Source: objdump1.cc Used By: main.cc: main object(std::string const&) Full name: Storage::object(std::string const&) Source: object.cc Used By: pushback.cc: Storage::push_back(std::string) objFile(std::string const&) Full name: Storage::objFile(std::string const&) Source: objfile.cc Used By: pushback.cc: Storage::push_back(std::string) operator++() Full name: ObjDump::const_iterator::operator++() Source: prefixinc.cc Used By: main.cc: GLOBALS main.cc tmp/main.o constiterator1.cc: ObjDump::const_iterator::const_iterator(FBB::Process*, bool) operator==(ObjDump::const_iterator const&) const Full name: ObjDump::const_iterator::operator==(ObjDump::const_iterator const&) const Source: operatorequal.cc Used By: main.cc: GLOBALS main.cc tmp/main.o print(unsigned long, unsigned long) Full name: Tree::print(unsigned long, unsigned long) Source: print.cc Used By: tree.cc: Store::tree(std::string const&) const push_back(std::string) Full name: Storage::push_back(std::string) Source: pushback.cc Used By: main.cc: GLOBALS main.cc tmp/main.o reduceLen(unsigned long, unsigned long) Full name: XrefData::reduceLen(unsigned long, unsigned long) Source: reducelen.cc Used By: setcooked.cc: XrefData::setCooked() reduceToCount(unsigned long, unsigned long) Full name: XrefData::reduceToCount(unsigned long, unsigned long) Source: reducetocount.cc Used By: setcooked.cc: XrefData::setCooked() replacementFile(std::string const&) Full name: Storage::replacementFile(std::string const&) Source: replacementfile.cc Used By: storage1.cc: Storage::Storage() replacements(std::string&) const Full name: Storage::replacements(std::string&) const Source: replacements.cc Used By: pushback.cc: Storage::push_back(std::string) s_abs Full name: Storage::s_abs Source: data.cc Used By: pushback.cc: Storage::push_back(std::string) s_g_F Full name: Storage::s_g_F Source: data.cc Used By: pushback.cc: Storage::push_back(std::string) s_g_O Full name: Storage::s_g_O Source: data.cc Used By: pushback.cc: Storage::push_back(std::string) s_objFile Full name: Storage::s_objFile Source: data.cc Used By: pushback.cc: Storage::push_back(std::string) s_reject Full name: Storage::s_reject Source: data.cc Used By: pushback.cc: Storage::push_back(std::string) s_UND Full name: Storage::s_UND Source: data.cc Used By: pushback.cc: Storage::push_back(std::string) setCooked() Full name: XrefData::setCooked() Source: setcooked.cc Used By: ctor.cc: XrefData::ctor() setFunction(std::string const&) Full name: Store::setFunction(std::string const&) Source: setfunction.cc Used By: function.cc: Storage::function(std::string const&) setLocation(std::string const&, std::string const&) Full name: XrefData::setLocation(std::string const&, std::string const&) Source: setlocation.cc Used By: define.cc: Store::define(std::string const&, bool) setObject(std::string const&) Full name: Store::setObject(std::string const&) Source: setobject.cc Used By: object.cc: Storage::object(std::string const&) setObjfile(std::string const&) Full name: Store::setObjfile(std::string const&) Source: setobjfile.cc Used By: objfile.cc: Storage::objFile(std::string const&) setSource(std::string const&) Full name: Store::setSource(std::string const&) Source: setsource.cc Used By: sourcefile.cc: Storage::sourceFile(std::string const&) skipTemplate(unsigned long) const Full name: XrefData::skipTemplate(unsigned long) const Source: skiptemplate.cc Used By: eraseparam.cc: XrefData::eraseParam(unsigned long) eraseparam2.cc: XrefData::eraseParam(unsigned long, unsigned long) reducetocount.cc: XrefData::reduceToCount(unsigned long, unsigned long) sourceFile(std::string const&) Full name: Storage::sourceFile(std::string const&) Source: sourcefile.cc Used By: pushback.cc: Storage::push_back(std::string) Storage() Full name: Storage::Storage() Source: storage1.cc Used By: main.cc: main Store() Full name: Store::Store() Source: store1.cc Used By: storage1.cc: Storage::Storage() storeReplacement(std::string const&, std::string const&) Full name: Storage::storeReplacement(std::string const&, std::string const&) Source: storereplacement.cc Used By: replacementfile.cc: Storage::replacementFile(std::string const&) storage1.cc: Storage::Storage() symbolIdx(std::string const&) const Full name: Store::symbolIdx(std::string const&) const Source: symbolidx.cc Used By: tree.cc: Store::tree(std::string const&) const tree() const Full name: Storage::tree() const Source: tree.cc Used By: main.cc: main tree(std::string const&) const Full name: Store::tree(std::string const&) const Source: tree.cc Used By: tree.cc: Storage::tree() const undefined(std::string const&) Full name: Store::undefined(std::string const&) Source: undefined.cc Used By: undefined.cc: Storage::undefined(std::string const&) undefined(std::string const&) Full name: Storage::undefined(std::string const&) Source: undefined.cc Used By: pushback.cc: Storage::push_back(std::string) usage(std::string const&) Full name: usage(std::string const&) Source: usage.cc Used By: main.cc: main usedBy(unsigned long, std::ostream&, std::vector const&) Full name: Store::usedBy(unsigned long, std::ostream&, std::vector const&) Source: usedby.cc Used By: insertdefined.cc: Store::insertDefined(unsigned long, std::ostream&, std::vector const&) version Full name: Icmbuild::version Source: version.cc Used By: main.cc: main header.cc: header(int, char**) usage.cc: usage(std::string const&) xref() const Full name: Storage::xref() const Source: xref.cc Used By: main.cc: main XrefData(std::string const&) Full name: XrefData::XrefData(std::string const&) Source: xrefdata3.cc Used By: undefined.cc: Store::undefined(std::string const&) XrefData(std::string const&, std::string const&, bool, std::string const&) Full name: XrefData::XrefData(std::string const&, std::string const&, bool, std::string const&) Source: xrefdata2.cc Used By: define.cc: Store::define(std::string const&, bool) years Full name: Icmbuild::years Source: version.cc Used By: header.cc: header(int, char**) usage.cc: usage(std::string const&) ---------------------------------------------------------------------- CALL TREE FOR: main main +-usage(std::string const&) | +-Icmbuild::version | +-Icmbuild::author | +-Icmbuild::years +-Icmbuild::version +-ObjDump::ObjDump() +-Storage::Storage() | +-Storage::replacementFile(std::string const&) | | +-Storage::storeReplacement(std::string const&, std::string const&) | +-Storage::storeReplacement(std::string const&, std::string const&) | +-Store::Store() +-ObjDump::const_iterator::const_iterator(FBB::Process*, bool) | +-ObjDump::const_iterator::operator++() +-header(int, char**) | +-Icmbuild::version | +-Icmbuild::author | +-Icmbuild::years +-Storage::xref() const | +-Store::insertInto(std::ostream&) const | +-Store::insert(std::ostream&, std::string const&, bool) const | | +-Store::insertDefined(unsigned long, std::ostream&, std::vector const&) | | +-XrefData::defined(std::ostream&) const | | +-Store::usedBy(unsigned long, std::ostream&, std::vector const&) | +-Store::insertDefined(unsigned long, std::ostream&, std::vector const&) | +-XrefData::defined(std::ostream&) const | +-Store::usedBy(unsigned long, std::ostream&, std::vector const&) +-Storage::tree() const +-Store::tree(std::string const&) const +-Store::symbolIdx(std::string const&) const | +-Store::findSymbol(XrefData const&, std::string const&) +-Tree::print(unsigned long, unsigned long) +-Tree::calls(unsigned long, unsigned long) | +-Tree::calls(unsigned long, XrefData const&) +-Tree::indent(unsigned long) const oxref-2.02.00/README.data0000644000175000017500000000211614516432277013565 0ustar frankfrankStorage: 'Store d_store' storing the data. "select" and "select-pattern": handled by Store::insertInto via Store::insert The entity to locate is assigned to its 'string entity'. State::insert calls State::insertDefined. State::insertDefined receives the Store: ====== XrefVector d_xrefVector std::vector d_defIdx; // indices of functions/objects XrefData: ========= XrefVector = std::vector; std::vector const &usedBy() // indices in std::string d_sourceFile; // defined, unless empty std::string d_objFile; bool d_isFunction; // true: function, false: object std::string d_refName; // full name of object or function std::string d_cooked; // name as processed by -a size_t d_nameIndex; // index where the proper name (after // its class/namespace) starts std::vector d_calledFrom; // returned by usedBy() oxref-2.02.00/replacements0000644000175000017500000000046414516432277014406 0ustar frankfrank // replace objdump's idea of what a string is by ours: #std::__cxx11::basic_string, std::allocator >#std::string# #, std::allocator ## #unsigned long#size_t# #, std::allocator ## #, std::hash## #, std::deque ## #, std::equal_to## oxref-2.02.00/required0000644000175000017500000000062514516432277013543 0ustar frankfrankThis file lists non-standard software only. Thus, standard utilities like cp, mv, sed, etc, etc, are not explicitly mentioned. Neither is the gcc compiler explicitly mentioned, but a fairly recent one is assumed. Required software for building Oxref ------------------------------------ Build-Depends: libbobcat-dev (>= 4.01.03) icmake (>= 8.00.04) yodl (>= 3.06.0) oxref-2.02.00/storage/0000755000175000017500000000000014641433710013431 5ustar frankfrankoxref-2.02.00/storage/data.cc0000644000175000017500000000143314516432277014662 0ustar frankfrank#include "storage.ih" Pattern Storage::s_reject ( "^.*\\*UND\\*\\s+\\d+\\s+_" "|" "vtable for" "|" "typeinfo for" "|" "virtual thunk to" ); Pattern Storage::s_objFile("^(.*):\\s+file format"); Pattern Storage::s_abs("^.*\\*ABS\\*\\s+[[:alnum:]]+\\s(.*)"); // 00000000 *UND* 00000000 std::ios_base::Init::Init() Pattern Storage::s_UND("^[[:alnum:]]+\\s+\\*UND\\*\\s+[[:alnum:]]+\\s(.*)"); // 00000090 g F .text 0000047f main // 00000090 g F .text 00000165 usage(std::string const&) Pattern Storage::s_g_F( "^[[:alnum:]]+\\s+g\\s+F\\s+\\S+\\s+[[:alnum:]]+\\s(.*)"); // 00000000 g O .data 00000008 Icmbuild::version Pattern Storage::s_g_O( "^[[:alnum:]]+\\s+g\\s+O\\s+\\S+\\s+[[:alnum:]]+\\s(.*)"); oxref-2.02.00/storage/storereplacement.cc0000644000175000017500000000124614516432277017327 0ustar frankfrank#include "storage.ih" void Storage::storeReplacement(string const &label, string const &spec) { int separator; if ( spec.length() < 3 or count(spec.begin(), spec.end(), separator = spec[0]) != 3 or spec.back() != separator ) throw Exception{} << label << ": invalid pattern `" << spec << '\''; size_t pos = spec.find(separator, 1); // find the middle sep. d_replacement.push_back( // store the pattern { spec.substr(1, pos - 1), spec.substr(pos + 1, spec.length() - pos - 2 ) } ); } oxref-2.02.00/storage/function.cc0000644000175000017500000000024514516432277015576 0ustar frankfrank#include "storage.ih" void Storage::function(std::string const &symbol) { // Note: symbols may repeatedly appear in objfiles d_store.setFunction(symbol); } oxref-2.02.00/storage/undefined.cc0000644000175000017500000000023314516432277015707 0ustar frankfrank#include "storage.ih" void Storage::undefined(std::string const &symbol) { //cout << "UNDEF'D: " << symbol << '\n'; d_store.undefined(symbol); } oxref-2.02.00/storage/replacementfile.cc0000644000175000017500000000064014516432277017107 0ustar frankfrank#include "storage.ih" void Storage::replacementFile(string const &fname) { ifstream in{ Exception::factory(fname) }; string label{ "pattern file `" + fname + '\'' }; string line; while (getline(in, line)) { line = String::trim(line); if (line.empty() or line.find("//") == 0) // empty or comment continue; storeReplacement(label, line); } } oxref-2.02.00/storage/pushback.cc0000644000175000017500000000163214516432277015552 0ustar frankfrank#include "storage.ih" // receives lines generated by oxref, processing them according to // the matched s_* patterns. void Storage::push_back(string line) { if (s_reject << line) return; replacements(line); if (s_objFile << line) // 1st line of a record, like objFile(s_objFile[1]); // tmp/main.o: file format ... else if (s_abs << line) // the source filename (if available) sourceFile(s_abs[1]); else if (s_UND << line) // *UND* entries are stored in undefined(s_UND[1]); // Store::d_xrefData: entities referred to by // the current function else if (s_g_F << line) // 'g F .text' entries define symbols function(s_g_F[1]); // in d_xrefData else if (s_g_O << line) // 'g O .data' entries define global data object(s_g_O[1]); // in d_xrefData } oxref-2.02.00/storage/sourcefile.cc0000644000175000017500000000030014516432277016101 0ustar frankfrank#include "storage.ih" void Storage::sourceFile(std::string const &fname) { //d_sourceFile = fname; //cout << "SOURCE FILE: " << d_sourceFile << '\n'; d_store.setSource(fname); } oxref-2.02.00/storage/objfile.cc0000644000175000017500000000015314516432277015361 0ustar frankfrank#include "storage.ih" void Storage::objFile(std::string const &fname) { d_store.setObjfile(fname); } oxref-2.02.00/storage/storage.ih0000644000175000017500000000343514641275600015426 0ustar frankfrank#include "storage.h" #include #include #include #include #include #include #include // "/bin/grep -E -v '" // "[[:space:]]_" // "|" // "archive" // "|" // "[[:space:]]\\.data" // "|" // "[[:space:]]\\.bss" // "|" // "[[:space:]]std::" // "|" // "[[:space:]]w[[:space:]]" // "|" // "__" // "|" // "[[:space:]]d[[:space:]]" // "|" // "SYMBOL[[:space:]]TABLE:" // "|" // "typeinfo[[:space:]]for" // "|" // "[[:space:]]l[[:space:]]+F[[:space:]]\\.text" // "'"); // // Pattern pattern( //// " .data" //// "|" // "^\\s*$" // "|" // "^In archive" // "|" // " .bss" // "|" // " std::" // "|" // "__" // "|" // " _" // "|" // " d " // "|" // " w " // "|" // " l\\s+F\\s\\.text" // "|" // "SYMBOL TABLE:" // "|" // "operator delete\\(void\\*\\)" // "|" // "typeinfo for ", // false); // case sensitive OFF // // // // { // if (not(pattern << line)) // cout << line << endl; // } #ifndef SPCH_ using namespace std; using namespace FBB; #endif oxref-2.02.00/storage/replacements.cc0000644000175000017500000000114114516432277016427 0ustar frankfrank#include "storage.ih" // replace contents of lines by replacement text. Format: // XencounteredXreplaceX void Storage::replacements(string &line) const { for (auto const &replace: d_replacement) { size_t srcLen = replace.first.length(); size_t dstLen = replace.second.length(); size_t pos = 0; while (true) { pos = line.find(replace.first, pos); if (pos == string::npos) // no more matches break; line.replace(pos, srcLen, replace.second); pos += dstLen; } } } oxref-2.02.00/storage/object.cc0000644000175000017500000000015214516432277015214 0ustar frankfrank#include "storage.ih" void Storage::object(std::string const &symbol) { d_store.setObject(symbol); } oxref-2.02.00/storage/tree.cc0000644000175000017500000000026014516432277014705 0ustar frankfrank#include "storage.ih" void Storage::tree() const { string symbol; if (d_arg.option(&symbol, 't')) // tree start symbol specified d_store.tree(symbol); } oxref-2.02.00/storage/xref.cc0000644000175000017500000000060214516432277014712 0ustar frankfrank#include "storage.ih" void Storage::xref() const { if (d_arg.option('X')) // no xref info requested return; cout << setfill('-') << setw(70) << '-' << setfill(' ') << "\n" "CROSS REFERENCE LISTING:\n" "\n" << d_store << '\n'; // store's insertion operator shows the // xreference info } oxref-2.02.00/storage/storage.h0000644000175000017500000000370014516432277015256 0ustar frankfrank#ifndef INCLUDED_STORAGE_ #define INCLUDED_STORAGE_ #include #include #include #include #include "../store/store.h" // see store.h for a description of the data-storage organization namespace FBB { class Arg; } class Storage { static FBB::Pattern s_reject; // rejected lines from objdump static FBB::Pattern s_objFile; static FBB::Pattern s_abs; static FBB::Pattern s_UND; static FBB::Pattern s_g_F; static FBB::Pattern s_g_O; FBB::Arg const &d_arg; Store d_store; // input lines 'first' text is replaced by 'second'. // Format: XfirstXsecondX where X is a separator char std::vector> d_replacement; public: typedef std::string value_type; typedef value_type const &const_reference; Storage(); // interpret lines from objdump // using the functions below void push_back(std::string line); void xref() const; // show the cross-reference info void tree() const; // show the call-tree of symbol -t void calledBy(); // show the (recursive) list of functions // calling the function's regex specified // by the --called-by (-c) option. private: void function(std::string const &symbol); void objFile(std::string const &fname); void sourceFile(std::string const &fname); void undefined(std::string const &symbol); void object(std::string const &symbol); void replacements(std::string &line) const; // perform replacements // in d_replacement void replacementFile(std::string const &fname); void storeReplacement(std::string const &what, std::string const &spec); }; #endif oxref-2.02.00/storage/storage1.cc0000644000175000017500000000076514516432277015505 0ustar frankfrank#include "storage.ih" Storage::Storage() : d_arg(Arg::instance()) { string spec; // process all 'R' replacements for (size_t idx = 0, end = d_arg.option('R'); idx != end; ++idx) { d_arg.option(idx, &spec, 'R'); // get the spec storeReplacement("-R option", spec); // store it. } if (d_arg.option(&spec, 'r')) // replacements file? replacementFile(spec); // then process its replacements } oxref-2.02.00/storage/calledby.cc0000644000175000017500000000024714516432277015532 0ustar frankfrank#include "storage.ih" void Storage::calledBy() { string spec; if (d_arg.option(&spec, 'c')) // no called-by requested d_store.calledBy(spec); } oxref-2.02.00/store/0000755000175000017500000000000014641433710013121 5ustar frankfrankoxref-2.02.00/store/setobject.cc0000644000175000017500000000022514516432277015421 0ustar frankfrank#include "store.ih" void Store::setObject(string const &symbol) { d_symbol = symbol; define(symbol, false); // false: define an object } oxref-2.02.00/store/checkglobals.cc0000644000175000017500000000256214641430264016057 0ustar frankfrank#include "store.ih" void Store::checkGlobals(IdxIter &begin, IdxIter &end) { auto iter = find_if(begin, end, // find a GLOBALS entry [&](size_t idx) { return d_xrefVector[idx].symbol().find("GLOBALS") != string::npos; } ); if (iter == end) // no such entry { d_globals.first = d_xrefVector.size(); return; } d_globals.first = iter - begin; // the entry having GLOBALS // find a function name istringstream names{ d_xrefVector[d_globals.first].symbol() }; string name; while (names >> name) // find a name != GLOBALS { if (name != "GLOBALS") { name.resize(name.find('.')); // source file w/o the break; // extension: maybe equal to } // the source's function name } iter = find_if(iter + 1, end, // maybe find such a name [&](size_t idx) { // not here... if (d_xrefVector[idx].symbol().find(name) == string::npos) return false; d_globals.second = idx; // but here. return true; } ); } oxref-2.02.00/store/insert.cc0000644000175000017500000000174414516432277014752 0ustar frankfrank#include "store.ih" void Store::insert(ostream &out, string const &name, bool doSelect) const { auto iter = d_defIdx.begin(); auto end = d_defIdx.end(); Pattern namePattern; if (not doSelect) namePattern.setPattern(name); while (true) { iter = doSelect ? find_if( iter, end, [&](size_t idx) { return string(d_xrefVector[idx].name()).find(name) == 0; } ) : find_if( iter, end, [&](size_t idx) { return namePattern << d_xrefVector[idx].symbol(); } ); if (iter == end) break; insertDefined(*iter, out, d_xrefVector); ++iter; } } oxref-2.02.00/store/store.h0000644000175000017500000000534014516432277014440 0ustar frankfrank#ifndef INCLUDED_STORE_ #define INCLUDED_STORE_ #include #include #include #include #include #include #include "../xrefdata/xrefdata.h" // XrefData elements in the vector d_xrefVector. // XrefData's usedBy() returns a vector of indices in d_xrefVector of functions // using XrefData's symbol(). // XrefData's element's identifier itself is returned by XrefData's // name(). // // Indices of defined elements are stored in d_defIdx. Other entries in // d_defIdx are used, but not defined in the specified object // files. namespace FBB { class Pattern; } class Store { friend std::ostream &operator<<(std::ostream &out, Store const &store); size_t d_currentIdx; std::string d_sourceFile; std::string d_objFile; std::string d_symbol; using IdxIter = std::vector::iterator; XrefVector d_xrefVector; mutable std::vector d_defIdx; // indices of defined // functions/objects // GLOBALS main.cc tmp/main.o (main.cc) std::pair d_globals; // convert GLOBALS idx to // its first function public: Store(); void setSource(std::string const &fname); void setObjfile(std::string const &fname); void setFunction(std::string const &function); void setObject(std::string const &object); void undefined(std::string const &symbol); void tree(std::string const &symbol) const; void calledBy(std::string const &spec); private: void define(std::string const &symbol, bool isFunction); std::ostream &insertInto(std::ostream &out) const; void insert(std::ostream &out, std::string const &name, bool doSelect) const; void callers(std::unordered_set &done, std::queue &todo) const; void checkGlobals(IdxIter &begin, IdxIter &end); size_t symbolIdx(std::string const &symbol) const; static bool findSymbol(XrefData const &data, std::string const &target); static void insertDefined(size_t idx, std::ostream &out, XrefVector const &xref); static void usedBy(size_t idx, std::ostream &out, XrefVector const &xref); static std::string rmBlanks(std::string const &symbol); }; inline std::ostream &operator<<(std::ostream &out, Store const &store) { return store.insertInto(out); } #endif oxref-2.02.00/store/undefined.cc0000644000175000017500000000206214516432277015401 0ustar frankfrank#include "store.ih" // 00000000 *UND* 00000000 std::ios_base::Init::Init() // --------------------------- void Store::undefined(std::string const &symbol) { // find 'symbol' in d_xrefVector. // If not yet available add it to xrefData. // Determine the symbol's index in xrefData // The function currently handled has a currentIdx and from that index // the current *UND* symbol is called. auto iter = find_if( d_xrefVector.begin(), d_xrefVector.end(), [&](XrefData const &xrefData) { return xrefData.hasSymbol(symbol); } ); size_t index = iter - d_xrefVector.begin(); // index of this symbol if (iter == d_xrefVector.end()) // symbol not yet defined { index = d_xrefVector.size(); d_xrefVector.push_back(XrefData{ symbol }); // define the symbol } d_xrefVector[index].calledFrom(d_currentIdx); } oxref-2.02.00/store/setsource.cc0000644000175000017500000000037414516432277015460 0ustar frankfrank#include "store.ih" void Store::setSource(std::string const &fname) { d_sourceFile = fname; // cout << "Sourcefile: " << d_sourceFile << '\n'; d_currentIdx = d_xrefVector.size(); define("GLOBALS " + fname + " " + d_objFile, false); } oxref-2.02.00/store/insertdefined.cc0000644000175000017500000000063014516432277016262 0ustar frankfrank#include "store.ih" void Store::insertDefined(size_t idx, ostream &out, XrefVector const &xref) { XrefData const &ref = xref[idx]; auto begin = ref.usedBy().begin(); auto end = ref.usedBy().end(); if (begin != end) { ref.defined(out); out << " Used By:\n"; for (auto idx: ranger(begin, end)) usedBy(idx, out, xref); out << '\n'; } } oxref-2.02.00/store/callers.cc0000644000175000017500000000432314516432277015067 0ustar frankfrank#include "store.ih" void Store::callers(unordered_set &done, queue &todo) const { // vector calls; while (not todo.empty()) { size_t idx = todo.front(); // get/remove the next entry idx todo.pop(); if (done.find(idx) != done.end()) // entry 'idx' already processed. continue; done.insert(idx); // avoid repeated lists XrefData const &data = d_xrefVector[idx]; // the current entry vector const &usedBy = data.usedBy(); // and its callers if (usedBy.empty()) { // ignore GLOBALS if (data.fullName().find("GLOBALS ") == string::npos) // entries cout << data.fullName() << " (" << d_xrefVector[idx].sourceFile() << "): not called\n\n"; //calls.push_back(data.fullName() + " (" + // d_xrefVector[idx].sourceFile() + // "): not called\n\n"); continue; } //calls.push_back(data.fullName() + // " (" + d_xrefVector[idx].sourceFile() + // ") : called by\n"); cout << data.fullName() << " (" << d_xrefVector[idx].sourceFile() << "): called by\n"; for (size_t idx: usedBy) { if (idx == d_globals.first) // avoid using the GLOBALS idx = d_globals.second; // reference if (done.find(idx) == done.end()) { if (not d_xrefVector[idx].usedBy().empty()) todo.push(idx); } cout << " " << ' ' << d_xrefVector[idx].fullName() << " (" << d_xrefVector[idx].sourceFile() << ")\n"; //calls.back() += " " + d_xrefVector[idx].fullName() + // " (" + d_xrefVector[idx].sourceFile() + ")\n"; } cout.put('\n'); //calls.back() += '\n'; } //sort(calls.begin() + 1, calls.end()); //for (string const &str: calls) // cout << str; } oxref-2.02.00/store/store.ih0000644000175000017500000000043414641275600014602 0ustar frankfrank#include "store.h" #include #include #include #include #include #include #include #include #include "../tree/tree.h" #ifndef SPCH_ using namespace std; using namespace FBB; #endif oxref-2.02.00/store/setfunction.cc0000644000175000017500000000022614516432277016001 0ustar frankfrank#include "store.ih" void Store::setFunction(string const &symbol) { d_symbol = symbol; define(symbol, true); // true: define a function } oxref-2.02.00/store/insertinto.cc0000644000175000017500000000134614516432277015642 0ustar frankfrank#include "store.ih" std::ostream &Store::insertInto(std::ostream &out) const { Arg &arg = Arg::instance(); bool doSelect; string entity; if ( (doSelect = arg.option(&entity, "select")) || arg.option(&entity, "select-pattern") ) insert(out, entity, doSelect); else { sort( d_defIdx.begin(), d_defIdx.end(), [&](size_t left, size_t right) { return strcasecmp(d_xrefVector[left].name(), d_xrefVector[right].name()) < 0; } ); for (auto idx: d_defIdx) insertDefined(idx, out, d_xrefVector); } return out; } oxref-2.02.00/store/symbolidx.cc0000644000175000017500000000046414516432277015456 0ustar frankfrank#include "store.ih" size_t Store::symbolIdx(string const &symbol) const { return find_if(d_xrefVector.begin(), d_xrefVector.end(), [&](XrefData const &data) { return findSymbol(data, symbol); } ) - d_xrefVector.begin(); } oxref-2.02.00/store/rmblanks.cc0000644000175000017500000000066314516432277015256 0ustar frankfrank#include "store.ih" // static string Store::rmBlanks(string const &symbol) { return symbol; // // size_t begin; // size_t end = 0; // string ret; // // while (true) // { // begin = symbol.find_first_not_of(' ', end); // if (begin == string::npos) // break; // end = symbol.find_first_of(' ', begin); // ret += symbol.substr(begin, end - begin); // } // // return ret; } oxref-2.02.00/store/define.cc0000644000175000017500000000264514516432277014701 0ustar frankfrank#include "store.ih" void Store::define(std::string const &symbol, bool isFunction) { auto iter = find_if( d_xrefVector.begin(), d_xrefVector.end(), [&](XrefData const &data) { return data.isDefined(symbol); } ); if (iter != d_xrefVector.end()) return; // symbol already defined iter = find_if( d_xrefVector.begin(), d_xrefVector.end(), [&](XrefData const &xrefData) { return xrefData.hasSymbol(symbol); } ); size_t currentIdx; if (iter != d_xrefVector.end()) { currentIdx = iter - d_xrefVector.begin(); d_xrefVector[currentIdx].setLocation(d_sourceFile, d_objFile); d_defIdx.push_back(currentIdx); } else { // new symbol: defined at index currentIdx, // any *UND* elements are for function currentIdx // if not a function, then d_currentIdx isn't // used with *UND* elements d_defIdx.push_back(currentIdx = d_xrefVector.size()); d_xrefVector.push_back( XrefData(d_sourceFile, d_objFile, isFunction, symbol) ); } if (isFunction) d_currentIdx = currentIdx; } oxref-2.02.00/store/store1.cc0000644000175000017500000000005314516432277014653 0ustar frankfrank#include "store.ih" Store::Store() //: {} oxref-2.02.00/store/setobjfile.cc0000644000175000017500000000014114516432277015562 0ustar frankfrank#include "store.ih" void Store::setObjfile(std::string const &fname) { d_objFile = fname; } oxref-2.02.00/store/tree.cc0000644000175000017500000000072314516432277014401 0ustar frankfrank#include "store.ih" void Store::tree(string const &symbol) const { size_t idx = symbolIdx(symbol); if (idx == d_xrefVector.size()) { cout << '`' << symbol << "' not found\n"; return; } cout << setfill('-') << setw(70) << '-' << setfill(' ') << "\n" "CALL TREE FOR: " << symbol << "\n" "\n"; Tree tree{ d_xrefVector }; tree.print(idx); // print the tree, starting at symbol idx } oxref-2.02.00/store/findsymbol.cc0000644000175000017500000000046314516432277015611 0ustar frankfrank#include "store.ih" // static bool Store::findSymbol(XrefData const &data, string const &target) { return not data.sourceFile().empty() // source file and // and data.symbol() == target; // found the target symbol } oxref-2.02.00/store/usedby.cc0000644000175000017500000000041414516432277014732 0ustar frankfrank#include "store.ih" void Store::usedBy(size_t idx, std::ostream &out, XrefVector const &xref) { XrefData const &ref = xref[idx]; out << " "; if (Arg::instance().option('x')) out << ref.sourceFile() << ": "; out << ref.symbol() << '\n'; } oxref-2.02.00/store/calledby.cc0000644000175000017500000000241214516432277015216 0ustar frankfrank#include "store.ih" void Store::calledBy(string const &spec) { unordered_set done; queue todo; Pattern pattern{ spec }; // regex pattern to locate auto begin = d_defIdx.begin(); // range of defined symbol indices auto end = d_defIdx.end(); cout << // the called-by listing setfill('-') << setw(70) << '-' << setfill(' ') << "\n" "CALLED-BY LISTING:\n\n"; checkGlobals(begin, end); // check for a GLOBALS entry with // a possible function name while (true) { begin = find_if( // find an entry matching pattern begin, end, [&](size_t idx) { return pattern << d_xrefVector[idx].symbol(); } ); if (begin == end) // no more matching entries break; todo.push(*begin == d_globals.first ? d_globals.second : *begin); ++begin; callers(done, todo); // recursively show its callers } if (done.empty()) // unknown spec cout << spec << ": not found\n"; } oxref-2.02.00/tree/0000755000175000017500000000000014641433710012724 5ustar frankfrankoxref-2.02.00/tree/tree.ih0000644000175000017500000000022214641275600014203 0ustar frankfrank#include "tree.h" #include //#define XERR std::cerr << __FILE__": " #include #ifndef SPCH_ using namespace std; #endif oxref-2.02.00/tree/indent.cc0000644000175000017500000000033114516432277014521 0ustar frankfrank#include "tree.ih" void Tree::indent(size_t level) const { for (size_t idx = 0; idx != level; ++idx) { auto &data = d_info[idx]; cout << (data.last ? " " : "| "); } cout << "+-"; } oxref-2.02.00/tree/tree.h0000644000175000017500000000165614516432277014054 0ustar frankfrank#ifndef INCLUDED_TREE_ #define INCLUDED_TREE_ #include #include #include "../xrefdata/xrefdata.h" class Tree { struct Data; std::vector d_info; XrefVector const &d_xrefVector; public: Tree(XrefVector const &xrefVector); void print(size_t idx, size_t level = 0); // idx in d_xrefVector // of the symbol to print private: void indent(size_t level) const; size_t calls(size_t symIdx, size_t from); // 1.cc static bool calls(size_t symIdx, XrefData const &data); // 2.cc }; struct Tree::Data { bool last; // reached the last entity called by this function size_t symIdx; // xrefVector index holding the info about the // called entity }; inline Tree::Tree(XrefVector const &xrefVector) : d_xrefVector(xrefVector) {} #endif oxref-2.02.00/tree/calls2.cc0000644000175000017500000000041114516432277014417 0ustar frankfrank#include "tree.ih" // static bool Tree::calls(size_t symIdx, XrefData const &data) { return not data.sourceFile().empty() and find(data.usedBy().begin(), data.usedBy().end(), symIdx) != data.usedBy().end(); } oxref-2.02.00/tree/calls1.cc0000644000175000017500000000063014516432277014421 0ustar frankfrank#include "tree.ih" size_t Tree::calls(size_t symIdx, size_t from) { auto iter = find_if(d_xrefVector.begin() + from, d_xrefVector.end(), [&](XrefData const &data) { return calls(symIdx, data); } ); return iter == d_xrefVector.end() ? d_xrefVector.size() : iter - d_xrefVector.begin(); } oxref-2.02.00/tree/print.cc0000644000175000017500000000353114516432277014401 0ustar frankfrank#include "tree.ih" void Tree::print(size_t symIdx, size_t level) { string const &name = d_xrefVector[symIdx].symbol(); // the symbol name cout << name; for (size_t idx = 0; idx != level; ++idx) { if (d_info[idx].symIdx == symIdx) // recursive call? { cout << " ==> " << idx << '\n'; // show the recursion level return; } } cout << '\n'; size_t callIdx = calls(symIdx, 0); // idx of 1st called entity if (callIdx == d_xrefVector.size()) // nothing called from here return; d_info.resize(level + 1); // room for the next level d_info[level].symIdx = symIdx; // store this symbol's idx size_t nextLevel = level + 1; while (true) { size_t nextIdx = calls(symIdx, callIdx + 1); // anything else // called? // callIdx refers to the last // called entity ? d_info[level].last = nextIdx == d_xrefVector.size(); // cout << " " << d_xrefVector[callIdx].symbol() << '\n'; indent(level); print(callIdx, nextLevel); if (nextIdx == d_xrefVector.size()) break; callIdx = nextIdx; } /////////////////////////////////////////////////////////////////// // auto iter // size_t size = d_idMap.callSize(name); // d_xrefVector[symIdx]. // // d_info.resize(level + 1); // // d_info[level] = Data{ size, 0, name }; // // size_t nextLevel = level + 1; // next recursion // // for (size_t elem = 0; elem != size; ++elem) // { // ++d_info[level].current; // indent(level); // print(d_idMap.element(elem, name), nextLevel); // } } oxref-2.02.00/treedemo/0000755000175000017500000000000014516432277013601 5ustar frankfrankoxref-2.02.00/treedemo/idmap/0000755000175000017500000000000014516432277014673 5ustar frankfrankoxref-2.02.00/treedemo/idmap/idmap.h0000644000175000017500000000110014516432277016126 0ustar frankfrank#ifndef INCLUDED_IDMAP_ #define INCLUDED_IDMAP_ #include #include #include #include class IDmap: private std::unordered_map< std::string, std::vector > { public: IDmap(); size_t callSize(std::string const &name) const; // no idx bound check std::string const &element(size_t idx, std::string const &name) const; void add(std::string const &name, std::initializer_list &&calls); }; #endif oxref-2.02.00/treedemo/idmap/element.cc0000644000175000017500000000036714516432277016641 0ustar frankfrank#include "idmap.ih" string const &IDmap::element(size_t idx, string const &name) const { auto iter = find(name); if (iter == end()) throw runtime_error{ "No entry `" + name + '\'' }; return iter->second[idx]; } oxref-2.02.00/treedemo/idmap/idmap.ih0000644000175000017500000000020014516432277016277 0ustar frankfrank#include "idmap.h" //#include //#define XERR std::cerr << __FILE__": " #include using namespace std; oxref-2.02.00/treedemo/idmap/idmap1.cc0000644000175000017500000000005414516432277016354 0ustar frankfrank#include "idmap.ih" IDmap::IDmap() //: { } oxref-2.02.00/treedemo/idmap/callsize.cc0000644000175000017500000000034014516432277017005 0ustar frankfrank#include "idmap.ih" size_t IDmap::callSize(std::string const &name) const { auto iter = find(name); if (iter == end()) throw runtime_error{ "No entry `" + name + '\'' }; return iter->second.size(); } oxref-2.02.00/treedemo/idmap/add.cc0000644000175000017500000000050614516432277015733 0ustar frankfrank#include "idmap.ih" void IDmap::add(string const &name, initializer_list &&calls) { for (auto begin = calls.begin(), end = calls.end(); begin != end; ++begin) this->insert( pair{ *begin, vector{} } ); (*this)[name] = std::move(calls) ; //insert( pair{ name, std::move(calls) } ); } oxref-2.02.00/treedemo/tree/0000755000175000017500000000000014516432277014540 5ustar frankfrankoxref-2.02.00/treedemo/tree/tree.ih0000644000175000017500000000020514516432277016016 0ustar frankfrank#include "tree.h" #include //#define XERR std::cerr << __FILE__": " #include "../idmap/idmap.h" using namespace std; oxref-2.02.00/treedemo/tree/indent.cc0000644000175000017500000000035514516432277016333 0ustar frankfrank#include "tree.ih" void Tree::indent(size_t level) const { for (size_t idx = 0; idx != level; ++idx) { auto &data = d_info[idx]; cout << (data.current != data.callSize ? "| " : " "); } cout << "+-"; } oxref-2.02.00/treedemo/tree/tree.h0000644000175000017500000000101014516432277015640 0ustar frankfrank#ifndef INCLUDED_TREE_ #define INCLUDED_TREE_ #include #include class IDmap; class Tree { struct Data; std::vector d_info; IDmap const &d_idMap; public: Tree(IDmap const &idMap); void print(std::string const &name, size_t level = 0); private: void indent(size_t level) const; }; struct Tree::Data { size_t callSize; size_t current; std::string name; }; inline Tree::Tree(IDmap const &idMap) : d_idMap(idMap) {} #endif oxref-2.02.00/treedemo/tree/print.cc0000644000175000017500000000120214516432277016176 0ustar frankfrank#include "tree.ih" void Tree::print(string const &name, size_t level) { cout << name; for (size_t idx = 0; idx != level; ++idx) { if (d_info[idx].name == name) { cout << " ==> " << idx << '\n'; return; } } cout << '\n'; size_t size = d_idMap.callSize(name); d_info.resize(level + 1); d_info[level] = Data{ size, 0, name }; size_t nextLevel = level + 1; // next recursion for (size_t elem = 0; elem != size; ++elem) { ++d_info[level].current; indent(level); print(d_idMap.element(elem, name), nextLevel); } } oxref-2.02.00/treedemo/icmconf0000644000175000017500000000105114516432277015137 0ustar frankfrank#define CLS #define MAIN "main.cc" #define SOURCES "*.cc" #define OBJ_EXT ".o" #define TMP_DIR "tmp" #define USE_ECHO ON #define CXX "g++" #define CXXFLAGS " --std=c++2a -Wall -O2" \ " -fdiagnostics-color=never " #define IH ".ih" //#define PRECOMP "-x c++-header" #define REFRESH #define LDFLAGS "-s" #define ADD_LIBRARIES "" #define ADD_LIBRARY_PATHS "" #define DEFCOM "program" oxref-2.02.00/treedemo/main.cc0000644000175000017500000000075514516432277015043 0ustar frankfrank#include "main.ih" // Room for Args initialization int main(int argc, char **argv) try { IDmap idMap; idMap.add("A", { "B", "C", "D", "A"}); idMap.add("B", { "E", "F" }); idMap.add("C", { "A" }); idMap.add("D", { "P", "Q" }); idMap.add("F", { "R", "S", "B" }); idMap.add("Q", { "K", "L" }); Tree tree{ idMap }; tree.print("A"); cout << "\n" "-----------------\n" "\n"; tree.print("B"); } catch (...) { return 1; } oxref-2.02.00/treedemo/main.ih0000644000175000017500000000015514516432277015050 0ustar frankfrank#include #include #include "idmap/idmap.h" #include "tree/tree.h" using namespace std; oxref-2.02.00/treedemo/CLASSES0000644000175000017500000000001314516432277014613 0ustar frankfranktree idmap oxref-2.02.00/usage.cc0000644000175000017500000000520614516432277013413 0ustar frankfrank// usage.cc #include "main.ih" namespace { char const usageText[] = R"( Where: [options] - optional arguments (short options between parentheses): --arg (-a) ... count - display function argument counts only first - only display the first word of the parameter types - restrict parameter types to the first characters --called-by (-c) regex - display (recursively) the function(s) calling the function specified at 'regex'. --full-symbol (-f) - display the full symbol names (e.g., including class name prefixes) --help (-h) - provide this help --no-xref (-X) - don't generate the cross-reference listing --objdump command - the command calling the object dump program (see the man-page for details) --object-files (-o) - display the object file names --replace (-R) spec - spec is XfirstXsecondX. 'first' found in objdump's output is replaced by 'second'; X is a unique separator character. (multiple -R options may be specified) --replace-file (-r) fname - fname contains 'spec' replacement specifications as used with the --replace options (empty lines and lines beginning with // are skipped) --select name - only display the cross-reference of `name', where `name' is the (initial substring of an) entity's name. --select-pattern regex - only display the cross-reference of `regex', where `regex' is a regular expression against which (full) symbols are matched --source-files (-s) - display the source file names --tree (-t) symbol - display the call-tree for symbol --xref-source-files (-x)- display the source file names in the cross-reference lists --version (-v) - show version information and terminate args - non-stripped .o or libraries whose symbols must be cross-referenced. )"; } // namespace void usage(std::string const &progname) { cout << '\n' << progname << " by " << Icmbuild::author << '\n' << progname << " V " << Icmbuild::version << " " << Icmbuild::years << "\n" "\n" "Usage: " << progname << " [options] args" << usageText; } oxref-2.02.00/VERSION0000644000175000017500000000015714641433441013041 0ustar frankfrank#define AUTHOR "Frank B. Brokken (f.b.brokken@rug.nl)" #define VERSION "2.02.00" #define YEARS "2012-2024" oxref-2.02.00/version.cc0000644000175000017500000000027314641433662013771 0ustar frankfrank// version.cc #include "main.ih" #include "VERSION" namespace Icmbuild { char version[] = VERSION; char years[] = YEARS; char author[] = AUTHOR; } oxref-2.02.00/VERSION.h0000644000175000017500000000010414516432277013266 0ustar frankfrank#include "VERSION" SUBST(_CurVers_)(VERSION) SUBST(_CurYrs_)(YEARS) oxref-2.02.00/xrefdata/0000755000175000017500000000000014641433710013563 5ustar frankfrankoxref-2.02.00/xrefdata/setcooked.cc0000644000175000017500000000134714516432277016067 0ustar frankfrank#include "xrefdata.ih" void XrefData::setCooked() { d_cooked = d_refName; size_t begin = d_cooked.find('(', d_nameIndex); size_t end = d_cooked.rfind(')'); if (begin == string::npos || end == string::npos) // no parentheses ??? return; // so be it... Arg &arg = Arg::instance(); string option; if (not arg.option(&option, 'a')) return; // no -a option if (option == "count") reduceToCount(begin, end); else if (option == "first") keepFirst(begin); else { size_t len = stoul(option); if (len < 5) len = 5; reduceLen(begin, len); } } oxref-2.02.00/xrefdata/calledfrom.cc0000644000175000017500000000016114516432277016210 0ustar frankfrank#include "xrefdata.ih" void XrefData::calledFrom(size_t currentIdx) { d_calledFrom.push_back(currentIdx); } oxref-2.02.00/xrefdata/xrefdata.h0000644000175000017500000000607414516432277015551 0ustar frankfrank#ifndef INCLUDED_XREFDATA_ #define INCLUDED_XREFDATA_ #include #include #include // see store.h for a description of the data-storage organization class XrefData { std::string d_sourceFile; // defined, unless empty std::string d_objFile; bool d_isFunction; // true: function, false: object std::string d_refName; // full name of object or function std::string d_cooked; // name as processed by -a size_t d_nameIndex; // index where the proper name (after // its class/namespace) starts std::vector d_calledFrom; bool d_source; bool d_object; bool d_fullSymbol; public: using XrefVector = std::vector; XrefData(); XrefData(std::string const &sourceFile, std::string const &objFile, bool isFunction, std::string const &symbol); XrefData(std::string const &symbol); void setLocation(std::string const &sourceFile, std::string const &objFile); bool isDefined(std::string const &symbol) const; bool hasSymbol(std::string const &symbol) const; void calledFrom(size_t currentIdx); // the current function is called // from the function at // 'currentIdx', which is an index // in Store::d_xrefVector void defined(std::ostream &out) const; std::string const &fullName() const; // returns d_refName // .h std::string const &symbol() const;// returns d_cooked // .h char const *name() const; // returns d_cooked[d_nameIndex] .h std::string const &sourceFile() const; // .h std::vector const &usedBy() const; // .h bool isFunction() const; // .h private: void ctor(); void setCooked(); void keepFirst(size_t openParIdx); void reduceLen(size_t openParIdx, size_t len); void reduceToCount(size_t openParIdx, size_t end); size_t skipTemplate(size_t begin) const; // index of 1st '<' // returns idx of last '>' size_t eraseParam(size_t begin); // returns , or ) position size_t eraseParam(size_t begin, size_t len); }; using XrefVector = XrefData::XrefVector; inline std::vector const &XrefData::usedBy() const { return d_calledFrom; } inline char const *XrefData::name() const { return d_cooked.c_str() + d_nameIndex; } inline std::string const &XrefData::sourceFile() const { return d_sourceFile; } inline std::string const &XrefData::symbol() const { return d_cooked; } inline std::string const &XrefData::fullName() const { return d_refName; } inline bool XrefData::isFunction() const { return d_isFunction; } #endif oxref-2.02.00/xrefdata/setlocation.cc0000644000175000017500000000024014516432277016422 0ustar frankfrank#include "xrefdata.ih" void XrefData::setLocation(string const &sourceFile, string const &objFile) { d_sourceFile = sourceFile; d_objFile = objFile; } oxref-2.02.00/xrefdata/skiptemplate.cc0000644000175000017500000000075514516432277016613 0ustar frankfrank#include "xrefdata.ih" size_t XrefData::skipTemplate(size_t begin) const { size_t level = 1; while (true) { begin = d_cooked.find_first_of("<>", begin); if (begin == string::npos) throw Exception() << "skipTemplate: invalid template spec. in " << d_cooked; if (d_cooked[begin] == '<') ++level; else --level; if (level == 0) return begin; ++begin; } } oxref-2.02.00/xrefdata/defined.cc0000644000175000017500000000055614516432277015506 0ustar frankfrank#include "xrefdata.ih" void XrefData::defined(std::ostream &out) const { out << name() << '\n'; if (d_fullSymbol) out << " Full name: " << symbol() << '\n'; if (d_source) out << " Source: " << d_sourceFile << ' '; if (d_object) out << '(' << d_objFile << ')'; if (d_source || d_object) out << '\n'; } oxref-2.02.00/xrefdata/isdefined.cc0000644000175000017500000000022614516432277016034 0ustar frankfrank#include "xrefdata.ih" bool XrefData::isDefined(string const &symbol) const { return not d_sourceFile.empty() && d_refName == symbol; } oxref-2.02.00/xrefdata/eraseparam.cc0000644000175000017500000000056514516432277016230 0ustar frankfrank#include "xrefdata.ih" size_t XrefData::eraseParam(size_t begin) { size_t next = begin; while (true) { next = d_cooked.find_first_of("*&<,)", next); if (d_cooked[next] != '<') break; next = skipTemplate(next + 1) + 1; } d_cooked.erase(begin, next - begin); return d_cooked.find_first_of(",)", begin); } oxref-2.02.00/xrefdata/hassymbol.cc0000644000175000017500000000017214516432277016103 0ustar frankfrank#include "xrefdata.ih" bool XrefData::hasSymbol(string const &symbol) const { return d_refName == symbol; } oxref-2.02.00/xrefdata/xrefdata3.cc0000644000175000017500000000024414516432277015763 0ustar frankfrank#include "xrefdata.ih" XrefData::XrefData(string const &symbol) : d_isFunction(false), // actually: not yet known d_refName(symbol) { ctor(); } oxref-2.02.00/xrefdata/keepfirst.cc0000644000175000017500000000222114516432277016073 0ustar frankfrank#include "xrefdata.ih" void XrefData::keepFirst(size_t openParIdx) { //cout << d_cooked << "\n"; size_t begin = openParIdx; while (d_cooked[begin] != ')') { ++begin; // beyond the separator if (d_cooked[begin] == ' ') // keep blank after sep. ++begin; size_t next = d_cooked.find_first_not_of(" \t", begin); // erase extra d_cooked.erase(begin, next - begin); // blanks // find end of 1st word: // < begins template // , ends argument // ) ends parlist // blank ends 1st word begin = d_cooked.find_first_of("*&<,) \t", begin); begin = eraseParam(begin); // erase the param. from // 'begin', return , or ) // position } } oxref-2.02.00/xrefdata/xrefdata2.cc0000644000175000017500000000042314516432277015761 0ustar frankfrank#include "xrefdata.ih" XrefData::XrefData(string const &sourceFile, string const &objFile, bool isFunction, string const &symbol) : d_sourceFile(sourceFile), d_objFile(objFile), d_isFunction(isFunction), d_refName(symbol) { ctor(); } oxref-2.02.00/xrefdata/xrefdata.ih0000644000175000017500000000026414641275600015707 0ustar frankfrank#include "xrefdata.h" #include #include #include #include #ifndef SPCH_ using namespace std; using namespace FBB; #endif oxref-2.02.00/xrefdata/ctor.cc0000644000175000017500000000120714516432277015051 0ustar frankfrank#include "xrefdata.ih" void XrefData::ctor() { Arg &arg = Arg::instance(); d_source = arg.option('s'); d_object = arg.option('o'); d_fullSymbol = arg.option('f'); d_nameIndex = d_refName.find('('); // find 1st opening '(' if (d_nameIndex == string::npos) // not found: search fm the end d_nameIndex = d_refName.length(); d_nameIndex = d_refName.rfind(':', d_nameIndex); // find SRO d_nameIndex = d_nameIndex == string::npos ? // none found: use full d_refName 0 : d_nameIndex + 1; // else: d_refName starts beyond : setCooked(); } oxref-2.02.00/xrefdata/xrefdata1.cc0000644000175000017500000000021114516432277015753 0ustar frankfrank#include "xrefdata.ih" XrefData::XrefData() : d_isFunction(false), d_nameIndex(0), d_source(false), d_object(false) {} oxref-2.02.00/xrefdata/reducelen.cc0000644000175000017500000000131214516432277016045 0ustar frankfrank#include "xrefdata.ih" void XrefData::reduceLen(size_t openParIdx, size_t len) { size_t begin = openParIdx; while (d_cooked[begin] != ')') { ++begin; // beyond the separator if (d_cooked[begin] == ' ') // keep blank after sep. ++begin; size_t next = d_cooked.find_first_not_of(" \t", begin); // erase extra d_cooked.erase(begin, next - begin); // blanks begin = eraseParam(begin, len); // erase the param. from // 'begin', return , or ) // position } } oxref-2.02.00/xrefdata/reducetocount.cc0000644000175000017500000000151214516432277016764 0ustar frankfrank#include "xrefdata.ih" void XrefData::reduceToCount(size_t openParIdx, size_t end) { size_t nArgs = 0; for (size_t begin = openParIdx + 1; begin != end; ++begin) { switch (d_cooked[begin]) { case ' ': // ignore blanks case '\t': case ',': // skip over the comma's break; default: // skip argument begin = d_cooked.find_first_of("<,)", begin); if (begin == end) --begin; ++nArgs; break; case '<': begin = skipTemplate(begin); break; } } if (nArgs) { auto iter = d_cooked.begin(); d_cooked.replace(iter + openParIdx + 1, iter + end, to_string(nArgs)); } } oxref-2.02.00/xrefdata/eraseparam2.cc0000644000175000017500000000077514516432277016315 0ustar frankfrank#include "xrefdata.ih" size_t XrefData::eraseParam(size_t begin, size_t len) { size_t next = begin; while (true) { next = d_cooked.find_first_of("*&<,)", next); if (d_cooked[next] != '<') break; next = skipTemplate(next + 1) + 1; } if (next - begin > len) { d_cooked.erase(begin + len, next - begin - len); begin += len; d_cooked.replace(begin - 3, 3, "...", 3); } return d_cooked.find_first_of(",)", begin); }