Changeset 382 for cpp


Ignore:
Timestamp:
05/22/15 04:15:14 (10 years ago)
Author:
sz
Message:

Moving frams/virtfile to common/virtfile:

  • file references updated (includes, makefile)
  • common/virtfile can no longer use the Framsticks specific SString (using std::string instead)
Location:
cpp
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/stl-util.cpp

    r375 r382  
    1212#include <assert.h>
    1313#ifdef USE_VIRTFILE
    14 #include <frams/virtfile/virtfile.h>
     14#include <common/virtfile/virtfile.h>
    1515#endif
    1616#ifdef __BORLANDC__
  • cpp/common/virtfile/stringfile.cpp

    r348 r382  
    99size_t StringFILE::Vread(void *ptr, size_t size, size_t nmemb)
    1010{
    11         int have = (int)(str.len() - pos);
     11        int have = int(str.size()) - pos;
    1212        if (have <= 0) return 0;
    1313        int need = (int)(size*nmemb);
     
    2020int StringFILE::Vgetc()
    2121{
    22         if (pos >= str.len()) //...i znowu byl bug roku! :O
     22        if (pos >= int(str.size()))
    2323                return EOF;
    2424        else
     
    2828char *StringFILE::Vgets(char *s, int size)
    2929{
    30         int have = str.len() - (int)pos;
     30        int have = int(str.size()) - pos;
    3131        if (have <= 0) return 0;
    3232        if (size < 0) size = 0;
     
    4949        case SEEK_SET: pos = offset; break;
    5050        case SEEK_CUR: pos += offset; break;
    51         case SEEK_END: pos = str.len() - offset; break;
     51        case SEEK_END: pos = int(str.size()) - offset; break;
    5252        default: return EINVAL;
    5353        }
    54         if (pos < 0) pos = 0; else if (pos>str.len()) pos = str.len();
     54        if (pos < 0) pos = 0; else if (pos > int(str.size())) pos = int(str.size());
    5555        return 0;
    5656}
     
    6767        if ((*mode == 'r') && isStringPath(path))
    6868        {
    69                 return new StringFILE2(SString(path + sizeof(PREFIX) - 1));
     69                return new StringFILE2(string(path + sizeof(PREFIX) - 1));
    7070        }
    7171        return (chain != NULL) ? chain->Vfopen(path, mode) : NULL;
  • cpp/common/virtfile/stringfile.h

    r295 r382  
    77
    88#include "virtfile.h"
    9 #include <frams/util/sstring.h>
     9#include <common/nonstd_stl.h>
     10#include <string.h>
    1011
    1112class StringFILE : public VirtFILE
    1213{
    1314protected:
    14         SString& str;
    15         long pos;
     15        string& str;
     16        int pos;
    1617public:
    17         StringFILE(SString& s): VirtFILE(""), str(s), pos(0) {}
     18        StringFILE(string& s): VirtFILE(""), str(s), pos(0) {}
    1819        size_t Vread(void *ptr, size_t size, size_t nmemb);
    1920        size_t Vwrite(const void *ptr, size_t size, size_t nmemb) { str.append((const char*)ptr, (int)(size*nmemb)); return size*nmemb; }
    20         int Veof() { return pos >= str.len(); }
     21        int Veof() { return pos >= int(str.size()); }
    2122        int Vputc(int c) { str += (char)c; return c; }
    2223        int Vputs(const char *s) { str.append(s, (int)strlen(s)); return 0; }
     
    3132class StringFILE2 : public StringFILE
    3233{
    33         SString string;
     34        string str;
    3435public:
    35         StringFILE2(const SString& s) :StringFILE(string), string(s) {}
    36         StringFILE2() :StringFILE(string) {}
    37         const SString& getString() { return string; }
     36        StringFILE2(const string& s) :StringFILE(str), str(s) {}
     37        StringFILE2() :StringFILE(str) {}
     38        const string& getString() { return str; }
    3839};
    3940
  • cpp/frams/Makefile-SDK-files

    r375 r382  
    22
    33# ALL_DIRS is later expanded by the shell, no spaces/newlines allowed, or it breaks
    4 ALL_DIRS={common,frams,frams/canvas,frams/config,frams/loggers,frams/genetics,frams/genetics/f0,frams/genetics/f1,frams/genetics/f2,frams/genetics/f3,frams/genetics/f4,frams/genetics/f5,frams/genetics/f6,frams/genetics/f7,frams/genetics/f8,frams/genetics/f9,frams/genetics/fF,frams/genetics/fT,frams/model,frams/neuro,frams/neuro/impl,frams/param,frams/test,frams/util,frams/vm/classes,frams/virtfile,frams/_demos,frams/model/geometry,frams/_demos/geometry,frams/model/similarity,frams/model/similarity/SVD}
     4ALL_DIRS={common,frams,frams/canvas,frams/config,frams/loggers,frams/genetics,frams/genetics/f0,frams/genetics/f1,frams/genetics/f2,frams/genetics/f3,frams/genetics/f4,frams/genetics/f5,frams/genetics/f6,frams/genetics/f7,frams/genetics/f8,frams/genetics/f9,frams/genetics/fF,frams/genetics/fT,frams/model,frams/neuro,frams/neuro/impl,frams/param,frams/test,frams/util,frams/vm/classes,common/virtfile,frams/_demos,frams/model/geometry,frams/_demos/geometry,frams/model/similarity,frams/model/similarity/SVD}
    55
    66GENMANF4=frams/genetics/f4/oper_f4.o
     
    2525#### sdk_tests
    2626
    27 GENOMANIPULATION_OBJS= frams/_demos/genomanipulation.o frams/loggers/loggertostdout.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
     27GENOMANIPULATION_OBJS= frams/_demos/genomanipulation.o frams/loggers/loggertostdout.o common/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    2828
    29 MULTILINE_F0_OBJS=frams/_demos/multiline_f0_test.o frams/virtfile/stringfile.o frams/virtfile/virtfile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
     29MULTILINE_F0_OBJS=frams/_demos/multiline_f0_test.o common/virtfile/stringfile.o common/virtfile/virtfile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    3030
    31 F0_VARIANTS_OBJS=frams/_demos/f0_variants_test.o frams/virtfile/stringfile.o frams/virtfile/virtfile.o frams/loggers/loggertostdout.o   $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
     31F0_VARIANTS_OBJS=frams/_demos/f0_variants_test.o common/virtfile/stringfile.o common/virtfile/virtfile.o frams/loggers/loggertostdout.o   $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
    3232
    33 LOADER_TEST_OBJS=frams/_demos/genotypeloader.o frams/_demos/loader_test.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
     33LOADER_TEST_OBJS=frams/_demos/genotypeloader.o frams/_demos/loader_test.o common/virtfile/virtfile.o frams/param/multiparamload.o common/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
    3434
    35 LOADER_TEST_PARAM_OBJS=frams/_demos/loader_test_param.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o frams/loggers/loggertostdout.o $(SDK_OBJS)
     35LOADER_TEST_PARAM_OBJS=frams/_demos/loader_test_param.o common/virtfile/virtfile.o frams/param/multiparamload.o common/virtfile/stdiofile.o frams/loggers/loggertostdout.o $(SDK_OBJS)
    3636
    37 GENOCONV_TEST_OBJS= frams/_demos/genoconv_test.o frams/_demos/printconvmap.o frams/loggers/loggertostdout.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
     37GENOCONV_TEST_OBJS= frams/_demos/genoconv_test.o frams/_demos/printconvmap.o frams/loggers/loggertostdout.o common/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
    3838
    39 GENO_TEST_OBJS= frams/_demos/geno_test.o frams/virtfile/virtfile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
     39GENO_TEST_OBJS= frams/_demos/geno_test.o common/virtfile/virtfile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    4040
    41 GENOOPER_TEST_OBJS=frams/_demos/genooper_test.o frams/virtfile/virtfile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
     41GENOOPER_TEST_OBJS=frams/_demos/genooper_test.o common/virtfile/virtfile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    4242
    43 GENOOPER_TEST_FTEST_OBJS=frams/_demos/genooper_test_fTest.o frams/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) $(GENMAN_FT)
     43GENOOPER_TEST_FTEST_OBJS=frams/_demos/genooper_test_fTest.o common/virtfile/virtfile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) $(GENMAN_FT)
    4444
    45 NEURO_TEST_OBJS= frams/_demos/neuro_test.o frams/loggers/loggertostdout.o frams/virtfile/virtfile.o \
     45NEURO_TEST_OBJS= frams/_demos/neuro_test.o frams/loggers/loggertostdout.o common/virtfile/virtfile.o \
    4646        frams/neuro/neuroimpl.o frams/neuro/neurofactory.o frams/neuro/impl/neuroimpl-simple.o frams/neuro/impl/neuroimpl-channels.o \
    4747        frams/neuro/impl/neuroimpl-fuzzy.o frams/neuro/impl/neuroimpl-fuzzy-f0.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    4848
    49 FULL_PROPS_OBJS= frams/_demos/full_props.o frams/loggers/loggertostdout.o frams/virtfile/virtfile.o  frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
     49FULL_PROPS_OBJS= frams/_demos/full_props.o frams/loggers/loggertostdout.o common/virtfile/virtfile.o  common/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    5050
    51 SHAPECONVERT_OBJS= frams/_demos/shapeconvert.o frams/loggers/loggertostdout.o frams/virtfile/virtfile.o  frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
     51SHAPECONVERT_OBJS= frams/_demos/shapeconvert.o frams/loggers/loggertostdout.o common/virtfile/virtfile.o  common/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    5252
    53 SERIAL_TEST_OBJS= frams/_demos/serial_test.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
     53SERIAL_TEST_OBJS= frams/_demos/serial_test.o common/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
    5454
    55 PART_SHAPES_OBJS= frams/_demos/part_shapes.o frams/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
     55PART_SHAPES_OBJS= frams/_demos/part_shapes.o common/virtfile/virtfile.o  $(SDK_OBJS) $(GENOCONV_SDK_OBJS)
    5656
    57 NEURO_LAYOUT_TEST_OBJS= frams/_demos/neuro_layout_test.o frams/virtfile/virtfile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) frams/canvas/nn_layout_model.o frams/canvas/nn_simple_layout.o frams/canvas/nn_smart_layout.o
     57NEURO_LAYOUT_TEST_OBJS= frams/_demos/neuro_layout_test.o common/virtfile/virtfile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS) frams/canvas/nn_layout_model.o frams/canvas/nn_simple_layout.o frams/canvas/nn_smart_layout.o
    5858
    59 GEOMETRY_INFO_TEST_OBJS=frams/_demos/geometry/info_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS)
     59GEOMETRY_INFO_TEST_OBJS=frams/_demos/geometry/info_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o common/virtfile/virtfile.o frams/param/multiparamload.o common/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS)
    6060
    61 GEOMETRY_SURFACE_TEST_OBJS=frams/_demos/geometry/surface_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS)
     61GEOMETRY_SURFACE_TEST_OBJS=frams/_demos/geometry/surface_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o common/virtfile/virtfile.o frams/param/multiparamload.o common/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS)
    6262
    63 GEOMETRY_VOLUME_TEST_OBJS=frams/_demos/geometry/volume_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS)
     63GEOMETRY_VOLUME_TEST_OBJS=frams/_demos/geometry/volume_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o common/virtfile/virtfile.o frams/param/multiparamload.o common/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS)
    6464
    65 GEOMETRY_APICES_TEST_OBJS=frams/_demos/geometry/apices_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS)
     65GEOMETRY_APICES_TEST_OBJS=frams/_demos/geometry/apices_test.o frams/_demos/geometry/geometrytestutils.o frams/_demos/genotypeloader.o common/virtfile/virtfile.o frams/param/multiparamload.o common/virtfile/stdiofile.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GEOMETRY_OBJS)
    6666
    6767SIMIL_TEST_OBJS=frams/_demos/simil_test.o frams/model/similarity/SVD/lapack.o frams/model/similarity/SVD/matrix_tools.o frams/model/similarity/simil_match.o frams/model/similarity/simil_model.o  \
    68      frams/_demos/genotypeloader.o frams/virtfile/virtfile.o frams/param/multiparamload.o frams/virtfile/stdiofile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
     68     frams/_demos/genotypeloader.o common/virtfile/virtfile.o frams/param/multiparamload.o common/virtfile/stdiofile.o frams/loggers/loggertostdout.o $(SDK_OBJS) $(GENOCONV_SDK_OBJS) $(GENMAN_SDK_OBJS)
    6969
    7070SIMIL_UNITTESTS_OBJS=frams/_demos/simil_unittests.o frams/model/similarity/simil_match.o
  • cpp/frams/_demos/f0_variants_test.cpp

    r375 r382  
    66#include <stdio.h>
    77#include <time.h>
    8 #include <frams/virtfile/stdiofile.h>
     8#include <common/virtfile/stdiofile.h>
    99
    1010#include <frams/genetics/defgenoconv.h>
  • cpp/frams/_demos/full_props.cpp

    r375 r382  
    66#include <stdio.h>
    77#include <time.h>
    8 #include <frams/virtfile/stdiofile.h>
     8#include <common/virtfile/stdiofile.h>
    99
    1010#include <frams/model/model.h>
  • cpp/frams/_demos/geno_test.cpp

    r375 r382  
    33// See LICENSE.txt for details.
    44
    5 #include <frams/virtfile/stdiofile.h>
     5#include <common/virtfile/stdiofile.h>
    66#include <frams/util/sstringutils.h>
    77#include <frams/genetics/preconfigured.h>
  • cpp/frams/_demos/genomanipulation.cpp

    r375 r382  
    66#include <stdio.h>
    77#include <time.h>
    8 #include <frams/virtfile/stdiofile.h>
     8#include <common/virtfile/stdiofile.h>
    99
    1010#include <frams/model/model.h>
  • cpp/frams/_demos/geometry/geometrytestutils.cpp

    r348 r382  
    66
    77#include "../genotypeloader.h"
    8 #include <frams/virtfile/stdiofile.h>
     8#include <common/virtfile/stdiofile.h>
    99#include <math.h>
    1010#include <stdio.h>
  • cpp/frams/_demos/loader_test.cpp

    r348 r382  
    44
    55#include "genotypeloader.h"
    6 #include <frams/virtfile/stdiofile.h>
     6#include <common/virtfile/stdiofile.h>
    77
    88/**
  • cpp/frams/_demos/loader_test_param.cpp

    r375 r382  
    44
    55#include <frams/param/multiparamload.h>
    6 #include <frams/virtfile/stdiofile.h>
     6#include <common/virtfile/stdiofile.h>
    77#include <frams/loggers/loggertostdout.h>
    88
  • cpp/frams/_demos/multiline_f0_test.cpp

    r375 r382  
    66#include <stdio.h>
    77#include <time.h>
    8 #include <frams/virtfile/stdiofile.h>
     8#include <common/virtfile/stdiofile.h>
    99
    1010#include <frams/genetics/preconfigured.h>
    1111#include <frams/model/model.h>
    1212#include <frams/loggers/loggertostdout.h>
    13 #include <frams/virtfile/stringfile.h>
     13#include <common/virtfile/stringfile.h>
    1414
    1515int main(int argc,char*argv[])
  • cpp/frams/_demos/neuro_layout_test.cpp

    r375 r382  
    33// See LICENSE.txt for details.
    44
    5 #include <frams/virtfile/stdiofile.h>
     5#include <common/virtfile/stdiofile.h>
    66#include <frams/util/sstringutils.h>
    77#include <frams/genetics/preconfigured.h>
  • cpp/frams/_demos/neuro_test.cpp

    r375 r382  
    44
    55#include <frams/genetics/geno.h>
    6 #include <frams/virtfile/stdiofile.h>
     6#include <common/virtfile/stdiofile.h>
    77#include <frams/util/sstringutils.h>
    88#include <frams/genetics/preconfigured.h>
  • cpp/frams/_demos/shapeconvert.cpp

    r375 r382  
    66#include <stdio.h>
    77#include <time.h>
    8 #include <frams/virtfile/stdiofile.h>
     8#include <common/virtfile/stdiofile.h>
    99
    1010#include <frams/model/model.h>
  • cpp/frams/_demos/simil_test.cpp

    r375 r382  
    88#include "frams/_demos/genotypeloader.h"
    99#include "frams/genetics/preconfigured.h"
    10 #include "frams/virtfile/stdiofile.h"
     10#include "common/virtfile/stdiofile.h"
    1111#include "frams/model/similarity/simil_model.h"
    1212
  • cpp/frams/loggers/loggertostdout.h

    r378 r382  
    77
    88#include "loggers.h"
    9 #include <frams/virtfile/virtfile.h>
     9#include <common/virtfile/virtfile.h>
    1010
    1111class LoggerToStdout : public LoggerBase
  • cpp/frams/param/multiparamload.h

    r333 r382  
    88#include <stdio.h>
    99#include "param.h"
    10 #include <frams/virtfile/virtfile.h>
     10#include <common/virtfile/virtfile.h>
    1111#include <frams/util/extvalue.h>
    1212
  • cpp/frams/param/param.h

    r375 r382  
    1111#include <frams/util/list.h>
    1212#include <frams/util/statrick.h>
    13 #include <frams/virtfile/virtfile.h>
     13#include <common/virtfile/virtfile.h>
    1414#include <common/log.h>
    1515
  • cpp/frams/util/sstringutils.cpp

    r375 r382  
    44
    55#include "sstringutils.h"
    6 #include <frams/virtfile/virtfile.h>
     6#include <common/virtfile/virtfile.h>
    77#include <common/log.h>
    88#include <common/nonstd.h>
  • cpp/frams/util/sstringutils.h

    r286 r382  
    77
    88#include "sstring.h"
    9 #include <frams/virtfile/virtfile.h>
     9#include <common/virtfile/virtfile.h>
    1010
    1111/// return: 1=ok 0=error
  • cpp/frams/vm/framscript.l

    r348 r382  
    7676                    if (end)
    7777                       {
    78                        trctx.tmp+=SString(yytext,end-yytext);
    79                        framscriptlval.setString(quoteMultiline(trctx.tmp));
     78                       trctx.tmp+=string(yytext,end-yytext);
     79                       framscriptlval.setString(quoteMultiline(SString(trctx.tmp.c_str())));
    8080                       yyless((end-yytext)+3);
    8181                       BEGIN 0;
     
    8383                       }
    8484                    else
    85                        trctx.tmp+=SString(yytext,yyleng);
     85                       trctx.tmp+=string(yytext,yyleng);
    8686                    }
    8787<multiline>\n       {trctx.line++; trctx.linechanged=true; trctx.tmp+="\n";}
  • cpp/frams/vm/framscript.y

    r375 r382  
    526526                   trstack.adjust(+1);
    527527                   }
    528            trctx.tmp=0;
     528           trctx.tmp="";
    529529           trctx.divertOut();
    530530           //trctx.out->printf("# expr#3\n");
     
    535535           if (!$7.constant) { trctx.out->printf("inc m0\n"); trstack.adjust(+1); }
    536536           trctx.restoreOut();
    537            $$.setString(trctx.tmp);
     537           $$.setString(trctx.tmp.c_str());
    538538           //trctx.out->printf("# pseudoblok_statement pos=%d\n",trstack.currentPos());
    539539           }
Note: See TracChangeset for help on using the changeset viewer.