[Avida-SVN] r2858 - in development: Avida.xcodeproj source/script source/tools

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Tue Oct 21 08:23:07 PDT 2008


Author: brysonda
Date: 2008-10-21 11:23:07 -0400 (Tue, 21 Oct 2008)
New Revision: 2858

Added:
   development/source/script/ASAvidaNativeObjects.h
Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/script/ASAnalyzeLib.cc
   development/source/script/ASAvidaLib.cc
   development/source/tools/tDataManager.h
Log:
AS: Reorganize native object type declarations for reuse across aslibs.

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2008-10-20 23:45:24 UTC (rev 2857)
+++ development/Avida.xcodeproj/project.pbxproj	2008-10-21 15:23:07 UTC (rev 2858)
@@ -420,6 +420,7 @@
 		702F52DF0992FD8000B2B507 /* cScriptObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cScriptObject.cc; sourceTree = "<group>"; };
 		70381F7F0EAD0BD000A97DFD /* ASAnalyzeLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASAnalyzeLib.h; sourceTree = "<group>"; };
 		70381F800EAD0BD000A97DFD /* ASAnalyzeLib.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ASAnalyzeLib.cc; sourceTree = "<group>"; };
+		70381FDB0EAE2A2A00A97DFD /* ASAvidaNativeObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASAvidaNativeObjects.h; sourceTree = "<group>"; };
 		703D4D6D0ABA374A0032C8A0 /* cArgSchema.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cArgSchema.cc; sourceTree = "<group>"; };
 		70422A1C091B141000A5E67F /* cAnalyze.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cAnalyze.cc; sourceTree = "<group>"; };
 		70422A1D091B141000A5E67F /* cAnalyze.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cAnalyze.h; sourceTree = "<group>"; };
@@ -1267,6 +1268,7 @@
 				7048A9A40EA431140087B7BD /* cASCPPParameter_NativeObjectSupport.h */,
 				70381F7F0EAD0BD000A97DFD /* ASAnalyzeLib.h */,
 				70381F800EAD0BD000A97DFD /* ASAnalyzeLib.cc */,
+				70381FDB0EAE2A2A00A97DFD /* ASAvidaNativeObjects.h */,
 			);
 			path = script;
 			sourceTree = "<group>";

Modified: development/source/script/ASAnalyzeLib.cc
===================================================================
--- development/source/script/ASAnalyzeLib.cc	2008-10-20 23:45:24 UTC (rev 2857)
+++ development/source/script/ASAnalyzeLib.cc	2008-10-21 15:23:07 UTC (rev 2858)
@@ -24,6 +24,8 @@
 
 #include "ASAnalyzeLib.h"
 
+#include "ASAvidaNativeObjects.h"
+
 #include "cASCPPParameter_NativeObjectSupport.h"
 #include "cASFunction.h"
 #include "cASLibrary.h"
@@ -95,7 +97,9 @@
   
 
   BIND_FUNCTION(cWorld, "LoadOrganism", LoadOrganism, cAnalyzeGenotype* (const cString&));
-  BIND_FUNCTION(cWorld, "LoadOrgnaismWithInstSet", LoadOrganismWithInstSet, cAnalyzeGenotype* (const cString&, cInstSet*));
+  BIND_FUNCTION(cWorld, "LoadOrganismWithInstSet", LoadOrganismWithInstSet, cAnalyzeGenotype* (const cString&, cInstSet*));
+  BIND_FUNCTION(cWorld, "LoadSequence", LoadSequence, cAnalyzeGenotype* (const cString&));
+  BIND_FUNCTION(cWorld, "LoadSequenceWithInstSet", LoadSequenceWithInstSet, cAnalyzeGenotype* (const cString&, cInstSet*));
 
 
 #undef BIND_FUNCTION

Modified: development/source/script/ASAvidaLib.cc
===================================================================
--- development/source/script/ASAvidaLib.cc	2008-10-20 23:45:24 UTC (rev 2857)
+++ development/source/script/ASAvidaLib.cc	2008-10-21 15:23:07 UTC (rev 2858)
@@ -24,6 +24,8 @@
 
 #include "ASAvidaLib.h"
 
+#include "ASAvidaNativeObjects.h"
+
 #include "cASCPPParameter_NativeObjectSupport.h"
 #include "cASLibrary.h"
 
@@ -33,17 +35,7 @@
 
 #include <cstring>
 
-#define AS_DECLARE_NATIVE_OBJECT(CLASS, NAME) \
- namespace AvidaScript { template<> inline sASTypeInfo TypeOf<CLASS*>() { return sASTypeInfo(AS_TYPE_OBJECT_REF, #NAME); } }
 
-
-AS_DECLARE_NATIVE_OBJECT(cAvidaConfig,       Config);
-AS_DECLARE_NATIVE_OBJECT(cDefaultRunDriver,  Driver);
-AS_DECLARE_NATIVE_OBJECT(cWorld,             World);
-
-#undef AS_DECLARE_NATIVE_OBJECT
-
-
 static void setupNativeObjects()
 {
 #define REGISTER_S_METHOD(CLASS, NAME, METHOD, SIGNATURE) \

Added: development/source/script/ASAvidaNativeObjects.h
===================================================================
--- development/source/script/ASAvidaNativeObjects.h	                        (rev 0)
+++ development/source/script/ASAvidaNativeObjects.h	2008-10-21 15:23:07 UTC (rev 2858)
@@ -0,0 +1,41 @@
+/*
+ *  ASAvidaNativeObjects.h
+ *  Avida
+ *
+ *  Created by David Bryson on 10/21/08.
+ *  Copyright 2008 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#ifndef ASAvidaNativeObjects_h
+#define ASAvidaNativeObjects_h
+
+#include "AvidaScript.h"
+
+#define AS_DECLARE_NATIVE_OBJECT(NAME, CLASS) \
+  class CLASS; \
+  namespace AvidaScript { template<> inline sASTypeInfo TypeOf<CLASS*>() { return sASTypeInfo(AS_TYPE_OBJECT_REF, NAME); } }
+
+AS_DECLARE_NATIVE_OBJECT("Config",    cAvidaConfig);
+AS_DECLARE_NATIVE_OBJECT("Driver",    cDefaultRunDriver);
+AS_DECLARE_NATIVE_OBJECT("Genotype",  cAnalyzeGenotype);
+AS_DECLARE_NATIVE_OBJECT("World",     cWorld);
+
+#undef AS_DECLARE_NATIVE_OBJECT
+
+#endif

Modified: development/source/tools/tDataManager.h
===================================================================
--- development/source/tools/tDataManager.h	2008-10-20 23:45:24 UTC (rev 2857)
+++ development/source/tools/tDataManager.h	2008-10-21 15:23:07 UTC (rev 2858)
@@ -55,14 +55,11 @@
     : cDataManager_Base(in_filetype), target(_target) { ; }
   ~tDataManager() { ; }
 
-  template<class OUT> bool Add(const cString & name,  const cString & desc,
-			       OUT (T::*_funR)() const,
-			       void (T::*_funS)(OUT _val) = NULL,
-			       int compare = 0,
-			       const cString & null="0",
-			       const cString & html_cell="align=center") {
-    tDataEntryBase<T> * new_entry =
-     new tDataEntry<T, OUT> (name, desc, _funR, _funS, compare, null, html_cell);
+  template<class OUT> bool Add(const cString& name,  const cString& desc,
+                               OUT (T::*_funR)() const, void (T::*_funS)(OUT _val) = NULL,
+                               int compare = 0, const cString& null="0", const cString& html_cell="align=center")
+  {
+    tDataEntryBase<T>* new_entry = new tDataEntry<T, OUT> (name, desc, _funR, _funS, compare, null, html_cell);
     new_entry->SetTarget(target);
     entry_dict.Add(name, new_entry);
     return true;




More information about the Avida-cvs mailing list