int main(int argc, char *argv[]) { run_script_file("/data/html/jquery-2.1.4.js"); run_script_file("/data/html/kiui_html.js"); mk::HtmlWindow htmlwindow(1200, 800, "kiUi demo", KIUI_EXAMPLE_RESSOURCE_PATH); gWindow = &htmlwindow; mk::UiWindow& uiwindow = htmlwindow.uiWindow(); uiwindow.init(); mk::Form& root = uiwindow.rootForm(); createUiTest(root); emscripten_set_main_loop(iterate, 0, 1); }
static void python_compose_script_callback(GtkAction *action, gpointer data) { char *filename; ComposeActionData *dat = (ComposeActionData*)data; filename = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_BASE_DIR, G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_COMPOSE_DIR, G_DIR_SEPARATOR_S, dat->name, NULL); run_script_file(filename, dat->compose); g_free(filename); }
static void compose_toolbar_callback(gpointer parent, const gchar *item_name, gpointer data) { gchar *filename; filename = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_BASE_DIR, G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_COMPOSE_DIR, G_DIR_SEPARATOR_S, item_name, NULL); run_script_file(filename, (Compose*)parent); g_free(filename); }
static void python_mainwin_script_callback(GtkAction *action, gpointer data) { char *filename; filename = extract_filename(data); if(!filename) return; filename = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_BASE_DIR, G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_MAIN_DIR, G_DIR_SEPARATOR_S, filename, NULL); run_script_file(filename, NULL); g_free(filename); }
static void run_auto_script_file_if_it_exists(const gchar *autofilename, Compose *compose) { gchar *auto_filepath; /* execute auto/autofilename, if it exists */ auto_filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_BASE_DIR, G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_AUTO_DIR, G_DIR_SEPARATOR_S, autofilename, NULL); if(file_exist(auto_filepath, FALSE)) run_script_file(auto_filepath, compose); g_free(auto_filepath); }
int main ( int argc, char *argv[ ] ) /* Function: main Author: Neil Cossor Modified: 20000122 Description: This function starts the program, gathers the log on data, logs on to the system, downloads various data, sets up the exit procedure, and kicks off the main loop. Input Parameters: (generic C) The first string (argv[0]) is the program name, and each following string is an argument passed to the program from the command line. The last pointer (argv[argc]) is NULL. (app specific, if supplied.. may be NULLed by specifying "" in command line) argv[1] == name of logfile for output. Default LOGFILE.TXT argv[2] == name of User file, containing CLICK username, gateway name etc defaults to name (in const.h) #defined by USER_DATA_FILENAME argv[3] == name of script file to run. No default. If supplied, then it is - loaded immediately - run - and then the application exits If not supplied, then we run in interactive mode. Note that a script file can be LOADed and RUN from interactive mode. */ { int32 status_i = SUCCESSFUL; int8 command_line_s[USER_INPUT_BUFFER_LEN]; click_details_xt z; int k = sizeof(z.log_reply_x.trans_reply_x ); /* code */ printf("\n\nWelcome to Version %s of the simulator.\n",SIM_VERSION); printf("______________________________________________\n\n"); printf("\nThis session started on " ); printf_time (); printf ("\n"); printf ("Commandline args are :-\n"); display_arglist ( argc, &argv[0] ); // stash the supplied command line params // try for 4th param - script filename if ( argc > 3) { // have enough arguments for a script filename user_script_filename_ps = argv[3]; } if ( argc > 2) { // have enough arguments for a user param filename strcpy ( user_param_filename_ps, argv[2] ); } if ( argc > 1) { // have more arguments than just the program name - try for logfile name user_log_filename_ps = argv[1]; } // test if enuff params for a logfile name to be supplied // try to set everything up... including allocation of memory for generic data click_px = ISESim_init ( argc, &argv[0] ); if (click_px == NULL) // 0 { printf("\nAborting - error starting logger\n"); exit(0); } // if the caller supplied a SIM script file, then we just load that, // execute it, and exit if ( ( user_script_filename_ps != NULL ) && ( strlen ( user_script_filename_ps ) != 0 ) ) { // load and run the script status_i = load_script_file ( user_script_filename_ps ); // did the load work OK if (status_i == SUCCESSFUL) { // attempt to actually run the script // 1 argument, no "parameter", so it makes it default to 1 run status_i = run_script_file ( click_px, 1, NULL ); } // test if script load worked OK } else { // print out help prompt printf("Commands useful at this point are:- \n\tLOAD LOGON HELP EXIT QUIT.\n\n"); printf("Please Type '?' or Help for Help on Commands\n"); status_i = SUCCESSFUL; while (status_i >= SUCCESSFUL) { // zot the input line memset (&command_line_s[0], (char)0, sizeof (command_line_s)); // process keyboard input printf("ISESim> "); // get a command from the user read_kbd_input ( &command_line_s[0] ); // and process it status_i = process_commands (click_px, &command_line_s[0], FALSE ); } // while no errors processing commands, and no exit/quit request }; // test if running a script from initial program arguments exit (status_i); } // main