intersys 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,143 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = /opt/local/lib/ruby/1.8/powerpc-darwin8.4.0
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
10
+ prefix = $(DESTDIR)/opt/local
11
+ exec_prefix = $(DESTDIR)/opt/local
12
+ sitedir = $(prefix)/lib/ruby/site_ruby
13
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
14
+ archdir = $(rubylibdir)/$(arch)
15
+ sbindir = $(exec_prefix)/sbin
16
+ vendordir = $(prefix)/lib/ruby/vendor_ruby
17
+ datadir = $(prefix)/share
18
+ includedir = $(prefix)/include
19
+ infodir = $(prefix)/info
20
+ sysconfdir = $(prefix)/etc
21
+ mandir = $(DESTDIR)/opt/local/share/man
22
+ libdir = $(DESTDIR)/opt/local/lib
23
+ sharedstatedir = $(prefix)/com
24
+ oldincludedir = $(DESTDIR)/usr/include
25
+ sitearchdir = $(sitelibdir)/$(sitearch)
26
+ vendorarchdir = $(vendorlibdir)/$(vendorarch)
27
+ bindir = $(exec_prefix)/bin
28
+ localstatedir = $(prefix)/var
29
+ vendorlibdir = $(vendordir)/$(ruby_version)
30
+ sitelibdir = $(sitedir)/$(ruby_version)
31
+ libexecdir = $(exec_prefix)/libexec
32
+
33
+ CC = gcc -g
34
+ LIBRUBY = $(LIBRUBY_SO)
35
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
36
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
37
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
38
+
39
+ CFLAGS = -fno-common -O -pipe -I/opt/local/include -fno-common -pipe -fno-common -I/Applications/Cache/dev/cpp/include -I/cygdrive/c/Progra~1/Cache/dev/cpp/include -I/cygdrive/c/Cachesys/dev/cpp/include -Wall
40
+ CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) -O -pipe -I/opt/local/include
41
+ CXXFLAGS = $(CFLAGS)
42
+ DLDFLAGS = -L/opt/local/lib
43
+ LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
44
+ AR = ar
45
+ EXEEXT =
46
+
47
+ RUBY_INSTALL_NAME = ruby
48
+ RUBY_SO_NAME = ruby
49
+ arch = powerpc-darwin8.4.0
50
+ sitearch = powerpc-darwin8.4.0
51
+ vendorarch = powerpc-darwin8.4.0
52
+ ruby_version = 1.8
53
+ ruby = /opt/local/bin/ruby
54
+ RUBY = $(ruby)
55
+ RM = rm -f
56
+ MAKEDIRS = mkdir -p
57
+ INSTALL = /usr/bin/install -c
58
+ INSTALL_PROG = $(INSTALL) -m 0755
59
+ INSTALL_DATA = $(INSTALL) -m 644
60
+ COPY = cp
61
+
62
+ #### End of system configuration section. ####
63
+
64
+ preload =
65
+
66
+ libpath = $(libdir)
67
+ LIBPATH = -L"$(libdir)"
68
+ DEFFILE =
69
+
70
+ CLEANFILES =
71
+ DISTCLEANFILES =
72
+
73
+ extout =
74
+ extout_prefix =
75
+ target_prefix =
76
+ LOCAL_LIBS =
77
+ LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
78
+ SRCS = common.c database.c definition.c intersys.c object.c query.c
79
+ OBJS = common.o database.o definition.o intersys.o object.o query.o
80
+ TARGET = intersys_cache
81
+ DLLIB = $(TARGET).bundle
82
+ STATIC_LIB =
83
+
84
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
85
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
86
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
87
+
88
+ TARGET_SO = $(DLLIB)
89
+ CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
90
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
91
+
92
+ all: $(DLLIB)
93
+ static: $(STATIC_LIB)
94
+
95
+ clean:
96
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
97
+
98
+ distclean: clean
99
+ @-$(RM) Makefile extconf.h conftest.* mkmf.log
100
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
101
+
102
+ realclean: distclean
103
+ install: install-so install-rb
104
+
105
+ install-so: $(RUBYARCHDIR)
106
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
107
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
108
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
109
+ install-rb: pre-install-rb install-rb-default
110
+ install-rb-default: pre-install-rb-default
111
+ pre-install-rb: Makefile
112
+ pre-install-rb-default: Makefile
113
+ $(RUBYARCHDIR):
114
+ $(MAKEDIRS) $@
115
+
116
+ site-install: site-install-so site-install-rb
117
+ site-install-so: install-so
118
+ site-install-rb: install-rb
119
+
120
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
121
+
122
+ .cc.o:
123
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
124
+
125
+ .cxx.o:
126
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
127
+
128
+ .cpp.o:
129
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
130
+
131
+ .C.o:
132
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
133
+
134
+ .c.o:
135
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
136
+
137
+ $(DLLIB): $(OBJS)
138
+ @-$(RM) $@
139
+ $(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
140
+
141
+
142
+
143
+ $(OBJS): ruby.h defines.h
@@ -40,14 +40,10 @@ VALUE wcstr_new(const wchar_t *w_str, const char_size_t len) {
40
40
  size = (int)(len)*sizeof(wchar_t);
41
41
  capa = (int)(len + 1)*sizeof(wchar_t);
42
42
 
43
- result = rb_str_new(0, 0);
43
+ result = rb_str_buf_new(capa);
44
+ bzero(STR(result) + size, capa-size);
45
+ rb_str_buf_cat(result, (char *)w_str, size);
44
46
 
45
- RSTRING(result)->len = size;
46
- RSTRING(result)->aux.capa = capa;
47
- RSTRING(result)->ptr = ALLOC_N(char, capa);
48
- bzero(RSTRING(result)->ptr, capa);
49
-
50
- memcpy(RSTRING(result)->ptr, (char *)w_str, size);
51
47
  rb_str_freeze(result);
52
48
  return result;
53
49
  }
Binary file
@@ -1,7 +1,6 @@
1
1
  #include "intersys.h"
2
2
 
3
3
  void intersys_base_free(struct rbDatabase* base) {
4
- // printf("Releasing database\n");
5
4
  RUN(cbind_free_db(base->database));
6
5
  RUN(cbind_free_conn(base->connection));
7
6
  free(base);
@@ -37,7 +36,9 @@ VALUE intersys_base_connect(VALUE self, VALUE options) {
37
36
  VALUE host, port, user, password, namespace, timeout;
38
37
 
39
38
  host = connect_get_options(options, "host", "localhost", 0);
40
- port = connect_get_options(options, "port", "1972", 0);
39
+ port = connect_get_options(options, "port", "1973", 0);
40
+ //port = connect_get_options(options, "port", "1972", 0);
41
+ //namespace = connect_get_options(options, "namespace", "User", 0);
41
42
  namespace = connect_get_options(options, "namespace", "Samples", 0);
42
43
 
43
44
  user = connect_get_options(options, "user", "_SYSTEM", 1);
Binary file
@@ -1,7 +1,6 @@
1
1
  #include "intersys.h"
2
2
 
3
3
  static void intersys_definition_free(struct rbDefinition* definition) {
4
- // printf("Releasing definition (%d)\n", definition->type);
5
4
  switch(definition->type) {
6
5
  case D_PROPERTY: {
7
6
  RUN(cbind_free_prop_def(definition->def));
@@ -98,7 +97,7 @@ VALUE intersys_property_get(VALUE self) {
98
97
  RUN(cbind_reset_args(property->database));
99
98
  RUN(cbind_set_next_arg_as_res(property->database, property->cpp_type));
100
99
  RUN(cbind_get_prop(property->database, property->oref, property->in_name));
101
- return rb_funcall(self, rb_intern("extract_retval!"), 0);
100
+ return intersys_method_extract_retval(self);
102
101
  }
103
102
 
104
103
  VALUE intersys_property_set(VALUE self, VALUE value) {
@@ -107,7 +106,7 @@ VALUE intersys_property_set(VALUE self, VALUE value) {
107
106
  Data_Get_Struct(self, struct rbDefinition, property);
108
107
 
109
108
  RUN(cbind_reset_args(property->database));
110
- rb_funcall(self, rb_intern("marshall!"), 1, value);
109
+ intersys_argument_set(self, value);
111
110
  RUN(cbind_set_prop(property->database, property->oref, property->in_name));
112
111
  return self;
113
112
  }
@@ -159,27 +158,6 @@ VALUE intersys_method_num_args(VALUE self) {
159
158
  return INT2FIX(method->num_args);
160
159
  }
161
160
 
162
- VALUE intersys_method_prepare_call(VALUE self) {
163
- struct rbDefinition* method;
164
-
165
- Data_Get_Struct(self, struct rbDefinition, method);
166
-
167
- RUN(cbind_reset_args(method->database));
168
- RUN(cbind_mtd_rewind_args(method->def));
169
- return self;
170
- }
171
-
172
- VALUE intersys_method_call(VALUE self) {
173
- struct rbDefinition* method;
174
-
175
- Data_Get_Struct(self, struct rbDefinition, method);
176
-
177
- if (method->cpp_type != CBIND_VOID) {
178
- RUN(cbind_set_next_arg_as_res(method->database, method->cpp_type));
179
- }
180
- RUN(cbind_run_method(method->database, method->oref, CLASS_NAME(method), method->in_name));
181
- return self;
182
- }
183
161
 
184
162
  static VALUE extract_next_dlist_elem(char *dlist, int* elem_size) {
185
163
  bool_t flag;
@@ -222,6 +200,71 @@ static VALUE extract_next_dlist_elem(char *dlist, int* elem_size) {
222
200
 
223
201
 
224
202
 
203
+
204
+ VALUE intersys_method_call(VALUE self, VALUE args) {
205
+ struct rbDefinition* method;
206
+ int i;
207
+ Check_Type(args, T_ARRAY);
208
+ Data_Get_Struct(self, struct rbDefinition, method);
209
+ if(method->num_args < RARRAY(args)->len) {
210
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", RARRAY(args)->len, method->num_args);
211
+ }
212
+ VALUE database = rb_iv_get(self, "@database");
213
+ VALUE class_name = rb_iv_get(self, "@class_name");
214
+ VALUE name = rb_iv_get(self, "@name");
215
+
216
+ RUN(cbind_reset_args(method->database));
217
+ RUN(cbind_mtd_rewind_args(method->def));
218
+
219
+ for(i = 0; i < RARRAY(args)->len; i++) {
220
+ VALUE arg = rb_funcall(cArgument, rb_intern("new"), 4, database, class_name, name, self);
221
+ intersys_argument_set(arg, RARRAY(args)->ptr[i]);
222
+ RUN(cbind_mtd_arg_next(method->def));
223
+ }
224
+ method->passed_args = RARRAY(args)->len;
225
+
226
+ if (method->cpp_type != CBIND_VOID) {
227
+ RUN(cbind_set_next_arg_as_res(method->database, method->cpp_type));
228
+ }
229
+ RUN(cbind_run_method(method->database, method->oref, CLASS_NAME(method), method->in_name));
230
+ return intersys_method_extract_retval(self);
231
+ }
232
+
233
+
234
+ VALUE intersys_argument_initialize(VALUE self, VALUE r_database, VALUE class_name, VALUE name, VALUE r_method) {
235
+ struct rbDefinition* argument;
236
+ struct rbDefinition* method;
237
+ VALUE args[] = {r_database, class_name, name};
238
+ rb_call_super(3, args);
239
+
240
+ Data_Get_Struct(self, struct rbDefinition, argument);
241
+ Data_Get_Struct(r_method, struct rbDefinition, method);
242
+
243
+
244
+ argument->type = D_ARGUMENT;
245
+ RUN(cbind_alloc_arg_def(&argument->def));
246
+ RUN(cbind_mtd_arg_get(method->def, argument->def));
247
+ RUN(cbind_get_arg_cpp_type(argument->def, &argument->cpp_type));
248
+ RUN(cbind_get_arg_cache_type(argument->def, &argument->cache_type));
249
+ RUN(cbind_get_arg_name(argument->def, &argument->name));
250
+ RUN(cbind_get_arg_is_by_ref(argument->def, &argument->is_by_ref));
251
+ RUN(cbind_get_arg_is_default(argument->def, &argument->is_default));
252
+ RUN(cbind_get_arg_def_val(argument->def, &argument->default_value));
253
+ RUN(cbind_get_arg_def_val_size(argument->def, &argument->default_value_size));
254
+ argument->arg_number = method->arg_counter;
255
+ method->arg_counter++;
256
+ return self;
257
+ }
258
+
259
+ VALUE intersys_argument_default_value(VALUE self) {
260
+ struct rbDefinition* argument;
261
+ Data_Get_Struct(self, struct rbDefinition, argument);
262
+ if(!argument->is_default) {
263
+ return Qnil;
264
+ }
265
+ return rb_str_new(argument->default_value, argument->default_value_size);
266
+ }
267
+
225
268
  VALUE intersys_method_extract_retval(VALUE self) {
226
269
  struct rbDefinition* method;
227
270
  bool_t is_null;
@@ -232,7 +275,7 @@ VALUE intersys_method_extract_retval(VALUE self) {
232
275
  }
233
276
 
234
277
 
235
- RUN(cbind_get_is_null(method->database, method->num_args, &is_null));
278
+ RUN(cbind_get_is_null(method->database, method->passed_args, &is_null));
236
279
  if(is_null) {
237
280
  return Qnil;
238
281
  }
@@ -250,7 +293,7 @@ VALUE intersys_method_extract_retval(VALUE self) {
250
293
  VALUE class_name_w, class_name;
251
294
  const wchar_t *cl_name = 0;
252
295
  struct rbObject* object;
253
- RUN(cbind_get_arg_as_obj(method->database, method->num_args, &oref, &cl_name, &len, &is_null));
296
+ RUN(cbind_get_arg_as_obj(method->database, method->passed_args, &oref, &cl_name, &len, &is_null));
254
297
  if(is_null) {
255
298
  printf("Loaded NULL object\n");
256
299
  return Qnil;
@@ -267,95 +310,95 @@ VALUE intersys_method_extract_retval(VALUE self) {
267
310
  case CBIND_TIME_ID:
268
311
  {
269
312
  int hour, minute, second;
270
- RUN(cbind_get_arg_as_time(method->database, method->num_args, &hour, &minute, &second, &is_null));
313
+ RUN(cbind_get_arg_as_time(method->database, method->passed_args, &hour, &minute, &second, &is_null));
271
314
  return Qnil;
272
315
  break;
273
316
  }
274
317
  case CBIND_DATE_ID:
275
318
  {
276
319
  int year, month,day;
277
- RUN(cbind_get_arg_as_date(method->database, method->num_args, &year, &month, &day, &is_null));
278
- return Qnil;
279
- break;
320
+ RUN(cbind_get_arg_as_date(method->database, method->passed_args, &year, &month, &day, &is_null));
321
+ if(is_null) {
322
+ return Qnil;
323
+ }
324
+ return rb_funcall(rb_cTime, rb_intern("local"), 3, INT2NUM(year), INT2NUM(month), INT2NUM(day))
280
325
  }
281
326
  case CBIND_TIMESTAMP_ID:
282
327
  {
283
328
  int year, month, day, hour, minute, second, fraction;
284
- RUN(cbind_get_arg_as_timestamp(method->database, method->num_args,
329
+ RUN(cbind_get_arg_as_timestamp(method->database, method->passed_args,
285
330
  &year, &month, &day, &hour, &minute, &second, &fraction, &is_null));
286
- return Qnil;
287
- break;
331
+ if(is_null) {
332
+ return Qnil;
333
+ }
334
+ //TODO: fraction also should be included
335
+ return rb_funcall(rb_cTime, rb_intern("local"), 6,
336
+ INT2NUM(year), INT2NUM(month), INT2NUM(day), INT2NUM(hour), INT2NUM(minute), INT2NUM(second));
288
337
  }
289
338
 
290
339
  case CBIND_INT_ID: {
291
340
  int val;
292
- RUN(cbind_get_arg_as_int(method->database, method->num_args, &val, &is_null));
341
+ RUN(cbind_get_arg_as_int(method->database, method->passed_args, &val, &is_null));
293
342
  return INT2FIX(val);
294
343
  }
295
344
 
296
345
  case CBIND_DOUBLE_ID: {
297
346
  double val;
298
- RUN(cbind_get_arg_as_double(method->database, method->num_args, &val, &is_null));
347
+ RUN(cbind_get_arg_as_double(method->database, method->passed_args, &val, &is_null));
299
348
  return rb_float_new(val);
300
349
  }
301
350
  case CBIND_CURRENCY_ID:
302
351
  {
303
352
  double val;
304
- RUN(cbind_get_arg_as_cy(method->database, method->num_args, &val, &is_null));
353
+ RUN(cbind_get_arg_as_cy(method->database, method->passed_args, &val, &is_null));
305
354
  return rb_float_new(val);
306
355
  }
307
356
 
308
357
  case CBIND_BINARY_ID: {
309
358
  byte_size_t size;
310
- char *buf;
311
- VALUE result = rb_str_new(0, 0);
359
+ VALUE result = Qnil;
312
360
 
313
- RUN(cbind_get_arg_as_bin(method->database, method->num_args, NULL, 0, &size, &is_null));
314
- buf = ALLOC_N(char, size + 1);
315
- RUN(cbind_get_arg_as_bin(method->database, method->num_args, buf, size, &size, &is_null));
316
-
317
- RSTRING(result)->ptr = buf;
318
- RSTRING(result)->len = size;
319
- RSTRING(result)->aux.capa = size;
361
+ RUN(cbind_get_arg_as_bin(method->database, method->passed_args, NULL, 0, &size, &is_null));
362
+ result = rb_str_buf_new((int)size);
363
+ RUN(cbind_get_arg_as_bin(method->database, method->passed_args, STR(result), size, &size, &is_null));
364
+ LEN(result) = size;
320
365
  return result;
321
366
  }
322
367
  case CBIND_STATUS_ID:{
323
368
  byte_size_t size;
324
- char *buf;
369
+ VALUE buf;
325
370
  int code;
326
371
 
327
- RUN(cbind_get_arg_as_status(method->database, method->num_args, &code, NULL, 0, MULTIBYTE, &size, &is_null));
328
- buf = ALLOC_N(char, size + 1);
329
- RUN(cbind_get_arg_as_status(method->database, method->num_args, &code, buf, size, MULTIBYTE, &size, &is_null));
330
-
331
- free(buf);
332
- return rb_funcall(cStatus, rb_intern("new"), 2, INT2NUM(code), FROMWCHAR(rb_str_new(buf, size)));
372
+ //TODO: if code is not OK, we should throw exception. No class Status is required
373
+ RUN(cbind_get_arg_as_status(method->database, method->passed_args, &code, NULL, 0, MULTIBYTE, &size, &is_null));
374
+ if(!code || is_null) {
375
+ return Qtrue;
376
+ }
377
+ buf = rb_str_buf_new(size);
378
+ RUN(cbind_get_arg_as_status(method->database, method->passed_args, &code, STR(buf), RSTRING(buf)->aux.capa, MULTIBYTE, &size, &is_null));
379
+ STR(buf)[size] = '\0';
380
+ rb_exc_raise(rb_funcall(cStatus, rb_intern("new"), 2, INT2FIX(code), buf));
381
+ return Qnil;
333
382
  }
334
383
 
335
384
  case CBIND_STRING_ID: {
336
385
  byte_size_t size;
337
- char *buf;
338
- VALUE result = rb_str_new(0, 0);
339
- VALUE res;
386
+ VALUE result = Qnil;
340
387
 
341
- RUN(cbind_get_arg_as_str(method->database, method->num_args, NULL, 0, CPP_UNICODE, &size, &is_null));
388
+ RUN(cbind_get_arg_as_str(method->database, method->passed_args, NULL, 0, CPP_UNICODE, &size, &is_null));
342
389
  //It is important to add wchar_t to end, because for wcslen we need more than 1 terminating zero.
343
390
  //I don't know exactly, how works wcslen, but I add 4 (sizeof wchar_t) terminating zeroes
344
- buf = ALLOC_N(char, size + sizeof(wchar_t));
345
- bzero(buf, size + sizeof(wchar_t));
346
- RUN(cbind_get_arg_as_str(method->database, method->num_args, buf, size, CPP_UNICODE, &size, &is_null));
347
-
348
- RSTRING(result)->ptr = buf;
349
- RSTRING(result)->len = size;
350
- RSTRING(result)->aux.capa = size;
351
- res = rb_funcall(result, rb_intern("from_wchar"), 0);
352
- return res;
391
+ result = rb_str_buf_new(size + sizeof(wchar_t));
392
+ bzero(STR(result) + size, sizeof(wchar_t));
393
+ RUN(cbind_get_arg_as_str(method->database, method->passed_args, STR(result), size, CPP_UNICODE, &size, &is_null));
394
+ LEN(result) = size;
395
+ return FROMWCHAR(result);
353
396
  }
354
397
 
355
398
  case CBIND_BOOL_ID:
356
399
  {
357
400
  bool_t val;
358
- RUN(cbind_get_arg_as_bool(method->database, method->num_args, &val, &is_null));
401
+ RUN(cbind_get_arg_as_bool(method->database, method->passed_args, &val, &is_null));
359
402
  if(val) {
360
403
  return Qtrue;
361
404
  }
@@ -364,26 +407,26 @@ VALUE intersys_method_extract_retval(VALUE self) {
364
407
 
365
408
  case CBIND_DLIST_ID:
366
409
  {
367
- char *buf;
410
+ VALUE buf = Qnil;
368
411
  char *p;
369
412
  byte_size_t size;
370
413
  int num_elems;
371
414
  int i;
372
415
  VALUE list;
373
416
 
374
- RUN(cbind_get_arg_as_dlist(method->database, method->num_args, NULL, 0, &size, &is_null));
375
- buf = ALLOC_N(char, size);
376
- RUN(cbind_get_arg_as_dlist(method->database, method->num_args, buf, size, &size, &is_null));
417
+ RUN(cbind_get_arg_as_dlist(method->database, method->passed_args, NULL, 0, &size, &is_null));
418
+ buf = rb_str_buf_new(size);
419
+ RUN(cbind_get_arg_as_dlist(method->database, method->passed_args, STR(buf), size, &size, &is_null));
420
+ LEN(buf) = size;
377
421
 
378
- RUN(cbind_dlist_calc_num_elems(buf, size, &num_elems));
422
+ RUN(cbind_dlist_calc_num_elems(STR(buf), LEN(buf), &num_elems));
379
423
  list = rb_ary_new2(num_elems);
380
- p = buf;
424
+ p = STR(buf);
381
425
  for (i=0; i < num_elems; i++) {
382
426
  int elem_size;
383
427
  rb_ary_push(list, extract_next_dlist_elem(p, &elem_size));
384
428
  p += elem_size;
385
429
  }
386
- free(buf);
387
430
  return list;
388
431
  }
389
432
 
@@ -392,41 +435,6 @@ VALUE intersys_method_extract_retval(VALUE self) {
392
435
  }
393
436
 
394
437
 
395
- VALUE intersys_argument_initialize(VALUE self, VALUE r_database, VALUE class_name, VALUE name, VALUE r_method) {
396
- struct rbDefinition* argument;
397
- struct rbDefinition* method;
398
- VALUE args[] = {r_database, class_name, name};
399
- rb_call_super(3, args);
400
-
401
- Data_Get_Struct(self, struct rbDefinition, argument);
402
- Data_Get_Struct(r_method, struct rbDefinition, method);
403
-
404
-
405
- argument->type = D_ARGUMENT;
406
- RUN(cbind_alloc_arg_def(&argument->def));
407
- RUN(cbind_mtd_arg_get(method->def, argument->def));
408
- RUN(cbind_get_arg_cpp_type(argument->def, &argument->cpp_type));
409
- RUN(cbind_get_arg_cache_type(argument->def, &argument->cache_type));
410
- RUN(cbind_get_arg_name(argument->def, &argument->name));
411
- RUN(cbind_get_arg_is_by_ref(argument->def, &argument->is_by_ref));
412
- RUN(cbind_get_arg_is_default(argument->def, &argument->is_default));
413
- RUN(cbind_get_arg_def_val(argument->def, &argument->default_value));
414
- RUN(cbind_get_arg_def_val_size(argument->def, &argument->default_value_size));
415
- RUN(cbind_mtd_arg_next(method->def));
416
- argument->arg_number = method->arg_counter;
417
- method->arg_counter++;
418
- return self;
419
- }
420
-
421
- VALUE intersys_argument_default_value(VALUE self) {
422
- struct rbDefinition* argument;
423
- Data_Get_Struct(self, struct rbDefinition, argument);
424
- if(!argument->is_default) {
425
- return Qnil;
426
- }
427
- return rb_str_new(argument->default_value, argument->default_value_size);
428
- }
429
-
430
438
  VALUE intersys_argument_marshall_dlist_elem(VALUE self, VALUE elem) {
431
439
  struct rbDefinition* argument;
432
440
  Data_Get_Struct(self, struct rbDefinition, argument);
@@ -467,7 +475,7 @@ VALUE intersys_argument_set(VALUE self, VALUE obj) {
467
475
 
468
476
  if(obj == Qnil) {
469
477
  RUN(cbind_set_next_arg_as_null(property->database, property->cpp_type, property->is_by_ref));
470
- return obj;
478
+ return self;
471
479
  }
472
480
  switch (property->cpp_type) {
473
481
  case CBIND_VOID:
@@ -507,7 +515,7 @@ VALUE intersys_argument_set(VALUE self, VALUE obj) {
507
515
  }
508
516
  case CBIND_STRING_ID:
509
517
  {
510
- VALUE res = (rb_funcall(obj, rb_intern("to_s"), 0));
518
+ VALUE res = rb_funcall(obj, rb_intern("to_s"), 0);
511
519
  RUN(cbind_set_next_arg_as_str(property->database, STR(res), LEN(res), MULTIBYTE, property->is_by_ref));
512
520
  break;
513
521
  }
@@ -568,8 +576,8 @@ VALUE intersys_argument_set(VALUE self, VALUE obj) {
568
576
  default:
569
577
  rb_raise(rb_eStandardError,"unknown type for argument, type = %d",
570
578
  property->cpp_type, CLASS_NAME(property));
571
- return Qnil;
579
+ return self;
572
580
  }
573
- return obj;
581
+ return self;
574
582
 
575
583
  }