2 * Simulator of microcontrollers (cmd51.cc)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
10 /* This file is part of microcontroller simulator: ucsim.
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.
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.
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
40 * Special console for s51 it uses old version of the command interpreter
43 cl_51cons::cl_51cons(char *fin, char *fout, class cl_sim *asim):
44 cl_console(fin, fout, asim)
47 cl_51cons::cl_51cons(FILE *fin, FILE *fout, class cl_sim *asim):
48 cl_console(fin, fout, asim)
52 cl_51cons::cl_51cons(int portnumber, class cl_sim *asim):
53 cl_console(portnumber, asim)
58 cl_51cons::proc_input(void)
60 return(cl_console::proc_input());
61 /*char *cmd= read_line();
64 int retval= interpret(cmd);
71 cl_51cons::interpret(char *cmd)
75 bool repeat= DD_FALSE, retval= DD_FALSE;
82 last_command= strdup(cmd);
85 if (last_command == NULL)
89 c= strdup(last_command);
93 s= strtok(c, delimiters);
94 while ((cmd_table[i].name != NULL) &&
95 /*(strstr(c, cmd_table[i].name) != c)*/
96 (strcmp(s, cmd_table[i].name) != 0))
98 if (cmd_table[i].name == NULL)
100 sim->cmd->printf("Unknown command.\n");
110 retval= cmd_table[i].func(c, sim->uc, sim);
112 if (cmd_table[i].can_repeat)
113 retval= cmd_table[i].func(c, sim->uc, sim);
120 cl_51cons::old_command(class cl_cmdline *cmdline)
124 if (cmdline->name == 0 ||
125 *(cmdline->name) == '\0' ||
126 *(cmdline->name) == '\n')
128 while ((cmd_table[i].name != NULL) &&
129 /*(strstr(c, cmd_table[i].name) != c)*/
130 (strcmp(cmdline->name, cmd_table[i].name) != 0))
132 return(cmd_table[i].name != NULL);
137 * Special commander for s51 it uses special console
140 cl_51cmd::cl_51cmd(class cl_sim *asim):
145 cl_51cmd::mk_console(char *fin, char *fout, class cl_sim *asim)
147 return(new cl_51cons(fin, fout, asim));
151 cl_51cmd::mk_console(FILE *fin, FILE *fout, class cl_sim *asim)
153 return(new cl_51cons(fin, fout, asim));
157 /* End of s51.src/cmd51.cc */