You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by lo...@apache.org on 2012/01/06 23:52:52 UTC
[lucy-commits] svn commit: r1228482 - in
/incubator/lucy/trunk/clownfish/ruby/ext/Clownfish: CFC.c CFC/ extconf.rb
Author: logie
Date: Fri Jan 6 22:52:51 2012
New Revision: 1228482
URL: http://svn.apache.org/viewvc?rev=1228482&view=rev
Log:
LUCY-202
1. Merged Clownfish/CFC/Hierarchy.c down to Clownfish/CFC.c
2. Namespaced correctly ie: Clownfish::CFC::Hierarchy.new
3. Corrected various variable names to match conventions from the perl side.
4. Updated extconf.rb to create Makefile.
Added:
incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/extconf.rb
Removed:
incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/CFC/
Modified:
incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/CFC.c
Modified: incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/CFC.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/CFC.c?rev=1228482&r1=1228481&r2=1228482&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/CFC.c (original)
+++ incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/CFC.c Fri Jan 6 22:52:51 2012
@@ -17,3 +17,45 @@
#include "ruby.h"
#include "CFC.h"
+VALUE mClownfish;
+VALUE mCFC;
+VALUE cHierarchy;
+
+static VALUE cfc_hierarchy_alloc(VALUE klass) {
+ CFCHierarchy *self = CFCHierarchy_allocate();
+
+ VALUE self_rb = Data_Wrap_Struct(klass, 0, CFCHierarchy_destroy, self);
+
+ return self_rb;
+}
+
+static VALUE cfc_hierarchy_init(VALUE self_rb, VALUE source, VALUE dest) {
+
+ char *s = StringValuePtr(source);
+ char *d = StringValuePtr(dest);
+ CFCHierarchy *self;
+
+ Data_Get_Struct(self_rb, CFCHierarchy, self);
+ CFCHierarchy_init(self, s, d);
+
+ return self_rb;
+}
+
+static VALUE cfc_hierarchy_build(VALUE self_rb) {
+ CFCHierarchy *self;
+
+ Data_Get_Struct(self_rb, CFCHierarchy, self);
+ CFCHierarchy_build(self);
+}
+
+void Init_CFC() {
+ mClownfish = rb_define_module("Clownfish");
+ mCFC = rb_define_module_under(mClownfish, "CFC");
+ cHierarchy = rb_define_class_under(mCFC, "Hierarchy", rb_cObject);
+
+ rb_define_alloc_func(cHierarchy, cfc_hierarchy_alloc);
+
+ rb_define_method(cHierarchy, "initialize", cfc_hierarchy_init, 2);
+ rb_define_method(cHierarchy, "build", cfc_hierarchy_build, 0);
+}
+
Added: incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/extconf.rb
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/extconf.rb?rev=1228482&view=auto
==============================================================================
--- incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/extconf.rb (added)
+++ incubator/lucy/trunk/clownfish/ruby/ext/Clownfish/extconf.rb Fri Jan 6 22:52:51 2012
@@ -0,0 +1,9 @@
+require 'mkmf'
+CLOWNFISH_INCLUDE_DIR = File.join('..','..','..','include')
+CLOWNFISH_SRC_DIR = File.join('..','..','..','src')
+$CFLAGS = "-I#{CLOWNFISH_INCLUDE_DIR} -I#{CLOWNFISH_SRC_DIR}"
+$objs = ['CFC.o']
+Dir.glob("#{CLOWNFISH_SRC_DIR}/*.o").each do|o|
+ $objs.push o
+end
+create_makefile 'CFC'