#include "timing.hh"
#include "compile.hh"
#include "signals.hh"
#include <string>
#include <list>
#include <set>
#include <map>
#include "sigtype.hh"
#include "smartpointer.hh"
#include "tlib.hh"
#include "property.hh"
#include "loop.hh"
#include "graphSorting.hh"
#include <vector>
#include "uitree.hh"
#include <stack>
#include <iostream>
#include <stdio.h>
#include "sigprint.hh"
#include "ppsig.hh"
#include "sigtyperules.hh"
#include "simplify.hh"
#include "privatise.hh"
Go to the source code of this file.
Functions | |
static string | wdel (const string &s) |
Removes enclosing whitespaces : ' toto ' -> 'toto'. | |
static string | rmWhiteSpaces (const string &s) |
rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not those in the middle of the string) | |
static void | extractMetadata (const string &fulllabel, string &label, map< string, set< string > > &metadata) |
Extracts metdata from a label : 'vol [unit: dB]' -> 'vol' + metadata. | |
Variables | |
int | gDetailsSwitch |
string | gMasterName |
static void extractMetadata | ( | const string & | fulllabel, | |
string & | label, | |||
map< string, set< string > > & | metadata | |||
) | [static] |
Extracts metdata from a label : 'vol [unit: dB]' -> 'vol' + metadata.
Definition at line 178 of file compile.cpp.
References rmWhiteSpaces().
Referenced by Compiler::generateWidgetCode(), and Compiler::generateWidgetMacro().
00179 { 00180 enum {kLabel, kEscape1, kEscape2, kEscape3, kKey, kValue}; 00181 int state = kLabel; int deep = 0; 00182 string key, value; 00183 00184 for (unsigned int i=0; i < fulllabel.size(); i++) { 00185 char c = fulllabel[i]; 00186 switch (state) { 00187 case kLabel : 00188 assert (deep == 0); 00189 switch (c) { 00190 case '\\' : state = kEscape1; break; 00191 case '[' : state = kKey; deep++; break; 00192 default : label += c; 00193 } 00194 break; 00195 00196 case kEscape1 : 00197 label += c; 00198 state = kLabel; 00199 break; 00200 00201 case kEscape2 : 00202 key += c; 00203 state = kKey; 00204 break; 00205 00206 case kEscape3 : 00207 value += c; 00208 state = kValue; 00209 break; 00210 00211 case kKey : 00212 assert (deep > 0); 00213 switch (c) { 00214 case '\\' : state = kEscape2; 00215 break; 00216 00217 case '[' : deep++; 00218 key += c; 00219 break; 00220 00221 case ':' : if (deep == 1) { 00222 state = kValue; 00223 } else { 00224 key += c; 00225 } 00226 break; 00227 case ']' : deep--; 00228 if (deep < 1) { 00229 metadata[rmWhiteSpaces(key)].insert(""); 00230 state = kLabel; 00231 key=""; 00232 value=""; 00233 } else { 00234 key += c; 00235 } 00236 break; 00237 default : key += c; 00238 } 00239 break; 00240 00241 case kValue : 00242 assert (deep > 0); 00243 switch (c) { 00244 case '\\' : state = kEscape3; 00245 break; 00246 00247 case '[' : deep++; 00248 value += c; 00249 break; 00250 00251 case ']' : deep--; 00252 if (deep < 1) { 00253 metadata[rmWhiteSpaces(key)].insert(rmWhiteSpaces(value)); 00254 state = kLabel; 00255 key=""; 00256 value=""; 00257 } else { 00258 value += c; 00259 } 00260 break; 00261 default : value += c; 00262 } 00263 break; 00264 00265 default : 00266 cerr << "ERROR unrecognized state " << state << endl; 00267 } 00268 } 00269 label = rmWhiteSpaces(label); 00270 }
static string rmWhiteSpaces | ( | const string & | s | ) | [static] |
rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not those in the middle of the string)
Definition at line 163 of file compile.cpp.
Referenced by extractMetadata().
00164 { 00165 size_t i = s.find_first_not_of(" \t"); 00166 size_t j = s.find_last_not_of(" \t"); 00167 00168 if ( (i != string::npos) & (j != string::npos) ) { 00169 return s.substr(i, 1+j-i); 00170 } else { 00171 return ""; 00172 } 00173 }
static string wdel | ( | const string & | s | ) | [static] |
Removes enclosing whitespaces : ' toto ' -> 'toto'.
Definition at line 148 of file compile.cpp.
Referenced by Compiler::generateWidgetCode().
00149 { 00150 size_t i = 0; 00151 size_t j = s.size(); 00152 while (i<j && s[i]==' ') i++; 00153 while (j>i && s[j-1] == ' ') j--; 00154 return s.substr(i,j-i); 00155 }
int gDetailsSwitch |
string gMasterName |