/** @brief The following function implements a line-editor loop, quiting when there is no more input to be read. @param o a fully initialized for environment @return int <0 on failure of the Forth execution or the line editor **/ static int forth_line_editor(forth_t *o) { int rval = 0; char *line = NULL; assert(o); errno = 0; if(line_history_load(history_file) < 0) /* loading can fail, which is fine */ warning("failed to load history file %s, %s", history_file, forth_strerror()); while((line = line_editor(prompt))) { forth_set_string_input(o, line); if((rval = forth_run(o)) < 0) goto end; if(line_history_add(line) < 0) { rval = -1; goto end; } if(line_history_save(history_file) < 0) { rval = -1; goto end; } free(line); line = NULL; } end: free(line); return rval; }
void LLWidgetReg::initClass(bool register_widgets) { // Only need to register if the Windows linker has optimized away the // references to the object files. if (register_widgets) { LLDefaultChildRegistry::Register<LLButton> button("button"); LLDefaultChildRegistry::Register<LLMenuButton> menu_button("menu_button"); LLDefaultChildRegistry::Register<LLCheckBoxCtrl> check_box("check_box"); LLDefaultChildRegistry::Register<LLComboBox> combo_box("combo_box"); LLDefaultChildRegistry::Register<LLFilterEditor> filter_editor("filter_editor"); LLDefaultChildRegistry::Register<LLFlyoutButton> flyout_button("flyout_button"); LLDefaultChildRegistry::Register<LLContainerView> container_view("container_view"); LLDefaultChildRegistry::Register<LLIconCtrl> icon("icon"); LLDefaultChildRegistry::Register<LLLoadingIndicator> loading_indicator("loading_indicator"); LLDefaultChildRegistry::Register<LLLineEditor> line_editor("line_editor"); LLDefaultChildRegistry::Register<LLMenuItemSeparatorGL> menu_item_separator("menu_item_separator"); LLDefaultChildRegistry::Register<LLMenuItemCallGL> menu_item_call_gl("menu_item_call"); LLDefaultChildRegistry::Register<LLMenuItemCheckGL> menu_item_check_gl("menu_item_check"); LLDefaultChildRegistry::Register<LLMenuGL> menu("menu"); LLDefaultChildRegistry::Register<LLMenuBarGL> menu_bar("menu_bar"); LLDefaultChildRegistry::Register<LLContextMenu> context_menu("context_menu"); LLDefaultChildRegistry::Register<LLMultiSlider> multi_slider_bar("multi_slider_bar"); LLDefaultChildRegistry::Register<LLMultiSliderCtrl> multi_slider("multi_slider"); LLDefaultChildRegistry::Register<LLPanel> panel("panel", &LLPanel::fromXML); LLDefaultChildRegistry::Register<LLLayoutStack> layout_stack("layout_stack"); LLDefaultChildRegistry::Register<LLProgressBar> progress_bar("progress_bar"); LLDefaultChildRegistry::Register<LLRadioGroup> radio_group("radio_group"); LLDefaultChildRegistry::Register<LLSearchEditor> search_editor("search_editor"); LLDefaultChildRegistry::Register<LLScrollContainer> scroll_container("scroll_container"); LLDefaultChildRegistry::Register<LLScrollingPanelList> scrolling_panel_list("scrolling_panel_list"); LLDefaultChildRegistry::Register<LLScrollListCtrl> scroll_list("scroll_list"); LLDefaultChildRegistry::Register<LLSlider> slider_bar("slider_bar"); LLDefaultChildRegistry::Register<LLSliderCtrl> slider("slider"); LLDefaultChildRegistry::Register<LLSpinCtrl> spinner("spinner"); LLDefaultChildRegistry::Register<LLStatBar> stat_bar("stat_bar"); //LLDefaultChildRegistry::Register<LLPlaceHolderPanel> placeholder("placeholder"); LLDefaultChildRegistry::Register<LLTabContainer> tab_container("tab_container"); LLDefaultChildRegistry::Register<LLTextBox> text("text"); LLDefaultChildRegistry::Register<LLTimeCtrl> time("time"); LLDefaultChildRegistry::Register<LLTextEditor> simple_text_editor("simple_text_editor"); LLDefaultChildRegistry::Register<LLUICtrl> ui_ctrl("ui_ctrl"); LLDefaultChildRegistry::Register<LLStatView> stat_view("stat_view"); //LLDefaultChildRegistry::Register<LLUICtrlLocate> locate("locate"); //LLDefaultChildRegistry::Register<LLUICtrlLocate> pad("pad"); LLDefaultChildRegistry::Register<LLViewBorder> view_border("view_border"); } // *HACK: Usually this is registered as a viewer text editor LLDefaultChildRegistry::Register<LLTextEditor> text_editor("text_editor"); }
void edit_a_bbs_message(char *directory,struct bbs_board_info *bbs_info, int *num_files, int which_fl, struct board_info *new_board) { char s[40]; if ((which_fl<1) || (which_fl>*num_files)) return; if (!((test_bit(user_options[tswitch].privs,BBS_EDIT_PRV)) || (user_lines[tswitch].number == new_board->user_moderator))) { print_str_cr("You do not have edit privilege to that message."); return; }; sprintf(s,"%s\\%s",directory,bbs_info[which_fl-1].filename); line_editor(s,MESSAGE_SIZE); }
void send_a_bbs_message(int bbs_num,struct board_info *new_board, int bbs_mesg, struct bbs_board_info *board_info) { char s[40]; char subject[60]; FILE *fileptr; char directory[24]; if ((bbs_num<0) || (bbs_num>999)) return; print_cr(); special_code(1,tswitch); print_string("|*h1|*f4From:|*r1 "); print_str_cr(user_lines[tswitch].handle); print_string("|*r1|*h1|*f4Subject:|*f7 "); get_string(subject,57); print_cr(); special_code(0,tswitch); if (!(*subject)) { print_cr(); return; }; sprintf(s,"bbs\\tempfl.%02d",tswitch); lock_dos(); if ((fileptr=g_fopen(s,"wb","BBS#4"))==NULL) { log_error(s); unlock_dos(); return; }; g_fclose(fileptr); unlock_dos(); if (line_editor(s,MESSAGE_SIZE)) { find_bbs_directory(directory,bbs_num); create_bbs_message(directory,s,subject,user_lines[tswitch].number, user_lines[tswitch].handle,new_board,bbs_mesg,board_info); print_str_cr("Message posted."); }; }