this was an attempt to bring back in the callstack tracker feature, after maybe 15 years of it not being alive in the codebase.
lots of struggle with that, and it's not working yet, but is a bit better. currently the feature is disabled in the codebase,
but hopefully it can be enabled soon...
-
-
-
-/*****************************************************************************\
-* *
-* Name : callstack_tracker *
-* Author : Chris Koeritz *
-* *
+/*
+*
+* Name : callstack_tracker
+* Author : Chris Koeritz
+*
*******************************************************************************
* Copyright (c) 2007-$now By Author. This program is free software; you can *
* redistribute it and/or modify it under the terms of the GNU General Public *
#include "callstack_tracker.h"
+#include <basis/functions.h>
+
#include <malloc.h>
#include <stdio.h>
+#include <string.h>
+
+//using namespace application;
+using namespace basis;
+//using namespace configuration;
+//using namespace mathematics;
+//using namespace filesystem;
+//using namespace loggers;
+//using namespace structures;
+//using namespace textual;
+//using namespace timely;
+//using namespace unit_test;
////#undef new
-//is this right way to clean that out.
+//is this right way to clean that out..?
+
+namespace application {
const int MAX_STACK_DEPTH = 2000;
// beyond that many stack frames, we will simply refuse to add any more.
//////////////
+//! the single instance of callstack_tracker.
+/*! this is also an ultra low-level object, although it's not as far down
+as the memory checker. it can allocate c++ objects and that kind of thing
+just fine. the object must be stored here rather than in the static basis
+library due to issues in windows dlls.
+NOTE: this is also not thread safe; it must be initialized before any threads
+have started. */
+
+//hmmm: why is this here? because it needs to interact with the progwide memories?
+callstack_tracker &program_wide_stack_trace()
+{
+ static callstack_tracker *_hidden_trace = NULL_POINTER;
+ if (!_hidden_trace) {
+#ifdef ENABLE_MEMORY_HOOK
+ program_wide_memories().disable();
+ // we don't want infinite loops tracking the call stack during this
+ // object's construction.
+#endif
+ _hidden_trace = new callstack_tracker;
+#ifdef ENABLE_MEMORY_HOOK
+ program_wide_memories().enable();
+#endif
+ }
+ return *_hidden_trace;
+}
+
+//////////////
+
class callstack_records
{
public:
//printf("frametrackinst updatelinenum out\n");
}
-#endif // ENABLE_CALLSTACK_TRACKING
-
-
+} // namespace
+#endif // ENABLE_CALLSTACK_TRACKING
* Please send any updates to: fred@gruntose.com *
\*****************************************************************************/
-#include "definitions.h"
-
-#ifdef ENABLE_CALLSTACK_TRACKING
-
-#include "build_configuration.h"
-#include "root_object.h"
+#include <application/build_configuration.h>
+#include <basis/contracts.h>
+#include <basis/definitions.h>
namespace application {
+#ifdef ENABLE_CALLSTACK_TRACKING
+
// forward.
class callstack_records;
class callstack_tracker;
//////////////
-callstack_tracker BASIS_EXTERN &program_wide_stack_trace();
+callstack_tracker &program_wide_stack_trace();
//!< a global object that can be used to track the runtime callstack.
//////////////
callstack_tracker();
virtual ~callstack_tracker();
- DEFINE_CLASS_NAME("callstack_tracker");
+// DEFINE_CLASS_NAME("callstack_tracker");
bool push_frame(const char *class_name, const char *func, const char *file,
int line);
//!< sets the line number for the current frame in the global stack trace.
#else // ENABLE_CALLSTACK_TRACKING
- // bogus replacements for most commonly used callstack tracking support.
+ /*
+ bogus replacements for the most commonly used callstack tracking support.
+ these are necessary because we don't want this enabled in all scenarios,
+ and when we want the callstack tracking disabled, it must have near zero
+ runtime cost.
+ */
+ inline void no_op() { /* do nothing. */ }
#define frame_tracking_instance
- #define __trail_of_function(p1, p2, p3, p4, p5) if (func) {}
+ #define __trail_of_function(p1, p2, p3, p4, p5) no_op();
// the above actually trades on the name of the object we'd normally
// define. it must match the object name in the FUNCDEF macro.
- #define update_current_stack_frame_line_number(line)
+ inline void update_current_stack_frame_line_number(int line) { /* more nothing. */ }
#endif // ENABLE_CALLSTACK_TRACKING
} //namespace.
//#define DEBUG_MEMORY_CHECKER
// uncomment for super noisy version.
+namespace application {
+
//////////////
// define the replacement new and delete operators.
//////////////
-#endif // enable memory hook
-
+} // namespace.
+#endif // enable memory hook
* Please send any updates to: fred@gruntose.com *
\*****************************************************************************/
+#include <application/callstack_tracker.h>
#include <basis/definitions.h>
namespace basis {
cannot get its own name, and other really helpful features.
*/
-//hmmm: temporary to hide missing code.
-#define frame_tracking_instance
-#define __trail_of_function(a, b, c, d, e)
-
class enhance_cpp : public virtual root_object
{
public:
time the stack will no longer show it as active. */
#define FUNCDEF(func_in) \
const char *func = (const char *)func_in; \
- frame_tracking_instance __trail_of_function(static_class_name(), func, \
- __FILE__, __LINE__, true)
+ application::frame_tracking_instance __trail_of_function(static_class_name(), func, \
+ __FILE__, __LINE__, true);
//////////////
that object (the macro "func" must be defined with that name). */
#define FUNCTION(func) BASE_FUNCTION(func); \
function_name += ": "; \
- update_current_stack_frame_line_number(__LINE__)
+ application::update_current_stack_frame_line_number(__LINE__)
//! A macro used within the INSTANCE_FUNCTION macro.
#define BASE_INSTANCE_FUNCTION(func) astring just_function = astring(func); \
information about the class. */
#define INSTANCE_FUNCTION(func) BASE_INSTANCE_FUNCTION(func); \
function_name += ": "; \
- update_current_stack_frame_line_number(__LINE__)
+ application::update_current_stack_frame_line_number(__LINE__)
//////////////
#include <application/windoze_helper.h>
#include <basis/environment.h>
+//#include <basis/enhance_cpp.h>
#include <basis/functions.h>
#include <basis/guards.h>
#include <basis/mutex.h>
public:
virtual ~application_configuration() {}
+ DEFINE_CLASS_NAME("application_configuration");
+
// these methods are mainly about the application itself.
static basis::astring application_name();
of these to yield a simpler macro name per project, such as PRINT or LOG.
*/
+#include <application/callstack_tracker.h>
#include <basis/enhance_cpp.h>
#include <loggers/logging_filters.h>
#include <timely/time_stamp.h>
///hmmm: very temporary until the call stack tracking is available again.
-#define update_current_stack_frame_line_number(x)
+////#define update_current_stack_frame_line_number(x)
//! Logs a string "to_log" on "the_logger" using the "filter".
/*! The filter is checked before the string is allowed to come into
//! Class specific logging method that uses a filter.
/* These add a class and function name to the log entry. */
#define CLASS_FILTER_LOG(the_logger, to_log, filter) { \
- update_current_stack_frame_line_number(__LINE__); \
+ application::update_current_stack_frame_line_number(__LINE__); \
if (the_logger.member(filter)) { \
astring temp_log = to_log; \
if (temp_log.length()) { \
} \
the_logger.log(temp_log, filter); \
} \
- update_current_stack_frame_line_number(__LINE__); \
+ application::update_current_stack_frame_line_number(__LINE__); \
}
//! Class specific logging method that always prints.
#define CLASS_EMERGENCY_LOG(the_logger, to_log) \
/*! This use the instance name of the object, which can include more
information than the simple class name. */
#define INSTANCE_FILTER_LOG(the_logger, to_log, filter) { \
- update_current_stack_frame_line_number(__LINE__); \
+ application::update_current_stack_frame_line_number(__LINE__); \
if (the_logger.member(filter)) { \
astring temp_log = to_log; \
if (temp_log.length()) { \
temp_log += "]"; \
} \
the_logger.log(temp_log, filter); \
- update_current_stack_frame_line_number(__LINE__); \
+ application::update_current_stack_frame_line_number(__LINE__); \
} \
}
//! Logs with class instance info, but this always prints.
bool path::generate_path(node *to_locate, path &to_follow) const
{
- FUNCDEF("generate_path")
+ FUNCDEF("generate_path");
if (to_locate || to_follow.current()) {}
LOG("hmmm: path::generate_path is not implemented.");
_associations(new symbol_tree_associations(estimated_elements)),
_name(new astring(node_name))
{
- FUNCDEF("constructor")
+ FUNCDEF("constructor");
}
symbol_tree::~symbol_tree()
#include <basis/functions.h>
#include <basis/array.h>
+#include <application/callstack_tracker.h>
//temp! needed for fake continuable error etc
#include <stdio.h>
#include <string.h>
+using namespace application;
using namespace basis;
+/* no.
+namespace application {
+
+//! the single instance of callstack_tracker.
+/ *! this is also an ultra low-level object, although it's not as far down
+as the memory checker. it can allocate c++ objects and that kind of thing
+just fine. the object must be stored here rather than in the static basis
+library due to issues in windows dlls.
+NOTE: this is also not thread safe; it must be initialized before any threads
+have started. * /
+
+//hmmm: why is this here? because it needs to interact with the progwide memories?
+callstack_tracker &program_wide_stack_trace()
+{
+ static callstack_tracker *_hidden_trace = NULL_POINTER;
+ if (!_hidden_trace) {
+#ifdef ENABLE_MEMORY_HOOK
+ program_wide_memories().disable();
+ // we don't want infinite loops tracking the call stack during this
+ // object's construction.
+#endif
+ _hidden_trace = new callstack_tracker;
+#ifdef ENABLE_MEMORY_HOOK
+ program_wide_memories().enable();
+#endif
+ }
+ return *_hidden_trace;
+}
+
+} //namespace.
+*/
+
namespace structures {
//#define DEBUG_STATIC_MEMORY_GREMLIN
#endif
#ifdef ENABLE_CALLSTACK_TRACKING
- program_wide_stack_trace().full_trace_size();
+ application::program_wide_stack_trace().full_trace_size();
// invoke now to get callback tracking instantiated.
#endif
FUNCDEF("HOOPLE_GLOBALS remainder");
PROJECT = tests_application
TYPE = test
-TARGETS = test_break_signal.exe test_command_line.exe test_path_configuration.exe \
- test_registry_configurator.exe
+TARGETS = test_break_signal.exe test_callstack_tracker.exe test_command_line.exe \
+ test_path_configuration.exe test_registry_configurator.exe
DEFINITIONS += USE_FEISTY_MEOW_DLLS
LOCAL_LIBS_USED = unit_test application configuration filesystem loggers \
mathematics nodes processes structures textual timely structures basis
--- /dev/null
+/*****************************************************************************\
+*
+* Name : test_callstack_tracker
+* Author : Chris Koeritz
+*
+* Purpose:
+*
+* Puts the callstack tracking code through its paces, a bit.
+*
+*******************************************************************************
+* Copyright (c) 1992-$now By Author. This program is free software; you can *
+* redistribute it and/or modify it under the terms of the GNU General Public *
+* License as published by the Free Software Foundation; either version 2 of *
+* the License or (at your option) any later version. This is online at: *
+* http://www.fsf.org/copyleft/gpl.html *
+* Please send any updates to: fred@gruntose.com *
+\*****************************************************************************/
+
+#include <basis/functions.h>
+#include <basis/guards.h>
+#include <basis/astring.h>
+
+#include <application/application_shell.h>
+#include <application/callstack_tracker.h>
+#include <application/hoople_main.h>
+#include <loggers/console_logger.h>
+#include <loggers/critical_events.h>
+#include <loggers/program_wide_logger.h>
+#include <filesystem/filename.h>
+#include <structures/static_memory_gremlin.h>
+#include <structures/string_array.h>
+#include <unit_test/unit_base.h>
+
+using namespace application;
+using namespace basis;
+using namespace filesystem;
+using namespace loggers;
+using namespace structures;
+using namespace unit_test;
+
+#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
+
+class test_callstack_tracker : virtual public unit_base, virtual public application_shell
+{
+public:
+ test_callstack_tracker() : application_shell() {}
+ DEFINE_CLASS_NAME("test_callstack_tracker");
+ // our test suite...
+ int run_filestack_simple();
+ int run_filestack_middling();
+ int run_filestack_complex();
+ int execute();
+};
+
+int test_callstack_tracker::run_filestack_simple()
+{
+ #ifdef ENABLE_CALLSTACK_TRACKING
+//just show this stack.
+//return an error if any problem.
+ #endif
+ return 0;
+}
+
+int test_callstack_tracker::run_filestack_middling()
+{
+ #ifdef ENABLE_CALLSTACK_TRACKING
+//show a couple calls in.
+//return an error if any problem.
+ #endif
+ return 0;
+}
+
+int test_callstack_tracker::run_filestack_complex()
+{
+ #ifdef ENABLE_CALLSTACK_TRACKING
+//do something recursive and show an elaborate stack
+//return an error if any problem.
+ #endif
+ return 0;
+}
+
+int test_callstack_tracker::execute()
+{
+ FUNCDEF("execute");
+
+ int ret = run_filestack_simple();
+ if (ret) return ret;
+ ret = run_filestack_middling();
+ if (ret) return ret;
+ ret = run_filestack_complex();
+ if (ret) return ret;
+
+ critical_events::alert_message(astring(class_name()) + ": works for those functions tested.");
+
+ return final_report();
+}
+
+HOOPLE_MAIN(test_callstack_tracker, )
+
#include "checkup.h"
#include <basis/astring.h>
+#include <basis/enhance_cpp.h>
#include <loggers/critical_events.h>
using namespace basis;
#undef UNIT_BASE_THIS_OBJECT
#define UNIT_BASE_THIS_OBJECT testing
#undef static_class_name
-#define static_class_name() astring("system_checkup")
+#define static_class_name() "system_checkup"
bool check_system_characteristics(unit_base &testing)
{
#include <time.h>
#include <sys/time.h>
#if defined(__WIN32__) || defined(__UNIX__)
-// #include <sys/timeb.h>
+ #include <sys/timeb.h>
#endif
#include <stdio.h>
//////////////
+#define static_class_name() "time_locus"
+
time_locus convert(time_number seconds, time_number useconds,
const tm &cal_values)
{
time_locus now()
{
- FUNCDEF("now")
+ FUNCDEF("now");
timeval currtime;
int okay = gettimeofday(&currtime, NULL_POINTER);
if (okay != 0) {
time_locus greenwich_now()
{
- FUNCDEF("greenwich_now")
+ FUNCDEF("greenwich_now");
timeval currtime;
int okay = gettimeofday(&currtime, NULL_POINTER);
if (okay != 0) {
}
}
+#undef static_class_name
+
} // namespace.
time_number millisecond; //!< The number of milliseconds elapsed in this second.
time_number microsecond; //!< Number of microseconds elapsed in this millisecond.
+ DEFINE_CLASS_NAME("clock_time");
+
//! Constructs a clock_time object given all the parts.
clock_time(time_number h = 0, time_number m = 0, time_number s = 0, time_number ms = 0, time_number us = 0)
: hour(h), minute(m), second(s), millisecond(ms),
days day_of_week; //!< The day of the week.
time_number day_of_year; //!< Numerical day, where January 1st is equal to zero.
+ DEFINE_CLASS_NAME("day_in_year");
+
int packed_size() const { return 4 * structures::PACKED_SIZE_INT64; }
//! Constructs a representation of the day specified.
#include <textual/string_manipulation.cpp>
#include <timely/earth_time.cpp>
#include <timely/time_stamp.cpp>
+
+//added manually since buildor_gen_deps is hosed as of 2026-02-09 (or earlier, since i didn't notice).
+#include <application/callstack_tracker.cpp>
+
#endif // __BUILD_STATIC_APPLICATION__
#include <timely/earth_time.cpp>
#include <timely/time_stamp.cpp>
#include <versions/version_ini.cpp>
+
+//added manually since buildor_gen_deps is hosed as of 2026-02-09 (or earlier, since i didn't notice).
+#include <application/callstack_tracker.cpp>
+
#endif // __BUILD_STATIC_APPLICATION__
#include <timely/time_control.cpp>
#include <timely/time_stamp.cpp>
#include <versions/version_ini.cpp>
+
+//added manually since buildor_gen_deps is hosed as of 2026-02-09 (or earlier, since i didn't notice).
+#include <application/callstack_tracker.cpp>
+
#endif // __BUILD_STATIC_APPLICATION__
#include <timely/earth_time.cpp>
#include <timely/time_stamp.cpp>
#include <versions/version_ini.cpp>
+
+//added manually since buildor_gen_deps is hosed as of 2026-02-09 (or earlier, since i didn't notice).
+#include <application/callstack_tracker.cpp>
+
#endif // __BUILD_STATIC_APPLICATION__
struct filepointer *currentfile;
inclist *currentinc;
-int cppsetup(register char *line, register struct filepointer *filep,
- register inclist *inc)
+int cppsetup(char *line, struct filepointer *filep,
+ inclist *inc)
{
- register char *p, savec;
+ char *p, savec;
static bool setupdone = false;
bool value;
}
-int yyerror(register char *s)
+int yyerror(char *s)
{
fatalerr("Fatal error: %s\n", s);
}
}
-int cppsetup(register char *line, register struct filepointer *filep,
- register inclist *inc)
+int cppsetup(char *line, struct filepointer *filep,
+ inclist *inc)
{
IfParser ip;
struct _parse_data pd;
symtab *isdefined();
symtab *fdefined();
filepointer *getfile();
-inclist *newinclude(register char *, register char *);
+inclist *newinclude(char *, char *);
inclist *inc_path();
*/
// cppsetup.cpp:
-int cppsetup(register char *line, register filepointer *filep,
- register inclist *inc);
+int cppsetup(char *line, filepointer *filep,
+ inclist *inc);
// include.cpp
-inclist *newinclude(register char *newfile, register char *incstring);
+inclist *newinclude(char *newfile, char *incstring);
void inc_clean();
-inclist *inc_path(register char *file, register char *include, bool dot,
+inclist *inc_path(char *file, char *include, bool dot,
bool &failure_okay);
-void included_by(register inclist *ip, register inclist *newfile);
+void included_by(inclist *ip, inclist *newfile);
// main.cpp:
-char *base_name(register char *file);
-char *copy(register char *str);
+char *base_name(char *file);
+char *copy(char *str);
filepointer *getfile(char *file);
void freefile(filepointer *fp);
-char *getline(register filepointer *filep);
-int match(register const char *str, register const char **list);
+char *getline(filepointer *filep);
+int match(const char *str, const char **list);
void redirect(char *line, char *makefile);
#if NeedVarargsPrototypes
void fatalerr(const char *, ...);
// parse.cpp:
void define(char *def, inclist *file);
void define2(char *name, char *val, inclist *file);
-int deftype(register char *line, register filepointer *filep,
- register inclist *file_red, register inclist *file,
+int deftype(char *line, filepointer *filep,
+ inclist *file_red, inclist *file,
int parse_it);
-symtab *fdefined(register char *symbol, inclist *file, inclist **srcfile);
+symtab *fdefined(char *symbol, inclist *file, inclist **srcfile);
int find_includes(filepointer *filep, inclist *file,
inclist *file_red, int recursion, bool failOK);
-int gobble(register filepointer *filep, inclist *file,
+int gobble(filepointer *filep, inclist *file,
inclist *file_red);
-symtab *isdefined(register char *symbol, inclist *file,
+symtab *isdefined(char *symbol, inclist *file,
inclist **srcfile);
-symtab *slookup(register char *symbol, register inclist *file);
-void undefine(char *symbol, register inclist *file);
-int zero_value(register char *exp, register filepointer *filep,
- register inclist *file_red);
+symtab *slookup(char *symbol, inclist *file);
+void undefine(char *symbol, inclist *file);
+int zero_value(char *exp, filepointer *filep,
+ inclist *file_red);
// pr.cpp:
void add_include(filepointer *filep, inclist *file,
inclist *file_red, char *include, bool dot, bool failOK);
-void pr(register inclist *ip, char *file, char *base, bool rc_file);
-void recursive_pr_include(register inclist *head, register char *file,
- register char *base);
+void pr(inclist *ip, char *file, char *base, bool rc_file);
+void recursive_pr_include(inclist *head, char *file,
+ char *base);
// forward.
void remove_dotdot(char *path);
-int isdot(register char *p);
-int isdotdot(register char *p);
-int issymbolic(register char *dir, register char *component);
-void included_by(register inclist *ip, register inclist *newfile);
+int isdot(char *p);
+int isdotdot(char *p);
+int issymbolic(char *dir, char *component);
+void included_by(inclist *ip, inclist *newfile);
-inclist *inc_path(register char *file, register char *include, bool dot,
+inclist *inc_path(char *file, char *include, bool dot,
bool &failure_okay)
{
static char path[ BUFSIZ ];
- register char **pp, *p;
- register inclist *ip;
+ char **pp, *p;
+ inclist *ip;
struct stat st;
bool found = false;
//fprintf(stderr, "file=%s include=%s\n", file, include);
const size_t inclen = strlen(include);
if (inclen >= 4) {
- register char *cpp_point = include + inclen - 4;
+ char *cpp_point = include + inclen - 4;
if (!strcasecmp(".cpp", cpp_point)) {
// this is a CPP file include, which we skip.
//fprintf(stderr, "!found match at point: %s\n", cpp_point);
sprintf(path, "%s/%s", *pp, include);
remove_dotdot(path);
if (stat(path, &st) == 0) {
- register char **pp2;
+ char **pp2;
bool exclude_it = false;
for (pp2 = excludedirs; *pp2; pp2++) {
////////fprintf(stderr, "comparing %s with %s\n", *pp, *pp2);
*/
void remove_dotdot(char *path)
{
- register char *end, *from, *to, **cp;
+ char *end, *from, *to, **cp;
char *components[ MAXFILES ], newpath[ BUFSIZ ];
bool component_copied;
strcpy(path, newpath);
}
-int isdot(register char *p)
+int isdot(char *p)
{
if(p && *p++ == '.' && *p++ == '\0')
return(true);
return(false);
}
-int isdotdot(register char *p)
+int isdotdot(char *p)
{
if(p && *p++ == '.' && *p++ == '.' && *p++ == '\0')
return(true);
return(false);
}
-int issymbolic(register char *dir, register char *component)
+int issymbolic(char *dir, char *component)
{
#ifdef S_IFLNK
struct stat st;
/*
* Add an include file to the list of those included by 'file'.
*/
-inclist *newinclude(register char *newfile, register char *incstring)
+inclist *newinclude(char *newfile, char *incstring)
{
- register inclist *ip;
+ inclist *ip;
/*
* First, put this file on the global list of include files.
return(ip);
}
-void included_by(register inclist *ip, register inclist *newfile)
+void included_by(inclist *ip, inclist *newfile)
{
- register int i;
+ int i;
if (ip == NULL)
return;
void inc_clean()
{
- register inclist *ip;
+ inclist *ip;
for (ip = inc_list; ip < inclistp; ip++) {
ip->i_marked = false;
int main(int argc, char **argv)
{
- register char **fp = filelist;
- register char **incp = includedirs;
- register char **excp = excludedirs;
- register char *p;
- register struct inclist *ip;
+ char **fp = filelist;
+ char **incp = includedirs;
+ char **excp = excludedirs;
+ char *p;
+ struct inclist *ip;
char *makefile = NULL;
struct filepointer *filecontent;
struct symtab *psymp = predefs;
struct filepointer *getfile(char *file)
{
- register int fd;
+ int fd;
struct filepointer *content;
struct stat st;
free(fp);
}
-char *copy(register char *str)
+char *copy(char *str)
{
- register char *p = (char *)malloc(strlen(str) + 1);
+ char *p = (char *)malloc(strlen(str) + 1);
strcpy(p, str);
return(p);
}
-int match(register const char *str, register const char **list)
+int match(const char *str, const char **list)
{
- register int i;
+ int i;
for (i=0; *list; i++, list++)
if (strcmp(str, *list) == 0)
* Get the next line. We only return lines beginning with '#' since that
* is all this program is ever interested in.
*/
-char *getline(register struct filepointer *filep)
+char *getline(struct filepointer *filep)
{
- register char *p, /* walking pointer */
+ char *p, /* walking pointer */
*eof, /* end of file pointer */
*bol; /* beginning of line pointer */
- register int lineno; /* line number */
+ int lineno; /* line number */
eof = filep->f_end;
//// if (p >= eof) return NULL;
////fprintf(stderr, "%s: %s\n", filep->f_name, bol);
////fflush(stderr);
if (*bol == '#') {
- register char *cp;
+ char *cp;
/* punt lines with just # (yacc generated) */
for (cp = bol+1; *cp && (*cp == ' ' || *cp == '\t'); cp++) {}
if (*cp) { p++; goto done; }
* Strip the file name down to what we want to see in the Makefile.
* It will have objprefix and objsuffix around it.
*/
-char *base_name(register char *file)
+char *base_name(char *file)
{
- register char *p;
+ char *p;
file = copy(file);
for(p=file+strlen(file); p>file && *p != '.'; p--) ;
int find_includes(struct filepointer *filep, inclist *file, inclist *file_red, int recursion, bool failOK)
{
- register char *line;
- register int type;
+ char *line;
+ int type;
bool recfailOK;
while ((line = getline(filep))) {
return(-1);
}
-int gobble(register struct filepointer *filep, inclist *file,
+int gobble(struct filepointer *filep, inclist *file,
inclist *file_red)
{
- register char *line;
- register int type;
+ char *line;
+ int type;
while ((line = getline(filep))) {
switch(type = deftype(line, filep, file_red, file, false)) {
/*
* Decide what type of # directive this line is.
*/
-int deftype(register char *line, register struct filepointer *filep,
- register inclist *file_red, register inclist *file,
+int deftype(char *line, struct filepointer *filep,
+ inclist *file_red, inclist *file,
int parse_it)
{
- register char *p;
+ char *p;
char *directive, savechar;
- register int ret;
+ int ret;
/*
* Parse the directive...
return(ret);
}
-symtab *isdefined(register char *symbol, inclist *file,
+symtab *isdefined(char *symbol, inclist *file,
inclist **srcfile)
{
- register struct symtab *val;
+ struct symtab *val;
if ((val = slookup(symbol, &maininclist))) {
debug(1,("%s defined on command line\n", symbol));
return(NULL);
}
-struct symtab *fdefined(register char *symbol, inclist *file, inclist **srcfile)
+struct symtab *fdefined(char *symbol, inclist *file, inclist **srcfile)
{
- register inclist **ip;
- register struct symtab *val;
- register int i;
+ inclist **ip;
+ struct symtab *val;
+ int i;
static int recurse_lvl = 0;
if (file->i_defchecked)
/*
* Return type based on if the #if expression evaluates to 0
*/
-int zero_value(register char *exp, register struct filepointer *filep,
- register inclist *file_red)
+int zero_value(char *exp, struct filepointer *filep,
+ inclist *file_red)
{
if (cppsetup(exp, filep, file_red))
return(IFFALSE);
void define2(char *name, char *val, inclist *file)
{
int first, last, below;
- register struct symtab *sp = NULL, *dest;
+ struct symtab *sp = NULL, *dest;
/* Make space if it's needed */
if (file->i_defs == NULL)
while (last >= first)
{
/* Fast inline binary search */
- register char *s1;
- register char *s2;
- register int middle = (first + last) / 2;
+ char *s1;
+ char *s2;
+ int middle = (first + last) / 2;
/* Fast inline strchr() */
s1 = name;
sp->s_value = copy(val);
}
-struct symtab *slookup(register char *symbol, register inclist *file)
+struct symtab *slookup(char *symbol, inclist *file)
{
- register int first = 0;
- register int last = file->i_ndefs - 1;
+ int first = 0;
+ int last = file->i_ndefs - 1;
if (file) while (last >= first)
{
/* Fast inline binary search */
- register char *s1;
- register char *s2;
- register int middle = (first + last) / 2;
+ char *s1;
+ char *s2;
+ int middle = (first + last) / 2;
/* Fast inline strchr() */
s1 = symbol;
return(NULL);
}
-void undefine(char *symbol, register inclist *file)
+void undefine(char *symbol, inclist *file)
{
- register struct symtab *ptr;
+ struct symtab *ptr;
inclist *srcfile;
while ((ptr = isdefined(symbol, file, &srcfile)) != NULL)
{
void add_include(filepointer *filep, inclist *file,
inclist *file_red, char *include, bool dot, bool failOK)
{
- register struct inclist *newfile;
- register struct filepointer *content;
+ struct inclist *newfile;
+ struct filepointer *content;
/*
* First decide what the pathname of this include file really is.
}
}
-void recursive_pr_include(register struct inclist *head, register char *file,
- register char *base)
+void recursive_pr_include(struct inclist *head, char *file,
+ char *base)
{
- register int i;
+ int i;
if (head->i_marked)
return;
recursive_pr_include(head->i_list[ i ], file, base);
}
-void pr(register struct inclist *ip, char *file, char *base, bool rc_file)
+void pr(struct inclist *ip, char *file, char *base, bool rc_file)
{
static char *lastfile;
static int current_len;
- register int len, i;
+ int len, i;
char buf[ BUFSIZ ];
printed = true;
# throw out any items that are in the same directory we started in.
if [ "$prohibited_directory" == "$(dirname $line_please)" ]; then
-#echo "skipping prohibited: $line_please"
+echo "skipping prohibited: $line_please"
continue
fi
local chewed_line=$(echo $line_please | sed -e 's/.*[\\\/]\(.*\)[\\\/]\(.*\)$/\1\/\2/')
if [ ! -z "$(echo $chewed_line | sed -n -e 's/\.h$/yow/p')" ]; then
-#echo skipping header file: $chewed_line
+echo skipping header file: $chewed_line
continue
fi
local new_include=" #include <$chewed_line>"
echo "$new_include" >>"$pending_deps"
-#echo adding "$new_include"
+echo adding "$new_include"
done
sort "$pending_deps" >>"$replacement_file"