1
0

String.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma src "/sys/src/libString"
  2. #pragma lib "libString.a"
  3. /* extensible Strings */
  4. typedef struct String {
  5. Lock;
  6. char *base; /* base of String */
  7. char *end; /* end of allocated space+1 */
  8. char *ptr; /* ptr into String */
  9. short ref;
  10. uchar fixed;
  11. } String;
  12. #define s_clone(s) s_copy((s)->base)
  13. #define s_to_c(s) ((s)->base)
  14. #define s_len(s) ((s)->ptr-(s)->base)
  15. extern String* s_append(String*, char*);
  16. extern String* s_array(char*, int);
  17. extern String* s_copy(char*);
  18. extern void s_free(String*);
  19. extern String* s_incref(String*);
  20. extern String* s_memappend(String*, char*, int);
  21. extern String* s_nappend(String*, char*, int);
  22. extern String* s_new(void);
  23. extern String* s_newalloc(int);
  24. extern String* s_parse(String*, String*);
  25. extern String* s_reset(String*);
  26. extern String* s_restart(String*);
  27. extern void s_terminate(String*);
  28. extern void s_tolower(String*);
  29. extern void s_putc(String*, int);
  30. extern String* s_unique(String*);
  31. extern String* s_grow(String*, int);
  32. #ifdef BGETC
  33. extern int s_read(Biobuf*, String*, int);
  34. extern char *s_read_line(Biobuf*, String*);
  35. extern char *s_getline(Biobuf*, String*);
  36. #endif BGETC