summaryrefslogtreecommitdiff
path: root/libstd/strjoin.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
commit2bc852bda98762d3bc01548bf972e3f1b137fbfb (patch)
tree74831deed3c9057c5fe0cbb8790d220e855bc792 /libstd/strjoin.myr
parent3de952510eb2a23350d24ed926f19c0cf72a12f2 (diff)
downloadmc-2bc852bda98762d3bc01548bf972e3f1b137fbfb.tar.gz
Move Myrddin libs to lib/ subdirectory.
Diffstat (limited to 'libstd/strjoin.myr')
-rw-r--r--libstd/strjoin.myr41
1 files changed, 0 insertions, 41 deletions
diff --git a/libstd/strjoin.myr b/libstd/strjoin.myr
deleted file mode 100644
index 518a4dc..0000000
--- a/libstd/strjoin.myr
+++ /dev/null
@@ -1,41 +0,0 @@
-use "alloc.use"
-use "die.use"
-use "slcp.use"
-
-pkg std =
- const strcat : (a : byte[:], b : byte[:] -> byte[:])
- const strjoin : (strings : byte[:][:], delim : byte[:] -> byte[:])
-;;
-
-const strcat = {a, b
- -> strjoin([a, b][:], "")
-}
-
-const strjoin = {strings, delim
- var len, off
- var i
- var s
-
- len = 0
- for i = 0; i < strings.len; i++
- len += strings[i].len
- ;;
- if strings.len > 0
- len += (strings.len - 1)*delim.len
- ;;
-
- s = slalloc(len)
- off = 0
- for i = 0; i < strings.len; i++
- slcp(s[off:off + strings[i].len], strings[i])
- off += strings[i].len
- /* we don't want to terminate the last string with delim */
- if i != strings.len - 1
- slcp(s[off:off + delim.len], delim)
- off += delim.len
- ;;
- ;;
- -> s
-}
-
-