diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-04-17 18:50:29 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-04-17 18:50:29 -0700 |
commit | 1d188c4f816fce8728fdffaa7ad6ef205ca05abd (patch) | |
tree | 8523aea864e0d2042c4494a181c910ec1948461d /include | |
parent | b7b3dece056794d7b840b71c25ad5ca5846cf231 (diff) |
chore: update naming & calling conventions
Diffstat (limited to 'include')
-rw-r--r-- | include/str.h | 62 | ||||
-rw-r--r-- | include/u.h | 9 |
2 files changed, 40 insertions, 31 deletions
diff --git a/include/str.h b/include/str.h index c728bf0..85051e4 100644 --- a/include/str.h +++ b/include/str.h @@ -25,38 +25,38 @@ enum RuneMax = 0x10FFFF, }; -int utf8·FullRune(byte* s, int n); -byte *utf8·FindRune(byte* s, long i); -int utf8·CharToRune(Rune *r, byte* s); -int utf8·RuneToChar(byte* s, Rune* r); -int utf8·Len(byte* s); -int utf8·RuneLen(Rune r); -int utf8·IsLetter(Rune r); -int utf8·IsDigit(Rune r); -int utf8·IsSpace(Rune r); -int utf8·IsTitle(Rune r); +int utf8·fullRune(byte *s, int n); +byte *utf8·findRune(byte *s, long i); +int utf8·charToRune(Rune *r, byte *s); +int utf8·runeToChar(byte *s, Rune *r); +int utf8·len(byte *s); +int utf8·runeLen(Rune r); +int utf8·isLetter(Rune r); +int utf8·isDigit(Rune r); +int utf8·isSpace(Rune r); +int utf8·isTitle(Rune r); // ------------------------------------------------------------------------- // Dynamic string functions -string str·NewCap(const byte* s, vlong len, vlong cap); -string str·NewLen(const byte* s, vlong len); -string str·New(const byte* s); -string str·Newf(const byte* fmt, ...); -void str·Free(string s); -int str·Len(const string s); -int str·Cap(const string s); -string str·Clear(string s); -string str·Grow(string s, vlong delta); -string str·Fit(string s); -string str·AppendCount(string s, const byte* b, vlong len); -string str·Append(string s, const byte* b); -string str·Appendf(string s, const byte* fmt, ...); -string str·AppendByte(string s, const byte b); -bool str·Equals(const string s, const string t); -int str·Find(string s, const byte* substr); -void str·Lower(string s); -void str·Upper(string s); -void str·Replace(string s, const byte* from, const byte* to); -string* str·Split(string s, const byte* tok); -string str·Join(byte** fields, vlong numFields, const byte* sep); +string str·newCap(const byte *s, vlong len, vlong cap); +string str·newLen(const byte *s, vlong len); +string str·new(const byte *s); +string str·newf(const byte *fmt, ...); +void str·free(string s); +int str·len(const string s); +int str·cap(const string s); +string str·clear(string s); +string str·grow(string s, vlong delta); +string str·fit(string s); +string str·appendCount(string s, vlong len, const byte *b); +string str·append(string s, const byte* b); +string str·appendf(string s, const byte* fmt, ...); +string str·appendByte(string s, const byte b); +bool str·equals(const string s, const string t); +int str·find(string s, const byte* substr); +void str·lower(string s); +void str·upper(string s); +void str·replace(string s, const byte* from, const byte* to); +string* str·split(string s, const byte* tok); +string str·join(vlong len, byte** fields, const byte* sep); diff --git a/include/u.h b/include/u.h index 349a236..b7bd9ca 100644 --- a/include/u.h +++ b/include/u.h @@ -86,6 +86,15 @@ void* bufgrow(void*, vlong, vlong); void _bufpop(void*, int, vlong);
// -----------------------------------------------------------------------------
+// Co-routines
+
+typedef struct coro coro;
+
+coro* coro·new(uintptr stk, uintptr (*func)(coro* c, uintptr));
+uintptr coro·yield(coro* c, uintptr arg);
+error coro·free(coro* c);
+
+// -----------------------------------------------------------------------------
// Strings
#include "str.h"
|