#include "allobjects.h"
#include "modsupport.h"
+#include <ctype.h>
+
static object *
strop_split(self, args)
i = 0;
while (i < len) {
while (i < len &&
- ((c = s[i]) == ' ' || c == '\t' || c == '\n')) {
+ ((c = s[i]), isspace(c))) {
i = i+1;
}
j = i;
while (i < len &&
- !((c = s[i]) == ' ' || c == '\t' || c == '\n')) {
+ !((c = s[i]), isspace(c))) {
i = i+1;
}
if (j < i) {
return NULL;
i = 0;
- while (i < len && ((c = s[i]) == ' ' || c == '\t' || c == '\n')) {
+ while (i < len && ((c = s[i]), isspace(c))) {
i++;
}
j = len;
do {
j--;
- } while (j >= i && ((c = s[j]) == ' ' || c == '\t' || c == '\n'));
+ } while (j >= i && ((c = s[j]), isspace(c)));
j++;
if (i == 0 && j == len) {
}
-#include <ctype.h>
-
static object *
strop_lower(self, args)
object *self; /* Not used */
void
initstrop()
{
- initmodule("strop", strop_methods);
+ object *m, *d, *s;
+ char buf[256];
+ int c, n;
+ m = initmodule("strop", strop_methods);
+ d = getmoduledict(m);
+ n = 0;
+ for (c = 1; c < 256; c++) {
+ if (isspace(c))
+ buf[n++] = c;
+ }
+ s = newsizedstringobject(buf, n);
+ dictinsert(d, "whitespace", s);
+ DECREF(s);
}