24 return strcons(strlen(data),data);
27 LISP
strcons(
long length,
const char *data)
34 s->storage_as.string.dim = length;
36 memmove(s->storage_as.string.data,data,length+1);
46 s->storage_as.string.data = (
char *)(
void *)data;
47 s->storage_as.string.dim = strlen(data);
51 static int rfs_getc(
unsigned char **p)
58 static void rfs_ungetc(
unsigned char c,
unsigned char **p)
87 data = s->storage_as.string.data;
95 return(
flocons((
double)string->storage_as.string.dim));}
105 char *downsym =
wstrdup(symname);
109 for (i=0; symname[i] !=
'\0'; i++)
110 if (isupper(symname[i]))
111 downsym[i] = tolower(symname[i]);
113 downsym[i] = symname[i];
124 char *upsym =
wstrdup(symname);
128 for (i=0; symname[i] !=
'\0'; i++)
129 if (islower(symname[i]))
130 upsym[i] = toupper(symname[i]);
132 upsym[i] = symname[i];
174 lpaths =
cdr(lpaths);
178 lpaths =
cdr(lpaths);
207 for (i=strlen(pathstr); i >= 0; i--)
208 if (pathstr[i] ==
'/')
211 for (j=strlen(pathstr),k=strlen(suff); k >= 0; k--,j--)
212 if (pathstr[j] != suff[k])
215 end = strlen(pathstr);
219 bname =
walloc(
char,end-start+1);
220 memcpy(bname,&pathstr[start],end-start);
221 bname[end-
start] =
'\0';
222 newsym =
strcons(strlen(bname),bname);
229 static LISP lisp_to_string(LISP l)
234 printf(
"%s\n",(
const char *)s);
238 static LISP symbolconc(LISP args)
245 if NSYMBOLP(s)
err(
"wrong type of argument(non-symbol) to symbolconc",s);
246 size = size + strlen(
PNAME(s));
260 for (i=0; pname[i] !=
'\0'; i++)
293 err(
"not a string",
string);
295 const char *data =
string->storage_as.string.data;
296 int dim =
string->storage_as.string.dim;
304 char *nbuffer =
walloc(
char, length+1);
305 memmove(nbuffer,data+start,length);
306 nbuffer[length] =
'\0';
308 LISP ncell =
strcons(length, nbuffer);
315 static LISP l_sbefore(LISP atom, LISP before)
325 static LISP l_safter(LISP atom, LISP after)
338 "(string-append STR1 STR2 ...)\n\ 339 Return a string made from the concatenation of the print names of STR1\n\ 342 "(string-length SYMBOL)\n\ 343 Return the number of characters in the print name of SYMBOL.");
345 "(print_string DATA)\n\ 346 Returns a string representing the printing of DATA." );
348 "(read-from-string SYMBOL)\n\ 349 Return first s-expression in print name of SYMBOL.");
351 "(downcase SYMBOL)\n\ 352 Returns a string with the downcased version of SYMBOL's printname.");
355 Returns a string with the upcased version of SYMBOL's printname.");
357 "(string-matches ATOM REGEX)\n\ 358 Returns t if ATOM's printname matches the regular expression REGEX,\n\ 359 otherwise it returns nil.");
361 "(string-equal ATOM1 ATOM2)\n\ 362 Returns t if ATOM's printname is equal to ATOM's print name, otherwise\n\ 365 "(substring STRING START LENGTH)\n\ 366 Return a substring of STRING starting at START of length LENGTH.");
368 "(string-before ATOM BEFORE)\n\ 369 Returns an atom whose printname is the substring of ATOM's printname \n\ 370 which appears before BEFORE. This is a wraparound for the EST_String.before \n\ 371 function in C++, and hence has the same conditions for boundary cases.");
373 "(string-after ATOM AFTER)\n\ 374 Returns an atom whose printname is the substring of ATOM's printname \n\ 375 which appears after AFTER. This is a wraparound for the EST_String.after \n\ 376 function in C++, and hence has the same conditions for boundary cases.");
379 "(symbolconc SYMBOL1 SYMBOL2 ...)\n\ 380 Form new symbol by concatenation of the print forms of each of SYMBOL1\n\ 383 "(symbolexplode SYMBOL)\n\ 384 Returns list of atoms one for each character in the print name of SYMBOL.");
387 "(parse-number SYMBOL)\n\ 388 Returns a number form a symbol or string whose print name is a number.");
391 "(basename PATH SUFFIX)\n\ 392 Return a string with directory removed from basename. If SUFFIX is\n\ 393 specified remove that from end of PATH. Basically the same function\n\ 394 as the UNIX command of the same name.");
398 "(path-is-filename PATHNAME)\n\ 399 Is PATH a non-directory name.");
402 "(path-as-directory PATHNAME)\n\ 403 Return PATH as a directory name.");
406 "(path-as-file PATHNAME)\n\ 407 Return PATH as a non-directory name.");
410 "(path-append DIRECTORY-PATH ADDITION1 ADDITION2 ...)\n\ 411 Return a the path for ADDITION in DIRECTORY.");
414 "(path-basename PATHNAME)\n\ 415 Return name part of PATH.");
419 "(path-is-dirname PATHNAME)\n\ 420 Is PATH a directory name.");
char * wstrdup(const char *s)
float end(const EST_Item &item)
#define walloc(TYPE, SIZE)
LISP readtl(struct gen_readio *f)
LISP l_matches(LISP atom, LISP regex)
void(* ungetc_fcn)(int, char *)
long int get_c_int(LISP x)
void init_subr_2(const char *name, LISP(*fcn)(LISP, LISP), const char *doc)
LISP path_append(LISP lpaths)
int is_filename(void) const
LISP path_basename(LISP lpath)
EST_Pathname as_file(void) const
void err(const char *message, LISP x) EST_NORETURN
const char * get_c_string(LISP x)
LISP string_upcase(LISP symbol)
LISP read_from_lstring(LISP x)
EST_Regex & make_regex(const char *r)
LISP strcons(long length, const char *data)
EST_String siod_sprint(LISP exp)
LISP cons(LISP x, LISP y)
LISP path_is_dirname(LISP lpath)
LISP cstrcons(const char *data)
LISP l_strequal(LISP atom1, LISP atom2)
void init_subr_1(const char *name, LISP(*fcn)(LISP), const char *doc)
long no_interrupt(long n)
LISP strintern(const char *data)
int matches(const char *e, ssize_t pos=0) const
Exactly match this string?
LISP path_as_file(LISP lpath)
LISP read_from_string(const char *string)
LISP parse_number(LISP x)
LISP symbol_basename(LISP path, LISP suffix)
LISP path_is_filename(LISP lpath)
void init_subr_3(const char *name, LISP(*fcn)(LISP, LISP, LISP), const char *doc)
float start(const EST_Item &item)
EST_String basename(int remove_all=0) const
void init_lsubr(const char *name, LISP(*fcn)(LISP), const char *doc)
LISP rintern(const char *name)
char * must_malloc(unsigned long size)
int is_dirname(void) const
EST_String after(int pos, int len=1) const
Part after pos+len.
void init_subrs_str(void)
LISP path_as_directory(LISP lpath)
EST_String before(int pos, int len=0) const
Part before position.
LISP string_length(LISP string)
EST_Pathname as_directory(void) const
void reverse(EST_Wave &sig)
LISP symbolexplode(LISP name)
LISP string_append(LISP args)
LISP string_downcase(LISP symbol)
LISP l_substring(LISP string, LISP l_start, LISP l_length)