873bab1743df47c4ad5aa7bc3afdaccf50f8676f
[fw/sdcc] / sim / ucsim / sim.src / app.cc
1 /*
2  * Simulator of microcontrollers (app.cc)
3  *
4  * Copyright (C) 2001,01 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 #include <stdio.h>
29 #include <stdlib.h>
30
31 // prj
32 #include "i_string.h"
33
34 // sim.src
35 #include "simcl.h"
36
37 // local
38 #include "appcl.h"
39
40
41 /*
42  * Program options
43  */
44
45 /*cl_option::cl_option(int atype, char sn, char *ln)
46 {
47   type= atype;
48   short_name= sn;
49   if (!ln)
50     long_name= NULL;
51   else
52     long_name= strdup(ln);
53   values= new cl_ustrings(1, 1);
54 }
55
56 cl_option::~cl_option(void)
57 {
58   if (long_name)
59     free(long_name);
60   delete values;
61 }
62
63 int
64 cl_option::add_value(char *value)
65 {
66   values->add(value);
67   return(values->count - 1);
68 }
69
70 char *
71 cl_option::get_value(int index)
72 {
73   if (index > values->count - 1)
74     return(0);
75   return((char*)(values->at(index)));
76 }*/
77
78 /* List of options */
79
80 /*cl_options::cl_options(void):
81   cl_list(2, 2)
82 {
83 }*/
84
85
86 /*
87  * Application
88  ****************************************************************************
89  */
90
91 cl_app::cl_app(void)
92 {
93   //options= new cl_options();
94   sim= 0;
95 }
96
97 cl_app::~cl_app(void)
98 {
99   //delete options;
100   remove_simulator();
101 }
102
103 int
104 cl_app::init(void)
105 {
106   cl_base::init();
107
108   return(0);
109 }
110
111 /* Main cycle */
112
113 int
114 cl_app::run(void)
115 {
116   return(0);
117 }
118
119 void
120 cl_app::done(void)
121 {
122 }
123
124
125 /* Command handling */
126
127 class cl_cmd *
128 cl_app::get_cmd(class cl_cmdline *cmdline)
129 {
130   return(0);
131 }
132
133
134 /* Adding and removing comonents */
135
136 void
137 cl_app::set_simulator(class cl_sim *simulator)
138 {
139   if (sim)
140     remove_simulator();
141   sim= simulator;
142   
143 }
144
145 void
146 cl_app::remove_simulator(void)
147 {
148   if (!sim)
149     return;
150   delete sim;
151   sim= 0;
152 }
153
154 void
155 cl_app::build_cmdset(class cl_cmdset *cs)
156 {
157   
158 }
159
160
161 /* End of sim.src/app.cc */