1 /* 2 * $Id: parse.h,v 1.38 2017/02/04 23:59:27 sfeam Exp $ 3 */ 4 5 /* GNUPLOT - parse.h */ 6 7 /*[ 8 * Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley 9 * 10 * Permission to use, copy, and distribute this software and its 11 * documentation for any purpose with or without fee is hereby granted, 12 * provided that the above copyright notice appear in all copies and 13 * that both that copyright notice and this permission notice appear 14 * in supporting documentation. 15 * 16 * Permission to modify the software is granted, but not the right to 17 * distribute the complete modified source code. Modifications are to 18 * be distributed as patches to the released version. Permission to 19 * distribute binaries produced by compiling modified sources is granted, 20 * provided you 21 * 1. distribute the corresponding source modifications from the 22 * released version in the form of a patch file along with the binaries, 23 * 2. add special version identification to distinguish your version 24 * in addition to the base release version number, 25 * 3. provide your name and address as the primary contact for the 26 * support of your modified version, and 27 * 4. retain our contact information in regard to use of the base 28 * software. 29 * Permission to distribute the released version of the source code along 30 * with corresponding source modifications in the form of a patch file is 31 * granted with same provisions 2 through 4 for binary distributions. 32 * 33 * This software is provided "as is" without express or implied warranty 34 * to the extent permitted by applicable law. 35 ]*/ 36 37 #ifndef PARSE_H 38 # define PARSE_H 39 40 # include "syscfg.h" 41 # include "gp_types.h" 42 43 #include "eval.h" 44 45 /* externally usable types defined by parse.h */ 46 47 /* exported variables of parse.c */ 48 extern TBOOLEAN scanning_range_in_progress; 49 50 /* The choice of dummy variables, as set by 'set dummy', 'set polar' 51 * and 'set parametric' */ 52 extern char set_dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1]; 53 /* Dummy variables referenced by name in a fit command */ 54 /* Sep 2014 (DEBUG) used to deduce how many independent variables */ 55 extern int fit_dummy_var[MAX_NUM_VAR]; 56 /* the currently used 'dummy' variables. Usually a copy of 57 * set_dummy_var, but may be changed by the '(s)plot' command 58 * containing an explicit range (--> 'plot [phi=0..pi]') */ 59 extern char c_dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1]; 60 61 /* This is used by plot_option_using() */ 62 extern int at_highest_column_used; 63 64 /* This is checked by df_readascii() */ 65 extern TBOOLEAN parse_1st_row_as_headers; 66 67 /* This is used by df_open() and df_readascii() */ 68 extern udvt_entry *df_array; 69 70 /* Protection mechanism for trying to parse a string followed by a + or - sign. 71 * Also suppresses an undefined variable message if an unrecognized token 72 * is encountered during try_to_get_string(). 73 */ 74 extern TBOOLEAN string_result_only; 75 76 /* Prototypes of exported functions in parse.c */ 77 78 int int_expression __PROTO(()); 79 double real_expression __PROTO(()); 80 void parse_reset_after_error __PROTO(()); 81 struct value * const_string_express __PROTO((struct value *valptr)); 82 struct value * const_express __PROTO((struct value *valptr)); 83 char* string_or_express __PROTO((struct at_type **atptr)); 84 struct at_type * temp_at __PROTO((void)); 85 struct at_type * perm_at __PROTO((void)); 86 struct at_type * create_call_column_at __PROTO((char *)); 87 struct udvt_entry * add_udv __PROTO((int t_num)); 88 struct udft_entry * add_udf __PROTO((int t_num)); 89 void cleanup_udvlist __PROTO((void)); 90 int is_function __PROTO((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 __PROTO((void)); 113 TBOOLEAN next_iteration __PROTO((t_iterator *)); 114 TBOOLEAN empty_iteration __PROTO((t_iterator *)); 115 TBOOLEAN forever_iteration __PROTO((t_iterator *)); 116 t_iterator * cleanup_iteration __PROTO((t_iterator *)); 117 118 void parse_link_via __PROTO((struct udft_entry *)); 119 120 #endif /* PARSE_H */ 121