Add methods for converting between Collections (asBag, asSet, etc)
[panda.git] / src / st-context.h
blobb1db8dc1a58cfa2893fbda2f0170e16b217d9d69
1 /*
2 * st-context.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_CONTEXT_H__
26 #define __ST_CONTEXT_H__
28 #include <st-types.h>
29 #include <st-object.h>
31 struct st_context_part
33 struct st_header __parent__;
35 st_oop sender;
36 st_oop ip;
37 st_oop sp;
41 struct st_method_context
43 struct st_context_part __parent__;
44 st_oop method;
45 st_oop receiver;
47 st_oop stack[];
50 struct st_block_context
52 struct st_context_part __parent__;
53 st_oop initial_ip;
54 st_oop argcount;
55 st_oop home;
57 st_oop stack[];
60 #define ST_CONTEXT_PART(oop) ((struct st_context_part *) st_detag_pointer (oop))
61 #define ST_METHOD_CONTEXT(oop) ((struct st_method_context *) st_detag_pointer (oop))
62 #define ST_BLOCK_CONTEXT(oop) ((struct st_block_context *) st_detag_pointer (oop))
65 #define ST_CONTEXT_PART_SENDER(oop) (ST_CONTEXT_PART (oop)->sender)
66 #define ST_CONTEXT_PART_IP(oop) (ST_CONTEXT_PART (oop)->ip)
67 #define ST_CONTEXT_PART_SP(oop) (ST_CONTEXT_PART (oop)->sp)
69 #define ST_METHOD_CONTEXT_METHOD(oop) (ST_METHOD_CONTEXT (oop)->method)
70 #define ST_METHOD_CONTEXT_RECEIVER(oop) (ST_METHOD_CONTEXT (oop)->receiver)
71 #define ST_METHOD_CONTEXT_STACK(oop) (ST_METHOD_CONTEXT (oop)->stack)
73 #define ST_BLOCK_CONTEXT_INITIALIP(oop) (ST_BLOCK_CONTEXT (oop)->initial_ip)
74 #define ST_BLOCK_CONTEXT_ARGCOUNT(oop) (ST_BLOCK_CONTEXT (oop)->argcount)
75 #define ST_BLOCK_CONTEXT_HOME(oop) (ST_BLOCK_CONTEXT (oop)->home)
76 #define ST_BLOCK_CONTEXT_STACK(oop) (ST_BLOCK_CONTEXT (oop)->stack)
78 #endif /* __ST_CONTEXT_H__ */