| 72 | |
| 73 | |
| 74 | void PolymakeFile::open(std::istream &f) |
| 75 | { |
| 76 | isXml=false; |
| 77 | // fileName=string(fileName_); |
| 78 | |
| 79 | // FILE *f=fopen(fileName.c_str(),"r"); |
| 80 | // if(!f)//fprintf(Stderr,"Could not open file:\"%s\"\n",fileName_); |
| 81 | // assert(f); |
| 82 | |
| 83 | int c=f.get();//fgetc(f); |
| 84 | while(!f.eof()) |
| 85 | { |
| 86 | if(c=='_') |
| 87 | { |
| 88 | readUntil(f,'\n'); |
| 89 | } |
| 90 | else if(c!='\n') |
| 91 | { |
| 92 | f.unget(); |
| 93 | // ungetc(c,f); |
| 94 | string name=readUntil(f,'\n'); |
| 95 | |
| 96 | // fprintf(Stderr,"Reading:\"%s\"\n",name.c_str()); |
| 97 | stringstream value; |
| 98 | while(1) |
| 99 | { |
| 100 | string l=readUntil(f,'\n'); |
| 101 | if(l.size()==0)break; |
| 102 | value << l <<endl; |
| 103 | } |
| 104 | properties.push_back(PolymakeProperty(name.c_str(),value.str().c_str())); |
| 105 | } |
| 106 | c=f.get();//fgetc(f); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /*void PolymakeFile::open(const char *fileName_) |
| 111 | { |