Mercurial > hg > plml
changeset 23:bfef495cd52a
God rid of unused code.
author | samer |
---|---|
date | Wed, 15 Feb 2012 17:50:14 +0000 |
parents | 3d4f0243c5fc |
children | 27c10ed38592 |
files | cpp/plml.cpp |
diffstat | 1 files changed, 3 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/cpp/plml.cpp Thu Feb 09 11:55:20 2012 +0000 +++ b/cpp/plml.cpp Wed Feb 15 17:50:14 2012 +0000 @@ -85,7 +85,6 @@ #define ALT_LASTERR 1 -#define ALT_WSALLOC 1 /* The maximum number of simultaneous connections to Matlab from one Prolog process. */ @@ -210,8 +209,6 @@ // functor to be used to wrap array pointers static pthread_mutex_t EngMutex; -#define LOCK pthread_mutex_lock(&EngMutex) -#define UNLOCK pthread_mutex_unlock(&EngMutex) class lock { public: @@ -540,7 +537,6 @@ x.engine = engine->ep; x.id = engine->id; -#ifdef ALT_WSALLOC // printf("-- mlWSAlloc: Calling uniquevar... \r"); fflush(stdout); { lock l; if (engEvalString(x.engine, "uniquevar([])")) @@ -558,29 +554,6 @@ } memcpy(x.name,engine->outbuf+11,len); x.name[len]=0; -#else - - // printf("-- mlWSAlloc: Calling uniquevar... \r"); fflush(stdout); - if (engEvalString(x.engine, "t__0=uniquevar([])")) { - return raise_exception("mlWSAlloc: Cannot execute uniquevar"); - } - - if (strncmp(engine->outbuf,">> \nt__0 =",10)!=0) { - //printf("\n** mlWSAlloc: output buffer looks bad: '%s'\n",engine->outbuf); - return raise_exception("mlWSAlloc: Bad output buffer."); - } - mxArray *newname=engGetVariable(x.engine, "t__0"); - - if (newname==NULL) { - return raise_exception("mlWSAlloc: Cannot get new variable name."); - } - memset(x.name,sizeof(x.name),0); - int rc = mxGetString(newname,x.name, sizeof(x.name)); - mxDestroyArray(newname); - if (rc) { - return raise_exception("mlWSAlloc: Cannot read new variable name."); - } -#endif return PL_unify_blob(blob,&x,sizeof(x),&ws_blob); } @@ -676,15 +649,14 @@ if (strncmp(eng->outbuf,">> #\n",5)!=0) { throw PlException(PlCompound("bad_output_buffer",PlTermv("exec",eng->outbuf))); } + // write whatever is in the output buffer now, starting after the "#\n" fputs(eng->outbuf+5,stdout); - #ifdef ALT_LASTERR // --------------- ALTERNATIVE LASTERR SCHEME ------------------ - // call engine to eval lasterr, then scrape from output buffer - // it's faster and easier and not prone to engGetVariable lock up problem! + // call engine to eval lasterr, then scrape from output buffer: it's faster and easier. rc=engEvalString(eng->ep,"lasterr"); if (rc) { throw PlException("mlExec: unable to execute lasterr"); } @@ -744,6 +716,7 @@ } #endif + return TRUE; } catch (PlException &e) { return e.plThrow();