Add methods for converting between Collections (asBag, asSet, etc)
[panda.git] / src / st-behavior.h
blob61efe7c2a5e5e8a8d358fbc6d549a540d5fe571e
1 /*
2 * st-behavior.h
4 * Copyright (C) 2008 Vincent Geddes
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
25 #ifndef __ST_BEHAVIOR_H__
26 #define __ST_BEHAVIOR_H__
28 #include <st-types.h>
29 #include <st-object.h>
30 #include <st-memory.h>
31 #include <st-small-integer.h>
32 #include <st-array.h>
33 #include <st-float.h>
34 #include <st-large-integer.h>
36 #define ST_BEHAVIOR(oop) ((struct st_behavior *) st_detag_pointer (oop))
37 #define ST_CLASS(oop) ((struct st_class *) st_detag_pointer (oop))
38 #define ST_METACLASS(oop) ((struct st_metaclass *) st_detag_pointer (oop))
40 struct st_behavior
42 struct st_header header;
44 st_oop format;
45 st_oop superclass;
46 st_oop instance_size;
47 st_oop method_dictionary;
48 st_oop instance_variables;
51 struct st_class
53 struct st_behavior parent;
55 st_oop name;
58 struct st_metaclass
60 struct st_behavior parent;
62 st_oop instance_class;
65 #define ST_BEHAVIOR_FORMAT(oop) (ST_BEHAVIOR (oop)->format)
66 #define ST_BEHAVIOR_SUPERCLASS(oop) (ST_BEHAVIOR (oop)->superclass)
67 #define ST_BEHAVIOR_INSTANCE_SIZE(oop) (ST_BEHAVIOR (oop)->instance_size)
68 #define ST_BEHAVIOR_METHOD_DICTIONARY(oop) (ST_BEHAVIOR (oop)->method_dictionary)
69 #define ST_BEHAVIOR_INSTANCE_VARIABLES(oop) (ST_BEHAVIOR (oop)->instance_variables)
70 #define ST_CLASS_NAME(oop) (ST_CLASS (oop)->name)
71 #define ST_METACLASS_INSTANCE_CLASS(oop) (ST_METACLASS (oop)->instance_class)
74 st_oop st_object_new (st_oop class);
75 st_oop st_object_new_arrayed (st_oop class, int size);
77 st_list *st_behavior_all_instance_variables (st_oop class);
81 #endif /* __ST_BEHAVIOR_H__ */