Changeset a53fb9c in tol


Ignore:
Timestamp:
Jan 12, 2017, 11:35:17 AM (10 years ago)
Author:
Pedro Gea <pgea@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
b57479d
Parents:
a52bf16
Message:

Refs #1941
Se revisan las funciones RTolSetXxx. Se añade el uso de R_concat para poder decompilarlas.
Se añade la función para crear matrices.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@7389 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtol/source/tolRlink.cpp

    ra52bf16 ra53fb9c  
    195195
    196196//----------------------------------------------------------------------------
    197 extern "C" DLLEXPORT(void) RTolSetReal(char **name, int *type, double *value)
     197extern "C" DLLEXPORT(void) RTolSetReal(char **name, int *type, double *value, int *ok)
    198198//----------------------------------------------------------------------------
    199199{
    … …  
    215215    BList* aux = NIL;
    216216    LstFastAppend(result, aux, so);
    217   }
    218 }
    219 
    220 //----------------------------------------------------------------------------
    221 extern "C" DLLEXPORT(void) RTolSetText(char **name, char **value)
     217    R_concat(&R_stack, result);   
     218    *ok = 1;
     219  }
     220  else {
     221    *ok = 0;
     222  }
     223}
     224
     225//----------------------------------------------------------------------------
     226extern "C" DLLEXPORT(void) RTolSetText(char **name, char **value, int *ok)
    222227//----------------------------------------------------------------------------
    223228{
    … …  
    230235    BList* aux = NIL;
    231236    LstFastAppend(result, aux, so);
    232   }
    233 }
    234 
    235 //----------------------------------------------------------------------------
    236 extern "C" DLLEXPORT(void) RTolSetDate(char **name, int *type, double *value)
     237    R_concat(&R_stack, result);   
     238    *ok = 1;
     239  }
     240  else {
     241    *ok = 0;
     242  }
     243}
     244
     245//----------------------------------------------------------------------------
     246extern "C" DLLEXPORT(void) RTolSetDate(char **name, int *type, double *value, int *ok)
    237247//----------------------------------------------------------------------------
    238248{
    … …  
    243253    d.PutIndex(*value);
    244254  } else if(*type == 2) {
     255    d.PutIndex(219147); // End
     256  } else if(*type == 3) {
    245257    d.PutIndex(-115782); // Begin
    246   } else if(*type == 3) {
    247     d.PutIndex(219147); // End
    248258  } else { // type 1
    249259    d.PutIndex(-300000); // Unknown
    … …  
    254264    BList* aux = NIL;
    255265    LstFastAppend(result, aux, so);
    256   }
    257 }
    258 
    259 //////////////////////////////////////////////////////////////////////////////
    260 
     266    R_concat(&R_stack, result);   
     267    *ok = 1;
     268  }
     269  else {
     270    *ok = 0;
     271  }
     272}
     273
     274//----------------------------------------------------------------------------
     275extern "C" DLLEXPORT(void) RTolSetMatrix(char **name, int *rows, int *cols,
     276  bool *mask, int *type, double *value, int *ok)
     277//----------------------------------------------------------------------------
     278{
     279  if(TOLHasBeenInitialized()==0) RInitTolKernel();
     280  char* str_name = (char*)*name;
     281  BMat d(*rows, *cols);
     282  for (int c=0; c< (*cols); ++c) {   
     283    for (int r=0; r< (*rows); ++r) {
     284      int p = c * (*rows) + r;
     285      if(*mask) {
     286        if(type[p] == 0) {
     287          d(r, c).PutValue(value[p]);
     288        } else if(type[p] == 2) {
     289          d(r, c).PutValue(BDat::PosInf());
     290        } else if(type[p] == 3) {
     291          d(r, c).PutValue(BDat::NegInf());
     292        } else { // type 1
     293          d(r, c).PutKnown(BUNKNOWN);
     294        }
     295      } else {
     296        d(r, c).PutValue(value[p]);
     297      }
     298    }
     299  }
     300  BSyntaxObject * so = new BContensMat(str_name, d, "");
     301  if (so) {
     302    BList* result = NIL;
     303    BList* aux = NIL;
     304    LstFastAppend(result, aux, so);
     305    R_concat(&R_stack, result);   
     306    *ok = 1;
     307  }
     308  else {
     309    *ok = 0;
     310  }
     311}
     312
     313//////////////////////////////////////////////////////////////////////////////
     314
Note: See TracChangeset for help on using the changeset viewer.