version 0.2.39: fix of arith insts and start of re-structure
[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 // local
35 #include "appcl.h"
36
37
38 /*
39  * Program options
40  */
41
42 cl_option::cl_option(int atype, char sn, char *ln)
43 {
44   type= atype;
45   short_name= sn;
46   if (!ln)
47     long_name= NULL;
48   else
49     long_name= strdup(ln);
50   values= new cl_ustrings(1, 1);
51 }
52
53 cl_option::~cl_option(void)
54 {
55   if (long_name)
56     free(long_name);
57   delete values;
58 }
59
60 int
61 cl_option::add_value(char *value)
62 {
63   values->add(value);
64   return(values->count - 1);
65 }
66
67 char *
68 cl_option::get_value(int index)
69 {
70   if (index > values->count - 1)
71     return(0);
72   return((char*)(values->at(index)));
73 }
74
75 /* List of options */
76
77 cl_options::cl_options(void):
78   cl_list(2, 2)
79 {
80 }
81
82
83 /*
84  * Application
85  ****************************************************************************
86  */
87
88 cl_app::cl_app(void)
89 {
90   options= new cl_options();
91 }
92
93 cl_app::~cl_app(void)
94 {
95   delete options;
96 }
97
98
99 /* End of sim.src/app.cc */