IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10073


Ignore:
Timestamp:
Nov 17, 2006, 5:04:25 PM (19 years ago)
Author:
eugene
Message:

added additional chars to whitespace checks

Location:
trunk/Ohana/src
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/imregister/base/ConfigFilter.c

    r2803 r10073  
    7272  for (i = 0; i < strlen (line); i++, p++) {
    7373    *p = line[i];
    74     if (whitespace(line[i])) {
     74    if (OHANA_WHITESPACE(line[i])) {
    7575      *p = '.';
    7676      if (blank) p--;
  • trunk/Ohana/src/imregister/base/misc.c

    r4836 r10073  
    109109 
    110110   
    111 /* replaces whitespace blocks with single . */
     111/* replaces WHITESPACE blocks with single . */
    112112void clean_spaces (char *line) {
    113113
     
    118118  out = in = line;
    119119  while (*in) {
    120     if (whitespace(*in)) {
     120    if (OHANA_WHITESPACE(*in)) {
    121121      *out = '.';
    122122      out ++;
    123123      in ++;
    124       while (*in && whitespace(*in)) in++;
     124      while (*in && OHANA_WHITESPACE(*in)) in++;
    125125    } else {
    126126      *out = *in;
  • trunk/Ohana/src/libfits/header/F_modify.c

    r7054 r10073  
    117117 
    118118  c += 2;
    119   /* advance pointer over whitespace */
     119  /* advance pointer over WHITESPACE */
    120120  while ((*c == ' ') && (c < line + 80)) { c++; }
    121121 
     
    137137  c1 += 2;
    138138
    139   /* advance pointer over whitespace */
     139  /* advance pointer over WHITESPACE */
    140140  while ((*c1 == ' ') && (c1 < line + 80)) { c1++; }
    141141 
  • trunk/Ohana/src/libfits/header/F_scan.c

    r7054 r10073  
    4242    Nchar = MIN (80, p + 80 - q);
    4343    memcpy (tmp, q, Nchar);
    44     gfits_stripwhite (tmp);
     44    stripwhite (tmp);
    4545    strcpy (va_arg (argp, char *), tmp);
    4646    return (TRUE);
     
    5555    bzero (tmp, 81);
    5656    memcpy (tmp, s, Nchar);
    57     gfits_stripwhite (tmp);
     57    stripwhite (tmp);
    5858    strcpy (va_arg (argp, char *), tmp);
    5959    return (TRUE);
     
    9494/* if the variable argument stuff breaks on another system, look
    9595at F_modify.c as it has the old code */
    96 
    97 #ifndef whitespace
    98 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
    99 #endif
    100 
    101 /* Strip whitespace from the start and end of STRING. */
    102 int gfits_stripwhite (char *string) {
    103 
    104   int i;
    105 
    106   if (string == (char *) NULL)
    107     return (FALSE);
    108 
    109   for (i = 0; whitespace (string[i]); i++);
    110   if (i) memmove (string, string + i, strlen(string+i)+1);
    111   for (i = strlen (string) - 1; (i > 0) && whitespace (string[i]); i--);
    112   string[++i] = 0;
    113 
    114   return (i);
    115 
    116 }
    117 
    118 # if (0)
    119     one_quote = FALSE;
    120     tmp[0] = *(p + 10);
    121     if (tmp[0] == 0x27)
    122       one_quote = TRUE;
    123     /* end the string if we hit: a -- end of line (80 chars) b -- NEWLINE c -- '(0x27: single quote) (end of string) */
    124     for (i = 1; (i < 70) && (p[i + 10] != NEWLINE) && ((p[i + 10] != 0x27) || !one_quote); i++) {
    125       tmp[i] = *(p + 10 + i);
    126       if ((tmp[i] == 0x27) && !one_quote)
    127         one_quote = TRUE;
    128       if ((tmp[i] == 0x2f) && !one_quote)
    129         break;
    130     }
    131     tmp[i] = 0;
    132     if ((c = strchr (tmp, 0x27)) != NULL)
    133       *c = ' ';
    134 # endif
  • trunk/Ohana/src/libkapa/src/DrawRotString.c

    r5854 r10073  
    2626
    2727  unsigned char *bitmap;
    28   char *currentname, basename[64], *c;
     28  char *currentname, basename[64];
    2929  int i, dy, dx, N, X, Y, code;
    3030  int dX, Xoff, dY, Yoff, YoffBase;
     
    3838  basesize = currentsize;
    3939
    40   /* strip leading whitespace */
    41   for (c = string; (*c == ' ') || (*c == '\t'); c++);
    42   if (*c == 0) return (FALSE);
     40  /* strip leading WHITESPACE */
     41  stripwhite (string);
     42  if (*string == 0) return (FALSE);
    4343 
    4444  /* compute string length */
    4545  cs = cos(angle*RAD_DEG);
    4646  sn = sin(angle*RAD_DEG);
    47   dX = RotStrlen (c);
     47  dX = RotStrlen (string);
    4848  dY = currentfont[65].ascent;
    4949
     
    6666  YoffBase = Yoff;
    6767  /* draw characters one-by-one */
    68   for (i = 0; i < strlen(c); i++) {
    69     N = (int)(c[i]);
     68  for (i = 0; i < strlen(string); i++) {
     69    N = (int)(string[i]);
    7070    if ((N < 0) || (N >= NROTCHARS)) continue;
    7171
     
    9595      }
    9696      if (N == 38) {
    97         if (c[i+1] == 'h') {
     97        if (string[i+1] == 'h') {
    9898          SetRotFont ("helvetica", currentsize);
    9999          currentfont = GetRotFontData (&currentscale);
    100100        }
    101         if (c[i+1] == 't') {
     101        if (string[i+1] == 't') {
    102102          SetRotFont ("times", currentsize);
    103103          currentfont = GetRotFontData (&currentscale);
    104104        }
    105         if (c[i+1] == 'c') {
     105        if (string[i+1] == 'c') {
    106106          SetRotFont ("courier", currentsize);
    107107          currentfont = GetRotFontData (&currentscale);
    108108        }
    109         if (c[i+1] == 's') {
     109        if (string[i+1] == 's') {
    110110          SetRotFont ("symbol", currentsize);
    111111          currentfont = GetRotFontData (&currentscale);
  • trunk/Ohana/src/libkapa/src/PSRotFont.c

    r5854 r10073  
    66void PSRotText (FILE *f, int x, int y, char *string, int pos, double angle) {
    77
    8   char *c, *segment, basename[64], *currentname;
     8  char *segment, basename[64], *currentname;
    99  int i, N, code;
    1010  int dX, dY, Xoff, Yoff, X, Y, Nseg, NSEG, YoffBase;
     
    1818  basesize = currentsize;
    1919
    20   /* strip off leading whitespace */
    21   for (c = string; (*c == ' ') || (*c == '\t'); c++);
    22   if (*c == 0) return;
     20  /* strip off leading WHITESPACE */
     21  stripwhite (string);
     22  if (*string == 0) return;
    2323 
    2424  /* compute string length */
     
    2929  if (!strcmp (currentname, "helvetica")) fscale = 0.9;
    3030  if (!strcmp (currentname, "symbol")) fscale = 1.2;
    31   dX = fscale*RotStrlen (c);
     31  dX = fscale*RotStrlen (string);
    3232  dY = currentfont[65].ascent;
    3333 
     
    5555
    5656  Nseg = 0;
    57   NSEG = strlen(c) + 2;
     57  NSEG = strlen(string) + 2;
    5858  ALLOCATE (segment, char, NSEG);
    5959  bzero (segment, NSEG);
     
    6262  YoffBase = 0;
    6363  /* accumulate string segments with common state */
    64   for (i = 0; i < strlen (c); i++) {
    65     N = (int)(c[i]);
     64  for (i = 0; i < strlen (string); i++) {
     65    N = (int)(string[i]);
    6666    if ((N < 0) || (N >= NROTCHARS)) continue;
    6767
     
    122122      if (N == 38) {
    123123        PSDumpRotSegment (f, segment, &Nseg);
    124         if (c[i+1] == 'h') {
     124        if (string[i+1] == 'h') {
    125125          SetRotFont ("helvetica", currentsize);
    126126          currentfont = GetRotFontData (&currentscale);
    127127          PSSetFont (f, currentname, currentsize);
    128128        }
    129         if (c[i+1] == 't') {
     129        if (string[i+1] == 't') {
    130130          SetRotFont ("times", currentsize);
    131131          currentfont = GetRotFontData (&currentscale);
    132132          PSSetFont (f, currentname, currentsize);
    133133        }
    134         if (c[i+1] == 'c') {
     134        if (string[i+1] == 'c') {
    135135          SetRotFont ("courier", currentsize);
    136136          currentfont = GetRotFontData (&currentscale);
    137137          PSSetFont (f, currentname, currentsize);
    138138        }
    139         if (c[i+1] == 's') {
     139        if (string[i+1] == 's') {
    140140          SetRotFont ("symbol", currentsize);
    141141          currentfont = GetRotFontData (&currentscale);
  • trunk/Ohana/src/libkapa/src/bDrawRotFont.c

    r5854 r10073  
    2727  basesize = currentsize;
    2828
    29   /* strip leading whitespace */
    30   for (c = string; (*c == ' ') || (*c == '\t'); c++);
    31   if (*c == 0) return (FALSE);
     29  /* strip leading WHITESPACE */
     30  stripwhite (string);
     31  if (*string == 0) return (FALSE);
    3232 
    3333  /* compute string length */
    3434  cs = cos(angle*RAD_DEG);
    3535  sn = sin(angle*RAD_DEG);
    36   dX = RotStrlen (c);
     36  dX = RotStrlen (string);
    3737  dY = currentfont[65].ascent;
    3838
     
    5555  YoffBase = Yoff;
    5656  /* draw characters one-by-one */
    57   for (i = 0; i < strlen(c); i++) {
    58     N = (int)(c[i]);
     57  for (i = 0; i < strlen(string); i++) {
     58    N = (int)(string[i]);
    5959    if ((N < 0) || (N >= NROTCHARS)) continue;
    6060
     
    8484      }
    8585      if (N == 38) {
    86         if (c[i+1] == 'h') {
     86        if (string[i+1] == 'h') {
    8787          SetRotFont ("helvetica", currentsize);
    8888          currentfont = GetRotFontData (&currentscale);
    8989        }
    90         if (c[i+1] == 't') {
     90        if (string[i+1] == 't') {
    9191          SetRotFont ("times", currentsize);
    9292          currentfont = GetRotFontData (&currentscale);
    9393        }
    94         if (c[i+1] == 'c') {
     94        if (string[i+1] == 'c') {
    9595          SetRotFont ("courier", currentsize);
    9696          currentfont = GetRotFontData (&currentscale);
    9797        }
    98         if (c[i+1] == 's') {
     98        if (string[i+1] == 's') {
    9999          SetRotFont ("symbol", currentsize);
    100100          currentfont = GetRotFontData (&currentscale);
  • trunk/Ohana/src/libohana/include/ohana.h

    r8633 r10073  
    9393# endif /* FOPEN */
    9494
     95/*
     96  isspace is c99 : do we require c99 now?
     97  isspace()
     98   checks  for white-space characters.  In the "C" and "POSIX" locales, these are: space, form-feed ('\f'), newline ('\n'),
     99   carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v').
     100   horiz. tab: 0x09, vert. tab: 0x0b, newline: 0x0a, form-feed: 0x0c, return: 0x0d, space: 0x20,
     101*/
     102# define OHANA_WHITESPACE(c)(((c) == 0x09) || ((c) == 0x0a) || ((c) == 0x0b) || ((c) == 0x0b) || ((c) == 0x0c) || ((c) == 0x0d) || ((c) == 0x20))
     103
    95104/* socket / pipe communication buffer */
    96105typedef struct {
  • trunk/Ohana/src/libohana/src/config.c

    r2647 r10073  
    11# include <ohana.h>
    2 # ifndef whitespace
    3 # define whitespace(c) (((c) == ' ') || ((c) == '\t'))
    4 # endif
    52
    63# define D_NBYTES 4096
     
    278275    }
    279276    p2 = tmp + strlen (tfield);
    280     if (whitespace (*p2)) {
     277    if (OHANA_WHITESPACE (*p2)) {
    281278      p = p2;
    282279      i++;
  • trunk/Ohana/src/libohana/src/string.c

    r8633 r10073  
    11# include <ohana.h>
    22
    3 #ifndef whitespace
    4 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
    5 #endif
    6 
    7 /* Strip whitespace from the start and end of STRING. */
     3/* Strip WHITESPACE from the start and end of STRING. */
    84int stripwhite (char *string) {
    95
     
    128  if (string == (char *) NULL) return (FALSE);
    139
    14   for (i = 0; whitespace (string[i]); i++);
     10  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    1511  if (i) memmove (string, string + i, strlen(string+i)+1);
    16   for (i = strlen (string) - 1; (i > 0) && whitespace (string[i]); i--);
     12  for (i = strlen (string) - 1; (i > 0) && OHANA_WHITESPACE (string[i]); i--);
    1713  string[++i] = 0;
    1814  return (i);
  • trunk/Ohana/src/misc/src/string.c

    r2417 r10073  
    11# include <ohana.h>
    22
    3 /* Strip whitespace from the start and end of STRING. */
     3/* Strip WHITESPACE from the start and end of STRING. */
    44int stripwhite (string)
    55char *string;
     
    1010    return (FALSE);
    1111
    12   for (i = 0; whitespace (string[i]); i++);
     12  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    1313  if (i) memmove (string, string + i, strlen(string+i)+1);
    14   for (i = strlen (string) - 1; (i > 0) && whitespace (string[i]); i--);
     14  for (i = strlen (string) - 1; (i > 0) && OHANA_WHITESPACE (string[i]); i--);
    1515  string[++i] = 0;
    1616  return (i);
  • trunk/Ohana/src/misc/src/test.c

    r7080 r10073  
    2323# define ISNUM(c) (isdigit(c) || (c == '-') || (c == '.'))
    2424
    25 /* Strip whitespace from the start and end of STRING. */
     25/* Strip WHITESPACE from the start and end of STRING. */
    2626int stripwhite (string)
    2727char *string;
     
    3232    return (0);
    3333
    34   for (i = 0; whitespace (string[i]); i++);
     34  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    3535
    3636  if (i)
     
    3939  i = strlen (string) - 1;
    4040
    41   for (; (i > 0) && whitespace (string[i]); i--);
     41  for (; (i > 0) && OHANA_WHITESPACE (string[i]); i--);
    4242
    4343  string[++i] = 0;
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r9726 r10073  
    100100int vgrid            PROTO((int, char **));
    101101int vgauss           PROTO((int, char **));
     102int vmaxwell         PROTO((int, char **));
    102103int vload            PROTO((int, char **));
    103104int vstat            PROTO((int, char **));
     
    211212  {"select",       vect_select,      "selective vector assignment"},
    212213  {"vgauss",       vgauss,           ""},
     214  {"vmaxwell",     vmaxwell,         ""},
    213215  {"vgrid",        vgrid,            ""},
    214216  {"vload",        vload,            "load vectors on Kii"},
  • trunk/Ohana/src/opihi/lib.shell/expand_vars.c

    r9844 r10073  
    3838    if (*L == 0) break;
    3939
    40     V1 = aftervar (L);           /* V1 points to the first non-whitespace after the variable */
     40    V1 = aftervar (L);           /* V1 points to the first non-WHITESPACE after the variable */
    4141    V0 = thisvar (L);            /* V0 points to the name of the var */
    4242    /* note: V1 points to a fraction of L, it does not need to be freed */
  • trunk/Ohana/src/opihi/lib.shell/expand_vectors.c

    r7917 r10073  
    5050
    5151    /* find vector name */
    52     for (w = p - 1; (w >= line) && !whitespace(*w) && (isalnum(*w) || (*w == ':') || (*w == '_')); w--);
     52    for (w = p - 1; (w >= line) && !OHANA_WHITESPACE(*w) && (isalnum(*w) || (*w == ':') || (*w == '_')); w--);
    5353    w ++;
    5454    n = (int)(p - w);
  • trunk/Ohana/src/opihi/lib.shell/isolate_elements.c

    r7917 r10073  
    121121      }
    122122      /* not an operator, not a quoted string */
    123       if (!whitespace (in[i][j])) {
     123      if (!OHANA_WHITESPACE (in[i][j])) {
    124124        InsertValue (in[i][j]);
    125125      } else {
  • trunk/Ohana/src/opihi/lib.shell/opihi.c

    r7917 r10073  
    3333      continue;
    3434    }
     35
    3536    Nbad = 0;
    3637    ohana_memregister (line);
  • trunk/Ohana/src/opihi/lib.shell/parse.c

    r7917 r10073  
    5151    if (*V1 != '=') goto error;
    5252
    53     /* find first non-whitespace character after = */
     53    /* find first non-WHITESPACE character after = */
    5454    V1 ++;
    5555    while (isspace (*V1)) V1++;
     
    9393      val = dvomath (1, &V1, &size, 0);
    9494      if (val == NULL) {
    95         while (whitespace (*V1)) V1++;
     95        while (OHANA_WHITESPACE (*V1)) V1++;
    9696        val = strcreate (V1);
    9797      }
  • trunk/Ohana/src/opihi/lib.shell/string.c

    r7917 r10073  
    33/**********************************************************************/
    44/* returns a pointer to an isolated string containing the first word,
    5    removing leading whitespace.  A "word" is a contiguous set of
     5   removing leading WHITESPACE.  A "word" is a contiguous set of
    66   characters from the set: alphanumerics, and any of: / . _ -
    7    Any other single, non-whitespace characters are considered to be
     7   Any other single, non-WHITESPACE characters are considered to be
    88   complete words in themselves.  Any characters surrounded by quotes
    99   make a single word
     
    1717  if (string == (char *) NULL) return ((char *) NULL);
    1818
    19   for (i = 0; whitespace (string[i]); i++);
     19  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    2020  if (string[i] == 0) return ((char *)NULL);
    2121  if (string[i] == ';') {
     
    6363
    6464
    65   for (j = i; (string[j] != 0) && (string[j] != ';') && !whitespace(string[j]); j++);
     65  for (j = i; (string[j] != 0) && (string[j] != ';') && !OHANA_WHITESPACE(string[j]); j++);
    6666  word = strncreate (&string[i], j - i);
    6767  return (word);
     
    7070
    7171/* returns a pointer to an isolated string containing the first command,
    72    removing leading whitespace.  A command ends with the first non whitespace */
     72   removing leading WHITESPACE.  A command ends with the first non WHITESPACE */
    7373char *thiscomm (char *string) {
    7474
     
    7878  if (string == (char *) NULL) return ((char *) NULL);
    7979
    80   for (i = 0; whitespace (string[i]); i++);
     80  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    8181  if (string[i] == 0) return ((char *)NULL);
    8282
    83   for (j = i; ((string[j] != 0) && !whitespace (string[j])); j++);
     83  for (j = i; ((string[j] != 0) && !OHANA_WHITESPACE (string[j])); j++);
    8484  if (i == j) return ((char *) NULL);
    8585
     
    122122  if (string == (char *) NULL) return ((char *) NULL);
    123123
    124   for (i = 0; whitespace (string[i]); i++);
     124  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    125125  if (string[i] == 0) return ((char *)NULL);
    126126
     
    134134    }
    135135    i++;
    136     for (; (string[i] != 0) && whitespace (string[i]); i++);
     136    for (; (string[i] != 0) && OHANA_WHITESPACE (string[i]); i++);
    137137    if (string[i] == 0) return ((char *) NULL);
    138138    return (&string[i]);
     
    155155      return ((char *)NULL);
    156156    }
    157     for (; (string[i] != 0) && whitespace (string[i]); i++);
     157    for (; (string[i] != 0) && OHANA_WHITESPACE (string[i]); i++);
    158158    if (string[i] == 0) return ((char *) NULL);
    159159    return (&string[i]);
     
    161161
    162162  if (string[i] == ';') i++;
    163   for (; (string[i] != 0) && (string[i] != ';') && !whitespace(string[i]); i++);
    164   for (; (string[i] != 0) && whitespace (string[i]); i++);
     163  for (; (string[i] != 0) && (string[i] != ';') && !OHANA_WHITESPACE(string[i]); i++);
     164  for (; (string[i] != 0) && OHANA_WHITESPACE (string[i]); i++);
    165165  if (string[i] == 0) return ((char *) NULL);
    166166
     
    169169
    170170/* returns a pointer to the next command, or (char *) NULL
    171    if there is not a next command.  A command is bounded by whitespace */
     171   if there is not a next command.  A command is bounded by WHITESPACE */
    172172char *nextcomm (char *string) {
    173173
     
    176176  if (string == (char *) NULL) return ((char *) NULL);
    177177 
    178   for (i = 0; (string[i] != 0) && !whitespace (string[i]); i++);
     178  for (i = 0; (string[i] != 0) && !OHANA_WHITESPACE (string[i]); i++);
    179179  if (string[i] == 0) return ((char *) NULL);
    180180 
    181   for (; whitespace (string[i]); i++);
     181  for (; OHANA_WHITESPACE (string[i]); i++);
    182182  if (string[i] == 0) return ((char *) NULL);
    183183
     
    193193  if (c == (char *) NULL) return ((char *) NULL);
    194194
    195   for (; !whitespace(*c) && (c >= string); c--);
     195  for (; !OHANA_WHITESPACE(*c) && (c >= string); c--);
    196196  if (c < string) return ((char *)NULL);
    197197
    198   for (; whitespace(*c) && (c >= string); c--);
     198  for (; OHANA_WHITESPACE(*c) && (c >= string); c--);
    199199  if (c < string)
    200200    return ((char *)NULL);
    201   for (; !whitespace(*c) && (c >= string); c--);
     201  for (; !OHANA_WHITESPACE(*c) && (c >= string); c--);
    202202  c++;
    203203  return (c);
     
    207207
    208208/* take a pointer to the beginning of a variable (ie $fred) and return
    209    a pointer to the next thing (non whitespace) which is not part of the
     209   a pointer to the next thing (non WHITESPACE) which is not part of the
    210210   variable extract only the variable name */
    211211
     
    224224  if (i == start) return ((char *) NULL);
    225225
    226   for (j = i; whitespace (string[j]); j++);
     226  for (j = i; OHANA_WHITESPACE (string[j]); j++);
    227227  if (string[j] == 0) return ((char *)NULL);
    228228
     
    240240  if (c == (char *) NULL) return ((char *) NULL);
    241241
    242   for (; (c >= string) && whitespace(*c); c--);
     242  for (; (c >= string) && OHANA_WHITESPACE(*c); c--);
    243243  if (c < string) return ((char *)NULL);
    244244
Note: See TracChangeset for help on using the changeset viewer.