/* ============= InitMacStuff ============= */ void InitMacStuff( void ) { Handle menuBar; char dir[MAX_OSPATH]; // init toolbox MaxApplZone(); MoreMasters(); InitGraf(&qd.thePort); InitFonts(); FlushEvents(everyEvent, 0); SetEventMask( -1 ); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); // init menu menuBar = GetNewMBar(rMenuBar); if(!menuBar) { Com_Error( ERR_FATAL, "MenuBar not found."); } SetMenuBar(menuBar); DisposeHandle(menuBar); AppendResMenu(GetMenuHandle(mApple),'DRVR'); DrawMenuBar(); Sys_InitConsole(); SetEventMask( -1 ); }
int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) { HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Meta_ModifyMenu); // hook srmm window close/open events HookEvent(ME_MSG_WINDOWEVENT, Meta_MessageWindowEvent); HookEvent(ME_MSG_ICONPRESSED, Meta_SrmmIconClicked); ////////////////////////////////////////////////////////////////////////////////////// InitMenus(); // create srmm icon StatusIconData sid = { sizeof(sid) }; sid.szModule = META_PROTO; sid.hIcon = LoadSkinnedProtoIcon(META_PROTO, ID_STATUS_ONLINE); Srmm_AddIcon(&sid); // hook protocol nudge events to forward to subcontacts int numberOfProtocols; PROTOACCOUNT ** ppProtocolDescriptors; ProtoEnumAccounts(&numberOfProtocols, &ppProtocolDescriptors); for (int i = 0; i < numberOfProtocols; i++) if (strcmp(ppProtocolDescriptors[i]->szModuleName, META_PROTO)) { char str[MAXMODULELABELLENGTH + 10]; mir_snprintf(str, SIZEOF(str), "%s/Nudge", ppProtocolDescriptors[i]->szModuleName); HookEvent(str, NudgeRecieved); } return 0; }
int main () { int ret; Rect windRect; long start,end,amount; /* Initialize all the needed managers. */ InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); //ProfilerInit(collectDetailed, bestTimeBase, 1000, 50); //ProfilerSetStatus(true); windRect = qd.screenBits.bounds; InsetRect(&windRect, 50, 50); pWindow = NewCWindow(nil, &windRect, "\pMpeg", true, documentProc, (WindowPtr) -1, false, 0); start = TickCount(); main2(); end = TickCount(); amount = end - start; fprintf(stderr, "Time taken %d memoryAllocator %d \n", amount,counter); // ProfilerDump("\pProfile.out"); do { } while (!Button()); }
static int MacintoshInit() { MaxApplZone(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); tcl_macQdPtr = &qd; if (TkMacHaveAppearance()) { RegisterAppearanceClient(); } InitGraf(&tcl_macQdPtr->thePort); InitFonts(); if (TkMacHaveAppearance() >= 0x110) { InitFloatingWindows(); } else { InitWindows(); } InitMenus(); InitDialogs((long) NULL); InitCursor(); FlushEvents(everyEvent, 0); SetEventMask(everyEvent); Tcl_MacSetEventProc(TkMacConvertEvent); return TCL_OK; }
int main (void) { /* init the Macintosh toolbox */ InitGraf(&qd.thePort); InitFonts(); FlushEvents(everyEvent,0); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); /* read the screen's size */ screenx = ((qd.screenBits).bounds).right; screeny = ((qd.screenBits).bounds).bottom; SetRect(&dragRect,4,24,((qd.screenBits).bounds).right-4,((qd.screenBits).bounds).bottom-4); SetUpMenus (); SetState(CLOSED); OpenCommand(); /* handle events till the end */ while (!quitFlag) { ProcessEvent(); } return(0); }
// -------------------------------------------------------------------------------------- static void initialize(void) { MenuBarHandle menuBar; OSErr error; MoreMasters(); // I doubt we actually need any extra master pointers InitGraf(&qd.thePort); // but I left the calls here as a reminder for where they InitFonts(); // belong if they are needed InitWindows(); InitMenus(); TEInit(); InitDialogs(NULL); InitCursor(); RegisterAppearanceClient(); menuBar = GetNewMBar(rMenuBar); // draw the menu bar as soon as possible if (menuBar == NULL) ExitToShell(); SetMenuBar(menuBar); DrawMenuBar(); // do non time sensitive initialization after we get the application event loop going gOpenAppAEHandler = NewAEEventHandlerUPP(openApplicationAEHandler); error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, gOpenAppAEHandler, 0, false); if (error != noErr) ExitToShell(); /* If we supported them, we would install open documents and print documents handlers here and we would do most of the same initialization stuff that we do in the open application handler. */ FlushEvents(everyEvent, 0); }
void BasicInit() #ifdef MAC { void InitColors(); #if MACB4CARBON short i; Ptr stackTop; // JLMextern _DataInit(); stackTop = GetApplLimit(); SetApplLimit((void *)(stackTop - (Ptr)30000)); // SetApplLimit((void *)(*(long *)csb - 30000)); MaxApplZone(); for (i = 1 ; i <= 16 ; i++) MoreMasters(); InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); FlushEvents(everyEvent, 0); #endif InitCursor(); InitColors(); }
static void InitMacToolbox (void) { InitGraf (&qd.thePort); InitFonts (); InitWindows (); InitMenus (); TEInit (); InitDialogs (nil); }
CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : PROTO<CMraProto>(_module, _displayName), m_bLoggedIn(false), m_groups(5, NumericKeySortT) { InitializeCriticalSectionAndSpinCount(&csCriticalSectionSend, 0); MraSendQueueInitialize(0, &hSendQueueHandle); MraFilesQueueInitialize(0, &hFilesQueueHandle); MraMPopSessionQueueInitialize(&hMPopSessionQueue); MraAvatarsQueueInitialize(&hAvatarsQueueHandle); CreateProtoService(PS_SETCUSTOMSTATUSEX, &CMraProto::MraSetXStatusEx); CreateProtoService(PS_GETCUSTOMSTATUSEX, &CMraProto::MraGetXStatusEx); CreateProtoService(PS_GETCUSTOMSTATUSICON, &CMraProto::MraGetXStatusIcon); CreateProtoService(PS_SET_LISTENINGTO, &CMraProto::MraSetListeningTo); CreateProtoService(PS_CREATEACCMGRUI, &CMraProto::MraCreateAccMgrUI); CreateProtoService(PS_GETAVATARCAPS, &CMraProto::MraGetAvatarCaps); CreateProtoService(PS_GETAVATARINFOT, &CMraProto::MraGetAvatarInfo); CreateProtoService(PS_GETMYAVATART, &CMraProto::MraGetMyAvatar); CreateProtoService(MS_ICQ_SENDSMS, &CMraProto::MraSendSMS); CreateProtoService(PS_SEND_NUDGE, &CMraProto::MraSendNudge); if ( ServiceExists(MS_NUDGE_SEND)) m_heNudgeReceived = CreateProtoEvent(PE_NUDGE); TCHAR name[128]; mir_sntprintf( name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = name; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); HookProtoEvent(ME_SYSTEM_PRESHUTDOWN, &CMraProto::OnPreShutdown); InitMenus(); mir_snprintf(szNewMailSound, SIZEOF(szNewMailSound), "%s: %s", m_szModuleName, MRA_SOUND_NEW_EMAIL); SkinAddNewSoundEx(szNewMailSound, m_szModuleName, MRA_SOUND_NEW_EMAIL); HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu); hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", LPGEN("Mail.ru Xstatus"), "mra_xstatus25"); hExtraInfo = ExtraIcon_Register("MRAStatus", LPGEN("Mail.ru extra info"), "mra_xstatus49"); bHideXStatusUI = FALSE; m_iXStatus = getByte(DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); if ( !IsXStatusValid(m_iXStatus)) m_iXStatus = MRA_MIR_XSTATUS_NONE; }
/* ----------- private code */ static void initialize_application( void) { Handle menubar; StringHandle userName; #ifndef OP_PLATFORM_MAC_CARBON_FLAG MaxApplZone(); MoreMasters(); MoreMasters(); MoreMasters(); InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(NULL); #else MoreMasterPointers(192); #endif // ! OP_PLATFORM_MAC_CARBON_FLAG InitCursor(); FlushEvents(everyEvent, 0); menubar= GetNewMBar(rMENU_BAR_ID); op_assert(menubar); SetMenuBar(menubar); DisposeHandle(menubar); AppendResMenu(GetMenuHandle(mApple), 'DRVR'); DrawMenuBar(); // Get the user name from the systemÉ userName = GetString (-16096); if (userName == NULL) strcpy(gNameString, "OpenPlay Test"); else { doCopyP2CStr(*userName,gNameString); ReleaseResource ((Handle) userName); } // ecf - we wanna enable enumeration by default... check_menu_item(mSpecial, iActiveEnumeration, active_enumeration); //install apple event handler for quitting AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,NewAEEventHandlerUPP((AEEventHandlerProcPtr)do_quit_apple_event),0L,false); return; }
static void init_toolbox() { InitGraf(&qd.thePort); InitFonts(); InitWindows(); TEInit(); InitDialogs((long)0); InitMenus(); InitCursor(); SIOUXSettings.asktosaveonclose = 0; }
CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : PROTO<CMraProto>(_module, _displayName), m_bLoggedIn(false), m_groups(5, NumericKeySortT) { MraSendQueueInitialize(0, &hSendQueueHandle); MraFilesQueueInitialize(0, &hFilesQueueHandle); MraMPopSessionQueueInitialize(&hMPopSessionQueue);//getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS) MraAvatarsQueueInitialize(&hAvatarsQueueHandle); CreateProtoService(PS_SETCUSTOMSTATUSEX, &CMraProto::MraSetXStatusEx); CreateProtoService(PS_GETCUSTOMSTATUSEX, &CMraProto::MraGetXStatusEx); CreateProtoService(PS_GETCUSTOMSTATUSICON, &CMraProto::MraGetXStatusIcon); CreateProtoService(PS_SET_LISTENINGTO, &CMraProto::MraSetListeningTo); CreateProtoService(PS_CREATEACCMGRUI, &CMraProto::MraCreateAccMgrUI); CreateProtoService(PS_GETAVATARCAPS, &CMraProto::MraGetAvatarCaps); CreateProtoService(PS_GETAVATARINFO, &CMraProto::MraGetAvatarInfo); CreateProtoService(PS_GETMYAVATAR, &CMraProto::MraGetMyAvatar); CreateProtoService(MS_ICQ_SENDSMS, &CMraProto::MraSendSMS); CreateProtoService(PS_SEND_NUDGE, &CMraProto::MraSendNudge); CreateProtoService(PS_GETUNREADEMAILCOUNT, &CMraProto::GetUnreadEmailCount); if (ServiceExists(MS_NUDGE_SEND)) m_heNudgeReceived = CreateProtoEvent(PE_NUDGE); TCHAR name[MAX_PATH]; mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = name; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); InitMenus(); mir_snprintf(szNewMailSound, _countof(szNewMailSound), "%s_new_email", m_szModuleName); SkinAddNewSoundEx(szNewMailSound, m_szModuleName, MRA_SOUND_NEW_EMAIL); HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu); hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", LPGEN("Mail.ru xStatus"), "mra_xstatus25"); hExtraInfo = ExtraIcon_Register("MRAStatus", LPGEN("Mail.ru extra info"), MRA_XSTATUS_UNKNOWN_STR); m_bHideXStatusUI = false; m_iXStatus = getByte(DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); if (!IsXStatusValid(m_iXStatus)) m_iXStatus = MRA_MIR_XSTATUS_NONE; }
int main(void) { InitLocale("System/Prefs/IControl.catalog", 1); InitMenus(); OpenLibs(); GetArguments(); InitPrefs((STRPTR)args[ARG_FROM], (args[ARG_USE] ? TRUE : FALSE), (args[ARG_SAVE] ? TRUE : FALSE)); MakeGUI(); HandleAll(); Cleanup(NULL); return 0; }
static void init_toolbox() { #ifndef USING_CARBON InitGraf(&qd.thePort); InitFonts(); InitWindows(); TEInit(); InitDialogs((long)0); InitMenus(); InitCursor(); #endif SIOUXSettings.asktosaveonclose = 0; }
void InitManagers(void) { MaxApplZone(); MoreMasters(); MoreMasters(); MoreMasters(); InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(NULL); InitCursor(); FlushEvents(everyEvent, 0); }
void Initialize(void) { InitGraf((Ptr) &qd.thePort); InitFonts(); FlushEvents(everyEvent, 0); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); SetUpMenus(); }
InitMacInterface() { int myRsrc, i; int MainEvent(); /*=====================================================*/ /* Macintosh Incantation for initializing application. */ /*=====================================================*/ InitGraf(&thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(0L); MaxApplZone(); FlushEvents(everyEvent,0); /*==================================*/ /* Get the screen width and height. */ /*==================================*/ ScreenHeight = screenBits.bounds.bottom - screenBits.bounds.top; ScreenWidth = screenBits.bounds.right - screenBits.bounds.left; /*===============================*/ /* Set up the menus and cursors. */ /*===============================*/ SetUpMenus(); SetUpCursors(); /*=====================================*/ /* Initialize global window variables. */ /*=====================================*/ TheWindow = NULL; /*=========================*/ /* Initialize the windows. */ /*=========================*/ InitDisplayWindow(); InitFileListWindow(); }
static int MacintoshInit() { #if GENERATING68K && !GENERATINGCFM SetApplLimit(GetApplLimit() - (TCL_MAC_68K_STACK_GROWTH)); #endif MaxApplZone(); #if defined(THINK_C) /* Set options for Think C console package */ /* The console package calls the Mac init calls */ console_options.pause_atexit = 0; console_options.title = "\pTcl Interpreter"; #elif defined(__MWERKS__) /* Set options for CodeWarrior SIOUX package */ SIOUXSettings.autocloseonquit = true; SIOUXSettings.showstatusline = true; SIOUXSettings.asktosaveonclose = false; SIOUXSettings.wasteusetempmemory = true; InstallConsole(0); SIOUXSetTitle("\pTcl Interpreter"); #elif defined(applec) /* Init packages used by MPW SIOW package */ InitGraf((Ptr)&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); #endif Tcl_MacSetEventProc((Tcl_MacConvertEventPtr) SIOUXHandleOneEvent); /* No problems with initialization */ return TCL_OK; }
static void InitToolBox(void) { #if !TARGET_CARBON MaxApplZone(); InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(0); #endif FlushEvents(everyEvent, 0); InitCursor(); #ifdef TARGET_API_MAC_CARBON AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, AEProc(handleQuitApp), 0L, false); #endif }
int main( int argc, char *argv[ ] ) { // turn on the glut package: // (do this before checking argc and argv since it might // pull some command line arguments out) glutInit( &argc, argv ); // setup all the graphics stuff: InitGraphics( ); // create the display structures that will not change: InitLists( ); // init all the global variables used by Display( ): // this will also post a redisplay Reset( ); // setup all the user interface stuff: InitMenus( ); // draw the scene once and wait for some interaction: // (this will never return) glutSetWindow( MainWindow ); glutMainLoop( ); // this is here to make the compiler happy: return 0; }
ToolBox::ToolBox(void) { short i; /* if you have stack requirements that differ from the default, then you counld use SetApplLimit to increase StackSpace at this point, before calling MaxApplZone */ MaxApplZone(); for(i = 0; i < 50; i++) MoreMasters(); //notice the following order is important InitGraf(&(qd.thePort)); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(0L); InitCursor(); FlushEvents( everyEvent, REMOVE_EVENTS); }
MainFrame::MainFrame() : BasicViewerFrame( NULL, -1, _("FullAnalyze"), wxDefaultPosition, wxSize( 1280, 1024 ), wxDEFAULT_FRAME_STYLE) { InitMenus(); InitFenetres(); InitToolBars(); wxConfigBase *pConfig = wxConfigBase::Get(); //Réglage des options par défaut // wxConfigBase *pConfig = wxConfigBase::Get(); int threadNb; pConfig->Read(_T("/FA/Options/FitThreadNumber"), &threadNb, 1); pConfig->Write(_T("/FA/Options/FitThreadNumber"), threadNb); wxString fitType; pConfig->Read(_T("/FA/Options/FitType"), &fitType, _("SMAX_NOFIT_DI")); pConfig->Write(_T("/FA/Options/FitType"), fitType); wxString FWRieglFilePath; pConfig->Read(_T("/FA/Paths/FWRieglFilePath"), &FWRieglFilePath, _("/home/achauve/fw-draix/070406_090036.sdf")); pConfig->Write(_T("/FA/Paths/FWRieglFilePath"), FWRieglFilePath); wxString TrajectoBinFilePath; pConfig->Read(_T("/FA/Paths/TrajectoBinFilePath"), &TrajectoBinFilePath, _("/home/achauve/fw-draix/GE606136_01.bin")); pConfig->Write(_T("/FA/Paths/TrajectoBinFilePath"), TrajectoBinFilePath); bool LoadWoleImage, BilinearZoom; pConfig->Read(_T("/Options/LoadWoleImage"), &LoadWoleImage, 0); pConfig->Write(_T("/Options/FitThreadNumber"), LoadWoleImage); pConfig->Read(_T("/Options/BilinearZoom"), &BilinearZoom, 0); pConfig->Write(_T("/Options/BilinearZoom"), BilinearZoom); }
int CVkProto::OnModulesLoaded(WPARAM, LPARAM) { // Chats GCREGISTER gcr = { sizeof(gcr) }; gcr.ptszDispName = m_tszUserName; gcr.pszModule = m_szModuleName; gcr.nColors = _countof(sttColors); gcr.pColors = sttColors; CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr); CreateProtoService(PS_LEAVECHAT, &CVkProto::OnLeaveChat); CreateProtoService(PS_JOINCHAT, &CVkProto::OnJoinChat); HookProtoEvent(ME_GC_EVENT, &CVkProto::OnChatEvent); HookProtoEvent(ME_GC_BUILDMENU, &CVkProto::OnGcMenuHook); // Other hooks HookProtoEvent(ME_MSG_WINDOWEVENT, &CVkProto::OnProcessSrmmEvent); HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CVkProto::OnDbEventRead); HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CVkProto::OnDbSettingChanged); InitPopups(); InitMenus(); return 0; }
int OnModulesLoaded(WPARAM, LPARAM) { NETLIBUSER nl_user = { 0 }; nl_user.cbSize = sizeof(nl_user); nl_user.szSettingsModule = PLUG; nl_user.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nl_user.ptszDescriptiveName = TranslateT("Ping Plugin"); nl_user.szHttpGatewayHello = 0; nl_user.szHttpGatewayUserAgent = 0; nl_user.pfnHttpGatewayInit = 0; nl_user.pfnHttpGatewayWrapSend = 0; nl_user.pfnHttpGatewayUnwrapRecv = 0; hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user); InitUtils(); InitMenus(); hFillListEvent = HookEvent(PLUG "/ListReload", FillList); if (!db_get_b(0, PLUG, "PingPlugImport", 0)) { if (db_get_dw(0, "PingPlug", "NumEntries", 0)) { import_ping_addresses(); db_set_b(0, PLUG, "PingPlugImport", 1); } } InitList(); CallService(PLUG "/LoadPingList", 0, 0); graphs_init(); if (options.logging) CallService(PLUG "/Log", (WPARAM)_T("start"), 0); return 0; }
void DUIInit( void ) { InitScreen(); CmdHistory = WndInitHistory(); SrchHistory = WndInitHistory(); InitToolBar(); InitMemWindow(); InitAboutMessage(); InitIOWindow(); InitMenus(); WndInit( LIT_DUI( The_WATCOM_Debugger ) ); _SwitchOff( SW_ERROR_STARTUP ); #if defined(__GUI__) TellWinHandle(); #endif if( WndMain != NULL ) WndSetIcon( WndMain, &MainIcon ); StartTimer(); InitHelp(); InitGadget(); InitPaint(); InitBrowse(); InitFont(); }
static void initmacintosh (void) { /* the magic stuff that every Macintosh application needs to do before doing anything else. */ short i; MaxApplZone (); for (i = 0; i < 10; i++) MoreMasters (); InitGraf (&qd.thePort); InitFonts (); FlushEvents (everyEvent, 0); InitWindows (); InitMenus (); TEInit (); InitDialogs (0L); InitCursor (); for (i = 0; i < 5; i++) { /*register with Multifinder*/ EventRecord ev; EventAvail (everyEvent, &ev); /*see TN180 -- splash screen*/ } /*for*/ } /*initmacintosh*/
init_mac_interface() { int myRsrc, i; int MainEvent(); /*=====================================================*/ /* Macintosh Incantation for initializing application. */ /*=====================================================*/ InitGraf(&thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(0L); MaxApplZone(); FlushEvents(everyEvent,0); /*==================================*/ /* Get the screen width and height. */ /*==================================*/ ScreenHeight = screenBits.bounds.bottom - screenBits.bounds.top; ScreenWidth = screenBits.bounds.right - screenBits.bounds.left; /*===============================*/ /* Set up the menus and cursors. */ /*===============================*/ SetUpMenus(); SetUpCursors(); /*=====================================*/ /* Initialize global window variables. */ /*=====================================*/ TheText = NULL; TheWindow = NULL; TheVScrollBar = NULL; TheHScrollBar = NULL; /*======================================*/ /* Place any selected files in buffers. */ /*======================================*/ DoStartup(); /*=======================*/ /* Initialize the Scrap. */ /*=======================*/ InitializeScrap(); /*=========================*/ /* Set up for MultiFinder. */ /*=========================*/ MultiFinderSetup(); /*===================================*/ /* Set up routers for the interface. */ /*===================================*/ SetUpRouters(); /*==================================================================*/ /* Set up hook between CLIPS command loop and interface event loop. */ /*==================================================================*/ set_event_function(MainEvent); /*==================================================================*/ /* Add execution function to update interface between rule firings. */ /*==================================================================*/ add_exec_function("macint",mac_exec_function); }
static int MacintoshInit() { int i; long result, mask = 0x0700; /* mask = system 7.x */ #if GENERATING68K && !GENERATINGCFM SetApplLimit(GetApplLimit() - (TK_MAC_68K_STACK_GROWTH)); #endif MaxApplZone(); for (i = 0; i < 4; i++) { (void) MoreMasters(); } /* * Tk needs us to set the qd pointer it uses. This is needed * so Tk doesn't have to assume the availablity of the qd global * variable. Which in turn allows Tk to be used in code resources. */ tcl_macQdPtr = &qd; /* * If appearance is present, then register Tk as an Appearance client * This means that the mapping from non-Appearance to Appearance cdefs * will be done for Tk regardless of the setting in the Appearance * control panel. */ if (TkMacHaveAppearance()) { RegisterAppearanceClient(); } InitGraf(&tcl_macQdPtr->thePort); InitFonts(); if (TkMacHaveAppearance() >= 0x110) { InitFloatingWindows(); } else { InitWindows(); } InitMenus(); InitDialogs((long) NULL); InitCursor(); /* * Make sure we are running on system 7 or higher */ if ((NGetTrapAddress(_Gestalt, ToolTrap) == NGetTrapAddress(_Unimplemented, ToolTrap)) || (((Gestalt(gestaltSystemVersion, &result) != noErr) || (result < mask)))) { panic("Tcl/Tk requires System 7 or higher."); } /* * Make sure we have color quick draw * (this means we can't run on 68000 macs) */ if (((Gestalt(gestaltQuickdrawVersion, &result) != noErr) || (result < gestalt32BitQD13))) { panic("Tk requires Color QuickDraw."); } FlushEvents(everyEvent, 0); SetEventMask(everyEvent); Tcl_MacSetEventProc(TkMacConvertEvent); return TCL_OK; }
static void mac_startup(void) { Handle menuBar; TECInfoHandle ti; #if !TARGET_API_MAC_CARBON /* Init Memory Manager */ MaxApplZone(); /* Init QuickDraw */ InitGraf(&qd.thePort); /* Init Font Manager */ InitFonts(); /* Init Window Manager */ InitWindows(); /* Init Menu Manager */ InitMenus(); /* Init TextEdit */ TEInit(); /* Init Dialog Manager */ InitDialogs(NULL); #endif /* Get base system version (only used if there's no better selector) */ if (Gestalt(gestaltSystemVersion, &mac_gestalts.sysvers) != noErr || (mac_gestalts.sysvers &= 0xffff) < 0x700) fatalbox("PuTTYgen requires System 7 or newer"); /* Find out if we've got Color Quickdraw */ if (Gestalt(gestaltQuickdrawVersion, &mac_gestalts.qdvers) != noErr) mac_gestalts.qdvers = gestaltOriginalQD; /* ... and the Appearance Manager? */ if (Gestalt(gestaltAppearanceVersion, &mac_gestalts.apprvers) != noErr) if (Gestalt(gestaltAppearanceAttr, NULL) == noErr) mac_gestalts.apprvers = 0x0100; else mac_gestalts.apprvers = 0; #if TARGET_RT_MAC_CFM /* Paranoia: Did we manage to pull in AppearanceLib? */ if (&RegisterAppearanceClient == kUnresolvedCFragSymbolAddress) mac_gestalts.apprvers = 0; #endif #if TARGET_CPU_68K mac_gestalts.cntlattr = 0; mac_gestalts.windattr = 0; #else /* Mac OS 8.5 Control Manager (proportional scrollbars)? */ if (Gestalt(gestaltControlMgrAttr, &mac_gestalts.cntlattr) != noErr || &SetControlViewSize == kUnresolvedCFragSymbolAddress) mac_gestalts.cntlattr = 0; /* Mac OS 8.5 Window Manager? */ if (Gestalt(gestaltWindowMgrAttr, &mac_gestalts.windattr) != noErr || &SetWindowContentColor == kUnresolvedCFragSymbolAddress) mac_gestalts.windattr = 0; #endif /* Text Encoding Conversion Manager? */ if ( #if TARGET_RT_MAC_CFM &TECGetInfo == kUnresolvedCFragSymbolAddress || #else InitializeUnicodeConverter(NULL) != noErr || #endif TECGetInfo(&ti) != noErr) mac_gestalts.encvvers = 0; else { mac_gestalts.encvvers = (*ti)->tecVersion; mac_gestalts.uncvattr = (*ti)->tecUnicodeConverterFeatures; DisposeHandle((Handle)ti); } /* Navigation Services? */ if (NavServicesAvailable()) mac_gestalts.navsvers = NavLibraryVersion(); else mac_gestalts.navsvers = 0; /* We've been tested with the Appearance Manager */ if (mac_gestalts.apprvers != 0) RegisterAppearanceClient(); menuBar = GetNewMBar(128); if (menuBar == NULL) fatalbox("Unable to create menu bar."); SetMenuBar(menuBar); AppendResMenu(GetMenuHandle(mApple), 'DRVR'); mac_adjustmenus(); DrawMenuBar(); InitCursor(); windows.about = NULL; windows.licence = NULL; flags = FLAG_INTERACTIVE; /* Install Apple Event handlers. */ #if 0 AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, NewAEEventHandlerUPP(&mac_aevt_oapp), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(&mac_aevt_odoc), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, NewAEEventHandlerUPP(&mac_aevt_pdoc), 0, FALSE); #endif AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP(&mac_aevt_quit), 0, FALSE); }
boolean initmacintosh (void) { /* the magic stuff that every Macintosh application needs to do before doing anything else. 4/24/91 dmb: added memory config resource stuff 3.0.4 dmb: use LMGetCurStackBase, not CurStackBase global 3.0.4 dmb: pass 0L to InitDialogs */ register short i; register hdlmemoryconfig h; register long ctbytes; //Code change by Timothy Paustian Thursday, June 8, 2000 3:45:13 PM // #if TARGET_API_MAC_CARBON == 0 long ctstack; #endif long ctheap, ctcode; short ctmasters; h = (hdlmemoryconfig) Get1Resource ('MCFG', 1); if (h == nil) clearbytes (&macmemoryconfig, sizeof (macmemoryconfig)); else macmemoryconfig = **h; //Code change by Timothy Paustian Saturday, June 3, 2000 10:13:20 PM //Changed to Opaque call for Carbon //we don't need this in carbon. #if TARGET_API_MAC_CARBON == 0 if (h != nil) { /*first check stack size*/ ctbytes = (**h).minstacksize; ctstack = LMGetCurStackBase () - GetApplLimit (); /*current stack size*/ if (ctbytes > ctstack) SetApplLimit (LMGetCurStackBase () - ctbytes); } MaxApplZone (); #endif if (h != nil) { /*check heap size and master pointers*/ ctbytes = (**h).minheapsize; //Code change by Timothy Paustian Thursday, June 8, 2000 3:04:31 PM //Changed to Opaque call for Carbon //This is meaningless for OS X since it has unlimited memory. #if TARGET_API_MAC_CARBON == 1 //we need to do somethings else. FreeMem is going to return some large value //of all the available system memory //This whole thing is pointless. We can get as much memory as we need. #pragma unused (ctmasters) #pragma unused (ctcode) #pragma unused (ctheap) #else ctheap = FreeMem (); if (ctbytes > ctheap) { return (false); } ctbytes = (**h).avghandlesize; ctcode = (**h).reserveforcode; if ((ctbytes > 0) && (ctheap > ctcode)) { ctmasters = ((ctheap - ctcode) / ctbytes) / kNumberOfMasters; ctmasters = min (ctmasters, 1024); /*7.1b37 PBS: You'd think 1024 calls would be enough. With large memory alottments on Mac Classic, we're calling MoreMasters in excess of 20,000 times. That makes the app take a minute or so to start up! So instead I've chosen an arbitrary limit.*/ for (i = 1; i < ctmasters; i++) MoreMasters (); } #endif ReleaseResource ((Handle) h); /*we're done with it*/ } //Code change by Timothy Paustian Thursday, June 8, 2000 3:21:06 PM //Changed to Opaque call for Carbon //we don't need this initialization in carbon #if TARGET_API_MAC_CARBON == 0 InitGraf (&qd.thePort); InitFonts (); FlushEvents (everyEvent, 0); InitWindows (); InitMenus (); TEInit (); InitDialogs (0L); #endif InitCursor (); //Code change by Timothy Paustian Thursday, June 8, 2000 3:22:57 PM //Changed to Opaque call for Carbon //this is obsolete, we should be using gestalt for this. { long quickDrawFeatures; OSErr theErr = Gestalt(gestaltSystemVersion, &gSystemVersion); if(oserror(theErr)) ExitToShell(); theErr = Gestalt(gestaltQuickdrawFeatures, &quickDrawFeatures); if(oserror(theErr)) ExitToShell(); gHasColorQD = (quickDrawFeatures & (1 << gestaltHasColor)); //Nav services has to be present and we want the 1.1 or greater version. gCanUseNavServ = (NavServicesAvailable() && (NavLibraryVersion() >= 0x01108000)); } //SysEnvirons (1, &macworld); //gee I bet this isn't required anymore either. for (i = 1; i <= 5; i++) { /*register with Multifinder*/ EventRecord ev; EventAvail (everyEvent, &ev); /*see TN180 -- splash screen*/ } /*for*/ #if TARGET_API_MAC_CARBON == 1 RegisterAppearanceClient (); #endif return (true); } /*initmacintosh*/