26 #include "../include/VarData.h" 30 if(String == NULL)
return 1;
31 int iLen = (int) (strlen(cLine));
35 for(
int i=0;i<iLen;i++){
38 if(cLine[i]==String[0]){
40 for(
int j=i;j<iLen;j++){
43 memset(cVar,0,STRSIZE);
44 strncpy(cVar,cLine+Paren[0],Paren[1]-Paren[0]);
46 for(
int q =0;q<Paren[1]-Paren[0];q++) cVar[q] = cLine[q+Paren[0]];
47 if( (strcmp(cVar,String))==0 ){
48 for(
int l=j;l<iLen;l++){
51 for(
int h=l;h<iLen;h++){
52 if(cLine[h]==
' ' || cLine[h]==
'\n'){
55 strncpy(cVal,cLine+Paren[0],Paren[1]-Paren[0]);
57 sprintf(cVal+Paren[1]-Paren[0],
" ");
59 sscanf(cVal,
"%lf",Value);
84 int iLen = (int) (strlen(Line));
86 printf(
"%s->%s",String,Line);
87 for(
int i=0;i<iLen;i++){
90 if(pLine[i]==String[0]){
92 for(
int j=i;j<iLen;j++){
95 memset(cVar,STRSIZE,
sizeof(
char));
96 strncpy(cVar,Line+Paren[0],Paren[1]-Paren[0]);
98 printf(
" %d %d %s %d\n",Paren[0],Paren[1],cVar,strlen(cVar));
99 if( (strcmp(cVar,String))==0 ){
102 for(
int l=j;l<iLen;l++){
105 for(
int h=l;h<iLen;h++){
106 if(pLine[h]==
' ' || pLine[h]==
'\n'){
109 strncpy(cVal,Line+Paren[0],Paren[1]-Paren[0]);
111 sprintf(cVal+Paren[1]-Paren[0],
" ");
112 sscanf(cVal,
"%lf",Value);
113 printf(
"%s Vale %f\n",cVar,*Value);
132 if(pLine==NULL)
return 0;
138 int iLen = (int) (strlen(pLine));
139 memset(cVar,0,STRSIZE);
140 for(
int i=0;i<iLen;i++){
145 for(
int j=i;j<iLen;j++){
146 if(pLine[j]==
' ' || pLine[j]==
'\n'){
148 strncpy(cVar,pLine+Paren[0],Paren[1]-Paren[0]);
149 sprintf(cVal+Paren[1]-Paren[0],
" ");
150 sscanf(cVar,
"%lf",Value);
161 int sLen = strlen(str);
170 for(
int s=0;s<sLen;s++){
171 if(!strncmp(str+s,mask,strlen(mask)) ){
174 for(
int ss=s;ss<sLen;ss++){
175 if(str[ss] ==
'(' || str[ss] ==
'['){
177 for(
int sss=ss;sss<sLen;sss++){
178 if(str[sss] ==
')' || str[sss] ==
']'){
190 if(!IfContinue)
return 0;
193 char *sNumber = str+sPos;
195 for(
int a=0;a<NArg;a++){
196 sscanf(sNumber+sNum,
"%lf",Val+a);
198 for(
int s=sNum+1;s<sLen-sPos;s++){
199 if(sNumber[s] ==
' '){
200 for(
int ss=s;ss<sLen-sPos;ss++){
201 if(sNumber[ss] !=
' '){
215 if(!strncmp(str,mask,strlen(mask)))
return 1;
216 char *pInit = strpbrk(str,mask);
217 if(pInit == NULL)
return 1;
218 int InitPos = pInit - str + 1;
219 char *pOpen = strpbrk(str+InitPos,
"([{");
220 char *pClose = strpbrk(str+InitPos,
"}])");
222 if(pOpen == NULL || pClose == NULL)
return 1;
223 *sPos = pOpen - str +1;
224 *sLen = pClose - str;
231 int IfContinue =
BraketPos(str,mask,&sPos,&sLen);
232 if(IfContinue)
return 0;
234 memset(Field,
' ',120*
sizeof(
char));
236 strncpy(Field,str+sPos,sLen-sPos);
239 vsscanf(Field,fmt,args);
int Fetch(char *str, char *mask, char *fmt,...)
Retrive from a string the information concerning the mask.
int BraketPos(char *str, char *mask, int *sPos, int *sLen)
Retrive from a string the position of the brakets.
bool ReadString(const char *String, char *cLine, double *Value)
Copy the value in the.
int ReadVal(char *pLine, double *Value)
Copy the value in the String to the Value referring to the position of pLine.