1 /* GNUPLOT - parse.h */ 2 3 /*[ 4 * Copyright 1986 - 1993, 1998, 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 PARSE_H 34 # define PARSE_H 35 36 # include "syscfg.h" 37 # include "gp_types.h" 38 39 #include "eval.h" 40 41 /* externally usable types defined by parse.h */ 42 43 /* exported variables of parse.c */ 44 extern TBOOLEAN scanning_range_in_progress; 45 46 /* The choice of dummy variables, as set by 'set dummy', 'set polar' 47 * and 'set parametric' */ 48 extern char set_dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1]; 49 /* Dummy variables referenced by name in a fit command */ 50 /* Sep 2014 (DEBUG) used to deduce how many independent variables */ 51 extern int fit_dummy_var[MAX_NUM_VAR]; 52 /* the currently used 'dummy' variables. Usually a copy of 53 * set_dummy_var, but may be changed by the '(s)plot' command 54 * containing an explicit range (--> 'plot [phi=0..pi]') */ 55 extern char c_dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1]; 56 57 /* This is used by plot_option_using() */ 58 extern int at_highest_column_used; 59 60 /* This is checked by df_readascii() */ 61 extern TBOOLEAN parse_1st_row_as_headers; 62 63 /* This is used by df_open() and df_readascii() */ 64 extern udvt_entry *df_array; 65 66 /* This is used to block re-definition of built-in functions */ 67 extern int is_builtin_function(int t_num); 68 69 /* Protection mechanism for trying to parse a string followed by a + or - sign. 70 * Also suppresses an undefined variable message if an unrecognized token 71 * is encountered during try_to_get_string(). 72 */ 73 extern TBOOLEAN string_result_only; 74 75 /* Prototypes of exported functions in parse.c */ 76 77 intgr_t int_expression(void); 78 double real_expression(void); 79 void parse_reset_after_error(void); 80 struct value * const_string_express(struct value *valptr); 81 struct value * const_express(struct value *valptr); 82 char* string_or_express(struct at_type **atptr); 83 struct at_type * temp_at(void); 84 struct at_type * perm_at(void); 85 struct at_type * create_call_column_at(char *); 86 struct at_type * create_call_columnhead(void); 87 struct udvt_entry * add_udv(int t_num); 88 struct udft_entry * add_udf(int t_num); 89 void cleanup_udvlist(void); 90 int is_function(int t_num); 91 92 /* Code that uses the iteration routines here must provide */ 93 /* a blank iteration structure to use for bookkeeping. */ 94 typedef struct iterator { 95 struct iterator *next; /* linked list */ 96 struct udvt_entry *iteration_udv; 97 t_value original_udv_value; /* prior value of iteration variable */ 98 char *iteration_string; 99 int iteration_start; 100 int iteration_end; 101 int iteration_increment; 102 int iteration_current; /* start + increment * iteration */ 103 int iteration; /* runs from 0 to (end-start)/increment */ 104 struct at_type *start_at; /* expression that evaluates to iteration_start */ 105 struct at_type *end_at; /* expression that evaluates to iteration_end */ 106 } t_iterator; 107 108 extern t_iterator * plot_iterator; /* Used for plot and splot */ 109 extern t_iterator * set_iterator; /* Used by set/unset commands */ 110 111 /* These are used by the iteration code */ 112 t_iterator * check_for_iteration(void); 113 TBOOLEAN next_iteration (t_iterator *); 114 TBOOLEAN empty_iteration (t_iterator *); 115 TBOOLEAN forever_iteration (t_iterator *); 116 t_iterator * cleanup_iteration(t_iterator *); 117 118 void parse_link_via(struct udft_entry *); 119 120 #endif /* PARSE_H */ 121