int Client(int argc, char** argv) { long type = CLIENT_TO_SERVER; char request[BUFF]; Mesg snd; if(OpenQueue() < 0){ return 1; } done = 1; if(CreateReadThread() < 0) return -1; while (running) { if(done) { rc = ReadArguments(request, argc, argv); if(rc < 0) { return 0; } else if(rc == 1) { continue; } done = 0; strncpy(snd.mesg_data, request, BUFF); snd.mesg_type = type; if(SendMessage(msgQueue, &snd) < 0) { return -1; } } } return 0; }
int main(void) { Object *application, *window; Locale_Initialize(); if (ReadArguments()) { /* FIXME: handle arguments... */ // FROM - import prefs from this file at start // USE - 'use' the loaded prefs immediately, don't open window. // SAVE - 'save' the lodaed prefs immediately, don't open window. FreeArguments(); } application = (Object *)ApplicationObject, MUIA_Application_Title, __(MSG_NAME), MUIA_Application_Version, (IPTR) VERSION, MUIA_Application_Description, __(MSG_DESCRIPTION), MUIA_Application_Base, (IPTR) "FONTPREF", SubWindow, (IPTR) (window = (Object *)SystemPrefsWindowObject, MUIA_Window_ID, MAKE_ID('F','W','I','N'), WindowContents, (IPTR) FPEditorObject, End, End), End; if (application != NULL) { SET(window, MUIA_Window_Open, TRUE); DoMethod(application, MUIM_Application_Execute); SET(window, MUIA_Window_Open, FALSE); MUI_DisposeObject(application); } Locale_Deinitialize(); return 0; }
int main(int argc, char **argv) { // (A) ==== Read in command-line options: ==== // if (argc < 2) { fprintf(stderr,"usage: %s [-f <Input data file>] [-model <model type>] [-gapfile <file with concentration dilution steps.] [-mfile <file with model parameters>] [-pfile <file with priors>] [-n <number of nested objects>] [-max <max number of nesting iterations>] [-mc <number of MCMC trials for finding a new object>] [-D <size of unweighted posterior sample>] [-out <file with unweighted posterior sample>] [-rs <random seed>] \n",argv[0]); exit(1); } int argbase = 1; Options *opt = ReadArguments(argbase, argc, argv); // (B) ==== Read in data and model parameters from files ==== // DATAtable dt(opt->file); DELTAtable dxt(opt->gapfile); Mtable mt(opt->mfile); Ptable pt(opt->pfile); // (C) ==== Carry out nested sampling ==== // Nested nst(dt, dxt, mt, pt, opt->model, opt->n, opt->max, opt->mc, opt->rs); nst.Results(dt, dxt); if (opt->outfile != "none") { nst.MCPosterior(dt, dxt, opt->D, opt->outfile, "adaptive"); // adaptive/fixed } }