version 0.5.2
[fw/sdcc] / sim / ucsim / cmd.src / cmdconf.cc
1 /*
2  * Simulator of microcontrollers (cmd.src/cmdconf.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 // prj
29 #include "globals.h"
30 #include "utils.h"
31
32 // sim
33 #include "simcl.h"
34
35 // local
36 #include "cmdconfcl.h"
37
38
39 /*
40  * Command: conf
41  *----------------------------------------------------------------------------
42  */
43
44 //int
45 //cl_conf_cmd::do_work(class cl_sim *sim,
46 //                   class cl_cmdline *cmdline, class cl_console *con)
47 COMMAND_DO_WORK_UC(cl_conf_cmd)
48 {
49   int i;
50
51   con->dd_printf("ucsim version %s\n", VERSIONSTR);
52   con->dd_printf("Type of microcontroller: %s\n", uc->id_string());
53   con->dd_printf("Controller has %d hardware element(s).\n",
54                  uc->hws->count);
55   for (i= 0; i < uc->hws->count; i++)
56     {
57       class cl_hw *hw= (class cl_hw *)(uc->hws->at(i));
58       con->dd_printf("  %s[%d]\n", hw->id_string, hw->id);
59     }
60   return(0);
61 }
62
63 /*
64  * Command: conf objects
65  *----------------------------------------------------------------------------
66  */
67
68 static void
69 conf_objects_cmd_print_node(class cl_console *con,
70                             int indent, class cl_base *node)
71 {
72   if (!node)
73     return;
74   int i;
75   for (i= 0; i < indent; i++)
76     con->dd_printf(" ");
77   char *name= node->get_name("unknown");
78   con->dd_printf("%s\n", name);
79   class cl_base *c= node->first_child();
80   while (c)
81     {
82       conf_objects_cmd_print_node(con, indent+2, c);
83       c= node->next_child(c);
84     }
85 }
86
87 //int
88 //cl_conf_addmem_cmd::do_work(class cl_sim *sim,
89 //                          class cl_cmdline *cmdline, class cl_console *con)
90 COMMAND_DO_WORK_APP(cl_conf_objects_cmd)
91 {
92   //class cl_address_space *mem= 0;
93   /*class cl_cmd_arg *params[4]= { cmdline->param(0),
94                                  cmdline->param(1),
95                                  cmdline->param(2),
96                                  cmdline->param(3) };*/
97   conf_objects_cmd_print_node(con, 0, application);
98   return(DD_FALSE);
99 }
100
101
102 /* End of cmd.src/cmdconf.cc */