An advanced programming language branch, master, updated. 363feb38c7d51cfcbb3247a3ff9bf9d362820c45

0 views
Skip to first unread message

felixgit

unread,
Oct 4, 2010, 1:30:51 PM10/4/10
to felix-...@googlegroups.com
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "An advanced programming language".

The branch, master has been updated
via 363feb38c7d51cfcbb3247a3ff9bf9d362820c45 (commit)
from d79f62582cea4f0929dae47a148a5fd5e2f0aec9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 363feb38c7d51cfcbb3247a3ff9bf9d362820c45
Author: John Skaller <ska...@users.sourceforge.net>
Date: Tue Oct 5 04:30:02 2010 +1100

Add Filename::split1 and join1 functions

diff --git a/lpsrc/flx_stdlib.pak b/lpsrc/flx_stdlib.pak
index d80858b..d0440f7 100644
--- a/lpsrc/flx_stdlib.pak
+++ b/lpsrc/flx_stdlib.pak
@@ -271,4 +271,33 @@ module Filename
tangle(' const sep : charp = c"\\"\\\\\\\\\\"";')
else:
tangle(' const sep : charp = c"\\"'+os.sep+'\\"";')
+
+ // these seem more generic
+
+ // Note carefully that split1("x")=> "","x" whereas
+ // split1("/x")=>"/","x"
+ // join1 handles this correctly
+ // Note also we do NOT return "." unless it is explicitly given
+ // since relative filenames are NOT necessarily relative to the
+ // current directory (for example C #include names)
+
+ fun split1(s:string)=> match find_last_of(s,sep) with
+ | Some ?pos =>
+ if pos==0 then sep else s.[to pos] endif,
+ s.[pos+1 to]
+ | None => "",s
+ endmatch
+ ;
+
+ fun join1(p:string, b:string)=>
+ match len p, len b with
+ | 0,0 => ""
+ | 0,_ => b
+ | _,0 => p
+ | _,_ => if p==sep then p+b else p+sep+b endif
+ endmatch
+ ;
+
+ // todo: multi-component split/join
}
+

-----------------------------------------------------------------------

Summary of changes:
lpsrc/flx_stdlib.pak | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)


hooks/post-receive
--
An advanced programming language

Reply all
Reply to author
Forward
0 new messages