new files of 0.5.2
[fw/sdcc] / sim / ucsim / cmd.src / show.cc
1 /*
2  * Simulator of microcontrollers (cmd.src/show.cc)
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 #include "ddconfig.h"
29 #include "i_string.h"
30
31 // prj
32 #include "globals.h"
33 #include "utils.h"
34
35 // sim
36 #include "simcl.h"
37
38 // local
39 #include "showcl.h"
40
41
42 /*
43  * Command: show copying
44  *----------------------------------------------------------------------------
45  */
46
47 //int
48 //cl_show_copying_cmd::do_work(class cl_sim *sim,
49 //                           class cl_cmdline *cmdline, class cl_console *con)
50 COMMAND_DO_WORK(cl_show_copying_cmd)
51 {
52   con->dd_printf("%s\n", copying);
53   return(DD_FALSE);;
54 }
55
56
57 /*
58  * Command: show warranty
59  *----------------------------------------------------------------------------
60  */
61
62 //int
63 //cl_show_warranty_cmd::do_work(class cl_sim *sim,
64 //                            class cl_cmdline *cmdline, class cl_console *con)
65 COMMAND_DO_WORK(cl_show_warranty_cmd)
66 {
67   con->dd_printf("%s\n", warranty);
68   return(DD_FALSE);;
69 }
70
71
72 /*
73  * Command: show option
74  *----------------------------------------------------------------------------
75  */
76 COMMAND_DO_WORK_APP(cl_show_option_cmd)
77 {
78   class cl_cmd_arg *parm= cmdline->param(0);
79   char *s= 0;
80
81   if (!parm)
82     ;
83   else if (cmdline->syntax_match(0/*app->get_uc()*/, STRING)) {
84     s= parm->value.string.string;
85   }
86   else
87     con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
88
89   int i;
90   for (i= 0; i < app->options->count; i++)
91     {
92       class cl_option *o= (class cl_option *)(/*uc*/app->options->at(i));
93       if (!s ||
94           !strcmp(s, o->get_name()))
95         {
96           con->dd_printf("%d. %s: ", i, object_name(o));
97           o->print(con);
98           con->dd_printf(" - %s\n", o->help);
99           union option_value *val= o->get_value();
100           con->dd_printf("  Value: \"");
101           unsigned int uj;
102           int j;
103           TYPE_UBYTE *d= (TYPE_UBYTE*)val;
104           for (uj= 0; uj < sizeof(*val); uj++)
105             con->print_char_octal(d[uj]);
106           con->dd_printf("\"\n  Creator: \"%s\"\n  %d Users:\n",
107                          object_name(o->get_creator()),
108                          o->users->count);
109           con->dd_printf("  Hidden: %s\n", (o->hidden)?"True":"False");
110           for (j= 0; j < o->users->count; j++)
111             {
112               class cl_optref *r= (class cl_optref *)(o->users->at(j));
113               con->dd_printf("    %2d. owner(s)=\"%s\"\n", j,
114                              object_name(r->get_owner()));
115             }
116           if (i >= 0 &&
117               i < app->options->count-1)
118             con->dd_printf("\n");
119         }
120     }
121   
122   return(DD_FALSE);;
123 }
124
125
126 /* End of cmd.src/show.cc */