Skip to content

Commit

Permalink
Load plruby-0.2.9 into trunk.
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/knu/repos/ts/plruby/trunk@24 1f148aff-833f-de11-9cfd-0015170b777a
  • Loading branch information
ts committed Dec 28, 2002
1 parent 67b1927 commit 4c31f38
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
5 changes: 4 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@

adapted for 7.3b3


--- 0.2.9

adapted for 1.8.0
corrected stupid bug with GC
10 changes: 9 additions & 1 deletion extconf.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/usr/bin/ruby
require 'mkmf'

stat_lib = if CONFIG.key?("LIBRUBYARG_STATIC")
$LDFLAGS += " -L#{CONFIG['libdir']}"
CONFIG["LIBRUBYARG_STATIC"]
else
"-lruby"
end.sub(/^-l/, '')

src_dir = ""
if srcdir = with_config("pgsql-srcinc-dir")
$CFLAGS = "-I#{srcdir}"
Expand Down Expand Up @@ -31,7 +39,7 @@
if ! have_library("pq", "PQsetdbLogin")
raise "libpq is missing"
end
$libs = append_library($libs, "ruby")
$libs = append_library($libs, stat_lib)
if ! version = with_config("pgsql-version")
for version_in in [
"#{include_dir}/config.h",
Expand Down
21 changes: 10 additions & 11 deletions plruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,26 +188,24 @@ static VALUE
plruby_protect(args)
VALUE *args;
{
Datum *retval;
VALUE res;
Datum retval;

if (sigsetjmp(Warn_restart, 1) != 0)
return pg_eCatch;
res = Data_Make_Struct(rb_cObject, Datum, 0, free, retval);
#ifdef NEW_STYLE_FUNCTION
if (CALLED_AS_TRIGGER((FunctionCallInfo)args))
*retval = PointerGetDatum(plruby_trigger_handler((FunctionCallInfo)args));
retval = PointerGetDatum(plruby_trigger_handler((FunctionCallInfo)args));
else
*retval = plruby_func_handler((FunctionCallInfo)args);
retval = plruby_func_handler((FunctionCallInfo)args);
#else
if (CurrentTriggerData == NULL)
*retval = plruby_func_handler((FmgrInfo *)args[0],
retval = plruby_func_handler((FmgrInfo *)args[0],
(FmgrValues *)args[1],
(bool *)args[2]);
else
*retval = (Datum) plruby_trigger_handler((FmgrInfo *)args[0]);
retval = (Datum) plruby_trigger_handler((FmgrInfo *)args[0]);
#endif
return res;
return Data_Wrap_Struct(rb_cObject, 0, 0, (void *)retval);
}

Datum
Expand All @@ -221,7 +219,7 @@ plruby_call_handler(FmgrInfo *proinfo,
{
VALUE *args, c;
sigjmp_buf save_restart;
Datum *result;
Datum result;
int state;

if (plruby_firstcall)
Expand Down Expand Up @@ -268,8 +266,9 @@ plruby_call_handler(FmgrInfo *proinfo,
else
rb_raise(pg_ePLruby, "%.*s", RSTRING(d)->len, RSTRING(d)->ptr);
}
Data_Get_Struct(c, Datum, result);
return *result;
Check_Type(c, T_DATA);
result = (Datum)DATA_PTR(c);
return result;
}

static Datum
Expand Down
2 changes: 1 addition & 1 deletion test/plp/b.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rbconfig'
include Config
pwd = Dir.pwd
pwd.sub!("[^/]+/[^/]+$", "")
pwd.sub!(%r{[^/]+/[^/]+$}, "")
language, extension = 'C', '_new'
opaque = 'opaque'
case ARGV[0].to_i
Expand Down
2 changes: 1 addition & 1 deletion test/plt/b.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rbconfig'
include Config
pwd = Dir.pwd
pwd.sub!("[^/]+/[^/]+$", "")
pwd.sub!(%r{[^/]+/[^/]+$}, "")
language, extension, procedural = 'C', '_old', 'procedural'
opaque = 'opaque'
case ARGV[0].to_i
Expand Down

0 comments on commit 4c31f38

Please sign in to comment.