int SLrline_init (SLFUTURE_CONST char *appname, SLFUTURE_CONST char *user_initfile, SLFUTURE_CONST char *sys_initfile) { #ifdef __WIN32__ char *home_dir = getenv ("USERPROFILE"); #else # ifdef VMS char *home_dir = "SYS$LOGIN:"******"HOME"); # endif #endif char *file = NULL; int status; static char *appname_malloced; if (sys_initfile == NULL) sys_initfile = SLRLINE_SYS_INIT_FILE; if (user_initfile == NULL) user_initfile = SLRLINE_USER_INIT_FILE; if (appname == NULL) appname = "Unknown"; if (NULL == (appname_malloced = SLmake_string (appname))) return -1; if (-1 == SLadd_intrinsic_variable ("__RL_APP__", &appname_malloced, SLANG_STRING_TYPE, 1)) return -1; if (-1 == SLadd_intrin_fun_table (Intrinsics, NULL)) return -1; if (-1 == init_keymap ()) return -1; if (user_initfile != NULL) { file = SLpath_find_file_in_path (home_dir, user_initfile); if (file != NULL) { status = SLns_load_file (file, NULL); SLfree (file); return status; } } if (sys_initfile != NULL) { file = _pSLpath_find_file (sys_initfile, 0); if (file != NULL) { status = SLns_load_file (file, NULL); SLang_free_slstring (file); return status; } } return 0; }
// Call to commit changes void CommitPrefs(void) { // Check if landscape mode setting has changed if (hd.landscape_mode != temphd.landscape_mode) ToggleLandscape(); //FrmCustomAlert(Info, "CommitPrefs", 0, 0); memcpy(&hd, &temphd, sizeof(headerdata)); // re-initalize the keymap init_keymap(); }
int main(int argc,char **argv) { INFO(char *dbg="Main(init): "); native_startup(argc, argv); /*** init modules ***/ INFO(printf("%sSharedMemory\n",dbg)); init_sharedmem(&dope); INFO(printf("%sTimer\n",dbg)); init_timer(&dope); INFO(printf("%sTick\n",dbg)); init_tick(&dope); INFO(printf("%sRelax\n",dbg)); init_relax(&dope); INFO(printf("%sKeymap\n",dbg)); init_keymap(&dope); INFO(printf("%sThread\n",dbg)); init_thread(&dope); INFO(printf("%sCache\n",dbg)); init_cache(&dope); INFO(printf("%sHashTable\n",dbg)); init_hashtable(&dope); INFO(printf("%sApplication Manager\n",dbg)); init_appman(&dope); INFO(printf("%sTokenizer\n",dbg)); init_tokenizer(&dope); INFO(printf("%sMessenger\n",dbg)); init_messenger(&dope); INFO(printf("%sScript\n",dbg)); init_script(&dope); INFO(printf("%sClipping\n",dbg)); init_clipping(&dope); INFO(printf("%sScreen Driver\n",dbg)); init_scrdrv(&dope); INFO(printf("%sInput\n",dbg)); init_input(&dope); INFO(printf("%sViewManager\n",dbg)); init_viewman(&dope); INFO(printf("%sConvertFNT\n",dbg)); init_conv_fnt(&dope); INFO(printf("%sFontManager\n",dbg)); init_fontman(&dope); INFO(printf("%sGfxScreen16\n",dbg)); init_gfxscr16(&dope); INFO(printf("%sGfxImage16\n",dbg)); init_gfximg16(&dope); INFO(printf("%sGfxImage32\n",dbg)); init_gfximg32(&dope); INFO(printf("%sGfxImageYUV420\n",dbg)); init_gfximgyuv420(&dope); INFO(printf("%sGfx\n",dbg)); init_gfx(&dope); INFO(printf("%sRedrawManager\n",dbg)); init_redraw(&dope); INFO(printf("%sUserState\n",dbg)); init_userstate(&dope); INFO(printf("%sWidgetManager\n",dbg)); init_widman(&dope); INFO(printf("%sScope\n",dbg)); init_scope(&dope); INFO(printf("%sButton\n",dbg)); init_button(&dope); INFO(printf("%sEntry\n",dbg)); init_entry(&dope); INFO(printf("%sVariable\n",dbg)); init_variable(&dope); INFO(printf("%sLabel\n",dbg)); init_label(&dope); INFO(printf("%sLoadDisplay\n",dbg)); init_loaddisplay(&dope); INFO(printf("%sBackground\n",dbg)); init_background(&dope); INFO(printf("%sScrollbar\n",dbg)); init_scrollbar(&dope); INFO(printf("%sScale\n",dbg)); init_scale(&dope); INFO(printf("%sFrame\n",dbg)); init_frame(&dope); INFO(printf("%sContainer\n",dbg)); init_container(&dope); INFO(printf("%sGrid\n",dbg)); init_grid(&dope); INFO(printf("%sWinLayout\n",dbg)); init_winlayout(&dope); INFO(printf("%sWindow\n",dbg)); init_window(&dope); INFO(printf("%sScreen\n",dbg)); init_screen(&dope); INFO(printf("%sScheduler\n",dbg)); if (config_don_scheduler) { // init_don_scheduler(&dope); printf("NOOOOOOOOOOOOOOOOOOO\n"); } else init_simple_scheduler(&dope); INFO(printf("%sVScreenServer\n",dbg)); init_vscr_server(&dope); INFO(printf("%sVScreen\n",dbg)); init_vscreen(&dope); INFO(printf("%sVTextScreen\n",dbg)); init_vtextscreen(&dope); INFO(printf("%sServer\n",dbg)); init_server(&dope); INFO(printf("%screate screen\n",dbg)); { static GFX_CONTAINER *scr_ds; gfx = pool_get("Gfx 1.0"); screen = pool_get("Screen 1.0"); userstate = pool_get("UserState 1.0"); scr_ds = gfx->alloc_scr("default"); curr_scr = screen->create(); curr_scr->scr->set_gfx(curr_scr, scr_ds); userstate->set_max_mx(gfx->get_width(scr_ds)); userstate->set_max_my(gfx->get_height(scr_ds)); } INFO(printf("%sstarting server\n",dbg)); if ((server = pool_get("Server 1.0"))) server->start(); INFO(printf("%sstarting scheduler\n",dbg)); if ((sched = pool_get("Scheduler 1.0"))) sched->process_mainloop(); return 0; }
void OS_SYSTEM_init_keyboard(void) { init_keymap(); g_hKeyboardHook = SetWindowsHookEx( WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(NULL), 0 ); }
SLrline_Type *SLrline_open (unsigned int width, unsigned int flags) { SLrline_Type *rli; if (_pSLutf8_mode) flags |= SL_RLINE_UTF8_MODE; if (NULL == (rli = (SLrline_Type *)SLcalloc (1, sizeof (SLrline_Type)))) return NULL; if (width == 0) width = 80; if (width < 256) rli->buf_len = 256; else rli->buf_len = width; if (NULL == (rli->buf = (unsigned char *)SLmalloc (rli->buf_len))) { SLrline_close (rli); return NULL; } *rli->buf = 0; #ifdef REAL_UNIX_SYSTEM rli->eof_char = 4; #else rli->eof_char = 26; #endif rli->point = 0; rli->flags = flags; rli->edit_width = width; rli->hscroll = width/4; rli->tab = 8; rli->getkey = SLang_getkey; rli->input_pending = SLang_input_pending; rli->state = RLI_LINE_INVALID; if (rli->flags & SL_RLINE_USE_ANSI) { if (rli->tt_goto_column == NULL) rli->tt_goto_column = ansi_goto_column; } if (-1 == init_keymap ()) { SLrline_close (rli); return NULL; } rli->keymap = RL_Keymap; rli->old_upd = rli->upd_buf1; rli->new_upd = rli->upd_buf2; if (Char_Widths[0] == 0) { int ch; /* FIXME: This does not support UTF-8 */ for (ch = 0; ch < 32; ch++) Char_Widths[ch] = 2; for (ch = 32; ch < 256; ch++) Char_Widths[ch] = 1; Char_Widths[127] = 2; #ifndef IBMPC_SYSTEM for (ch = 128; ch < 160; ch++) Char_Widths[ch] = 3; #endif } return rli; }