_termSubprocId _DtTermPrimAddSubproc(Widget w, pid_t pid, _termSubprocProc proc, XtPointer client_data) { subprocInfo *subprocTmp; /* malloc a new entry... */ subprocTmp = (subprocInfo *) XtCalloc(1, sizeof(subprocInfo)); /* fill in the structures... */ subprocTmp->pid = pid; subprocTmp->w = w; subprocTmp->proc = proc; subprocTmp->client_data = client_data; subprocTmp->signal_id = XtAppAddSignal(XtWidgetToApplicationContext(w), InvokeCallbacks, subprocTmp); /* insert it after the head of the list... */ _DtTermProcessLock(); subprocTmp->prev = subprocHead; subprocTmp->next = subprocHead->next; subprocHead->next = subprocTmp; if (subprocTmp->next) { subprocTmp->next->prev = subprocTmp; } _DtTermProcessUnlock(); /* return the pointer... */ return((_termSubprocId) subprocTmp); }
/*-------------------------------------------------------------------------*/ int main( int argc, char **argv ) { Widget StartupWindow = 0; Arg args[10]; Cardinal ac = 0; #ifdef L10N char *lang; #endif /* static char app_name[1024]; */ int i; XrmDatabase qmon_database; static char progname[256]; DENTER_MAIN(TOP_LAYER, "qmon_main"); #ifndef L10N setlocale(LC_ALL, "C"); putenv("LANG=C"); putenv("LC_ALL=C"); #endif /* INSTALL SIGNAL HANDLER */ qmonInstSignalHandler(); strcpy(progname, argv[0]); /* GENERAL SGE SETUP */ if (!(argc > 1 && !strcmp(argv[1], "-help"))) { qmonInitSge(&ctx, progname, 0); } else { /* -help */ qmonInitSge(&ctx, progname, 1); } SGE_ROOT = ctx->get_sge_root(ctx); /* ** Attention !!! Change the XtMalloc() above if you add additional args */ ac = 0; XtSetArg(args[ac], XmtNconfigDir, SGE_ROOT); ac++; XtSetArg(args[ac], XmtNconfigPath, "%R/locale/%L/%N%S:%R/locale/%l/%N%S:%R/locale/%l_%t.%c/%N%S:%R/qmon/%N%S"); ac++; /* XtSetArg(args[ac], XmtNpixmapFilePath, "%R/qmon/PIXMAPS/%N.xpm"); ac++; */ /* XtSetArg(args[ac], XmtNcontextHelpFile, "qmon_help"); ac++; */ XtSetArg(args[ac], XtNtitle, "QMON +++ Main Control"); ac++; /* ** SETUP XMT, here qmon_version is checked, ** so here an exit is possible */ AppShell = XmtInitialize( &AppContext, APP_NAME, NULL, 0, &argc, argv, qmon_fallbacks, args, ac); sigint_id = XtAppAddSignal(AppContext, sigint_callback, NULL); #if 0 /* ** protocoll the actions performed by qmon */ XtAppAddActionHook(AppContext, TraceActions, NULL); #endif #ifdef L10N /* ** Internationalization: ** The qmon_messages.ad file is installed under ** $SGE_ROOT/qmon/locale/<LANG>/qmon_messages.ad ** Read in the _Messages_ catalogue */ if (((lang = getenv("LC_MESSAGES")) || (lang = getenv("LC_ALL")) || (lang = getenv("LANG"))) && lang && strcasecmp(lang, "POSIX") && strcasecmp(lang, "C")) { DPRINTF(("lang: '%s'\n", lang)); if (!strcasecmp(lang, "relabel")) lang = "C"; XmtLoadResourceFile(AppShell, "qmon_messages", False, True); } #endif #if 0 strcpy(app_name, "QMON +++ Main Control"); if (strcmp(uti_state_get_default_cell(), "default")) { strcat(app_name, " @ "); strncat(app_name, uti_state_get_default_cell(), 1000); } XtVaSetValues(AppShell, XtNtitle, XmtLocalize(AppShell, app_name, "QMON +++ Main Control"), NULL); #endif XtVaSetValues(AppShell, XtNtitle, XmtLocalize(AppShell, "QMON +++ Main Control", "QMON +++ Main Control"), NULL); /* ** we must shift the usage here for internationalization */ if (helpset) { qmonUsage(AppShell); qmonExitFunc(0); } /* ** get the dialog resource files, they override any settings from the ** Qmon app default file concerning dialogue descriptions */ qmon_database = XtDatabase(XtDisplay(AppShell)); for (i=0; qmon_dialogs[i]; i++) { XrmPutLineResource(&qmon_database, qmon_dialogs[i]); } #if 0 /* ** Debugging: ** write contents of Resource DB to file DB.TXT in cwd */ XrmPutFileDatabase(qmon_database, "DB.TXT"); #endif /* ** read qmon preferences file ~/.qmon_preferences, it contains ** customization info for Queue and Job Control dialogues */ qmonReadPreferences(); /* ** display of startup screen ? */ if (!nologo) { /* show the user we're starting up */ StartupWindow = qmonStartupWindow(AppShell); } /* ** INITIALIZE Graphics Contexts */ qmonCreateGC(AppShell); /* ** Allocate Pixel values */ qmonAllocColor(AppShell); /* ** Cache all Icons */ qmonLoadIcons(); /* ** set the close button callback ** cause the close button to call the qmonExitCB() ** set the icon and iconName after qmonLoadIcons() */ XmtCreatePixmapIcon(AppShell, qmonGetIcon("mcicon"), None); XtVaSetValues(AppShell, XtNiconName, "qmon:Main Control", NULL); XmtAddDeleteCallback(AppShell, XmDO_NOTHING, qmonExitCB, NULL); /* ** CREATE MainControl */ MainControl = qmonCreateMainControl(AppShell); /* ** install context help */ XmtHelpInstallContextHelp(AppShell, XmtHelpContextHelpCallback, NULL); /* XmtHelpParseFile(AppShell, "qmon_help"); */ /* ** initialize QmonMirrorList entries */ qmonMirrorListInit(); /* ** setup timers */ qmonStartPolling(AppContext); #ifdef HAS_EDITRES /* ** Plug in editres protocol handler */ XtAddEventHandler (AppShell, (EventMask)0, True, _XEditResCheckMessages, (XtPointer)NULL); #endif /* ** Popdown startup screen and destroy it */ if (!nologo) { sleep(1); XtDestroyWidget(StartupWindow); } XtRealizeWidget(AppShell); XtAppMainLoop(AppContext); return 0; }