MIDAS  0.75
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
librw.cpp
Go to the documentation of this file.
1 #include "librw.h"
2 
3 #include "gelib.h"
4 #include "arrays.h"
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <ctype.h>
10 
11 
12 namespace midaspace {
13 
14 #define CHECK_DEST if (!dest) _errorr("destination is not allocated")
15 
20 bool isWordChar (char C)
21 {
22  return ( ( C == ' ' || C == '\t' || C == '\n' || C == '\0' || C == '\r' || C == EOF) ? false : true);
23 }
24 
26 bool isLineChar (char C)
27 {
28  return ( ( C == '\n' || C == '\0' || C == '\r' || C == EOF) ? false : true);
29 }
30 
32 bool isSpaceChar (char C)
33 {
34  return ( ( C == ' ' || C == '\t' ) ? true : false);
35 }
36 
37 bool isDigitChar (char C)
38 {
39  return ( ( C < 48 || C > 57 ) ? false : true);
40 }
41 
43 long giveLineLength (const char *src)
44 {
45  long n = 0;
46  while (isLineChar(src[n])) n++;
47 
48  return n;
49 }
50 
53 char* strdupl (const char *src)
54 {
55  if (src==NULL) return NULL;
56  long len = strlen (src) + 1;
57  char *dest = new char[len];
58  return (char *) memcpy (dest, src, len);
59 }
60 char* strdupl (const char *src1, const char *src2)
61 {
62  char *aux = new char[strlen(src1) + strlen(src2) + 1];
63  sprintf (aux, "%s%s", src1, src2);
64  return aux;
65 }
66 char* strdupl (const char *src1, const char *src2, const char *src3)
67 {
68  char *aux = new char[strlen(src1) + strlen(src2) + strlen(src3) + 1];
69  sprintf (aux, "%s%s%s", src1, src2, src3);
70  return aux;
71 }
72 
73 char* pathstrdupl (const char *src)
74 {
75  long len = strlen (src) + 2;
76  char *dest = new char[len];
77  memcpy (dest, src, len);
78  if (dest[len-3] != DIRSEPARATOR) {
79  dest[len-2] = DIRSEPARATOR;
80  dest[len-1] = '\0';
81  }
82  return (char *) dest;
83 }
84 
85 
94 
97 long AP_find_option (int argc, char *argv[], const char *s)
98 {
99  for (int i=1; i<argc; i++)
100  if (!_STRCASECMP(s,argv[i])) return i;
101 
102  return 0;
103 }
104 
106 void AP_fprint_arguments (FILE *stream, int argc, char *argv[])
107 {
108  fprintf (stream,"\n Command line:");
109  fprintf (stream,"\n %s ",argv[0]);
110  for (int i=1;i<argc;i++)
111  fprintf (stream," %c",argv[i][0]);
112 
113  fprintf (stream,"\n options: ");
114  for (int i=1;i<argc;i++)
115  fprintf (stream," %s",argv[i]);
116 
117  fprintf (stream,"\n\n");
118 }
119 
120 
121 
127 
128 
130 bool FP_skip_comment (FILE *stream)
131 {
132  char c;
133  while (true) {
134  c = getc(stream);
135  if (c == EOF) { ungetc(c, stream); return false; }
136  if (! isWordChar(c)) continue;
137  if (c == '#') FP_skip_line (stream);
138  else { ungetc(c, stream); return true; }
139  }
140 
141  return false;
142 }
143 
145 void FP_skip_line_commented (FILE *stream)
146 {
147  char c;
148  while ((c = getc(stream)) == '#')
149  FP_skip_line (stream);
150 
151  ungetc (c, stream);
152 }
153 
155 void FP_skip_line_fast_skip_commented (FILE *stream, int n)
156 {
157  char c;
158  while (n--) {
159  c = getc(stream);
160  if (c == '\n') continue;
161  if (c == '#' ) n++;
162  while ( getc(stream) != '\n') ;
163  }
164 }
165 
167 bool FP_skip_line (FILE *stream, int n)
168 {
169  char c;
170  while (n--)
171  while (true) {
172  c = getc(stream);
173  if (c == '\n') break;
174  if (c == EOF ) { ungetc(c, stream); return false; }
175  }
176 
177  return true;
178 }
179 
181 bool FP_skip_behind_line_starting_with (FILE *stream, const char *string, bool cs)
182 {
183  while (true) {
184  if ( FP_skip_expected_string (stream, string, cs)) return (FP_skip_line (stream));
185  if (!FP_skip_line (stream)) return false;
186  }
187 }
188 
190 bool FP_skip_to_line_starting_with (FILE *stream, const char *string, bool cs)
191 {
192  while (true) {
193  if ( FP_skip_expected_string (stream, string, cs)) return true;
194  if (!FP_skip_line (stream)) return false;
195  }
196 }
197 
200 bool FP_skip_to_line_starting_with (FILE *stream, char C)
201 {
202  char c;
203  while ( (c = fgetc (stream)) != C )
204  while (c != '\n')
205  if (c == EOF ) { ungetc(c, stream); return false; }
206  else c = fgetc(stream);
207 
208  ungetc (c, stream);
209  return true;
210 }
211 
212 
214 bool FP_scan_array (FILE *stream, int n, int *dest) { while (n--) if (fscanf (stream, "%d", dest++) == 0) return false; return true; }
215 bool FP_scan_array (FILE *stream, int n, long *dest) { while (n--) if (fscanf (stream, "%ld", dest++) == 0) return false; return true; }
216 bool FP_scan_array (FILE *stream, int n, double *dest) { while (n--) if (fscanf (stream, "%lf", dest++) == 0) return false; return true; }
217 
218 
220 long FP_number_of_words (FILE *stream)
221 {
222  char c;
223  long answer = 0;
224  bool space = true;
225 
226  while ((c = getc(stream)) != EOF)
227  if (isWordChar(c)) {
228  if (space) {
229  answer++;
230  space = false;
231  }
232  }
233  else
234  space = true;
235 
236  return answer;
237 }
238 
240 long FP_number_of_lines (FILE *stream, bool rwd)
241 {
242  int c;
243  long lines = 0, fp = 0;
244 
245  if (rwd) fp = ftell(stream);
246 
247  while ((c = getc(stream)) != EOF)
248  if(c == '\n')
249  lines++;
250 
251  if (rwd) fseek(stream, fp, SEEK_SET);
252 
253  return lines;
254 }
255 
256 
257 
262 
264 bool FP_skip_nonword (FILE *stream)
265 {
266  char c;
267  while ((c = getc(stream)) != EOF)
268  if (isWordChar(c)) {
269  ungetc (c, stream);
270  return true;
271  }
272 
273  ungetc (c, stream);
274  return false;
275 }
277 bool FP_skip_space (FILE *stream)
278 {
279  char c;
280  while ((c = getc(stream)) != EOF)
281  if (!isSpaceChar(c)) {
282  ungetc (c, stream);
283  return true;
284  }
285 
286  ungetc (c, stream);
287  return false;
288 }
290 bool FP_skip_word (FILE *stream)
291 {
292  //FP_skip_space (stream); toto odkomentuj a pust testy !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
293  char c;
294  while (true) {
295  c = getc(stream);
296  if (!isWordChar(c)) break;
297  }
298 
299  ungetc (c, stream);
300  return true;
301 }
302 
307 
309 long FP_scan_line_skip_emptyORcommented (FILE *stream, char *dest)
310 {
311  char c;
312  FP_skip_space (stream);
313  while ((c = getc(stream)) == '#' || c == '\n')
314  if (c == '#') FP_skip_line (stream);
315 
316  ungetc (c, stream);
317 
318  return FP_scan_line (stream, dest);
319 }
321 long FP_scan_line (FILE *stream, char *dest)
322 {
323  long n=0;
324  while (isLineChar(dest[n] = getc(stream)))
325  n++;
326 
327  if (dest[n] == EOF) {
328  ungetc(EOF, stream);
329  if (n==0) return -1;
330  }
331 
332  if (dest[n] == '\r') getc(stream); // win end of line
333  //if (dest[n] == '\r') { dest[n+1] = getc(stream); if (dest[n+1] == '\r') getc(stream); } // vorlasovo docasne
334 
335  dest[n] = '\0';
336 
337  return n;
338 }
340 long FP_scan_line_alloc (FILE *stream, char *&dest)
341 {
342  if (dest) _errorr("allocated");
343 
344  char aux[10001];
345  long n = FP_scan_line (stream, aux);
346 
347  dest = new char[n+1];
348 
349  long i = n+1;
350  while (i--) dest[i] = aux[i];
351 
352  return n;
353 }
354 
356 int FP_scan_word (FILE *src, char *dest)
357 {
358  if (! FP_skip_nonword (src)) return 0;
359 
360  // scan word
361  char c;
362  register int n = 0;
363  while (true) {
364  c = getc(src);
365  if (isWordChar(c)) dest[n++] = c;
366  else break;
367  }
368 
369  ungetc (c, src);
370  dest[n] = '\0';
371 
372  return n;
373 }
374 
376 bool FP_skip_expected_string (FILE *src, const char *expctd, bool cs)
377 {
378  char c;
379  register int n = 0;
380 
381  if (cs) while (expctd[n] != '\0') { c = getc(src); if ( c != expctd[n] ) { ungetc (c, src); break; } n++; }
382  else while (expctd[n] != '\0') { c = getc(src); if (tolower(c) != tolower(expctd[n])) { ungetc (c, src); break; } n++; }
383 
384  return (expctd[n] == '\0');
385 }
386 
388 bool FP_scan_expected_word (FILE *src, const char *expctd, bool cs)
389 {
390  if (! FP_skip_nonword (src)) return false;
391  if (! FP_skip_expected_string (src, expctd, cs)) return false;
392 
393  FP_skip_word (src);
394  return true;
395 }
396 
398 void FP_scan_expected_word_FL (const char* file, int line, FILE *src, const char *expctd, const char *msg, bool cs)
399 {
400  if (!FP_scan_expected_word (src, expctd, cs)) errorr_expected (file, line, msg, expctd, NULL);
401 }
402 
404 bool FP_scan_expected_line (FILE *src, const char *expctd, bool cs)
405 {
406  if (! FP_skip_space (src)) return false;
407  if (! FP_skip_expected_string (src, expctd, cs)) return false;
408  if (! FP_skip_space (src)) return false;
409 
410  char c = getc(src);
411  if (c == '\r') c = getc(src);
412  if (c == EOF) ungetc(c, src);
413  if (c == '\n') return true;
414 
415  return false;
416 }
417 
419 void FP_scan_expected_line_FL (const char* file, int line, FILE *src, const char *expctd, const char *msg, bool cs)
420 {
421  if (!FP_scan_expected_line (src, expctd, cs)) errorr_expected (file, line, msg, expctd, NULL);
422 }
423 
424 
425 
426 
432 
433 void errorr_expected (const char* file, int line, const char *msg, const char *expctd, const char *src) { errorr (file, line, "%s, expected \"%s\" != \"%s\"", msg, expctd, src); }
434 void errorr_expected (const char* file, int line, const char *msg, int expctd, const char *src) { errorr (file, line, "%s, expected \"%d\" != \"%s\"", msg, expctd, src); }
435 void errorr_expected (const char* file, int line, const char *msg, long expctd, const char *src) { errorr (file, line, "%s, expected \"%ld\" != \"%s\"", msg, expctd, src); }
436 
438 bool SP_cutcomment (char *src)
439 {
440  while (*src != '\0')
441  if (*src != '#') src++;
442  else {
443  while (*(--src) == ' ') ;
444  src[1] = '\0';
445  return true;
446  }
447 
448  return false;
449 }
450 
451 
456 
458 bool SP_unskip_space (const char *&src)
459 {
460  while (src[-1]==' ' || src[-1]=='\t') src--;
461  return true;
462 }
463 
465 bool SP_skip_space (const char *&src)
466 {
467  while (src[0]==' ' || src[0]=='\t') src++;
468  return true;
469 }
470 
472 bool SP_skip_word (const char *&src, int n)
473 {
474  while (n--) {
475  SP_skip_space (src);
476  // check word presence
477  if (src[0]=='\n' || src[0]=='\0') return false;
478  // skip word
479  while ( isWordChar(src[0]) ) src++;
480  }
481 
482  return true;
483 }
484 
486 bool SP_skip_int (const char *&src)
487 {
488  SP_skip_space (src);
489  // check word presence
490  if (src[0]=='\n' || src[0]=='\0') return false;
491 
492  // skip sign
493  if (src[0]=='+' || src[0]=='-') src++;
494  // skip word
495  while ( isDigitChar(src[0]) ) src++;
496 
497  return true;
498 }
499 
504 void SP_unscan_word (const char *&src, const char *w)
505 {
506  SP_unskip_space (src);
507  // find length of word
508  long n = strlen(w);
509  src = src-n;
510 
511  while (n--) if (src[n] != w[n]) _errorr ("unscan error");
512 }
513 
515 
517 bool SP_scan_character (const char *&src, char &dest)
518 {
519  SP_skip_space (src);
520  //
521  if (src[0]=='\n' || src[0]=='\0' || src[0]=='\r')
522  return false;
523 
524  dest = src[0]; src++;
525  return true;
526 }
528 long SP_scan_word (const char *&src, char *dest)
529 {
530  SP_skip_space (src);
531 
532  // find length of word
533  long n=0;
534  while (isWordChar(src[n])) n++;
535  // copy word
536  strncpy (dest, src, n);
537  dest[n] = '\0';
538  // shift src pointer
539  src += n;
540 
541  return n;
542 }
544 long SP_scan_line (const char *&src, char *dest)
545 {
546  CHECK_DEST;
547 
548  long n=0;
549  while (isLineChar(src[n])) {
550  dest[n] = src[n];
551  n++;
552  }
553  dest[n] = '\0';
554  src += n;
555 
556  return n;
557 }
559 long SP_scan_line_alloc (const char *&src, char *&dest)
560 {
561  if (dest) _errorr("allocated");
562 
563  SP_skip_space (src);
564 
565  long n = giveLineLength (src);
566 
567  dest = new char[n+1];
568 
569  long i = n;
570  while (i--) dest[i] = src[i];
571 
572  dest[n] = '\0';
573 
574  src += n;
575 
576  return n;
577 }
578 
580 bool SP_scan_expected_word (const char *&src, const char *expctd, bool cs)
581 {
582  SP_skip_space (src);
583  register int n = -1;
584  if (cs) { while (expctd[++n] != '\0') if ( src[n] != expctd[n] ) return false; }
585  else { while (expctd[++n] != '\0') if (tolower(src[n]) != tolower(expctd[n])) return false; }
586  src += n;
587  return true;
588 }
590 void SP_scan_expected_word_FL (const char* file, int line, const char *&src, const char *expctd, const char *msg, bool cs) { if ( !SP_scan_expected_word (src, expctd, cs)) errorr_expected (file, line, msg, expctd, src); }
591 void SP_scan_expected_word_FL (const char* file, int line, const char *&src, const char *expctd1, const char *expctd2, const char *msg, bool cs) { if ( !SP_scan_expected_word (src, expctd2, cs) && !SP_scan_expected_word (src, expctd1, cs)) errorr (file, line, "%s, expected \"%s\" or \"%s\" != \"%s\"", msg, expctd1, expctd2, src); }
592 void SP_scan_expected_word_FL (const char* file, int line, const char *&src, const char *expctd1, const char *expctd2, const char *expctd3, const char *msg, bool cs) { if (!SP_scan_expected_word (src, expctd3, cs) && !SP_scan_expected_word (src, expctd2, cs) && !SP_scan_expected_word (src, expctd1, cs)) errorr (file, line, "%s, expected \"%s\" or \"%s\" or \"%s\" != \"%s\"", msg, expctd1, expctd2, expctd2, src); }
593 
595 bool SP_scan_number (const char *&src, int &dest) { sscanf (src, "%d", &dest); return SP_skip_int (src); }
596 bool SP_scan_number (const char *&src, long &dest) { sscanf (src, "%ld", &dest); return SP_skip_int (src); }
597 bool SP_scan_number (const char *&src, double &dest) { sscanf (src, "%lf", &dest); return SP_skip_word (src); }
598 
599 
601 bool SP_scan_array_L (const char *&src, int L, double *a)
602 {
603  if (!SP_scan_expected_number (src, L)) {
604  _warningg2 ("The length of array of doubles is not \"%d\"", L);
605  return false;
606  }
607  return SP_scan_array (src, L, a);
608 }
609 
611 bool SP_scan_Dvctr_exit (const char *&src, int n, Dvctr *v)
612 {
613  if (!SP_scan_expected_number (src, n)) _errorr("unexpected number of components in scanned array");
614  v->resize_ignore_vals(n);
615  return SP_scan_array (src, n, v->give_ptr2val());
616 }
617 
618 
623 
625 bool SP_print_space (const char *&src, FILE *stream)
626 {
627  while ( isSpaceChar(src[0]) ) {
628  fprintf (stream, "%c", src[0]);
629  src++;
630  }
631  return true;
632 }
633 
635 bool SP_print_word (const char *&src, FILE *stream)
636 {
637  SP_skip_space (src);
638  while ( isWordChar(src[0]) ) {
639  fprintf (stream, "%c", src[0]);
640  src++;
641  }
642  return true;
643 }
644 
645 
649 long find_double (long n, long* p)
650 {
651  int i, j;
652 
653  for (i=0; i<n; i++)
654  for (j=i+1; j<n; j++)
655  if (p[i]==p[j]) return i+1;
656 
657  return 0;
658 }
659 
660 
661 void sprint_param (char *s, char *argv[], int n)
662 {
663  ; sprintf (strchr(s,'\0'), " ");
664  while (n--) sprintf (strchr(s,'\0'), " %s", *(argv-n));
665 }
666 
667 
668 void read_star_end (FILE *stream,int n)
669 {
670  while (n--) { read_star (stream); FP_skip_line (stream); }
671 }
672 void read_star (FILE *stream)
673 {
674  char c;
675  while ((c = getc (stream)) != '*' ) ;
676  ungetc (c,stream);
677 }
678 
679 void copy_star_end (FILE *sour,FILE *dest,int n)
680 {
681  while (n--) { copy_star (sour,dest); copy_line (sour,dest); }
682 }
683 void copy_star (FILE *sour,FILE *dest)
684 {
685  char c;
686  while ((c = getc (sour)) != '*') putc (c,dest);
687  ungetc (c,sour);
688 }
689 void copy_line (FILE *sour,FILE *dest,int n)
690 {
691  char c;
692  while (n--) do{ c=getc(sour); putc(c,dest); } while(c!='\n');
693 }
694 
695 void copy_to_end_line (FILE *sour,FILE *dest)
696 {
697  char c;
698  while ((c = getc (sour)) != '\n') putc (c,dest);
699  ungetc ('\n',sour);
700 }
701 
702 void copy_file (FILE *sour,FILE *dest)
703 {
704  int c;
705  while ((c = getc(sour)) != EOF) putc (c,dest);
706 }
707 
708 int extract_long (const char *s1, const char *s2, long &a)
709 {
710  const char *ss = strstr (s1,s2);
711  if (ss==NULL) return 1;
712  ss += strlen(s2);
713  sscanf (ss,"%ld",&a);
714  return 0;
715 }
716 
718 int extract_double (const char *s1, const char *s2, double &a)
719 {
720  const char *ss = strstr (s1,s2);
721  if (ss==NULL) return 1;
722  ss += strlen(s2);
723  sscanf (ss,"%lf",&a);
724  return 0;
725 }
726 
727 
728 void ad_line (FILE *stream,char *s)
729 {
730  char c;
731  long l = strlen (s);
732  char* ss = s + l;
733  register long i=0;
734  while ((c = getc(stream)) != '\n') ss[i++] = c;
735  ss[i] = '\0';
736 }
737 
738 } // namespace midaspace
char * strdupl(const char *src)
standard strdup - Memory for the new string is obtained with malloc(3), and can be freed with free(3)...
Definition: librw.cpp:53
void errorr(const char *file, int line, const char *format,...)
*** *** *** *** ERROR FCE *** *** *** ***
Definition: gelib.cpp:10
bool FP_skip_to_line_starting_with(FILE *stream, const char *string, bool cs)
move file descriptor to the line starting with string, exactly behind the string
Definition: librw.cpp:190
void SP_unscan_word(const char *&src, const char *w)
*** *** *** SCANNING *** *** *** unscan word == shift pointer back over word
Definition: librw.cpp:504
void ad_line(FILE *stream, char *s)
Definition: librw.cpp:728
bool SP_print_word(const char *&src, FILE *stream)
... word
Definition: librw.cpp:635
int FP_scan_word(FILE *src, char *dest)
... word; return value is length of the word
Definition: librw.cpp:356
bool SP_print_space(const char *&src, FILE *stream)
*** *** *** PRINTING *** *** *** printing == print ...
Definition: librw.cpp:625
void FP_skip_line_commented(FILE *stream)
move file descriptor to the start of the new noncommented line, without checking of EOF ...
Definition: librw.cpp:145
void FP_skip_line_fast_skip_commented(FILE *stream, int n)
move file descriptor to the start of the n-th new line, without checking of EOF
Definition: librw.cpp:155
bool SP_scan_expected_number(const char *&src, ArgType expctd)
... number and compare with expected one
Definition: librw.h:214
bool SP_unskip_space(const char *&src)
*** *** *** SKIPING *** *** *** (un)skiping == shift src pointer at the end(start) of ...
Definition: librw.cpp:458
General functions.
long SP_scan_word(const char *&src, char *dest)
... word; return value is length of the word
Definition: librw.cpp:528
long FP_number_of_lines(FILE *stream, bool rwd)
count number of lines in file
Definition: librw.cpp:240
long find_double(long n, long *p)
*** *** *** *** OBSOLETE FUNCTIONS *** *** *** ***
Definition: librw.cpp:649
Input / output function.
void copy_star(FILE *sour, FILE *dest)
Definition: librw.cpp:683
long FP_scan_line_skip_emptyORcommented(FILE *stream, char *dest)
*** *** *** SCANNING *** *** *** scanning == scan ...
Definition: librw.cpp:309
void sprint_param(char *s, char *argv[], int n)
Definition: librw.cpp:661
#define DIRSEPARATOR
Definition: gelib.h:25
bool SP_skip_word(const char *&src, int n)
... word and space before
Definition: librw.cpp:472
bool isDigitChar(char C)
Definition: librw.cpp:37
void errorr_expected(const char *file, int line, const char *msg, const char *expctd, const char *src)
*** *** *** *** STRING PROCESSING *** *** *** *** src pointer is always shifted over the skipped/sc...
Definition: librw.cpp:433
void read_star(FILE *stream)
Definition: librw.cpp:672
char * pathstrdupl(const char *src)
Definition: librw.cpp:73
Structs Elem3D, PoinT and VectoR; classes Array, Array1d, Xscal, Dscal, Xvctr, Lvctr, Dvctr, Xmtrx, Lmtrx and Dmtrx.
Dvctr * resize_ignore_vals(long newsize)
Definition: arrays.h:595
bool isLineChar(char C)
return true if character C is "normal" char or "space" char –> C != ' ' '\0' '' ...
Definition: librw.cpp:26
long FP_number_of_words(FILE *stream)
count number of words (see isWordChar) in file
Definition: librw.cpp:220
long SP_scan_line(const char *&src, char *dest)
... line; return value is length of the line
Definition: librw.cpp:544
long SP_scan_line_alloc(const char *&src, char *&dest)
... line; return value is length of the line; dest is NULL and allocated here
Definition: librw.cpp:559
long giveLineLength(const char *src)
return length of line == sting compount of "line chars"
Definition: librw.cpp:43
void FP_scan_expected_word_FL(const char *file, int line, FILE *src, const char *expctd, const char *msg, bool cs)
... word and compare with expected one, exit if false
Definition: librw.cpp:398
void copy_file(FILE *sour, FILE *dest)
Definition: librw.cpp:702
bool isWordChar(char C)
*** *** *** *** GENERAL FUNCTIONS *** *** *** *** return true if character C is "normal" char –> C...
Definition: librw.cpp:20
#define _warningg2(_1, _2)
Definition: gelib.h:157
bool SP_scan_Dvctr_exit(const char *&src, int n, Dvctr *v)
Definition: librw.cpp:611
bool FP_skip_line(FILE *stream, int n)
move file descriptor to the start of the n-th new line //[former read_line]
Definition: librw.cpp:167
long FP_scan_line(FILE *stream, char *dest)
scan/copy line == string without ' ' from stream
Definition: librw.cpp:321
bool SP_skip_space(const char *&src)
... space == ' ' and '' characters
Definition: librw.cpp:465
void copy_line(FILE *sour, FILE *dest, int n)
Definition: librw.cpp:689
#define _STRCASECMP
Definition: gelib.h:38
void SP_scan_expected_word_FL(const char *file, int line, const char *&src, const char *expctd, const char *msg, bool cs)
... word and compare with expected one/two/three, exit if false
Definition: librw.cpp:590
#define _errorr(_1)
Definition: gelib.h:151
bool SP_scan_character(const char *&src, char &dest)
scanning == scan ... to variable dest and shift src pointer at the end of ...
Definition: librw.cpp:517
void copy_star_end(FILE *sour, FILE *dest, int n)
read line of file until , no save, dava bacha na EOF
Definition: librw.cpp:679
bool FP_scan_expected_line(FILE *src, const char *expctd, bool cs)
... line and compare with expected one
Definition: librw.cpp:404
bool FP_skip_expected_string(FILE *src, const char *expctd, bool cs)
... word and compare with expected one
Definition: librw.cpp:376
bool FP_skip_space(FILE *stream)
... space
Definition: librw.cpp:277
bool FP_skip_behind_line_starting_with(FILE *stream, const char *string, bool cs)
move file descriptor to the start of the new line after the one starting with string ...
Definition: librw.cpp:181
void read_star_end(FILE *stream, int n)
Definition: librw.cpp:668
bool SP_scan_array_L(const char *&src, int L, double *a)
Definition: librw.cpp:601
bool FP_skip_nonword(FILE *stream)
*** *** *** SKIPING *** *** *** skiping == shift stream pointer at the first char which is not ...
Definition: librw.cpp:264
bool SP_scan_expected_word(const char *&src, const char *expctd, bool cs)
... word and compare with expected one
Definition: librw.cpp:580
void copy_to_end_line(FILE *sour, FILE *dest)
Definition: librw.cpp:695
bool SP_skip_int(const char *&src)
... word compound of digits and space before
Definition: librw.cpp:486
int extract_double(const char *s1, const char *s2, double &a)
v retezci s1 se najde key retezec s2 a za nim se precte double
Definition: librw.cpp:718
bool SP_scan_array(const char *&src, int n, ArgType *a)
... array of numbers
Definition: librw.h:233
bool SP_scan_number(const char *&src, int &dest)
... number of type int/long/double
Definition: librw.cpp:595
int extract_long(const char *s1, const char *s2, long &a)
Definition: librw.cpp:708
double * give_ptr2val(long i=0)
return pointer to
Definition: arrays.h:618
long AP_find_option(int argc, char *argv[], const char *s)
*** *** *** *** ARGUMENTS PROCESSING *** *** *** *** terminology: tar -cz -f archiv.tgz archiv/ /// fce name | arguments /// fce name | options | parameters /// fce name | opt | opt | opt argum.
Definition: librw.cpp:97
bool FP_skip_word(FILE *stream)
... word
Definition: librw.cpp:290
long FP_scan_line_alloc(FILE *stream, char *&dest)
scan/copy line == string without ' ' from stream; dest is NULL and allocated here ...
Definition: librw.cpp:340
bool SP_cutcomment(char *src)
cut of comment == end of line starting by '#'
Definition: librw.cpp:438
bool FP_scan_array(FILE *stream, int n, int *dest)
scan/copy array of numbers from src to dest, src pointer is shifted over the field ...
Definition: librw.cpp:214
bool isSpaceChar(char C)
return true if character C is "space" char –> C == ' ' ''
Definition: librw.cpp:32
void FP_scan_expected_line_FL(const char *file, int line, FILE *src, const char *expctd, const char *msg, bool cs)
... line and compare with expected one, exit if false
Definition: librw.cpp:419
bool FP_scan_expected_word(FILE *src, const char *expctd, bool cs)
... word and compare with expected one
Definition: librw.cpp:388
void AP_fprint_arguments(FILE *stream, int argc, char *argv[])
print arguments to stream
Definition: librw.cpp:106
bool FP_skip_comment(FILE *stream)
*** *** *** *** FILE PROCESSING *** *** *** *** general rules for file processing: ...
Definition: librw.cpp:130
#define CHECK_DEST
Definition: librw.cpp:14