#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <math.h>
#include "doc_compile.hh"
#include "sigtype.hh"
#include "floats.hh"
#include "sigprint.hh"
#include "sigtyperules.hh"
#include "recursivness.hh"
#include "simplify.hh"
#include "privatise.hh"
#include "prim2.hh"
#include "xtended.hh"
#include "compatibility.hh"
#include "ppsig.hh"
#include "names.hh"
#include "doc.hh"
#include "tlib.hh"
#include "doc_notice.hh"
Go to the source code of this file.
Functions | |
bool | getSigListNickName (Tree t, Tree &id) |
static void | extractMetadata (const string &fulllabel, string &label, map< string, set< string > > &metadata) |
Extracts metadata from a UI label : 'vol [unit: dB]' -> 'vol' + metadata map. | |
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 bool | isVerySimpleFormula (Tree sig) |
Test if exp is very simple that is it can't be considered a real component. | |
static bool | isSeparator (char c) |
tests if a charactere is a word separator | |
static string | replaceTimeBy (const string &src, char r) |
Replaces the occurences of 't' in a formula with another character. | |
Variables | |
bool | gLessTempSwitch |
int | gMaxCopyDelay |
map< string, string > | gDocMathStringMap |
static const unsigned int | MAX_RIGHT_MEMBER = 20 |
static const unsigned int | MAX_SUB_EXPR = 10 |
static void extractMetadata | ( | const string & | fulllabel, | |
string & | label, | |||
map< string, set< string > > & | metadata | |||
) | [static] |
Extracts metadata from a UI label : 'vol [unit: dB]' -> 'vol' + metadata map.
Definition at line 1345 of file doc_compile.cpp.
References rmWhiteSpaces().
Referenced by DocCompiler::getUIDocInfos().
01346 { 01347 enum {kLabel, kEscape1, kEscape2, kEscape3, kKey, kValue}; 01348 int state = kLabel; int deep = 0; 01349 string key, value; 01350 01351 for (unsigned int i=0; i < fulllabel.size(); i++) { 01352 char c = fulllabel[i]; 01353 switch (state) { 01354 case kLabel : 01355 assert (deep == 0); 01356 switch (c) { 01357 case '\\' : state = kEscape1; break; 01358 case '[' : state = kKey; deep++; break; 01359 default : label += c; 01360 } 01361 break; 01362 01363 case kEscape1 : 01364 label += c; 01365 state = kLabel; 01366 break; 01367 01368 case kEscape2 : 01369 key += c; 01370 state = kKey; 01371 break; 01372 01373 case kEscape3 : 01374 value += c; 01375 state = kValue; 01376 break; 01377 01378 case kKey : 01379 assert (deep > 0); 01380 switch (c) { 01381 case '\\' : state = kEscape2; 01382 break; 01383 01384 case '[' : deep++; 01385 key += c; 01386 break; 01387 01388 case ':' : if (deep == 1) { 01389 state = kValue; 01390 } else { 01391 key += c; 01392 } 01393 break; 01394 case ']' : deep--; 01395 if (deep < 1) { 01396 metadata[rmWhiteSpaces(key)].insert(""); 01397 state = kLabel; 01398 key=""; 01399 value=""; 01400 } else { 01401 key += c; 01402 } 01403 break; 01404 default : key += c; 01405 } 01406 break; 01407 01408 case kValue : 01409 assert (deep > 0); 01410 switch (c) { 01411 case '\\' : state = kEscape3; 01412 break; 01413 01414 case '[' : deep++; 01415 value += c; 01416 break; 01417 01418 case ']' : deep--; 01419 if (deep < 1) { 01420 metadata[rmWhiteSpaces(key)].insert(rmWhiteSpaces(value)); 01421 state = kLabel; 01422 key=""; 01423 value=""; 01424 } else { 01425 value += c; 01426 } 01427 break; 01428 default : value += c; 01429 } 01430 break; 01431 01432 default : 01433 cerr << "ERROR unrecognized state (in extractMetadata) : " << state << endl; 01434 } 01435 } 01436 label = rmWhiteSpaces(label); 01437 }
static bool isSeparator | ( | char | c | ) | [static] |
tests if a charactere is a word separator
Definition at line 780 of file doc_compile.cpp.
Referenced by replaceTimeBy().
00781 { 00782 bool w = ( ((c >= 'a') && (c <='z')) 00783 || ((c >= 'A') && (c <='Z')) 00784 || ((c >= '0') && (c <='9')) 00785 ); 00786 00787 return ! w; 00788 }
static bool isVerySimpleFormula | ( | Tree | sig | ) | [static] |
Test if exp is very simple that is it can't be considered a real component.
exp | the signal we want to test |
Definition at line 503 of file doc_compile.cpp.
References isSigButton(), isSigCheckbox(), isSigFConst(), isSigHSlider(), isSigInput(), isSigInt(), isSigNumEntry(), isSigReal(), isSigVSlider(), and name().
Referenced by DocCompiler::generateCacheCode().
00504 { 00505 int i; 00506 double r; 00507 Tree type, name, file, label, c, x, y, z; 00508 00509 return isSigInt(sig, &i) 00510 || isSigReal(sig, &r) 00511 || isSigInput(sig, &i) 00512 || isSigFConst(sig, type, name, file) 00513 || isSigButton(sig, label) 00514 || isSigCheckbox(sig, label) 00515 || isSigVSlider(sig, label,c,x,y,z) 00516 || isSigHSlider(sig, label,c,x,y,z) 00517 || isSigNumEntry(sig, label,c,x,y,z) 00518 ; 00519 }
static string replaceTimeBy | ( | const string & | src, | |
char | r | |||
) | [static] |
Replaces the occurences of 't' in a formula with another character.
Definition at line 794 of file doc_compile.cpp.
References isSeparator().
Referenced by DocCompiler::generateDocWriteTbl().
00795 { 00796 string dst; 00797 char pre = 0; 00798 for (size_t i=0; i < src.size(); i++) 00799 { 00800 char x = src[i]; 00801 if ((x=='t') && isSeparator(pre) && ((i == src.size()-1) || isSeparator(src[i+1]))) { 00802 dst.push_back(r); 00803 } else { 00804 dst.push_back(x); 00805 } 00806 pre = x; 00807 } 00808 return dst; 00809 }
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 1444 of file doc_compile.cpp.
Referenced by extractMetadata().
01445 { 01446 size_t i = s.find_first_not_of(" \t"); 01447 size_t j = s.find_last_not_of(" \t"); 01448 01449 if ( (i != string::npos) & (j != string::npos) ) { 01450 return s.substr(i, 1+j-i); 01451 } else { 01452 return ""; 01453 } 01454 }
map<string, string> gDocMathStringMap |
bool gLessTempSwitch |
Definition at line 128 of file main.cpp.
Referenced by process_cmdline().
int gMaxCopyDelay |
Definition at line 129 of file main.cpp.
Referenced by VectorCompiler::dlineLoop(), SchedulerCompiler::dlineLoop(), ScalarCompiler::generateDelayLine(), ScalarCompiler::generateDelayVecNoTemp(), VectorCompiler::generateFixDelay(), ScalarCompiler::generateFixDelay(), and process_cmdline().
const unsigned int MAX_RIGHT_MEMBER = 20 [static] |
Definition at line 65 of file doc_compile.cpp.
const unsigned int MAX_SUB_EXPR = 10 [static] |
Definition at line 66 of file doc_compile.cpp.