2 * Simulator of microcontrollers (pobjcl.h)
4 * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
11 This file is part of microcontroller simulator: ucsim.
13 UCSIM is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 UCSIM is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with UCSIM; see the file COPYING. If not, write to the Free
25 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
41 ==========================================================================#
43 ==========================================================================#
54 class cl_base *parent;
55 class cl_list *children;
58 virtual ~cl_base(void);
60 virtual int init(void);
61 virtual const char *get_name(void) { return(name); }
62 virtual const char *get_name(const char *def);
63 virtual bool have_name(void) { return(name != 0); }
64 virtual bool have_real_name(void) { return(name != 0 && *name != '\0'); }
65 const char *set_name(const char *new_name);
66 const char *set_name(const char *new_name, const char *def_name);
67 bool is_named(const char *the_name);
68 bool is_inamed(const char *the_name);
70 class cl_base *get_parent(void) { return(parent); }
71 int nuof_children(void);
73 virtual void add_child(class cl_base *child);
74 virtual void remove_child(class cl_base *child);
75 virtual void remove_from_chain(void);
76 virtual void unlink(void);
77 virtual class cl_base *first_child(void);
78 virtual class cl_base *next_child(class cl_base *child);
80 virtual bool handle_event(class cl_event &event);
81 virtual bool pass_event_down(class cl_event &event);
89 class cl_event: public cl_base
96 cl_event(enum event what_event);
97 virtual ~cl_event(void);
99 bool is_handled(void) { return(handled); }
100 virtual void handle(void) { handled= DD_TRUE; }
105 ==========================================================================#
107 ==========================================================================#
111 class cl_list: public cl_base
121 cl_list(t_index alimit, t_index adelta, const char *aname);
122 virtual ~cl_list(void);
124 void *at(t_index index);
125 class cl_base *object_at(t_index index);
126 virtual t_index index_of(void *item);
127 virtual bool index_of(void *item, t_index *idx);
128 virtual void *next(void *item);
130 virtual void *pop(void);
131 virtual void *top(void);
134 virtual void set_limit(t_index alimit);
136 void free_at(t_index index);
138 void disconn_at(t_index index);
139 void disconn(void *item);
140 void disconn_all(void);
142 void add_at(t_index index, void *item);
143 void put_at(t_index index, void *item);
144 virtual t_index add(void *item);
145 virtual t_index add(class cl_base *item, class cl_base *parent);
146 virtual void push(void *item);
148 void *first_that(match_func test, const void *arg);
149 void *last_that(match_func test, void *arg);
150 void for_each(iterator_func action, void *arg);
152 void error(t_index code, t_index info);
154 virtual void free_item(void *item);
159 ==========================================================================#
161 ==========================================================================#
165 class cl_sorted_list: public cl_list
170 cl_sorted_list(t_index alimit, t_index adelta, const char *aname);
171 virtual ~cl_sorted_list(void);
173 virtual bool search(const void *key, t_index& index);
174 virtual t_index index_of(void *item);
175 virtual t_index add(void *item);
176 virtual const void *key_of(void *item);
178 virtual int compare(const void *key1, const void *key2)= 0;
183 ==========================================================================#
185 ==========================================================================#
189 class cl_strings: public cl_sorted_list
192 cl_strings(t_index alimit, t_index adelta, const char *aname);
193 virtual ~cl_strings(void);
196 virtual int compare(const void *key1, const void *key2);
197 virtual void free_item(void *item);
202 ==========================================================================#
204 ==========================================================================#
208 class cl_ustrings: public cl_strings
211 cl_ustrings(t_index alimit, t_index adelta, const char *aname);
212 virtual ~cl_ustrings(void);
215 virtual int compare(const void *key1, const void *key2);
216 virtual bool search(const void *key, t_index &index);