Changeset 1019
- Timestamp:
- Jun 8, 2008, 6:32:32 PM (16 years ago)
- Location:
- trunk/examples
- Files:
-
- 28 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/c-example/Makefile.in
r833 r1019 1 # define rappture src directory2 ifndef RP_BASE3 RP_BASE = @prefix@4 endif5 1 6 PROGS = plot plotc compress compressc 2 bindir = @bindir@ 3 datadir = @datadir@ 4 datarootdir = @datarootdir@ 5 exec_prefix = @exec_prefix@ 6 includedir = @includedir@ 7 libdir = @libdir@ 8 mandir = @mandir@ 9 prefix = @prefix@ 10 srcdir = @srcdir@ 7 11 8 # define our compiling environment 9 # 12 INSTALL = @INSTALL@ 13 INSTALL_DATA = @INSTALL_DATA@ 14 10 15 CC = @CC@ 16 CFLAGS = @CFLAGS@ 11 17 CXX = @CXX@ 12 DEBUG = -g -Wall 13 DEBUG_PLUS = -g -DDEBUG 18 CXXFLAGS = @CFLAGS@ 19 DEFINES = -g -Wall 20 INCLUDES = -I$(srcdir)/../../src/core \ 21 -I$(includedir) 22 LIBS = \ 23 -L../../src/core -lrappture \ 24 -L$(libdir) -lexpat -lb64 -lz 25 VPATH = $(srcdir) 14 26 15 # define our directories 16 # 17 INCLUDES_DIR = $(RP_BASE)/include 18 INCL_CEE = -I $(INCLUDES_DIR)/cee 19 INCL_CORE = -I $(INCLUDES_DIR)/core 20 INCL_RP_DEPS = -I $(RP_BASE)/include 27 CXX_SWITCHES = $(CXXFLAGS) $(INCLUDES) $(DEFINES) 28 CC_SWITCHES = $(CFLAGS) $(INCLUDES) $(DEFINES) 21 29 22 INCL_FILES = $(INCL_CEE) $(INCL_CORE) $(INCL_RP_DEPS) 30 FILES = \ 31 $(srcdir)/README \ 32 $(srcdir)/compress.c \ 33 $(srcdir)/compress.cc \ 34 $(srcdir)/output.dx \ 35 $(srcdir)/plot.cc \ 36 $(srcdir)/plotc.c \ 37 $(srcdir)/tool.xml \ 38 $(srcdir)/tool2.xml \ 39 Makefile 23 40 24 LIB_DIR = $(RP_BASE)/lib 25 LIB_RAPPTURE = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture 26 LIB_RAPPTURE_MAC = -L$(LIB_DIR) -lrappture -lscew 41 destdir = $(prefix)/examples/c-example 42 43 44 PROGS = \ 45 compress \ 46 compressc \ 47 plot \ 48 plotc \ 27 49 28 50 all: $(PROGS) 29 51 30 compress: compress.cc 31 @if test "`uname`" == "Darwin"; then \ 32 $(CXX) $(DEBUG) $(INCL_FILES) -o $@ $< $(LIB_RAPPTURE_MAC); \ 33 else \ 34 $(CXX) $(DEBUG) $(INCL_FILES) -o $@ $< $(LIB_RAPPTURE); \ 35 fi 52 compress: $(srcdir)/compress.cc 53 $(CXX) $(CXX_SWITCHES) -o $@ $< $(LIBS) 54 compressc: $(srcdir)/compress.c 55 $(CC) $(CC_SWITCHES) -o $@ $< $(LIBS) 56 plot: $(srcdir)/plot.cc 57 $(CXX) $(CXX_SWITCHES) -o $@ $< $(LIBS) 58 plotc: $(srcdir)/plotc.c 59 $(CC) $(CC_SWITCHES) -o $@ $< $(LIBS) 36 60 37 compressc: compress.c 38 @if test "`uname`" == "Darwin"; then \ 39 $(CC) $(DEBUG) $(INCL_FILES) -o $@ $< $(LIB_RAPPTURE_MAC); \ 40 else \ 41 $(CC) $(DEBUG) $(INCL_FILES) -o $@ $< $(LIB_RAPPTURE); \ 42 fi 61 install: 62 $(INSTALL) -d $(destdir) 63 for i in $(FILES) ; do \ 64 $(INSTALL) -m 444 $$i $(destdir) ; \ 65 done 66 for i in $(PROGS) ; do \ 67 $(INSTALL) -m 555 $$i $(destdir) ; \ 68 done 43 69 44 plot: plot.cc45 @if test "`uname`" == "Darwin"; then \46 $(CXX) $(DEBUG) -DDEBUG $(INCL_FILES) -o $@ $< $(LIB_RAPPTURE_MAC); \47 else \48 $(CXX) $(DEBUG) -DDEBUG $(INCL_FILES) -o $@ $< $(LIB_RAPPTURE); \49 fi50 51 plotc: plotc.c52 @if test "`uname`" == "Darwin"; then \53 $(CXX) $(DEBUG) -DDEBUG $(INCL_FILES) -o $@ $< $(LIB_RAPPTURE_MAC); \54 else \55 $(CC) $(DEBUG) -DDEBUG $(INCL_FILES) -o $@ $< $(LIB_RAPPTURE) -lm; \56 fi57 58 #### CLEAN UP ############################################################59 70 clean: 60 rm -f$(PROGS) run*.xml71 $(RM) $(PROGS) run*.xml 61 72 62 73 distclean: clean 63 - rm Makefile74 $(RM) Makefile *~ -
trunk/examples/c-example/plot.cc
r872 r1019 11 11 #include <iostream> 12 12 #include <sstream> 13 14 #ifdef DEBUG 15 static int debug = 1; 16 #else 17 static int debug = 0; 18 #endif 13 19 14 20 int main(int argc, char * argv[]) … … 29 35 filePath = std::string(argv[1]); 30 36 31 if ( DEBUG) {37 if (debug) { 32 38 std::cout << "filePath: " << filePath << std::endl; 33 39 } … … 37 43 38 44 if (lib) { 39 if( DEBUG) {45 if(debug) { 40 46 std::cout << "created Rappture Library successfully" << std::endl; 41 47 } … … 51 57 52 58 if(! (xmltext.empty()) ) { 53 if( DEBUG) {59 if(debug) { 54 60 //printf("XML file content:\n"); 55 61 //printf("%s\n", xmltext); … … 71 77 } 72 78 73 if( DEBUG) {79 if(debug) { 74 80 std::cout << "xml min :" << xmltext << ": len=" << xmltext.size() << std::endl; 75 81 } … … 78 84 fmin = lib->getDouble("input.number(min).current"); 79 85 80 if( DEBUG) {86 if(debug) { 81 87 std::cout << "min: " << fmin << std::endl; 82 88 } … … 84 90 // get the max 85 91 fmax = lib->getDouble("input.(max).current"); 86 if( DEBUG) {92 if(debug) { 87 93 std::cout << "max: " << fmax << std::endl; 88 94 } -
trunk/examples/c-example/plotc.c
r555 r1019 13 13 #include <math.h> 14 14 15 int main(int argc, char * argv[]) 15 #ifdef DEBUG 16 static int debug = 1; 17 #else 18 static int debug = 0; 19 #endif 20 21 int 22 main(int argc, char **argv) 16 23 { 17 24 … … 37 44 filePath = argv[1]; 38 45 39 if ( DEBUG)46 if (debug) 40 47 printf("filePath: %s:\n", filePath); 41 48 … … 44 51 45 52 if (lib) { 46 if( DEBUG) {53 if(debug) { 47 54 printf("created Rappture Library successfully\n"); 48 55 } … … 57 64 err = rpXml(lib,&xmltext); 58 65 if( !err ) { 59 if( DEBUG) {66 if(debug) { 60 67 //printf("XML file content:\n"); 61 68 //printf("%s\n", xmltext); … … 79 86 // it will live in rappture's memory until the next call to getString() 80 87 81 if( DEBUG) {82 printf("xml min: %s: len=%d\n", xmltext,strlen(xmltext));88 if(debug) { 89 printf("xml min: %s: len=%d\n", xmltext, (int)strlen(xmltext)); 83 90 } 84 91 85 92 fmin = atof(xmltext); 86 93 // fmin = getDouble(lib,"input.number(min).current"); 87 if( DEBUG) {94 if(debug) { 88 95 printf("min: %f\n", fmin); 89 96 } … … 91 98 // get the max 92 99 rpGetDouble(lib,"input.(max).current",&fmax); 93 if( DEBUG) {100 if(debug) { 94 101 printf("max: %f\n", fmax); 95 102 }
Note: See TracChangeset
for help on using the changeset viewer.