/* *---------------------------------------------------------------------------- * * Fspdev_TraceInit -- * * Initialize the pseudo-device trace buffer. Used for debugging * and profiling. * * Results: * None. * * Side effects: * Calls to the Trace module to allocate the trace buffer, etc. * *---------------------------------------------------------------------------- * */ ReturnStatus Fspdev_TraceInit() { Trace_Init(fspdevTraceHdrPtr, fspdevTraceLength, sizeof(FspdevTraceRecord), TRACE_NO_TIMES); return SUCCESS; }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ Task_Info_t TaskState=TASK_INFO_INIT; /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* System interrupt init*/ /* Sets the priority grouping field */ HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0); HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_USART6_UART_Init(); MX_USART1_UART_Init(); MX_USART2_UART_Init(); MX_USART3_UART_Init(); MX_TimerDynamixel_Init(&TimHandle2 , TIM2); MX_TimerDynamixel_Init(&TimHandle3 , TIM3); MX_TimerDynamixel_Init(&TimHandle4 , TIM4); Trace_Init(); HAL_Delay(1000); Trace_Raw("Medula control board start...\n\r"); Dynamixel_Init(); IO_Data_init(); while (0) { Dynamixel_test(&TaskState); Trace_Task(); } while (1) { HAL_Delay(10); IO_Data_Scan_In(); Appli(&TaskState); Trace_Task(); HAL_Delay(5); IO_Data_Scan_Out(); } /* USER CODE END 3 */ }
/*- * main -- * The main function, for obvious reasons. Initializes variables * and a few modules, then parses the arguments give it in the * environment and on the command line. Reads the system makefile * followed by either Makefile, makefile or the file given by the * -f argument. Sets the .MAKEFLAGS PMake variable based on all the * flags it has received by then uses either the Make or the Compat * module to create the initial list of targets. * * Results: * If -q was given, exits -1 if anything was out-of-date. Else it exits * 0. * * Side Effects: * The program exits when done. Targets are created. etc. etc. etc. */ int main(int argc, char **argv) { Lst targs; /* target nodes to create -- passed to Make_Init */ Boolean outOfDate = FALSE; /* FALSE if all targets up to date */ struct stat sb, sa; char *p1, *path; char mdpath[MAXPATHLEN]; #ifdef FORCE_MACHINE const char *machine = FORCE_MACHINE; #else const char *machine = getenv("MACHINE"); #endif const char *machine_arch = getenv("MACHINE_ARCH"); char *syspath = getenv("MAKESYSPATH"); Lst sysMkPath; /* Path of sys.mk */ char *cp = NULL, *start; /* avoid faults on read-only strings */ static char defsyspath[] = _PATH_DEFSYSPATH; char found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */ struct timeval rightnow; /* to initialize random seed */ struct utsname utsname; /* default to writing debug to stderr */ debug_file = stderr; #ifdef SIGINFO (void)bmake_signal(SIGINFO, siginfo); #endif /* * Set the seed to produce a different random sequence * on each program execution. */ gettimeofday(&rightnow, NULL); srandom(rightnow.tv_sec + rightnow.tv_usec); if ((progname = strrchr(argv[0], '/')) != NULL) progname++; else progname = argv[0]; #if defined(MAKE_NATIVE) || (defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)) /* * get rid of resource limit on file descriptors */ { struct rlimit rl; if (getrlimit(RLIMIT_NOFILE, &rl) != -1 && rl.rlim_cur != rl.rlim_max) { rl.rlim_cur = rl.rlim_max; (void)setrlimit(RLIMIT_NOFILE, &rl); } } #endif if (uname(&utsname) == -1) { (void)fprintf(stderr, "%s: uname failed (%s).\n", progname, strerror(errno)); exit(2); } /* * Get the name of this type of MACHINE from utsname * so we can share an executable for similar machines. * (i.e. m68k: amiga hp300, mac68k, sun3, ...) * * Note that both MACHINE and MACHINE_ARCH are decided at * run-time. */ if (!machine) { #ifdef MAKE_NATIVE machine = utsname.machine; #else #ifdef MAKE_MACHINE machine = MAKE_MACHINE; #else machine = "unknown"; #endif #endif } if (!machine_arch) { #if defined(MAKE_NATIVE) && defined(HAVE_SYSCTL) && defined(CTL_HW) && defined(HW_MACHINE_ARCH) static char machine_arch_buf[sizeof(utsname.machine)]; int mib[2] = { CTL_HW, HW_MACHINE_ARCH }; size_t len = sizeof(machine_arch_buf); if (sysctl(mib, __arraycount(mib), machine_arch_buf, &len, NULL, 0) < 0) { (void)fprintf(stderr, "%s: sysctl failed (%s).\n", progname, strerror(errno)); exit(2); } machine_arch = machine_arch_buf; #else #ifndef MACHINE_ARCH #ifdef MAKE_MACHINE_ARCH machine_arch = MAKE_MACHINE_ARCH; #else machine_arch = "unknown"; #endif #else machine_arch = MACHINE_ARCH; #endif #endif } myPid = getpid(); /* remember this for vFork() */ /* * Just in case MAKEOBJDIR wants us to do something tricky. */ Var_Init(); /* Initialize the lists of variables for * parsing arguments */ Var_Set(".MAKE.OS", utsname.sysname, VAR_GLOBAL, 0); Var_Set("MACHINE", machine, VAR_GLOBAL, 0); Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL, 0); #ifdef MAKE_VERSION Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL, 0); #endif Var_Set(".newline", "\n", VAR_GLOBAL, 0); /* handy for :@ loops */ /* * This is the traditional preference for makefiles. */ #ifndef MAKEFILE_PREFERENCE_LIST # define MAKEFILE_PREFERENCE_LIST "makefile Makefile" #endif Var_Set(MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST, VAR_GLOBAL, 0); Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL, 0); create = Lst_Init(FALSE); makefiles = Lst_Init(FALSE); printVars = FALSE; debugVflag = FALSE; variables = Lst_Init(FALSE); beSilent = FALSE; /* Print commands as executed */ ignoreErrors = FALSE; /* Pay attention to non-zero returns */ noExecute = FALSE; /* Execute all commands */ noRecursiveExecute = FALSE; /* Execute all .MAKE targets */ keepgoing = FALSE; /* Stop on error */ allPrecious = FALSE; /* Remove targets when interrupted */ queryFlag = FALSE; /* This is not just a check-run */ noBuiltins = FALSE; /* Read the built-in rules */ touchFlag = FALSE; /* Actually update targets */ debug = 0; /* No debug verbosity, please. */ jobsRunning = FALSE; maxJobs = DEFMAXLOCAL; /* Set default local max concurrency */ maxJobTokens = maxJobs; compatMake = FALSE; /* No compat mode */ ignorePWD = FALSE; /* * Initialize the parsing, directory and variable modules to prepare * for the reading of inclusion paths and variable settings on the * command line */ /* * Initialize various variables. * MAKE also gets this name, for compatibility * .MAKEFLAGS gets set to the empty string just in case. * MFLAGS also gets initialized empty, for compatibility. */ Parse_Init(); if (argv[0][0] == '/' || strchr(argv[0], '/') == NULL) { /* * Leave alone if it is an absolute path, or if it does * not contain a '/' in which case we need to find it in * the path, like execvp(3) and the shells do. */ p1 = argv[0]; } else { /* * A relative path, canonicalize it. */ p1 = cached_realpath(argv[0], mdpath); if (!p1 || *p1 != '/' || stat(p1, &sb) < 0) { p1 = argv[0]; /* realpath failed */ } } Var_Set("MAKE", p1, VAR_GLOBAL, 0); Var_Set(".MAKE", p1, VAR_GLOBAL, 0); Var_Set(MAKEFLAGS, "", VAR_GLOBAL, 0); Var_Set(MAKEOVERRIDES, "", VAR_GLOBAL, 0); Var_Set("MFLAGS", "", VAR_GLOBAL, 0); Var_Set(".ALLTARGETS", "", VAR_GLOBAL, 0); /* some makefiles need to know this */ Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMD, 0); /* * Set some other useful macros */ { char tmp[64], *ep; makelevel = ((ep = getenv(MAKE_LEVEL_ENV)) && *ep) ? atoi(ep) : 0; if (makelevel < 0) makelevel = 0; snprintf(tmp, sizeof(tmp), "%d", makelevel); Var_Set(MAKE_LEVEL, tmp, VAR_GLOBAL, 0); snprintf(tmp, sizeof(tmp), "%u", myPid); Var_Set(".MAKE.PID", tmp, VAR_GLOBAL, 0); snprintf(tmp, sizeof(tmp), "%u", getppid()); Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL, 0); } if (makelevel > 0) { char pn[1024]; snprintf(pn, sizeof(pn), "%s[%d]", progname, makelevel); progname = bmake_strdup(pn); } #ifdef USE_META meta_init(); #endif /* * First snag any flags out of the MAKE environment variable. * (Note this is *not* MAKEFLAGS since /bin/make uses that and it's * in a different format). */ #ifdef POSIX p1 = explode(getenv("MAKEFLAGS")); Main_ParseArgLine(p1); free(p1); #else Main_ParseArgLine(getenv("MAKE")); #endif /* * Find where we are (now). * We take care of PWD for the automounter below... */ if (getcwd(curdir, MAXPATHLEN) == NULL) { (void)fprintf(stderr, "%s: getcwd: %s.\n", progname, strerror(errno)); exit(2); } MainParseArgs(argc, argv); if (enterFlag) printf("%s: Entering directory `%s'\n", progname, curdir); /* * Verify that cwd is sane. */ if (stat(curdir, &sa) == -1) { (void)fprintf(stderr, "%s: %s: %s.\n", progname, curdir, strerror(errno)); exit(2); } /* * All this code is so that we know where we are when we start up * on a different machine with pmake. * Overriding getcwd() with $PWD totally breaks MAKEOBJDIRPREFIX * since the value of curdir can vary depending on how we got * here. Ie sitting at a shell prompt (shell that provides $PWD) * or via subdir.mk in which case its likely a shell which does * not provide it. * So, to stop it breaking this case only, we ignore PWD if * MAKEOBJDIRPREFIX is set or MAKEOBJDIR contains a transform. */ #ifndef NO_PWD_OVERRIDE if (!ignorePWD) { char *pwd, *ptmp1 = NULL, *ptmp2 = NULL; if ((pwd = getenv("PWD")) != NULL && Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &ptmp1) == NULL) { const char *makeobjdir = Var_Value("MAKEOBJDIR", VAR_CMD, &ptmp2); if (makeobjdir == NULL || !strchr(makeobjdir, '$')) { if (stat(pwd, &sb) == 0 && sa.st_ino == sb.st_ino && sa.st_dev == sb.st_dev) (void)strncpy(curdir, pwd, MAXPATHLEN); } } free(ptmp1); free(ptmp2); } #endif Var_Set(".CURDIR", curdir, VAR_GLOBAL, 0); /* * Find the .OBJDIR. If MAKEOBJDIRPREFIX, or failing that, * MAKEOBJDIR is set in the environment, try only that value * and fall back to .CURDIR if it does not exist. * * Otherwise, try _PATH_OBJDIR.MACHINE, _PATH_OBJDIR, and * finally _PATH_OBJDIRPREFIX`pwd`, in that order. If none * of these paths exist, just use .CURDIR. */ Dir_Init(curdir); (void)Main_SetObjdir(curdir); if ((path = Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &p1)) != NULL) { (void)snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir); (void)Main_SetObjdir(mdpath); free(p1); } else if ((path = Var_Value("MAKEOBJDIR", VAR_CMD, &p1)) != NULL) { (void)Main_SetObjdir(path); free(p1); } else { (void)snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine); if (!Main_SetObjdir(mdpath) && !Main_SetObjdir(_PATH_OBJDIR)) { (void)snprintf(mdpath, MAXPATHLEN, "%s%s", _PATH_OBJDIRPREFIX, curdir); (void)Main_SetObjdir(mdpath); } } /* * Initialize archive, target and suffix modules in preparation for * parsing the makefile(s) */ Arch_Init(); Targ_Init(); Suff_Init(); Trace_Init(tracefile); DEFAULT = NULL; (void)time(&now); Trace_Log(MAKESTART, NULL); /* * Set up the .TARGETS variable to contain the list of targets to be * created. If none specified, make the variable empty -- the parser * will fill the thing in with the default or .MAIN target. */ if (!Lst_IsEmpty(create)) { LstNode ln; for (ln = Lst_First(create); ln != NULL; ln = Lst_Succ(ln)) { char *name = (char *)Lst_Datum(ln); Var_Append(".TARGETS", name, VAR_GLOBAL); } } else Var_Set(".TARGETS", "", VAR_GLOBAL, 0); /* * If no user-supplied system path was given (through the -m option) * add the directories from the DEFSYSPATH (more than one may be given * as dir1:...:dirn) to the system include path. */ if (syspath == NULL || *syspath == '\0') syspath = defsyspath; else syspath = bmake_strdup(syspath); for (start = syspath; *start != '\0'; start = cp) { for (cp = start; *cp != '\0' && *cp != ':'; cp++) continue; if (*cp == ':') { *cp++ = '\0'; } /* look for magic parent directory search string */ if (strncmp(".../", start, 4) != 0) { (void)Dir_AddDir(defIncPath, start); } else { if (Dir_FindHereOrAbove(curdir, start+4, found_path, sizeof(found_path))) { (void)Dir_AddDir(defIncPath, found_path); } } } if (syspath != defsyspath) free(syspath); /* * Read in the built-in rules first, followed by the specified * makefile, if it was (makefile != NULL), or the default * makefile and Makefile, in that order, if it wasn't. */ if (!noBuiltins) { LstNode ln; sysMkPath = Lst_Init(FALSE); Dir_Expand(_PATH_DEFSYSMK, Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath, sysMkPath); if (Lst_IsEmpty(sysMkPath)) Fatal("%s: no system rules (%s).", progname, _PATH_DEFSYSMK); ln = Lst_Find(sysMkPath, NULL, ReadMakefile); if (ln == NULL) Fatal("%s: cannot open %s.", progname, (char *)Lst_Datum(ln)); } if (!Lst_IsEmpty(makefiles)) { LstNode ln; ln = Lst_Find(makefiles, NULL, ReadAllMakefiles); if (ln != NULL) Fatal("%s: cannot open %s.", progname, (char *)Lst_Datum(ln)); } else { p1 = Var_Subst(NULL, "${" MAKEFILE_PREFERENCE "}", VAR_CMD, VARF_WANTRES); if (p1) { (void)str2Lst_Append(makefiles, p1, NULL); (void)Lst_Find(makefiles, NULL, ReadMakefile); free(p1); } } /* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */ if (!noBuiltins || !printVars) { makeDependfile = Var_Subst(NULL, "${.MAKE.DEPENDFILE:T}", VAR_CMD, VARF_WANTRES); doing_depend = TRUE; (void)ReadMakefile(makeDependfile, NULL); doing_depend = FALSE; } if (enterFlagObj) printf("%s: Entering directory `%s'\n", progname, objdir); MakeMode(NULL); Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL); free(p1); if (!forceJobs && !compatMake && Var_Exists(".MAKE.JOBS", VAR_GLOBAL)) { char *value; int n; value = Var_Subst(NULL, "${.MAKE.JOBS}", VAR_GLOBAL, VARF_WANTRES); n = strtol(value, NULL, 0); if (n < 1) { (void)fprintf(stderr, "%s: illegal value for .MAKE.JOBS -- must be positive integer!\n", progname); exit(1); } if (n != maxJobs) { Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL); Var_Append(MAKEFLAGS, value, VAR_GLOBAL); } maxJobs = n; maxJobTokens = maxJobs; forceJobs = TRUE; free(value); } /* * Be compatible if user did not specify -j and did not explicitly * turned compatibility on */ if (!compatMake && !forceJobs) { compatMake = TRUE; } if (!compatMake) Job_ServerStart(maxJobTokens, jp_0, jp_1); if (DEBUG(JOB)) fprintf(debug_file, "job_pipe %d %d, maxjobs %d, tokens %d, compat %d\n", jp_0, jp_1, maxJobs, maxJobTokens, compatMake); Main_ExportMAKEFLAGS(TRUE); /* initial export */ /* * For compatibility, look at the directories in the VPATH variable * and add them to the search path, if the variable is defined. The * variable's value is in the same format as the PATH envariable, i.e. * <directory>:<directory>:<directory>... */ if (Var_Exists("VPATH", VAR_CMD)) { char *vpath, savec; /* * GCC stores string constants in read-only memory, but * Var_Subst will want to write this thing, so store it * in an array */ static char VPATH[] = "${VPATH}"; vpath = Var_Subst(NULL, VPATH, VAR_CMD, VARF_WANTRES); path = vpath; do { /* skip to end of directory */ for (cp = path; *cp != ':' && *cp != '\0'; cp++) continue; /* Save terminator character so know when to stop */ savec = *cp; *cp = '\0'; /* Add directory to search path */ (void)Dir_AddDir(dirSearchPath, path); *cp = savec; path = cp + 1; } while (savec == ':'); free(vpath); } /* * Now that all search paths have been read for suffixes et al, it's * time to add the default search path to their lists... */ Suff_DoPaths(); /* * Propagate attributes through :: dependency lists. */ Targ_Propagate(); /* print the initial graph, if the user requested it */ if (DEBUG(GRAPH1)) Targ_PrintGraph(1); /* print the values of any variables requested by the user */ if (printVars) { LstNode ln; Boolean expandVars; if (debugVflag) expandVars = FALSE; else expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE); for (ln = Lst_First(variables); ln != NULL; ln = Lst_Succ(ln)) { char *var = (char *)Lst_Datum(ln); char *value; if (strchr(var, '$')) { value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, VARF_WANTRES); } else if (expandVars) { char tmp[128]; if (snprintf(tmp, sizeof(tmp), "${%s}", var) >= (int)(sizeof(tmp))) Fatal("%s: variable name too big: %s", progname, var); value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL, VARF_WANTRES); } else { value = Var_Value(var, VAR_GLOBAL, &p1); } printf("%s\n", value ? value : ""); free(p1); } } else { /* * Have now read the entire graph and need to make a list of * targets to create. If none was given on the command line, * we consult the parsing module to find the main target(s) * to create. */ if (Lst_IsEmpty(create)) targs = Parse_MainName(); else targs = Targ_FindList(create, TARG_CREATE); if (!compatMake) { /* * Initialize job module before traversing the graph * now that any .BEGIN and .END targets have been read. * This is done only if the -q flag wasn't given * (to prevent the .BEGIN from being executed should * it exist). */ if (!queryFlag) { Job_Init(); jobsRunning = TRUE; } /* Traverse the graph, checking on all the targets */ outOfDate = Make_Run(targs); } else { /* * Compat_Init will take care of creating all the * targets as well as initializing the module. */ Compat_Run(targs); } } #ifdef CLEANUP Lst_Destroy(targs, NULL); Lst_Destroy(variables, NULL); Lst_Destroy(makefiles, NULL); Lst_Destroy(create, (FreeProc *)free); #endif /* print the graph now it's been processed if the user requested it */ if (DEBUG(GRAPH2)) Targ_PrintGraph(2); Trace_Log(MAKEEND, 0); if (enterFlagObj) printf("%s: Leaving directory `%s'\n", progname, objdir); if (enterFlag) printf("%s: Leaving directory `%s'\n", progname, curdir); #ifdef USE_META meta_finish(); #endif Suff_End(); Targ_End(); Arch_End(); Var_End(); Parse_End(); Dir_End(); Job_End(); Trace_End(); return outOfDate ? 1 : 0; }
EXPORT void TraceAgent_WriteTrace(MODULE_IDS moduleID, Severities severity, const char* file, const char* function, int line,const char *fmt, ...) { va_list arglist; struct tm timeinfo; time_t currTime; BOOL result; const char *delimitedFileName = NULL; int tmpByteWritten; char userMessage[512] = {0}, fullMsg[512 + 128] = {0}; if (FALSE == OSAL_atomic_compareExchange((LPLONG) & isInitialized, FALSE, FALSE)) { result = Trace_Init(); if (result ==FALSE) return; } OSAL_enter_critical_section(&csWriteProt); // Leave is in the other part of the macro // Make sure that the log file is initialized if (gLogFile == NULL) { OSAL_exit_critical_section(&csWriteProt); return; } if ((moduleID & gModuleID) && (severity & gSeverity)) { delimitedFileName = strrchr(file, '/'); if (delimitedFileName == NULL) { delimitedFileName = file; } else { delimitedFileName = delimitedFileName + 1; } currTime = time(NULL); timeinfo = *(localtime(&currTime)); va_start(arglist, fmt); vsnprintf(userMessage, 512, fmt, arglist); va_end(arglist); snprintf(fullMsg, 512 + 128, "%s [%s]", userMessage, function); tmpByteWritten = fprintf(gLogFile, "%02d:%02d:%02d:%12u @%-8s @%-15s@%-150s@%-16s(%d)\t@%s\n", timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec, OSAL_get_threadid(), GetSeverityName((Severities)severity), GetModuleName((MODULE_IDS)moduleID), fullMsg, delimitedFileName, line, gcProcessName); fflush(gLogFile); } OSAL_exit_critical_section(&csWriteProt); }
int Tk_utils_Init(Tcl_Interp *interp) { char *s, c[20], *lib = NULL, buf[1024]; our_interp = interp; /* FIXME: Remove this, but firstly we need to remove from tcl code */ Tcl_SetVar2(interp, "licence","type", "f", TCL_GLOBAL_ONLY); /* Master subversion repository version */ Tcl_SetVar(interp, "svn_version", SVN_VERS, TCL_GLOBAL_ONLY); /* Keyed lists from tclX */ TclX_KeyedListInit(interp); /* Our updated Raster widget */ Raster_Init(interp); /* Our own widgets and commands */ Tk_utils_Misc_Init(interp); TextOutput_Init(interp); Trace_Init(interp); Sheet_Init(interp); /* Other ancillary commands */ Tcl_CreateObjCommand(interp, "read_seq_trace", tcl_read_seq_trace, (ClientData) NULL, NULL); /* Used only by spin2; not currently supported */ /* Container_Init(interp); Tk_CreateItemType(&tkGraphType); Tcl_GraphInit(interp); */ /* SeqReg_Init(interp); */ /* * The auto_path. */ if (lib = getenv("STADTCL")) { sprintf(buf, "%s/tk_utils", lib); lib = buf; } if (lib) { char *argv[3]; int argc = 3; char *merged; argv[0] = "lappend"; argv[1] = "auto_path"; argv[2] = lib; Tcl_Eval(interp, merged = Tcl_Merge(argc, argv)); Tcl_Free(merged); } /* * Set packages(name). This is done to prevent subsequent reloading * of this library (for efficiency reasons). The only reason that this * is necessary is that currently gap4 dynamically links with some * libraries at link time. When they're all at run time this won't * be necessary. */ if (s = Tcl_GetVar2(interp, "packages", "tk_utils", TCL_GLOBAL_ONLY)) sprintf(c, "%d", atoi(s)|2); else strcpy(c, "2"); Tcl_SetVar2(interp, "packages", "tk_utils", c, TCL_GLOBAL_ONLY); /* * tk_utils_defs (a Tcl_Obj pointer) * * We keep this up to date by creating a write trace on the object and * doing an ObjGetVar2 when it changes. This way the object is always * valid. * Firstly we have to create tk_utils_defs though as initially it doesn't * exist. */ { Tcl_Obj *val = Tcl_NewStringObj("", -1); defs_name = Tcl_NewStringObj("tk_utils_defs", -1); /* global */ tk_utils_defs = Tcl_ObjSetVar2(interp, defs_name, NULL, val, TCL_GLOBAL_ONLY); Tcl_TraceVar(interp, "tk_utils_defs", TCL_TRACE_WRITES | TCL_GLOBAL_ONLY, tk_utils_defs_trace, NULL); } return Tcl_PkgProvide(interp, "tk_utils", "1.0"); }
void main(void) { #else int g_start_gl = 1; int main(int argc, const char** argv) { if ((argc > 1) && (argv[1][0] == 'h')) g_start_gl = 0; #endif /* softReset() on x86 will jump here! */ softResetJumpDestination(); InitAll(); while(1) { Timer_StartStopwatch(eMAIN); #ifndef __CC8E__ // give opengl thread a chance to run usleep(10); #endif /* #ifndef __CC8E__ */ do_and_measure(Platform_CheckInputs); do_and_measure(Error_Throw); do_and_measure(CommandIO_GetCommands); if(g_UpdateLedStrip > 0) { do_and_measure(Ledstrip_UpdateLed); Timer1Enable(); g_UpdateLedStrip = 0; } Timer_StopStopwatch(eMAIN); do_and_measure(ScriptCtrl_Run); if(g_UpdateLed > 0) { do_and_measure(Ledstrip_DoFade); Timer5InterruptLock(); g_UpdateLed = 0; Timer5InterruptUnlock(); } } } //*********************** UNTERPROGRAMME ********************************************** void InitAll() { clearRAM(); Trace_Init(); Platform_OsciInit(); Platform_IOInit(); RingBuf_Init(&g_RingBuf); UART_Init(); Timer_Init(); Ledstrip_Init(); CommandIO_Init(); Rtc_Init(); ScriptCtrl_Init(); ExtEeprom_Init(); #ifndef __CC8E__ init_x86(g_start_gl); #endif /* #ifndef CC8E */ Platform_AllowInterrupts(); /* Startup Wait-Time 2s * to protect Wifly-Modul from errors*/ gScriptBuf.waitValue = 20; CommandIO_CreateResponse(&g_ResponseBuf, FW_STARTED, OK); CommandIO_SendResponse(&g_ResponseBuf); Trace_String(" Init Done "); Platform_DisableBootloaderAutostart(); }
/* *---------------------------------------------------------------------- * * Rpc_Init -- * * Allocate and set up the tables used by the RPC system. This * should be called after virtual memory allocation can be done and * before any RPCs are attempted. This allocates the Client Channel * data structures and some stuff for the Rpc Servers' state. The * number of client channels is fixed by rpcNumChannels, but the * number of RPC server processes can grow via the Rpc_Deamon process. * * Results: * None. * * Side effects: * Allocate space for tables, and set the initial state for the * client channels and the servers. * *---------------------------------------------------------------------- */ void Rpc_Init() { int i; register int frag; extern void RpcInitServerTraces(); /* * Initialize sets of time parameters. These structures are used in * the RpcDoCall code. This is much too hard coded, and someone * should figure out how to dynamically determine these parameters. * * Ethernet - retry after 0.1 seconds, .5 seconds if fragmenting. * Double this until the retry interval is 1 second. * Retry at most 8 times, for a total timeout period of * .1 + .2 + .4 + .8 + 1.0 + 1.0 + 1.0 + 1.0 = 5.5 * .5 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 = 7.5 (frag) * If we are recieving acks, then back off and probe every 5 seconds. * If we get acked 10 times then give a warning. */ rpcEtherConst.retryMsec = 100; rpcEtherConst.retryWait = 100 * timer_IntOneMillisecond; rpcEtherConst.fragRetryMsec = 500; rpcEtherConst.fragRetryWait = 500 * timer_IntOneMillisecond; rpcEtherConst.maxAckMsec = 5000; rpcEtherConst.maxAckWait = 5000 * timer_IntOneMillisecond; rpcEtherConst.maxTimeoutMsec = 1000; rpcEtherConst.maxTimeoutWait = 1000 * timer_IntOneMillisecond; rpcEtherConst.maxTries = 8; rpcEtherConst.maxAcks = 10; /* * Internet (IP) - retry after 0.5 seconds, 1.0 if fragmenting. * Double this until the retry interval is 4 seconds. * Retry at most 8 times, for a total timeout period of * .5 + 1.0 + 2.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 = 23.5 * 1.0 + 2.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 = 27.0 (frag) * If we are recieving acks, then back off and probe every 5 seconds. * If we get acked 10 times then give a warning. */ rpcInetConst.retryMsec = 500; rpcInetConst.retryWait = 500 * timer_IntOneMillisecond; rpcInetConst.fragRetryMsec = 1000; rpcInetConst.fragRetryWait = 1000 * timer_IntOneMillisecond; rpcInetConst.maxAckMsec = 5000; rpcInetConst.maxAckWait = 5000 * timer_IntOneMillisecond; rpcInetConst.maxTimeoutMsec = 4000; rpcInetConst.maxTimeoutWait = 4000 * timer_IntOneMillisecond; rpcInetConst.maxTries = 8; rpcInetConst.maxAcks = 10; /* * TRACE and HISTOGRAM initialization. */ Trace_Init(rpcTraceHdrPtr, RPC_TRACE_LEN, sizeof(RpcHdr), 0); rpcServiceTime[0] = (Rpc_Histogram *)NIL; rpcCallTime[0] = (Rpc_Histogram *)NIL; for (i=1 ; i<=RPC_LAST_COMMAND ; i++) { rpcServiceTime[i] = Rpc_HistInit(RPC_NUM_HIST_BUCKETS, 1024); rpcCallTime[i] = Rpc_HistInit(RPC_NUM_HIST_BUCKETS, 1024); } /* * Set our preferred inter-fragment delay based on machine type. * This is a microsecond value. Our output rate starts the same * as the input rate, although MyDelay could increase if a machine * senses that it is overloaded. */ RpcGetMachineDelay(&rpcMyDelay, &rpcOutputRate); /* * The client channel table is kept as a pointer to an array of pointers * to client channels. First allocate the table of pointers and then * allocate storage for each channel. */ rpcChannelPtrPtr = (RpcClientChannel **) Vm_RawAlloc(rpcNumChannels * sizeof(RpcClientChannel *)); /* * Query the net module of the maximum size protocol header buffer * needed. */ for (i=0 ; i<rpcNumChannels ; i++) { register RpcClientChannel *chanPtr; chanPtr = (RpcClientChannel *)Vm_RawAlloc(sizeof(RpcClientChannel)); rpcChannelPtrPtr[i] = chanPtr; chanPtr->state = CHAN_FREE; chanPtr->index = i; chanPtr->serverID = -1; Sync_SemInitDynamic(&chanPtr->mutex,"Rpc:RpcClientChannel.mutex"); Sync_SemRegister(&chanPtr->mutex); chanPtr->waitCondition.waiting = FALSE; /* * Set up header storage and the scatter/gather sets used to * refer to a whole message. This is done for each type * of packet (request, reply ack), plus an array of these * things used for fragmenting our request. */ RpcBufferInit((RpcHdr *) &chanPtr->requestRpcHdr, &chanPtr->request, chanPtr->index, -1); RpcBufferInit(&chanPtr->replyRpcHdr, &chanPtr->reply, chanPtr->index, -1); RpcBufferInit(&chanPtr->ackHdr, &chanPtr->ack, chanPtr->index, -1); for (frag=0 ; frag < RPC_MAX_NUM_FRAGS ; frag++) { RpcBufferInit(&chanPtr->fragRpcHdr[frag], &chanPtr->fragment[frag], chanPtr->index, -1); } } /* * Initialize server nack info. */ Sync_SemInitDynamic(&rpcNack.mutex,"Rpc:RpcNackData.mutex"); Sync_SemRegister(&rpcNack.mutex); /* * Set nack buffers to NIL until allocated when rpc system turned on. */ rpcNack.numFree = 0; rpcNack.rpcHdrArray = (RpcHdr *) NIL; rpcNack.hdrState = (int *) NIL; rpcNack.bufferSet = (RpcBufferSet *) NIL; /* * Initialize client's table on whether servers are sending negative * acknowledgements or not (if channel ramping-down is used). */ RpcInitServerChannelState(); /* * Initialize neg-ack back-off constants on clients. */ rpcNackRetryWait = 2 * timer_IntOneSecond; rpcMaxNackWait = 15 * timer_IntOneSecond; /* * Initialize the servers' state table. Most slots are left * uninitialized. They get filled in by Rpc_Deamon when it creates * new server processes. After creation, a server process * claims a table entry with RpcServerInstall. */ rpcServerPtrPtr = (RpcServerState **) Vm_RawAlloc(rpcAbsoluteMaxServers * sizeof(RpcServerState *)); for (i=0 ; i<rpcMaxServers ; i++) { rpcServerPtrPtr[i] = (RpcServerState *)NIL; } /* * Ask the net module to set up our Sprite ID. It uses either * existing (compiled in) addresses or Reverse ARP. If we can't * figure out our ID we use zero and rely on the RPC server to * propogate our Sprite ID back in the first RPC reply message. * We try all the interfaces until we get one that works. */ for (i = 0; ; i++) { Net_Interface *interPtr; interPtr = Net_NextInterface(TRUE, &i); if (interPtr == (Net_Interface *) NIL) { break; } rpc_SpriteID = Net_AddrToID(&interPtr->netAddress[NET_PROTO_RAW]); if (rpc_SpriteID > 0) { break; } } if (rpc_SpriteID < 0) { rpc_SpriteID = 0; } RpcInitServerTraces(); return; }
/*- * main -- * The main function, for obvious reasons. Initializes variables * and a few modules, then parses the arguments give it in the * environment and on the command line. Reads the system makefile * followed by either Makefile, makefile or the file given by the * -f argument. Sets the .MAKEFLAGS PMake variable based on all the * flags it has received by then uses either the Make or the Compat * module to create the initial list of targets. * * Results: * If -q was given, exits -1 if anything was out-of-date. Else it exits * 0. * * Side Effects: * The program exits when done. Targets are created. etc. etc. etc. */ int main(int argc, char **argv) { Lst targs; /* target nodes to create -- passed to Make_Init */ Boolean outOfDate = TRUE; /* FALSE if all targets up to date */ struct stat sb, sa; char *p1, *path, *pwd; char mdpath[MAXPATHLEN]; #ifdef FORCE_MACHINE char *machine = FORCE_MACHINE; #else char *machine = getenv("MACHINE"); #endif const char *machine_arch = getenv("MACHINE_ARCH"); char *syspath = getenv("MAKESYSPATH"); Lst sysMkPath; /* Path of sys.mk */ char *cp = NULL, *start; /* avoid faults on read-only strings */ static char defsyspath[] = DEFAULT_SYS_PATH; char found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */ struct timeval rightnow; /* to initialize random seed */ /* * Set the seed to produce a different random sequences * on each program execution. */ gettimeofday(&rightnow, NULL); srandom(rightnow.tv_sec + rightnow.tv_usec); if ((progname = strrchr(argv[0], '/')) != NULL) progname++; else progname = argv[0]; #ifdef RLIMIT_NOFILE /* * get rid of resource limit on file descriptors */ { struct rlimit rl; if (getrlimit(RLIMIT_NOFILE, &rl) != -1 && rl.rlim_cur != rl.rlim_max) { rl.rlim_cur = rl.rlim_max; (void)setrlimit(RLIMIT_NOFILE, &rl); } } #endif /* * Find where we are and take care of PWD for the automounter... * All this code is so that we know where we are when we start up * on a different machine with pmake. */ if (getcwd(curdir, MAXPATHLEN) == NULL) { (void)fprintf(stderr, "%s: %s.\n", progname, strerror(errno)); exit(2); } if (stat(curdir, &sa) == -1) { (void)fprintf(stderr, "%s: %s: %s.\n", progname, curdir, strerror(errno)); exit(2); } /* * Overriding getcwd() with $PWD totally breaks MAKEOBJDIRPREFIX * since the value of curdir can very depending on how we got * here. Ie sitting at a shell prompt (shell that provides $PWD) * or via subdir.mk in which case its likely a shell which does * not provide it. * So, to stop it breaking this case only, we ignore PWD if * MAKEOBJDIRPREFIX is set or MAKEOBJDIR contains a transform. */ #ifndef NO_PWD_OVERRIDE if ((pwd = getenv("PWD")) != NULL && getenv("MAKEOBJDIRPREFIX") == NULL) { const char *makeobjdir = getenv("MAKEOBJDIR"); if (makeobjdir == NULL || !strchr(makeobjdir, '$')) { if (stat(pwd, &sb) == 0 && sa.st_ino == sb.st_ino && sa.st_dev == sb.st_dev) (void)strncpy(curdir, pwd, MAXPATHLEN); } } #endif /* * Get the name of this type of MACHINE from utsname * so we can share an executable for similar machines. * (i.e. m68k: amiga hp300, mac68k, sun3, ...) * * Note that both MACHINE and MACHINE_ARCH are decided at * run-time. */ if (!machine) { #ifdef MAKE_NATIVE struct utsname utsname; if (uname(&utsname) == -1) { (void)fprintf(stderr, "%s: uname failed (%s).\n", progname, strerror(errno)); exit(2); } machine = utsname.machine; #else #ifdef MAKE_MACHINE machine = MAKE_MACHINE; #else machine = "unknown"; #endif #endif } if (!machine_arch) { #ifndef MACHINE_ARCH #ifdef MAKE_MACHINE_ARCH machine_arch = MAKE_MACHINE_ARCH; #else machine_arch = "unknown"; #endif #else machine_arch = MACHINE_ARCH; #endif } /* * Just in case MAKEOBJDIR wants us to do something tricky. */ Var_Init(); /* Initialize the lists of variables for * parsing arguments */ Var_Set(".CURDIR", curdir, VAR_GLOBAL, 0); Var_Set("MACHINE", machine, VAR_GLOBAL, 0); Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL, 0); #ifdef MAKE_VERSION Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL, 0); #endif Var_Set(".newline", "\n", VAR_GLOBAL, 0); /* handy for :@ loops */ /* * Find the .OBJDIR. If MAKEOBJDIRPREFIX, or failing that, * MAKEOBJDIR is set in the environment, try only that value * and fall back to .CURDIR if it does not exist. * * Otherwise, try _PATH_OBJDIR.MACHINE, _PATH_OBJDIR, and * finally _PATH_OBJDIRPREFIX`pwd`, in that order. If none * of these paths exist, just use .CURDIR. */ Dir_Init(curdir); (void)Main_SetObjdir(curdir); if ((path = getenv("MAKEOBJDIRPREFIX")) != NULL) { (void)snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir); (void)Main_SetObjdir(mdpath); } else if ((path = getenv("MAKEOBJDIR")) != NULL) { (void)Main_SetObjdir(path); } else { (void)snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine); if (!Main_SetObjdir(mdpath) && !Main_SetObjdir(_PATH_OBJDIR)) { (void)snprintf(mdpath, MAXPATHLEN, "%s%s", _PATH_OBJDIRPREFIX, curdir); (void)Main_SetObjdir(mdpath); } } create = Lst_Init(FALSE); makefiles = Lst_Init(FALSE); printVars = FALSE; variables = Lst_Init(FALSE); beSilent = FALSE; /* Print commands as executed */ ignoreErrors = FALSE; /* Pay attention to non-zero returns */ noExecute = FALSE; /* Execute all commands */ noRecursiveExecute = FALSE; /* Execute all .MAKE targets */ keepgoing = FALSE; /* Stop on error */ allPrecious = FALSE; /* Remove targets when interrupted */ queryFlag = FALSE; /* This is not just a check-run */ noBuiltins = FALSE; /* Read the built-in rules */ touchFlag = FALSE; /* Actually update targets */ usePipes = TRUE; /* Catch child output in pipes */ debug = 0; /* No debug verbosity, please. */ jobsRunning = FALSE; maxLocal = DEFMAXLOCAL; /* Set default local max concurrency */ #ifdef REMOTE maxJobs = DEFMAXJOBS; /* Set default max concurrency */ #else maxJobs = maxLocal; #endif compatMake = FALSE; /* No compat mode */ /* * Initialize the parsing, directory and variable modules to prepare * for the reading of inclusion paths and variable settings on the * command line */ /* * Initialize various variables. * MAKE also gets this name, for compatibility * .MAKEFLAGS gets set to the empty string just in case. * MFLAGS also gets initialized empty, for compatibility. */ Parse_Init(); Var_Set("MAKE", argv[0], VAR_GLOBAL, 0); Var_Set(".MAKE", argv[0], VAR_GLOBAL, 0); Var_Set(MAKEFLAGS, "", VAR_GLOBAL, 0); Var_Set(MAKEOVERRIDES, "", VAR_GLOBAL, 0); Var_Set("MFLAGS", "", VAR_GLOBAL, 0); Var_Set(".ALLTARGETS", "", VAR_GLOBAL, 0); /* * First snag any flags out of the MAKE environment variable. * (Note this is *not* MAKEFLAGS since /bin/make uses that and it's * in a different format). */ #ifdef POSIX Main_ParseArgLine(getenv("MAKEFLAGS")); #else Main_ParseArgLine(getenv("MAKE")); #endif MainParseArgs(argc, argv); /* * Be compatible if user did not specify -j and did not explicitly * turned compatibility on */ if (!compatMake && !forceJobs) { compatMake = TRUE; } /* * Initialize archive, target and suffix modules in preparation for * parsing the makefile(s) */ Arch_Init(); Targ_Init(); Suff_Init(); Trace_Init(tracefile); DEFAULT = NILGNODE; (void)time(&now); Trace_Log(MAKESTART, NULL); /* * Set up the .TARGETS variable to contain the list of targets to be * created. If none specified, make the variable empty -- the parser * will fill the thing in with the default or .MAIN target. */ if (!Lst_IsEmpty(create)) { LstNode ln; for (ln = Lst_First(create); ln != NILLNODE; ln = Lst_Succ(ln)) { char *name = (char *)Lst_Datum(ln); Var_Append(".TARGETS", name, VAR_GLOBAL); } } else Var_Set(".TARGETS", "", VAR_GLOBAL, 0); /* * If no user-supplied system path was given (through the -m option) * add the directories from the DEFSYSPATH (more than one may be given * as dir1:...:dirn) to the system include path. */ if (syspath == NULL || *syspath == '\0') syspath = defsyspath; else syspath = strdup(syspath); for (start = syspath; *start != '\0'; start = cp) { for (cp = start; *cp != '\0' && *cp != ':'; cp++) continue; if (*cp == ':') { *cp++ = '\0'; } /* look for magic parent directory search string */ if (strncmp(".../", start, 4) != 0) { (void)Dir_AddDir(defIncPath, start); } else { if (Dir_FindHereOrAbove(curdir, start+4, found_path, sizeof(found_path))) { (void)Dir_AddDir(defIncPath, found_path); } } } if (syspath != defsyspath) free(syspath); /* * Read in the built-in rules first, followed by the specified * makefile, if it was (makefile != NULL), or the default * makefile and Makefile, in that order, if it wasn't. */ if (!noBuiltins) { LstNode ln; sysMkPath = Lst_Init(FALSE); Dir_Expand(_PATH_DEFSYSMK, Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath, sysMkPath); if (Lst_IsEmpty(sysMkPath)) Fatal("%s: no system rules (%s).", progname, _PATH_DEFSYSMK); ln = Lst_Find(sysMkPath, (ClientData)NULL, ReadMakefile); if (ln != NILLNODE) Fatal("%s: cannot open %s.", progname, (char *)Lst_Datum(ln)); } if (!Lst_IsEmpty(makefiles)) { LstNode ln; ln = Lst_Find(makefiles, (ClientData)NULL, ReadMakefile); if (ln != NILLNODE) Fatal("%s: cannot open %s.", progname, (char *)Lst_Datum(ln)); } else if (!ReadMakefile(UNCONST("makefile"), NULL)) (void)ReadMakefile(UNCONST("Makefile"), NULL); (void)ReadMakefile(UNCONST(".depend"), NULL); Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL); if (p1) free(p1); if (!jobServer && !compatMake) Job_ServerStart(maxJobs); if (DEBUG(JOB)) printf("job_pipe %d %d, maxjobs %d maxlocal %d compat %d\n", job_pipe[0], job_pipe[1], maxJobs, maxLocal, compatMake); Main_ExportMAKEFLAGS(TRUE); /* initial export */ #ifndef NO_CHECK_MAKE_CHDIR Check_Cwd_av(0, NULL, 0); /* initialize it */ #endif /* * For compatibility, look at the directories in the VPATH variable * and add them to the search path, if the variable is defined. The * variable's value is in the same format as the PATH envariable, i.e. * <directory>:<directory>:<directory>... */ if (Var_Exists("VPATH", VAR_CMD)) { char *vpath, savec; /* * GCC stores string constants in read-only memory, but * Var_Subst will want to write this thing, so store it * in an array */ static char VPATH[] = "${VPATH}"; vpath = Var_Subst(NULL, VPATH, VAR_CMD, FALSE); path = vpath; do { /* skip to end of directory */ for (cp = path; *cp != ':' && *cp != '\0'; cp++) continue; /* Save terminator character so know when to stop */ savec = *cp; *cp = '\0'; /* Add directory to search path */ (void)Dir_AddDir(dirSearchPath, path); *cp = savec; path = cp + 1; } while (savec == ':'); free(vpath); } /* * Now that all search paths have been read for suffixes et al, it's * time to add the default search path to their lists... */ Suff_DoPaths(); /* * Propagate attributes through :: dependency lists. */ Targ_Propagate(); /* print the initial graph, if the user requested it */ if (DEBUG(GRAPH1)) Targ_PrintGraph(1); /* print the values of any variables requested by the user */ if (printVars) { LstNode ln; for (ln = Lst_First(variables); ln != NILLNODE; ln = Lst_Succ(ln)) { char *var = (char *)Lst_Datum(ln); char *value; if (strchr(var, '$')) { value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, 0); } else { value = Var_Value(var, VAR_GLOBAL, &p1); } printf("%s\n", value ? value : ""); if (p1) free(p1); } } /* * Have now read the entire graph and need to make a list of targets * to create. If none was given on the command line, we consult the * parsing module to find the main target(s) to create. */ if (Lst_IsEmpty(create)) targs = Parse_MainName(); else targs = Targ_FindList(create, TARG_CREATE); if (!compatMake && !printVars) { /* * Initialize job module before traversing the graph, now that * any .BEGIN and .END targets have been read. This is done * only if the -q flag wasn't given (to prevent the .BEGIN from * being executed should it exist). */ if (!queryFlag) { if (maxLocal == -1) maxLocal = maxJobs; Job_Init(maxJobs, maxLocal); jobsRunning = TRUE; } /* Traverse the graph, checking on all the targets */ outOfDate = Make_Run(targs); } else if (!printVars) { /* * Compat_Init will take care of creating all the targets as * well as initializing the module. */ Compat_Run(targs); } #ifdef CLEANUP Lst_Destroy(targs, NOFREE); Lst_Destroy(variables, NOFREE); Lst_Destroy(makefiles, NOFREE); Lst_Destroy(create, (FreeProc *)free); #endif /* print the graph now it's been processed if the user requested it */ if (DEBUG(GRAPH2)) Targ_PrintGraph(2); Trace_Log(MAKEEND, 0); Suff_End(); Targ_End(); Arch_End(); Var_End(); Parse_End(); Dir_End(); Job_End(); Trace_End(); if (queryFlag && outOfDate) return(1); else return(0); }