[Gd-chatter] r11687 - in trunk/libraries: . network/koala/sources/dylan-basics network/koala/sources/examples/buddha network/koala/sources/examples/code-browser network/koala/sources/koala network/wiki
cgay at gwydiondylan.org
cgay at gwydiondylan.org
Tue Feb 19 01:22:07 CET 2008
Author: cgay
Date: Tue Feb 19 01:22:06 2008
New Revision: 11687
Modified:
trunk/libraries/network/koala/sources/dylan-basics/dylan-basics.dylan
trunk/libraries/network/koala/sources/dylan-basics/library.dylan
trunk/libraries/network/koala/sources/examples/buddha/cisco-telnet.dylan
trunk/libraries/network/koala/sources/examples/code-browser/library.dylan
trunk/libraries/network/koala/sources/koala/header-values.dylan
trunk/libraries/network/koala/sources/koala/library.dylan
trunk/libraries/network/koala/sources/koala/server.dylan
trunk/libraries/network/koala/sources/koala/utils.dylan
trunk/libraries/network/wiki/library.dylan
trunk/libraries/network/wiki/new-library.dylan
trunk/libraries/network/wiki/parser.dylan
trunk/libraries/reorg.txt
Log:
job: 7357
Updates for new definitions of split and regex changes.
Modified: trunk/libraries/network/koala/sources/dylan-basics/dylan-basics.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/dylan-basics/dylan-basics.dylan (original)
+++ trunk/libraries/network/koala/sources/dylan-basics/dylan-basics.dylan Tue Feb 19 01:22:06 2008
@@ -223,94 +223,11 @@
-// ----------------------------------------------------------------------
-// join(range(from: 1, to: 3), ", ",
-// key: integer-to-string,
-// conjunction: " and ");
-// => "1, 2 and 3"
-
-define open generic join
- (sequence :: <sequence>, separator :: <string>,
- #key key :: <function> = identity,
- conjunction :: false-or(<string>))
- => (result :: <string>);
-
-define method join
- (seq :: <sequence>, separator :: <string>,
- #key key :: <function> = identity,
- conjunction :: false-or(<string>))
- => (result :: <string>)
- with-output-to-string (out)
- let len-1 :: <integer> = seq.size - 1;
- for (i :: <integer> from 1,
- item in seq)
- write(out, key(item));
- if (i < len-1)
- write(out, separator);
- elseif (i == len-1)
- write(out, conjunction | separator);
- end;
- end;
- end
-end;
-
-
define inline-only function whitespace?
(ch :: <character>) => (white? :: <boolean>)
member?(ch, #[' ', '\t', '\n'])
end;
-
-
-
-define method splitf
- (string :: <byte-string>, separator? :: <function>, separator-size :: <integer>,
- #key start :: <integer> = 0,
- end: epos :: <integer> = size(string),
- trim? :: <boolean> = #t,
- max: max-splits :: false-or(<integer>),
- allow-empty-strings? :: <boolean>)
- let bpos :: <integer> = start;
- let new-pos :: <integer> = bpos;
- let results :: <stretchy-vector> = make(<stretchy-vector>);
- local method add-substring
- (start :: <integer>, _end :: <integer>)
- if (trim?)
- while (start < _end & whitespace?(string[start]))
- start := start + 1
- end;
- while (start < _end & whitespace?(string[_end - 1]))
- _end := _end - 1
- end
- end;
- if (allow-empty-strings? | start ~== _end)
- add!(results, copy-sequence(string, start: start, end: _end))
- end
- end method add-substring;
- let splits :: <integer> = 0;
- while (new-pos < epos & (~max-splits | splits < max-splits))
- if (separator?(new-pos))
- add-substring(bpos, new-pos);
- if (allow-empty-strings?)
- new-pos := new-pos + separator-size;
- else
- // skip consecutive separators
- while (new-pos < epos & separator?(new-pos))
- new-pos := new-pos + separator-size;
- end;
- end;
- bpos := new-pos;
- splits := splits + 1;
- else
- new-pos := new-pos + 1;
- end
- end;
- add-substring(bpos, epos);
- results
-end method splitf;
-
-//split("1,2,,4", separator: ",", allow-empty-strings?: #t);
-
// ----------------------------------------------------------------------
// For removing certain keyword/value pairs from argument lists before
// passing them along with apply or next-method.
Modified: trunk/libraries/network/koala/sources/dylan-basics/library.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/dylan-basics/library.dylan (original)
+++ trunk/libraries/network/koala/sources/dylan-basics/library.dylan Tue Feb 19 01:22:06 2008
@@ -26,7 +26,6 @@
// float-to-string, but decided to keep it with a different name.
// --cgay
float-to-formatted-string,
- join,
remove-keys, // For removing keywords from #rest arglists.
raise,
ignore-errors,
Modified: trunk/libraries/network/koala/sources/examples/buddha/cisco-telnet.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/examples/buddha/cisco-telnet.dylan (original)
+++ trunk/libraries/network/koala/sources/examples/buddha/cisco-telnet.dylan Tue Feb 19 01:22:06 2008
@@ -67,7 +67,7 @@
let line = read-whats-available(control.socket,
timeout: 1,
end-marker: "Password:");
- let (banner, prompt) = regexp-match(line, "(.*)(Password:)");
+ let (banner, prompt) = regex-search-strings(line, "(.*)(Password:)");
if (banner)
control.device.banner := banner;
write-line(control.socket,
@@ -83,7 +83,7 @@
let line = read-whats-available(control.socket,
timeout: 1,
end-marker: ">");
- let (match, hostname) = regexp-match(line, "(.*)>");
+ let (match, hostname) = regex-search-strings(line, "(.*)>");
if (match)
control.device.host-name := hostname;
write-line(control.socket, "enable");
@@ -101,7 +101,7 @@
let line = read-whats-available(control.socket,
timeout: 1,
end-marker: "#");
- if (regexp-match(line, "#"))
+ if (regex-search(line, "#"))
control.connection-state := #"enabled"
else
error("enable password invalid")
Modified: trunk/libraries/network/koala/sources/examples/code-browser/library.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/examples/code-browser/library.dylan (original)
+++ trunk/libraries/network/koala/sources/examples/code-browser/library.dylan Tue Feb 19 01:22:06 2008
@@ -42,7 +42,7 @@
use streams;
use file-system;
use dsp, exclude: { split };
- use regular-expressions, import: { regexp-replace };
+ use regular-expressions, import: { regex-replace };
use source-records;
use source-records-implementation;
use environment-protocols,
Modified: trunk/libraries/network/koala/sources/koala/header-values.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/header-values.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/header-values.dylan Tue Feb 19 01:22:06 2008
@@ -256,7 +256,7 @@
if (string-match("Basic", str, bpos, dpos))
// base64 encoding of userid:password. Should decode and return
// (userid . password). or maybe avalue with "userid"=userid, etc.
- let username+password = string-split(base64-decode(trimmed-substring(str, dpos, epos)), ':');
+ let username+password = split(base64-decode(trimmed-substring(str, dpos, epos)), ':');
pair(first(username+password), last(username+password));
else
make(<avalue>,
Modified: trunk/libraries/network/koala/sources/koala/library.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/library.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/library.dylan Tue Feb 19 01:22:06 2008
@@ -38,7 +38,7 @@
define module utilities
use dylan;
use common-extensions,
- exclude: { format-to-string, split };
+ exclude: { format-to-string };
use dylan-extensions,
import: { element-no-bounds-check,
element-no-bounds-check-setter,
@@ -316,7 +316,6 @@
use dylan;
use threads; // from dylan lib
use common-extensions,
- rename: { split => string-split },
exclude: { format-to-string };
use dylan-basics;
use simple-random;
@@ -364,8 +363,7 @@
define module dsp
use dylan;
- use common-extensions,
- exclude: { split };
+ use common-extensions;
use dylan-basics;
use koala,
export: all;
@@ -404,6 +402,8 @@
page-source,
page-source-setter,
+ page-template,
+ page-template-setter,
<dylan-server-page>, // Subclass this using the "define page" macro
page-definer, // Defines a new page class
Modified: trunk/libraries/network/koala/sources/koala/server.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/server.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/server.dylan Tue Feb 19 01:22:06 2008
@@ -687,7 +687,7 @@
let content-type-header = get-header(request, "content-type");
as(<symbol>,
if (content-type-header)
- first(split(content-type-header, ";"))
+ first(split(content-type-header, ';'))
else
""
end if)
@@ -774,8 +774,8 @@
buffer :: <byte-string>,
content-length :: <integer>)
=> (content :: <string>)
- let header-content-type = split(get-header(request, "content-type"), ";");
- let boundary = split(second(header-content-type), "=");
+ let header-content-type = split(get-header(request, "content-type"), ';');
+ let boundary = split(second(header-content-type), '=');
if (element(boundary, 1, default: #f))
let boundary-value = second(boundary);
log-debug("boundary: %=", boundary-value);
@@ -998,7 +998,7 @@
let type = #f;
let filename = #f;
for (header-entry in header-entries)
- let header-entry-parts = split(header-entry, ";");
+ let header-entry-parts = split(header-entry, ';');
for (header-entry-part in header-entry-parts)
let eq-pos = char-position('=', header-entry-part, 0, size(header-entry-part));
let p-pos = char-position(':', header-entry-part, 0, size(header-entry-part));
Modified: trunk/libraries/network/koala/sources/koala/utils.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/utils.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/utils.dylan Tue Feb 19 01:22:06 2008
@@ -189,7 +189,7 @@
define method add-object
(trie :: <string-trie>, path :: <sequence>, object :: <object>,
#key replace?)
- => ();
+ => ()
local method real-add (trie, rest-path)
if (rest-path.size = 0)
if (trie.trie-object = #f | replace?)
@@ -218,7 +218,7 @@
define method remove-object
(trie :: <string-trie>, path :: <sequence>)
- => ();
+ => ()
let nodes = #[];
let node = reduce(method (a, b)
nodes := add!(nodes, a);
Modified: trunk/libraries/network/wiki/library.dylan
==============================================================================
--- trunk/libraries/network/wiki/library.dylan (original)
+++ trunk/libraries/network/wiki/library.dylan Tue Feb 19 01:22:06 2008
@@ -38,7 +38,7 @@
//use meta;
use dsp;
use regular-expressions,
- import: { regexp-position };
+ import: { regex-position };
use xml-rpc-common,
import: { base64-encode, base64-decode };
use strings, import: { index-of, case-insensitive-equal? };
Modified: trunk/libraries/network/wiki/new-library.dylan
==============================================================================
--- trunk/libraries/network/wiki/new-library.dylan (original)
+++ trunk/libraries/network/wiki/new-library.dylan Tue Feb 19 01:22:06 2008
@@ -45,7 +45,7 @@
//use meta;
use dsp;
use regular-expressions,
- import: { regexp-position };
+ import: { regex-position };
use xml-rpc-common,
import: { base64-encode, base64-decode };
use strings, import: { index-of, case-insensitive-equal? };
Modified: trunk/libraries/network/wiki/parser.dylan
==============================================================================
--- trunk/libraries/network/wiki/parser.dylan (original)
+++ trunk/libraries/network/wiki/parser.dylan Tue Feb 19 01:22:06 2008
@@ -84,7 +84,7 @@
elseif (start + 1 < markup.size & markup[start + 1] == ' ')
// lines preceded by space are preformatted...
// Find next line with no leading whitespace...
- let (epos, #rest xs) = regexp-position(markup, "\n\\S", start: start + 1) | markup.size;
+ let (epos, #rest xs) = regex-position("\n\\S", markup, start: start + 1) | markup.size;
write(out, "<pre>");
//XXX more speed
let raw-text = copy-sequence(markup, start: start, end: epos);
@@ -131,8 +131,8 @@
(out :: <stream>, markup :: <string>, start :: <integer>)
=> (end-pos :: false-or(<integer>))
let newline = find(markup, '\n', start: start) | markup.size;
- // let (#rest idxs) = regexp-position(markup, "(==+)([^=\n]+)(==+)\\s*(\n|$)",
- let (#rest idxs) = regexp-position(markup, "(==+)([^=\n]+)(==+|$)",
+ // let (#rest idxs) = regex-position("(==+)([^=\n]+)(==+)\\s*(\n|$)", markup,
+ let (#rest idxs) = regex-position("(==+)([^=\n]+)(==+|$)", markup,
start: start, end: newline);
if (idxs.size > 1)
let tag = copy-sequence(markup, start: idxs[2], end: idxs[3]);
@@ -203,7 +203,7 @@
(stream, markup, start, bullet-char, tag)
=> (end-pos :: false-or(<integer>))
let regex1 = format-to-string("\n\\s*[^%s]", bullet-char);
- let (list-end, #rest xs) = regexp-position(markup, regex1, start: start);
+ let (list-end, #rest xs) = regex-position(regex1, markup, start: start);
let lines = split(copy-sequence(markup,
start: start,
end: list-end | markup.size),
@@ -212,7 +212,7 @@
let depth :: <integer> = 0;
let regex2 = format-to-string("^\\s*([%s]+)", bullet-char);
for (line in lines)
- let (#rest indexes) = regexp-position(line, regex2);
+ let (#rest indexes) = regex-position(regex2, line);
if (indexes.size > 1)
let bullet-start = indexes[2];
let bullet-end = indexes[3];
Modified: trunk/libraries/reorg.txt
==============================================================================
--- trunk/libraries/reorg.txt (original)
+++ trunk/libraries/reorg.txt Tue Feb 19 01:22:06 2008
@@ -77,8 +77,6 @@
monday
parser-generator // What's the difference...
parsergen // ...between these two?
- string-tools
- regular-expressions // Is this just for strings?
testing
testworks
testworks-gui
@@ -92,6 +90,7 @@
utilities
channels
command-line-parser
+ regular-expressions
timer
commands
state-machine
More information about the chatter
mailing list