- Timestamp:
- Sep 29, 2005, 10:21:05 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 11 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/fortran/RpFortranCommon.h
r76 r77 3 3 #include <ctype.h> 4 4 #include <string.h> 5 #include <string> 5 6 6 7 #ifndef _RpFORTRAN_COMMON_H 7 8 #define _RpFORTRAN_COMMON_H 9 8 10 9 11 #ifdef __cplusplus … … 12 14 13 15 char* null_terminate(char* inStr, int len); 14 16 std::string null_terminate_str(const char* inStr, int len); 15 17 void fortranify(const char* inBuff, char* retText, int retTextLen); 16 18 -
trunk/src/Makefile
r76 r77 8 8 9 9 EMB_PY_FLAGS = -Wl,-rpath,$(EMB_PY_LIB_DIR) -L$(EMB_PY_LIB_DIR) $(EMB_PY_LIB_FLAG) 10 11 12 # tell make where to find the libscew sources 13 SCEW_HEADERS = /opt/rappture/include/scew 14 LIB_SCEW_INCL = -I $(SCEW_HEADERS) 15 LIB_SCEW_FLAG = -L/opt/rappture/lib -lscew 16 #LIB_SCEW_FLAG = -static -L/opt/rappture/lib -lscew 17 10 18 11 19 # everything below should be ok, but check to make sure … … 23 31 PROGS = librappture \ 24 32 libRpObjects \ 33 librappture_test 25 34 26 35 # define our compiling environment … … 78 87 LIB_RP_OBJECTS = $(LIB_INC_PREFIX) -lRpObjects 79 88 LIB_RAPPTURE = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture 89 LIB_RAPPTURE_T = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture_test 80 90 81 91 INCL_CORE = -I $(INCLUDES_DIR)/core … … 89 99 all: ${PROGS} 90 100 101 RP_IO_DEPS = RpLibrary.o RpLibraryCInterface.o RpLibraryFInterface.o scew_extras.o 102 RP_UNITS_DEPS = RpUnitsStd.o RpUnits.o RpUnitsCInterface.o RpUnitsFInterface.o 103 RP_OTHER_DEPS = RpFortranCommon.o 104 91 105 # include rappture library definitions 92 106 … … 99 113 /sbin/ldconfig -n $(LIB_DIR) 100 114 115 librappture_test: $(RP_IO_DEPS) $(RP_UNITS_DEPS) $(RP_OTHER_DEPS) 116 $(CXX) $(DEGUG) -shared -Wl,-rpath,$(LIB_DIR)/ \ 117 -Wl,-soname,$@.so -o $(LIB_DIR)/$@.so.0.0 $^ $(LIB_SCEW_FLAG) 118 119 /sbin/ldconfig -n $(LIB_DIR) 101 120 102 121 #### libRpObjects ######################################################## 103 122 libRpObjects: RpVariable.o RpAbout.o RpNumber.o RpString.o RpBoolean.o RpChoice.o RpOption.o RpUnitsStd.o RpUnits.o 104 123 $(CXX) $(DEGUG) -shared -Wl,-rpath,$(LIB_DIR)/ \ 105 -Wl,-soname,$@.so -o $(LIB_DIR)/$@.so.0.0 $^ -lc124 -Wl,-soname,$@.so -o $(LIB_DIR)/$@.so.0.0 $^ 106 125 107 126 /sbin/ldconfig -n $(LIB_DIR) … … 110 129 # include core source files 111 130 131 RpLibrary.o: $(CORE_SRC)/RpLibrary.cc 132 $(CXX) -fPIC $(DEBUG) $(INCL_CORE) $(LIB_SCEW_INCL) -o $@ -c $? 133 134 scew_extras.o: $(CORE_SRC)/scew_extras.c 135 $(CC) -fPIC $(DEBUG) $(INCL_CORE) $(LIB_SCEW_INCL) -o $@ -c $? 136 112 137 RpVariable.o: $(CORE_SRC)/RpVariable.cc 113 138 $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $? … … 146 171 147 172 RpUnitsCInterface.o: $(CEE_SRC)/RpUnitsCInterface.cc 148 $(CXX) $(CFLAGS) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_CEE) -o $@ -c $? 173 $(CXX) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_CEE) -o $@ -c $? 174 175 RpLibraryCInterface.o: $(CEE_SRC)/RpLibraryCInterface.cc 176 $(CXX) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_CEE) $(LIB_SCEW_INCL) -o $@ -c $? 149 177 150 178 … … 160 188 161 189 RpFortranCommon.o: $(FORT_SRC)/RpFortranCommon.c 162 $(CC) $(CFLAGS) -fPIC $(DEBUG) $(INCL_FORTRAN) -o $@ -c $< 190 $(CXX) $(CFLAGS) -fPIC $(DEBUG) $(INCL_FORTRAN) -o $@ -c $< 191 192 RpLibraryFInterface.o: $(FORT_SRC)/RpLibraryFInterface.cc 193 $(CXX) $(CFLAGS) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_FORTRAN) $(LIB_SCEW_INCL) -o $@ -c $? 163 194 164 195 … … 167 198 #### CLEAN UP ############################################################ 168 199 clean: 169 - rm -f $(BIN_DIR)/* *.o librappture.* libR*.so*200 - rm -f *.o librappture*.so* libRp*.so* -
trunk/src/README
r41 r77 1 1 To compile the Rappture Library, the following must be done: 2 2 3 1) Adjust the Makefile.3 1) Adjust the Makefile. 4 4 5 5 Change Makefile variables as needed. Pay particular attention to … … 10 10 above this directory. 11 11 12 2) Adjust the file 'include/cee/rappture_interface.h' 12 Check the Following variables: 13 14 PY_SRC_HEADERS = /opt/rappture/include/python2.4 15 EMB_PY_LIB_FLAG = -lpython2.4 16 EMB_PY_LIB_DIR = /opt/rappture/lib 13 17 14 Line 1 of rappture_interface.h includes 'python2.4/Python.h'. 15 Make sure this file (and all of its supporting files) exist 16 in the directory 'include/cee/'. Replace 'python2.4/Python.h' 17 with the version of python being used and the location where 18 Python.h can be found. Python.h and all of its suppoting files 19 can be downloaded from http://www.python.org/download/. You 20 will only need the header files to fulfill this task. 21 If you do not have a python object library, you will need to 22 compile python with the appropriate flags (--enable-shared) to 23 get it. 24 25 3) Make sure the Rappture module is installed in Python. 18 # tell make where to find the libscew sources 19 SCEW_HEADERS = /opt/rappture/include/scew 20 LIB_SCEW_INCL = -I $(SCEW_HEADERS) 21 LIB_SCEW_FLAG = -L/opt/rappture/lib -lscew 26 22 27 4) Make a library 28 29 make librappture 23 # define the top of our directory structure 24 # replace this with the full path of the directory 25 # containing the rappture directory 26 TOP_DIR 30 27 31 5) Make the Rappture Test programs 28 CFLAGS 32 29 33 make test 30 2) Make the Rappture library 31 32 To make the Rappture Library, you will need to make sure the Scew 33 library header files are installed and the makefile variable 34 SCEW_HEADERS is properly defined. The following scew related header 35 files must be available in the library search path, preferably in 36 same directory as the scew header files. 37 38 | Header File Name | Provider | 39 -+--------------------+--------------+- 40 | xelement.h | scew source | 41 | xattribute.h | scew source | 42 | xerror.h | scew source | 43 -+--------------------|--------------+- 44 | attribute.h | scew source | 45 | element.h | scew source | 46 | error.h | scew source | 47 | parser.h | scew source | 48 | scew.h | scew source | 49 | str.h | scew source | 50 | tree.h | scew source | 51 | writer.h | scew source | 52 -+--------------------+--------------+- 53 | expat.h | expat source | 54 | expat_external.h | expat source | 55 -+--------------------+--------------+- 56 57 Once You've verified that these header files are available, 58 issue the following commands: 59 cd rappture/src 60 make 61 62 3) Installing Python's Rappture.Units module. 63 cd rappture/python 64 python setup.py install 65 66 4) Make the Rappture Test programs 67 cd rappture/test 68 make -
trunk/src/fortran/RpFortranCommon.c
r76 r77 37 37 } 38 38 39 std::string null_terminate_str(const char* inStr, int len) 40 { 41 int retVal = 0; 42 std::string newStr = ""; 43 const char* current = NULL; 44 45 if (inStr) { 46 47 current = inStr+len-1; 48 49 while ((len > 0) && (isspace(*(current)))) { 50 // dont strip off newlines 51 52 if ( (*(current) == '\f') 53 || (*(current) == '\n') 54 || (*(current) == '\r') 55 || (*(current) == '\t') 56 || (*(current) == '\v') ) 57 { 58 break; 59 } 60 61 if (--len) { 62 current--; 63 } 64 } 65 66 newStr = std::string(inStr,len); 67 68 retVal++; 69 } 70 71 // return retVal; 72 73 return newStr; 74 } 75 76 39 77 void fortranify(const char* inBuff, char* retText, int retTextLen) { 40 78 … … 42 80 int i = 0; 43 81 44 inBuffLen = strlen(inBuff); 82 if (inBuff && retText && (retTextLen > 0)) { 83 inBuffLen = strlen(inBuff); 45 84 46 strncpy(retText, inBuff, retTextLen);85 strncpy(retText, inBuff, retTextLen); 47 86 48 // fortran-ify the string 49 if (inBuffLen < retTextLen) { 50 for (i = inBuffLen; i < retTextLen; i++) { 51 retText[i] = ' '; 87 // fortran-ify the string 88 if (inBuffLen < retTextLen) { 89 for (i = inBuffLen; i < retTextLen; i++) { 90 retText[i] = ' '; 91 } 52 92 } 53 93 } -
trunk/test/Makefile
r76 r77 1 2 # tell make where to find the libscew sources 3 SCEW_HEADERS = /opt/rappture/include/scew 4 LIB_SCEW_INCL = -I $(SCEW_HEADERS) 5 LIB_SCEW_FLAG = -L/opt/rappture/lib -lscew 6 #LIB_SCEW_FLAG = -static -L/opt/rappture/lib -lscew 7 1 8 # define the top of our directory structure 2 9 # replace this with the full path of the directory … … 16 23 RpVariable_test \ 17 24 RpUnitsC_test \ 18 RpUnitsF_test 25 RpUnitsF_test \ 26 RpLibrary_test \ 27 RpLibraryCInterface_test 19 28 20 29 # define our compiling environment … … 65 74 LIB_RP_OBJECTS = $(LIB_INC_PREFIX) -lRpObjects 66 75 LIB_RAPPTURE = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture 76 LIB_RAPPTURE_T = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture_test 67 77 68 78 INCL_CORE = -I $(INCLUDES_DIR)/core … … 100 110 101 111 RpUnitsC_test: $(SRC_TEST)/RpUnitsC_test.c 102 $(CC) $(DEBUG) $(INCL_CEE) $(INCL_CORE) -o $@ $^ $(LIB_RAPPTURE) 112 $(CC) $(DEBUG) $(INCL_CEE) $(INCL_CORE) -o $@ $^ $(LIB_RAPPTURE_T) 113 114 RpLibrary_test: $(SRC_TEST)/RpLibrary_test.cc 115 $(CXX) $(DEBUG) $(INCL_CEE) $(INCL_CORE) $(LIB_SCEW_INCL) -o $@ $^ $(LIB_RAPPTURE_T) 116 117 RpLibraryCInterface_test: $(SRC_TEST)/RpLibraryCInterface_test.c 118 $(CC) $(DEBUG) $(INCL_CEE) $(INCL_CORE) $(LIB_SCEW_INCL) -o $@ $^ $(LIB_RAPPTURE_T) 103 119 104 120 RpUnitsF_test: $(SRC_TEST)/RpUnitsF_test.f 105 $(F77) $(DEBUG) -o $@ $^ $(LIB_RAPPTURE )121 $(F77) $(DEBUG) -o $@ $^ $(LIB_RAPPTURE_T) 106 122 107 123
Note: See TracChangeset
for help on using the changeset viewer.