int main(int argc, char **argv) { unused(argc); printf("argv[0] == `%s`\n", argv[0]); printf("ProgramName returned `%s`\n", ProgramName(argv[0], "turnip")); return 0; }
/* * Print usage message for the command line options. */ void usage(char* prog, int real_only, int max_fft_order, const char *summary) { fprintf(stderr, "\n%s: [-hTFI] [-n logsize] [-s scale] [-g signal-type] " "[-S signal value]\n\t\t[-v verbose] [-m minFFT] [-M maxFFT]\n", ProgramName(prog)); fprintf(stderr, summary); fprintf(stderr, " -h\t\tThis help\n"); fprintf(stderr, " -T\t\tIndividual test mode, otherwise run all tests\n"); fprintf(stderr, " -F\t\tDo not run forward FFT tests\n"); fprintf(stderr, " -I\t\tDo not run inverse FFT tests\n"); fprintf(stderr, " -m min\tMinium FFT order to test (default 2)\n"); fprintf(stderr, " -M min\tMaximum FFT order to test (default %d)\n", max_fft_order); fprintf(stderr, " -n logsize\tLog2 of FFT size\n"); fprintf(stderr, " -s scale\tScale factor for forward FFT (default = 0)\n"); fprintf(stderr, " -S signal\tBase value for the test signal " "(default = 1024)\n"); fprintf(stderr, " -v level\tVerbose output level (default = 1)\n"); fprintf(stderr, " -g type\tInput signal type:\n"); fprintf(stderr, "\t\t 0 - Constant signal S + i*S. (Default value.)\n"); fprintf(stderr, "\t\t 1 - Real ramp starting at S/N, N = FFT size\n"); fprintf(stderr, "\t\t 2 - Sine wave of amplitude S\n"); if (!real_only) fprintf(stderr, "\t\t 3 - Complex signal whose transform is a sine " "wave.\n"); exit(0); }
ProgVar_ operator[](std::size_t offset) { Init(); return ProgVar_( ProgramName(this->_program), GLuint(this->_location+offset) ); }
/** * @glsymbols * @glfunref{UniformBlockBinding} */ void Binding(UniformBufferBindingPoint binding) { OGLPLUS_GLFUNC(UniformBlockBinding)( this->_program, this->_location, GLuint(binding) ); OGLPLUS_VERIFY( UniformBlockBinding, ProgVarError, Program(ProgramName(this->_program)). Index(GLuint(binding)) ); }
void ShowHelp(const char * a_ProgramFullName) { AString ProgramName(a_ProgramFullName); size_t idx = ProgramName.rfind(cFile::PathSeparator); if (idx != AString::npos) { ProgramName.erase(0, idx + 1); } printf("Tool written by _Xoft(o), code is public domain.\n"); printf("Usage:\n"); printf("%s [-w <MCAFolder>]\n", ProgramName.c_str()); printf("Zaps blocks and / or entities in specified regions.\n"); printf("Regions are read from stdin, the format is:\n"); printf(" x1 x2 y1 y2 z1 z2 [B|E|BE]\n"); printf("B or no specifier zaps blocks only\n"); printf("E zaps entities only\n"); printf("BE zaps blocks and entities\n"); printf("MCA files are searched in the <MCAFolder>; if not specified, in the current folder.\n"); }
/** * @glsymbols * @glfunref{GetIntegerv} */ static ProgramName Binding(void) { return ProgramName(_binding()); }
BOOL SafeToExit( VOID ) { STATIC CONST UBYTE __reallyquitmsg[] = "Do you really want to quit?"; BOOL rc = TRUE, imle; ZoneAlarmTask * zat; int len=0; UBYTE buf[4096]; ENTER(); Forbid(); if(!uSemaLockAttempt ( )) { struct Task * t = uSemaOwner ( ) ; rc = FALSE; ADD("Cannot try to exit right now, Process $%lx (%s) is actively using me!", t, t->tc_Node.ln_Name ); Permit(); RA_Requester(tell_gadgets,buf); } else if(IsMinListEmpty(G->ZoneAlarmTasks)) { /** * There is no tasks using me, pop a single confirmation */ Permit(); if(RA_Requester(ask_gadgets,(STRPTR)__reallyquitmsg)!=1) { rc = FALSE; } } else { /** * There are some programs using me, ask for confirmation * telling the user which tasks are running */ ADD("The following applications are\nstill using %s:\n\n",ProgramName()); ITERATE_LIST( G->ZoneAlarmTasks, ZoneAlarmTask *, zat ) { ADD(" %s ($%lx)\n", zat->task_name, zat->task ); } ADD("\n\033b%s", __reallyquitmsg); DBG_STRING(buf); Permit(); if(RA_Requester("_Quit|_Cancel", buf) == 1) { /** * user really want to quit, break the tasks using me.. */ Forbid(); ITERATE_LIST( G->ZoneAlarmTasks, ZoneAlarmTask *, zat ) { DBG(".........Breaking $%lx (%s)\n", zat->task, zat->task_name); Signal( zat->task, SIGBREAKF_CTRL_C ); } Permit(); /** * do a little delay to let the tasks exit */ Delay( 4 * TICKS_PER_SECOND ); Forbid();//ObtainSemaphore(G->Semaphore); imle = IsMinListEmpty(G->ZoneAlarmTasks) ? TRUE:FALSE; Permit();//ReleaseSemaphore(G->Semaphore); if(imle==FALSE) { /** * uh-oh... some task refused to quit, let the * user know which */ Forbid(); len = 0; ADD("\033b%s is unable to exit, the following\napplications refuse to quit:\033n\n\n", ProgramName()); ITERATE_LIST( G->ZoneAlarmTasks, ZoneAlarmTask *, zat ) { ADD(" %s ($%lx)\n", zat->task_name, zat->task ); } //ADD("\n\033b...try again right now"); ADD("\n\033b...do you want to quit anyway? your\nsystem MAY becomes unstable though\n"); DBG_STRING(buf); Permit(); if(RA_Requester(ask_gadgets,buf)==0) rc = FALSE; } }