[Namazu-cvs 757] r245 - Search-Namazu/trunk/Search-Namazu

cvsd @ vaj.namazu.org cvsd @ vaj.namazu.org
2006年 3月 28日 (火) 17:55:37 JST


Author: knok
Date: 2006-03-28 17:55:36 +0900 (Tue, 28 Mar 2006)
New Revision: 245

Modified:
   Search-Namazu/trunk/Search-Namazu/ChangeLog
   Search-Namazu/trunk/Search-Namazu/Namazu.xs
Log:
Added Search::Namazu::ResultXS, pure C result class.


Modified: Search-Namazu/trunk/Search-Namazu/ChangeLog
===================================================================
--- Search-Namazu/trunk/Search-Namazu/ChangeLog	2006-03-28 04:48:18 UTC (rev 244)
+++ Search-Namazu/trunk/Search-Namazu/ChangeLog	2006-03-28 08:55:36 UTC (rev 245)
@@ -1,6 +1,7 @@
 2006-03-28  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 
 	* Namazu.{xs,pm}: Added maxget parameter.
+	  Added a new class: Search::Namazu::ResultXS.
 
 2006-03-27  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 

Modified: Search-Namazu/trunk/Search-Namazu/Namazu.xs
===================================================================
--- Search-Namazu/trunk/Search-Namazu/Namazu.xs	2006-03-28 04:48:18 UTC (rev 244)
+++ Search-Namazu/trunk/Search-Namazu/Namazu.xs	2006-03-28 08:55:36 UTC (rev 245)
@@ -2,7 +2,7 @@
 
 Namazu.xs
 
-# Copyright (C) 1999,2000,2001,2002 NOKUBI Takatsugu All rights reserved.
+# Copyright (C) 1999-2006 NOKUBI Takatsugu All rights reserved.
 # This is free software with ABSOLUTELY NO WARRANTY.
 # 
 # This program is free software; you can redistribute it and/or modify
@@ -220,3 +220,51 @@
 		RETVAL = status;
 	OUTPUT:
 		RETVAL
+
+
+MODULE = Search::Namazu	PACKAGE = Search::Namazu::ResultXS	PREFIX = res_
+
+SV *
+res_new()
+	CODE:
+		HV *self;
+		HV *stash;
+		SV *ref;
+
+		stash = gv_stashpv("Search::Namazu::ResultXS", 0);
+		self = newHV();
+		ref = newRV_inc((SV*) self);
+		sv_bless(ref, stash);
+		RETVAL = ref;
+	OUTPUT:
+		RETVAL
+
+void
+res_set(self, key, val)
+	      SV *self
+	      SV *key
+	      SV *val
+	CODE:
+		HV *hash;
+
+		hash = (HV *) SvRV(self);
+		hv_store(hash, SvPV_nolen(key), SvCUR(key), val, 0);
+
+SV *
+res_get(self, key)
+	      SV *self
+	      SV *key
+	CODE:
+		HV *hash;
+		SV **ret;
+
+		hash = (HV *) SvRV(self);
+		ret = hv_fetch(hash, SvPV_nolen(key), SvCUR(key), 0);
+		if (ret == NULL) {
+			RETVAL = &PL_sv_undef;
+		} else {
+			RETVAL = SvREFCNT_inc(*ret);
+		}
+	OUTPUT:
+		RETVAL
+




Namazu-cvs メーリングリストの案内