Changeset 15091


Ignore:
Timestamp:
05/23/13 21:21:00 (12 years ago)
Author:
Eric.Larour
Message:

CHG: the Windows build requires using mexPrintf instead of printf throughout the core code.
To avoid having to recompiled libISSMCore twice (once for the issm.exe "c++" version of the
code, and once for the Matlab wrappers), we use an ApiPrintf routine, which gets resolved
differently in the wrappers than in the issm.exe build. This allows to handle matlab printf
specific behaviour without having to compile the core in several flavors.

Location:
issm/trunk-jpl/src
Files:
2 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Makefile.am

    r15082 r15091  
    944944libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(ADOLCLIB)
    945945libISSMCore_la_FFLAGS = $(AM_FFLAGS)
    946 
    947 libISSMOverload_la_SOURCES = ./shared/String/stricmp.c
    948946endif
    949947
     
    971969#}}}
    972970#Overload library, to overload any non-standard symbols. {{{
    973 libISSMOverload_a_SOURCES = ./shared/String/stricmp.c
     971libISSMOverload_a_SOURCES = ./shared/String/stricmp.cpp\
     972                                                        ./shared/String/ApiPrintf.cpp
     973
    974974libISSMOverload_a_CFLAGS  = -fPIC -D_C_ $(COPTFLAGS) $(CFLAGS)
    975975#}}}
  • issm/trunk-jpl/src/c/shared/String/sharedstring.h

    r13623 r15091  
    1212#endif
    1313
     14void ApiPrintf(char* format,const char* string);
     15
    1416#endif //ifndef _SHAREDSTRING_H_
  • issm/trunk-jpl/src/c/shared/io/Print/Print.h

    r15089 r15091  
    5252/*}}}*/
    5353
     54/* _printLine_ {{{*/
     55/* macro to print a line, adds std::endl, only on cpu 0 */
     56#define _printLine_(StreamArgs)\
     57  do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
     58          aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
     59          PrintfFunction3(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
     60/*}}}*/
     61
    5462/*functions: */
    5563int PrintfFunction(const char* format,...);
  • issm/trunk-jpl/src/c/shared/io/Print/PrintfFunction.cpp

    r15089 r15091  
    1717#include "./Print.h"
    1818#include "../Comm/Comm.h"
     19#include "../../String/sharedstring.h"
    1920#include "../../MemOps/MemOps.h"
    2021
     
    7172                __android_log_print(ANDROID_LOG_INFO, "Native",message.c_str());
    7273                #else
    73                 printf("%s\n",message.c_str());
     74                ApiPrintf("%s\n",message.c_str());
    7475                #endif
    7576        }
     
    8384
    8485        if(my_rank==0){
    85                 printf("%s",message.c_str());
     86                ApiPrintf("%s",message.c_str());
    8687        }
    8788        return 1;
     
    9293        __android_log_print(ANDROID_LOG_INFO, "Native",message.c_str());
    9394        #else
    94         printf("%s\n",message.c_str());
     95        ApiPrintf("%s\n",message.c_str());
    9596        #endif
    9697
     
    99100int PrintfFunction4(const string & message){
    100101
    101         printf("%s",message.c_str());
     102        ApiPrintf("%s",message.c_str());
    102103
    103104        return 1;
  • issm/trunk-jpl/src/wrappers/matlab/io/WriteMatlabData.cpp

    r14719 r15091  
    488488}
    489489/*}}}*/
     490
     491/*Matlab printf i/o: */
     492/*FUNCTION ApiPrintf(char* format, const char* string){{{*/
     493void ApiPrintf(char* format,const char* string){
     494
     495        /*use mexPrintf in matlab: */
     496        mexPrintf(format,string);
     497       
     498        return;
     499}
     500/*}}}*/
  • issm/trunk-jpl/src/wrappers/matlab/io/matlabio.h

    r15061 r15091  
    1616#include "../../c/classes/classes.h"
    1717#include "../../c/toolkits/toolkits.h"
     18#include "../../c/shared/shared.h"
    1819
    1920void WriteData(mxArray** pdataref,IssmDenseMat<double>* matrix);
     
    9596#endif
    9697
     98
    9799#endif  /* _IO_H_ */
  • issm/trunk-jpl/src/wrappers/python/io/WritePythonData.cpp

    r14996 r15091  
    291291}
    292292/*}}}*/
     293
     294/*Python printf i/o: */
     295/*FUNCTION ApiPrintf(char* format, const char* string){{{*/
     296void ApiPrintf(char* format,const char* string){
     297
     298        /*use printf: */
     299        printf(format,string);
     300       
     301        return;
     302}
     303/*}}}*/
  • issm/trunk-jpl/src/wrappers/python/io/pythonio.h

    r15061 r15091  
    1515#include "../../c/bamg/bamgobjects.h"
    1616#include "../../c/classes/classes.h"
     17#include "../../c/shared/shared.h"
    1718
    1819void WriteData(PyObject* py_tuple,int index, double* matrix, int M,int N);
Note: See TracChangeset for help on using the changeset viewer.