ucsim-0.2.37-pre3 into cvs
[fw/sdcc] / sim / ucsim / sim.src / argcl.h
1 /*
2  * Simulator of microcontrollers (argcl.h)
3  *
4  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
5  * 
6  * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
7  *
8  */
9
10 /* This file is part of microcontroller simulator: ucsim.
11
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.
16
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.
21
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
25 02111-1307, USA. */
26 /*@1@*/
27
28 #ifndef ARGCL_HEADER
29 #define ARGCL_HEADER
30
31 #include "pobjcl.h"
32
33
34 /*
35  * Base type of arguments/parameters
36  */
37
38 class cl_arg: public cl_base
39 {
40 public:
41   union {
42     long long i_value;
43     double f_value;
44     void *p_value;
45   };
46   char *s_value;
47
48 public:  
49   cl_arg(long long lv);
50   cl_arg(char *lv);
51   cl_arg(double fv);
52   cl_arg(void *pv);
53   ~cl_arg(void);
54
55   virtual long long get_ivalue(void);
56   virtual char *get_svalue(void);
57   virtual double get_fvalue(void);
58   virtual void *get_pvalue(void);
59 };
60
61
62 /*
63  * Command parameters
64  */
65
66 class cl_cmd_arg: public cl_arg
67 {
68 public:
69   cl_cmd_arg(long long i): cl_arg(i) {}
70   cl_cmd_arg(char *s): cl_arg(s) {}
71
72   virtual int is_string(void) { return(0); }
73   virtual long get_address(void) { return(-1); }
74 };
75
76 class cl_cmd_int_arg: public cl_cmd_arg
77 {
78 public:
79   cl_cmd_int_arg(long long addr);
80
81   virtual long get_address(void) { return(get_ivalue()); }
82 };
83
84 class cl_cmd_sym_arg: public cl_cmd_arg
85 {
86 public:
87   cl_cmd_sym_arg(char *sym);
88
89   virtual long get_address(void);
90 };
91
92 class cl_cmd_str_arg: public cl_cmd_arg
93 {
94 public:
95   cl_cmd_str_arg(char *str);
96
97   virtual int is_string(void) { return(1); }
98 };
99
100 class cl_cmd_bit_arg: public cl_cmd_arg
101 {
102 public:
103   class cl_cmd_arg *sfr, *bit;
104
105 public:
106   cl_cmd_bit_arg(class cl_cmd_arg *asfr, class cl_cmd_arg *abit);
107   ~cl_cmd_bit_arg(void);
108
109   virtual long get_address(void);
110 };
111
112
113 /*
114  * Program arguments
115  */
116
117 class cl_prg_arg: public cl_arg
118 {
119 public:
120   char short_name;
121   char *long_name;
122
123 public:
124   cl_prg_arg(char sn, char *ln, long long lv);
125   cl_prg_arg(char sn, char *ln, char *lv);
126   cl_prg_arg(char sn, char *ln, double fv);
127   cl_prg_arg(char sn, char *ln, void *pv);
128   ~cl_prg_arg(void);
129 };
130
131
132 #endif
133
134 /* End of argcl.h */