2 * Simulator of microcontrollers (sim.src/optioncl.h)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
28 #ifndef SIM_OPTIONCL_HEADER
29 #define SIM_OPTIONCL_HEADER
59 class cl_option: public cl_base
64 union option_value value;
65 class cl_base *creator;
67 class cl_list *users; // cl_optref
73 cl_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
74 virtual class cl_option &operator=(class cl_option &o);
75 virtual ~cl_option(void);
76 virtual void pre_remove(void);
78 virtual class cl_base *get_creator(void) { return(creator); }
79 virtual void hide(void) { hidden= DD_TRUE; }
80 virtual void show(void) { hidden= DD_FALSE; }
82 virtual void print(class cl_console_base *con) {}
83 virtual const char *get_type_name(void) { return("non"); }
85 virtual union option_value *get_value(void) { return(&value); }
86 virtual void get_value(bool *val);
87 virtual void get_value(char **val);
88 virtual void get_value(void **val);
89 virtual void get_value(long *val);
90 virtual void get_value(double *val);
91 virtual void set_value(bool opt);
92 virtual void set_value(char *opt);
93 virtual void set_value(void *opt);
94 virtual void set_value(long opt);
95 virtual void set_value(double opt);
97 virtual void new_reference(class cl_optref *ref);
98 virtual void del_reference(class cl_optref *ref);
99 virtual void inform_users(void);
103 class cl_options: public cl_sorted_list
106 cl_options(void): cl_sorted_list(2, 2, "options") { Duplicates= DD_TRUE; }
107 virtual const void *key_of(void *item);
108 virtual int compare(const void *key1, const void *key2);
109 virtual void new_option(class cl_option *opt);
110 virtual void del_option(class cl_option *opt);
111 virtual class cl_option *get_option(const char *the_name);
112 virtual class cl_option *get_option(const char *the_name, class cl_base *creator);
113 virtual class cl_option *get_option(const char *the_name, char *creator);
114 virtual class cl_option *get_option(int idx);
115 virtual int nuof_options(char *the_name);
116 virtual int nuof_options(char *the_name, char *creator);
118 virtual class cl_option *set_value(const char *the_name, cl_base *creator,
120 virtual class cl_option *set_value(const char *the_name, cl_base *creator,
122 virtual class cl_option *set_value(const char *the_name, cl_base *creator,
124 virtual class cl_option *set_value(const char *the_name, cl_base *creator,
126 virtual class cl_option *set_value(const char *the_name, cl_base *creator,
131 class cl_optref: public cl_base
134 class cl_option *option;
135 class cl_base *owner;
137 cl_optref(class cl_base *the_owner);
138 cl_optref(class cl_base *the_owner, class cl_option *new_option);
139 virtual ~cl_optref(void);
141 virtual class cl_option *create(class cl_base *creator,
142 enum option_type type,
143 const char *the_name, const char *help);
144 virtual void default_option(const char *the_name);
145 virtual class cl_option *use(void);
146 virtual class cl_option *use(const char *the_name);
147 virtual void option_changed(void) {}
148 virtual void option_removing(void);
149 virtual class cl_base *get_owner(void) { return(owner); }
151 virtual bool get_value(bool);
152 virtual char *get_value(const char *);
153 virtual void *get_value(void *);
154 virtual long get_value(long);
155 virtual double get_value(double);
159 class cl_bool_option: public cl_option
162 cl_bool_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
163 virtual void print(class cl_console_base *con);
164 virtual const char *get_type_name(void) { return("boolean"); }
165 virtual void set_value(char *s);
169 class cl_string_option: public cl_option
172 cl_string_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
173 virtual class cl_option &operator=(class cl_option &o);
174 virtual void print(class cl_console_base *con);
175 virtual const char *get_type_name(void) { return("string"); }
179 class cl_pointer_option: public cl_option
182 cl_pointer_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
183 virtual class cl_option &operator=(class cl_option &o);
184 virtual void print(class cl_console_base *con);
185 virtual const char *get_type_name(void) { return("pointer"); }
189 class cl_number_option: public cl_option
192 cl_number_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
193 virtual void print(class cl_console_base *con);
194 virtual const char *get_type_name(void) { return("integer"); }
195 virtual void set_value(char *s);
199 class cl_float_option: public cl_option
202 cl_float_option(class cl_base *the_creator, const char *aname, const char *Ihelp);
203 virtual void print(class cl_console_base *con);
204 virtual const char *get_type_name(void) { return("float"); }
205 virtual void set_value(char *s);
209 /*class cl_cons_debug_opt: public cl_option
214 cl_cons_debug_opt(class cl_app *the_app, char *Iid, char *Ihelp);
216 virtual void print(class cl_console_base *con);
218 virtual void get_value(bool *val);
220 virtual void set_value(bool);
221 virtual void set_value(char *s);
227 /* End of optioncl.h */