Fixed some C/C++ compiler errors due to stricter checks.
[rubinius.git] / machine / arguments.hpp
blobbd8964681daa7b401644bdbc2982569972b251a5
1 #ifndef RBX_ARGUMENTS_HPP
2 #define RBX_ARGUMENTS_HPP
4 #include <stdint.h>
5 #include "class/array.hpp"
6 #include "class/tuple.hpp"
8 namespace rubinius {
9 class Array;
11 class Arguments {
12 Symbol* name_;
13 Object* recv_;
14 Object* block_;
16 uint32_t total_;
17 Object** arguments_;
18 Tuple* argument_container_;
20 public:
21 Arguments(Symbol* name, Object* recv, Object* block, uint32_t total, Object** buffer)
22 : name_(name)
23 , recv_(recv)
24 , block_(block)
25 , total_(total)
26 , arguments_(buffer)
27 , argument_container_(0)
30 Arguments(Symbol* name, Object* recv, uint32_t total, Object** buffer)
31 : name_(name)
32 , recv_(recv)
33 , block_(cNil)
34 , total_(total)
35 , arguments_(buffer)
36 , argument_container_(0)
39 Arguments(Symbol* name, uint32_t total, Object** buffer)
40 : name_(name)
41 , recv_(cNil)
42 , block_(cNil)
43 , total_(total)
44 , arguments_(buffer)
45 , argument_container_(0)
48 Arguments(Symbol* name, Object* recv, Object* block)
49 : name_(name)
50 , recv_(recv)
51 , block_(block)
52 , total_(0)
53 , arguments_(0)
54 , argument_container_(0)
57 Arguments(Symbol* name, Object* recv)
58 : name_(name)
59 , recv_(recv)
60 , block_(cNil)
61 , total_(0)
62 , arguments_(0)
63 , argument_container_(0)
66 Arguments(Symbol* name)
67 : name_(name)
68 , recv_(cNil)
69 , block_(cNil)
70 , total_(0)
71 , arguments_(0)
72 , argument_container_(0)
75 Arguments(Symbol* name, Object* recv, Object* block, Array* ary)
76 : name_(name)
77 , recv_(recv)
78 , block_(block)
80 use_array(ary);
83 Arguments(Symbol* name, Object* recv, Array* ary)
84 : name_(name)
85 , recv_(recv)
86 , block_(cNil)
88 use_array(ary);
91 Arguments(Symbol* name, Array* ary)
92 : name_(name)
93 , recv_(cNil)
94 , block_(cNil)
96 use_array(ary);
99 Symbol* name() const {
100 return name_;
103 void set_name(Symbol* n) {
104 name_ = n;
107 Object* recv() const {
108 return recv_;
111 Object*& recv_location() {
112 return recv_;
115 void set_recv(Object* val) {
116 recv_ = val;
119 Object* block() const {
120 return block_;
123 Object*& block_location() {
124 return block_;
127 void set_block(Object* val) {
128 block_ = val;
131 Object* get_argument(uint32_t which) const {
132 return arguments_[which];
135 Object** arguments() const {
136 return arguments_;
139 Object**& arguments_location() {
140 return arguments_;
143 Tuple* argument_container() const {
144 return argument_container_;
147 void update_argument_container(Tuple* obj);
149 uint32_t total() const {
150 return total_;
153 void use_argument(Object* obj) {
154 arguments_[0] = obj;
157 void use_array(Array* ary) {
158 use_tuple(ary->tuple(), ary->size(), ary->offset());
161 void use_tuple(Tuple* tup, uint32_t size, uint32_t offset) {
162 total_ = size;
163 arguments_ = tup->field + offset;
164 argument_container_ = tup;
167 void use_tuple(Tuple* tup, uint32_t size) {
168 use_tuple(tup, size, 0);
171 Array* as_array(STATE);
172 void append(STATE, Array* ary);
173 void prepend(STATE, Array* ary);
175 void unshift(STATE, Object* val);
176 void unshift2(STATE, Object* val, Object* val2);
178 Object* shift(STATE);
182 #endif