Changeset 10073
- Timestamp:
- Nov 17, 2006, 5:04:25 PM (19 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 19 edited
-
imregister/base/ConfigFilter.c (modified) (1 diff)
-
imregister/base/misc.c (modified) (2 diffs)
-
libfits/header/F_modify.c (modified) (2 diffs)
-
libfits/header/F_scan.c (modified) (3 diffs)
-
libkapa/src/DrawRotString.c (modified) (4 diffs)
-
libkapa/src/PSRotFont.c (modified) (6 diffs)
-
libkapa/src/bDrawRotFont.c (modified) (3 diffs)
-
libohana/include/ohana.h (modified) (1 diff)
-
libohana/src/config.c (modified) (2 diffs)
-
libohana/src/string.c (modified) (2 diffs)
-
misc/src/string.c (modified) (2 diffs)
-
misc/src/test.c (modified) (3 diffs)
-
opihi/cmd.data/init.c (modified) (2 diffs)
-
opihi/lib.shell/expand_vars.c (modified) (1 diff)
-
opihi/lib.shell/expand_vectors.c (modified) (1 diff)
-
opihi/lib.shell/isolate_elements.c (modified) (1 diff)
-
opihi/lib.shell/opihi.c (modified) (1 diff)
-
opihi/lib.shell/parse.c (modified) (2 diffs)
-
opihi/lib.shell/string.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/imregister/base/ConfigFilter.c
r2803 r10073 72 72 for (i = 0; i < strlen (line); i++, p++) { 73 73 *p = line[i]; 74 if ( whitespace(line[i])) {74 if (OHANA_WHITESPACE(line[i])) { 75 75 *p = '.'; 76 76 if (blank) p--; -
trunk/Ohana/src/imregister/base/misc.c
r4836 r10073 109 109 110 110 111 /* replaces whitespaceblocks with single . */111 /* replaces WHITESPACE blocks with single . */ 112 112 void clean_spaces (char *line) { 113 113 … … 118 118 out = in = line; 119 119 while (*in) { 120 if ( whitespace(*in)) {120 if (OHANA_WHITESPACE(*in)) { 121 121 *out = '.'; 122 122 out ++; 123 123 in ++; 124 while (*in && whitespace(*in)) in++;124 while (*in && OHANA_WHITESPACE(*in)) in++; 125 125 } else { 126 126 *out = *in; -
trunk/Ohana/src/libfits/header/F_modify.c
r7054 r10073 117 117 118 118 c += 2; 119 /* advance pointer over whitespace*/119 /* advance pointer over WHITESPACE */ 120 120 while ((*c == ' ') && (c < line + 80)) { c++; } 121 121 … … 137 137 c1 += 2; 138 138 139 /* advance pointer over whitespace*/139 /* advance pointer over WHITESPACE */ 140 140 while ((*c1 == ' ') && (c1 < line + 80)) { c1++; } 141 141 -
trunk/Ohana/src/libfits/header/F_scan.c
r7054 r10073 42 42 Nchar = MIN (80, p + 80 - q); 43 43 memcpy (tmp, q, Nchar); 44 gfits_stripwhite (tmp);44 stripwhite (tmp); 45 45 strcpy (va_arg (argp, char *), tmp); 46 46 return (TRUE); … … 55 55 bzero (tmp, 81); 56 56 memcpy (tmp, s, Nchar); 57 gfits_stripwhite (tmp);57 stripwhite (tmp); 58 58 strcpy (va_arg (argp, char *), tmp); 59 59 return (TRUE); … … 94 94 /* if the variable argument stuff breaks on another system, look 95 95 at F_modify.c as it has the old code */ 96 97 #ifndef whitespace98 #define whitespace(c) (((c) == ' ') || ((c) == '\t'))99 #endif100 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 26 26 27 27 unsigned char *bitmap; 28 char *currentname, basename[64] , *c;28 char *currentname, basename[64]; 29 29 int i, dy, dx, N, X, Y, code; 30 30 int dX, Xoff, dY, Yoff, YoffBase; … … 38 38 basesize = currentsize; 39 39 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); 43 43 44 44 /* compute string length */ 45 45 cs = cos(angle*RAD_DEG); 46 46 sn = sin(angle*RAD_DEG); 47 dX = RotStrlen ( c);47 dX = RotStrlen (string); 48 48 dY = currentfont[65].ascent; 49 49 … … 66 66 YoffBase = Yoff; 67 67 /* 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]); 70 70 if ((N < 0) || (N >= NROTCHARS)) continue; 71 71 … … 95 95 } 96 96 if (N == 38) { 97 if ( c[i+1] == 'h') {97 if (string[i+1] == 'h') { 98 98 SetRotFont ("helvetica", currentsize); 99 99 currentfont = GetRotFontData (¤tscale); 100 100 } 101 if ( c[i+1] == 't') {101 if (string[i+1] == 't') { 102 102 SetRotFont ("times", currentsize); 103 103 currentfont = GetRotFontData (¤tscale); 104 104 } 105 if ( c[i+1] == 'c') {105 if (string[i+1] == 'c') { 106 106 SetRotFont ("courier", currentsize); 107 107 currentfont = GetRotFontData (¤tscale); 108 108 } 109 if ( c[i+1] == 's') {109 if (string[i+1] == 's') { 110 110 SetRotFont ("symbol", currentsize); 111 111 currentfont = GetRotFontData (¤tscale); -
trunk/Ohana/src/libkapa/src/PSRotFont.c
r5854 r10073 6 6 void PSRotText (FILE *f, int x, int y, char *string, int pos, double angle) { 7 7 8 char * c, *segment, basename[64], *currentname;8 char *segment, basename[64], *currentname; 9 9 int i, N, code; 10 10 int dX, dY, Xoff, Yoff, X, Y, Nseg, NSEG, YoffBase; … … 18 18 basesize = currentsize; 19 19 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; 23 23 24 24 /* compute string length */ … … 29 29 if (!strcmp (currentname, "helvetica")) fscale = 0.9; 30 30 if (!strcmp (currentname, "symbol")) fscale = 1.2; 31 dX = fscale*RotStrlen ( c);31 dX = fscale*RotStrlen (string); 32 32 dY = currentfont[65].ascent; 33 33 … … 55 55 56 56 Nseg = 0; 57 NSEG = strlen( c) + 2;57 NSEG = strlen(string) + 2; 58 58 ALLOCATE (segment, char, NSEG); 59 59 bzero (segment, NSEG); … … 62 62 YoffBase = 0; 63 63 /* 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]); 66 66 if ((N < 0) || (N >= NROTCHARS)) continue; 67 67 … … 122 122 if (N == 38) { 123 123 PSDumpRotSegment (f, segment, &Nseg); 124 if ( c[i+1] == 'h') {124 if (string[i+1] == 'h') { 125 125 SetRotFont ("helvetica", currentsize); 126 126 currentfont = GetRotFontData (¤tscale); 127 127 PSSetFont (f, currentname, currentsize); 128 128 } 129 if ( c[i+1] == 't') {129 if (string[i+1] == 't') { 130 130 SetRotFont ("times", currentsize); 131 131 currentfont = GetRotFontData (¤tscale); 132 132 PSSetFont (f, currentname, currentsize); 133 133 } 134 if ( c[i+1] == 'c') {134 if (string[i+1] == 'c') { 135 135 SetRotFont ("courier", currentsize); 136 136 currentfont = GetRotFontData (¤tscale); 137 137 PSSetFont (f, currentname, currentsize); 138 138 } 139 if ( c[i+1] == 's') {139 if (string[i+1] == 's') { 140 140 SetRotFont ("symbol", currentsize); 141 141 currentfont = GetRotFontData (¤tscale); -
trunk/Ohana/src/libkapa/src/bDrawRotFont.c
r5854 r10073 27 27 basesize = currentsize; 28 28 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); 32 32 33 33 /* compute string length */ 34 34 cs = cos(angle*RAD_DEG); 35 35 sn = sin(angle*RAD_DEG); 36 dX = RotStrlen ( c);36 dX = RotStrlen (string); 37 37 dY = currentfont[65].ascent; 38 38 … … 55 55 YoffBase = Yoff; 56 56 /* 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]); 59 59 if ((N < 0) || (N >= NROTCHARS)) continue; 60 60 … … 84 84 } 85 85 if (N == 38) { 86 if ( c[i+1] == 'h') {86 if (string[i+1] == 'h') { 87 87 SetRotFont ("helvetica", currentsize); 88 88 currentfont = GetRotFontData (¤tscale); 89 89 } 90 if ( c[i+1] == 't') {90 if (string[i+1] == 't') { 91 91 SetRotFont ("times", currentsize); 92 92 currentfont = GetRotFontData (¤tscale); 93 93 } 94 if ( c[i+1] == 'c') {94 if (string[i+1] == 'c') { 95 95 SetRotFont ("courier", currentsize); 96 96 currentfont = GetRotFontData (¤tscale); 97 97 } 98 if ( c[i+1] == 's') {98 if (string[i+1] == 's') { 99 99 SetRotFont ("symbol", currentsize); 100 100 currentfont = GetRotFontData (¤tscale); -
trunk/Ohana/src/libohana/include/ohana.h
r8633 r10073 93 93 # endif /* FOPEN */ 94 94 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 95 104 /* socket / pipe communication buffer */ 96 105 typedef struct { -
trunk/Ohana/src/libohana/src/config.c
r2647 r10073 1 1 # include <ohana.h> 2 # ifndef whitespace3 # define whitespace(c) (((c) == ' ') || ((c) == '\t'))4 # endif5 2 6 3 # define D_NBYTES 4096 … … 278 275 } 279 276 p2 = tmp + strlen (tfield); 280 if ( whitespace(*p2)) {277 if (OHANA_WHITESPACE (*p2)) { 281 278 p = p2; 282 279 i++; -
trunk/Ohana/src/libohana/src/string.c
r8633 r10073 1 1 # include <ohana.h> 2 2 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. */ 8 4 int stripwhite (char *string) { 9 5 … … 12 8 if (string == (char *) NULL) return (FALSE); 13 9 14 for (i = 0; whitespace(string[i]); i++);10 for (i = 0; OHANA_WHITESPACE (string[i]); i++); 15 11 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--); 17 13 string[++i] = 0; 18 14 return (i); -
trunk/Ohana/src/misc/src/string.c
r2417 r10073 1 1 # include <ohana.h> 2 2 3 /* Strip whitespacefrom the start and end of STRING. */3 /* Strip WHITESPACE from the start and end of STRING. */ 4 4 int stripwhite (string) 5 5 char *string; … … 10 10 return (FALSE); 11 11 12 for (i = 0; whitespace(string[i]); i++);12 for (i = 0; OHANA_WHITESPACE (string[i]); i++); 13 13 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--); 15 15 string[++i] = 0; 16 16 return (i); -
trunk/Ohana/src/misc/src/test.c
r7080 r10073 23 23 # define ISNUM(c) (isdigit(c) || (c == '-') || (c == '.')) 24 24 25 /* Strip whitespacefrom the start and end of STRING. */25 /* Strip WHITESPACE from the start and end of STRING. */ 26 26 int stripwhite (string) 27 27 char *string; … … 32 32 return (0); 33 33 34 for (i = 0; whitespace(string[i]); i++);34 for (i = 0; OHANA_WHITESPACE (string[i]); i++); 35 35 36 36 if (i) … … 39 39 i = strlen (string) - 1; 40 40 41 for (; (i > 0) && whitespace(string[i]); i--);41 for (; (i > 0) && OHANA_WHITESPACE (string[i]); i--); 42 42 43 43 string[++i] = 0; -
trunk/Ohana/src/opihi/cmd.data/init.c
r9726 r10073 100 100 int vgrid PROTO((int, char **)); 101 101 int vgauss PROTO((int, char **)); 102 int vmaxwell PROTO((int, char **)); 102 103 int vload PROTO((int, char **)); 103 104 int vstat PROTO((int, char **)); … … 211 212 {"select", vect_select, "selective vector assignment"}, 212 213 {"vgauss", vgauss, ""}, 214 {"vmaxwell", vmaxwell, ""}, 213 215 {"vgrid", vgrid, ""}, 214 216 {"vload", vload, "load vectors on Kii"}, -
trunk/Ohana/src/opihi/lib.shell/expand_vars.c
r9844 r10073 38 38 if (*L == 0) break; 39 39 40 V1 = aftervar (L); /* V1 points to the first non- whitespaceafter the variable */40 V1 = aftervar (L); /* V1 points to the first non-WHITESPACE after the variable */ 41 41 V0 = thisvar (L); /* V0 points to the name of the var */ 42 42 /* 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 50 50 51 51 /* 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--); 53 53 w ++; 54 54 n = (int)(p - w); -
trunk/Ohana/src/opihi/lib.shell/isolate_elements.c
r7917 r10073 121 121 } 122 122 /* not an operator, not a quoted string */ 123 if (! whitespace(in[i][j])) {123 if (!OHANA_WHITESPACE (in[i][j])) { 124 124 InsertValue (in[i][j]); 125 125 } else { -
trunk/Ohana/src/opihi/lib.shell/opihi.c
r7917 r10073 33 33 continue; 34 34 } 35 35 36 Nbad = 0; 36 37 ohana_memregister (line); -
trunk/Ohana/src/opihi/lib.shell/parse.c
r7917 r10073 51 51 if (*V1 != '=') goto error; 52 52 53 /* find first non- whitespacecharacter after = */53 /* find first non-WHITESPACE character after = */ 54 54 V1 ++; 55 55 while (isspace (*V1)) V1++; … … 93 93 val = dvomath (1, &V1, &size, 0); 94 94 if (val == NULL) { 95 while ( whitespace(*V1)) V1++;95 while (OHANA_WHITESPACE (*V1)) V1++; 96 96 val = strcreate (V1); 97 97 } -
trunk/Ohana/src/opihi/lib.shell/string.c
r7917 r10073 3 3 /**********************************************************************/ 4 4 /* returns a pointer to an isolated string containing the first word, 5 removing leading whitespace. A "word" is a contiguous set of5 removing leading WHITESPACE. A "word" is a contiguous set of 6 6 characters from the set: alphanumerics, and any of: / . _ - 7 Any other single, non- whitespacecharacters are considered to be7 Any other single, non-WHITESPACE characters are considered to be 8 8 complete words in themselves. Any characters surrounded by quotes 9 9 make a single word … … 17 17 if (string == (char *) NULL) return ((char *) NULL); 18 18 19 for (i = 0; whitespace(string[i]); i++);19 for (i = 0; OHANA_WHITESPACE (string[i]); i++); 20 20 if (string[i] == 0) return ((char *)NULL); 21 21 if (string[i] == ';') { … … 63 63 64 64 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++); 66 66 word = strncreate (&string[i], j - i); 67 67 return (word); … … 70 70 71 71 /* 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 */ 73 73 char *thiscomm (char *string) { 74 74 … … 78 78 if (string == (char *) NULL) return ((char *) NULL); 79 79 80 for (i = 0; whitespace(string[i]); i++);80 for (i = 0; OHANA_WHITESPACE (string[i]); i++); 81 81 if (string[i] == 0) return ((char *)NULL); 82 82 83 for (j = i; ((string[j] != 0) && ! whitespace(string[j])); j++);83 for (j = i; ((string[j] != 0) && !OHANA_WHITESPACE (string[j])); j++); 84 84 if (i == j) return ((char *) NULL); 85 85 … … 122 122 if (string == (char *) NULL) return ((char *) NULL); 123 123 124 for (i = 0; whitespace(string[i]); i++);124 for (i = 0; OHANA_WHITESPACE (string[i]); i++); 125 125 if (string[i] == 0) return ((char *)NULL); 126 126 … … 134 134 } 135 135 i++; 136 for (; (string[i] != 0) && whitespace(string[i]); i++);136 for (; (string[i] != 0) && OHANA_WHITESPACE (string[i]); i++); 137 137 if (string[i] == 0) return ((char *) NULL); 138 138 return (&string[i]); … … 155 155 return ((char *)NULL); 156 156 } 157 for (; (string[i] != 0) && whitespace(string[i]); i++);157 for (; (string[i] != 0) && OHANA_WHITESPACE (string[i]); i++); 158 158 if (string[i] == 0) return ((char *) NULL); 159 159 return (&string[i]); … … 161 161 162 162 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++); 165 165 if (string[i] == 0) return ((char *) NULL); 166 166 … … 169 169 170 170 /* 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 */ 172 172 char *nextcomm (char *string) { 173 173 … … 176 176 if (string == (char *) NULL) return ((char *) NULL); 177 177 178 for (i = 0; (string[i] != 0) && ! whitespace(string[i]); i++);178 for (i = 0; (string[i] != 0) && !OHANA_WHITESPACE (string[i]); i++); 179 179 if (string[i] == 0) return ((char *) NULL); 180 180 181 for (; whitespace(string[i]); i++);181 for (; OHANA_WHITESPACE (string[i]); i++); 182 182 if (string[i] == 0) return ((char *) NULL); 183 183 … … 193 193 if (c == (char *) NULL) return ((char *) NULL); 194 194 195 for (; ! whitespace(*c) && (c >= string); c--);195 for (; !OHANA_WHITESPACE(*c) && (c >= string); c--); 196 196 if (c < string) return ((char *)NULL); 197 197 198 for (; whitespace(*c) && (c >= string); c--);198 for (; OHANA_WHITESPACE(*c) && (c >= string); c--); 199 199 if (c < string) 200 200 return ((char *)NULL); 201 for (; ! whitespace(*c) && (c >= string); c--);201 for (; !OHANA_WHITESPACE(*c) && (c >= string); c--); 202 202 c++; 203 203 return (c); … … 207 207 208 208 /* 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 the209 a pointer to the next thing (non WHITESPACE) which is not part of the 210 210 variable extract only the variable name */ 211 211 … … 224 224 if (i == start) return ((char *) NULL); 225 225 226 for (j = i; whitespace(string[j]); j++);226 for (j = i; OHANA_WHITESPACE (string[j]); j++); 227 227 if (string[j] == 0) return ((char *)NULL); 228 228 … … 240 240 if (c == (char *) NULL) return ((char *) NULL); 241 241 242 for (; (c >= string) && whitespace(*c); c--);242 for (; (c >= string) && OHANA_WHITESPACE(*c); c--); 243 243 if (c < string) return ((char *)NULL); 244 244
Note:
See TracChangeset
for help on using the changeset viewer.
