Changeset 638 for trunk/thirds


Ignore:
Timestamp:
Apr 27, 2015, 3:28:16 PM (10 years ago)
Author:
djay
Message:

Fix for SAGA-GIS generated ZCFG and add '=' to the acceptable values in a ZCFG.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/thirds/saga2zcfg/saga2zcfg.c

    r637 r638  
    1515}
    1616
    17 const char* cleanAbstract(CSG_String abstract){
     17void cleanAbstract(CSG_String abstract,char**res){
    1818  char* tmp=strdup(abstract.b_str());
    19   CSG_String val=CSG_String(" ")+tmp;
    20   if(val.Contains("¸")){
    21     val.Replace("¸"," ");
     19  CSG_String val=CSG_String("")+tmp;
     20  if(val.Contains("\r")){
     21    val.Replace("\r","<br/>");
    2222  }
    2323  if(val.Contains("\n")){
    2424    val.Replace("\n","<br/>");
    2525  }
    26   if(val.Contains("\r")){
    27     val.Replace("\r","");
    28   }
    2926  if(val.Contains("<")){
    3027    val.Replace("<","&lt;");
     
    3229  if(val.Contains(">")){
    3330    val.Replace(">","&gt;");
    34     fprintf(stderr,"%s\n",val.b_str());
    3531  }
    3632  free(tmp);
    37   fprintf(stderr,"%s\n",val.b_str());
    38   return val.b_str();
     33  if(val.is_Empty())
     34    *res=NULL;
     35  else
     36    *res=strdup(val.b_str());
    3937}
    4038
     
    4543    fprintf(stdout,"  Abstract = %s\n",CSG_String(param->Get_Name()).b_str());
    4644  else{
    47     fprintf(stdout,"  Abstract = %s\n",cleanAbstract(CSG_String(param->Get_Description())));
     45    char* tmp=strdup(CSG_String(param->Get_Description()).b_str());
     46    CSG_String val=CSG_String("")+tmp;
     47    if(val.Contains("\r")){
     48      val.Replace("\r","<br/>");
     49    }
     50    if(val.Contains("\n")){
     51      val.Replace("\n","<br/>");
     52    }
     53    if(val.Contains("<")){
     54      val.Replace("<","&lt;");
     55    }
     56    if(val.Contains(">")){
     57      val.Replace(">","&gt;");
     58    }
     59    free(tmp);
     60    fprintf(stdout,"  Abstract = %s\n",val.b_str());
    4861  }
    4962  if(!out){
     
    148161
    149162          mkdir(library->Get_Library_Name().b_str(),0755);
    150           fprintf(stderr,"%s %s \n",library->Get_Library_Name().b_str(),CSG_String(module->Get_ID()).b_str());
     163
    151164          FILE *stdout1=fopen((library->Get_Library_Name()+"/"+module->Get_ID()+".zcfg").b_str(),"w+");
    152165          fprintf(stdout1,"[%d]\n",j);
     
    156169            fprintf(stdout1," Abstract = %s\n",module->Get_Name().b_str());
    157170          else{
    158             const char *tmp=cleanAbstract(module->Get_Description());
    159             if(tmp==NULL || strlen(tmp)<7 ){
     171            char *val0;
     172            cleanAbstract(module->Get_Description(),&val0);
     173            if(val0==NULL)
    160174              fprintf(stdout1," Abstract = %s\n",module->Get_Name().b_str());
    161             }
    162175            else{
    163               fprintf(stdout1," Abstract = %s\n",tmp);
     176              fprintf(stdout1," Abstract = %s\n",val0);
     177              free(val0);
    164178            }
    165179          }
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png