1 /* GNUPLOT - command.h */ 2 3 /*[ 4 * Copyright 1999, 2004 Thomas Williams, Colin Kelley 5 * 6 * Permission to use, copy, and distribute this software and its 7 * documentation for any purpose with or without fee is hereby granted, 8 * provided that the above copyright notice appear in all copies and 9 * that both that copyright notice and this permission notice appear 10 * in supporting documentation. 11 * 12 * Permission to modify the software is granted, but not the right to 13 * distribute the complete modified source code. Modifications are to 14 * be distributed as patches to the released version. Permission to 15 * distribute binaries produced by compiling modified sources is granted, 16 * provided you 17 * 1. distribute the corresponding source modifications from the 18 * released version in the form of a patch file along with the binaries, 19 * 2. add special version identification to distinguish your version 20 * in addition to the base release version number, 21 * 3. provide your name and address as the primary contact for the 22 * support of your modified version, and 23 * 4. retain our contact information in regard to use of the base 24 * software. 25 * Permission to distribute the released version of the source code along 26 * with corresponding source modifications in the form of a patch file is 27 * granted with same provisions 2 through 4 for binary distributions. 28 * 29 * This software is provided "as is" without express or implied warranty 30 * to the extent permitted by applicable law. 31 ]*/ 32 33 #ifndef GNUPLOT_COMMAND_H 34 # define GNUPLOT_COMMAND_H 35 36 #include "gp_types.h" 37 #include "stdfn.h" 38 39 extern char *gp_input_line; 40 extern size_t gp_input_line_len; 41 42 extern int inline_num; 43 44 extern int if_depth; /* old if/else syntax only */ 45 extern TBOOLEAN if_open_for_else; /* new if/else syntax only */ 46 extern TBOOLEAN if_condition; /* used by both old and new syntax */ 47 48 typedef struct lexical_unit { /* produced by scanner */ 49 TBOOLEAN is_token; /* true if token, false if a value */ 50 struct value l_val; 51 int start_index; /* index of first char in token */ 52 int length; /* length of token in chars */ 53 } lexical_unit; 54 55 extern struct lexical_unit *token; 56 extern int token_table_size; 57 extern int plot_token; 58 #define END_OF_COMMAND (c_token >= num_tokens || equals(c_token,";")) 59 60 extern char *replot_line; 61 62 /* flag to disable `replot` when some data are sent through stdin; 63 * used by mouse/hotkey capable terminals */ 64 extern TBOOLEAN replot_disabled; 65 66 #ifdef USE_MOUSE 67 extern int paused_for_mouse; /* Flag the end condition we are paused until */ 68 #define PAUSE_BUTTON1 001 /* Mouse button 1 */ 69 #define PAUSE_BUTTON2 002 /* Mouse button 2 */ 70 #define PAUSE_BUTTON3 004 /* Mouse button 3 */ 71 #define PAUSE_CLICK 007 /* Any button click */ 72 #define PAUSE_KEYSTROKE 010 /* Any keystroke */ 73 #define PAUSE_WINCLOSE 020 /* Window close event */ 74 #define PAUSE_ANY 077 /* Terminate on any of the above */ 75 #endif 76 77 /* output file for the print command */ 78 extern FILE *print_out; 79 extern struct udvt_entry * print_out_var; 80 extern char *print_out_name; 81 82 extern struct udft_entry *dummy_func; 83 84 #ifndef STDOUT 85 # define STDOUT 1 86 #endif 87 88 #if defined(MSDOS) || defined(OS2) 89 extern char HelpFile[]; 90 #endif 91 92 #ifdef _WIN32 93 # define SET_CURSOR_WAIT SetCursor(LoadCursor((HINSTANCE) NULL, IDC_WAIT)) 94 # define SET_CURSOR_ARROW SetCursor(LoadCursor((HINSTANCE) NULL, IDC_ARROW)) 95 #else 96 # define SET_CURSOR_WAIT /* nought, zilch */ 97 # define SET_CURSOR_ARROW /* nought, zilch */ 98 #endif 99 100 /* input data, parsing variables */ 101 extern int num_tokens, c_token; 102 103 void raise_lower_command(int); 104 void raise_command(void); 105 void lower_command(void); 106 #ifdef OS2 107 extern void pm_raise_terminal_window(void); 108 extern void pm_lower_terminal_window(void); 109 #endif 110 #ifdef X11 111 extern void x11_raise_terminal_window(int); 112 extern void x11_raise_terminal_group(void); 113 extern void x11_lower_terminal_window(int); 114 extern void x11_lower_terminal_group(void); 115 #endif 116 #ifdef _WIN32 117 extern void win_raise_terminal_window(int); 118 extern void win_raise_terminal_group(void); 119 extern void win_lower_terminal_window(int); 120 extern void win_lower_terminal_group(void); 121 #endif 122 #ifdef WXWIDGETS 123 extern void wxt_raise_terminal_window(int); 124 extern void wxt_raise_terminal_group(void); 125 extern void wxt_lower_terminal_window(int); 126 extern void wxt_lower_terminal_group(void); 127 #endif 128 extern void string_expand_macros(void); 129 130 #ifdef USE_MOUSE 131 void bind_command(void); 132 void restore_prompt(void); 133 #else 134 #define bind_command() 135 #endif 136 void array_command(void); 137 void break_command(void); 138 void call_command(void); 139 void changedir_command(void); 140 void clear_command(void); 141 void continue_command(void); 142 void eval_command(void); 143 void exit_command(void); 144 void help_command(void); 145 void history_command(void); 146 void do_command(void); 147 void if_command(void); 148 void else_command(void); 149 void import_command(void); 150 void invalid_command(void); 151 void link_command(void); 152 void load_command(void); 153 void begin_clause(void); 154 void clause_reset_after_error(void); 155 void end_clause(void); 156 void null_command(void); 157 void pause_command(void); 158 void plot_command(void); 159 void print_command(void); 160 void printerr_command(void); 161 void pwd_command(void); 162 void refresh_request(void); 163 void refresh_command(void); 164 void replot_command(void); 165 void reread_command(void); 166 void save_command(void); 167 void screendump_command(void); 168 void splot_command(void); 169 void stats_command(void); 170 void system_command(void); 171 void test_command(void); 172 void toggle_command(void); 173 void update_command(void); 174 void do_shell(void); 175 void undefine_command(void); 176 void while_command(void); 177 178 /* Prototypes for functions exported by command.c */ 179 void extend_input_line(void); 180 void extend_token_table(void); 181 int com_line(void); 182 int do_line(void); 183 void do_string(const char* s); 184 void do_string_and_free(char* s); 185 TBOOLEAN iteration_early_exit(void); 186 #ifdef USE_MOUSE 187 void toggle_display_of_ipc_commands(void); 188 int display_ipc_commands(void); 189 void do_string_replot(const char* s); 190 #endif 191 #ifdef VMS /* HBB 990829: used only on VMS */ 192 void done(int status); 193 #endif 194 void define(void); 195 196 void replotrequest(void); /* used in command.c & mouse.c */ 197 198 void print_set_output(char *, TBOOLEAN, TBOOLEAN); /* set print output file */ 199 char *print_show_output(void); /* show print output file */ 200 201 int do_system_func(const char *cmd, char **output); 202 203 #endif /* GNUPLOT_COMMAND_H */ 204