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
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
37 ==========================================================================#
39 ==========================================================================#
49 virtual ~cl_base(void);
51 virtual int init(void);
52 virtual char *get_name(void) { return(name); }
53 virtual char *get_name(char *def);
54 virtual bool have_name(void) { return(name != 0); }
55 virtual bool have_real_name(void) { return(name != 0 && *name != '\0'); }
56 char *set_name(char *new_name);
61 ==========================================================================#
63 ==========================================================================#
67 class cl_list: public cl_base
77 cl_list(t_index alimit, t_index adelta);
78 virtual ~cl_list(void);
80 void *at(t_index index);
81 virtual t_index index_of(void *item);
82 virtual bool index_of(void *item, t_index *idx);
84 virtual void *pop(void);
85 virtual void *top(void);
88 virtual void set_limit(t_index alimit);
90 void free_at(t_index index);
92 void disconn_at(t_index index);
93 void disconn(void *item);
94 void disconn_all(void);
96 void add_at(t_index index, void *item);
97 void put_at(t_index index, void *item);
98 virtual t_index add(void *item);
99 virtual void push(void *item);
101 void *first_that(match_func test, void *arg);
102 void *last_that(match_func test, void *arg);
103 void for_each(iterator_func action, void *arg);
105 void error(t_index code, t_index info);
107 virtual void free_item(void *item);
112 ==========================================================================#
114 ==========================================================================#
118 class cl_sorted_list: public cl_list
123 cl_sorted_list(t_index alimit, t_index adelta);
124 virtual ~cl_sorted_list(void);
126 virtual bool search(void *key, t_index& index);
127 virtual t_index index_of(void *item);
128 virtual t_index add(void *item);
129 virtual void *key_of(void *item);
131 virtual int compare(void *key1, void *key2)= 0;
136 ==========================================================================#
138 ==========================================================================#
142 class cl_strings: public cl_sorted_list
145 cl_strings(t_index alimit, t_index adelta);
146 virtual ~cl_strings(void);
149 virtual int compare(void *key1, void *key2);
150 virtual void free_item(void *item);
155 ==========================================================================#
157 ==========================================================================#
161 class cl_ustrings: public cl_strings
164 cl_ustrings(t_index alimit, t_index adelta);
165 virtual ~cl_ustrings(void);
168 virtual int compare(void *key1, void *key2);
169 virtual bool search(void *key, t_index &index);