[cig-commits] commit: fixing up Variable.c .h and , meta with minor errors. also Variable_register

Mercurial hg at geodynamics.org
Mon Feb 1 15:32:25 PST 2010


changeset:   711:d333bb86ec96
branch:      pcu_rejig
parent:      701:476ea49b3bc7
user:        KathleenHumble
date:        Fri Dec 04 17:46:16 2009 +1100
files:       Base/Context/src/Variable.c Base/Context/src/Variable.h Base/Context/src/Variable.meta Base/Context/src/Variable_Register.h script/createCodex.py script/headerfilter.py
description:
fixing up Variable.c .h and ,meta with minor errors. also Variable_register
getting header.filter working with variable.c and .h so that it is
working correctly too.
adding in createCodex.py as an easy one-off


diff -r 476ea49b3bc7 -r d333bb86ec96 Base/Context/src/Variable.c
--- a/Base/Context/src/Variable.c	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/src/Variable.c	Fri Dec 04 17:46:16 2009 +1100
@@ -1143,9 +1143,9 @@ void Variable_ReadFromFileAsDoubles( voi
 }
 
 
-/** Returns || variable - comparison || / || variable ||, 
-  * where ||x|| indicates the Euclidean Norm which is the square root of the sum of the squares for each component in x
-  * i.e.  ||x|| = \sqrt{\sum_i x_i^2}*/
+/** Returns \f$ \frac{|| variable - comparison ||} { || variable ||} \f$, 
+  * where \f$ ||x|| \f$ indicates the Euclidean Norm which is the square root of the sum of the squares for each component in x
+  * i.e.  \f$ ||x|| = \sqrt{\sum_i x_i^2} \f$ */
 double Variable_ValueCompare( void* variable, void* _comparison ) {
 	Variable* self            = (Variable*)  variable;
 	Variable* comparison      = (Variable*) _comparison;
diff -r 476ea49b3bc7 -r d333bb86ec96 Base/Context/src/Variable.h
--- a/Base/Context/src/Variable.h	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/src/Variable.h	Fri Dec 04 17:46:16 2009 +1100
@@ -46,8 +46,8 @@
 **
 **/
 
-#ifndef __Base_Automation_Variable_h__
-#define __Base_Automation_Variable_h__
+#ifndef __Base_Context_Variable_h__
+#define __Base_Context_Variable_h__
 	
 	/** Textual name for Variable class. */
 	extern const Type Variable_Type;
@@ -66,6 +66,7 @@
 	typedef Index (Variable_ArraySizeFunc) ( void* self );
 
 	/* See Variable */
+
 	#define __Variable \
 		/* General info */ 					\
 		__Stg_Component						\
@@ -1214,5 +1215,5 @@
 	/** Checks whether || variable - comparison || / || variable || < tolerance */
 	Bool Variable_ValueCompareWithinTolerance( void* variable, void* comparison, double tolerance );
 
-#endif /* __Base_Automation_Variable__ */
+#endif /* __Base_Context_Variable__ */
 
diff -r 476ea49b3bc7 -r d333bb86ec96 Base/Context/src/Variable.meta
--- a/Base/Context/src/Variable.meta	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/src/Variable.meta	Fri Dec 04 17:46:16 2009 +1100
@@ -6,7 +6,7 @@
 <param name="Author">Steve Quenette</param>
 <param name="Organisation">VPAC</param>
 <param name="Project">StGermain</param>
-<param name="Location">./StGermain/Base/Automation/src/</param>
+<param name="Location">./StGermain/Base/Context/src/</param>
 <param name="Project Web">http://www.stgermainproject.org/</param>
 <param name="Copyright">StGermain Framework. Copyright (C) 2003-2005 VPAC.</param>
 <param name="License">The Gnu Lesser General Public License v2.1 - http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html</param>
diff -r 476ea49b3bc7 -r d333bb86ec96 Base/Context/src/Variable_Register.h
--- a/Base/Context/src/Variable_Register.h	Tue Dec 01 12:42:04 2009 +1100
+++ b/Base/Context/src/Variable_Register.h	Fri Dec 04 17:46:16 2009 +1100
@@ -42,8 +42,8 @@
 **
 **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
-#ifndef __Base_Automation_Variable_Register_h__
-#define __Base_Automation_Variable_Register_h__
+#ifndef __Base_Context_Variable_Register_h__
+#define __Base_Context_Variable_Register_h__
 	
 	
 	extern const Type Variable_Register_Type;
@@ -128,5 +128,5 @@
 
 	Variable*	Variable_Register_GetByIndex( void* variable_Register, Variable_Index varIndex);	
 	
-#endif /* __Base_Automation_Variable_Register_h__ */
+#endif /* __Base_Context_Variable_Register_h__ */
 
diff -r 476ea49b3bc7 -r d333bb86ec96 script/createCodex.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/script/createCodex.py	Fri Dec 04 17:46:16 2009 +1100
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+## This is a codelet to run just the codex with standard defaults from anywhere in the code.
+import createDocs
+import createHTMLDocuments, createDocument
+import sys, os.path, os, string, subprocess, shutil
+from createDocument import createDocuments
+from createDocs import createListDictionary
+from createDocs import createCodex
+
+## Function for specific help statement for running Doxygen ONLY
+def printHelpStatement(dictionary):
+
+         print "Help for createDoxygen.py. This file is designed to be standalone."
+         print "To run, type ./createCodex.py \n"
+         print "To run with input options: "
+         print "./createCodex.py  METATYPE WEBPAGES EMAIL CODEXINPUTDIR CODEXOUTPUTDIR \n"
+         print "Defaults:"
+         print "METATYPE: 'dtd' or 'xsd'"
+         print "WEBPAGES: [['http://www.underworldproject.org','Underworld Home Page']]"
+         print "EMAIL: 'underworld-users at vpac.org'\n"
+         print "CODEXINPUTDIR: Name of base directory.  Default: '../../', Current: "+ dictionary['directoryPath']
+         print "CODEXOUTPUTDIR: Name of directory to which Codex will output it's files. Default: '../../doc/', Current: "+ dictionary['docPath']
+         print "DOCDATAPATH: Name of path to StGermain/doc/ directory, which has necessary files for the Codex to run. Default: "+dictionary['directoryPath']+"/StGermain/doc/', Current: "+ dictionary['docDataPath']
+         print "*******WARNING********"
+         print "This codex file ONLY works with Stg base directory. "
+         print " To only create codex for smaller samples, use createHTMLDocuments.py"
+         print "**********************" 
+         print "*******WARNING********"
+         print "ALL data in "+dictionary['docPath']+ " will be overwritten or removed!"
+         print "**********************" 
+         print "Other defaults: (Not all necessary) \n"
+         print dictionary.items()
+
+if __name__=='__main__':
+    values = sys.argv
+    for i in range(7):
+        if len(values)< 7:
+            values.append("")
+    
+
+    
+    #Define input directory (relative to ~/stgUnderworldE/ )
+    if values[4] != "" :
+        directoryPath = os.path.realpath(values[4])
+    else:
+        directoryPath = os.path.realpath('../../')
+    print directoryPath
+
+    # Create the output directory. This is relative to the ./mainProj/config page.(relative to ~/stgUnderworldE/ )
+    if values[5] != "":
+        docPath = os.path.realpath(values[5])
+    else:
+        docPath = os.path.join(directoryPath, 'doc/')
+    print docPath
+
+    # createDictionary
+    mainDictionary = createListDictionary(values[1],values[2], values[3], "", directoryPath, docPath, values[6])
+
+    # Set up help print statement
+    if ((mainDictionary['arg1'] == "help") or (mainDictionary['arg1'] == '-h') or (mainDictionary['arg1'] =='--help') or (mainDictionary['arg1'] == 'h')):
+        printHelpStatement(mainDictionary)
+
+    else:
+        #check the directory now exists.
+        createDocument.checkOutputPath(docPath)
+
+        createCodex(mainDictionary)
+
diff -r 476ea49b3bc7 -r d333bb86ec96 script/headerfilter.py
--- a/script/headerfilter.py	Tue Dec 01 12:42:04 2009 +1100
+++ b/script/headerfilter.py	Fri Dec 04 17:46:16 2009 +1100
@@ -36,6 +36,7 @@ class Input():
         self.metaFilename = nameList[0] + ".meta"
         if os.path.isfile(self.metaFilename):
             return True
+
         else:
             return False
 
@@ -159,19 +160,25 @@ class Input():
         stringStart = -1
         stringEnd = -1
         lineCount = 0
+        functionNames = []
+        parentNames = []
+        functionLineCount = []
+        functionCounter = 0
         for line in text:
 			# find the function Name of the macro:
 			# Find line that starts with: "#define __" and ends with " \"
 			stringStart = (str(line)).find("#define __" )
-                        
+                        functionName = ""
+                        parentName = ""
+
 			if stringStart >= 0:
-                                
+
 				stringEnd =(str(line)).find("\\")
 				if stringEnd >=0:
-                                        
-					self.lines = [lineCount]
-					self.functionName = ((line[stringStart+10: stringEnd]).lstrip()).rstrip()
-                                        
+
+
+					functionName = ((line[stringStart+10: stringEnd]).lstrip()).rstrip()
+
 					stringNextStart = -1
 					stringNextEnd = -1
 					stringTemp = ""
@@ -180,48 +187,94 @@ class Input():
 					for i in range(1,15):
 					    if (lineCount + i) < (len(text)-1):
 					        stringNextStart = (str(text[lineCount +i])).find("__")
+
+
+
+
 					    else:
 					        stringNextStart = (str(text[len(text)-1])).find("__")
+
                                                 
 					    if stringNextStart >=0:
 
                                                 if (lineCount + i) < (len(text)-1): 
 						    stringNextEnd =(str(text[lineCount+i])).find("\\")
+
                                                 else:
                                                     stringNextEnd = (str(text[len(text)-1])).find("\\")
+
+
 						if stringNextEnd >= 0:
                                                     if (lineCount + i) < (len(text)-1):
-							self.parentName = ((text[lineCount +i][stringNextStart + 2:stringNextEnd]).lstrip()).rstrip()
+							parentName = ((text[lineCount +i][stringNextStart + 2:stringNextEnd]).lstrip()).rstrip()
+
+                                                        functionNames.append(functionName)
+                                                        parentNames.append(parentName)
+                          	                        functionLineCount.append(lineCount)
+                                                        functionCounter = functionCounter+1
                                                     else:
-                                                        self.parentName = ((text[len(text)-1][stringNextStart + 2:stringNextEnd]).lstrip()).rstrip()
+                                                        parentName = ((text[len(text)-1][stringNextStart + 2:stringNextEnd]).lstrip()).rstrip()
+
+                                                        functionNames.append(functionName)
+                                                        parentNames.append(parentName)
+					                functionLineCount.append(lineCount)
+                                                        functionCounter = functionCounter+1
 
 					    stringNextStart = -1
 					    stringNextEnd = -1
+
+
+                                        
+                                        
 			stringStart = -1
 			stringEnd = -1
 			stringMiddle = -1
+
+                        
 			#Find line that creates the inherited struct:
 			# Find line that looks like "	struct ",self.functionName," { __",self.FunctionName," };"
-			myString = ""
-			myString = "struct "
-                        myMiddleString = self.functionName
-			myNextString = "__"+self.functionName
-			stringStart = (str(line)).find(myString )
+                        functionCounter = 0
                         
-			if stringStart >=0:
+                        for functionName in functionNames:
+			    myString = ""
+			    myString = "struct "
+                            myMiddleString = functionName
+			    myNextString = "__"+functionName
+			    stringStart = (str(line)).find(myString )
+
+			    if stringStart >=0:
+
                                 stringMiddle = (str(line)).find(myMiddleString)
 				stringEnd = (str(line)).find(myNextString)
 				if stringEnd >=0:
-                                        
-				    (self.lines).append(lineCount)
+
+                                    self.functionName = functionName
+                                    self.parentName = parentNames[functionCounter]
+                                    #Extract out lineCount beginning for section
+
+                                    (self.lines).append(functionLineCount[functionCounter])
+                                    # add lineCount end for section
+                                    (self.lines).append(lineCount)
+
 			        elif stringMiddle >=0:
                                 #check next line for remainder of code, just in case it didn't fit on one line.
                                     stringEnd = (str(text[lineCount+1])).find(myNextString)
                                     if stringEnd >=0:
-                                        (self.lines).append(lineCount+1)
-			
-			lineCount = lineCount + 1		
+                                         self.functionName = functionName
+                                         self.parentName = parentNames[functionCounter]
 
+                                         (self.lines).append(functionLineCount[functionCounter])
+                                         (self.lines).append(lineCount+1)
+
+                                            
+                            functionCounter = functionCounter +1			
+			lineCount = lineCount + 1
+
+        #print functionNames
+        #print parentNames
+        #print functionLineCount
+        #print "self.lines = " + str(self.lines)           		
+        #print "******** "+ self.functionName +" " +self.parentName
 		
 		# Now, if there is text to replace:
         if self.functionName != "":
@@ -232,8 +285,10 @@ class Input():
 				inheritanceText = " : "+self.parentName
 			self.addedText = "struct "+ self.functionName + inheritanceText +"\n {\n "
 			lineNum = -1
-                        
+                        #print self.addedText
+                        #print self.lines
 			if len(self.lines) == 2:
+                                #print self.lines
 				for lineNum in range(self.lines[0]+1, self.lines[1]-1):
 					if self.parentName == "":
 						self.addedText += text[lineNum].split("\\")[0] + "\n "
@@ -246,22 +301,22 @@ class Input():
 							self.addedText += text[lineNum].split("\\")[0] + "\n "
 		                
 				# replace old text section with new 'addedText'
-				for lines in range(0, self.lines[0]-1):
+			        for lines in range(0, self.lines[0]-1):
 					self.output += text[lines]
-				self.output += self.addedText
-
-                                #Add in public: statement just in case.
+			        self.output += self.addedText
+                                #print self.addedText
+                        #Add in public: statement just in case.
                                 self.output += "public: \n" 
 				
                 # Find #endif statement and insert bracket before it.
-				for lines in range(self.lines[1]+1, len(text)):
+			        for lines in range(self.lines[1]+1, len(text)):
 					if ((text[lines]).find("#endif") >= 0):
 
 					   self.output +=  "};\n" + text[lines]
 					else:
 					    self.output += text[lines]
-
-
+                        #print self.addedText
+             
                 
 		# if no alterations are needed, then write output to screen as is	
         elif self.functionName == "":



More information about the CIG-COMMITS mailing list