static void sigint_handler(int) { // attempt a graceful shutdown cout << "\nShutting down (signal)...." << endl ; FrShutdown() ; exit(1) ; }
int #ifndef __WATCOMC__ __FrCDECL #endif main(int argc, char **argv) { #ifdef __WATCOMC__ FrDestroyWindow() ; // for Watcom, run as raw console app #endif /* __WATCOMC__ */ if (argc > 1) cout << argv[0] << " does not require any arguments." << endl << endl ; cout << "\tFramepaC " FramepaC_Version_string " Test Program" << endl << "\t==========================" << endl << "Use \"* ?\" to list the available commands." << endl ; // deliberately start with a tiny symbol table, to force table expansion as // we use the test program (in fact, the first expansion will happen during // initialization) #if 0 //#ifdef FrMOTIF Widget main_window = XtVaAppInitialize( &app_context, "Framepac Test Program", NULL, 0, &argc, argv, NULL, NULL); FrInitializeMotif("FramepaC Messages",main_window,16) ; #else initialize_FramepaC(16) ; #endif /* FrMOTIF */ FramepaC_set_userinfo_dir(0) ; // set default location FrObject *obj = 0 ; FrSymbol *symbolEOF = FrSymbolTable::add("*EOF*") ; do { if (obj) { obj->freeObject() ; // free the object from prev pass thru the loop obj = 0 ; } FramepaC_bgproc() ; // handle any asynchronous operations cout << "\nEnter a FrObject, NIL to end: " ; cin >> obj ; FramepaC_bgproc() ; // handle any asynchronous operations if (obj && obj->symbolp() && obj == FrSymbolTable::add("*")) interpret_command(cout,cin,True) ; else display_object_info(cout,obj) ; FramepaC_bgproc() ; // handle any asynchronous operations } while (!NIL_symbol(obj) && obj != symbolEOF) ; #if 0 //#ifdef FrMOTIF FrShutdownMotif() ; #else FrShutdown() ; #endif return 0 ; }
// SunOS 4.x has on_exit() which passes different args to the shutdown // function from the standard atexit(); Solaris has atexit() but no on_exit(). static void shutdown_FramepaC_sun(int status, caddr_t arg) { (void)status ; (void)arg ; FrShutdown() ; }