60 std::string
dtos(
double d){
71 output+=
itos(bits[i]);
77 std::vector<bool>
itob(
int val,
int nbit){
80 std::vector<bool>
bits(nbit);
86 bits[i]=(vsat/power==1);
93 int stoi(std::string value){
94 const unsigned int codage=2;
96 char h[codage]={
'0',
'1'};
97 const unsigned int size=value.size();
98 const char* word=value.c_str();
102 for (
unsigned int j=0; j<codage && !isSeen; j++){
103 if (h[j]==word[pos]){
104 result+=int(j*pow(2.,(
int)(size-pos-1)));
117 size_t found = s.find(
",");
118 if(found != std::string::npos)
120 return atof(s.c_str());
127 int size = instruction.size();
133 if ( format.empty() || std::string::npos==format.find_first_not_of(
' ') ) {
139 std::string line = std::string (format,
140 format.find_first_not_of(
' ') ,
142 std::vector<std::string> cmd;
143 std::string separator(1,
' ');
144 unsigned int ipos = line.find( separator );
145 cmd.push_back ( std::string( line, 0, ipos ) );
146 if ( 0!=std::string ( line , 0 , ipos ).compare(instruction[0]) ){
147 application()->
info(std::string ( line , 0 , ipos )+
" "+instruction[0],
"");
153 std::string str = line;
154 while ( ipos!=std::string::npos ){
155 std::string tmp = std::string (str, ipos , str.size());
157 pos=str.find_first_not_of(
' ' );
158 if ( pos == std::string::npos ) {
162 ipos = str.find(separator,pos);
164 if (ipos==std::string::npos){
165 arg = std::string(str , pos );
168 arg = std::string(str , pos, ipos - 1);
174 if ( instruction.size() != cmd.size() ){
179 if ( 1==cmd.size() ){
185 if ( 0==cmd[
index].compare(
"%i") || 0==cmd[
index].compare(
"%I") ){
186 if ( !
isInt ( instruction[
index].c_str() ) ) {
190 varlist.push_back (
var( atoi(instruction[
index].c_str()) ) );
193 if ( 0==cmd[
index].compare(
"%f") || 0==cmd[
index].compare(
"%F") ){
198 varlist.push_back(
var ( atof(instruction[
index].c_str()) ) );
207 const char *pChain = chain;
208 while (*pChain!=
'\0') {
209 if ( *pChain!=
'0' && *pChain!=
'1' && *pChain!=
'2' && *pChain!=
'3' &&
210 *pChain!=
'4' && *pChain!=
'5' && *pChain!=
'6' && *pChain!=
'7' &&
211 *pChain!=
'8' && *pChain!=
'9' && *pChain!=
'+' && *pChain!=
'-' &&
224 const char *pChain = chain;
226 while (*pChain!=
'\0') {
227 if ( ( *pChain<'0' || *pChain>
'9' ) ){
229 if ( !first || *pChain!=
'-' ){
264 return std::string(
"not implemented.");
void info(std::string mymsg)
void verbose(std::string mymsg)
void warning(std::string mymsg)