From 2853156a2bce535bcaa440c37cf872916f76c03b Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Thu, 3 Jan 2013 08:10:25 +0000 Subject: Refactoring, rename isNil to isNull. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1428206 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/components/cache/datacache.cpp | 4 +- sca-cpp/trunk/components/cache/memcache.cpp | 6 +- sca-cpp/trunk/components/cache/memcache.hpp | 4 +- sca-cpp/trunk/components/cache/memocache.cpp | 2 +- sca-cpp/trunk/components/cache/partitioner.cpp | 8 +- .../trunk/components/chat/chat-sendreceiver.cpp | 4 +- sca-cpp/trunk/components/chat/xmpp.hpp | 4 +- sca-cpp/trunk/components/constdb/constdb.cpp | 4 +- sca-cpp/trunk/components/filedb/filedb.cpp | 4 +- sca-cpp/trunk/components/filedb/filedb.hpp | 4 +- sca-cpp/trunk/components/sqldb/pgsql.hpp | 32 +++--- sca-cpp/trunk/components/sqldb/sqldb.cpp | 4 +- sca-cpp/trunk/hosting/server/accounts.py | 2 +- sca-cpp/trunk/hosting/server/apps.py | 14 +-- sca-cpp/trunk/hosting/server/atomutil.py | 24 ++-- sca-cpp/trunk/hosting/server/authn.py | 2 +- sca-cpp/trunk/hosting/server/client-test.hpp | 4 +- sca-cpp/trunk/hosting/server/composites.py | 10 +- sca-cpp/trunk/hosting/server/dashboards.py | 20 ++-- .../trunk/hosting/server/htdocs/account/index.html | 26 ++--- sca-cpp/trunk/hosting/server/htdocs/app/index.html | 80 ++++++------- .../trunk/hosting/server/htdocs/clone/index.html | 4 +- sca-cpp/trunk/hosting/server/htdocs/config.js | 2 +- .../trunk/hosting/server/htdocs/create/index.html | 2 +- .../trunk/hosting/server/htdocs/delete/index.html | 4 +- .../trunk/hosting/server/htdocs/graph/index.html | 124 ++++++++++----------- .../trunk/hosting/server/htdocs/home/index.html | 2 +- sca-cpp/trunk/hosting/server/htdocs/index.html | 32 +++--- .../trunk/hosting/server/htdocs/info/index.html | 24 ++-- .../trunk/hosting/server/htdocs/login/index.html | 8 +- .../trunk/hosting/server/htdocs/page/index.html | 58 +++++----- .../server/htdocs/proxy/public/oops/index.html | 8 +- .../trunk/hosting/server/htdocs/public/config.js | 2 +- .../server/htdocs/public/notauth/index.html | 8 +- .../server/htdocs/public/notfound/index.html | 8 +- .../hosting/server/htdocs/public/notyet/index.html | 8 +- .../hosting/server/htdocs/public/oops/index.html | 8 +- .../trunk/hosting/server/htdocs/rate/index.html | 4 +- .../trunk/hosting/server/htdocs/search/index.html | 16 +-- .../trunk/hosting/server/htdocs/store/index.html | 20 ++-- sca-cpp/trunk/hosting/server/icons.py | 36 +++--- sca-cpp/trunk/hosting/server/pages.py | 10 +- sca-cpp/trunk/hosting/server/palettes.py | 2 +- sca-cpp/trunk/hosting/server/pictures.py | 32 +++--- sca-cpp/trunk/hosting/server/ratings.py | 14 +-- sca-cpp/trunk/hosting/server/reviews.py | 26 ++--- sca-cpp/trunk/hosting/server/search.py | 8 +- sca-cpp/trunk/hosting/server/selector.py | 4 +- sca-cpp/trunk/hosting/server/store.py | 20 ++-- sca-cpp/trunk/hosting/server/util.py | 12 +- sca-cpp/trunk/kernel/element.hpp | 28 ++--- sca-cpp/trunk/kernel/function.hpp | 4 +- sca-cpp/trunk/kernel/kernel-test.cpp | 18 +-- sca-cpp/trunk/kernel/list.hpp | 68 +++++------ sca-cpp/trunk/kernel/parallel-test.cpp | 6 +- sca-cpp/trunk/kernel/parallel.hpp | 6 +- sca-cpp/trunk/kernel/sstream.hpp | 14 +-- sca-cpp/trunk/kernel/tree.hpp | 36 +++--- sca-cpp/trunk/kernel/value.hpp | 16 +-- sca-cpp/trunk/modules/atom/atom.hpp | 46 ++++---- sca-cpp/trunk/modules/http/http.hpp | 24 ++-- sca-cpp/trunk/modules/http/httpd.hpp | 8 +- sca-cpp/trunk/modules/http/mod-openauth.cpp | 14 +-- sca-cpp/trunk/modules/http/openauth.hpp | 10 +- sca-cpp/trunk/modules/java/driver.hpp | 2 +- sca-cpp/trunk/modules/java/eval.hpp | 10 +- .../java/org/apache/tuscany/IterableUtil.java | 24 ++-- sca-cpp/trunk/modules/java/test/ServerImpl.java | 2 +- sca-cpp/trunk/modules/js/htdocs/atomutil.js | 46 ++++---- sca-cpp/trunk/modules/js/htdocs/elemutil.js | 32 +++--- sca-cpp/trunk/modules/js/htdocs/jsonutil.js | 12 +- sca-cpp/trunk/modules/js/htdocs/scdl.js | 22 ++-- sca-cpp/trunk/modules/js/htdocs/ui.js | 18 +-- sca-cpp/trunk/modules/js/htdocs/util.js | 24 ++-- sca-cpp/trunk/modules/js/htdocs/xmlutil.js | 22 ++-- sca-cpp/trunk/modules/json/json.hpp | 14 +-- sca-cpp/trunk/modules/oauth/mod-oauth1.cpp | 70 ++++++------ sca-cpp/trunk/modules/oauth/mod-oauth2.cpp | 52 ++++----- sca-cpp/trunk/modules/opencl/driver.hpp | 2 +- sca-cpp/trunk/modules/opencl/eval.hpp | 4 +- sca-cpp/trunk/modules/python/driver.hpp | 2 +- sca-cpp/trunk/modules/python/eval.hpp | 2 +- sca-cpp/trunk/modules/python/python-test.cpp | 2 +- sca-cpp/trunk/modules/rss/rss.hpp | 30 ++--- sca-cpp/trunk/modules/scdl/scdl.hpp | 18 +-- sca-cpp/trunk/modules/scheme/driver.hpp | 2 +- sca-cpp/trunk/modules/scheme/environment.hpp | 12 +- sca-cpp/trunk/modules/scheme/eval.hpp | 16 +-- sca-cpp/trunk/modules/scheme/io.hpp | 2 +- sca-cpp/trunk/modules/scheme/primitive.hpp | 14 +-- sca-cpp/trunk/modules/server/client-test.hpp | 4 +- sca-cpp/trunk/modules/server/mod-cpp.hpp | 4 +- sca-cpp/trunk/modules/server/mod-eval.hpp | 122 ++++++++++---------- sca-cpp/trunk/modules/server/mod-scheme.hpp | 6 +- sca-cpp/trunk/modules/wsgi/atomutil.py | 30 ++--- sca-cpp/trunk/modules/wsgi/composite.py | 12 +- sca-cpp/trunk/modules/wsgi/elemutil.py | 32 +++--- sca-cpp/trunk/modules/wsgi/jsonutil.py | 12 +- sca-cpp/trunk/modules/wsgi/rssutil.py | 20 ++-- sca-cpp/trunk/modules/wsgi/util.py | 12 +- sca-cpp/trunk/modules/wsgi/xmlutil.py | 6 +- sca-cpp/trunk/modules/xml/xml.hpp | 10 +- sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp | 10 +- .../samples/store-java/store/ShoppingCartImpl.java | 8 +- 104 files changed, 905 insertions(+), 905 deletions(-) (limited to 'sca-cpp') diff --git a/sca-cpp/trunk/components/cache/datacache.cpp b/sca-cpp/trunk/components/cache/datacache.cpp index 4fafd9e345..b96fe92b71 100644 --- a/sca-cpp/trunk/components/cache/datacache.cpp +++ b/sca-cpp/trunk/components/cache/datacache.cpp @@ -48,12 +48,12 @@ const failable get(const value& key, const lvvlambda& rcache1, const lvvl // Lookup level1 cache const value val1 = rcache1(mklist("get", key)); - if (!isNil(val1)) + if (!isNull(val1)) return val1; // Lookup level2 cache const value val2 = rcache2(mklist("get", key)); - if (isNil(val2)) { + if (isNull(val2)) { ostringstream os; os << "Couldn't get cache entry: " << key; return mkfailure(str(os), 404, false); diff --git a/sca-cpp/trunk/components/cache/memcache.cpp b/sca-cpp/trunk/components/cache/memcache.cpp index e1a3c7e9af..a15250c37b 100644 --- a/sca-cpp/trunk/components/cache/memcache.cpp +++ b/sca-cpp/trunk/components/cache/memcache.cpp @@ -68,7 +68,7 @@ const failable put(const list& params, const memcache::MemCached& const failable patch(const list& params, const memcache::MemCached& ch) { // Read patch value p = assoc("patch", assoc("content", car(cadr(params)))); - if (isNil(p)) + if (isNull(p)) return mkfailure("Couldn't read patch script"); const string script = cadr(p); debug(script, "memcache::patch::script"); @@ -82,7 +82,7 @@ const failable patch(const list& params, const memcache::MemCached // Apply patch scheme::Env env = scheme::setupEnvironment(); const value pval = scheme::evalScript(cons("patch", scheme::quotedParameters(mklist(car(params), hasContent(ival)? content(ival) : (value)list()))), is, env); - if (isNil(pval)) { + if (isNull(pval)) { ostringstream os; os << "Couldn't patch memcached entry: " << car(params); return mkfailure(str(os), 404, false); @@ -109,7 +109,7 @@ const failable del(const list& params, const memcache::MemCached& * Convert a list of properties to a list of server addresses. */ const list servers(const list& params) { - if (isNil(params)) + if (isNull(params)) return list(); const value s = ((lvvlambda)car(params))(nilListValue); return cons(s, servers(cdr(params))); diff --git a/sca-cpp/trunk/components/cache/memcache.hpp b/sca-cpp/trunk/components/cache/memcache.hpp index 7962d1caa0..06e2061a09 100644 --- a/sca-cpp/trunk/components/cache/memcache.hpp +++ b/sca-cpp/trunk/components/cache/memcache.hpp @@ -95,10 +95,10 @@ private: } const failable addServers(apr_memcache_t* const m, const list& servers) { - if (isNil(servers)) + if (isNull(servers)) return true; const list toks = tokenize(":", car(servers)); - const failable r = addServer(m, car(toks), isNil(cdr(toks))? 11211 : atoi(c_str(cadr(toks)))); + const failable r = addServer(m, car(toks), isNull(cdr(toks))? 11211 : atoi(c_str(cadr(toks)))); if (!hasContent(r)) return r; return addServers(m, cdr(servers)); diff --git a/sca-cpp/trunk/components/cache/memocache.cpp b/sca-cpp/trunk/components/cache/memocache.cpp index 5539ccee2f..6ac3cece26 100644 --- a/sca-cpp/trunk/components/cache/memocache.cpp +++ b/sca-cpp/trunk/components/cache/memocache.cpp @@ -47,7 +47,7 @@ const failable memoize(const list& params, const lvvlambda& relay, // Lookup memoized value from cache const value val = cache(mklist("get", params)); - if (!isNil(val)) { + if (!isNull(val)) { debug(val, "memocache::memoize::cached"); return val; } diff --git a/sca-cpp/trunk/components/cache/partitioner.cpp b/sca-cpp/trunk/components/cache/partitioner.cpp index 8a56a7f932..c7c49c04de 100644 --- a/sca-cpp/trunk/components/cache/partitioner.cpp +++ b/sca-cpp/trunk/components/cache/partitioner.cpp @@ -44,7 +44,7 @@ const failable > partition(const value& key, const lvvlambda& select // Call the selector component to convert the given key to a list of partitions const value p = selector(mklist("get", key, partitions)); - if (isNil(p)) { + if (isNull(p)) { ostringstream os; os << "Couldn't get partition: " << key; return mkfailure >(str(os), -1, false); @@ -57,12 +57,12 @@ const failable > partition(const value& key, const lvvlambda& select * Get lists of items from a list of partitions. */ const failable > getlist(const value& key, const list& partitions) { - if (isNil(partitions)) + if (isNull(partitions)) return nilListValue; const lvvlambda l = car(partitions); const value val = l(mklist("get", key)); - if (isNil(val)) + if (isNull(val)) return getlist(key, cdr(partitions)); if (!isList(val)) { ostringstream os; @@ -92,7 +92,7 @@ const failable get(const value& key, const lvvlambda& selector, const lis if (length(p) == 1) { const lvvlambda l = car(p); const value val = l(mklist("get", key)); - if (isNil(val)) { + if (isNull(val)) { ostringstream os; os << "Couldn't get entry from partition: " << key; return mkfailure(str(os), 404, false); diff --git a/sca-cpp/trunk/components/chat/chat-sendreceiver.cpp b/sca-cpp/trunk/components/chat/chat-sendreceiver.cpp index 94577b7551..7669f91f36 100644 --- a/sca-cpp/trunk/components/chat/chat-sendreceiver.cpp +++ b/sca-cpp/trunk/components/chat/chat-sendreceiver.cpp @@ -55,7 +55,7 @@ const failable post(const list& params, XMPPClient& xc) { */ const failable start(const list& params) { // Extract the relay reference and the XMPP JID and password - const bool hasRelay = !isNil(cddr(params)); + const bool hasRelay = !isNull(cddr(params)); const lvvlambda rel = hasRelay? (lvvlambda)car(params) : lvvlambda(); const list props = hasRelay? cdr(params) : params; const value jid = ((lvvlambda)car(props))(nilListValue); @@ -71,7 +71,7 @@ const failable start(const list& params) { worker w(3); const lambda(const value&, const value&, XMPPClient&)> rl = [rel](const value& jid, const value& val, unused XMPPClient& xc) -> const failable { // A relay function that posts the XMPP messages it receives to a relay component reference. - if (isNil(rel)) + if (isNull(rel)) return true; debug(jid, "chat::relay::jid"); debug(val, "chat::relay::value"); diff --git a/sca-cpp/trunk/components/chat/xmpp.hpp b/sca-cpp/trunk/components/chat/xmpp.hpp index 31b4ed3a13..945f1cadc1 100644 --- a/sca-cpp/trunk/components/chat/xmpp.hpp +++ b/sca-cpp/trunk/components/chat/xmpp.hpp @@ -176,7 +176,7 @@ int messageHandler(unused xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, XMPPClient& xc = *(XMPPClient*)udata; const char* const from = xmpp_stanza_get_attribute(stanza, "from"); const char* const text = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "body")); - if (isNil((lambda(const value&, const value&, XMPPClient&)>)xc.listener)) + if (isNull((lambda(const value&, const value&, XMPPClient&)>)xc.listener)) return 1; const value val(content(scheme::readValue(text))); debug(from, "chat::messageHandler::from"); @@ -315,7 +315,7 @@ const failable listen(const lambda(const value&, cons xc.listener = listener; xmpp_handler_add(xc.conn, messageHandler, NULL, "message", NULL, &xc); xc.ctx->loop_status = XMPP_LOOP_RUNNING; - while(xc.connected && !isNil((lambda(const value&, const value&, XMPPClient&)>)xc.listener) && xc.ctx->loop_status == XMPP_LOOP_RUNNING) + while(xc.connected && !isNull((lambda(const value&, const value&, XMPPClient&)>)xc.listener) && xc.ctx->loop_status == XMPP_LOOP_RUNNING) xmpp_run_once(xc.ctx, 1000L); return true; } diff --git a/sca-cpp/trunk/components/constdb/constdb.cpp b/sca-cpp/trunk/components/constdb/constdb.cpp index 2d34ed2b73..d5d2d05e3a 100644 --- a/sca-cpp/trunk/components/constdb/constdb.cpp +++ b/sca-cpp/trunk/components/constdb/constdb.cpp @@ -68,7 +68,7 @@ const failable put(const list& params, const tinycdb::TinyCDB& cdb const failable patch(const list& params, const tinycdb::TinyCDB& cdb) { // Read patch value p = assoc("patch", assoc("content", car(cadr(params)))); - if (isNil(p)) + if (isNull(p)) return mkfailure("Couldn't read patch script"); const string script = cadr(p); debug(script, "tinycdb::patch::script"); @@ -82,7 +82,7 @@ const failable patch(const list& params, const tinycdb::TinyCDB& c // Apply patch scheme::Env env = scheme::setupEnvironment(); const value pval = scheme::evalScript(cons("patch", scheme::quotedParameters(mklist(car(params), hasContent(ival)? content(ival) : (value)list()))), is, env); - if (isNil(pval)) { + if (isNull(pval)) { ostringstream os; os << "Couldn't patch tinycdb entry: " << car(params); return mkfailure(str(os), 404, false); diff --git a/sca-cpp/trunk/components/filedb/filedb.cpp b/sca-cpp/trunk/components/filedb/filedb.cpp index b28cc9bedb..efc5838fa6 100644 --- a/sca-cpp/trunk/components/filedb/filedb.cpp +++ b/sca-cpp/trunk/components/filedb/filedb.cpp @@ -68,7 +68,7 @@ const failable put(const list& params, const filedb::FileDB& db) { const failable patch(const list& params, const filedb::FileDB& db) { // Read patch value p = assoc("patch", assoc("content", car(cadr(params)))); - if (isNil(p)) + if (isNull(p)) return mkfailure("Couldn't read patch script"); const string script = cadr(p); debug(script, "filedb::patch::script"); @@ -82,7 +82,7 @@ const failable patch(const list& params, const filedb::FileDB& db) // Apply patch scheme::Env env = scheme::setupEnvironment(); const value pval = scheme::evalScript(cons("patch", scheme::quotedParameters(mklist(car(params), hasContent(ival)? content(ival) : (value)list()))), is, env); - if (isNil(pval)) { + if (isNull(pval)) { ostringstream os; os << "Couldn't patch file database entry: " << car(params); return mkfailure(str(os), 404, false); diff --git a/sca-cpp/trunk/components/filedb/filedb.hpp b/sca-cpp/trunk/components/filedb/filedb.hpp index 41dde88bef..89e0c1b424 100644 --- a/sca-cpp/trunk/components/filedb/filedb.hpp +++ b/sca-cpp/trunk/components/filedb/filedb.hpp @@ -91,7 +91,7 @@ private: * Convert a key to a file name. */ const string filename(const list& path, const string& root) { - if (isNil(path)) + if (isNull(path)) return root; const string name = root + "/" + (isString(car(path))? (string)car(path) : write(content(scheme::writeValue(car(path))))); return filename(cdr(path), name); @@ -107,7 +107,7 @@ const string filename(const value& key, const string& root) { * Make the parent directories of a keyed file. */ const failable mkdirs(const list& path, const string& root) { - if (isNil(cdr(path))) + if (isNull(cdr(path))) return true; const string dir = root + "/" + (isString(car(path))? (string)car(path) : write(content(scheme::writeValue(car(path))))); mkdir(c_str(dir), S_IRWXU); diff --git a/sca-cpp/trunk/components/sqldb/pgsql.hpp b/sca-cpp/trunk/components/sqldb/pgsql.hpp index 5e0004c4e6..e7c7c5d5cd 100644 --- a/sca-cpp/trunk/components/sqldb/pgsql.hpp +++ b/sca-cpp/trunk/components/sqldb/pgsql.hpp @@ -320,7 +320,7 @@ const failable patch(const value& key, const value& val, const PGSql& pgsq * Convert a key to an item id. */ const list keyid(const list& key) { - if (isNil(key)) + if (isNull(key)) return nilListValue; if (isList(car(key))) return keyid(cdr(key)); @@ -331,7 +331,7 @@ const list keyid(const list& key) { * Convert a key to a (param name, value) assoc. */ const list keyparams(const list& key) { - if (isNil(key)) + if (isNull(key)) return nilListValue; if (!isList(car(key))) return keyparams(cdr(key)); @@ -386,11 +386,11 @@ const failable get(const value& key, const PGSql& pgsql) { const list rank = assoc("rank", kparams); const list id = lk? keyid(key) : nilListValue; const list atable = assoc("table", kparams); - const string table = isNil(atable)? pgsql.table : (string)cadr(atable); + const string table = isNull(atable)? pgsql.table : (string)cadr(atable); const list akname = assoc("kcolumn", kparams); - const string kname = isNil(akname)? pgsql.kname : (string)cadr(akname); + const string kname = isNull(akname)? pgsql.kname : (string)cadr(akname); const list avname = assoc("vcolumn", kparams); - const string vname = isNil(avname)? pgsql.vname : (string)cadr(avname); + const string vname = isNull(avname)? pgsql.vname : (string)cadr(avname); // Build the SQL query const char* sqlparams[6]; @@ -398,60 +398,60 @@ const failable get(const value& key, const PGSql& pgsql) { int w = 0; ostringstream sqlos; sqlos << "select data." << kname << ", data." << vname; - if (!isNil(textsearch)) { + if (!isNull(textsearch)) { // Text search, setup text result ranking sqlos << ", ts_rank_cd(to_tsvector(data." << vname << "), tsquery, 32) as tsrank"; } - if (!isNil(rank)) { + if (!isNull(rank)) { // Ranking, setup rank expression const string rs = (string)cadr(rank); sqlparams[p++] = c_str(rs); sqlos << ", $" << p << " as rank"; } sqlos << " from " << table << " data"; - if (!isNil(textsearch)) { + if (!isNull(textsearch)) { // Text search, define the query const string ts = tstranslate((string)cadr(textsearch)); sqlparams[p++] = c_str(ts); sqlos << ", plainto_tsquery($" << p << ") tsquery"; } - if (!lk || !isNil(id)) { + if (!lk || !isNull(id)) { // Query of the form key = id sqlparams[p++] = c_str(write(content(scheme::writeValue(lk? (value)id : key)))); sqlos << (w == 0? " where" : " and"); sqlos << " data." << kname << " = $" << p; w++; } - if (!isNil(regex)) { + if (!isNull(regex)) { // Query of the form key ~ param sqlparams[p++] = c_str((string)cadr(regex)); sqlos << (w == 0? " where" : " and"); sqlos << " data." << kname << " ~ $" << p; w++; } - if (!isNil(like)) { + if (!isNull(like)) { // Query of the form key like param sqlparams[p++] = c_str((string)cadr(like)); sqlos << (w == 0? " where" : " and"); sqlos << " data." << kname << " like $" << p; w++; } - if (!isNil(textsearch)) { + if (!isNull(textsearch)) { // Text search, apply the query sqlos << (w == 0? " where" : " and"); sqlos << " tsquery @@ to_tsvector(data." << vname << ")"; w++; } - if (!isNil(textsearch) || !isNil(rank)) { + if (!isNull(textsearch) || !isNull(rank)) { // Result ordering - sqlos << " order by" << (isNil(rank)? "" : " rank desc") << ((isNil(rank) || isNil(textsearch))? "" : ",") << (isNil(textsearch)? "" : " tsrank desc"); + sqlos << " order by" << (isNull(rank)? "" : " rank desc") << ((isNull(rank) || isNull(textsearch))? "" : ",") << (isNull(textsearch)? "" : " tsrank desc"); } - if (!isNil(offset)) { + if (!isNull(offset)) { // Result pagination offset sqlos << " offset " << atoi(c_str((string)cadr(offset))); } // Result limit count - const int l = isNil(limit)? 1 : atoi(c_str((string)cadr(limit))); + const int l = isNull(limit)? 1 : atoi(c_str((string)cadr(limit))); sqlos << " limit " << l << ";"; // Execute the query diff --git a/sca-cpp/trunk/components/sqldb/sqldb.cpp b/sca-cpp/trunk/components/sqldb/sqldb.cpp index 75be2c0624..c0fcd0a2f1 100644 --- a/sca-cpp/trunk/components/sqldb/sqldb.cpp +++ b/sca-cpp/trunk/components/sqldb/sqldb.cpp @@ -69,7 +69,7 @@ const failable put(const list& params, const pgsql::PGSql& pg) { const failable patch(const list& params, const pgsql::PGSql& pg) { // Read patch value p = assoc("patch", assoc("content", car(cadr(params)))); - if (isNil(p)) + if (isNull(p)) return mkfailure("Couldn't read patch script"); const string script = cadr(p); debug(script, "pgsql::patch::script"); @@ -92,7 +92,7 @@ const failable patch(const list& params, const pgsql::PGSql& pg) { istringstream is(script); scheme::Env env = scheme::setupEnvironment(); const value pval = scheme::evalScript(cons("patch", scheme::quotedParameters(mklist(key, hasContent(ival)? content(ival) : (value)list()))), is, env); - if (isNil(pval)) { + if (isNull(pval)) { ostringstream os; os << "Couldn't patch postgresql entry: " << key; return mkfailure(str(os), 404, false); diff --git a/sca-cpp/trunk/hosting/server/accounts.py b/sca-cpp/trunk/hosting/server/accounts.py index 99655620f1..6aa50c9375 100644 --- a/sca-cpp/trunk/hosting/server/accounts.py +++ b/sca-cpp/trunk/hosting/server/accounts.py @@ -28,7 +28,7 @@ def accountid(user): def get(id, user, cache): debug('accounts.py::get::id', id) account = cache.get(accountid(user)) - if isNil(account): + if isNull(account): return mkentry(user.get(()), user.get(()), user.get(()), now(), ()) return account diff --git a/sca-cpp/trunk/hosting/server/apps.py b/sca-cpp/trunk/hosting/server/apps.py index 5b0c1b8831..20c38cb3c5 100644 --- a/sca-cpp/trunk/hosting/server/apps.py +++ b/sca-cpp/trunk/hosting/server/apps.py @@ -34,7 +34,7 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): if car(id) == eid: # Check app author eapp = cache.get(appid(id)) - if (not isNil(eapp)) and (author(eapp) != user.get(())): + if (not isNull(eapp)) and (author(eapp) != user.get(())): debug('apps.py::put', 'different author', author(eapp)) return False @@ -45,7 +45,7 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): dashboard.put(id, appentry) # Create new page and composite if necessary - if isNil(eapp): + if isNull(eapp): comp = mkentry(car(id), car(id), user.get(()), now(), ()) composites.put(id, comp) page = mkentry(car(id), car(id), user.get(()), now(), ()) @@ -57,13 +57,13 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): # Check app author eapp = cache.get(appid(id)) - if (not isNil(eapp)) and (author(eapp) != user.get(())): + if (not isNull(eapp)) and (author(eapp) != user.get(())): debug('apps.py::put', 'different author', author(eapp)) return False # Get app to clone capp = cache.get(appid((eid,))) - if isNil(capp): + if isNull(capp): debug('apps.py::put', 'cloned app not found', (eid,)) return False @@ -80,12 +80,12 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): # Get an app from the apps db def get(id, user, cache, dashboard, store, composites, pages, icons): debug('apps.py::get::id', id) - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Apps"), ("'id", "apps")),) # Get the requested app app = cache.get(appid(id)) - if isNil(app): + if isNull(app): debug('apps.py::get', 'app not found', id) return None @@ -99,7 +99,7 @@ def delete(id, user, cache, dashboard, store, composites, pages, icons): # Get the requested app app = cache.get(appid(id)) - if isNil(app): + if isNull(app): debug('apps.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/atomutil.py b/sca-cpp/trunk/hosting/server/atomutil.py index 8f01f81d3a..2fbcaff8ce 100644 --- a/sca-cpp/trunk/hosting/server/atomutil.py +++ b/sca-cpp/trunk/hosting/server/atomutil.py @@ -21,42 +21,42 @@ from time import strftime, gmtime # Make an ATOM entry def mkentry(title, id, author, updated, content): - return (("'entry", ("'title", title), ("'id", id), ("'author", author), ("'updated", updated), ("'content",) if isNil(content) else ("'content", content)),) + return (("'entry", ("'title", title), ("'id", id), ("'author", author), ("'updated", updated), ("'content",) if isNull(content) else ("'content", content)),) # Make an ATOM feed def mkfeed(title, id, author, updated, entries): - return (("'entry", ("'title", title), ("'id", id), ("'author", author), ("'updated", updated), ("'content",) if isNil(content) else ("'content", content)),) + return (("'entry", ("'title", title), ("'id", id), ("'author", author), ("'updated", updated), ("'content",) if isNull(content) else ("'content", content)),) # Return ATOM attributes def title(e): - if isNil(e): + if isNull(e): return () t = assoc("'title", car(e)) - return None if isNil(t) else cadr(t) + return None if isNull(t) else cadr(t) def entryid(e): - if isNil(e): + if isNull(e): return () id = assoc("'id", car(e)) - return None if isNil(id) else cadr(id) + return None if isNull(id) else cadr(id) def author(e): - if isNil(e): + if isNull(e): return () a = assoc("'author", car(e)) - return None if isNil(a) else cadr(a) + return None if isNull(a) else cadr(a) def updated(e): - if isNil(e): + if isNull(e): return () u = assoc("'updated", car(e)) - return None if isNil(u) else cadr(u) + return None if isNull(u) else cadr(u) def content(e): - if isNil(e): + if isNull(e): return () c = assoc("'content", car(e)) - return () if isNil(c) or isNil(cdr(c)) else c[len(c) - 1] + return () if isNull(c) or isNull(cdr(c)) else c[len(c) - 1] # Return the current time def now(): diff --git a/sca-cpp/trunk/hosting/server/authn.py b/sca-cpp/trunk/hosting/server/authn.py index 02c24a2852..e3d6711cbd 100644 --- a/sca-cpp/trunk/hosting/server/authn.py +++ b/sca-cpp/trunk/hosting/server/authn.py @@ -25,7 +25,7 @@ def authnid(id): # Get a user's authentication def get(id, cache): authn = cache.get(authnid(id)) - if isNil(authn): + if isNull(authn): return None return authn diff --git a/sca-cpp/trunk/hosting/server/client-test.hpp b/sca-cpp/trunk/hosting/server/client-test.hpp index 9d887e0558..7620326421 100644 --- a/sca-cpp/trunk/hosting/server/client-test.hpp +++ b/sca-cpp/trunk/hosting/server/client-test.hpp @@ -221,7 +221,7 @@ const list > startPost(const worker& w, const int threads, const bl } const bool checkPost(const list >& r) { - if (isNil(r)) + if (isNull(r)) return true; assert(car(r) == true); return checkPost(cdr(r)); @@ -279,7 +279,7 @@ const list startPost(const int procs, const blambda& l) { } const bool checkPost(const list& r) { - if (isNil(r)) + if (isNull(r)) return true; int status; waitpid(car(r), &status, 0); diff --git a/sca-cpp/trunk/hosting/server/composites.py b/sca-cpp/trunk/hosting/server/composites.py index 9e4b40b669..d0276ab5ee 100644 --- a/sca-cpp/trunk/hosting/server/composites.py +++ b/sca-cpp/trunk/hosting/server/composites.py @@ -31,7 +31,7 @@ def put(id, comp, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('composites.py::put', 'app not found', id) return False @@ -48,12 +48,12 @@ def put(id, comp, user, cache, apps): # Get a composite from the composite db def get(id, user, cache, apps): debug('composites.py::get::id', id) - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Composites"), ("'id", "composites")),) # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('composites.py::get', 'app not found', id) # Return a default new composite @@ -61,7 +61,7 @@ def get(id, user, cache, apps): # Get the requested composite comp = cache.get(compid(id)) - if isNil(comp): + if isNull(comp): debug('composites.py::get', 'composite not found', id) # Return a default new composite @@ -78,7 +78,7 @@ def delete(id, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('composites.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/dashboards.py b/sca-cpp/trunk/hosting/server/dashboards.py index a87f1fa819..d2dca67ddd 100644 --- a/sca-cpp/trunk/hosting/server/dashboards.py +++ b/sca-cpp/trunk/hosting/server/dashboards.py @@ -28,10 +28,10 @@ def dashboardid(user): def getdashboard(id, cache): debug('dashboards.py::getdashboard::id', id) val = cache.get(id) - if isNil(val): + if isNull(val): return () dashboard = cdddr(car(val)) - if not isNil(dashboard) and isList(car(cadr(car(dashboard)))): + if not isNull(dashboard) and isList(car(cadr(car(dashboard)))): # Expand list of entries edashboard = tuple(map(lambda e: cons("'entry", e), cadr(car(dashboard)))) debug('dashboards.py::getdashboard::edashboard', edashboard) @@ -53,7 +53,7 @@ def put(id, app, user, cache, apps, ratings): debug('dashboards.py::put::app', app) def putapp(id, app, dashboard): - if isNil(dashboard): + if isNull(dashboard): return app if car(id) == entryid(dashboard): return cons(car(app), cdr(dashboard)) @@ -73,15 +73,15 @@ def mergeapps(entries, apps, ratings): debug('store.py::mergeapp::entry', entry) id = (entryid(entry),) app = apps.get(id) - if isNil(app): + if isNull(app): return ((),) info = content(app) rating = ratings.get(id) rates = content(rating) - mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNil(info) else cdr(info)) + (() if isNil(rates) else cdr(rates))) + mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNull(info) else cdr(info)) + (() if isNull(rates) else cdr(rates))) return mergedentry - mergedentries = tuple(filter(lambda e: not isNil(e), map(lambda e: car(mergeapp((e,))), entries))) + mergedentries = tuple(filter(lambda e: not isNull(e), map(lambda e: car(mergeapp((e,))), entries))) debug('store.py::mergeapps::mergedentries', mergedentries) return mergedentries @@ -90,13 +90,13 @@ def get(id, user, cache, apps, ratings): debug('dashboards.py::get::id', id) def findapp(id, dashboard): - if isNil(dashboard): + if isNull(dashboard): return None if car(id) == entryid(dashboard): return (car(dashboard),) return findapp(id, cdr(dashboard)) - if isNil(id): + if isNull(id): dashboardapps = mergeapps(getdashboard(dashboardid(user), cache), apps, ratings) dashboard = ((("'feed", ("'title", "Your Apps"), ("'id", user.get(()))) + dashboardapps),) debug('dashboards.py::get::dashboard', dashboard) @@ -109,11 +109,11 @@ def get(id, user, cache, apps, ratings): # Delete apps from the user's dashboard def delete(id, user, cache, apps, ratings): debug('dashboards.py::delete::id', id) - if isNil(id): + if isNull(id): return cache.delete(dashboardid(user)) def deleteapp(id, dashboard): - if isNil(dashboard): + if isNull(dashboard): return () if car(id) == entryid(dashboard): return cdr(dashboard) diff --git a/sca-cpp/trunk/hosting/server/htdocs/account/index.html b/sca-cpp/trunk/hosting/server/htdocs/account/index.html index 47c0ea0e9c..9357a89dd6 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/account/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/account/index.html @@ -133,29 +133,29 @@ var savedpicxml = ''; var acct = cadr(assoc("'content", acctentry)); var email = assoc("'email", acct); - $('userEmail').value = isNil(email) || isNil(cdr(email))? '' : cadr(email); + $('userEmail').value = isNull(email) || isNull(cdr(email))? '' : cadr(email); var desc = assoc("'description", acct); - $('userDescription').innerHTML = isNil(desc) || isNil(cdr(desc))? '' : cadr(desc); + $('userDescription').innerHTML = isNull(desc) || isNull(cdr(desc))? '' : cadr(desc); /* TODO disabled for now var cal = assoc("'calendar", acct); reduce(function(i, evt) { var sched = assoc("'@schedule", evt); var svc = assoc("'@service", evt); - $('sched' + i).value = isNil(sched)? '' : cadr(sched); - $('service' + i).value = isNil(svc)? '' : cadr(svc); + $('sched' + i).value = isNull(sched)? '' : cadr(sched); + $('service' + i).value = isNull(svc)? '' : cadr(svc); return i + 1; - }, 1, isNil(cal)? mklist() : cadr(cadr(cal))); + }, 1, isNull(cal)? mklist() : cadr(cadr(cal))); var keys = assoc("'keys", acct); reduce(function(i, key) { var kn = assoc("'@name", key); var kv = assoc("'@value", key); - $('name' + i).value = isNil(kn)? '' : cadr(kn); - $('value' + i).value = isNil(kv)? '' : cadr(kv); + $('name' + i).value = isNull(kn)? '' : cadr(kn); + $('value' + i).value = isNull(kv)? '' : cadr(kv); return i + 1; - }, 1, isNil(keys)? mklist() : cadr(cadr(keys))); + }, 1, isNull(keys)? mklist() : cadr(cadr(keys))); */ savedacctxml = car(atom.writeATOMEntry(valuesToElements(mklist(acctentry)))); @@ -184,7 +184,7 @@ var savedpicxml = ''; var content = assoc("'content", picentry); var picture = assoc("'picture", content); var img = assoc("'image", picture); - if (!isNil(img)) + if (!isNull(img)) $('userPicture').src = cadr(img); onlinestatus(); @@ -216,11 +216,11 @@ function refreshpic() { var token = assoc("'token", picture); // Update picture - if (isNil(token)) { + if (isNull(token)) { var entryxml = car(atom.writeATOMEntry(valuesToElements(mklist(picentry)))); savedpicxml = entryxml; var img = assoc("'image", picture); - if (!isNil(img)) + if (!isNull(img)) $('userPicture').src = cadr(img); $('refreshingPicture').style.display = 'none'; refreshingpic = false; @@ -237,7 +237,7 @@ function refreshpic() { * Save the user's account. */ function saveacct(entryxml) { - if (isNil(username)) + if (isNull(username)) return false; workingstatus(true); showstatus('Saving'); @@ -261,7 +261,7 @@ function saveacct(entryxml) { * Save the user's picture. */ function savepic(entryxml) { - if (isNil(username)) + if (isNull(username)) return false; workingstatus(true); showstatus('Uploading'); diff --git a/sca-cpp/trunk/hosting/server/htdocs/app/index.html b/sca-cpp/trunk/hosting/server/htdocs/app/index.html index cd033118a3..9ff3a72b0f 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/app/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/app/index.html @@ -207,7 +207,7 @@ window.addEventListener('online', function(e) { * as a list of ids. */ function namedvalue(l, id) { - if (isNil(l)) + if (isNull(l)) return null; var e = car(l); @@ -215,7 +215,7 @@ function namedvalue(l, id) { if (car(id) == elementName(e)) { // Found element matching the whole id path - if (isNil(cdr(id))) + if (isNull(cdr(id))) return e; // Search for next id segments in child elements @@ -267,15 +267,15 @@ function setwidgetvalue(e, dv) { } function vattr(dv) { - return (elementHasValue(dv) && !isNil(elementValue(dv)))? mklist(mklist('value', isNil(elementValue(dv))? '' : elementValue(dv))) : mklist(); + return (elementHasValue(dv) && !isNull(elementValue(dv)))? mklist(mklist('value', isNull(elementValue(dv))? '' : elementValue(dv))) : mklist(); } function sattr(dv) { var s = namedElementChild("'htstyle", dv); - return isNil(s)? mklist() : mklist(mklist('style', elementHasValue(s)? elementValue(s) : elementChildren(s))) + return isNull(s)? mklist() : mklist(mklist('style', elementHasValue(s)? elementValue(s) : elementChildren(s))) } - var attrs = append(append(isNil(htattrs)? mklist() : map(attr, elementChildren(htattrs)), vattr(dv)), sattr(dv)); + var attrs = append(append(isNull(htattrs)? mklist() : map(attr, elementChildren(htattrs)), vattr(dv)), sattr(dv)); // Set the attributes of the widget function setattrs(vsetter, attrs, ce) { @@ -312,7 +312,7 @@ function setwidgetvalue(e, dv) { // Define the stylesheet if (s != '') { var esheet = ui.elementByID(contentdiv, 'style_' + e.id); - if (isNil(esheet)) { + if (isNull(esheet)) { var nesheet = document.createElement('style'); nesheet.id = 'style_' + e.id; nesheet.type = 'text/css'; @@ -330,7 +330,7 @@ function setwidgetvalue(e, dv) { ce.setAttribute('style', p); // Restart current animation if necessary - if (!isNil(aname) && ce.style.webkitAnimationName == aname) { + if (!isNull(aname) && ce.style.webkitAnimationName == aname) { ce.style.webkitAnimationName = ''; ui.async(function restartanimation() { ce.style.webkitAnimationName = aname; @@ -381,12 +381,12 @@ function setwidgetvalue(e, dv) { return setattrs(setselectvalue, attrs, ce); } if (e.className == 'list') { - var dl = ui.datalist(isNil(dv)? mklist() : mklist(dv)); + var dl = ui.datalist(isNull(dv)? mklist() : mklist(dv)); e.innerHTML = dl; return dl; } if (e.className == 'table') { - var dl = ui.datatable(isNil(dv)? mklist() : mklist(dv)); + var dl = ui.datatable(isNull(dv)? mklist() : mklist(dv)); e.innerHTML = dl; return dl; } @@ -422,19 +422,19 @@ function setwidgetvalue(e, dv) { * Update the app page with the given app data. */ function updatepage(l) { - if (isNil(l)) + if (isNull(l)) return true; // Update the widgets values function updatewidget(e) { var dv = namedvalue(l, map(function(t) { return "'" + t; }, e.id.split('.'))); - if (dv == null || isNil(dv)) + if (dv == null || isNull(dv)) return e; setwidgetvalue(e, dv); return e; } - map(updatewidget, filter(function(e) { return !isNil(e.id) && e.id.substring(0, 5) != 'page:'; }, nodeList(ui.elementByID(contentdiv, 'page').childNodes))); + map(updatewidget, filter(function(e) { return !isNull(e.id) && e.id.substring(0, 5) != 'page:'; }, nodeList(ui.elementByID(contentdiv, 'page').childNodes))); return true; } @@ -442,7 +442,7 @@ function updatepage(l) { * Convert a document to application data. */ function docdata(doc) { - if (isNil(doc)) + if (isNull(doc)) return null; if (json.isJSON(mklist(doc))) @@ -566,7 +566,7 @@ function fixupwidget(e) { * Set initial value of a widget. */ function initwidget(e) { - if (!isNil(e.id) && e.id.substring(0, 5) != 'page:') + if (!isNull(e.id) && e.id.substring(0, 5) != 'page:') setwidgetvalue(e, mklist()); return e; } @@ -575,9 +575,9 @@ function initwidget(e) { * Return the component bound to a uri. */ function isbound(uri, comps) { - return !isNil(filter(function(comp) { - return !isNil(filter(function(svc) { - return !isNil(filter(function(b) { + return !isNull(filter(function(comp) { + return !isNull(filter(function(svc) { + return !isNull(filter(function(b) { return uri == scdl.uri(b); }, scdl.bindings(svc))); }, scdl.services(comp))); @@ -592,7 +592,7 @@ function getappdata(appname, page, compos) { // Eval a component init script function evalcompinit(doc) { - if (isNil(doc)) + if (isNull(doc)) return true; var js = car(json.readJSON(mklist(doc))); if (!elementHasValue(js)) @@ -609,7 +609,7 @@ function getappdata(appname, page, compos) { } // Setup the widgets - map(setupwidget, filter(function(e) { return !isNil(e.id); }, nodeList(ui.elementByID(contentdiv, 'page').childNodes))); + map(setupwidget, filter(function(e) { return !isNull(e.id); }, nodeList(ui.elementByID(contentdiv, 'page').childNodes))); // Get the app components var comps = scdl.components(compos); @@ -617,7 +617,7 @@ function getappdata(appname, page, compos) { // Get the component app data if (isbound("start", comps)) { startcomp.get(location.search, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(start, ' + location.search + ')', e); return false; } @@ -630,7 +630,7 @@ function getappdata(appname, page, compos) { // Get and eval the optional timer, animation and location watch setup scripts if (isbound("timer", comps)) { timercomp.get('setup', function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(timer, setup)', e); return false; } @@ -642,7 +642,7 @@ function getappdata(appname, page, compos) { if (isbound("animation", comps)) { animationcomp.get('setup', function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(animation, setup)', e); return false; } @@ -654,7 +654,7 @@ function getappdata(appname, page, compos) { if (isbound("location", comps)) { locationcomp.get('setup', function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(location, setup)', e); return false; } @@ -677,7 +677,7 @@ function getappdata(appname, page, compos) { */ function atompage(doc) { var entry = atom.readATOMEntry(mklist(doc)); - if (isNil(entry)) + if (isNull(entry)) return mklist(); var content = namedElementChild("'content", car(entry)); if (content == null) @@ -691,7 +691,7 @@ function atompage(doc) { function getapppage(appname, compos) { pagecomp.get(appname, function(doc, e) { //debug('page get'); - if (isNil(doc)) { + if (isNull(doc)) { debug('error in getapppage', e); return false; } @@ -702,7 +702,7 @@ function getapppage(appname, compos) { apppage = page; // Merge in the app data - if (!isNil(appcomposite)) + if (!isNull(appcomposite)) getappdata(appname, apppage, appcomposite); }); @@ -720,10 +720,10 @@ function compquery() { return append(nodeList(n.childNodes), reduce(append, mklist(), map(childrenList, nodeList(n.childNodes)))); } - var args = map(queryarg, filter(function(e) { return !isNil(e.id) && !isNil(inputvalue(e)); }, childrenList(ui.elementByID(contentdiv, 'page')))); + var args = map(queryarg, filter(function(e) { return !isNull(e.id) && !isNull(inputvalue(e)); }, childrenList(ui.elementByID(contentdiv, 'page')))); // Append current location properties if known - if (!isNil(geoposition)) { + if (!isNull(geoposition)) { var g = geoposition; args = append(args, mklist('latitude=' + g.coords.latitude, 'longitude=' + g.coords.longitude, 'altitude=' + g.coords.altitude, 'accuracy=' + g.coords.accuracy, 'altitudeAccuracy=' + g.coords.altitudeAccuracy, 'heading=' + g.coords.heading, @@ -740,7 +740,7 @@ function buttonClickHandler(id, appname) { try { var uri = compquery(); return sca.component(id, appname).get(uri, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(button, ' + uri + ')', e); return false; } @@ -761,7 +761,7 @@ function intervalHandler() { try { var uri = compquery(); return timercomp.get(uri, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(timer, ' + uri + ')', e); return false; } @@ -804,7 +804,7 @@ function animationHandler() { updatepage(car(currentAnimationData)); // End of animation? - if (isNil(cdr(currentAnimationData))) { + if (isNull(cdr(currentAnimationData))) { if (currentAnimationLoop == -1) { // Repeat current animation forever currentAnimationData = animationData; @@ -830,12 +830,12 @@ function animationHandler() { } // Get new animation data if necessary - if (isNil(animationData)) { + if (isNull(animationData)) { if (gettingAnimationData) return true; var uri = compquery(); return animationcomp.get(uri, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(animation, ' + uri + ')', e); return false; } @@ -882,7 +882,7 @@ function locationHandler(pos) { geoposition = pos; var uri = compquery(); return locationcomp.get(uri, function(doc, e) { - if (isNil(doc)) { + if (isNull(doc)) { debug('error on get(location, ' + uri + ')', e); return false; } @@ -897,7 +897,7 @@ function locationHandler(pos) { function locationErrorHandler(e) { debug('location error', e); - if (!isNil(locationWatch)) { + if (!isNull(locationWatch)) { try { navigator.geolocation.clearWatch(locationWatch); } catch(e) {} @@ -911,7 +911,7 @@ function locationErrorHandler(e) { */ function setupLocationHandler() { function installLocationHandler() { - if (!isNil(locationWatch)) + if (!isNull(locationWatch)) return true; try { locationWatch = navigator.geolocation.watchPosition(locationHandler, locationErrorHandler); @@ -940,7 +940,7 @@ document.body.onorientationchange = function(e) { */ function atomcomposite(doc) { var entry = atom.readATOMEntry(mklist(doc)); - if (isNil(entry)) + if (isNull(entry)) return mklist(); var content = namedElementChild("'content", car(entry)); if (content == null) @@ -954,13 +954,13 @@ function atomcomposite(doc) { function getappcomposite(appname) { return composcomp.get(appname, function(doc, e) { //debug('page get'); - if (isNil(doc)) { + if (isNull(doc)) { debug('error in getappcomposite', e); return false; } var compos = atomcomposite(doc); - if (isNil(compos)) { + if (isNull(compos)) { // Create a default empty composite if necessary var x = '' + s + ''; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -249,7 +249,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -286,10 +286,10 @@ map(function(res) { */ function viewtransition(ouri, uri) { var ot = apptransitions[ouri]; - if (isNil(ot)) + if (isNull(ot)) return 'left'; var t = apptransitions[uri]; - if (isNil(t)) + if (isNull(t)) return 'left'; return t < ot? 'right' : 'left'; } @@ -330,7 +330,7 @@ function showmenu(view, appname) { append(mklist(ui.menu('menuhome', 'Home', '/', '_view', view == 'home'), ui.menu('menustore', 'Store', '/#view=store&category=' + storecat + '&idx=' + storeidx, '_view', view == 'store'), ui.menu('menusearch', 'Search', '/#view=search', '_view', view == 'search')), - (isNil(appname) || appname == 'undefined')? + (isNull(appname) || appname == 'undefined')? mklist() : mklist( ui.menu('menuinfo', 'Info', '/#view=info&app=' + appname, '_view', view == 'info'), @@ -341,7 +341,7 @@ function showmenu(view, appname) { ui.menu('menurun', 'Run!', '/' + appname + '/', '_blank', false) */ )), - (isNil(appname) || appname == 'undefined')? mklist( + (isNull(appname) || appname == 'undefined')? mklist( ui.menufunc('menusignout', 'Sign out', 'return logout();', false), ui.menu('menuaccount', 'Account', '/#view=account', '_view', view == 'account')) : mklist()); @@ -376,13 +376,13 @@ function showview(url) { // Determine the view to show var params = ui.fragmentParams(url); - var view = isNil(params['view'])? 'home' : params['view'];; + var view = isNull(params['view'])? 'home' : params['view'];; var uri = '/' + view + '/'; - var idx = isNil(params['idx'])? 0 : parseInt(params['idx']); + var idx = isNull(params['idx'])? 0 : parseInt(params['idx']); // Track store category view if (view == 'store') { - storecat = isNil(params['category'])? 'top' : params['category']; + storecat = isNull(params['category'])? 'top' : params['category']; storeidx = idx; } @@ -406,7 +406,7 @@ function showview(url) { if (ui.isMobile()) { // Prepare current view for transition out var ovdiv = viewdiv; - if (!isNil(ovdiv)) { + if (!isNull(ovdiv)) { ovdiv.skipNode = true; ovdiv.className = 'viewunloading3dm'; } @@ -420,7 +420,7 @@ function showview(url) { ui.async(function mtransitionview() { // Transition the old view out - if (!isNil(ovdiv)) + if (!isNull(ovdiv)) ovdiv.className = vtransition + 'viewunloaded3dm'; // Transition the new view in @@ -430,7 +430,7 @@ function showview(url) { } else { // Prepare current view for transition out var ovdiv = viewdiv; - if (!isNil(ovdiv)) + if (!isNull(ovdiv)) ovdiv.skipNode = true; // Load the requested doc into the view @@ -445,7 +445,7 @@ function showview(url) { vdiv.className = 'viewloaded3d'; // Transition the old view out - if (!isNil(ovdiv)) + if (!isNull(ovdiv)) ovdiv.parentNode.removeChild(ovdiv); }); } @@ -649,7 +649,7 @@ document.body.onorientationchange = function(e) { appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } @@ -697,7 +697,7 @@ window.onload = function() { document.referrer.indexOf('//accounts.google.com/ServiceLogin') != -1 || document.referrer.indexOf('//www.facebook.com/login.php') != -1)) { var lv = lastvisited(); - var url = isNil(lv)? location.pathname : lv; + var url = isNull(lv)? location.pathname : lv; updatelocation(url); if (url == viewurl) return true; diff --git a/sca-cpp/trunk/hosting/server/htdocs/info/index.html b/sca-cpp/trunk/hosting/server/htdocs/info/index.html index 0d72062719..3038d37cf2 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/info/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/info/index.html @@ -100,7 +100,7 @@ var savediconxml; * Get and display the requested app. */ (function getapp() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -118,10 +118,10 @@ var savediconxml; author = cadr(assoc("'author", appentry)); $('appAuthor').value = author.split('@')[0]; var updated = assoc("'updated", appentry); - $('appUpdated').value = isNil(updated)? '' : xmldatetime(cadr(updated)).toLocaleDateString(); + $('appUpdated').value = isNull(updated)? '' : xmldatetime(cadr(updated)).toLocaleDateString(); var content = cadr(assoc("'content", appentry)); var description = assoc("'description", content); - $('appDescription').value = isNil(description) || isNil(cadr(description))? '' : cadr(description); + $('appDescription').value = isNull(description) || isNull(cadr(description))? '' : cadr(description); //var ratingy = -20 * (4 - Math.floor(Math.random() * 4)); //$('appRating').style.backgroundPosition = '0px ' + ratingy + 'px'; //$('appRatings').value = ''; @@ -165,7 +165,7 @@ var savediconxml; var content = assoc("'content", picentry); var picture = assoc("'picture", content); var img = assoc("'image", picture); - if (!isNil(img)) + if (!isNull(img)) $('authorPicture').src = cadr(img); onlinestatus(); @@ -179,7 +179,7 @@ var savediconxml; * Get and display the app icon. */ (function geticon() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -197,7 +197,7 @@ var savediconxml; var content = assoc("'content", iconentry); var icon = assoc("'icon", content); var img = assoc("'image", icon); - if (!isNil(img)) + if (!isNull(img)) $('appIcon').src = cadr(img); onlinestatus(); @@ -212,7 +212,7 @@ var savediconxml; */ var refreshingicon = false; function refreshicon() { - if (isNil(appname)) + if (isNull(appname)) return false; if (!refreshingicon) return false; @@ -231,11 +231,11 @@ function refreshicon() { var token = assoc("'token", icon); // Update icon - if (isNil(token)) { + if (isNull(token)) { var entryxml = car(atom.writeATOMEntry(valuesToElements(mklist(iconentry)))); savediconxml = entryxml; var img = assoc("'image", icon); - if (!isNil(img)) + if (!isNull(img)) $('appIcon').src = cadr(img); $('refreshingIcon').style.display = 'none'; refreshingicon = false; @@ -252,7 +252,7 @@ function refreshicon() { * Get and display the app ratings. */ (function getratings() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -272,8 +272,8 @@ function refreshicon() { var ar2 = assoc("'rating2", aratings); var ar3 = assoc("'rating3", aratings); var ar4 = assoc("'rating4", aratings); - var rating = isNil(ar)? 0 : Number(cadr(ar)); - var reviews = (isNil(ar1)? 0 : Number(cadr(ar1))) + (isNil(ar2)? 0 : Number(cadr(ar2))) + (isNil(ar3)? 0 : Number(cadr(ar3))) + (isNil(ar4)? 0 : Number(cadr(ar4))); + var rating = isNull(ar)? 0 : Number(cadr(ar)); + var reviews = (isNull(ar1)? 0 : Number(cadr(ar1))) + (isNull(ar2)? 0 : Number(cadr(ar2))) + (isNull(ar3)? 0 : Number(cadr(ar3))) + (isNull(ar4)? 0 : Number(cadr(ar4))); var ratingy = -20 * (4 - Math.floor(rating)); $('appRating').style.backgroundPosition = '0px ' + ratingy + 'px'; diff --git a/sca-cpp/trunk/hosting/server/htdocs/login/index.html b/sca-cpp/trunk/hosting/server/htdocs/login/index.html index efc3feaeaa..93d47d3f28 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/login/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/login/index.html @@ -212,7 +212,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -230,7 +230,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '' + s + ''; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -258,7 +258,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -469,7 +469,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/page/index.html b/sca-cpp/trunk/hosting/server/htdocs/page/index.html index c6e1108ce5..ca89ed34db 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/page/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/page/index.html @@ -132,7 +132,7 @@ var pages = sca.reference(editorComp, 'pages'); */ var msiefixupbounds = ui.isMSIE(); function widgettransform(e) { - if (!isNil(e.xtranslate)) + if (!isNull(e.xtranslate)) return [e.xtranslate, e.ytranslate]; var t = e.style.getPropertyValue('-webkit-transform') || e.style.getPropertyValue('-moz-transform') || e.style.getPropertyValue('-ms-transform') || e.style.getPropertyValue('-o-transform') || @@ -156,7 +156,7 @@ function widgettransform(e) { */ function widgetxpos(e) { var t = widgettransform(e)[0]; - return ui.numpos(e.style.left) + (isNil(t)? 0 : t); + return ui.numpos(e.style.left) + (isNull(t)? 0 : t); } /** @@ -164,7 +164,7 @@ function widgetxpos(e) { */ function widgetypos(e) { var t = widgettransform(e)[1]; - return ui.numpos(e.style.top) + (isNil(t)? 0 : t); + return ui.numpos(e.style.top) + (isNull(t)? 0 : t); } /** @@ -290,7 +290,7 @@ function clonewidget(e) { */ function selectwidget(n, s) { //debug('selectwidget', n, s); - if (isNil(n) || !s) { + if (isNull(n) || !s) { // Clear the widget value field $('widgetValue').value = ''; $('widgetValue').readOnly = true; @@ -304,7 +304,7 @@ function selectwidget(n, s) { $('deleteWidgetButton').disabled = true; // Clear the widget outline - if (!isNil(n)) + if (!isNull(n)) n.style.removeProperty('outline'); return true; } @@ -422,44 +422,44 @@ function setwidgettext(e, t) { e.id = f != ''? f.substring(1) : ('page:' + wc); if (wc == 'hd1' || wc == 'hd2' || wc == 'text' || wc == 'section') { - car(childElements(e)).innerHTML = isNil(c)? f : car(c); + car(childElements(e)).innerHTML = isNull(c)? f : car(c); return t; } if (wc == 'button') { - car(childElements(e)).value = isNil(c)? f : car(c); + car(childElements(e)).value = isNull(c)? f : car(c); return t; } if (wc == 'entry' || wc == 'password') { - car(childElements(e)).defaultValue = isNil(c)? f : car(c); + car(childElements(e)).defaultValue = isNull(c)? f : car(c); return t; } if (wc == 'checkbox') { - car(childElements(e)).value = isNil(c)? f : car(c); - map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = isNil(c)? f : car(c); return n; }, nodeList(e.childNodes)); + car(childElements(e)).value = isNull(c)? f : car(c); + map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = isNull(c)? f : car(c); return n; }, nodeList(e.childNodes)); return t; } if (wc == 'select') { var ce = car(childElements(car(childElements(e)))); - ce.value = isNil(c)? f : car(c); - ce.innerHTML = isNil(c)? f : car(c); + ce.value = isNull(c)? f : car(c); + ce.innerHTML = isNull(c)? f : car(c); return t; } if (wc == 'list') { - e.innerHTML = '
' + (isNil(c)? f : car(c)) + '
...
'; + e.innerHTML = '
' + (isNull(c)? f : car(c)) + '
...
'; return t; } if (wc == 'table') { - e.innerHTML = '
' + (isNil(c)? f : car(c)) + '...
......
'; + e.innerHTML = '
' + (isNull(c)? f : car(c)) + '...
......
'; return t; } if (wc == 'link') { var ce = car(childElements(e)); - ce.href = isNil(c)? 'link:/index.html' : ('link:' + car(c)); - car(childElements(ce)).innerHTML = isNil(c)? (f != ''? f : '/index.html') : isNil(cdr(c))? (f != ''? f : car(c)) : cadr(c); + ce.href = isNull(c)? 'link:/index.html' : ('link:' + car(c)); + car(childElements(ce)).innerHTML = isNull(c)? (f != ''? f : '/index.html') : isNull(cdr(c))? (f != ''? f : car(c)) : cadr(c); return t; } if (wc == 'img') { - car(childElements(e)).src = isNil(c)? '/public/img.png' : car(c); + car(childElements(e)).src = isNull(c)? '/public/img.png' : car(c); return t; } return ''; @@ -512,7 +512,7 @@ function widgetbounds(e) { //debug('fixup br', e, br.left, br.top, br.right, br.bottom, t[0], t[1]); function fixuptransform(e) { var t = widgettransform(e); - if (!isNil(e.xtranslate)) + if (!isNull(e.xtranslate)) return [e.xtranslate, e.ytranslate]; var t = e.style.getPropertyValue('-webkit-transform') || e.style.getPropertyValue('-moz-transform') || e.style.getPropertyValue('-ms-transform') || e.style.getPropertyValue('-o-transform') || @@ -538,12 +538,12 @@ function widgetbounds(e) { */ function draggable(x, y, l) { //debug('draggable?', x, y, l); - if (isNil(l)) + if (isNull(l)) return null; var n = car(l); - if (isNil(n.id) || n.id == '') { + if (isNull(n.id) || n.id == '') { var d = draggable(x, y, reverse(nodeList(n.childNodes))); - if (!isNil(d)) + if (!isNull(d)) return d; return draggable(x, y, cdr(l)); } @@ -849,9 +849,9 @@ function mkeditor() { onpagechange(false); // On Firefox > 4, re-apply the outline after the widget has been repositioned - if (fffixupoutline && !isNil(selected)) { + if (fffixupoutline && !isNull(selected)) { ui.delay(function() { - if (!isNil(selected)) + if (!isNull(selected)) selected.style.outline = '2px solid #598edd'; }, 32); } @@ -932,7 +932,7 @@ function mkeditor() { } // Dismiss the palette - if (palvis && isNil(draggable(moveX, moveY, mklist($('palettecontent'))))) + if (palvis && isNull(draggable(moveX, moveY, mklist($('palettecontent'))))) hidepalette(); return true; @@ -1091,7 +1091,7 @@ function mkeditor() { * Get and display the requested app page. */ (function getpage() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -1108,15 +1108,15 @@ function mkeditor() { // Get the page from the ATOM entry, convert it to XHTML and place it in a hidden buffer var pageentry = car(atom.readATOMEntry(mklist(doc))); var content = namedElementChild("'content", pageentry); - var el = isNil(content)? mklist() : elementChildren(content); - if (isNil(el)) + var el = isNull(content)? mklist() : elementChildren(content); + if (isNull(el)) $('xhtmlbuffer').innerHTML = '
'; else $('xhtmlbuffer').innerHTML = writeStrings(writeXML(el, false)); // Remove any existing page nodes from the editor div var fnodes = filter(function(e) { - if (isNil(e.id) || e.id == '') + if (isNull(e.id) || e.id == '') return false; return true; }, nodeList($('pagediv').childNodes)); @@ -1169,7 +1169,7 @@ function pagexhtml() { // part of the page, as well as nodes positioned out the // editing area var fnodes = filter(function(e) { - if (isNil(e.id) || e.id == '') + if (isNull(e.id) || e.id == '') return false; return true; }, nodes); diff --git a/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html b/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html index 5ea9d7619d..f7cdab9bf2 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html @@ -161,7 +161,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -179,7 +179,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '' + s + ''; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -207,7 +207,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -329,7 +329,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/config.js b/sca-cpp/trunk/hosting/server/htdocs/public/config.js index be23c7c01e..e3b966d542 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/config.js +++ b/sca-cpp/trunk/hosting/server/htdocs/public/config.js @@ -17,7 +17,7 @@ * under the License. */ -if (isNil(config)) +if (isNull(config)) config = {}; /** diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html index f453e0491c..cf5f3465d8 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html @@ -161,7 +161,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -179,7 +179,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '' + s + ''; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -207,7 +207,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -328,7 +328,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html index c8475147d7..ba82ecb897 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html @@ -162,7 +162,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -180,7 +180,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '' + s + ''; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -208,7 +208,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -329,7 +329,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html index 4bcb3728ae..0597d10942 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html @@ -162,7 +162,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -180,7 +180,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '' + s + ''; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -208,7 +208,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -329,7 +329,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html index 68554efdb0..788435289f 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html @@ -161,7 +161,7 @@ try { * Initialize status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -179,7 +179,7 @@ try { */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '' + s + ''; $('status').className = ui.isMobile()? 'status3dm' : 'status3d'; @@ -207,7 +207,7 @@ window.errorstatus = function(s) { */ window.workingstatus = function(w, c) { //debug('show working', w); - if (isNil($('working'))) + if (isNull($('working'))) return w; if (!ui.isMobile()) $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2)); @@ -328,7 +328,7 @@ var appresources = [ appcache.remove(res[0]); appcache.get(res[0], 'remote'); }, append(appresources, config.appresources())); - if (!isNil(lcmf)) { + if (!isNull(lcmf)) { //debug('reloading'); window.location.reload(); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/rate/index.html b/sca-cpp/trunk/hosting/server/htdocs/rate/index.html index 22f11f631a..90d45bd3ea 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/rate/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/rate/index.html @@ -116,7 +116,7 @@ var savedxml = ''; * Get and display the requested app rating. */ (function getrating() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -133,7 +133,7 @@ var savedxml = ''; appentry = doc != null? car(elementsToValues(atom.readATOMEntry(mklist(doc)))) : mklist("'entry", mklist("'title", ''), mklist("'id", appname)); savedxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry)))); var content = cadr(assoc("'content", appentry)); - if (!isNil(content)) + if (!isNull(content)) selectrating(parseInt(cadr(content))); onlinestatus(); diff --git a/sca-cpp/trunk/hosting/server/htdocs/search/index.html b/sca-cpp/trunk/hosting/server/htdocs/search/index.html index 47d5a757f3..d46b0528c4 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/search/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/search/index.html @@ -74,7 +74,7 @@ function viewapp(appname) { * Get and display an app icon. */ function geticon(appname) { - if (isNil(appname)) + if (isNull(appname)) return false; return icons.get(appname, function(doc) { @@ -86,9 +86,9 @@ function geticon(appname) { var content = assoc("'content", iconentry); var icon = assoc("'icon", content); var img = assoc("'image", icon); - if (!isNil(img)) { + if (!isNull(img)) { var appimg = $('search_app_img_' + appname); - if (!isNil(appimg)) + if (!isNull(appimg)) appimg.src = cadr(img); } return true; @@ -114,7 +114,7 @@ function getapps(query) { var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc)))); var aentries = assoc("'entry", feed); - var entries = isNil(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries)); + var entries = isNull(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries)); var defappimg = ui.b64png(appcache.get('/public/app.b64')); @@ -122,7 +122,7 @@ function getapps(query) { var icons = mklist(); (function displayentries(entries) { - if (isNil(entries)) + if (isNull(entries)) return apps; var entry = car(entries); var title = cadr(assoc("'title", entry)) @@ -136,8 +136,8 @@ function getapps(query) { var ar2 = assoc("'rating2", aratings); var ar3 = assoc("'rating3", aratings); var ar4 = assoc("'rating4", aratings); - var rating = isNil(ar)? 0 : Number(cadr(ar)); - var reviews = (isNil(ar1)? 0 : Number(cadr(ar1))) + (isNil(ar2)? 0 : Number(cadr(ar2))) + (isNil(ar3)? 0 : Number(cadr(ar3))) + (isNil(ar4)? 0 : Number(cadr(ar4))); + var rating = isNull(ar)? 0 : Number(cadr(ar)); + var reviews = (isNull(ar1)? 0 : Number(cadr(ar1))) + (isNull(ar2)? 0 : Number(cadr(ar2))) + (isNull(ar3)? 0 : Number(cadr(ar3))) + (isNull(ar4)? 0 : Number(cadr(ar4))); apps += '
' apps += '
' @@ -165,7 +165,7 @@ function getapps(query) { ui.unmemo$('search_app_'); (function displayicons(icons) { - if (isNil(icons)) + if (isNull(icons)) return true; geticon(car(icons)); return displayicons(cdr(icons)); diff --git a/sca-cpp/trunk/hosting/server/htdocs/store/index.html b/sca-cpp/trunk/hosting/server/htdocs/store/index.html index 15e7aeed0c..57920ede2e 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/store/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/store/index.html @@ -59,10 +59,10 @@ var categories = [ * Find a store category. */ function findcategory(name) { - if (isNil(name)) + if (isNull(name)) return findcategory('featured'); var f = filter(function(c) { return cadr(c) == name }, categories); - if (isNil(f)) + if (isNull(f)) return findcategory('featured'); return car(f); } @@ -121,7 +121,7 @@ $('createApp').onclick = function() { * Get and display an app icon. */ function geticon(appname) { - if (isNil(appname)) + if (isNull(appname)) return false; return icons.get(appname, function(doc) { @@ -133,9 +133,9 @@ function geticon(appname) { var content = assoc("'content", iconentry); var icon = assoc("'icon", content); var img = assoc("'image", icon); - if (!isNil(img)) { + if (!isNull(img)) { var appimg = $('store_app_img_' + appname); - if (!isNil(appimg)) + if (!isNull(appimg)) appimg.src = cadr(img); } return true; @@ -161,7 +161,7 @@ function geticon(appname) { var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc)))); var aentries = assoc("'entry", feed); - var entries = isNil(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries)); + var entries = isNull(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries)); var defappimg = ui.b64png(appcache.get('/public/app.b64')); @@ -169,7 +169,7 @@ function geticon(appname) { var icons = mklist(); (function displayentries(entries) { - if (isNil(entries)) + if (isNull(entries)) return apps; var entry = car(entries); var title = cadr(assoc("'title", entry)) @@ -183,8 +183,8 @@ function geticon(appname) { var ar2 = assoc("'rating2", aratings); var ar3 = assoc("'rating3", aratings); var ar4 = assoc("'rating4", aratings); - var rating = isNil(ar)? 0 : Number(cadr(ar)); - var reviews = (isNil(ar1)? 0 : Number(cadr(ar1))) + (isNil(ar2)? 0 : Number(cadr(ar2))) + (isNil(ar3)? 0 : Number(cadr(ar3))) + (isNil(ar4)? 0 : Number(cadr(ar4))); + var rating = isNull(ar)? 0 : Number(cadr(ar)); + var reviews = (isNull(ar1)? 0 : Number(cadr(ar1))) + (isNull(ar2)? 0 : Number(cadr(ar2))) + (isNull(ar3)? 0 : Number(cadr(ar3))) + (isNull(ar4)? 0 : Number(cadr(ar4))); apps += '
' apps += '
' @@ -213,7 +213,7 @@ function geticon(appname) { ui.unmemo$('store_app_'); (function displayicons(icons) { - if (isNil(icons)) + if (isNull(icons)) return true; geticon(car(icons)); return displayicons(cdr(icons)); diff --git a/sca-cpp/trunk/hosting/server/icons.py b/sca-cpp/trunk/hosting/server/icons.py index 7ee9ae9bfb..d9fbcab448 100644 --- a/sca-cpp/trunk/hosting/server/icons.py +++ b/sca-cpp/trunk/hosting/server/icons.py @@ -49,7 +49,7 @@ def put(id, icon, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('icons.py::put', 'app not found', id) return False @@ -61,23 +61,23 @@ def put(id, icon, user, cache, apps): # Get image and token from input icon def image(c): img = assoc("'image", c) - return None if isNil(img) else to50x50png(cadr(img)) + return None if isNull(img) else to50x50png(cadr(img)) def token(c): tok = assoc("'token", c) - return None if isNil(tok) else cadr(tok) + return None if isNull(tok) else cadr(tok) img = image(content(icon)) tok = token(content(icon)) # Update the icon # Put with an upload token - if not isNil(tok): + if not isNull(tok): debug('icons.py::put::token', tok) # Token alone, store token with existing image, if any - if isNil(img): + if isNull(img): eicon = cache.get(iconid(id)) - eimg = None if isNil(eicon) else image(content(eicon)) - if isNil(eimg): + eimg = None if isNull(eicon) else image(content(eicon)) + if isNull(eimg): iconentry = mkentry(title(app), car(id), author(app), now(), ("'icon", ("'token", tok))) debug('icons.py::put::iconentry', iconentry) return cache.put(iconid(id), iconentry) @@ -90,9 +90,9 @@ def put(id, icon, user, cache, apps): # Token plus image, put image if token is valid, removing the token debug('icons.py::put::img', img) eicon = cache.get(iconid(id)) - etok = None if isNil(eicon) else token(content(eicon)) + etok = None if isNull(eicon) else token(content(eicon)) debug('icons.py::put::etok', etok) - if isNil(etok) or tok != etok: + if isNull(etok) or tok != etok: debug('icons.py::put', 'invalid token', tok) return False @@ -101,7 +101,7 @@ def put(id, icon, user, cache, apps): return cache.put(iconid(id), iconentry) # Update icon image - if not isNil(img): + if not isNull(img): debug('icons.py::put::img', img) iconentry = mkentry(title(app), car(id), author(app), now(), ("'icon", ("'image", img))) debug('icons.py::put::iconentry', iconentry) @@ -115,12 +115,12 @@ def put(id, icon, user, cache, apps): # Get an icon def get(id, user, cache, apps): debug('icons.py::get::id', id) - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Icons"), ("'id", "icons")),) # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('icons.py::get', 'app not found', id) # Return a default new icon @@ -128,7 +128,7 @@ def get(id, user, cache, apps): # Get the requested icon icon = cache.get(iconid(id)) - if isNil(icon): + if isNull(icon): debug('icons.py::get', 'icon not found', id) # Return a default new icon @@ -137,16 +137,16 @@ def get(id, user, cache, apps): # Get image, token, and updated date from icon def image(c): img = assoc("'image", c) - return None if isNil(img) else cadr(img) + return None if isNull(img) else cadr(img) def token(c): tok = assoc("'token", c) - return None if isNil(tok) else cadr(tok) + return None if isNull(tok) else cadr(tok) img = image(content(icon)) tok = token(content(icon)) # Return the icon - iconc = (() if isNil(img) else (("'image", img),)) + (() if isNil(tok) or (user.get(()) != author(app) and user.get(()) != 'admin') else (("'token", tok),)) - if isNil(iconc): + iconc = (() if isNull(img) else (("'image", img),)) + (() if isNull(tok) or (user.get(()) != author(app) and user.get(()) != 'admin') else (("'token", tok),)) + if isNull(iconc): iconentry = mkentry(title(app), car(id), author(app), updated(icon), ()) debug('icons.py::get::iconentry', iconentry) return iconentry @@ -161,7 +161,7 @@ def delete(id, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('icons.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/pages.py b/sca-cpp/trunk/hosting/server/pages.py index d8c774c14d..3d353279ba 100644 --- a/sca-cpp/trunk/hosting/server/pages.py +++ b/sca-cpp/trunk/hosting/server/pages.py @@ -31,7 +31,7 @@ def put(id, page, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('pages.py::put', 'app not found', id) return False @@ -48,12 +48,12 @@ def put(id, page, user, cache, apps): # Get a page from the page db def get(id, user, cache, apps): debug('pages.py::get::id', id) - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Pages"), ("'id", "pages")),) # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('pages.py::get', 'app not found', id) # Return a default new page @@ -61,7 +61,7 @@ def get(id, user, cache, apps): # Get the requested page page = cache.get(pageid(id)) - if isNil(page): + if isNull(page): debug('pages.py::get', 'page not found', id) # Return a default new page @@ -80,7 +80,7 @@ def delete(id, user, cache, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('pages.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/palettes.py b/sca-cpp/trunk/hosting/server/palettes.py index 38e012835a..be681f874c 100644 --- a/sca-cpp/trunk/hosting/server/palettes.py +++ b/sca-cpp/trunk/hosting/server/palettes.py @@ -30,7 +30,7 @@ def put(id, palette, cache): # Get a palette from the palettes db def get(id, cache): - if isNil(id): + if isNull(id): return (("'feed", ("'title", "Palettes"), ("'id", "palettes")),) return mkentry(car(id), car(id), None, now(), car(cache.get(paletteid(id)))) diff --git a/sca-cpp/trunk/hosting/server/pictures.py b/sca-cpp/trunk/hosting/server/pictures.py index fab7df47ce..6c5e268e0f 100644 --- a/sca-cpp/trunk/hosting/server/pictures.py +++ b/sca-cpp/trunk/hosting/server/pictures.py @@ -47,7 +47,7 @@ def put(id, picture, user, cache): debug('pictures.py::put::id', id) debug('pictures.py::put::picture', picture) - picid = user.get(()) if isNil(id) else car(id) + picid = user.get(()) if isNull(id) else car(id) # Only the admin can update other user's pictures if picid != user.get(()) and user.get(()) != 'admin': @@ -57,23 +57,23 @@ def put(id, picture, user, cache): # Get image and token from input picture def image(c): img = assoc("'image", c) - return None if isNil(img) else to50x50png(cadr(img)) + return None if isNull(img) else to50x50png(cadr(img)) def token(c): tok = assoc("'token", c) - return None if isNil(tok) else cadr(tok) + return None if isNull(tok) else cadr(tok) img = image(content(picture)) tok = token(content(picture)) # Update the picture # Put with an upload token - if not isNil(tok): + if not isNull(tok): debug('pictures.py::put::token', tok) # Token alone, store token with existing image, if any - if isNil(img): + if isNull(img): epicture = cache.get(pictureid(picid)) - eimg = None if isNil(epicture) else image(content(epicture)) - if isNil(eimg): + eimg = None if isNull(epicture) else image(content(epicture)) + if isNull(eimg): picentry = mkentry(title(picture), picid, picid, now(), ("'picture", ("'token", tok))) debug('pictures.py::put::picentry', picentry) return cache.put(pictureid(picid), picentry) @@ -86,9 +86,9 @@ def put(id, picture, user, cache): # Token plus image, put image if token is valid, removing the token debug('pictures.py::put::img', img) epicture = cache.get(pictureid(picid)) - etok = None if isNil(epicture) else token(content(epicture)) + etok = None if isNull(epicture) else token(content(epicture)) debug('pictures.py::put::etok', etok) - if isNil(etok) or tok != etok: + if isNull(etok) or tok != etok: debug('pictures.py::put', 'invalid token', tok) return False @@ -97,7 +97,7 @@ def put(id, picture, user, cache): return cache.put(pictureid(picid), picentry) # Update picture image - if not isNil(img): + if not isNull(img): debug('pictures.py::put::img', img) picentry = mkentry(title(picture), picid, picid, now(), ("'picture", ("'image", img))) debug('pictures.py::put::picentry', picentry) @@ -113,24 +113,24 @@ def get(id, user, cache): debug('pictures.py::get::id', id) # Get the requested picture - picid = user.get(()) if isNil(id) else car(id) + picid = user.get(()) if isNull(id) else car(id) picture = cache.get(pictureid(picid)) - if isNil(picture): + if isNull(picture): return mkentry(picid, picid, picid, now(), ()) # Get image and token from picture def image(c): img = assoc("'image", c) - return None if isNil(img) else cadr(img) + return None if isNull(img) else cadr(img) def token(c): tok = assoc("'token", c) - return None if isNil(tok) else cadr(tok) + return None if isNull(tok) else cadr(tok) img = image(content(picture)) tok = token(content(picture)) # Return the picture - picc = (() if isNil(img) else (("'image", img),)) + (() if isNil(tok) or (user.get(()) != author(picture) and user.get(()) != 'admin') else (("'token", tok),)) - if isNil(picc): + picc = (() if isNull(img) else (("'image", img),)) + (() if isNull(tok) or (user.get(()) != author(picture) and user.get(()) != 'admin') else (("'token", tok),)) + if isNull(picc): picentry = mkentry(title(picture), picid, author(picture), updated(picture), ()) debug('pictures.py::get::picentry', picentry) return picentry diff --git a/sca-cpp/trunk/hosting/server/ratings.py b/sca-cpp/trunk/hosting/server/ratings.py index 5638d8609f..d36dcad45e 100644 --- a/sca-cpp/trunk/hosting/server/ratings.py +++ b/sca-cpp/trunk/hosting/server/ratings.py @@ -31,7 +31,7 @@ def put(id, ratings, user, cache, db, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('ratings.py::put', 'app not found', id) return False @@ -52,7 +52,7 @@ def patch(id, ratings, user, cache, db, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('ratings.py::patch', 'app not found', id) return False @@ -107,9 +107,9 @@ def get(id, user, cache, db, apps): debug('ratings.py::get::id', id) # Return the top ratings - if isNil(id): + if isNull(id): topentries = db.get((("'regex", '("ratings" .* "app.ratings")'), ("'rank", "(regexp_matches(value, '(.*\(rating )([^\)]+)(\).*)'))[2]::float"), ("'limit", 25))) - flatentries = tuple(map(lambda v: car(v), () if isNil(topentries) else topentries)) + flatentries = tuple(map(lambda v: car(v), () if isNull(topentries) else topentries)) def rating(e): return cadr(assoc("'rating", assoc("'ratings", assoc("'content", e)))) sortedentries = tuple(sorted(flatentries, key = rating, reverse = True)) @@ -119,7 +119,7 @@ def get(id, user, cache, db, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('ratings.py::get', 'app not found', id) # Return default ratings @@ -127,7 +127,7 @@ def get(id, user, cache, db, apps): # Get the requested ratings ratings = cache.get(ratingsid(id)) - if isNil(ratings): + if isNull(ratings): debug('ratings.py::get', 'ratings not found', id) # Return default ratings @@ -144,7 +144,7 @@ def delete(id, user, cache, db, apps): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('ratings.py::delete', 'app not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/reviews.py b/sca-cpp/trunk/hosting/server/reviews.py index 3c175d8a0f..f3c610467e 100644 --- a/sca-cpp/trunk/hosting/server/reviews.py +++ b/sca-cpp/trunk/hosting/server/reviews.py @@ -28,10 +28,10 @@ def reviewsid(user): def getreviews(id, cache): debug('reviews.py::getreviews::id', id) val = cache.get(id) - if isNil(val): + if isNull(val): return () reviews = cdddr(car(val)) - if not isNil(reviews) and isList(car(cadr(car(reviews)))): + if not isNull(reviews) and isList(car(cadr(car(reviews)))): # Expand list of entries ereviews = tuple(map(lambda e: cons("'entry", e), cadr(car(reviews)))) debug('reviews.py::getreviews::ereviews', ereviews) @@ -42,7 +42,7 @@ def getreviews(id, cache): # Get a review from a user's reviews def getreview(id, reviews): - if isNil(reviews): + if isNull(reviews): return None if car(id) == entryid(reviews): return (car(reviews),) @@ -51,20 +51,20 @@ def getreview(id, reviews): # Get reviews from the user's reviews def get(id, user, cache, apps, ratings): debug('reviews.py::get::id', id) - if isNil(id): + if isNull(id): reviews = ((("'feed", ("'title", "Your Reviews"), ("'id", user.get(()))) + getreviews(reviewsid(user), cache)),) debug('reviews.py::get::reviews', reviews) return reviews # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('reviews.py::get', 'app not found', id) return False # Get the review review = getreview(id, getreviews(reviewsid(user), cache)) - if isNil(review): + if isNull(review): debug('reviews.py::get', 'review not found', id) # Return a default empty review @@ -75,7 +75,7 @@ def get(id, user, cache, apps, ratings): # Patch an app ratings def patchratings(id, user, ratings, oreview, nreview): - patch = ("'patch", ("'old", "0" if isNil(oreview) else cadr(content(oreview))), ("'new", "0" if isNil(nreview) else cadr(content(nreview)))) + patch = ("'patch", ("'old", "0" if isNull(oreview) else cadr(content(oreview))), ("'new", "0" if isNull(nreview) else cadr(content(nreview)))) patchentry = mkentry(car(id), car(id), user.get(()), now(), patch); debug('reviews.py::patchratings::patchentry', patchentry) return ratings.patch(id, patchentry) @@ -89,7 +89,7 @@ def putreviews(id, reviews, cache): # Put a review into a user's reviews def putreview(id, review, reviews): - if isNil(reviews): + if isNull(reviews): return review if car(id) == entryid(reviews): return cons(car(review), cdr(reviews)) @@ -102,7 +102,7 @@ def put(id, review, user, cache, apps, ratings): # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('reviews.py::put', 'app not found', id) return False @@ -122,7 +122,7 @@ def put(id, review, user, cache, apps, ratings): # Delete a review from a reviews record def deletereview(id, reviews): - if isNil(reviews): + if isNull(reviews): return () if car(id) == entryid(reviews): return cdr(reviews) @@ -131,19 +131,19 @@ def deletereview(id, reviews): # Delete reviews from the user's reviews record def delete(id, user, cache, apps, ratings): debug('reviews.py::delete::id', id) - if isNil(id): + if isNull(id): return cache.delete(reviewsid(user)) # Get the requested app app = apps.get(id) - if isNil(app): + if isNull(app): debug('reviews.py::delete', 'app not found', id) return False # Get the review reviews = getreviews(reviewsid(user), cache) review = getreview(id, reviews) - if isNil(review): + if isNull(review): debug('reviews.py::delete', 'review not found', id) return False diff --git a/sca-cpp/trunk/hosting/server/search.py b/sca-cpp/trunk/hosting/server/search.py index b1a7d36733..e79ff0ce51 100644 --- a/sca-cpp/trunk/hosting/server/search.py +++ b/sca-cpp/trunk/hosting/server/search.py @@ -30,10 +30,10 @@ def mergeratings(entries, ratings): info = content(app) rating = ratings.get(id) rates = content(rating) - mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNil(info) else cdr(info)) + (() if isNil(rates) else cdr(rates))) + mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNull(info) else cdr(info)) + (() if isNull(rates) else cdr(rates))) return mergedentry - mergedentries = tuple(filter(lambda e: not isNil(e), map(lambda e: car(mergerating((e,))), entries))) + mergedentries = tuple(filter(lambda e: not isNull(e), map(lambda e: car(mergerating((e,))), entries))) debug('search.py::mergeratings::mergedentries', mergedentries) return mergedentries @@ -41,7 +41,7 @@ def mergeratings(entries, ratings): def get(id, user, cache, db, apps, ratings): debug('search.py::get::id', id) q = assoc("'q", id) - if isNil(q): + if isNull(q): return None # Run the search @@ -49,7 +49,7 @@ def get(id, user, cache, db, apps, ratings): debug('search.py::get::foundentries', foundentries) # Merge app ratings - appentries = mergeratings(tuple(map(lambda v: car(v), () if isNil(foundentries) else foundentries)), ratings) + appentries = mergeratings(tuple(map(lambda v: car(v), () if isNull(foundentries) else foundentries)), ratings) results = ((("'feed", ("'title", "Search Results"), ("'id", 'search')) + appentries),) debug('search.py::get::results', results) diff --git a/sca-cpp/trunk/hosting/server/selector.py b/sca-cpp/trunk/hosting/server/selector.py index 33cd9512cc..4cbe31ba37 100644 --- a/sca-cpp/trunk/hosting/server/selector.py +++ b/sca-cpp/trunk/hosting/server/selector.py @@ -20,9 +20,9 @@ from util import * # Get the database to use for a particular key def get(id, db): - if isNil(id): + if isNull(id): return db - if not isNil(filter(lambda i: isList(i) and not isNil(i) and car(i) == "'limit", id)): + if not isNull(filter(lambda i: isList(i) and not isNull(i) and car(i) == "'limit", id)): return db if cadr(id)[0:1].lower() < 'm': return (db[0],) diff --git a/sca-cpp/trunk/hosting/server/store.py b/sca-cpp/trunk/hosting/server/store.py index 058505b4ee..aac233f877 100644 --- a/sca-cpp/trunk/hosting/server/store.py +++ b/sca-cpp/trunk/hosting/server/store.py @@ -30,10 +30,10 @@ def getstore(id, cache): # Lookup the requested store val = cache.get(id) - if isNil(val): + if isNull(val): return () store = cdddr(car(val)) - if not isNil(store) and isList(car(cadr(car(store)))): + if not isNull(store) and isList(car(cadr(car(store)))): # Expand list of entries estore = tuple(map(lambda e: cons("'entry", e), cadr(car(store)))) debug('store.py::getstore::estore', estore) @@ -57,7 +57,7 @@ def put(id, app, user, cache, apps, ratings): appid = cdr(id) def putapp(appid, app, store): - if isNil(store): + if isNull(store): return app if car(appid) == entryid(store): return cons(car(app), cdr(store)) @@ -77,15 +77,15 @@ def mergeapps(entries, apps, ratings): debug('store.py::mergeapp::entry', entry) id = (entryid(entry),) app = apps.get(id) - if isNil(app): + if isNull(app): return ((),) info = content(app) rating = ratings.get(id) rates = content(rating) - mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNil(info) else cdr(info)) + (() if isNil(rates) else cdr(rates))) + mergedentry = mkentry(title(app), car(id), author(app), updated(app), ("'info",) + (() if isNull(info) else cdr(info)) + (() if isNull(rates) else cdr(rates))) return mergedentry - mergedentries = tuple(filter(lambda e: not isNil(e), map(lambda e: car(mergeapp((e,))), entries))) + mergedentries = tuple(filter(lambda e: not isNull(e), map(lambda e: car(mergeapp((e,))), entries))) debug('store.py::mergeapps::mergedentries', mergedentries) return mergedentries @@ -105,13 +105,13 @@ def get(id, user, cache, apps, ratings): # Collect the featured apps appid = cdr(id) def findapp(appid, store): - if isNil(store): + if isNull(store): return None if car(appid) == entryid(store): return (car(store),) return findapp(appid, cdr(store)) - if isNil(appid): + if isNull(appid): storeapps = mergeapps(getstore(storeid(tag), cache), apps, ratings) store = ((("'feed", ("'title", "App Store"), ("'id", tag)) + storeapps),) debug('store.py::get::store', store) @@ -127,11 +127,11 @@ def delete(id, user, cache, apps, ratings): tag = car(id) appid = cdr(id) - if isNil(appid): + if isNull(appid): return cache.delete(storeid(tag)) def deleteapp(appid, store): - if isNil(store): + if isNull(store): return () if car(appid) == entryid(store): return cdr(store) diff --git a/sca-cpp/trunk/hosting/server/util.py b/sca-cpp/trunk/hosting/server/util.py index 791951a71c..bd37eb11af 100644 --- a/sca-cpp/trunk/hosting/server/util.py +++ b/sca-cpp/trunk/hosting/server/util.py @@ -57,9 +57,9 @@ def reverse(l): r.reverse() return tuple(r) -def isNil(l): +def isNull(l): if isinstance(l, streampair): - return l.isNil() + return l.isNull() return l is None or l == () def isSymbol(v): @@ -76,7 +76,7 @@ def isList(v): return True def isTaggedList(v, t): - return isList(v) and not isNil(v) and car(v) == t + return isList(v) and not isNull(v) and car(v) == t # Scheme-like streams @@ -88,7 +88,7 @@ class streampair(object): def __repr__(self): return repr(self[0:len(self)]) - def isNil(self): + def isNull(self): return self.cdr == () def __len__(self): @@ -102,7 +102,7 @@ class streampair(object): return self.cdr()[i - 1] def __getslice__(self, i, j): - if isNil(self): + if isNull(self): return () if i > 0: if j == maxint: @@ -156,7 +156,7 @@ def curry(f, *args): # Convert a path represented as a list of values to a string def path(p): - if isNil(p): + if isNull(p): return "" return "/" + car(p) + path(cdr(p)) diff --git a/sca-cpp/trunk/kernel/element.hpp b/sca-cpp/trunk/kernel/element.hpp index d8907c8d21..4798570982 100644 --- a/sca-cpp/trunk/kernel/element.hpp +++ b/sca-cpp/trunk/kernel/element.hpp @@ -43,7 +43,7 @@ const string atsign("@"); * Returns true if a value is an element. */ inline const bool isElement(const value& v) { - if (!isList(v) || isNil(v) || element != car(v)) + if (!isList(v) || isNull(v) || element != car(v)) return false; return true; } @@ -52,7 +52,7 @@ inline const bool isElement(const value& v) { * Returns true if a value is an attribute. */ inline const bool isAttribute(const value& v) { - if (!isList(v) || isNil(v) || attribute != car(v)) + if (!isList(v) || isNull(v) || attribute != car(v)) return false; return true; } @@ -82,7 +82,7 @@ inline const value elementName(const list& l) { * Returns true if an element has children. */ inline const bool elementHasChildren(const list& l) { - return !isNil(cddr(l)); + return !isNull(cddr(l)); } /** @@ -99,7 +99,7 @@ inline const bool elementHasValue(const list& l) { const list r = reverse(l); if (isSymbol(car(r))) return false; - if(isList(car(r)) && !isNil((list)car(r)) && isSymbol(car(car(r)))) + if(isList(car(r)) && !isNull((list)car(r)) && isSymbol(car(car(r)))) return false; return true; } @@ -118,7 +118,7 @@ inline const bool elementToValueIsList(const value& v) { if (!isList(v)) return false; const list l = v; - return (isNil(l) || !isSymbol(car(l))); + return (isNull(l) || !isSymbol(car(l))); } inline const value elementToValue(const value& t) { @@ -159,7 +159,7 @@ inline const bool elementToValueIsSymbol(const value& v) { if (!isList(v)) return false; const list l = v; - if (isNil(l)) + if (isNull(l)) return false; if (!isSymbol(car(l))) return false; @@ -167,7 +167,7 @@ inline const bool elementToValueIsSymbol(const value& v) { } inline const list elementToValueGroupValues(const value& v, const list& l) { - if (isNil(l) || !elementToValueIsSymbol(v) || !elementToValueIsSymbol(car(l))) + if (isNull(l) || !elementToValueIsSymbol(v) || !elementToValueIsSymbol(car(l))) return cons(v, l); if (car(car(l)) != car(v)) return cons(v, l); @@ -181,7 +181,7 @@ inline const list elementToValueGroupValues(const value& v, const list elementsToValues(const list& e) { - if (isNil(e)) + if (isNull(e)) return e; return elementToValueGroupValues(elementToValue(car(e)), elementsToValues(cdr(e))); } @@ -193,9 +193,9 @@ inline const value valueToElement(const value& t) { const list valuesToElements(const list& l); // Convert a name value pair - if (isList(t) && !isNil((list)t) && isSymbol(car(t))) { + if (isList(t) && !isNull((list)t) && isSymbol(car(t))) { const value n = car(t); - const value v = isNil(cdr(t))? nilValue : cadr(t); + const value v = isNull(cdr(t))? nilValue : cadr(t); // Convert a single value to an attribute or an element if (!isList(v)) { @@ -205,7 +205,7 @@ inline const value valueToElement(const value& t) { } // Convert a list value - if (isNil((list)v) || !isSymbol(car(v))) + if (isNull((list)v) || !isSymbol(car(v))) return cons(element, cons(n, mklist(valuesToElements(v)))); // Convert a nested name value pair value @@ -222,7 +222,7 @@ inline const value valueToElement(const value& t) { * Convert a list of values to a list of elements. */ inline const list valuesToElements(const list& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(valueToElement(car(l)), valuesToElements(cdr(l))); } @@ -234,7 +234,7 @@ inline const value attributeValue(const value& name, const list& l) { const list f = filter([name](const value& v) { return isAttribute(v) && attributeName((list)v) == name; }, l); - if (isNil(f)) + if (isNull(f)) return nilValue; return caddr(car(f)); } @@ -253,7 +253,7 @@ inline const list elementChildren(const value& name, const list& l */ inline const value elementChild(const value& name, const list& l) { const list f = elementChildren(name, l); - if (isNil(f)) + if (isNull(f)) return nilValue; return car(f); } diff --git a/sca-cpp/trunk/kernel/function.hpp b/sca-cpp/trunk/kernel/function.hpp index 0a88cf51d9..e2ba8ad0ad 100644 --- a/sca-cpp/trunk/kernel/function.hpp +++ b/sca-cpp/trunk/kernel/function.hpp @@ -160,7 +160,7 @@ public: } template friend ostream& operator<<(ostream&, const lambda&); - template friend const bool isNil(const lambda& l) noexcept; + template friend const bool isNull(const lambda& l) noexcept; private: typedef Callable CallableType; @@ -179,7 +179,7 @@ template inline ostream& operator<<(ostream& out, const lambda& l /** * Return true if a lambda is nil. */ -template inline const bool isNil(const lambda& l) noexcept { +template inline const bool isNull(const lambda& l) noexcept { return (const void*)l.callable == NULL; } diff --git a/sca-cpp/trunk/kernel/kernel-test.cpp b/sca-cpp/trunk/kernel/kernel-test.cpp index 4c68975961..5d8b8039b4 100644 --- a/sca-cpp/trunk/kernel/kernel-test.cpp +++ b/sca-cpp/trunk/kernel/kernel-test.cpp @@ -225,7 +225,7 @@ const bool testMutable() { } { gc_mutable_ref v; - assert(isNil((value)v)); + assert(isNull((value)v)); v = 1; assert(v == 1); } @@ -386,7 +386,7 @@ ostream& operator<<(ostream& out, const Element& v) { const bool testCons() { assert(car(cons(2, mklist(3))) == 2); assert(car(cdr(cons(2, mklist(3)))) == 3); - assert(isNil(cdr(cdr(cons(2, mklist(3)))))); + assert(isNull(cdr(cdr(cons(2, mklist(3)))))); assert(cons(Element(1), mklist(Element(2))) == mklist(Element(1), Element(2))); return true; @@ -471,7 +471,7 @@ const bool testAppend() { assert(car(append(mklist(1), mklist(2))) == 1); assert(car(cdr(append(mklist(1), mklist(2)))) == 2); assert(car(cdr(cdr(append(mklist(1), mklist(2, 3))))) == 3); - assert(isNil(cdr(cdr(cdr(append(mklist(1), mklist(2, 3))))))); + assert(isNull(cdr(cdr(cdr(append(mklist(1), mklist(2, 3))))))); assert(list() + 1 + 2 + 3 == mklist(1, 2, 3)); return true; @@ -497,12 +497,12 @@ const bool testComplex() { const list p = mklist(Complex(1, 2), Complex(3, 4)); assert(car(p).x == 1); assert(car(cdr(p)).x == 3); - assert(isNil(cdr(cdr(p)))); + assert(isNull(cdr(cdr(p)))); return true; } const bool testMap() { - assert(isNil(map(square, list()))); + assert(isNull(map(square, list()))); const list m = map(square, mklist(2, 3)); assert(car(m) == 4); @@ -535,7 +535,7 @@ const bool testFilter() { } const bool testMember() { - assert(isNil(member(4, mklist(1, 2, 3)))); + assert(isNull(member(4, mklist(1, 2, 3)))); assert(car(member(1, mklist(1, 2, 3))) == 1); assert(car(member(2, mklist(1, 2, 3))) == 2); assert(car(member(3, mklist(1, 2, 3))) == 3); @@ -543,7 +543,7 @@ const bool testMember() { } const bool testReverse() { - assert(isNil(reverse(list()))); + assert(isNull(reverse(list()))); assert(car(reverse(mklist(1, 2, 3))) == 3); assert(cadr(reverse(mklist(1, 2, 3))) == 2); return true; @@ -566,7 +566,7 @@ const bool testSubst() { const bool testAssoc() { const list > l = mklist(mklist("x", "X"), mklist("a", "A"), mklist("y", "Y"), mklist("a", "AA")); assert(assoc("a", l) == mklist("a", "A")); - assert(isNil(assoc("z", l))); + assert(isNull(assoc("z", l))); const list > l3 = mklist(mklist("x", "X"), mklist("a", "A"), mklist("a", "AA")); assert(delAssoc("y", l) == l3); @@ -762,7 +762,7 @@ const bool testBinaryTreeAssoc() { assert(rbtreeAssoc("a", bt) == mklist("a", "aa")); assert(rbtreeAssoc("b", bt) == mklist("b", "bb")); assert(rbtreeAssoc("f", bt) == mklist("f", "ff")); - assert(isNil(rbtreeAssoc("x", bt))); + assert(isNull(rbtreeAssoc("x", bt))); return true; } diff --git a/sca-cpp/trunk/kernel/list.hpp b/sca-cpp/trunk/kernel/list.hpp index 02df2c2dc5..753b33b6a0 100644 --- a/sca-cpp/trunk/kernel/list.hpp +++ b/sca-cpp/trunk/kernel/list.hpp @@ -120,9 +120,9 @@ public: inline const bool operator==(const list& p) const noexcept { if(this == &p) return true; - if(isNil(cdr)) - return isNil(p.cdr); - if(isNil(p.cdr)) + if(isNull(cdr)) + return isNull(p.cdr); + if(isNull(p.cdr)) return false; if(!(car == p.car)) return false; @@ -134,9 +134,9 @@ public: inline const bool operator<(const list& p) const noexcept { if(this == &p) return false; - if (isNil(cdr)) - return !isNil(p.cdr); - if (isNil(p.cdr)) + if (isNull(cdr)) + return !isNull(p.cdr); + if (isNull(p.cdr)) return false; if (car < p.car) return true; @@ -148,9 +148,9 @@ public: inline const bool operator>(const list& p) const noexcept { if(this == &p) return false; - if (isNil(cdr)) + if (isNull(cdr)) return false; - if (isNil(p.cdr)) + if (isNull(p.cdr)) return true; if (car > p.car) return true; @@ -173,7 +173,7 @@ private: string watch; #endif - template friend const bool isNil(const list& p) noexcept; + template friend const bool isNull(const list& p) noexcept; template friend const X car(const list& p) noexcept; template friend const list cdr(const list& p) noexcept; @@ -188,7 +188,7 @@ private: * to watch than the list itself in a debugger. */ template inline const string watchList(const list& p) noexcept { - if(isNil(p)) + if(isNull(p)) return "()"; odebugstream os; os << "(" << car(p) << " ...)"; @@ -200,22 +200,22 @@ template inline const string watchList(const list& p) noexcept { /** * Returns true if the given list is nil. */ -template inline const bool isNil(const list& p) noexcept { - return isNil(p.cdr); +template inline const bool isNull(const list& p) noexcept { + return isNull(p.cdr); } /** * Write a list to an output stream. */ template inline ostream& writeHelper(ostream& out, const list& l) noexcept { - if (isNil(l)) + if (isNull(l)) return out; out << " " << car(l); return writeHelper(out, cdr(l)); } template inline ostream& operator<<(ostream& out, const list& l) noexcept { - if(isNil(l)) + if(isNull(l)) return out << "()"; out << "(" << car(l); writeHelper(out, cdr(l)); @@ -294,7 +294,7 @@ template inline const list mklist(const T& a, const T& b, const T */ template inline const T car(const list& p) noexcept { // Abort if trying to access the car of a nil list - assertOrFail(!isNil(p.cdr)); + assertOrFail(!isNull(p.cdr)); return p.car; } @@ -401,7 +401,7 @@ template inline const list cdddddddr(const list& p) noexcept { */ template inline const size_t length(const list& p) noexcept { const lambda&)> lengthRef = [&lengthRef](const size_t c, const list& p) -> const size_t { - if(isNil(p)) + if(isNull(p)) return c; return lengthRef(c + 1, cdr(p)); }; @@ -412,7 +412,7 @@ template inline const size_t length(const list& p) noexcept { * Appends a list and a lambda function returning a list. */ template inline const list append(const list&a, const lambda()>& fb) noexcept { - if(isNil(a)) + if(isNull(a)) return fb(); return cons(car(a), [a, fb]() { return append(cdr(a), fb); }); } @@ -439,7 +439,7 @@ template const list inline operator+(const list& l * Run a map lambda function on a list. */ template inline const list map(const lambda& f, const list& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list (); return cons(f(car(p)), map(f, cdr(p))); } @@ -449,7 +449,7 @@ template inline const list map(const lambda inline const R reduce(const lambda& f, const R& initial, const list& p) noexcept { const lambda&p)> reduceAccumulate = [f, &reduceAccumulate](const R& acc, const list& p) -> R { - if(isNil(p)) + if(isNull(p)) return acc; return reduceAccumulate(f(acc, car(p)), cdr(p)); }; @@ -458,7 +458,7 @@ template inline const R reduce(const lambda inline const R reduceRight(const lambda& f, const R& initial, const list& p) noexcept { const lambda&p, const R&)> reduceRightAccumulate = [f, &reduceRightAccumulate](const list& p, const R& acc) -> R { - if(isNil(p)) + if(isNull(p)) return acc; return reduceRightAccumulate(cdr(p), f(car(p), acc)); }; @@ -469,7 +469,7 @@ template inline const R reduceRight(const lambda inline const list filter(const lambda& f, const list& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list (); if(f(car(p))) { const lambda(const lambda, const list)> ff(filter); @@ -482,7 +482,7 @@ template inline const list filter(const lambda inline const list member(const T& t, const list& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list (); if(t == car(p)) return p; @@ -493,7 +493,7 @@ template inline const list member(const T& t, const list& p) n * Reverse a list. */ template inline const list reverseIter(const list& acc, const list& p) noexcept { - if(isNil(p)) + if(isNull(p)) return acc; return reverseIter(cons(car(p), acc), cdr(p)); } @@ -528,7 +528,7 @@ template inline const T listRef(const list& l, const size_t i) no template inline const list listTail(const list& l, const size_t k) noexcept { if(k == 0) return l; - if(isNil(l)) + if(isNull(l)) return l; return listTail(cdr(l), k - 1); } @@ -537,7 +537,7 @@ template inline const list listTail(const list& l, const size_ * Substitute elements in a list. */ template inline const list subst(const T& o, const T& n, const list& p) noexcept { - if(isNil(p)) + if(isNull(p)) return p; if(o == car(p)) return cons(n, subst(o, n, cdr(p))); @@ -548,7 +548,7 @@ template inline const list subst(const T& o, const T& n, const li * Returns the first pair matching a key from a list of key value pairs. */ template inline const list assoc(const T& k, const list >& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list(); if(k == car(car(p))) return car(p); @@ -560,7 +560,7 @@ template inline const list assoc(const T& k, const list > * Requires T to support isList and cast to list. */ template inline const list assoc(const T& k, const list& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list(); const T c = car(p); if(isList(c) && k == car(c)) @@ -572,7 +572,7 @@ template inline const list assoc(const T& k, const list& p) no * Returns a list of lists containing elements from two input lists. */ template inline const list > zip(const list& a, const list& b) noexcept { - if (isNil(a) || isNil(b)) + if (isNull(a) || isNull(b)) return list >(); return cons >(mklist(car(a), car(b)), zip(cdr(a), cdr(b))); } @@ -581,13 +581,13 @@ template inline const list > zip(const list& a, const lis * Converts a list of key value pairs to a list containing the list of keys and the list of values. */ template inline const list unzipKeys(const list >& l) noexcept { - if (isNil(l)) + if (isNull(l)) return list(); return cons(car(car(l)), unzipKeys(cdr(l))); } template inline const list unzipValues(const list >& l) noexcept { - if (isNil(l)) + if (isNull(l)) return list(); return cons(cadr(car(l)), unzipValues(cdr(l))); } @@ -600,7 +600,7 @@ template inline const list > unzip(const list >& l) * Delete assocs matching a key from a list of assocs. */ template inline const list > delAssoc(const T& k, const list >& p) noexcept { - if(isNil(p)) + if(isNull(p)) return p; if(k == car(car(p))) return delAssoc(k, cdr(p)); @@ -612,7 +612,7 @@ template inline const list > delAssoc(const T& k, const list * Requires T to support isList, isAssoc, and cast to list. */ template inline const list delAssoc(const T& k, const list& p) noexcept { - if(isNil(p)) + if(isNull(p)) return p; const T c = car(p); if(isList(c) && k == car(c)) @@ -624,7 +624,7 @@ template inline const list delAssoc(const T& k, const list& p) * Substitute assocs with matching keys in a list of assocs. */ template inline const list > substAssoc(const T& k, const list& n, const list >& p, const bool add = false) noexcept { - if(isNil(p)) + if(isNull(p)) return add? mklist >(n) : p; if(k == car(car(p))) return cons >(n, substAssoc(k, n, cdr(p), false)); @@ -636,7 +636,7 @@ template inline const list > substAssoc(const T& k, const li * Requires T to support isList, isAssoc, and cast to list. */ template inline const list substAssoc(const T& k, const list& n, const list& p, const bool add = false) noexcept { - if(isNil(p)) + if(isNull(p)) return add? mklist(n) : p; const T c = car(p); if(isList(c) && k == car(c)) diff --git a/sca-cpp/trunk/kernel/parallel-test.cpp b/sca-cpp/trunk/kernel/parallel-test.cpp index 895bb91eb8..9440cbaafd 100644 --- a/sca-cpp/trunk/kernel/parallel-test.cpp +++ b/sca-cpp/trunk/kernel/parallel-test.cpp @@ -109,7 +109,7 @@ const list > submitSquares(worker& w, const int max, const int i) { } bool checkSquareResults(const list > r, int i) { - if (isNil(r)) + if (isNull(r)) return true; assert(car(r) == i * i); checkSquareResults(cdr(r), i + 1); @@ -160,7 +160,7 @@ const list > submitTLSSets(worker& w, wqueue& wq, wqueue< } const bool checkTLSSets(const list > s) { - if (isNil(s)) + if (isNull(s)) return true; assert(car(s) == 0); return checkTLSSets(cdr(s)); @@ -174,7 +174,7 @@ const list > submitTLSChecks(worker& w, wqueue& wq, wqueue > r) { - if (isNil(r)) + if (isNull(r)) return true; assert(car(r) == true); return checkTLSResults(cdr(r)); diff --git a/sca-cpp/trunk/kernel/parallel.hpp b/sca-cpp/trunk/kernel/parallel.hpp index 8b01bb819f..6981a67831 100644 --- a/sca-cpp/trunk/kernel/parallel.hpp +++ b/sca-cpp/trunk/kernel/parallel.hpp @@ -274,7 +274,7 @@ template inline const future submit(const worker& w, const lambda * Enqueues shutdown requests. */ inline const bool shutdownEnqueue(const list& threads, wqueue& work) noexcept { - if (isNil(threads)) + if (isNull(threads)) return true; enqueue(work, result(false)); return shutdownEnqueue(cdr(threads), work); @@ -284,7 +284,7 @@ inline const bool shutdownEnqueue(const list& threads, wqueue& threads) noexcept { - if (isNil(threads)) + if (isNull(threads)) return true; pthread_join(car(threads), NULL); return shutdownJoin(cdr(threads)); @@ -303,7 +303,7 @@ inline const bool shutdown(const worker& w) noexcept { * Cancel a worker. */ inline const bool cancel(const list& threads) noexcept { - if (isNil(threads)) + if (isNull(threads)) return true; pthread_cancel(car(threads)); return cancel(cdr(threads)); diff --git a/sca-cpp/trunk/kernel/sstream.hpp b/sca-cpp/trunk/kernel/sstream.hpp index dbdc7414a1..56f1c1c867 100644 --- a/sca-cpp/trunk/kernel/sstream.hpp +++ b/sca-cpp/trunk/kernel/sstream.hpp @@ -46,7 +46,7 @@ inline void* stream_memcpy(void* t, const void* s, const size_t n) { * Write a list of strings into a buffer. */ const bool writeList(const list& l, char* const buf) { - if (isNil(l)) + if (isNull(l)) return true; const string c = car(l); char* b = buf - length(c); @@ -114,7 +114,7 @@ public: private: inline const string str() { spill(); - if (isNil((const list)buf)) + if (isNull((const list)buf)) return emptyString; char* const sbuf = gc_cnew(len + 1); writeList(buf, sbuf + len); @@ -239,10 +239,10 @@ inline const list tokenize(const char* const sep, const string& str) { inline const string join(const char* const sep, const list& l) { ostringstream os; const lambda&, ostringstream&)> join = [&join](const char* const sep, const list& l, ostringstream& os) -> ostringstream& { - if (isNil(l)) + if (isNull(l)) return os; os << car(l); - if (!isNil(cdr(l))) + if (!isNull(cdr(l))) os << sep; return join(sep, cdr(l), os); }; @@ -277,7 +277,7 @@ inline const list fragment(const list& l, const size_t max) { * Write a list of strings to an output stream. */ inline ostream& write(const list& l, ostream& os) { - if(isNil(l)) + if(isNull(l)) return os; os << car(l); return write(cdr(l), os); @@ -287,9 +287,9 @@ inline ostream& write(const list& l, ostream& os) { * Convert a list of strings to a string. */ inline const string write(const list& l) { - if (isNil(l)) + if (isNull(l)) return emptyString; - if (isNil(cdr(l))) + if (isNull(cdr(l))) return car(l); ostringstream os; write(l, os); diff --git a/sca-cpp/trunk/kernel/tree.hpp b/sca-cpp/trunk/kernel/tree.hpp index d350879ce7..a5d0e3d5b0 100644 --- a/sca-cpp/trunk/kernel/tree.hpp +++ b/sca-cpp/trunk/kernel/tree.hpp @@ -40,13 +40,13 @@ namespace tuscany { * Requires T to support isList, isAssoc, and cast to list. */ template inline const list treeDelAssoc(const list& k, const list& l) noexcept { - if (isNil(k) || isNil(l)) + if (isNull(k) || isNull(l)) return l; const list lv = l; // If list is an assoc and matches, skip it if (isAssoc(lv)) { - if (car(lv) == car(k) && isNil(cdr(k))) + if (car(lv) == car(k) && isNull(cdr(k))) return list(); } @@ -56,23 +56,23 @@ template inline const list treeDelAssoc(const list& k, const l if (!isList(a)) return cons(a, treeDelAssoc(k, cdr(lv))); const list da = treeDelAssoc(k, a); - return isNil(da)? treeDelAssoc(k, cdr(lv)) : cons(da, treeDelAssoc(k, cdr(lv))); + return isNull(da)? treeDelAssoc(k, cdr(lv)) : cons(da, treeDelAssoc(k, cdr(lv))); } // If we found a match, skip it and lookup children and rest of the list if (car(a) == car(k)) { - if (isNil(cdr(k))) + if (isNull(cdr(k))) return treeDelAssoc(k, cdr(lv)); return cons(cons(car(a), treeDelAssoc(cdr(k), cdr(a))), treeDelAssoc(k, cdr(lv))); } // No match, lookup children and rest of the list - if (isNil(cdr(a))) + if (isNull(cdr(a))) return cons(a, treeDelAssoc(k, cdr(lv))); if (!isList(cadr(a))) return cons(cons(car(a), cons(cadr(a), treeDelAssoc(k, cddr(a)))), treeDelAssoc(k, cdr(lv))); const list da = treeDelAssoc(k, cadr(a)); - if (isNil(da)) + if (isNull(da)) return cons(cons(car(a), treeDelAssoc(k, cddr(a))), treeDelAssoc(k, cdr(lv))); return cons(cons(car(a), cons(da, treeDelAssoc(k, cddr(a)))), treeDelAssoc(k, cdr(lv))); } @@ -83,12 +83,12 @@ template inline const list treeDelAssoc(const list& k, const l * Requires T to support isList, isAssoc, and cast to list. */ template inline const list treeSubstAssoc(const list& k, const list& n, const list& lv) noexcept { - if (isNil(k) || isNil(lv)) + if (isNull(k) || isNull(lv)) return lv; // If list is an assoc and matches, substitute it if (isAssoc(lv)) { - if (car(lv) == car(k) && isNil(cdr(k))) + if (car(lv) == car(k) && isNull(cdr(k))) return n; } @@ -102,13 +102,13 @@ template inline const list treeSubstAssoc(const list& k, const // If we found a match, substitute it and lookup children and rest of the list if (car(a) == car(k)) { - if (isNil(cdr(k))) + if (isNull(cdr(k))) return cons(n, treeSubstAssoc(k, n, cdr(lv))); return cons(cons(car(a), treeSubstAssoc(cdr(k), n, cdr(a))), treeSubstAssoc(k, n, cdr(lv))); } // No match, lookup children and rest of the list - if (isNil(cdr(a))) + if (isNull(cdr(a))) return cons(a, treeSubstAssoc(k, n, cdr(lv))); if (!isList(cadr(a))) return cons(cons(car(a), cons(cadr(a), treeSubstAssoc(k, n, cddr(a)))), treeSubstAssoc(k, n, cdr(lv))); @@ -121,12 +121,12 @@ template inline const list treeSubstAssoc(const list& k, const * Requires T to support isList, isAssoc, and cast to list. */ template inline const list treeSelectAssoc(const list& k, const list& lv) noexcept { - if (isNil(k) || isNil(lv)) + if (isNull(k) || isNull(lv)) return list(); // If list is an assoc and matches, select it if (isAssoc(lv)) { - if (car(lv) == car(k) && isNil(cdr(k))) + if (car(lv) == car(k) && isNull(cdr(k))) return mklist(lv); } @@ -140,13 +140,13 @@ template inline const list treeSelectAssoc(const list& k, cons // If we found a match, select it and lookup children and rest of the list if (car(a) == car(k)) { - if (isNil(cdr(k))) + if (isNull(cdr(k))) return cons(a, treeSelectAssoc(k, cdr(lv))); return append(treeSelectAssoc(cdr(k), cdr(a)), treeSelectAssoc(k, cdr(lv))); } // No match, lookup children and rest of the list - if (isNil(cdr(a))) + if (isNull(cdr(a))) return treeSelectAssoc(k, cdr(lv)); if (!isList(cadr(a))) return append(treeSelectAssoc(k, cddr(a)), treeSelectAssoc(k, cdr(lv))); @@ -164,7 +164,7 @@ template inline const list mkrbtree(const T& e, const list& le * Find a leaf with the given key in a rooted binary tree. */ template inline const list rbtreeAssoc(const T& k, const list& tree) { - if (isNil(tree)) + if (isNull(tree)) return tree; if (k == car(car(tree))) return car(tree); @@ -177,7 +177,7 @@ template inline const list rbtreeAssoc(const T& k, const list& * Construct a new rooted binary tree from a leaf and a tree. */ template inline const list rbtreeCons(const T& e, const list& tree) { - if (isNil(tree)) + if (isNull(tree)) return mkrbtree(e, list(), list()); if (e == car(tree)) return tree; @@ -190,7 +190,7 @@ template inline const list rbtreeCons(const T& e, const list& * Make a rooted binary tree from an unordered list of leaves. */ template inline const list mkrbtree(const list& l) { - if (isNil(l)) + if (isNull(l)) return l; return rbtreeCons(car(l), mkrbtree(cdr(l))); } @@ -199,7 +199,7 @@ template inline const list mkrbtree(const list& l) { * Convert a rooted binary tree to an ordered list of leaves. */ template inline const list flatten(const list& tree) { - if (isNil(tree)) + if (isNull(tree)) return tree; return append(flatten(cadr(tree)), cons(car(tree), flatten(caddr(tree)))); } diff --git a/sca-cpp/trunk/kernel/value.hpp b/sca-cpp/trunk/kernel/value.hpp index d5ce34084a..660ece0c25 100644 --- a/sca-cpp/trunk/kernel/value.hpp +++ b/sca-cpp/trunk/kernel/value.hpp @@ -489,7 +489,7 @@ inline const value::ValueType type(const value& v) noexcept { /** * Returns true if a value is nil. */ -inline const bool isNil(const value& v) noexcept { +inline const bool isNull(const value& v) noexcept { return type(v) == value::Nil; } @@ -546,7 +546,7 @@ inline const bool isPtr(const value& v) noexcept { * Returns true if a value is a tagged list. */ inline const bool isTaggedList(const value& exp, const value& tag) noexcept { - if(isList(exp) && !isNil((list)exp)) + if(isList(exp) && !isNull((list)exp)) return car((list)exp) == tag; return false; } @@ -555,14 +555,14 @@ inline const bool isTaggedList(const value& exp, const value& tag) noexcept { * Returns true if a value is an assoc. */ inline const bool isAssoc(const value& exp) noexcept { - return isList(exp) && !isNil((list)exp) && isSymbol(car(exp)); + return isList(exp) && !isNull((list)exp) && isSymbol(car(exp)); } /** * Make a list of values from a list of other things. */ template inline const list mkvalues(const list& l) noexcept { - if (isNil(l)) + if (isNull(l)) return nilListValue; return cons(car(l), mkvalues(cdr(l))); } @@ -571,7 +571,7 @@ template inline const list mkvalues(const list& l) noexcep * Convert a list of values to a list of other things. */ template inline const list convertValues(const list& l) noexcept { - if (isNil(l)) + if (isNull(l)) return list(); return cons(car(l), convertValues(cdr(l))); } @@ -580,7 +580,7 @@ template inline const list convertValues(const list& l) no * Convert a list of lists of values to a list of values. */ inline const list listOfValues(const list >& l) noexcept { - if (isNil(l)) + if (isNull(l)) return nilListValue; return cons(car(l), listOfValues(cdr(l))); } @@ -589,7 +589,7 @@ inline const list listOfValues(const list >& l) noexcept { * Convert a list of values to a list of lists of values. */ inline const list > listOfListOfValues(const list& l) noexcept { - if (isNil(l)) + if (isNull(l)) return list >(); return cons >(type(car(l)) == value::List? list(car(l)) : nilPairValue, listOfListOfValues(cdr(l))); } @@ -613,7 +613,7 @@ inline const list pathValues(const value& p) noexcept { * Convert a path represented as a list of values to a string value. */ inline const value path(const list& p) noexcept { - if (isNil(p)) + if (isNull(p)) return emptyString; return string("/") + (string)car(p) + (string)path(cdr(p)); } diff --git a/sca-cpp/trunk/modules/atom/atom.hpp b/sca-cpp/trunk/modules/atom/atom.hpp index 259769e2cb..b6f2788b1e 100644 --- a/sca-cpp/trunk/modules/atom/atom.hpp +++ b/sca-cpp/trunk/modules/atom/atom.hpp @@ -46,22 +46,22 @@ const value entry("entry"); */ const list entryElementValues(const list& e) { const list lt = elementChildren("title", e); - const list t = nilListValue + element + value("title") + (isNil(lt)? value(emptyString) : elementValue(car(lt))); + const list t = nilListValue + element + value("title") + (isNull(lt)? value(emptyString) : elementValue(car(lt))); const list li = elementChildren("id", e); - const list i = nilListValue + element + value("id") + (isNil(li)? value(emptyString) : elementValue(car(li))); + const list i = nilListValue + element + value("id") + (isNull(li)? value(emptyString) : elementValue(car(li))); const list la = elementChildren("author", e); - const list lan = isNil(la)? nilListValue : elementChildren("name", car(la)); - const list lae = isNil(la)? nilListValue : elementChildren("email", car(la)); - const list laa = isNil(lan)? lae : lan; - const list a = isNil(laa)? nilListValue : mklist(nilListValue + element + value("author") + elementValue(car(laa))); + const list lan = isNull(la)? nilListValue : elementChildren("name", car(la)); + const list lae = isNull(la)? nilListValue : elementChildren("email", car(la)); + const list laa = isNull(lan)? lae : lan; + const list a = isNull(laa)? nilListValue : mklist(nilListValue + element + value("author") + elementValue(car(laa))); const list lu = elementChildren("updated", e); - const list u = isNil(lu)? nilListValue : mklist(nilListValue + element + value("updated") + elementValue(car(lu))); + const list u = isNull(lu)? nilListValue : mklist(nilListValue + element + value("updated") + elementValue(car(lu))); const list lc = elementChildren("content", e); - const list c = isNil(lc)? nilListValue : isAttribute(elementValue(car(lc)))? nilListValue : + const list c = isNull(lc)? nilListValue : isAttribute(elementValue(car(lc)))? nilListValue : mklist(nilListValue + element + value("content") + elementValue(car(lc))); return append(append(append(nilListValue + element + entry + value(t) + value(i), a), u), c); @@ -71,7 +71,7 @@ const list entryElementValues(const list& e) { * Convert a list of elements to a list of element values representing ATOM entries. */ const list entriesElementValues(const list& e) { - if (isNil(e)) + if (isNull(e)) return e; return cons(entryElementValues(car(e)), entriesElementValues(cdr(e))); } @@ -99,7 +99,7 @@ const bool isATOMEntry(const list& ls) { */ const failable > readATOMEntry(const list& ilist) { const list e = content(xml::readElements(ilist)); - if (isNil(e)) + if (isNull(e)) return mkfailure >("Empty entry"); return mklist(entryElementValues(car(e))); } @@ -109,7 +109,7 @@ const failable > readATOMEntry(const list& ilist) { */ const failable > readATOMFeed(const list& ilist) { const list f = content(xml::readElements(ilist)); - if (isNil(f)) + if (isNull(f)) return mkfailure >("Empty feed"); const list t = elementChildren("title", car(f)); const list i = elementChildren("id", car(f)); @@ -136,18 +136,18 @@ const list entryElement(const list& l) { const value title = elementChild("title", l); const value id = elementChild("id", l); const value author = elementChild("author", l); - const bool email = isNil(author)? false : contains(elementValue(author), "@"); + const bool email = isNull(author)? false : contains(elementValue(author), "@"); const value updated = elementChild("updated", l); const value content = elementChild("content", l); - const bool text = isNil(content)? false : elementHasValue(content); + const bool text = isNull(content)? false : elementHasValue(content); return nilListValue + element + entry + (nilListValue + attribute + "xmlns" + "http://www.w3.org/2005/Atom") + (nilListValue + element + "title" + (nilListValue + attribute + "type" + "text") + elementValue(title)) + (nilListValue + element + "id" + elementValue(id)) - + (isNil(author)? nilListValue : (nilListValue + element + "author" + + + (isNull(author)? nilListValue : (nilListValue + element + "author" + (email? (nilListValue + element + "email" + elementValue(author)) : (nilListValue + element + "name" + elementValue(author))))) - + (isNil(updated)? nilListValue : (nilListValue + element + "updated" + elementValue(updated))) - + (isNil(content)? + + (isNull(updated)? nilListValue : (nilListValue + element + "updated" + elementValue(updated))) + + (isNull(content)? nilListValue : append(nilListValue + element + "content" + (nilListValue + attribute + "type" + (text? "text" : "application/xml")), text? mklist(elementValue(content)) : contentElementChildren(content))) @@ -158,7 +158,7 @@ const list entryElement(const list& l) { * Convert a list of element values representing ATOM entries to a list of elements. */ const list entriesElements(const list& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(entryElement(car(l)), entriesElements(cdr(l))); } @@ -167,7 +167,7 @@ const list entriesElements(const list& l) { * Convert a list of element values representing an ATOM entry to an ATOM entry. */ template const failable writeATOMEntry(const lambda& reduce, const R& initial, const list& ll) { - const list l = isNil(ll)? ll : (list)car(ll); + const list l = isNull(ll)? ll : (list)car(ll); return xml::writeElements(reduce, initial, mklist(entryElement(l))); } @@ -182,11 +182,11 @@ const failable > writeATOMEntry(const list& l) { * Convert a list of element values representing an ATOM feed to an ATOM feed. */ template const failable writeATOMFeed(const lambda& reduce, const R& initial, const list& ll) { - const list l = isNil(ll)? ll : (list)car(ll); + const list l = isNull(ll)? ll : (list)car(ll); const list lt = elementChildren("title", l); - const value t = isNil(lt)? value(emptyString) : elementValue(car(lt)); + const value t = isNull(lt)? value(emptyString) : elementValue(car(lt)); const list li = elementChildren("id", l); - const value i = isNil(li)? value(emptyString) : elementValue(car(li)); + const value i = isNull(li)? value(emptyString) : elementValue(car(li)); const list f = nilListValue + element + feed + (nilListValue + attribute + "xmlns" + "http://www.w3.org/2005/Atom") + (nilListValue + element + "title" + (nilListValue + attribute + "type" + "text") + t) @@ -194,11 +194,11 @@ template const failable writeATOMFeed(const lambda le = elementChildren(entry, l); - if (isNil(le)) + if (isNull(le)) return xml::writeElements(reduce, initial, mklist(f)); // Write a single ATOM entry element with a list of values - if (!isNil(le) && !isNil(car(le)) && isList(car(caddr(car(le))))) { + if (!isNull(le) && !isNull(car(le)) && isList(car(caddr(car(le))))) { const list fe = append(f, entriesElements(caddr(car(le)))); return xml::writeElements(reduce, initial, mklist(fe)); } diff --git a/sca-cpp/trunk/modules/http/http.hpp b/sca-cpp/trunk/modules/http/http.hpp index cd0eb6c04b..04b0d4e490 100644 --- a/sca-cpp/trunk/modules/http/http.hpp +++ b/sca-cpp/trunk/modules/http/http.hpp @@ -367,7 +367,7 @@ public: */ size_t readCallback(void *ptr, size_t size, size_t nmemb, void *data) { CURLReadContext& rcx = *(CURLReadContext*)data; - if (isNil((const list)rcx.ilist)) + if (isNull((const list)rcx.ilist)) return 0; const list f(fragment(rcx.ilist, size * nmemb)); const string s = car(f); @@ -403,7 +403,7 @@ template size_t writeCallback(void *ptr, size_t size, size_t nmemb, * a reduce function used to process the response. */ curl_slist* headers(curl_slist* const cl, const list& h) { - if (isNil(h)) + if (isNull(h)) return cl; return headers(curl_slist_append(cl, c_str(string(car(h)))), cdr(h)); } @@ -508,7 +508,7 @@ const failable evalExpr(const value& expr, const string& url, const CURLS * Find and return a header. */ const maybe header(const char* const prefix, const list& h) { - if (isNil(h)) + if (isNull(h)) return maybe(); const string s = car(h); if (find(s, prefix) != 0) @@ -676,7 +676,7 @@ const failable > > contentRequest(const value& c, unused const // Write in the format requested by the client, if any const list fmt = assoc("format", nilListValue); - if (!isNil(fmt)) { + if (!isNull(fmt)) { if (cadr(fmt) == "scheme") return writeRequest(scheme::writeValue(c), "text/x-scheme; charset=utf-8"); if (cadr(fmt) == "json") @@ -692,26 +692,26 @@ const failable > > contentRequest(const value& c, unused const } // Write an empty list as a JSON value - if (isNil((list)c)) { + if (isNull((list)c)) { debug(nilListValue, "http::contentRequest::empty"); return writeRequest(json::writeValue(c), "application/json; charset=utf-8"); } // Write content-type / content-list pair - if (isString(car(c)) && !isNil(cdr(c)) && isList(cadr(c))) + if (isString(car(c)) && !isNull(cdr(c)) && isList(cadr(c))) return writeRequest(convertValues(cadr(c)), car(c)); // Write an assoc value as a JSON value - if (isSymbol(car(c)) && !isNil(cdr(c))) { + if (isSymbol(car(c)) && !isNull(cdr(c))) { debug(c, "http::contentRequest::assoc"); return writeRequest(json::writeValue(c), "application/json; charset=utf-8"); } // Write an ATOM feed or entry const list e = valuesToElements(c); - if (isList(car(e)) && !isNil(car(e))) { + if (isList(car(e)) && !isNull(car(e))) { const list el = car(e); - if (isSymbol(car(el)) && car(el) == element && !isNil(cdr(el)) && isSymbol(cadr(el)) && elementHasChildren(el) && !elementHasValue(el)) { + if (isSymbol(car(el)) && car(el) == element && !isNull(cdr(el)) && isSymbol(cadr(el)) && elementHasChildren(el) && !elementHasValue(el)) { if (cadr(el) == atom::feed) return writeRequest(atom::writeATOMFeed(e), "application/atom+xml; charset=utf-8"); if (cadr(el) == atom::entry) @@ -943,14 +943,14 @@ const failable recv(char* const c, const size_t l, const CURLSession& cs * Converts a list of key value pairs to a query string. */ ostringstream& queryString(const list& args, ostringstream& os) { - if (isNil(args)) + if (isNull(args)) return os; const list arg = car(args); debug(arg, "http::queryString::arg"); - if (isNil(arg) || isNil(cdr(arg))) + if (isNull(arg) || isNull(cdr(arg))) return queryString(cdr(args), os); os << car(arg) << "=" << c_str(cadr(arg)); - if (!isNil(cdr(args))) + if (!isNull(cdr(args))) os << "&"; return queryString(cdr(args), os); } diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp index 255f0aa31b..bf06ed5d91 100644 --- a/sca-cpp/trunk/modules/http/httpd.hpp +++ b/sca-cpp/trunk/modules/http/httpd.hpp @@ -260,7 +260,7 @@ const string cookie(const request_rec* const r) { * Return the remaining part of a uri after the given path (aka the path info.) */ const list pathInfo(const list& uri, const list& path) { - if (isNil(path)) + if (isNull(path)) return uri; return pathInfo(cdr(uri), cdr(path)); } @@ -347,14 +347,14 @@ const list unescapeArgs(const list& args) { const value queryArg(const string& s) { debug(s, "httpd::queryArg::string"); const list t = tokenize("=", s); - if (isNil(cdr(t))) + if (isNull(cdr(t))) return mklist(c_str(car(t)), emptyString); return mklist(c_str(car(t)), cadr(t)); } const string fixupQueryArgs(const string& a) { const list t = tokenize("?", a); - if (isNil(t) || isNil(cdr(t))) + if (isNull(t) || isNull(cdr(t))) return a; return join("&", t); } @@ -376,7 +376,7 @@ const list queryArgs(const request_rec* const r) { * Converts the args received in a POST to a list of key value pairs. */ const list postArgs(const list& a) { - if (isNil(a)) + if (isNull(a)) return nilListValue; const list l = car(a); return cons(l, postArgs(cdr(a))); diff --git a/sca-cpp/trunk/modules/http/mod-openauth.cpp b/sca-cpp/trunk/modules/http/mod-openauth.cpp index 1b70f27744..3adc488301 100644 --- a/sca-cpp/trunk/modules/http/mod-openauth.cpp +++ b/sca-cpp/trunk/modules/http/mod-openauth.cpp @@ -127,7 +127,7 @@ static apr_status_t (*ap_session_set_fn)(request_rec * r, session_rec * z, const * Run the authnz hooks to authenticate a request. */ const failable checkAuthnzProviders(const string& user, const string& pw, request_rec* const r, const list& apcs) { - if(isNil(apcs)) + if(isNull(apcs)) return mkfailure("Authentication failure for: " + user, HTTP_UNAUTHORIZED); const AuthnProviderConf apc = car(apcs); if(apc.provider == NULL || !apc.provider->check_password) @@ -145,7 +145,7 @@ const failable checkAuthnz(const string& user, const string& pw, request_re if(substr(user, 0, 1) == "/" && pw == "password") return mkfailure(string("Encountered FakeBasicAuth spoof: ") + user, HTTP_UNAUTHORIZED); - if(isNil((const list)dc.apcs)) { + if(isNull((const list)dc.apcs)) { const authn_provider* provider = (const authn_provider*)ap_lookup_provider(AUTHN_PROVIDER_GROUP, AUTHN_DEFAULT_PROVIDER, AUTHN_PROVIDER_VERSION); return checkAuthnzProviders(user, pw, r, mklist(AuthnProviderConf(AUTHN_DEFAULT_PROVIDER, provider))); } @@ -181,10 +181,10 @@ const failable userInfoFromCookie(const value& sid, const string& realm, const list info = httpd::queryArgs(sid); debug(info, "modopenauth::userInfoFromCookie::info"); const list user = assoc(realm + "-user", info); - if(isNil(user)) + if(isNull(user)) return userInfoFromSession(realm, r); const list pw = assoc(realm + "-pw", info); - if(isNil(pw)) + if(isNull(pw)) return mkfailure("Couldn't retrieve password", HTTP_UNAUTHORIZED); return value(mklist(mklist("realm", realm), mklist("id", cadr(user)), mklist("password", cadr(pw)))); } @@ -217,12 +217,12 @@ const failable authenticated(const list& info, request_rec* const r) // Store user info in the request const list realm = assoc("realm", info); - if(isNil(realm) || isNil(cdr(realm))) + if(isNull(realm) || isNull(cdr(realm))) return mkfailure("Couldn't retrieve realm", HTTP_UNAUTHORIZED); apr_table_set(r->subprocess_env, apr_pstrdup(r->pool, "REALM"), apr_pstrdup(r->pool, c_str(cadr(realm)))); const list id = assoc("id", info); - if(isNil(id) || isNil(cdr(id))) + if(isNull(id) || isNull(cdr(id))) return mkfailure("Couldn't retrieve user id", HTTP_UNAUTHORIZED); r->user = apr_pstrdup(r->pool, c_str(cadr(id))); @@ -313,7 +313,7 @@ static int checkAuthn(request_rec* const r) { } // Decline if the request is for another authentication provider - if(!isNil(assoc("openid_identifier", args))) + if(!isNull(assoc("openid_identifier", args))) return DECLINED; // Redirect to the login page, unless we have a session id from another module diff --git a/sca-cpp/trunk/modules/http/openauth.hpp b/sca-cpp/trunk/modules/http/openauth.hpp index 1c49c4254c..70c6f658ad 100644 --- a/sca-cpp/trunk/modules/http/openauth.hpp +++ b/sca-cpp/trunk/modules/http/openauth.hpp @@ -49,13 +49,13 @@ const char* const cookieName(const char* const cs) { } const maybe sessionID(const list& c, const string& key) { - if (isNil(c)) + if (isNull(c)) return maybe(); const string cn = cookieName(c_str(car(c))); const size_t i = find(cn, "="); if (i < length(cn)) { const list kv = mklist(substr(cn, 0, i), substr(cn, i+1)); - if (!isNil(kv) && !isNil(cdr(kv))) { + if (!isNull(kv) && !isNull(cdr(kv))) { if (car(kv) == key) return cadr(kv); } @@ -92,10 +92,10 @@ const string cookie(const string& key, const string& sid, const string& domain) * Redirect to the configured login page. */ const failable login(const string& page, const value& ref, const value& attempt, request_rec* const r) { - const list rarg = ref == string("/")? nilListValue : mklist(mklist("openauth_referrer", httpd::escape(httpd::url(isNil(ref)? r->uri : ref, r)))); - const list aarg = isNil(attempt)? nilListValue : mklist(mklist("openauth_attempt", attempt)); + const list rarg = ref == string("/")? nilListValue : mklist(mklist("openauth_referrer", httpd::escape(httpd::url(isNull(ref)? r->uri : ref, r)))); + const list aarg = isNull(attempt)? nilListValue : mklist(mklist("openauth_attempt", attempt)); const list largs = append(rarg, aarg); - const string loc = isNil(largs)? httpd::url(page, r) : httpd::url(page, r) + string("?") + http::queryString(largs); + const string loc = isNull(largs)? httpd::url(page, r) : httpd::url(page, r) + string("?") + http::queryString(largs); debug(loc, "openauth::login::uri"); return httpd::externalRedirect(loc, r); } diff --git a/sca-cpp/trunk/modules/java/driver.hpp b/sca-cpp/trunk/modules/java/driver.hpp index 4ffc84f4db..a8d162249c 100644 --- a/sca-cpp/trunk/modules/java/driver.hpp +++ b/sca-cpp/trunk/modules/java/driver.hpp @@ -38,7 +38,7 @@ namespace java { const value evalDriverLoop(const JavaRuntime& jr, const JavaClass jc, istream& in, ostream& out) { scheme::promptForInput(scheme::evalInputPrompt, out); const value input = content(scheme::readValue(in)); - if (isNil(input)) + if (isNull(input)) return input; const failable output = evalClass(jr, input, jc); scheme::announceOutput(scheme::evalOutputPrompt, out); diff --git a/sca-cpp/trunk/modules/java/eval.hpp b/sca-cpp/trunk/modules/java/eval.hpp index 2c76b764fa..407e3d2a59 100644 --- a/sca-cpp/trunk/modules/java/eval.hpp +++ b/sca-cpp/trunk/modules/java/eval.hpp @@ -132,7 +132,7 @@ public: h.invokerLambda = h.env->GetFieldID(h.invokerClass, "lambda", "J"); h.iterableUtilClass = h.env->FindClass("org/apache/tuscany/IterableUtil"); h.iterableValueOf = h.env->GetStaticMethodID(h.iterableUtilClass, "list", "([Ljava/lang/Object;)Ljava/lang/Iterable;"); - h.iterableIsNil = h.env->GetStaticMethodID(h.iterableUtilClass, "isNil", "(Ljava/lang/Object;)Z"); + h.iterableIsNil = h.env->GetStaticMethodID(h.iterableUtilClass, "isNull", "(Ljava/lang/Object;)Z"); h.iterableCar = h.env->GetStaticMethodID(h.iterableUtilClass, "car", "(Ljava/lang/Object;)Ljava/lang/Object;"); h.iterableCdr = h.env->GetStaticMethodID(h.iterableUtilClass, "cdr", "(Ljava/lang/Object;)Ljava/lang/Iterable;"); h.uuidClass = h.env->FindClass("org/apache/tuscany/UUIDUtil"); @@ -257,7 +257,7 @@ public: } const value operator()(const list& expr) const { - if (isNil(expr)) + if (isNull(expr)) return func(expr); const value& op(car(expr)); if (op == "equals") @@ -331,7 +331,7 @@ const jobject mkJavaLambda(const JavaRuntime& jr, unused const value& iface, con * Convert a list of values to a Java jobjectArray. */ const jobjectArray valuesToJarrayHelper(const JavaRuntime& jr, jobjectArray a, const list& v, const int i) { - if (isNil(v)) + if (isNull(v)) return a; jr.h.env->SetObjectArrayElement(a, i, valueToJobject(jr, nilValue, car(v))); return valuesToJarrayHelper(jr, a, cdr(v), i + 1); @@ -375,7 +375,7 @@ const jobject valueToJobject(const JavaRuntime& jr, const value& jtype, const va * Convert a list of values to an array of jvalues. */ const jvalue* valuesToJvaluesHelper(const JavaRuntime& jr, jvalue* const a, const list& types, const list& v) { - if (isNil(v)) + if (isNull(v)) return a; a->l = valueToJobject(jr, car(types), car(v)); return valuesToJvaluesHelper(jr, a + 1, cdr(types), cdr(v)); @@ -542,7 +542,7 @@ const failable evalClass(const JavaRuntime& jr, const value& expr, const // Lookup the Java function named as the expression operand const list func = assoc(car(expr), jc.m); - if (isNil(func)) { + if (isNull(func)) { // The start, stop, and restart functions are optional const value fn = car(expr); diff --git a/sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java b/sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java index 2366d79af6..58bb18cf72 100644 --- a/sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java +++ b/sca-cpp/trunk/modules/java/org/apache/tuscany/IterableUtil.java @@ -61,9 +61,9 @@ public class IterableUtil { /** * Return true if a list is nil (empty). */ - public static boolean isNil(final Object l) { + public static boolean isNull(final Object l) { if(l instanceof BasicIterable) - return ((BasicIterable)l).isNil(); + return ((BasicIterable)l).isNull(); if(l instanceof Collection) return ((Collection)l).isEmpty(); return !((Iterable)l).iterator().hasNext(); @@ -144,7 +144,7 @@ public class IterableUtil { */ @SuppressWarnings("unchecked") public static Iterable append(final Object a, final Object b) { - if (isNil(a)) + if (isNull(a)) return (Iterable)b; return cons(car(a), append(cdr(a), b)); } @@ -153,7 +153,7 @@ public class IterableUtil { * Return the first pair matching a key from a list of key value pairs. */ public static Iterable assoc(final Object k, final Object l) { - if(isNil(l)) + if(isNull(l)) return list(); if(k.equals(car(car(l)))) return car(l); @@ -168,11 +168,11 @@ public class IterableUtil { abstract Iterable cdr(); - abstract Boolean isNil(); + abstract Boolean isNull(); @Override public int size() { - return this.isNil()? 0 : 1 + ((List)this.cdr()).size(); + return this.isNull()? 0 : 1 + ((List)this.cdr()).size(); } @Override @@ -194,7 +194,7 @@ public class IterableUtil { } @Override - Boolean isNil() { + Boolean isNull() { return this.a.length - this.start == 0; } @@ -243,7 +243,7 @@ public class IterableUtil { } @Override - Boolean isNil() { + Boolean isNull() { return this.l.size() - this.start == 0; } @@ -292,7 +292,7 @@ public class IterableUtil { } @Override - Boolean isNil() { + Boolean isNull() { return false; } @@ -365,12 +365,12 @@ public class IterableUtil { assert jl.get(2) == Integer.valueOf(2); final Iterable n = list(); - assert isNil(n); + assert isNull(n); assert n.toString().equals("[]"); final Iterable cn = cons(0, n); - assert !isNil(cn); - assert isNil(cdr(cn)); + assert !isNull(cn); + assert isNull(cdr(cn)); assert cn.toString().equals("[0]"); final Iterable al = new ArrayList(Arrays.asList(1, 2, 3)); diff --git a/sca-cpp/trunk/modules/java/test/ServerImpl.java b/sca-cpp/trunk/modules/java/test/ServerImpl.java index 4499681f78..8a6f0e95c9 100644 --- a/sca-cpp/trunk/modules/java/test/ServerImpl.java +++ b/sca-cpp/trunk/modules/java/test/ServerImpl.java @@ -28,7 +28,7 @@ public class ServerImpl { } public Iterable get(final Iterable id) { - if (isNil(id)) + if (isNull(id)) return list(list("'feed", list("'title", "Sample Feed"), list("'id", "123456789"), list("'entry", list( list(list("'title", "Item"), list("'id", "111"), list("'content", list("'item", list("'name", "Apple"), list("'currencyCode", "USD"), list("'currencySymbol", "$"), list("'price", 2.99)))), diff --git a/sca-cpp/trunk/modules/js/htdocs/atomutil.js b/sca-cpp/trunk/modules/js/htdocs/atomutil.js index 3d4e9d08d2..4b57b36fb4 100644 --- a/sca-cpp/trunk/modules/js/htdocs/atomutil.js +++ b/sca-cpp/trunk/modules/js/htdocs/atomutil.js @@ -27,22 +27,22 @@ var atom = {}; */ atom.entryElementValues = function(e) { var lt = filter(selector(mklist(element, "'title")), e); - var t = mklist(element, "'title", isNil(lt)? '' : elementValue(car(lt))); + var t = mklist(element, "'title", isNull(lt)? '' : elementValue(car(lt))); var li = filter(selector(mklist(element, "'id")), e); - var i = mklist(element, "'id", isNil(li)? '' : elementValue(car(li))); + var i = mklist(element, "'id", isNull(li)? '' : elementValue(car(li))); var la = filter(selector(mklist(element, "'author")), e); - var lan = isNil(la)? mklist() : filter(selector(mklist(element, "'name")), car(la)); - var lae = isNil(la)? mklist() : filter(selector(mklist(element, "'email")), car(la)); - var laa = isNil(lan)? lae : lan; - var a = isNil(laa)? mklist() : mklist(mklist(element, "'author", elementValue(car(laa)))); + var lan = isNull(la)? mklist() : filter(selector(mklist(element, "'name")), car(la)); + var lae = isNull(la)? mklist() : filter(selector(mklist(element, "'email")), car(la)); + var laa = isNull(lan)? lae : lan; + var a = isNull(laa)? mklist() : mklist(mklist(element, "'author", elementValue(car(laa)))); var lu = filter(selector(mklist(element, "'updated")), e); - var u = isNil(lu)? mklist() : mklist(mklist(element, "'updated", elementValue(car(lu)))); + var u = isNull(lu)? mklist() : mklist(mklist(element, "'updated", elementValue(car(lu)))); var lc = filter(selector(mklist(element, "'content")), e); - var c = isNil(lc)? mklist() : isAttribute(elementValue(car(lc)))? mklist() : mklist(mklist(element, "'content", elementValue(car(lc)))); + var c = isNull(lc)? mklist() : isAttribute(elementValue(car(lc)))? mklist() : mklist(mklist(element, "'content", elementValue(car(lc)))); return append(append(append(mklist(element, "'entry", t, i), a), u), c); }; @@ -51,7 +51,7 @@ atom.entryElementValues = function(e) { * Convert a list of elements to a list of values representing ATOM entries. */ atom.entriesElementValues = function(e) { - if (isNil(e)) + if (isNull(e)) return e; return cons(atom.entryElementValues(car(e)), atom.entriesElementValues(cdr(e))); }; @@ -70,7 +70,7 @@ atom.isATOMEntry = function(l) { */ atom.readATOMEntryDocument = function(doc) { var e = readXMLDocument(doc); - if (isNil(e)) + if (isNull(e)) return mklist(); return mklist(atom.entryElementValues(car(e))); }; @@ -96,7 +96,7 @@ atom.isATOMFeed = function(l) { */ atom.readATOMFeedDocument = function(doc) { var f = readXMLDocument(doc); - if (isNil(f)) + if (isNull(f)) return mklist(); var t = filter(selector(mklist(element, "'title")), car(f)); var i = filter(selector(mklist(element, "'id")), car(f)); @@ -120,17 +120,17 @@ atom.entryElement = function(l) { var title = elementValue(namedElementChild("'title", l)); var id = elementValue(namedElementChild("'id", l)); var author = namedElementChild("'author", l); - var email = isNil(author)? false : (elementValue(author).indexOf('@') != -1); + var email = isNull(author)? false : (elementValue(author).indexOf('@') != -1); var updated = namedElementChild("'updated", l); var content = namedElementChild("'content", l); - var text = isNil(content)? false : elementHasValue(content); + var text = isNull(content)? false : elementHasValue(content); return append(append(append(append( mklist(element, "'entry", mklist(attribute, "'xmlns", "http://www.w3.org/2005/Atom"), mklist(element, "'title", mklist(attribute, "'type", "text"), title), mklist(element, "'id", id)), - isNil(author)? mklist() : mklist(mklist(element, "'author", + isNull(author)? mklist() : mklist(mklist(element, "'author", (email? mklist(element, "'email", elementValue(author)) : mklist(element, "'name", elementValue(author)))))), - isNil(updated)? mklist() : mklist(mklist(element, "'updated", elementValue(updated)))), - isNil(content)? mklist() : + isNull(updated)? mklist() : mklist(mklist(element, "'updated", elementValue(updated)))), + isNull(content)? mklist() : mklist(append(mklist(element, "'content", mklist(attribute, "'type", text? "text" : "application/xml")), text? mklist(elementValue(content)) : elementChildren(content)))), mklist(mklist(element, "'link", mklist(attribute, "'href", id)))); @@ -140,7 +140,7 @@ atom.entryElement = function(l) { * Convert a list of values representing ATOM entries to a list of elements. */ atom.entriesElements = function(l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(atom.entryElement(car(l)), atom.entriesElements(cdr(l))); }; @@ -149,7 +149,7 @@ atom.entriesElements = function(l) { * Convert a list of values representing an ATOM entry to an ATOM entry. */ atom.writeATOMEntry = function(ll) { - var l = isNil(ll)? ll : car(ll); + var l = isNull(ll)? ll : car(ll); return writeXML(mklist(atom.entryElement(l)), true); }; @@ -157,22 +157,22 @@ atom.writeATOMEntry = function(ll) { * Convert a list of values representing an ATOM feed to an ATOM feed. */ atom.writeATOMFeed = function(ll) { - var l = isNil(ll)? ll : car(ll); + var l = isNull(ll)? ll : car(ll); var lt = filter(selector(mklist(element, "'title")), l); - var t = isNil(lt)? '' : elementValue(car(lt)); + var t = isNull(lt)? '' : elementValue(car(lt)); var li = filter(selector(mklist(element, "'id")), l); - var i = isNil(li)? '' : elementValue(car(li)); + var i = isNull(li)? '' : elementValue(car(li)); var f = mklist(element, "'feed", mklist(attribute, "'xmlns", "http://www.w3.org/2005/Atom"), mklist(element, "'title", mklist(attribute, "'type", "text"), car(l)), mklist(element, "'id", cadr(l))); // Write ATOM entries var le = filter(selector(mklist(element, "'entry")), l); - if (isNil(le)) + if (isNull(le)) return writeXML(mklist(f), true); // Write a single ATOM entry element with a list of values - if (!isNil(le) && !isNil(car(le)) && isList(car(caddr(car(le))))) { + if (!isNull(le) && !isNull(car(le)) && isList(car(caddr(car(le))))) { var fe = append(f, atom.entriesElements(caddr(car(le)))); return writeXML(mklist(fe), true); } diff --git a/sca-cpp/trunk/modules/js/htdocs/elemutil.js b/sca-cpp/trunk/modules/js/htdocs/elemutil.js index 37d641f7b3..62050f5953 100644 --- a/sca-cpp/trunk/modules/js/htdocs/elemutil.js +++ b/sca-cpp/trunk/modules/js/htdocs/elemutil.js @@ -29,14 +29,14 @@ var atsign = "'@" * Return true if a value is an element. */ function isElement(v) { - return (!(!isList(v) || isNil(v) || car(v) != element)); + return (!(!isList(v) || isNull(v) || car(v) != element)); } /** * Return true if a value is an attribute. */ function isAttribute(v) { - return (!(!isList(v) || isNil(v) || car(v) != attribute)); + return (!(!isList(v) || isNull(v) || car(v) != attribute)); } /** @@ -58,7 +58,7 @@ elementName = cadr; * Return true if an element has children. */ function elementHasChildren(l) { - return !isNil(cddr(l)); + return !isNull(cddr(l)); } /** @@ -73,7 +73,7 @@ function elementHasValue(l) { var r = reverse(l); if (isSymbol(car(r))) return false; - return (!(isList(car(r)) && !isNil(car(r)) && isSymbol(car(car(r))))) + return (!(isList(car(r)) && !isNull(car(r)) && isSymbol(car(car(r))))) } /** @@ -89,7 +89,7 @@ function elementValue(l) { function elementToValueIsList(v) { if (!isList(v)) return false; - return isNil(v) || !isSymbol(car(v)); + return isNull(v) || !isSymbol(car(v)); } function elementToValue(t) { @@ -112,11 +112,11 @@ function elementToValue(t) { * Convert a list of elements to a list of values. */ function elementToValueIsSymbol(v) { - return (!(!isList(v)) || isNil(v) || !isSymbol(car(v))); + return (!(!isList(v)) || isNull(v) || !isSymbol(car(v))); } function elementToValueGroupValues(v, l) { - if (isNil(l) || !elementToValueIsSymbol(v) || !elementToValueIsSymbol(car(l))) + if (isNull(l) || !elementToValueIsSymbol(v) || !elementToValueIsSymbol(car(l))) return cons(v, l); if (car(car(l)) != car(v)) return cons(v, l); @@ -129,7 +129,7 @@ function elementToValueGroupValues(v, l) { } function elementsToValues(e) { - if (isNil(e)) + if (isNull(e)) return e; return elementToValueGroupValues(elementToValue(car(e)), elementsToValues(cdr(e))); } @@ -138,15 +138,15 @@ function elementsToValues(e) { * Convert a value to an element. */ function valueToElement(t) { - if (isList(t) && !isNil(t) && isSymbol(car(t))) { + if (isList(t) && !isNull(t) && isSymbol(car(t))) { var n = car(t); - var v = isNil(cdr(t))? mklist() : cadr(t); + var v = isNull(cdr(t))? mklist() : cadr(t); if (!isList(v)) { if (n.substring(0, 2) == atsign) return mklist(attribute, "'" + n.substring(2), v); return mklist(element, n, v); } - if (isNil(v) || !isSymbol(car(v))) + if (isNull(v) || !isSymbol(car(v))) return cons(element, cons(n, mklist(valuesToElements(v)))); return cons(element, cons(n, valuesToElements(cdr(t)))); } @@ -159,7 +159,7 @@ function valueToElement(t) { * Convert a list of values to a list of elements. */ function valuesToElements(l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(valueToElement(car(l)), valuesToElements(cdr(l))); } @@ -169,9 +169,9 @@ function valuesToElements(l) { */ function selector(s) { function evalSelect(s, v) { - if (isNil(s)) + if (isNull(s)) return true; - if (isNil(v)) + if (isNull(v)) return false; if (car(s) != car(v)) return false; @@ -187,7 +187,7 @@ function selector(s) { function namedAttribute(name, l) { return memo(l, name, function() { var f = filter(function(v) { return isAttribute(v) && attributeName(v) == name; }, l); - if (isNil(f)) + if (isNull(f)) return null; return car(f); }); @@ -217,7 +217,7 @@ function namedElementChildren(name, l) { */ function namedElementChild(name, l) { var f = namedElementChildren(name, l); - if (isNil(f)) + if (isNull(f)) return null; return car(f); } diff --git a/sca-cpp/trunk/modules/js/htdocs/jsonutil.js b/sca-cpp/trunk/modules/js/htdocs/jsonutil.js index 8aa291bc89..9960a5d82f 100644 --- a/sca-cpp/trunk/modules/js/htdocs/jsonutil.js +++ b/sca-cpp/trunk/modules/js/htdocs/jsonutil.js @@ -41,13 +41,13 @@ json.Exception.prototype.toString = function() { * Return true if a list represents a JS array. */ json.isJSArray = function(l) { - if (isNil(l)) + if (isNull(l)) return true; var v = car(l); if (isSymbol(v)) return false; if (isList(v)) - if (!isNil(v) && isSymbol(car(v))) + if (!isNull(v) && isSymbol(car(v))) return false; return true; }; @@ -56,7 +56,7 @@ json.isJSArray = function(l) { * Converts JSON properties to values. */ json.jsPropertiesToValues = function(propertiesSoFar, o, i) { - if (isNil(i)) + if (isNull(i)) return propertiesSoFar; var p = car(i); var jsv = o[p]; @@ -92,7 +92,7 @@ json.jsValToValue = function(jsv) { * Return true if a list of strings contains a JSON document. */ json.isJSON = function(l) { - if (isNil(l)) + if (isNull(l)) return false; var s = car(l).slice(0, 1); return s == "[" || s == "{"; @@ -112,7 +112,7 @@ json.readJSON = function(l) { * Convert a list of values to JSON array elements. */ json.valuesToJSElements = function(a, l, i) { - if (isNil(l)) + if (isNull(l)) return a; var pv = json.valueToJSVal(car(l)); a[i] = pv @@ -134,7 +134,7 @@ json.valueToJSVal = function(v) { * Convert a list of values to JSON properties. */ json.valuesToJSProperties = function(o, l) { - if (isNil(l)) + if (isNull(l)) return o; var token = car(l); if (isTaggedList(token, attribute)) { diff --git a/sca-cpp/trunk/modules/js/htdocs/scdl.js b/sca-cpp/trunk/modules/js/htdocs/scdl.js index 50dab53e7c..fd0e08035f 100644 --- a/sca-cpp/trunk/modules/js/htdocs/scdl.js +++ b/sca-cpp/trunk/modules/js/htdocs/scdl.js @@ -27,7 +27,7 @@ var scdl = {}; */ scdl.composite = function(l) { var cs = namedElementChildren("'composite", l); - if (isNil(cs)) + if (isNull(cs)) return cs; return car(cs); }; @@ -37,7 +37,7 @@ scdl.composite = function(l) { */ scdl.components = function(l) { var cs = namedElementChildren("'composite", l); - if (isNil(cs)) + if (isNull(cs)) return cs; return namedElementChildren("'component", car(cs)); }; @@ -47,7 +47,7 @@ scdl.components = function(l) { */ scdl.promotions = function(l) { var cs = namedElementChildren("'composite", l); - if (isNil(cs)) + if (isNull(cs)) return cs; return namedElementChildren("'service", car(cs)); }; @@ -57,7 +57,7 @@ scdl.promotions = function(l) { */ scdl.promote = function(l) { var puri = namedAttributeValue("'promote", l); - if (isNil(puri)) + if (isNull(puri)) return puri; return car(tokens(puri)); }; @@ -74,7 +74,7 @@ scdl.name = function(l) { */ scdl.documentation = function(l) { var d = namedElementChildren("'documentation", l); - if (isNil(d)) + if (isNull(d)) return null; if (!elementHasValue(car(d))) return null; @@ -126,7 +126,7 @@ scdl.implementation = function(l) { } var n = filter(filterImplementation, l); - if (isNil(n)) + if (isNull(n)) return null; return car(n); }; @@ -204,21 +204,21 @@ scdl.bindingType = function(l) { scdl.target = function(l) { function targetURI() { function bindingsTarget(l) { - if (isNil(l)) + if (isNull(l)) return null; var u = scdl.uri(car(l)); - if (!isNil(u)) + if (!isNull(u)) return u; return bindingsTarget(cdr(l)); } var t = namedAttributeValue("'target", l); - if (!isNil(t)) + if (!isNull(t)) return t; return bindingsTarget(scdl.bindings(l)); } var turi = targetURI(); - if (isNil(turi)) + if (isNull(turi)) return turi; return car(tokens(turi)); }; @@ -243,7 +243,7 @@ scdl.propertyValue = function(l) { * Convert a list of elements to a name -> element assoc list. */ scdl.nameToElementAssoc = function(l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(mklist(scdl.name(car(l)), car(l)), scdl.nameToElementAssoc(cdr(l))); }; diff --git a/sca-cpp/trunk/modules/js/htdocs/ui.js b/sca-cpp/trunk/modules/js/htdocs/ui.js index 0c80b92bcf..3aa9e1052a 100644 --- a/sca-cpp/trunk/modules/js/htdocs/ui.js +++ b/sca-cpp/trunk/modules/js/htdocs/ui.js @@ -31,7 +31,7 @@ ui.elementByID = function(node, id) { return null; for (var i in node.childNodes) { var child = node.childNodes[i]; - if (isNil(child)) + if (isNull(child)) continue; if (child.id == id) return child; @@ -275,7 +275,7 @@ ui.msieVersion = function() { */ ui.asyncFrame = null; ui.async = function(f) { - if (isNil(ui.asyncFrame)) + if (isNull(ui.asyncFrame)) // Use requestAnimationFrame when available, fallback to setTimeout ui.asyncFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || @@ -293,7 +293,7 @@ ui.delay = function(f, t) { var id = window.setTimeout(function() { delete ui.delayed[id]; return f(); - }, isNil(t)? 16 : t); + }, isNull(t)? 16 : t); ui.delayed[id] = id; return id; }; @@ -311,12 +311,12 @@ ui.cancelDelay = function(id) { */ ui.animationFrame = null; ui.animation = function(f) { - if (isNil(ui.animationFrame)) + if (isNull(ui.animationFrame)) // Use requestAnimationFrame when available, fallback to setInterval ui.animationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(f) { - if (!('interval' in f) || isNil(f.interval)) { + if (!('interval' in f) || isNull(f.interval)) { // First call, setup the interval f.interval = window.setInterval(function animation() { f.clearInterval = true; @@ -370,7 +370,7 @@ ui.onload = function() { } else { // Style scroll bars var h = document.getElementsByTagName('html'); - if (!isNil(h)) + if (!isNull(h)) h[0].className = h[0].className? h[0].classname + ' flatscrollbars' : 'flatscrollbars'; } @@ -393,7 +393,7 @@ ui.onload = function() { ui.onorientationchange = function(e) { // Adjust filler height - if (!isNil(ui.filler)) + if (!isNull(ui.filler)) ui.filler.style.height = ui.pixpos(window.orientation == 0? screen.height : screen.width); // Scroll to hide the address bar @@ -524,7 +524,7 @@ ui.datatable = function(l) { } function rows(l, i) { - if (isNil(l)) + if (isNull(l)) return ''; var e = car(l); @@ -564,7 +564,7 @@ ui.datatable = function(l) { ui.datalist = function(l) { function rows(l, i) { - if (isNil(l)) + if (isNull(l)) return ''; var e = car(l); diff --git a/sca-cpp/trunk/modules/js/htdocs/util.js b/sca-cpp/trunk/modules/js/htdocs/util.js index 1cf086c60e..a8fec3994d 100644 --- a/sca-cpp/trunk/modules/js/htdocs/util.js +++ b/sca-cpp/trunk/modules/js/htdocs/util.js @@ -81,7 +81,7 @@ function range(a, b) { return l; } -function isNil(v) { +function isNull(v) { return (v == null || typeof v == 'undefined' || (v.constructor == Array && v.length == 0)); } @@ -98,7 +98,7 @@ function isList(v) { } function isTaggedList(v, t) { - return (isList(v) && !isNil(v) && car(v) == t); + return (isList(v) && !isNull(v) && car(v) == t); } var emptylist = new Array(); @@ -120,7 +120,7 @@ function length(l) { * Scheme-like associations. */ function assoc(k, l) { - if (isNil(l)) + if (isNull(l)) return emptylist; var n = l.length; for(var i = 0; i < n; i++) { @@ -134,7 +134,7 @@ function assoc(k, l) { * Map, filter and reduce functions. */ function map(f, l) { - if (isNil(l)) + if (isNull(l)) return l; var n = l.length; var a = new Array(); @@ -145,7 +145,7 @@ function map(f, l) { } function filter(f, l) { - if (isNil(l)) + if (isNull(l)) return l; var n = l.length; var a = new Array(); @@ -157,7 +157,7 @@ function filter(f, l) { } function reduce(f, i, l) { - if (isNil(l)) + if (isNull(l)) return i; return reduce(f, f(i, car(l)), cdr(l)); } @@ -223,7 +223,7 @@ function isIE() { * External build configuration. */ var config; -if (isNil(config)) +if (isNull(config)) config = {}; /** @@ -245,7 +245,7 @@ function assert(exp) { * Write a list of strings. */ function writeStrings(l) { - if (isNil(l)) + if (isNull(l)) return ''; var s = ''; var n = l.length; @@ -268,14 +268,14 @@ function writeValue(v) { } function writeList(l) { - if (isNil(l)) + if (isNull(l)) return ''; return ' ' + writeValue(car(l)) + writeList(cdr(l)); } if (!isList(v)) return writePrimitive(v); - if (isNil(v)) + if (isNull(v)) return '()'; return '(' + writeValue(car(v)) + writeList(cdr(v)) + ')'; } @@ -403,7 +403,7 @@ function domainname(host) { if (s != -1) return domainname(host.substring(0, s)); var h = reverse(host.split('.')); - var d = (!isNil(cddr(h)) && caddr(h) == 'www')? mklist(car(h), cadr(h), caddr(h)) : mklist(car(h), cadr(h)); + var d = (!isNull(cddr(h)) && caddr(h) == 'www')? mklist(car(h), cadr(h), caddr(h)) : mklist(car(h), cadr(h)); return reverse(d).join('.'); } @@ -536,7 +536,7 @@ function setcaddr(l, v) { * Append the elements of a list to a list. */ function setappend(a, b) { - if (isNil(b)) + if (isNull(b)) return a; a.push(car(b)); return setappend(a, cdr(b)); diff --git a/sca-cpp/trunk/modules/js/htdocs/xmlutil.js b/sca-cpp/trunk/modules/js/htdocs/xmlutil.js index 4d943cce75..29240dff9c 100644 --- a/sca-cpp/trunk/modules/js/htdocs/xmlutil.js +++ b/sca-cpp/trunk/modules/js/htdocs/xmlutil.js @@ -26,7 +26,7 @@ */ function nodeList(n) { var l = new Array(); - if (isNil(n)) + if (isNull(n)) return l; for (var i = 0; i < n.length; i++) l[i] = n[i]; @@ -37,7 +37,7 @@ function nodeList(n) { * Append a list of nodes to a parent node. */ function appendNodes(nodes, p) { - if (isNil(nodes)) + if (isNull(nodes)) return p; p.appendChild(car(nodes)); return appendNodes(cdr(nodes), p); @@ -71,7 +71,7 @@ function childText(e) { * Read a list of XML attributes. */ function readAttributes(p, a) { - if (isNil(a)) + if (isNull(a)) return a; var x = car(a); return cons(mklist(attribute, "'" + x.nodeName, x.nodeValue), readAttributes(p, cdr(a))); @@ -83,7 +83,7 @@ function readAttributes(p, a) { function readElement(e, childf) { var l = append(append(mklist(element, "'" + e.nodeName), readAttributes(e, childf(e))), readElements(childElements(e), childf)); var t = childText(e); - if (isNil(t)) + if (isNull(t)) return l; return append(l, mklist(car(t).nodeValue)); } @@ -92,7 +92,7 @@ function readElement(e, childf) { * Read a list of XML elements. */ function readElements(l, childf) { - if (isNil(l)) + if (isNull(l)) return l; return cons(readElement(car(l), childf), readElements(cdr(l), childf)); } @@ -101,7 +101,7 @@ function readElements(l, childf) { * Return true if a list of strings contains an XML document. */ function isXML(l) { - if (isNil(l)) + if (isNull(l)) return false; return car(l).substring(0, 5) == '& l) { - if(isNil(l)) + if(isNull(l)) return true; const value v = car(l); if (isSymbol(v)) return false; if(isList(v)) { - if(!isNil((list)v) && isSymbol(car(v))) + if(!isNull((list)v) && isSymbol(car(v))) return false; } return true; @@ -94,7 +94,7 @@ inline const list jsPropertiesToValues(const list& propertiesSoFar const char* const name = json_object_iter_key(i); json_t* const jsv = json_object_iter_value(i); const value val = jsValToValue(jsv); - if (isNil(val) && !isList(val)) + if (isNull(val) && !isList(val)) return jsPropertiesToValues(cons (mklist (element, c_str(name), val), propertiesSoFar), o, json_object_iter_next(o, i)); if (substr(name, 0, 1) == atsign) return jsPropertiesToValues(cons(mklist(attribute, c_str(substr(name, 1)), val), propertiesSoFar), o, json_object_iter_next(o, i)); @@ -148,7 +148,7 @@ const value jsValToValue(json_t* const jsv) { */ inline json_t* const valuesToJSElements(json_t* const a, const list& l) { json_t* const valueToJSVal(const value& val); - if (isNil(l)) + if (isNull(l)) return a; json_t* const v = valueToJSVal(car(l)); json_array_append(a, v); @@ -199,7 +199,7 @@ inline json_t* const valueToJSVal(const value& val) { * Converts a list of values to JS properties. */ inline json_t* const valuesToJSProperties(json_t* const o, const list& l) { - if (isNil(l)) + if (isNull(l)) return o; // Write an attribute @@ -235,7 +235,7 @@ inline json_t* const valuesToJSProperties(json_t* const o, const list& l) * Return true if a list of strings contains a JSON document. */ inline const bool isJSON(const list& ls) { - if (isNil(ls)) + if (isNull(ls)) return false; const string s = substr(car(ls), 0, 1); return s == "[" || s == "{"; @@ -390,7 +390,7 @@ inline const string funcName(const string& f) { * of key value pairs. */ inline const list queryParams(const list& a) { - if (isNil(a)) + if (isNull(a)) return nilListValue; const list p = car(a); if (car(p) == value("id") || car(p) == value("method")) diff --git a/sca-cpp/trunk/modules/oauth/mod-oauth1.cpp b/sca-cpp/trunk/modules/oauth/mod-oauth1.cpp index a7238804f8..b1786d1098 100644 --- a/sca-cpp/trunk/modules/oauth/mod-oauth1.cpp +++ b/sca-cpp/trunk/modules/oauth/mod-oauth1.cpp @@ -104,7 +104,7 @@ public: * Run the authnz hooks to authenticate a request. */ const failable checkAuthnzProviders(const string& user, request_rec* const r, const list& apcs) { - if (isNil(apcs)) + if (isNull(apcs)) return mkfailure("Authentication failure for: " + user, HTTP_UNAUTHORIZED); const AuthnProviderConf apc = car(apcs); if (apc.provider == NULL || !apc.provider->check_password) @@ -122,7 +122,7 @@ const failable checkAuthnz(const string& user, request_rec* const r, const if (substr(user, 0, 1) == "/") return mkfailure(string("Encountered FakeBasicAuth spoof: ") + user, HTTP_UNAUTHORIZED); - if (isNil(apcs)) { + if (isNull(apcs)) { const authn_provider* provider = (const authn_provider*)ap_lookup_provider(AUTHN_PROVIDER_GROUP, AUTHN_DEFAULT_PROVIDER, AUTHN_PROVIDER_VERSION); return checkAuthnzProviders(user, r, mklist(AuthnProviderConf(AUTHN_DEFAULT_PROVIDER, provider))); } @@ -142,11 +142,11 @@ const failable userInfo(const value& sid, const memcache::MemCached& mc) const failable authenticated(const list& userinfo, const bool check, request_rec* const r, const list& scopeattrs, const list& apcs) { debug(userinfo, "modoauth2::authenticated::userinfo"); - if (isNil(scopeattrs)) { + if (isNull(scopeattrs)) { // Store user id in an environment variable const list id = assoc("id", userinfo); - if (isNil(id) || isNil(cdr(id))) + if (isNull(id) || isNull(cdr(id))) return mkfailure("Couldn't retrieve user id", HTTP_UNAUTHORIZED); apr_table_set(r->subprocess_env, "OAUTH2_ID", apr_pstrdup(r->pool, c_str(cadr(id)))); @@ -164,7 +164,7 @@ const failable authenticated(const list& userinfo, const bool check, // Store each configured OAuth scope attribute in an environment variable const list a = car(scopeattrs); const list v = assoc(cadr(a), userinfo); - if (!isNil(v) && !isNil(cdr(v))) { + if (!isNull(v) && !isNull(cdr(v))) { // Map the REMOTE_USER attribute to the request user field if (string(car(a)) == "REMOTE_USER") @@ -192,7 +192,7 @@ const string header(const string& qs, const string& redir, const string& verif) << "oauth_consumer_key=\"" << string(cadr(assoc("oauth_consumer_key", args))) << "\", "; const list atok = assoc("oauth_token", args); - if (!isNil(atok) && !isNil(cdr(atok))) + if (!isNull(atok) && !isNull(cdr(atok))) hdr << "oauth_token=\"" << string(cadr(atok)) << "\", "; if (length(verif) != 0) @@ -223,22 +223,22 @@ const list sign(const string& verb, const string& uri, const list const failable authorize(const list& args, request_rec* const r, const list& appkeys, const memcache::MemCached& mc) { // Extract authorize, access_token, client ID and info URIs const list ref = assoc("openauth_referrer", args); - if (isNil(ref) || isNil(cdr(ref))) + if (isNull(ref) || isNull(cdr(ref))) return mkfailure("Missing openauth_referrer parameter"); const list req = assoc("oauth1_request_token", args); - if (isNil(req) || isNil(cdr(req))) + if (isNull(req) || isNull(cdr(req))) return mkfailure("Missing oauth1_request_token parameter"); const list auth = assoc("oauth1_authorize", args); - if (isNil(auth) || isNil(cdr(auth))) + if (isNull(auth) || isNull(cdr(auth))) return mkfailure("Missing oauth1_authorize parameter"); const list tok = assoc("oauth1_access_token", args); - if (isNil(tok) || isNil(cdr(tok))) + if (isNull(tok) || isNull(cdr(tok))) return mkfailure("Missing oauth1_access_token parameter"); const list cid = assoc("oauth1_client_id", args); - if (isNil(cid) || isNil(cdr(cid))) + if (isNull(cid) || isNull(cdr(cid))) return mkfailure("Missing oauth1_client_id parameter"); const list info = assoc("oauth1_info", args); - if (isNil(info) || isNil(cdr(info))) + if (isNull(info) || isNull(cdr(info))) return mkfailure("Missing oauth1_info parameter"); // Build the redirect URI @@ -248,7 +248,7 @@ const failable authorize(const list& args, request_rec* const r, con // Lookup client app configuration const list app = assoc(cadr(cid), appkeys); - if (isNil(app) || isNil(cdr(app))) + if (isNull(app) || isNull(cdr(app))) return mkfailure(string("client id not found: ") + (string)cadr(cid)); list appkey = cadr(app); @@ -271,13 +271,13 @@ const failable authorize(const list& args, request_rec* const r, con // Retrieve the request token const list conf = assoc("oauth_callback_confirmed", resargs); - if (isNil(conf) || isNil(cdr(conf)) || cadr(conf) != "true") + if (isNull(conf) || isNull(cdr(conf)) || cadr(conf) != "true") return mkfailure("Couldn't confirm oauth_callback"); const list tv = assoc("oauth_token", resargs); - if (isNil(tv) || isNil(cdr(tv))) + if (isNull(tv) || isNull(cdr(tv))) return mkfailure("Couldn't retrieve oauth_token"); const list sv = assoc("oauth_token_secret", resargs); - if (isNil(sv) || isNil(cdr(sv))) + if (isNull(sv) || isNull(cdr(sv))) return mkfailure("Couldn't retrieve oauth_token_secret"); // Store the request token in memcached @@ -301,12 +301,12 @@ const failable > profileUserInfo(const value& cid, const string& inf if (b == "[") { // Twitter JSON profile const list infov(content(json::readValue(mklist(info)))); - if (isNil(infov)) + if (isNull(infov)) return mkfailure >("Couldn't retrieve user info"); debug(infov, "modoauth1::access_token::info"); const list uv = assoc("user", car(infov)); debug(uv, "modoauth1::access_token::userInfo"); - if (isNil(uv) || isNil(cdr(uv))) + if (isNull(uv) || isNull(cdr(uv))) return mkfailure >("Couldn't retrieve user info"); const list iv = cdr(uv); return cons(mklist("realm", cid), iv); @@ -314,12 +314,12 @@ const failable > profileUserInfo(const value& cid, const string& inf if (b == "{") { // Foursquare JSON profile const list infov(content(json::readValue(mklist(info)))); - if (isNil(infov)) + if (isNull(infov)) return mkfailure >("Couldn't retrieve user info"); debug(infov, "modoauth1::access_token::info"); const list uv = assoc("user", infov); debug(uv, "modoauth1::access_token::userInfo"); - if (isNil(uv) || isNil(cdr(uv))) + if (isNull(uv) || isNull(cdr(uv))) return mkfailure >("Couldn't retrieve user info"); const list iv = cdr(uv); return cons(mklist("realm", cid), iv); @@ -327,12 +327,12 @@ const failable > profileUserInfo(const value& cid, const string& inf if (b == "<") { // XML profile const list infov = elementsToValues(content(xml::readElements(mklist(info)))); - if (isNil(infov)) + if (isNull(infov)) return mkfailure >("Couldn't retrieve user info"); debug(infov, "modoauth1::access_token::info"); const list pv = car(infov); debug(pv, "modoauth1::access_token::userInfo"); - if (isNil(pv) || isNil(cdr(pv))) + if (isNull(pv) || isNull(cdr(pv))) return mkfailure >("Couldn't retrieve user info"); const list iv = cdr(pv); return cons(mklist("realm", cid), iv); @@ -347,27 +347,27 @@ const failable accessToken(const list& args, request_rec* r, const l // Extract access_token URI, client ID and verification code const list ref = assoc("openauth_referrer", args); - if (isNil(ref) || isNil(cdr(ref))) + if (isNull(ref) || isNull(cdr(ref))) return mkfailure("Missing openauth_referrer parameter"); const list tok = assoc("oauth1_access_token", args); - if (isNil(tok) || isNil(cdr(tok))) + if (isNull(tok) || isNull(cdr(tok))) return mkfailure("Missing oauth1_access_token parameter"); const list cid = assoc("oauth1_client_id", args); - if (isNil(cid) || isNil(cdr(cid))) + if (isNull(cid) || isNull(cdr(cid))) return mkfailure("Missing oauth1_client_id parameter"); const list info = assoc("oauth1_info", args); - if (isNil(info) || isNil(cdr(info))) + if (isNull(info) || isNull(cdr(info))) return mkfailure("Missing oauth1_info parameter"); const list tv = assoc("oauth_token", args); - if (isNil(tv) || isNil(cdr(tv))) + if (isNull(tv) || isNull(cdr(tv))) return mkfailure("Missing oauth_token parameter"); const list vv = assoc("oauth_verifier", args); - if (isNil(vv) || isNil(cdr(vv))) + if (isNull(vv) || isNull(cdr(vv))) return mkfailure("Missing oauth_verifier parameter"); // Lookup client app configuration const list app = assoc(cadr(cid), appkeys); - if (isNil(app) || isNil(cdr(app))) + if (isNull(app) || isNull(cdr(app))) return mkfailure(string("client id not found: ") + (string)cadr(cid)); const list appkey = cadr(app); @@ -395,10 +395,10 @@ const failable accessToken(const list& args, request_rec* r, const l // Retrieve the access token const list atv = assoc("oauth_token", tokresargs); - if (isNil(atv) || isNil(cdr(atv))) + if (isNull(atv) || isNull(cdr(atv))) return mkfailure("Couldn't retrieve oauth_token"); const list asv = assoc("oauth_token_secret", tokresargs); - if (isNil(asv) || isNil(cdr(asv))) + if (isNull(asv) || isNull(cdr(asv))) return mkfailure("Couldn't retrieve oauth_token_secret"); debug(atv, "modoauth1::access_token::token"); @@ -498,7 +498,7 @@ static int checkAuthn(request_rec *r) { hasContent(openauth::sessionID(r, "TuscanyOpenAuth")) || hasContent(openauth::sessionID(r, "TuscanyOAuth2"))) return DECLINED; - if ((substr(string(r->uri), 0, 8) == "/oauth2/") || !isNil(assoc("openid_identifier", args))) + if ((substr(string(r->uri), 0, 8) == "/oauth2/") || !isNull(assoc("openid_identifier", args))) return DECLINED; r->ap_auth_type = const_cast(atype); @@ -515,9 +515,9 @@ int postConfigMerge(const ServerConf& mainsc, server_rec* const s) { debug(httpd::serverName(s), "modoauth1::postConfigMerge::serverName"); // Merge configuration from main server - if (isNil((list)sc.appkeys)) + if (isNull((list)sc.appkeys)) sc.appkeys = mainsc.appkeys; - if (isNil((list)sc.mcaddrs)) + if (isNull((list)sc.mcaddrs)) sc.mcaddrs = mainsc.mcaddrs; sc.mc = mainsc.mc; sc.cs = mainsc.cs; @@ -549,7 +549,7 @@ void childInit(apr_pool_t* const p, server_rec* const s) { ServerConf& sc = *psc; // Connect to Memcached - if (isNil((list)sc.mcaddrs)) + if (isNull((list)sc.mcaddrs)) sc.mc = *(new (gc_new()) memcache::MemCached("localhost", 11211)); else sc.mc = *(new (gc_new()) memcache::MemCached(sc.mcaddrs)); diff --git a/sca-cpp/trunk/modules/oauth/mod-oauth2.cpp b/sca-cpp/trunk/modules/oauth/mod-oauth2.cpp index 5bc212a681..0a4405ce2e 100644 --- a/sca-cpp/trunk/modules/oauth/mod-oauth2.cpp +++ b/sca-cpp/trunk/modules/oauth/mod-oauth2.cpp @@ -98,7 +98,7 @@ public: * Run the authnz hooks to authenticate a request. */ const failable checkAuthnzProviders(const string& user, request_rec* const r, const list& apcs) { - if (isNil(apcs)) + if (isNull(apcs)) return mkfailure("Authentication failure for: " + user, HTTP_UNAUTHORIZED); const AuthnProviderConf apc = car(apcs); if (apc.provider == NULL || !apc.provider->check_password) @@ -116,7 +116,7 @@ const failable checkAuthnz(const string& user, request_rec* const r, const if (substr(user, 0, 1) == "/") return mkfailure(string("Encountered FakeBasicAuth spoof: ") + user, HTTP_UNAUTHORIZED); - if (isNil(apcs)) { + if (isNull(apcs)) { const authn_provider* provider = (const authn_provider*)ap_lookup_provider(AUTHN_PROVIDER_GROUP, AUTHN_DEFAULT_PROVIDER, AUTHN_PROVIDER_VERSION); return checkAuthnzProviders(user, r, mklist(AuthnProviderConf(AUTHN_DEFAULT_PROVIDER, provider))); } @@ -136,11 +136,11 @@ const failable userInfo(const value& sid, const memcache::MemCached& mc) const failable authenticated(const list& userinfo, const bool check, request_rec* const r, const list& scopeattrs, const list& apcs) { debug(userinfo, "modoauth2::authenticated::userinfo"); - if (isNil(scopeattrs)) { + if (isNull(scopeattrs)) { // Store user id in an environment variable const list id = assoc("id", userinfo); - if (isNil(id) || isNil(cdr(id))) + if (isNull(id) || isNull(cdr(id))) return mkfailure("Couldn't retrieve user id", HTTP_UNAUTHORIZED); apr_table_set(r->subprocess_env, "OAUTH2_ID", apr_pstrdup(r->pool, c_str(cadr(id)))); @@ -158,7 +158,7 @@ const failable authenticated(const list& userinfo, const bool check, // Store each configured OAuth scope attribute in an environment variable const list a = car(scopeattrs); const list v = assoc(cadr(a), userinfo); - if (!isNil(v) && !isNil(cdr(v))) { + if (!isNull(v) && !isNull(cdr(v))) { // Map the REMOTE_USER attribute to the request user field if (string(car(a)) == "REMOTE_USER") @@ -175,22 +175,22 @@ const failable authenticated(const list& userinfo, const bool check, const failable authorize(const list& args, request_rec* const r, const list& appkeys) { // Extract authorize, access_token, client ID and info URIs const list ref = assoc("openauth_referrer", args); - if (isNil(ref) || isNil(cdr(ref))) + if (isNull(ref) || isNull(cdr(ref))) return mkfailure("Missing openauth_referrer parameter"); const list auth = assoc("oauth2_authorize", args); - if (isNil(auth) || isNil(cdr(auth))) + if (isNull(auth) || isNull(cdr(auth))) return mkfailure("Missing oauth2_authorize parameter"); const list tok = assoc("oauth2_access_token", args); - if (isNil(tok) || isNil(cdr(tok))) + if (isNull(tok) || isNull(cdr(tok))) return mkfailure("Missing oauth2_access_token parameter"); const list cid = assoc("oauth2_client_id", args); - if (isNil(cid) || isNil(cdr(cid))) + if (isNull(cid) || isNull(cdr(cid))) return mkfailure("Missing oauth2_client_id parameter"); const list info = assoc("oauth2_info", args); - if (isNil(info) || isNil(cdr(info))) + if (isNull(info) || isNull(cdr(info))) return mkfailure("Missing oauth2_info parameter"); const list scope = assoc("oauth2_scope", args); - if (isNil(scope) || isNil(cdr(scope))) + if (isNull(scope) || isNull(cdr(scope))) return mkfailure("Missing oauth2_scope parameter"); const list display = assoc("oauth2_display", args); @@ -205,12 +205,12 @@ const failable authorize(const list& args, request_rec* const r, con // Lookup client app configuration const list app = assoc(cadr(cid), appkeys); - if (isNil(app) || isNil(cdr(app))) + if (isNull(app) || isNull(cdr(app))) return mkfailure(string("client id not found: ") + (string)cadr(cid)); list appkey = cadr(app); // Redirect to the authorize URI - const list adisplay = (isNil(display) || isNil(cdr(display)))? nilListValue : mklist("display", cadr(display)); + const list adisplay = (isNull(display) || isNull(cdr(display)))? nilListValue : mklist("display", cadr(display)); const list aargs = mklist(mklist("response_type", "code"), mklist("client_id", car(appkey)), mklist("scope", cadr(scope)), adisplay, mklist("redirect_uri", httpd::escape(redir)), mklist("state", httpd::escape(state))); const string uri = httpd::unescape(cadr(auth)) + string("?") + http::queryString(aargs); debug(uri, "modoauth2::authorize::uri"); @@ -233,28 +233,28 @@ const failable accessToken(const list& args, request_rec* r, const l // Extract access_token URI, client ID and authorization code parameters const list state = assoc("state", args); - if (isNil(state) || isNil(cdr(state))) + if (isNull(state) || isNull(cdr(state))) return mkfailure("Missing state parameter"); const list& stargs = httpd::queryArgs(httpd::unescape(cadr(state))); const list ref = assoc("openauth_referrer", stargs); - if (isNil(ref) || isNil(cdr(ref))) + if (isNull(ref) || isNull(cdr(ref))) return mkfailure("Missing openauth_referrer parameter"); const list tok = assoc("oauth2_access_token", stargs); - if (isNil(tok) || isNil(cdr(tok))) + if (isNull(tok) || isNull(cdr(tok))) return mkfailure("Missing oauth2_access_token parameter"); const list cid = assoc("oauth2_client_id", stargs); - if (isNil(cid) || isNil(cdr(cid))) + if (isNull(cid) || isNull(cdr(cid))) return mkfailure("Missing oauth2_client_id parameter"); const list info = assoc("oauth2_info", stargs); - if (isNil(info) || isNil(cdr(info))) + if (isNull(info) || isNull(cdr(info))) return mkfailure("Missing oauth2_info parameter"); const list code = assoc("code", args); - if (isNil(code) || isNil(cdr(code))) + if (isNull(code) || isNull(cdr(code))) return mkfailure("Missing code parameter"); // Lookup client app configuration const list app = assoc(cadr(cid), appkeys); - if (isNil(app) || isNil(cdr(app))) + if (isNull(app) || isNull(cdr(app))) return mkfailure(string("client id not found: ") + (string)cadr(cid)); list appkey = cadr(app); @@ -274,12 +274,12 @@ const failable accessToken(const list& args, request_rec* r, const l return mkfailure(ftr); const value tr = content(ftr); debug(tr, "modoauth2::access_token::response"); - if (!isList(tr) || isNil(tr)) + if (!isList(tr) || isNull(tr)) return mkfailure("Empty access token"); const list tv = isString(car(tr)) ? assoc("access_token", httpd::queryArgs(join("", convertValues(cadr(tr))))) : assoc("access_token", tr); - if (isNil(tv) || isNil(cdr(tv))) + if (isNull(tv) || isNull(cdr(tv))) return mkfailure("Couldn't retrieve access_token"); debug(tv, "modoauth2::access_token::token"); @@ -373,7 +373,7 @@ static int checkAuthn(request_rec *r) { hasContent(openauth::sessionID(r, "TuscanyOpenAuth")) || hasContent(openauth::sessionID(r, "TuscanyOAuth1"))) return DECLINED; - if ((substr(string(r->uri), 0, 8) == "/oauth1/") || !isNil(assoc("openid_identifier", args))) + if ((substr(string(r->uri), 0, 8) == "/oauth1/") || !isNull(assoc("openid_identifier", args))) return DECLINED; r->ap_auth_type = const_cast(atype); @@ -390,9 +390,9 @@ int postConfigMerge(const ServerConf& mainsc, server_rec* const s) { debug(httpd::serverName(s), "modoauth2::postConfigMerge::serverName"); // Merge configuration from main server - if (isNil((list)sc.appkeys)) + if (isNull((list)sc.appkeys)) sc.appkeys = mainsc.appkeys; - if (isNil((list)sc.mcaddrs)) + if (isNull((list)sc.mcaddrs)) sc.mcaddrs = mainsc.mcaddrs; sc.mc = mainsc.mc; sc.cs = mainsc.cs; @@ -424,7 +424,7 @@ void childInit(apr_pool_t* const p, server_rec* const s) { ServerConf& sc = *psc; // Connect to Memcached - if (isNil((list)sc.mcaddrs)) + if (isNull((list)sc.mcaddrs)) sc.mc = *(new (gc_new()) memcache::MemCached("localhost", 11211)); else sc.mc = *(new (gc_new()) memcache::MemCached(sc.mcaddrs)); diff --git a/sca-cpp/trunk/modules/opencl/driver.hpp b/sca-cpp/trunk/modules/opencl/driver.hpp index c45bcf6ee4..f60e9c1dd3 100644 --- a/sca-cpp/trunk/modules/opencl/driver.hpp +++ b/sca-cpp/trunk/modules/opencl/driver.hpp @@ -38,7 +38,7 @@ namespace opencl { const value evalDriverLoop(const OpenCLProgram& clprog, istream& in, ostream& out, const OpenCLContext& cl) { scheme::promptForInput(scheme::evalInputPrompt, out); const value input = content(scheme::readValue(in)); - if (isNil(input)) + if (isNull(input)) return input; const failable output = evalKernel(createKernel(input, clprog), input, 1, value::String, 512, cl); scheme::announceOutput(scheme::evalOutputPrompt, out); diff --git a/sca-cpp/trunk/modules/opencl/eval.hpp b/sca-cpp/trunk/modules/opencl/eval.hpp index f842ba783d..e910d427bc 100644 --- a/sca-cpp/trunk/modules/opencl/eval.hpp +++ b/sca-cpp/trunk/modules/opencl/eval.hpp @@ -412,7 +412,7 @@ const failable readOnlyBuffer(const size_t size, const void* const * Fill an array of write events for a given list of buffers. */ const cl_uint writeBufferEvents(const list& buf, cl_event* const evt) { - if (isNil(buf)) + if (isNull(buf)) return 0; const cl_event e = car(buf).evt; if (e == 0) @@ -486,7 +486,7 @@ const failable valueToKernelArg(const value& v, const cl_uint i, c * Convert a list of values to kernel args. */ const failable> valuesToKernelArgsListHelper(const list& v, const cl_uint i, const OpenCLKernel& kernel, const OpenCLContext& cl, const cl_command_queue cq) { - if (isNil(v)) + if (isNull(v)) return list(); const failable a = valueToKernelArg(car(v), i, kernel, cl, cq); if (!hasContent(a)) diff --git a/sca-cpp/trunk/modules/python/driver.hpp b/sca-cpp/trunk/modules/python/driver.hpp index 41daed32c3..3b02302c65 100644 --- a/sca-cpp/trunk/modules/python/driver.hpp +++ b/sca-cpp/trunk/modules/python/driver.hpp @@ -38,7 +38,7 @@ namespace python { const value evalDriverLoop(PyObject* const script, istream& in, ostream& out, PythonRuntime& py) { scheme::promptForInput(scheme::evalInputPrompt, out); const value input = content(scheme::readValue(in)); - if (isNil(input)) + if (isNull(input)) return input; const failable output = evalScript(input, script, py); scheme::announceOutput(scheme::evalOutputPrompt, out); diff --git a/sca-cpp/trunk/modules/python/eval.hpp b/sca-cpp/trunk/modules/python/eval.hpp index 3f9c6c20a2..3728cdb7bb 100644 --- a/sca-cpp/trunk/modules/python/eval.hpp +++ b/sca-cpp/trunk/modules/python/eval.hpp @@ -483,7 +483,7 @@ PyObject* const mkPyLambda(const lvvlambda& l, PythonRuntime* const py) { * Convert a list of values to a python list. */ PyObject* const valuesToPyListHelper(PyObject* const l, const list& v, PythonRuntime* const py) { - if (isNil(v)) + if (isNull(v)) return l; PyObject* const pyv = valueToPyObject(car(v), py); PyList_Append(l, pyv); diff --git a/sca-cpp/trunk/modules/python/python-test.cpp b/sca-cpp/trunk/modules/python/python-test.cpp index 44a72f8f88..65b18c9b1b 100644 --- a/sca-cpp/trunk/modules/python/python-test.cpp +++ b/sca-cpp/trunk/modules/python/python-test.cpp @@ -197,7 +197,7 @@ const list > submitEvals(worker& w, const int max, const int i, PyO } const bool checkEvalResults(const list > r) { - if (isNil(r)) + if (isNull(r)) return true; assert(car(r) == true); return checkEvalResults(cdr(r)); diff --git a/sca-cpp/trunk/modules/rss/rss.hpp b/sca-cpp/trunk/modules/rss/rss.hpp index 348d50e8f3..e8edc0dcb1 100644 --- a/sca-cpp/trunk/modules/rss/rss.hpp +++ b/sca-cpp/trunk/modules/rss/rss.hpp @@ -46,14 +46,14 @@ const value entry("entry"); */ const list entryElementValues(const list& e) { const list lt = elementChildren("title", e); - const value t = isNil(lt)? value(emptyString) : elementValue(car(lt)); + const value t = isNull(lt)? value(emptyString) : elementValue(car(lt)); const list li = elementChildren("link", e); - const value i = isNil(li)? value(emptyString) : elementValue(car(li)); + const value i = isNull(li)? value(emptyString) : elementValue(car(li)); const list ld = elementChildren("description", e); return append(nilListValue + element + entry + value(nilListValue + element + value("title") + t) + value(nilListValue + element + value("id") + i), - isNil(ld)? nilListValue : isAttribute(elementValue(car(ld)))? nilListValue : + isNull(ld)? nilListValue : isAttribute(elementValue(car(ld)))? nilListValue : mklist(value(nilListValue + element + value("content") + elementValue(car(ld))))); } @@ -61,7 +61,7 @@ const list entryElementValues(const list& e) { * Convert a list of elements to a list of element values representing ATOM entries. */ const list entriesElementValues(const list& e) { - if (isNil(e)) + if (isNull(e)) return e; return cons(entryElementValues(car(e)), entriesElementValues(cdr(e))); } @@ -80,7 +80,7 @@ const bool isRSSFeed(const list& ls) { */ const failable > readRSSEntry(const list& ilist) { const list e = content(xml::readElements(ilist)); - if (isNil(e)) + if (isNull(e)) return mkfailure >("Empty entry"); return mklist(entryElementValues(car(e))); } @@ -90,7 +90,7 @@ const failable > readRSSEntry(const list& ilist) { */ const failable > readRSSFeed(const list& ilist) { const list f = content(xml::readElements(ilist)); - if (isNil(f)) + if (isNull(f)) return mkfailure >("Empty feed"); const list c = elementChildren("channel", car(f)); const list t = elementChildren("title", car(c)); @@ -109,12 +109,12 @@ const list entryElement(const list& l) { const value title = elementValue(elementChild("title", l)); const value id = elementValue(elementChild("id", l)); const value content = elementChild("content", l); - const bool text = isNil(content)? false : elementHasValue(content); + const bool text = isNull(content)? false : elementHasValue(content); return append(nilListValue + element + "item" + (nilListValue + element + "title" + title) + (nilListValue + element + "link" + id), - isNil(content)? + isNull(content)? nilListValue : mklist(append(nilListValue + element + "description", text? mklist(elementValue(content)) : elementChildren(content)))); @@ -124,7 +124,7 @@ const list entryElement(const list& l) { * Convert a list of values representing RSS entries to a list of elements. */ const list entriesElements(const list& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(entryElement(car(l)), entriesElements(cdr(l))); } @@ -134,7 +134,7 @@ const list entriesElements(const list& l) { * The first two values in the list are the entry id and title. */ template const failable writeRSSEntry(const lambda& reduce, const R& initial, const list& ll) { - const list l = isNil(ll)? ll : (list)car(ll); + const list l = isNull(ll)? ll : (list)car(ll); return xml::writeElements(reduce, initial, mklist(entryElement(l))); } @@ -150,11 +150,11 @@ const failable > writeRSSEntry(const list& l) { * The first two values in the list are the feed id and title. */ template const failable writeRSSFeed(const lambda& reduce, const R& initial, const list& ll) { - const list l = isNil(ll)? ll : (list)car(ll); + const list l = isNull(ll)? ll : (list)car(ll); const list lt = elementChildren("title", l); - const value t = isNil(lt)? value(emptyString) : elementValue(car(lt)); + const value t = isNull(lt)? value(emptyString) : elementValue(car(lt)); const list li = elementChildren("id", l); - const value i = isNil(li)? value(emptyString) : elementValue(car(li)); + const value i = isNull(li)? value(emptyString) : elementValue(car(li)); const list c = nilListValue + (nilListValue + element + "title" + t) + (nilListValue + element + "link" + i) @@ -162,7 +162,7 @@ template const failable writeRSSFeed(const lambda le = elementChildren(entry, l); - if (isNil(le)) { + if (isNull(le)) { const list fe = nilListValue + element + "rss" + (nilListValue + attribute + "version" + "2.0") + append(nilListValue + element + "channel", c); @@ -170,7 +170,7 @@ template const failable writeRSSFeed(const lambda(caddr(car(le))))) { + if (!isNull(le) && !isNull(car(le)) && isList(car(caddr(car(le))))) { const list ce = append(c, entriesElements(caddr(car(le)))); const list fe = nilListValue + element + "rss" + (nilListValue + attribute + "version" + "2.0") diff --git a/sca-cpp/trunk/modules/scdl/scdl.hpp b/sca-cpp/trunk/modules/scdl/scdl.hpp index 35a717d478..98afbe604c 100644 --- a/sca-cpp/trunk/modules/scdl/scdl.hpp +++ b/sca-cpp/trunk/modules/scdl/scdl.hpp @@ -40,7 +40,7 @@ namespace scdl { */ const list components(const value& l) { const list cs = elementChildren("composite", l); - if (isNil(cs)) + if (isNull(cs)) return cs; return elementChildren("component", car(cs)); } @@ -50,7 +50,7 @@ const list components(const value& l) { */ const list promotions(const value& l) { const list cs = elementChildren("composite", l); - if (isNil(cs)) + if (isNull(cs)) return cs; return elementChildren("service", car(cs)); } @@ -73,7 +73,7 @@ const value name(const value& l) { * Convert a list of elements to a name -> element assoc list. */ const list nameToElementAssoc(const list& l) { - if (isNil(l)) + if (isNull(l)) return l; const value e(car(l)); return cons(mklist(name(e), e), nameToElementAssoc(cdr(l))); @@ -87,7 +87,7 @@ const value named(const value& n, const value& l) { return name(v) == n; }; const list c = filter(filterName, l); - if (isNil(c)) + if (isNull(c)) return nilValue; return car(c); } @@ -100,7 +100,7 @@ const value implementation(const value& l) { return isElement(v) && contains(string(cadr(v)), "implementation."); }; const list n = filter(filterImplementation, l); - if (isNil(n)) + if (isNull(n)) return nilValue; return car(n); } @@ -148,17 +148,17 @@ const list bindings(const value& l) { * Returns the target of a reference. */ const value bindingsTarget(const list& l) { - if (isNil(l)) + if (isNull(l)) return nilValue; const value u = uri(car(l)); - if (!isNil(u)) + if (!isNull(u)) return u; return bindingsTarget(cdr(l)); } const value target(const value& l) { const value target = attributeValue("target", l); - if (!isNil(target)) + if (!isNull(target)) return target; return bindingsTarget(bindings(l)); } @@ -167,7 +167,7 @@ const value target(const value& l) { * Convert a list of references to a reference name -> target assoc list. */ const list referenceToTargetAssoc(const list& r) { - if (isNil(r)) + if (isNull(r)) return r; const value ref(car(r)); return cons(mklist(scdl::name(ref), scdl::target(ref)), referenceToTargetAssoc(cdr(r))); diff --git a/sca-cpp/trunk/modules/scheme/driver.hpp b/sca-cpp/trunk/modules/scheme/driver.hpp index c94af7bbf7..015348c9e1 100644 --- a/sca-cpp/trunk/modules/scheme/driver.hpp +++ b/sca-cpp/trunk/modules/scheme/driver.hpp @@ -56,7 +56,7 @@ const bool userPrint(const value val, ostream& out) { const value evalDriverLoop(istream& in, ostream& out, Env& env) { promptForInput(evalInputPrompt, out); const value input = content(readValue(in)); - if (isNil(input)) + if (isNull(input)) return input; const value output = evalExpr(input, env); announceOutput(evalOutputPrompt, out); diff --git a/sca-cpp/trunk/modules/scheme/environment.hpp b/sca-cpp/trunk/modules/scheme/environment.hpp index 1a295c74f4..ee82bc0401 100644 --- a/sca-cpp/trunk/modules/scheme/environment.hpp +++ b/sca-cpp/trunk/modules/scheme/environment.hpp @@ -81,16 +81,16 @@ const bool isDotVariable(const value& var) { } const Frame makeBinding(const Frame& frameSoFar, const list& variables, const list values) { - if (isNil(variables)) { - if (!isNil(values)) + if (isNull(variables)) { + if (!isNull(values)) logStream() << "Too many arguments supplied " << values << endl; return frameSoFar; } if (isDotVariable(car(variables))) return makeBinding(frameSoFar, cdr(variables), mklist(values)); - if (isNil(values)) { - if (!isNil(variables)) + if (isNull(values)) { + if (!isNull(variables)) logStream() << "Too few arguments supplied " << variables << endl; return frameSoFar; } @@ -118,7 +118,7 @@ const value definitionVariable(const value& exp) { const value definitionValue(const value& exp) { const list exps(exp); if(isSymbol(car(cdr(exps)))) { - if (isNil(cdr(cdr(exps)))) + if (isNull(cdr(cdr(exps)))) return nilValue; return car(cdr(cdr(exps))); } @@ -158,7 +158,7 @@ const Env setupEnvironment() { const value lookupEnvLoop(const value& var, const Env& env); const value lookupEnvScan(const value& var, const list& vars, const list& vals, const Env& env) { - if(isNil(vars)) + if(isNull(vars)) return lookupEnvLoop(var, enclosingEnvironment(env)); if(var == car(vars)) return car(vals); diff --git a/sca-cpp/trunk/modules/scheme/eval.hpp b/sca-cpp/trunk/modules/scheme/eval.hpp index 5074471931..17150a7b48 100644 --- a/sca-cpp/trunk/modules/scheme/eval.hpp +++ b/sca-cpp/trunk/modules/scheme/eval.hpp @@ -87,7 +87,7 @@ const list operands(const value& exp) { } const list listOfValues(const list exps, Env& env) { - if(isNil(exps)) + if(isNull(exps)) return list (); return cons(evalExpr(car(exps), env), listOfValues(cdr(exps), env)); } @@ -117,7 +117,7 @@ const Env procedureEnvironment(const value& exp) { } const bool isLastExp(const list& seq) { - return isNil(cdr(seq)); + return isNull(cdr(seq)); } const value firstExp(const list& seq) { @@ -151,7 +151,7 @@ const value applyProcedure(const value& procedure, list& arguments) { } const value sequenceToExp(const list exps) { - if(isNil(exps)) + if(isNull(exps)) return exps; if(isLastExp(exps)) return firstExp(exps); @@ -179,7 +179,7 @@ const value ifConsequent(const value& exp) { } const value ifAlternative(const value& exp) { - if(!isNil(cdr(cdr(cdr((list )exp))))) + if(!isNull(cdr(cdr(cdr((list )exp))))) return car(cdr(cdr(cdr((list )exp)))); return false; } @@ -201,12 +201,12 @@ const value makeIf(value predicate, value consequent, value alternative) { } const value expandClauses(const list& clauses) { - if(isNil(clauses)) + if(isNull(clauses)) return false; const value first = car(clauses); const list rest = cdr(clauses); if(isCondElseClause(first)) { - if(isNil(rest)) + if(isNull(rest)) return sequenceToExp(condActions(first)); logStream() << "else clause isn't last " << clauses << endl; return nilValue; @@ -259,7 +259,7 @@ const value evalExpr(const value& exp, Env& env) { } const list quotedParameters(const list& p) { - if (isNil(p)) + if (isNull(p)) return p; return cons(mklist(quoteSymbol, car(p)), quotedParameters(cdr(p))); } @@ -268,7 +268,7 @@ const list quotedParameters(const list& p) { * Evaluate an expression against a script provided as a list of values. */ const value evalScriptLoop(const value& expr, const list& script, scheme::Env& env) { - if (isNil(script)) + if (isNull(script)) return scheme::evalExpr(expr, env); scheme::evalExpr(car(script), env); return evalScriptLoop(expr, cdr(script), env); diff --git a/sca-cpp/trunk/modules/scheme/io.hpp b/sca-cpp/trunk/modules/scheme/io.hpp index 02f6923c86..c7177b54ae 100644 --- a/sca-cpp/trunk/modules/scheme/io.hpp +++ b/sca-cpp/trunk/modules/scheme/io.hpp @@ -231,7 +231,7 @@ inline const failable > writeValue(const value& val) { inline const value readScript(istream& in) { const value val = content(readValue(in)); - if (isNil(val)) + if (isNull(val)) return nilListValue; return cons(val, (list)readScript(in)); } diff --git a/sca-cpp/trunk/modules/scheme/primitive.hpp b/sca-cpp/trunk/modules/scheme/primitive.hpp index 4815e9a497..da0056d6da 100644 --- a/sca-cpp/trunk/modules/scheme/primitive.hpp +++ b/sca-cpp/trunk/modules/scheme/primitive.hpp @@ -118,10 +118,10 @@ inline const value treeSelectAssocProc(const list& args) { inline const value nullProc(const list& args) { const value v(car(args)); - if (isNil(v)) + if (isNull(v)) return true; if (isList(v)) - return isNil(list(v)); + return isNull(list(v)); return false; } @@ -138,13 +138,13 @@ inline const value lesserProc(const list& args) { } inline const value addProc(const list& args) { - if (isNil(cdr(args))) + if (isNull(cdr(args))) return (double)car(args); return (double)car(args) + (double)cadr(args); } inline const value subProc(const list& args) { - if (isNil(cdr(args))) + if (isNull(cdr(args))) return (double)0 - (double)car(args); return (double)car(args) - (double)cadr(args); } @@ -162,7 +162,7 @@ inline const value sqrtProc(const list& args) { } inline const value displayProc(const list& args) { - if (isNil(args)) { + if (isNull(args)) { displayStream() << endl; return true; } @@ -171,7 +171,7 @@ inline const value displayProc(const list& args) { } inline const value logProc(const list& args) { - if (isNil(args)) { + if (isNull(args)) { logStream() << endl; return true; } @@ -225,7 +225,7 @@ inline const bool isPrimitiveProcedure(const value& proc) { } inline const bool isSelfEvaluating(const value& exp) { - if(isNil(exp)) + if(isNull(exp)) return true; if(isNumber(exp)) return true; diff --git a/sca-cpp/trunk/modules/server/client-test.hpp b/sca-cpp/trunk/modules/server/client-test.hpp index 29da9e4798..562fe9c68e 100644 --- a/sca-cpp/trunk/modules/server/client-test.hpp +++ b/sca-cpp/trunk/modules/server/client-test.hpp @@ -190,7 +190,7 @@ const list > startPost(worker& w, const int threads, const blambda& } const bool checkPost(const list >& r) { - if (isNil(r)) + if (isNull(r)) return true; assert(car(r) == true); return checkPost(cdr(r)); @@ -244,7 +244,7 @@ const list startPost(const int procs, const blambda& l) { } const bool checkPost(const list& r) { - if (isNil(r)) + if (isNull(r)) return true; int status; waitpid(car(r), &status, 0); diff --git a/sca-cpp/trunk/modules/server/mod-cpp.hpp b/sca-cpp/trunk/modules/server/mod-cpp.hpp index 1321466383..54742306b0 100644 --- a/sca-cpp/trunk/modules/server/mod-cpp.hpp +++ b/sca-cpp/trunk/modules/server/mod-cpp.hpp @@ -46,7 +46,7 @@ namespace modcpp { * Apply a C++ component implementation function. */ const list failableResult(const value& func, const list& v) { - if (isNil(cdr(v))) + if (isNull(cdr(v))) return v; // Report a failure with an empty reason as 'function not supported' @@ -69,7 +69,7 @@ const failable evalImplementation(const string& path, const value& i // Configure the implementation's lambda function const value ipath(attributeValue("path", impl)); const value iname(attributeValue("library", impl)); - const string fpath(isNil(ipath)? path + (string)iname : path + (string)ipath + "/" + (string)iname); + const string fpath(isNull(ipath)? path + (string)iname : path + (string)ipath + "/" + (string)iname); const lib ilib(*(new (gc_new()) lib(fpath + dynlibExt))); const failable fappl(dynlambda&)>("apply", ilib)); if (!hasContent(fappl)) diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp index 5a8a15bf43..204459e127 100644 --- a/sca-cpp/trunk/modules/server/mod-eval.hpp +++ b/sca-cpp/trunk/modules/server/mod-eval.hpp @@ -161,9 +161,9 @@ static APR_OPTIONAL_FN_TYPE(ap_authn_cache_store) *authnCacheStore = NULL; * failable monad. */ const failable failableResult(const list& v) { - if (isNil(cdr(v))) + if (isNull(cdr(v))) return car(v); - return mkfailure(string(cadr(v)), isNil(cddr(v))? -1 : (int)caddr(v), false); + return mkfailure(string(cadr(v)), isNull(cddr(v))? -1 : (int)caddr(v), false); } /** @@ -207,7 +207,7 @@ public: // Lookup the component implementation const list impl(rbtreeAssoc(cname, (list)impls)); - if (isNil(impl)) + if (isNull(impl)) return mkfailure(string("Couldn't find component implementation: ") + (string)cname); // Call its lambda function @@ -225,7 +225,7 @@ public: debug(params, "modeval::implProxy::input"); // If the reference was 'wiredByImpl' use the first param as target - if (isNil(name)) { + if (isNull(name)) { const value uri = cadr(params); const list aparams = cons(car(params), cddr(params)); debug(uri, "modeval::implProxy::wiredByImpl::uri"); @@ -313,7 +313,7 @@ const value mkrefProxy(const value& ref, const gc_mutable_ref >& imp // Use an HTTP proxy or an internal proxy to the component implementation if (wbyimpl) return mkimplProxy(nilValue, impls, sslc, timeout); - if (isNil(target)) + if (isNull(target)) return mkunwiredProxy(scdl::name(ref)); if (http::isAbsolute(target)) return mkhttpProxy(target, timeout); @@ -321,7 +321,7 @@ const value mkrefProxy(const value& ref, const gc_mutable_ref >& imp } const list refProxies(const list& refs, const gc_mutable_ref >& impls, const SSLConf& sslc, const int timeout) { - if (isNil(refs)) + if (isNull(refs)) return refs; return cons(mkrefProxy(car(refs), impls, sslc, timeout), refProxies(cdr(refs), impls, sslc, timeout)); } @@ -352,7 +352,7 @@ const lvvlambda mkappPropProxy(const value& v) { if (currentRequest == NULL) return v; const RequestConf& reqc = httpd::requestConf(currentRequest, &mod_tuscany_eval); - const value a = isNil((const list)reqc.vpath)? v : car((const list)reqc.vpath); + const value a = isNull((const list)reqc.vpath)? v : car((const list)reqc.vpath); debug(a, "modeval::appPropProxy::value"); return a; }; @@ -463,7 +463,7 @@ const value mkpropProxy(const value& prop) { } const list propProxies(const list& props) { - if (isNil(props)) + if (isNull(props)) return props; return cons(mkpropProxy(car(props)), propProxies(cdr(props))); } @@ -505,7 +505,7 @@ const value evalComponent(const string& contribPath, const value& comp, const gc * Return a list of component-name + configured-implementation pairs. */ const list componentToImplementationAssoc(const list& c, const string& contribPath, const gc_mutable_ref >& impls, const lvvlambda& lifecycle, const SSLConf& sslc, const int timeout) { - if (isNil(c)) + if (isNull(c)) return c; return cons(mklist(scdl::name(car(c)), evalComponent(contribPath, car(c), impls, lifecycle, sslc, timeout)), @@ -531,11 +531,11 @@ const failable > getComponents(const lvvlambda& contributor, const s return mkfailure >(val); debug(content(val), "modeval::getComponents::val"); const list valc = assoc(value("content"), cdr(car(content(val)))); - if (isNil(valc)) + if (isNull(valc)) return mkfailure >(string("Could not get composite: ") + name); const list comp = assoc(value("composite"), cdr(valc)); debug(comp, "modeval::getComponents::comp"); - if (isNil(comp)) + if (isNull(comp)) return mkfailure >(string("Could not get composite: ") + name); const failable > x = xml::writeElements(car(valuesToElements(mklist(mklist(comp))))); if (!hasContent(x)) @@ -548,7 +548,7 @@ const failable > getComponents(const lvvlambda& contributor, const s * Return the functions returned by the component implementations. */ const failable > applyLifecycleExpr(const list& impls, const list& expr) { - if (isNil(impls)) + if (isNull(impls)) return nilListValue; // Evaluate lifecycle expression against a component implementation lambda @@ -559,7 +559,7 @@ const failable > applyLifecycleExpr(const list& impls, const const lvvlambda rl = content(r); // Use the returned lambda function, if any, from now on - const lvvlambda al = isNil(rl)? l : rl; + const lvvlambda al = isNull(rl)? l : rl; // Continue with the rest of the list const failable > nr = applyLifecycleExpr(cdr(impls), expr); @@ -577,7 +577,7 @@ const list componentReferenceToTargetTree(const value& c) { } const list componentReferenceToTargetAssoc(const list& c) { - if (isNil(c)) + if (isNull(c)) return c; return cons(componentReferenceToTargetTree(car(c)), componentReferenceToTargetAssoc(cdr(c))); } @@ -591,26 +591,26 @@ const list defaultBindingURI(const string& cn, const string& sn) { } const list bindingToComponentAssoc(const string& cn, const string& sn, const list& b) { - if (isNil(b)) + if (isNull(b)) return b; const value uri(scdl::uri(car(b))); - if (isNil(uri)) + if (isNull(uri)) return cons(mklist(defaultBindingURI(cn, sn), cn), bindingToComponentAssoc(cn, sn, cdr(b))); return cons(mklist(pathValues(c_str(string(uri))), cn), bindingToComponentAssoc(cn, sn, cdr(b))); } const list serviceToComponentAssoc(const string& cn, const list& s) { - if (isNil(s)) + if (isNull(s)) return s; const string sn(scdl::name(car(s))); const list btoc(bindingToComponentAssoc(cn, sn, scdl::bindings(car(s)))); - if (isNil(btoc)) + if (isNull(btoc)) return cons(mklist(defaultBindingURI(cn, sn), cn), serviceToComponentAssoc(cn, cdr(s))); return append(btoc, serviceToComponentAssoc(cn, cdr(s))); } const list uriToComponentAssoc(const list& c) { - if (isNil(c)) + if (isNull(c)) return c; return append(serviceToComponentAssoc(scdl::name(car(c)), scdl::services(car(c))), uriToComponentAssoc(cdr(c))); } @@ -625,7 +625,7 @@ const failable confComponents(const string& contribPath, const string debug(vhost, "modeval::confComponents::vhost"); debug(impls, "modeval::confComponents::impls"); - const failable > fcomps = isNil(contributor)? + const failable > fcomps = isNull(contributor)? readComponents(scdl::resourcePath(length(vhost) != 0? contribPath + vhost + "/" : contribPath, composName)) : getComponents(contributor, vhost); if (!hasContent(fcomps)) @@ -641,7 +641,7 @@ const failable confComponents(const string& contribPath, const string debug(flatten(svcs), "modeval::confComponents::svcs"); const list cimpls = mkbrbtree(sort(componentToImplementationAssoc(comps, - isNil(contributor)? length(vhost) != 0? contribPath + vhost + "/" : contribPath : contribPath, + isNull(contributor)? length(vhost) != 0? contribPath + vhost + "/" : contribPath : contribPath, impls, lifecycle, sslc, timeout))); debug(flatten(cimpls), "modeval::confComponents::impls"); @@ -701,7 +701,7 @@ const failable get(const list& rpath, request_rec* const r, const lv const list ma = assoc(value("method"), args); // Evaluate a JSON-RPC request and return a JSON result - if (!isNil(ia) && !isNil(ma)) { + if (!isNull(ia) && !isNull(ma)) { // Extract the request id, method and params const value id = cadr(ia); @@ -725,13 +725,13 @@ const failable get(const list& rpath, request_rec* const r, const lv debug(c, "modeval::get::content"); // Return a nil value as a not found status - if (!isList(c) && isNil(c)) + if (!isList(c) && isNull(c)) return HTTP_NOT_FOUND; // Write in the format requested by the client, if any const list fmt = assoc("format", args); - const value mtype = !isNil(fmt)? cadr(fmt) : acceptMediaType(r); - if (!isNil(mtype)) { + const value mtype = !isNull(fmt)? cadr(fmt) : acceptMediaType(r); + if (!isNull(mtype)) { if (mtype == "scheme") return httpd::writeResult(scheme::writeValue(c), "text/x-scheme; charset=utf-8", r); if (mtype == "json") @@ -747,26 +747,26 @@ const failable get(const list& rpath, request_rec* const r, const lv } // Write an empty list as a JSON value - if (isNil((list)c)) { + if (isNull((list)c)) { debug(nilListValue, "modeval::get::empty"); return httpd::writeResult(json::writeValue(c), "application/json; charset=utf-8", r); } // Write content-type / content-list pair - if (isString(car(c)) && !isNil(cdr(c)) && isList(cadr(c))) + if (isString(car(c)) && !isNull(cdr(c)) && isList(cadr(c))) return httpd::writeResult(convertValues(cadr(c)), car(c), r); // Write an assoc value as a JSON value - if (isSymbol(car(c)) && !isNil(cdr(c))) { + if (isSymbol(car(c)) && !isNull(cdr(c))) { debug(c, "modeval::get::assoc"); return httpd::writeResult(json::writeValue(c), "application/json; charset=utf-8", r); } // Write an ATOM feed or entry const list e = valuesToElements(c); - if (isList(car(e)) && !isNil(car(e))) { + if (isList(car(e)) && !isNull(car(e))) { const list el = car(e); - if (isSymbol(car(el)) && car(el) == element && !isNil(cdr(el)) && isSymbol(cadr(el)) && elementHasChildren(el) && !elementHasValue(el)) { + if (isSymbol(car(el)) && car(el) == element && !isNull(cdr(el)) && isSymbol(cadr(el)) && elementHasChildren(el) && !elementHasValue(el)) { if (cadr(el) == atom::feed) return httpd::writeResult(atom::writeATOMFeed(e), "application/atom+xml; charset=utf-8", r); if (cadr(el) == atom::entry) @@ -829,7 +829,7 @@ const failable post(const list& rpath, request_rec* const r, const l // Report HTTP status code const value rval = content(val); - if (isNil(rval) || rval == falseValue) + if (isNull(rval) || rval == falseValue) return HTTP_NOT_FOUND; if (isNumber(rval)) return (int)rval; @@ -870,7 +870,7 @@ const failable put(const list& rpath, request_rec* const r, const lv // Report HTTP status const value rval = content(val); - if (isNil(rval) || rval == falseValue) + if (isNull(rval) || rval == falseValue) return HTTP_NOT_FOUND; if (isNumber(rval)) return (int)rval; @@ -898,7 +898,7 @@ const failable patch(const list& rpath, request_rec* const r, const // Report HTTP status const value rval = content(val); - if (isNil(rval) || rval == falseValue) + if (isNull(rval) || rval == falseValue) return HTTP_NOT_FOUND; if (isNumber(rval)) return (int)rval; @@ -918,7 +918,7 @@ const failable del(const list& rpath, request_rec* const r, const lv // Report HTTP status const value rval = content(val); - if (isNil(rval) || rval == falseValue) + if (isNull(rval) || rval == falseValue) return HTTP_NOT_FOUND; if (isNumber(rval)) return (int)rval; @@ -954,10 +954,10 @@ int translateComponent(request_rec* const r, const list& rpath, const lis debug(flatten(impls), "modeval::translateComponent::impls"); // Find the requested component - if (isNil(cdr(rpath))) + if (isNull(cdr(rpath))) return HTTP_NOT_FOUND; const list impl(rbtreeAssoc(cadr(rpath), impls)); - if (isNil(impl)) + if (isNull(impl)) return HTTP_NOT_FOUND; debug(impl, "modeval::translateComponent::impl"); @@ -973,16 +973,16 @@ int translateReference(request_rec* const r, const list& rpath, const lis debug(flatten(refs), "modeval::translateReference::refs"); // Find the requested component - if (isNil(cdr(rpath))) + if (isNull(cdr(rpath))) return HTTP_NOT_FOUND; const list comp(rbtreeAssoc(cadr(rpath), refs)); - if (isNil(comp)) + if (isNull(comp)) return HTTP_NOT_FOUND; debug(comp, "modeval::translateReference::comp"); // Find the requested reference and target configuration const list ref(rbtreeAssoc(caddr(rpath), cadr(comp))); - if (isNil(ref)) + if (isNull(ref)) return HTTP_NOT_FOUND; debug(ref, "modeval::translateReference::ref"); @@ -1014,9 +1014,9 @@ int translateReference(request_rec* const r, const list& rpath, const lis * Find a leaf matching a request path in a tree of URI paths. */ const int matchPath(const list& k, const list& p) { - if (isNil(p)) + if (isNull(p)) return true; - if (isNil(k)) + if (isNull(k)) return false; if (car(k) != car(p)) return false; @@ -1024,7 +1024,7 @@ const int matchPath(const list& k, const list& p) { } const list assocPath(const value& k, const list& tree) { - if (isNil(tree)) + if (isNull(tree)) return tree; if (matchPath(k, car(car(tree)))) return car(tree); @@ -1041,10 +1041,10 @@ int translateService(request_rec* const r, const list& rpath, const list< debug(flatten(svcs), "modeval::translateService::svcs"); // Find the requested component - if (isNil(rpath)) + if (isNull(rpath)) return HTTP_NOT_FOUND; const list svc(assocPath(rpath, svcs)); - if (isNil(svc)) + if (isNull(svc)) return DECLINED; debug(svc, "modeval::translateService::svc"); @@ -1061,7 +1061,7 @@ int translateService(request_rec* const r, const list& rpath, const list< const int translateRequest(request_rec* const r, const list& rpath, const list& vpath, const list& refs, const list& svcs, const list& impls) { debug(vpath, "modeval::translateRequest::vpath"); debug(rpath, "modeval::translateRequest::rpath"); - const string prefix = isNil(rpath)? emptyStringValue : car(rpath); + const string prefix = isNull(rpath)? emptyStringValue : car(rpath); // Translate a component request if ((prefix == string("components") || prefix == string("c")) && translateComponent(r, rpath, vpath, impls) == OK) @@ -1076,7 +1076,7 @@ const int translateRequest(request_rec* const r, const list& rpath, const return proceedToHandler(r, OK); // Attempt to map a request targeting the main host to an actual file - if (isNil(vpath)) { + if (isNull(vpath)) { const failable fnr = httpd::internalSubRequest(r->uri, r); if (!hasContent(fnr)) return rcode(fnr); @@ -1095,7 +1095,7 @@ const int translateRequest(request_rec* const r, const list& rpath, const // Make sure a document root request ends with a '/' using // an external redirect - if (isNil(rpath) && r->uri[strlen(r->uri) - 1] != '/') { + if (isNull(rpath) && r->uri[strlen(r->uri) - 1] != '/') { const string target = string(r->uri) + string("/") + (r->args != NULL? string("?") + string(r->args) : emptyString); debug(target, "modeval::translateRequest::location"); return proceedToHandler(r, httpd::externalRedirect(target, r)); @@ -1128,7 +1128,7 @@ int translate(request_rec *r) { const list rpath = pathValues(r->uri); // Let default handler handle a resource request - const string prefix = isNil(rpath)? emptyStringValue : car(rpath); + const string prefix = isNull(rpath)? emptyStringValue : car(rpath); if (prefix == string("vhosts") || prefix == string("v")) return DECLINED; @@ -1137,7 +1137,7 @@ int translate(request_rec *r) { // If the request is targeting a virtual host, configure the components // in that virtual host - if (length(sc.vhostc.domain) != 0 && (length(sc.vhostc.contribPath) != 0 || !isNil(sc.vhostc.contributor)) && httpd::isVhostRequest(sc.server, sc.vhostc.domain, r)) { + if (length(sc.vhostc.domain) != 0 && (length(sc.vhostc.contribPath) != 0 || !isNull(sc.vhostc.contributor)) && httpd::isVhostRequest(sc.server, sc.vhostc.domain, r)) { const string vname = http::subDomain(httpd::hostName(r)); const failable fvcompos = confComponents(sc.vhostc.contribPath, sc.vhostc.composName, sc.vhostc.contributor, vname, reqc.impls, (value)sc.lifecycle, sc.sslc, sc.timeout); if (!hasContent(fvcompos)) @@ -1158,7 +1158,7 @@ int translate(request_rec *r) { return rc; // Attempt to map the first segment of the request path to a virtual host - if (length(prefix) != 0 && (length(sc.vhostc.contribPath) != 0 || !isNil(sc.vhostc.contributor))) { + if (length(prefix) != 0 && (length(sc.vhostc.contribPath) != 0 || !isNull(sc.vhostc.contributor))) { const string vname = prefix; const failable fvcompos = confComponents(sc.vhostc.contribPath, sc.vhostc.composName, sc.vhostc.contributor, vname, reqc.impls, (value)sc.lifecycle, sc.sslc, sc.timeout); if (!hasContent(fvcompos)) @@ -1180,7 +1180,7 @@ const int handleRequest(const list& rpath, request_rec* const r, const li // Get the component implementation lambda const list impl(rbtreeAssoc(cadr(rpath), impls)); - if (isNil(impl)) { + if (isNull(impl)) { mkfailure(string("Couldn't find component implementation: ") + (string)cadr(rpath)); return HTTP_NOT_FOUND; } @@ -1233,14 +1233,14 @@ int handler(request_rec* r) { debug(redir, "modeval::handler::internalredirect"); return httpd::internalRedirect(redir, r); } - if (isNil((const list)reqc.rpath)) + if (isNull((const list)reqc.rpath)) return HTTP_NOT_FOUND; // Get the server configuration const ServerConf& sc = httpd::serverConf(r, &mod_tuscany_eval); // Handle a request targeting a component in a virtual host - if (!isNil((const list)reqc.vpath)) { + if (!isNull((const list)reqc.vpath)) { // Start the components in the virtual host const failable > fsimpls = startComponents(reqc.impls); @@ -1280,7 +1280,7 @@ authn_status checkPassword(request_rec* r, const char* u, const char* p) { // Get the server configuration const ServerConf& sc = httpd::serverConf(r, &mod_tuscany_eval); - if (isNil(sc.vhostc.authenticator)) { + if (isNull(sc.vhostc.authenticator)) { mkfailure("SCA authenticator not configured"); return AUTH_GENERAL_ERROR; } @@ -1293,9 +1293,9 @@ authn_status checkPassword(request_rec* r, const char* u, const char* p) { return AUTH_USER_NOT_FOUND; } const value hval = content(val); - const list hcontent = isList(hval) && !isNil(hval) && isList(car(hval)) && !isNil(car(hval))? assoc(value("content"), cdr(car(hval))) : nilListValue; - const list hassoc = isNil(hcontent)? nilListValue : assoc(value("hash"), cdr(hcontent)); - if (isNil(hassoc)) { + const list hcontent = isList(hval) && !isNull(hval) && isList(car(hval)) && !isNull(car(hval))? assoc(value("content"), cdr(car(hval))) : nilListValue; + const list hassoc = isNull(hcontent)? nilListValue : assoc(value("hash"), cdr(hcontent)); + if (isNull(hassoc)) { mkfailure(string("SCA authentication check user failed, hash not found: ") + user, -1, user != "admin"); return AUTH_USER_NOT_FOUND; } @@ -1330,10 +1330,10 @@ apr_status_t serverCleanup(void* v) { stopComponents(sc.compos.impls); // Call the module lifecycle function - if (isNil((value)sc.lifecycle)) + if (isNull((value)sc.lifecycle)) return APR_SUCCESS; const lvvlambda ll = (value)sc.lifecycle; - if (isNil(ll)) + if (isNull(ll)) return APR_SUCCESS; debug((value)sc.lifecycle, "modeval::serverCleanup::stop"); @@ -1449,7 +1449,7 @@ void childInit(apr_pool_t* p, server_rec* s) { // Get the vhost contributor component implementation lambda if (length(sc.vhostc.contributorName) != 0) { const list impl(rbtreeAssoc((string)sc.vhostc.contributorName, (const list)sc.compos.impls)); - if (isNil(impl)) { + if (isNull(impl)) { mkfailure(string("Couldn't find contributor component implementation: ") + sc.vhostc.contributorName); failureExitChild(); } @@ -1459,7 +1459,7 @@ void childInit(apr_pool_t* p, server_rec* s) { // Get the vhost authenticator component implementation lambda if (length(sc.vhostc.authenticatorName) != 0) { const list impl(rbtreeAssoc((string)sc.vhostc.authenticatorName, (const list)sc.compos.impls)); - if (isNil(impl)) { + if (isNull(impl)) { mkfailure(string("Couldn't find authenticator component implementation: ") + sc.vhostc.authenticatorName); failureExitChild(); } diff --git a/sca-cpp/trunk/modules/server/mod-scheme.hpp b/sca-cpp/trunk/modules/server/mod-scheme.hpp index 36d91dc904..6a387a0991 100644 --- a/sca-cpp/trunk/modules/server/mod-scheme.hpp +++ b/sca-cpp/trunk/modules/server/mod-scheme.hpp @@ -43,7 +43,7 @@ namespace modscheme { * Convert proxy lambdas to evaluator primitive procedures. */ const list primitiveProcedures(const list& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(mklist(scheme::primitiveSymbol, car(l)), primitiveProcedures(cdr(l))); } @@ -58,7 +58,7 @@ const failable evalImplementation(const string& path, const value& i if (fail(is)) return mkfailure(string("Could not read implementation: ") + fpath); const value script = scheme::readScript(is); - if (isNil(script)) + if (isNull(script)) return mkfailure(string("Could not read implementation: ") + fpath); const list pxproc = scheme::quotedParameters(primitiveProcedures(px)); @@ -68,7 +68,7 @@ const failable evalImplementation(const string& path, const value& i debug(expr, "modeval::scheme::applyImplementation::input"); scheme::Env env = scheme::setupEnvironment(); const value res = scheme::evalScript(expr, script, env); - const value val = isNil(res)? mklist(nilValue, string("Could not evaluate expression")) : mklist(res); + const value val = isNull(res)? mklist(nilValue, string("Could not evaluate expression")) : mklist(res); debug(val, "modeval::scheme::applyImplementation::result"); return val; }; diff --git a/sca-cpp/trunk/modules/wsgi/atomutil.py b/sca-cpp/trunk/modules/wsgi/atomutil.py index 4b67ef216e..d65b26c41c 100644 --- a/sca-cpp/trunk/modules/wsgi/atomutil.py +++ b/sca-cpp/trunk/modules/wsgi/atomutil.py @@ -24,23 +24,23 @@ from xmlutil import * # Convert a list of elements to a list of values representing an ATOM entry def entryElementValues(e): lt = filter(selector((element, "'title")), e) - t = "" if isNil(lt) else elementValue(car(lt)) + t = "" if isNull(lt) else elementValue(car(lt)) li = filter(selector((element, "'id")), e) - i = "" if isNil(li) else elementValue(car(li)) + i = "" if isNull(li) else elementValue(car(li)) lc = filter(selector((element, "'content")), e) return append((element, "'entry", (element, "'title", t), (element, "'id", i)), - () if isNil(lc) else () if isAttribute(elementValue(car(lc))) else ((element, "'content", elementValue(car(lc))),)) + () if isNull(lc) else () if isAttribute(elementValue(car(lc))) else ((element, "'content", elementValue(car(lc))),)) # Convert a list of elements to a list of values representing ATOM entries def entriesElementValues(e): - if isNil(e): + if isNull(e): return e return cons(entryElementValues(car(e)), entriesElementValues(cdr(e))) # Convert a list of strings to a list of values representing an ATOM entry def readATOMEntry(l): e = readXML(l) - if isNil(e): + if isNull(e): return () return (entryElementValues(car(e)),) @@ -59,7 +59,7 @@ def isATOMEntry(l): # Convert a list of strings to a list of values representing an ATOM feed def readATOMFeed(l): f = readXML(l) - if isNil(f): + if isNull(f): return () t = filter(selector((element, "'title")), car(f)) i = filter(selector((element, "'id")), car(f)) @@ -73,44 +73,44 @@ def entryElement(l): title = elementValue(namedElementChild("'title", l)) id = elementValue(namedElementChild("'id", l)) content = namedElementChild("'content", l) - text = False if isNil(content) else elementHasValue(content) + text = False if isNull(content) else elementHasValue(content) return append(append( (element, "'entry", (attribute, "'xmlns", "http://www.w3.org/2005/Atom"), (element, "'title", (attribute, "'type", "text"), title), (element, "'id", id)), - () if isNil(content) else (append( + () if isNull(content) else (append( (element, "'content", (attribute, "'type", "text" if text else "application/xml")), (elementValue(content),) if text else elementChildren(content)),)), ((element, "'link", (attribute, "'href", id)),)) # Convert a list of values representing ATOM entries to a list of elements def entriesElements(l): - if isNil(l): + if isNull(l): return l return cons(entryElement(car(l)), entriesElements(cdr(l))) # Convert a list of values representing an ATOM entry to an ATOM entry def writeATOMEntry(ll): - l = ll if isNil(ll) else car(ll) + l = ll if isNull(ll) else car(ll) return writeXML((entryElement(l),), True) # Convert a list of values representing an ATOM feed to an ATOM feed def writeATOMFeed(ll): - l = ll if isNil(ll) else car(ll) + l = ll if isNull(ll) else car(ll) lt = filter(selector((element, "'title")), l) - t = '' if isNil(lt) else elementValue(car(lt)) + t = '' if isNull(lt) else elementValue(car(lt)) li = filter(selector((element, "'id")), l) - i = '' if isNil(li) else elementValue(car(li)) + i = '' if isNull(li) else elementValue(car(li)) f = (element, "'feed", (attribute, "'xmlns", "http://www.w3.org/2005/Atom"), (element, "'title", (attribute, "'type", "text"), t), (element, "'id", i)) # Write ATOM entries le = filter(selector((element, "'entry")), l) - if isNil(le): + if isNull(le): return writeXML((f,), True) # Write a single ATOM entry element with a list of values - if not isNil(le) and not isNil(car(le)) and isList(car(caddr(car(le)))): + if not isNull(le) and not isNull(car(le)) and isList(car(caddr(car(le)))): fe = append(f, entriesElements(caddr(car(le)))) return writeXML((fe,), True) diff --git a/sca-cpp/trunk/modules/wsgi/composite.py b/sca-cpp/trunk/modules/wsgi/composite.py index 77f2ecdb59..fbec66dc33 100755 --- a/sca-cpp/trunk/modules/wsgi/composite.py +++ b/sca-cpp/trunk/modules/wsgi/composite.py @@ -59,7 +59,7 @@ def requestIfNoneMatch(e): # Hash a list of strings into an MD5 signature def md5update(md, s): - if isNil(s): + if isNull(s): return md.hexdigest() md.update(car(s)) return md5update(md, cdr(s)) @@ -113,7 +113,7 @@ def fileresult(e, r, ct, f): # Converts the args received in a POST to a list of key value pairs def postArgs(a): - if isNil(a): + if isNull(a): return ((),) l = car(a); return cons(l, postArgs(cdr(a))) @@ -188,16 +188,16 @@ def application(e, r): return result(e, r, 200, (("Content-type", "application/json"),), writeJSON(())) # Write content-type / content-list pair - if isString(car(v)) and not isNil(cdr(v)) and isList(cadr(v)): + if isString(car(v)) and not isNull(cdr(v)) and isList(cadr(v)): return result(e, r, 200, (("Content-type", car(v)),), cadr(v)) # Convert list of values to element values ve = valuesToElements(v) # Write an assoc result as a JSON value - if isList(car(ve)) and not isNil(car(ve)): + if isList(car(ve)) and not isNull(car(ve)): el = car(ve) - if isSymbol(car(el)) and car(el) == element and not isNil(cdr(el)) and isSymbol(cadr(el)): + if isSymbol(car(el)) and car(el) == element and not isNull(cdr(el)) and isSymbol(cadr(el)): if cadr(el) == "'feed": return result(e, r, 200, (("Content-type", "application/atom+xml"),), writeATOMFeed(ve)) if cadr(el) == "'entry": @@ -224,7 +224,7 @@ def application(e, r): if contains(ct, "application/atom+xml"): ae = elementsToValues(readATOMEntry(requestBody(e))) v = comp("post", id, ae) - if isNil(v): + if isNull(v): return failure(e, r, 500) return result(e, r, 201, (("Location", request_uri(e) + "/" + "/".join(v)),)) return failure(e, r, 500) diff --git a/sca-cpp/trunk/modules/wsgi/elemutil.py b/sca-cpp/trunk/modules/wsgi/elemutil.py index 00b76c5c6e..bb176e7ffe 100644 --- a/sca-cpp/trunk/modules/wsgi/elemutil.py +++ b/sca-cpp/trunk/modules/wsgi/elemutil.py @@ -25,13 +25,13 @@ atsign = "'@" # Return true if a value is an element def isElement(v): - if not isList(v) or isNil(v) or v == None or car(v) != element: + if not isList(v) or isNull(v) or v == None or car(v) != element: return False return True # Return true if a value is an attribute def isAttribute(v): - if not isList(v) or isNil(v) or v == None or car(v) != attribute: + if not isList(v) or isNull(v) or v == None or car(v) != attribute: return False return True @@ -49,7 +49,7 @@ def elementName(l): # Return true if an element has children def elementHasChildren(l): - return not isNil(cddr(l)) + return not isNull(cddr(l)) # Return the children of an element def elementChildren(l): @@ -60,7 +60,7 @@ def elementHasValue(l): r = reverse(l) if isSymbol(car(r)): return False - if isList(car(r)) and not isNil(car(r)) and isSymbol(car(car(r))): + if isList(car(r)) and not isNull(car(r)) and isSymbol(car(car(r))): return False return True @@ -72,7 +72,7 @@ def elementValue(l): def elementToValueIsList(v): if not isList(v): return False - return isNil(v) or not isSymbol(car(v)) + return isNull(v) or not isSymbol(car(v)) def elementToValue(t): if isTaggedList(t, attribute): @@ -91,14 +91,14 @@ def elementToValue(t): def elementToValueIsSymbol(v): if not isList(v): return False - if (isNil(v)): + if (isNull(v)): return False if not isSymbol(car(v)): return False return True def elementToValueGroupValues(v, l): - if isNil(l) or not elementToValueIsSymbol(v) or not elementToValueIsSymbol(car(l)): + if isNull(l) or not elementToValueIsSymbol(v) or not elementToValueIsSymbol(car(l)): return cons(v, l) if car(car(l)) != car(v): return cons(v, l) @@ -109,20 +109,20 @@ def elementToValueGroupValues(v, l): return elementToValueGroupValues(g, cdr(l)) def elementsToValues(e): - if isNil(e): + if isNull(e): return e return elementToValueGroupValues(elementToValue(car(e)), elementsToValues(cdr(e))) # Convert a value to an element def valueToElement(t): - if isList(t) and not isNil(t) and isSymbol(car(t)): + if isList(t) and not isNull(t) and isSymbol(car(t)): n = car(t) - v = () if isNil(cdr(t)) else cadr(t) + v = () if isNull(cdr(t)) else cadr(t) if not isList(v): if n[0:2] == atsign: return (attribute, "'" + n[2:], v) return (element, n, v) - if isNil(v) or not isSymbol(car(v)): + if isNull(v) or not isSymbol(car(v)): return cons(element, cons(n, (valuesToElements(v),))) return cons(element, cons(n, valuesToElements(cdr(t)))) if not isList(t): @@ -131,15 +131,15 @@ def valueToElement(t): # Convert a list of values to a list of elements def valuesToElements(l): - if isNil(l): + if isNull(l): return l return cons(valueToElement(car(l)), valuesToElements(cdr(l))) # Return a selector lambda function which can be used to filter elements def evalSelect(s, v): - if isNil(s): + if isNull(s): return True - if isNil(v): + if isNull(v): return False if car(s) != car(v): return False @@ -151,7 +151,7 @@ def selector(s): # Return the value of the attribute with the given name def namedAttributeValue(name, l): f = filter(lambda v: isAttribute(v) and attributeName(v) == name, l) - if isNil(f): + if isNull(f): return None return caddr(car(f)) @@ -162,7 +162,7 @@ def namedElementChildren(name, l): # Return the child element with the given name def namedElementChild(name, l): f = namedElementChildren(name, l) - if isNil(f): + if isNull(f): return None return car(f) diff --git a/sca-cpp/trunk/modules/wsgi/jsonutil.py b/sca-cpp/trunk/modules/wsgi/jsonutil.py index 849b44405b..f284fd1a89 100644 --- a/sca-cpp/trunk/modules/wsgi/jsonutil.py +++ b/sca-cpp/trunk/modules/wsgi/jsonutil.py @@ -28,19 +28,19 @@ from elemutil import * # Return true if a list represents a JS array def isJSArray(l): - if isNil(l): + if isNull(l): return True v = car(l) if isSymbol(v): return False if isList(v): - if not isNil(v) and isSymbol(car(v)): + if not isNull(v) and isSymbol(car(v)): return False return True # Converts JSON properties to values def jsPropertiesToValues(propertiesSoFar, o, i): - if isNil(i): + if isNull(i): return propertiesSoFar p = car(i) jsv = o[p] @@ -69,7 +69,7 @@ def jsValToValue(jsv): # Return true if a list of strings contains a JSON document def isJSON(l): - if isNil(l): + if isNull(l): return False s = car(l)[0:1] return s == "[" or s == "{" @@ -83,7 +83,7 @@ def readJSON(l): # Convert a list of values to JSON array elements def valuesToJSElements(a, l, i): - if isNil(l): + if isNull(l): return a pv = valueToJSVal(car(l)) a[i] = pv @@ -99,7 +99,7 @@ def valueToJSVal(v): # Convert a list of values to JSON properties def valuesToJSProperties(o, l): - if isNil(l): + if isNull(l): return o token = car(l) if isTaggedList(token, attribute): diff --git a/sca-cpp/trunk/modules/wsgi/rssutil.py b/sca-cpp/trunk/modules/wsgi/rssutil.py index 984d71b690..c1b326c82d 100644 --- a/sca-cpp/trunk/modules/wsgi/rssutil.py +++ b/sca-cpp/trunk/modules/wsgi/rssutil.py @@ -24,22 +24,22 @@ from xmlutil import * # Convert a list of elements to a list of values representing an RSS entry def entryElementsToValues(e): lt = filter(selector((element, "'title")), e) - t = "" if isNil(lt) else elementValue(car(lt)) + t = "" if isNull(lt) else elementValue(car(lt)) li = filter(selector((element, "'link")), e) - i = "" if isNil(li) else elementValue(car(li)) + i = "" if isNull(li) else elementValue(car(li)) lc = filter(selector((element, "'description")), e) return (t, i, elementValue(car(lc))) # Convert a list of elements to a list of values representing RSS entries def entriesElementsToValues(e): - if isNil(e): + if isNull(e): return e return cons(entryElementsToValues(car(e)), entriesElementsToValues(cdr(e))) # Convert a list of strings to a list of values representing an RSS entry def readRSSEntry(l): e = readXML(l) - if isNil(e): + if isNull(e): return () return entryElementsToValues(car(e)) @@ -57,19 +57,19 @@ def isRSSFeed(l): # Convert a list of strings to a list of values representing an RSS feed def readRSSFeed(l): f = readXML(l) - if isNil(f): + if isNull(f): return () c = filter(selector((element, "'channel")), car(f)) t = filter(selector((element, "'title")), car(c)) i = filter(selector((element, "'link")), car(c)) e = filter(selector((element, "'item")), car(c)) - if isNil(e): + if isNull(e): return (elementValue(car(t)), elementValue(car(i))) return cons(elementValue(car(t)), cons(elementValue(car(i)), entriesElementsToValues(e))) # Convert an RSS feed containing elements to an RSS feed containing values def feedValuesLoop(e): - if (isNil(e)): + if (isNull(e)): return e return cons(entryValue(car(e)), feedValuesLoop(cdr(e))) @@ -85,7 +85,7 @@ def entryElement(l): # Convert a list of values representing RSS entries to a list of elements def entriesElements(l): - if isNil(l): + if isNull(l): return l return cons(entryElement(car(l)), entriesElements(cdr(l))) @@ -98,7 +98,7 @@ def writeRSSFeed(l): c = ((element, "'title", car(l)), (element, "'link", cadr(l)), (element, "'description", car(l))) - ce = c if isNil(cddr(l)) else append(c, entriesElements(cddr(l))) + ce = c if isNull(cddr(l)) else append(c, entriesElements(cddr(l))) fe = (element, "'rss", (attribute, "'version", "2.0"), append((element, "'channel"), ce)) return writeXML((fe,), True) @@ -108,7 +108,7 @@ def entryValuesToElements(v): # Convert an RSS feed containing values to an RSS feed containing elements def feedValuesToElementsLoop(v): - if isNil(v): + if isNull(v): return v return cons(entryValuesToElements(car(v)), feedValuesToElementsLoop(cdr(v))) diff --git a/sca-cpp/trunk/modules/wsgi/util.py b/sca-cpp/trunk/modules/wsgi/util.py index f630455901..97931c0c09 100644 --- a/sca-cpp/trunk/modules/wsgi/util.py +++ b/sca-cpp/trunk/modules/wsgi/util.py @@ -57,9 +57,9 @@ def reverse(l): r.reverse() return tuple(r) -def isNil(l): +def isNull(l): if isinstance(l, streampair): - return l.isNil() + return l.isNull() return l is None or l == () def isSymbol(v): @@ -76,7 +76,7 @@ def isList(v): return True def isTaggedList(v, t): - return isList(v) and not isNil(v) and car(v) == t + return isList(v) and not isNull(v) and car(v) == t # Scheme-like streams @@ -88,7 +88,7 @@ class streampair(object): def __repr__(self): return repr(self[0:len(self)]) - def isNil(self): + def isNull(self): return self.cdr == () def __len__(self): @@ -102,7 +102,7 @@ class streampair(object): return self.cdr()[i - 1] def __getslice__(self, i, j): - if isNil(self): + if isNull(self): return () if i > 0: if j == maxint: @@ -156,7 +156,7 @@ def curry(f, *args): # Convert a path represented as a list of values to a string def path(p): - if isNil(p): + if isNull(p): return "" return "/" + car(p) + path(cdr(p)) diff --git a/sca-cpp/trunk/modules/wsgi/xmlutil.py b/sca-cpp/trunk/modules/wsgi/xmlutil.py index 83b1cf2f92..bc1a1b376a 100644 --- a/sca-cpp/trunk/modules/wsgi/xmlutil.py +++ b/sca-cpp/trunk/modules/wsgi/xmlutil.py @@ -46,7 +46,7 @@ def readElements(l): # Return true if a list of strings represents an XML document def isXML(l): - if isNil(l): + if isNull(l): return False if car(l)[0:5] != " readList(const list& listSoFar, XMLReader& reader) { const value token = readToken(reader); - if(isNil(token) || endElement == token) + if(isNull(token) || endElement == token) return reverse(listSoFar); if(startElement == token) return readList(cons(readList(mklist(element), reader), listSoFar), reader); @@ -225,7 +225,7 @@ public: */ inline int readCallback(void *context, char* buffer, int len) { XMLReadContext& rc = *(XMLReadContext*)context; - if (isNil((const list)rc.ilist)) + if (isNull((const list)rc.ilist)) return 0; const list f(fragment(rc.ilist, len)); const string s(car(f)); @@ -238,7 +238,7 @@ inline int readCallback(void *context, char* buffer, int len) { * Return true if a list of strings contains an XML document. */ inline const bool isXML(const list& ls) { - if (isNil(ls)) + if (isNull(ls)) return false; return substr(car(ls), 0, 5) == " expandElementValues(const value& n, const list& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(value(cons(element, cons(n, isList(car(l))? (list)car(l) : mklist(car(l))))), expandElementValues(n, cdr(l))); } inline const failable writeList(const list& l, const xmlTextWriterPtr xml) { - if (isNil(l)) + if (isNull(l)) return true; // Write an attribute diff --git a/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp b/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp index e65aa0d392..46b032af94 100644 --- a/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp +++ b/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp @@ -45,7 +45,7 @@ const list getcart(const value& id, const lvvlambda& cache) { cerr << "cart fvalue: " << fcart << "\n"; cerr << "cart content: " << content(fcart) << "\n"; cerr << "cart reason: " << reason(fcart) << "\n"; - if (isNil(cart)) + if (isNull(cart)) return value(nilListValue); return (list)cart; } @@ -65,7 +65,7 @@ const failable post(unused const list& collection, const value& it * Find an item in the cart. */ const value find(const value& id, const list& cart) { - if (isNil(cart)) + if (isNull(cart)) return mklist(mklist("entry", mklist("title", string("Item")), mklist("id", "0"))); if (id == cadr(caddr(car(cart)))) return mklist(car(cart)); @@ -76,7 +76,7 @@ const value find(const value& id, const list& cart) { * Return items from the cart. */ const failable get(const list& id, const lvvlambda& cache) { - if (isNil(id)) + if (isNull(id)) return value(mklist(append(mklist("feed", mklist("title", string("Your Cart")), mklist("id", cartId)), getcart(cartId, cache)))); return find(car(id), getcart(cartId, cache)); } @@ -85,7 +85,7 @@ const failable get(const list& id, const lvvlambda& cache) { * Delete items from the cart. */ const failable del(const list& id, unused const lvvlambda& cache) { - if (isNil(id)) + if (isNull(id)) return cache(mklist("delete", mklist(cartId))); return trueValue; } @@ -101,7 +101,7 @@ const double price(const list& item) { * Sum the prices of a list of items. */ const double sum(const list& items) { - if (isNil(items)) + if (isNull(items)) return 0; return price(car(items)) + sum(cdr(items)); } diff --git a/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java b/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java index bd7678cce7..b5329606d1 100644 --- a/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java +++ b/sca-cpp/trunk/samples/store-java/store/ShoppingCartImpl.java @@ -58,7 +58,7 @@ public class ShoppingCartImpl { * Find an item in the cart. */ Iterable find(final String id, final Iterable cart) { - if(isNil(cart)) + if(isNull(cart)) return list(list("'entry", list("'title", "Item"), list("'id", "0"))); if(id.equals(cadr(caddr(car(cart))))) return list(car(cart)); @@ -69,7 +69,7 @@ public class ShoppingCartImpl { * Return items from the cart. */ public Iterable get(final Iterable id, final Service cache) { - if(isNil(id)) + if(isNull(id)) return list(append(list("'feed", list("'title", "Your Cart"), list("'id", cartId)), this.getcart(cartId, cache))); return this.find((String)car(id), this.getcart(cartId, cache)); } @@ -78,7 +78,7 @@ public class ShoppingCartImpl { * Delete items from the cart. */ public Boolean delete(final Iterable id, final Service cache) { - if(isNil(id)) { + if(isNull(id)) { final Iterable iid = list(cartId); return cache.delete(iid); } @@ -97,7 +97,7 @@ public class ShoppingCartImpl { * Sum the prices of a list of items. */ Double sum(final Iterable items) { - if(isNil(items)) + if(isNull(items)) return 0.0; return this.price((Iterable)car(items)) + this.sum(cdr(items)); } -- cgit v1.2.3