diff options
Diffstat (limited to '')
104 files changed, 905 insertions, 905 deletions
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<value> get(const value& key, const lvvlambda& rcache1, const lvvl // Lookup level1 cache const value val1 = rcache1(mklist<value>("get", key)); - if (!isNil(val1)) + if (!isNull(val1)) return val1; // Lookup level2 cache const value val2 = rcache2(mklist<value>("get", key)); - if (isNil(val2)) { + if (isNull(val2)) { ostringstream os; os << "Couldn't get cache entry: " << key; return mkfailure<value>(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<value> put(const list<value>& params, const memcache::MemCached& const failable<value> patch(const list<value>& params, const memcache::MemCached& ch) { // Read patch value p = assoc<value>("patch", assoc<value>("content", car<value>(cadr(params)))); - if (isNil(p)) + if (isNull(p)) return mkfailure<value>("Couldn't read patch script"); const string script = cadr<value>(p); debug(script, "memcache::patch::script"); @@ -82,7 +82,7 @@ const failable<value> patch(const list<value>& params, const memcache::MemCached // Apply patch scheme::Env env = scheme::setupEnvironment(); const value pval = scheme::evalScript(cons<value>("patch", scheme::quotedParameters(mklist<value>(car(params), hasContent(ival)? content(ival) : (value)list<value>()))), is, env); - if (isNil(pval)) { + if (isNull(pval)) { ostringstream os; os << "Couldn't patch memcached entry: " << car(params); return mkfailure<value>(str(os), 404, false); @@ -109,7 +109,7 @@ const failable<value> del(const list<value>& params, const memcache::MemCached& * Convert a list of properties to a list of server addresses. */ const list<string> servers(const list<value>& params) { - if (isNil(params)) + if (isNull(params)) return list<string>(); const value s = ((lvvlambda)car(params))(nilListValue); return cons<string>(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<bool> addServers(apr_memcache_t* const m, const list<string>& servers) { - if (isNil(servers)) + if (isNull(servers)) return true; const list<string> toks = tokenize(":", car(servers)); - const failable<bool> r = addServer(m, car(toks), isNil(cdr(toks))? 11211 : atoi(c_str(cadr(toks)))); + const failable<bool> 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<value> memoize(const list<value>& params, const lvvlambda& relay, // Lookup memoized value from cache const value val = cache(mklist<value>("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<list<value> > 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<value>("get", key, partitions)); - if (isNil(p)) { + if (isNull(p)) { ostringstream os; os << "Couldn't get partition: " << key; return mkfailure<list<value> >(str(os), -1, false); @@ -57,12 +57,12 @@ const failable<list<value> > partition(const value& key, const lvvlambda& select * Get lists of items from a list of partitions. */ const failable<list<value> > getlist(const value& key, const list<value>& partitions) { - if (isNil(partitions)) + if (isNull(partitions)) return nilListValue; const lvvlambda l = car(partitions); const value val = l(mklist<value>("get", key)); - if (isNil(val)) + if (isNull(val)) return getlist(key, cdr(partitions)); if (!isList(val)) { ostringstream os; @@ -92,7 +92,7 @@ const failable<value> get(const value& key, const lvvlambda& selector, const lis if (length(p) == 1) { const lvvlambda l = car(p); const value val = l(mklist<value>("get", key)); - if (isNil(val)) { + if (isNull(val)) { ostringstream os; os << "Couldn't get entry from partition: " << key; return mkfailure<value>(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<value> post(const list<value>& params, XMPPClient& xc) { */ const failable<value> start(const list<value>& 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<value> props = hasRelay? cdr(params) : params; const value jid = ((lvvlambda)car(props))(nilListValue); @@ -71,7 +71,7 @@ const failable<value> start(const list<value>& params) { worker w(3); const lambda<const failable<bool>(const value&, const value&, XMPPClient&)> rl = [rel](const value& jid, const value& val, unused XMPPClient& xc) -> const failable<bool> { // 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 failable<bool>(const value&, const value&, XMPPClient&)>)xc.listener)) + if (isNull((lambda<const failable<bool>(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<bool> listen(const lambda<const failable<bool>(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 failable<bool>(const value&, const value&, XMPPClient&)>)xc.listener) && xc.ctx->loop_status == XMPP_LOOP_RUNNING) + while(xc.connected && !isNull((lambda<const failable<bool>(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<value> put(const list<value>& params, const tinycdb::TinyCDB& cdb const failable<value> patch(const list<value>& params, const tinycdb::TinyCDB& cdb) { // Read patch value p = assoc<value>("patch", assoc<value>("content", car<value>(cadr(params)))); - if (isNil(p)) + if (isNull(p)) return mkfailure<value>("Couldn't read patch script"); const string script = cadr<value>(p); debug(script, "tinycdb::patch::script"); @@ -82,7 +82,7 @@ const failable<value> patch(const list<value>& params, const tinycdb::TinyCDB& c // Apply patch scheme::Env env = scheme::setupEnvironment(); const value pval = scheme::evalScript(cons<value>("patch", scheme::quotedParameters(mklist<value>(car(params), hasContent(ival)? content(ival) : (value)list<value>()))), is, env); - if (isNil(pval)) { + if (isNull(pval)) { ostringstream os; os << "Couldn't patch tinycdb entry: " << car(params); return mkfailure<value>(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<value> put(const list<value>& params, const filedb::FileDB& db) { const failable<value> patch(const list<value>& params, const filedb::FileDB& db) { // Read patch value p = assoc<value>("patch", assoc<value>("content", car<value>(cadr(params)))); - if (isNil(p)) + if (isNull(p)) return mkfailure<value>("Couldn't read patch script"); const string script = cadr<value>(p); debug(script, "filedb::patch::script"); @@ -82,7 +82,7 @@ const failable<value> patch(const list<value>& params, const filedb::FileDB& db) // Apply patch scheme::Env env = scheme::setupEnvironment(); const value pval = scheme::evalScript(cons<value>("patch", scheme::quotedParameters(mklist<value>(car(params), hasContent(ival)? content(ival) : (value)list<value>()))), is, env); - if (isNil(pval)) { + if (isNull(pval)) { ostringstream os; os << "Couldn't patch file database entry: " << car(params); return mkfailure<value>(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<value>& 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<bool> mkdirs(const list<value>& 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<bool> patch(const value& key, const value& val, const PGSql& pgsq * Convert a key to an item id. */ const list<value> keyid(const list<value>& key) { - if (isNil(key)) + if (isNull(key)) return nilListValue; if (isList(car(key))) return keyid(cdr(key)); @@ -331,7 +331,7 @@ const list<value> keyid(const list<value>& key) { * Convert a key to a (param name, value) assoc. */ const list<value> keyparams(const list<value>& key) { - if (isNil(key)) + if (isNull(key)) return nilListValue; if (!isList(car(key))) return keyparams(cdr(key)); @@ -386,11 +386,11 @@ const failable<value> get(const value& key, const PGSql& pgsql) { const list<value> rank = assoc<value>("rank", kparams); const list<value> id = lk? keyid(key) : nilListValue; const list<value> atable = assoc<value>("table", kparams); - const string table = isNil(atable)? pgsql.table : (string)cadr(atable); + const string table = isNull(atable)? pgsql.table : (string)cadr(atable); const list<value> akname = assoc<value>("kcolumn", kparams); - const string kname = isNil(akname)? pgsql.kname : (string)cadr(akname); + const string kname = isNull(akname)? pgsql.kname : (string)cadr(akname); const list<value> avname = assoc<value>("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<value> 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<value> put(const list<value>& params, const pgsql::PGSql& pg) { const failable<value> patch(const list<value>& params, const pgsql::PGSql& pg) { // Read patch value p = assoc<value>("patch", assoc<value>("content", car<value>(cadr(params)))); - if (isNil(p)) + if (isNull(p)) return mkfailure<value>("Couldn't read patch script"); const string script = cadr<value>(p); debug(script, "pgsql::patch::script"); @@ -92,7 +92,7 @@ const failable<value> patch(const list<value>& params, const pgsql::PGSql& pg) { istringstream is(script); scheme::Env env = scheme::setupEnvironment(); const value pval = scheme::evalScript(cons<value>("patch", scheme::quotedParameters(mklist<value>(key, hasContent(ival)? content(ival) : (value)list<value>()))), is, env); - if (isNil(pval)) { + if (isNull(pval)) { ostringstream os; os << "Couldn't patch postgresql entry: " << key; return mkfailure<value>(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<future<bool> > startPost(const worker& w, const int threads, const bl } const bool checkPost(const list<future<bool> >& r) { - if (isNil(r)) + if (isNull(r)) return true; assert(car(r) == true); return checkPost(cdr(r)); @@ -279,7 +279,7 @@ const list<pid_t> startPost(const int procs, const blambda& l) { } const bool checkPost(const list<pid_t>& 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 = '<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" ' + @@ -970,7 +970,7 @@ function getappcomposite(appname) { appcomposite = compos; // Merge in the app data - if (!isNil(apppage)) + if (!isNull(apppage)) getappdata(appname, apppage, appcomposite); }); } diff --git a/sca-cpp/trunk/hosting/server/htdocs/clone/index.html b/sca-cpp/trunk/hosting/server/htdocs/clone/index.html index c6a9658ce0..e9de1be1fb 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/clone/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/clone/index.html @@ -72,7 +72,7 @@ var savedappxml = ''; * Get and display the requested app. */ (function getapp() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -149,7 +149,7 @@ $('cloneAppForm').onsubmit = function() { // Check reserved app names var reserved = mklist('account', 'app', 'cache', 'clone', 'create', 'delete', 'graph', 'home', 'login', 'new', 'page', 'proxy', 'public', 'private', 'info', 'store'); - if (!isNil(assoc(name, map(function(r) { return mklist(r, r); }, reserved)))) { + if (!isNull(assoc(name, map(function(r) { return mklist(r, r); }, reserved)))) { errorstatus('App name is taken, please pick another name'); return false; } diff --git a/sca-cpp/trunk/hosting/server/htdocs/config.js b/sca-cpp/trunk/hosting/server/htdocs/config.js index 355174e6f7..20212980f0 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/config.js +++ b/sca-cpp/trunk/hosting/server/htdocs/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/create/index.html b/sca-cpp/trunk/hosting/server/htdocs/create/index.html index a11c0958f5..3fc26b8515 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/create/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/create/index.html @@ -114,7 +114,7 @@ $('createAppForm').onsubmit = function() { // Check reserved app names var reserved = mklist('account', 'app', 'cache', 'clone', 'create', 'delete', 'graph', 'home', 'login', 'new', 'page', 'proxy', 'public', 'private', 'info', 'store'); - if (!isNil(assoc(name, map(function(r) { return mklist(r, r); }, reserved)))) { + if (!isNull(assoc(name, map(function(r) { return mklist(r, r); }, reserved)))) { errorstatus('App name is taken, please pick another name'); return false; } diff --git a/sca-cpp/trunk/hosting/server/htdocs/delete/index.html b/sca-cpp/trunk/hosting/server/htdocs/delete/index.html index 81cfa0b625..3855a09e3c 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/delete/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/delete/index.html @@ -83,7 +83,7 @@ var appentry; * Get and display the requested app. */ (function getapp() { - if (isNil(appname)) + if (isNull(appname)) return false; workingstatus(true); showstatus('Loading'); @@ -103,7 +103,7 @@ var appentry; $('appUpdated').value = xmldatetime(cadr(assoc("'updated", appentry))).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); onlinestatus(); workingstatus(false); diff --git a/sca-cpp/trunk/hosting/server/htdocs/graph/index.html b/sca-cpp/trunk/hosting/server/htdocs/graph/index.html index d01bfa1c02..557f427e38 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/graph/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/graph/index.html @@ -32,11 +32,11 @@ */ var appname = ui.fragmentParams(location)['app']; var ispalette = false; -if (isNil(appname)) { +if (isNull(appname)) { appname = ui.fragmentParams(location)['palette']; // Edit a palette instead of a regular app - if (!isNil(appname)) + if (!isNull(appname)) ispalette = true; } @@ -179,7 +179,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc //debug('draggable', n); if (n == graphdiv || n == null) return null; - if (n.className == 'g' && !isNil(n.id) && n.id != '') + if (n.className == 'g' && !isNull(n.id) && n.id != '') return n; return draggable(n.parentNode); } @@ -301,7 +301,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc if (graph.dragging.parentNode == graphdiv && graph.dragging.id.substring(0, 8) != 'palette:') { // Add new dragged component to the composite - if (isNil(graph.dragging.compos)) { + if (isNull(graph.dragging.compos)) { var compos = scdl.composite(graphdiv.compos); setElement(compos, graph.sortcompos(graph.addcomps(mklist(graph.dragging.comp), compos))); graph.dragging.compos = graphdiv.compos; @@ -311,7 +311,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc setElement(graph.dragging.comp, graph.movecomp(graph.dragging.comp, graph.abspos(graph.draggingg))); // Wire component to neighboring reference - if (!isNil(graph.dragging.svcpos)) { + if (!isNull(graph.dragging.svcpos)) { var compos = scdl.composite(graphdiv.compos); setElement(compos, graph.sortcompos(graph.clonerefs(graph.wire(graph.dragging, compos, graphdiv)))); } @@ -332,7 +332,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc var nodes = graph.refresh(graphdiv); // Reselect the previously selected component - if (!isNil(graph.selected)) { + if (!isNull(graph.selected)) { graph.selected = graph.findcompnode(scdl.name(graph.selected.comp), nodes); graph.compselect(graph.selected, true, atitle, cvalue, ccopy, cdelete); @@ -544,7 +544,7 @@ graph.mkedit = function(graphdiv, pos, atitle, cvalue, cadd, ccopy, cdelete, onc // Remove selected component var compos = scdl.composite(graphdiv.compos); - if (isNil(graph.selected.compos)) + if (isNull(graph.selected.compos)) setElement(compos, graph.sortcompos(graph.cutwire(graph.selected, compos, graphdiv))); setElement(compos, graph.sortcompos(graph.clonerefs(graph.gcollect(graph.removecomp(graph.selected.comp, compos))))); @@ -752,8 +752,8 @@ graph.drawshape = function(g) { // Draw the shape ctx.fillStyle = g.fillStyle; - ctx.strokeStyle = !isNil(g.strokeStyle)? g.strokeStyle : graph.colors.gray; - ctx.lineWidth = !isNil(g.lineWidth)? g.lineWidth : 1; + ctx.strokeStyle = !isNull(g.strokeStyle)? g.strokeStyle : graph.colors.gray; + ctx.lineWidth = !isNull(g.lineWidth)? g.lineWidth : 1; g.path.draw(ctx); // Reset canvas context @@ -794,7 +794,7 @@ graph.comptitle = function(comp) { */ graph.comptitlewidth = function(comp) { var title = graph.comptitle(comp); - if (isNil(title)) + if (isNull(title)) return 0; return title.clientWidth; }; @@ -803,14 +803,14 @@ graph.comptitlewidth = function(comp) { * Draw a component shape selection. */ graph.compselect = function(g, s, atitle, cvalue, ccopy, cdelete) { - if (isNil(g) || !s) { + if (isNull(g) || !s) { cvalue.value = ''; cvalue.readOnly = true; cvalue.style.display = 'none'; atitle.style.display = 'block'; ccopy.disabled = true; cdelete.disabled = true; - if (isNil(g)) + if (isNull(g)) return true; g.shape.strokeStyle = null; g.shape.lineWidth = null; @@ -836,7 +836,7 @@ graph.compselect = function(g, s, atitle, cvalue, ccopy, cdelete) { * Draw a palette shape selection. */ graph.paletteselect = function(g, s) { - if (isNil(g)) + if (isNull(g)) return true; if (!s) { g.shape.strokeStyle = null; @@ -879,7 +879,7 @@ graph.compnode = function(comp, cassoc, pos) { g.shape = shape; g.style.width = ui.pixpos(shape.width); g.style.height = ui.pixpos(shape.height); - if (!isNil(title)) { + if (!isNull(title)) { title.style.left = ui.pixpos(shape.path.xmin * -1); g.appendChild(title); } @@ -895,14 +895,14 @@ graph.compnode = function(comp, cassoc, pos) { * Find the node representing a component. */ graph.findcompnode = function(name, nodes) { - if (isNil(nodes)) + if (isNull(nodes)) return null; - if (isNil(car(nodes).comp)) + if (isNull(car(nodes).comp)) return graph.findcompnode(name, cdr(nodes)); if (name == scdl.name(car(nodes).comp)) return car(nodes); var node = graph.findcompnode(name, nodeList(car(nodes).childNodes)); - if (!isNil(node)) + if (!isNull(node)) return node; return graph.findcompnode(name, cdr(nodes)); } @@ -969,7 +969,7 @@ graph.move = function(g, pos) { * Return the absolute position of a component node. */ graph.abspos = function(e) { - if (isNil(e) || e == graphdiv) + if (isNull(e) || e == graphdiv) return graph.mkpath(); var gpos = graph.relpos(e); var pgpos = graph.abspos(e.parentNode); @@ -1010,7 +1010,7 @@ graph.title = function(e) { */ graph.property = function(e) { var p = scdl.properties(e); - if (isNil(p)) + if (isNull(p)) return ''; if (scdl.visible(car(p)) == 'false') return ''; @@ -1034,7 +1034,7 @@ graph.propertytitle = function(e) { */ graph.hasproperty = function(e) { var p = scdl.properties(e); - if (isNil(p)) + if (isNull(p)) return false; if (scdl.visible(car(p)) == 'false') return false; @@ -1046,7 +1046,7 @@ graph.hasproperty = function(e) { */ graph.setproperty = function(e, value) { var p = scdl.properties(e); - if (isNil(p)) + if (isNull(p)) return ''; if (scdl.visible(car(p)) == 'false') return ''; @@ -1071,14 +1071,14 @@ graph.color = function(comp) { graph.lsvcs = function(comp) { return memo(comp, 'lsvcs', function() { var svcs = scdl.services(comp); - if (isNil(svcs)) + if (isNull(svcs)) return mklist(mklist("'element","'service","'attribute","'name",scdl.name(comp))); var l = filter(function(s) { var a = scdl.align(s); var v = scdl.visible(s); return (a == null || a == 'left') && v != 'false'; }, svcs); - if (isNil(l)) + if (isNull(l)) return mklist(); return mklist(car(l)); }); @@ -1103,7 +1103,7 @@ graph.rrefs = function(comp) { graph.rrefheight = function(ref, cassoc) { return memo(ref, 'rheight', function() { var target = assoc(scdl.target(ref), cassoc); - if (isNil(target)) + if (isNull(target)) return graph.tabsz * 8; return graph.compclosureheight(cadr(target), cassoc); }); @@ -1113,7 +1113,7 @@ graph.rrefheight = function(ref, cassoc) { * Return the total height of the references on the right side of a component. */ graph.rrefsheight = function(refs, cassoc) { - if (isNil(refs)) + if (isNull(refs)) return 0; return graph.rrefheight(car(refs), cassoc) + graph.rrefsheight(cdr(refs), cassoc); }; @@ -1144,7 +1144,7 @@ graph.compclosureheight = function(comp, cassoc) { * Return the max width of the references on the right side of a component. */ graph.rrefswidth = function(refs, cassoc) { - if (isNil(refs)) + if (isNull(refs)) return 0; return Math.max(graph.rrefwidth(car(refs), cassoc), graph.rrefswidth(cdr(refs), cassoc)); }; @@ -1155,7 +1155,7 @@ graph.rrefswidth = function(refs, cassoc) { graph.compwidth = function(comp, cassoc) { return memo(comp, 'width', function() { var ctw = graph.comptitlewidth(comp); - var rrefsw = (isNil(graph.rrefs(comp))? 0 : (graph.tabsz * 4)); + var rrefsw = (isNull(graph.rrefs(comp))? 0 : (graph.tabsz * 4)); var twidth = (graph.titlex * 2) + ctw + rrefsw; var width = Math.max(twidth, (graph.tabsz * 8) + (graph.tabsz * 4)); return width; @@ -1205,7 +1205,7 @@ graph.comppath = function(comp, cassoc) { * Apply a path rendering function to a list of services or references. */ function renderpath(x, f, cassoc, path, height) { - if (isNil(x)) + if (isNull(x)) return path; return renderpath(cdr(x), f, cassoc, f(car(x), cassoc, path, height), height); } @@ -1290,7 +1290,7 @@ graph.composite = function(compos, pos, aspalette) { */ function renderrref(ref, cassoc, pos, gcomp) { var target = assoc(scdl.target(ref), cassoc); - if (isNil(target)) + if (isNull(target)) return null; // Render the component target of the reference @@ -1304,7 +1304,7 @@ graph.composite = function(compos, pos, aspalette) { return pos.clone().rmove(0, graph.rrefheight(ref, cassoc)); } - if (isNil(refs)) + if (isNull(refs)) return mklist(); // Return list of (ref, comp rendering) pairs @@ -1322,7 +1322,7 @@ graph.composite = function(compos, pos, aspalette) { // Store list of (ref, pos, component rendering) triplets in the component function refposgcomp(refpos, grefs) { - if (isNil(refpos)) + if (isNull(refpos)) return mklist(); // Append component rendering to component @@ -1347,7 +1347,7 @@ graph.composite = function(compos, pos, aspalette) { */ function promcomp(svc, cassoc) { var c = assoc(scdl.promote(svc), cassoc); - if (isNil(c)) + if (isNull(c)) return mklist(); return cadr(c); } @@ -1359,13 +1359,13 @@ graph.composite = function(compos, pos, aspalette) { return pos.clone().rmove(0, graph.compclosureheight(comp, cassoc) + Math.max((graph.tabsz * 2), 8)); } - if (isNil(svcs)) + if (isNull(svcs)) return mklist(); // Render the first promoted component in the list // then recurse to render the rest of the list var comp = promcomp(car(svcs), cassoc); - if (isNil(comp)) + if (isNull(comp)) return renderproms(cdr(svcs), cassoc, rendermove(car(svcs), cassoc, pos)); var cpos = graph.comppos(comp, pos); @@ -1401,14 +1401,14 @@ graph.ucid = function(prefix, compos1, compos2, clone) { // Build an assoc list keyed by component name var comps = map(function(c) { return mklist(scdl.name(c), c); }, append(namedElementChildren("'component", compos1), namedElementChildren("'component", compos2))); - if (!clone && isNil(assoc(prefix, comps))) + if (!clone && isNull(assoc(prefix, comps))) return prefix; /** * Find a free component id. */ function ucid(p, id) { - if (isNil(assoc(p + id, comps))) + if (isNull(assoc(p + id, comps))) return p + id; return ucid(p, id + 1); } @@ -1447,7 +1447,7 @@ graph.clonepalette = function(e, compos) { * Move a SCDL component to the given position. */ graph.movecomp = function(comp, pos) { - if (isNil(pos)) + if (isNull(pos)) return append(mklist(element, "'component"), filter(function(e) { return !(isAttribute(e) && (attributeName(e) == "'x" || attributeName(e) == "'y")); }, elementChildren(comp))); return append(mklist(element, "'component", mklist(attribute, "'x", '' + (pos.x - graph.palcx)), mklist(attribute, "'y", '' + pos.y)), @@ -1469,11 +1469,11 @@ graph.clonecomp = function(e, compos) { // Write the component and the components it references to XML function collectcomp(e) { function collectrefs(refpos) { - if (isNil(refpos)) + if (isNull(refpos)) return mklist(); var r = car(refpos); var n = caddr(r); - if (isNil(n)) + if (isNull(n)) return collectrefs(cdr(refpos)); return append(collectcomp(n), collectrefs(cdr(refpos))); } @@ -1578,7 +1578,7 @@ graph.gcollect = function(compos) { // Filter out the unused components var used = append(proms, refs); return append(mklist(element, "'composite"), - filter(function(c) { return !(isElement(c) && elementName(c) == "'component" && isNil(assoc(scdl.name(c), used))); }, elementChildren(compos))); + filter(function(c) { return !(isElement(c) && elementName(c) == "'component" && isNull(assoc(scdl.name(c), used))); }, elementChildren(compos))); } /** @@ -1592,7 +1592,7 @@ graph.clonerefs = function(compos) { // If the references are clonable var refs = scdl.references(c); - if (isNil(refs)) + if (isNull(refs)) return c; if (scdl.clonable(car(refs)) != 'true') return c; @@ -1611,7 +1611,7 @@ graph.clonerefs = function(compos) { * Refactor references to a component. */ graph.refactorrefs = function(refs, oname, nname) { - if (isNil(refs)) + if (isNull(refs)) return true; var ref = car(refs); if (scdl.target(ref) != oname) @@ -1636,7 +1636,7 @@ graph.renamecomp = function(comp, compos, name) { // Rename the SCDL promoted service and component var proms = filter(function(s) { return scdl.name(s) == oname }, scdl.services(compos)); - if (!isNil(proms)) + if (!isNull(proms)) setElement(car(proms), mklist(element, "'service", mklist(attribute, "'name", name), mklist(attribute, "'promote", name))); setElement(comp, append(mklist(element, "'component"), cons(mklist(attribute, "'name", name), @@ -1655,7 +1655,7 @@ graph.cutwire = function(node, compos, g) { * Find the reference wired to a node and cut its wire. */ function cutref(refs, node) { - if (isNil(refs)) + if (isNull(refs)) return true; var ref = car(refs); if (caddr(ref) == node) { @@ -1702,13 +1702,13 @@ graph.wire = function(n, compos, g) { * references of a node. */ function closerefs(npos, refs, spos, cref) { - if (isNil(refs)) + if (isNull(refs)) return cref; var fdist = cadddr(cref); var ref = car(refs); // Skip wired reference - if (!isNil(filter(function(n) { return isAttribute(n) && attributeName(n) == "'target"; }, car(ref)))) + if (!isNull(filter(function(n) { return isAttribute(n) && attributeName(n) == "'target"; }, car(ref)))) return closerefs(npos, cdr(refs), spos, cref); // Compute distance between service node and reference node @@ -1723,12 +1723,12 @@ graph.wire = function(n, compos, g) { return closerefs(npos, cdr(refs), spos, fdist < rdist? cref : mklist(car(ref), cadr(ref), caddr(ref), rdist)); } - if (isNil(nodes)) + if (isNull(nodes)) return cref; // Skip non-component nodes var node = car(nodes); - if (isNil(node.comp)) + if (isNull(node.comp)) return closecomprefs(cdr(nodes), spos, cref); // Compute the component absolute position @@ -1771,7 +1771,7 @@ graph.display = function(nodes, g) { graph.hide = function(g) { // Remove nodes from the graph - map(function(n) { if (!isNil(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); + map(function(n) { if (!isNull(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); return g; }; @@ -1782,7 +1782,7 @@ graph.refresh = function(g) { //debug('refresh'); // Remove existing nodes from the graph - map(function(n) { if (!isNil(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); + map(function(n) { if (!isNull(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); // Redisplay the composite associated with the graph var nodes = graph.composite(g.compos, graph.mkpath().pos(graph.palcx,0), false); @@ -1802,7 +1802,7 @@ graph.edit = function(appname, compos, nodes, g) { setElement(scompos, graph.sortcompos(scompos)); // Remove existing nodes from the graph - map(function(n) { if (!isNil(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); + map(function(n) { if (!isNull(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); // Display the composite nodes appendNodes(nodes, g); @@ -1829,7 +1829,7 @@ var bpalette = null; * Get and display an application composite. */ function getapp(name, g) { - if (isNil(name)) + if (isNull(name)) return false; workingstatus(true); showstatus('Loading'); @@ -1846,8 +1846,8 @@ function getapp(name, g) { // Get the composite from the ATOM entry var composentry = car(atom.readATOMEntry(mklist(doc))); var content = namedElementChild("'content", composentry); - composite = isNil(content)? mklist() : elementChildren(content); - if (isNil(composite)) { + composite = isNull(content)? mklist() : elementChildren(content); + if (isNull(composite)) { // Create a default empty composite if necessary var x = '<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" ' + @@ -1879,15 +1879,15 @@ function getapp(name, g) { * Display a palette. Get it from the server if needed. */ function displaypalette(name, g, palette, gpalettes) { - if (isNil(name)) + if (isNull(name)) return; - if (isNil(gpalettes[name])) { + if (isNull(gpalettes[name])) { // Get the palette from the server palettes.get(name, function(doc) { var entry = car(atom.readATOMEntry(mklist(doc))); var content = namedElementChild("'content", entry); - var compos = isNil(content)? mklist() : elementChildren(content); + var compos = isNull(content)? mklist() : elementChildren(content); gpalettes[name] = graph.composite(compos, graph.mkpath().move(2580,0), true, g); graph.display(gpalettes[name], g); }); @@ -1985,7 +1985,7 @@ function oncomposchange(prop) { * Return the link to a component. */ function complink(appname, cname) { - if (cname == '' || isNil(cname)) + if (cname == '' || isNull(cname)) return ''; var protocol = location.protocol; var host = location.hostname; @@ -2004,9 +2004,9 @@ function oncompselect(gsel) { return true; gcomp = gsel; - cdelete.disabled = isNil(gsel) || !editable; - ccopy.disabled = isNil(gsel) || !editable; - cplay.disabled = isNil(gsel); + cdelete.disabled = isNull(gsel) || !editable; + ccopy.disabled = isNull(gsel) || !editable; + cplay.disabled = isNull(gsel); return true; } @@ -2016,7 +2016,7 @@ function oncompselect(gsel) { function showdata(gcomp) { if (!gvisible) return true; - if (isNil(gcomp)) + if (isNull(gcomp)) return true; cvalue.value = complink(appname, gcomp.id); cplay.value = '<'; diff --git a/sca-cpp/trunk/hosting/server/htdocs/home/index.html b/sca-cpp/trunk/hosting/server/htdocs/home/index.html index d7a098e998..b5240bfd11 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/home/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/home/index.html @@ -60,7 +60,7 @@ $('getstarted').onclick = function() { */ (function homeanimation() { var anim = $('homeanimation'); - if (!isNil(anim)) { + if (!isNull(anim)) { anim.style.background = 'url(\'' + ui.b64png(appcache.get('/home/home.b64')) + '\')'; var bgpos = 0; setInterval(function homeanimation() { diff --git a/sca-cpp/trunk/hosting/server/htdocs/index.html b/sca-cpp/trunk/hosting/server/htdocs/index.html index 6ea6f80939..7722f96e3f 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/index.html @@ -203,7 +203,7 @@ var appresources = [ * Init status message area. */ (function initstatus() { - if (isNil($('status'))) + if (isNull($('status'))) return; $('status').style.display = 'none'; @@ -221,7 +221,7 @@ var appresources = [ */ window.showstatus = function(s, c) { //debug('show status', s); - if (isNil($('status')) || $('status').error) + if (isNull($('status')) || $('status').error) return s; $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('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', '<span class="greentext" style="font-weight: bold">Run!</span>', '/' + 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 = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('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 = '<table class="datatable" style="width: 100%;;"><tr><td class="datatd">' + (isNil(c)? f : car(c)) + '</td></tr><tr><td class="datatd">...</td></tr></table>'; + e.innerHTML = '<table class="datatable" style="width: 100%;;"><tr><td class="datatd">' + (isNull(c)? f : car(c)) + '</td></tr><tr><td class="datatd">...</td></tr></table>'; return t; } if (wc == 'table') { - e.innerHTML = '<table class="datatable" style="width: 100%;"><tr><td class="datatdl">' + (isNil(c)? f : car(c)) + '</td><td class="datatdr">...</td></tr><tr><td class="datatdl">...</td><td class="datatdr">...</td></tr></table>'; + e.innerHTML = '<table class="datatable" style="width: 100%;"><tr><td class="datatdl">' + (isNull(c)? f : car(c)) + '</td><td class="datatdr">...</td></tr><tr><td class="datatdl">...</td><td class="datatdr">...</td></tr></table>'; 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 = '<div id="page"></div>'; 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 = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('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 = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('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 = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('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 = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('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 = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>'; $('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 += '<div class="box">' apps += '<div class="appicon">' @@ -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 += '<div class="box">' apps += '<div class="appicon">' @@ -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<value>(v)) + if (!isList(v) || isNull(v) || element != car<value>(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<value>(v)) + if (!isList(v) || isNull(v) || attribute != car<value>(v)) return false; return true; } @@ -82,7 +82,7 @@ inline const value elementName(const list<value>& l) { * Returns true if an element has children. */ inline const bool elementHasChildren(const list<value>& l) { - return !isNil(cddr(l)); + return !isNull(cddr(l)); } /** @@ -99,7 +99,7 @@ inline const bool elementHasValue(const list<value>& l) { const list<value> r = reverse(l); if (isSymbol(car(r))) return false; - if(isList(car(r)) && !isNil((list<value>)car(r)) && isSymbol(car<value>(car(r)))) + if(isList(car(r)) && !isNull((list<value>)car(r)) && isSymbol(car<value>(car(r)))) return false; return true; } @@ -118,7 +118,7 @@ inline const bool elementToValueIsList(const value& v) { if (!isList(v)) return false; const list<value> 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<value> 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<value> elementToValueGroupValues(const value& v, const list<value>& l) { - if (isNil(l) || !elementToValueIsSymbol(v) || !elementToValueIsSymbol(car(l))) + if (isNull(l) || !elementToValueIsSymbol(v) || !elementToValueIsSymbol(car(l))) return cons(v, l); if (car<value>(car(l)) != car<value>(v)) return cons(v, l); @@ -181,7 +181,7 @@ inline const list<value> elementToValueGroupValues(const value& v, const list<va } inline const list<value> elementsToValues(const list<value>& 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<value> valuesToElements(const list<value>& l); // Convert a name value pair - if (isList(t) && !isNil((list<value>)t) && isSymbol(car<value>(t))) { + if (isList(t) && !isNull((list<value>)t) && isSymbol(car<value>(t))) { const value n = car<value>(t); - const value v = isNil(cdr<value>(t))? nilValue : cadr<value>(t); + const value v = isNull(cdr<value>(t))? nilValue : cadr<value>(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<value>)v) || !isSymbol(car<value>(v))) + if (isNull((list<value>)v) || !isSymbol(car<value>(v))) return cons(element, cons(n, mklist<value>(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<value> valuesToElements(const list<value>& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons<value>(valueToElement(car(l)), valuesToElements(cdr(l))); } @@ -234,7 +234,7 @@ inline const value attributeValue(const value& name, const list<value>& l) { const list<value> f = filter<value>([name](const value& v) { return isAttribute(v) && attributeName((list<value>)v) == name; }, l); - if (isNil(f)) + if (isNull(f)) return nilValue; return caddr<value>(car(f)); } @@ -253,7 +253,7 @@ inline const list<value> elementChildren(const value& name, const list<value>& l */ inline const value elementChild(const value& name, const list<value>& l) { const list<value> 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<typename S> friend ostream& operator<<(ostream&, const lambda<S>&); - template<typename S> friend const bool isNil(const lambda<S>& l) noexcept; + template<typename S> friend const bool isNull(const lambda<S>& l) noexcept; private: typedef Callable<R,P...> CallableType; @@ -179,7 +179,7 @@ template<typename S> inline ostream& operator<<(ostream& out, const lambda<S>& l /** * Return true if a lambda is nil. */ -template<typename S> inline const bool isNil(const lambda<S>& l) noexcept { +template<typename S> inline const bool isNull(const lambda<S>& 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<value> 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<int>() + 1 + 2 + 3 == mklist(1, 2, 3)); return true; @@ -497,12 +497,12 @@ const bool testComplex() { const list<Complex> 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<int, int>(square, list<int>()))); + assert(isNull(map<int, int>(square, list<int>()))); const list<int> m = map<int, int>(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<int>()))); + assert(isNull(reverse(list<int>()))); 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<list<string> > l = mklist(mklist<string>("x", "X"), mklist<string>("a", "A"), mklist<string>("y", "Y"), mklist<string>("a", "AA")); assert(assoc<string>("a", l) == mklist<string>("a", "A")); - assert(isNil(assoc<string>("z", l))); + assert(isNull(assoc<string>("z", l))); const list<list<string> > l3 = mklist(mklist<string>("x", "X"), mklist<string>("a", "A"), mklist<string>("a", "AA")); assert(delAssoc<string>("y", l) == l3); @@ -762,7 +762,7 @@ const bool testBinaryTreeAssoc() { assert(rbtreeAssoc<value>("a", bt) == mklist<value>("a", "aa")); assert(rbtreeAssoc<value>("b", bt) == mklist<value>("b", "bb")); assert(rbtreeAssoc<value>("f", bt) == mklist<value>("f", "ff")); - assert(isNil(rbtreeAssoc<value>("x", bt))); + assert(isNull(rbtreeAssoc<value>("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<T>& 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<T>& 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<T>& 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<typename X> friend const bool isNil(const list<X>& p) noexcept; + template<typename X> friend const bool isNull(const list<X>& p) noexcept; template<typename X> friend const X car(const list<X>& p) noexcept; template<typename X> friend const list<X> cdr(const list<X>& p) noexcept; @@ -188,7 +188,7 @@ private: * to watch than the list itself in a debugger. */ template<typename T> inline const string watchList(const list<T>& p) noexcept { - if(isNil(p)) + if(isNull(p)) return "()"; odebugstream os; os << "(" << car(p) << " ...)"; @@ -200,22 +200,22 @@ template<typename T> inline const string watchList(const list<T>& p) noexcept { /** * Returns true if the given list is nil. */ -template<typename T> inline const bool isNil(const list<T>& p) noexcept { - return isNil(p.cdr); +template<typename T> inline const bool isNull(const list<T>& p) noexcept { + return isNull(p.cdr); } /** * Write a list to an output stream. */ template<typename T> inline ostream& writeHelper(ostream& out, const list<T>& l) noexcept { - if (isNil(l)) + if (isNull(l)) return out; out << " " << car(l); return writeHelper(out, cdr(l)); } template<typename T> inline ostream& operator<<(ostream& out, const list<T>& l) noexcept { - if(isNil(l)) + if(isNull(l)) return out << "()"; out << "(" << car(l); writeHelper<T>(out, cdr(l)); @@ -294,7 +294,7 @@ template<typename T> inline const list<T> mklist(const T& a, const T& b, const T */ template<typename T> inline const T car(const list<T>& 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<typename T> inline const list<T> cdddddddr(const list<T>& p) noexcept { */ template<typename T> inline const size_t length(const list<T>& p) noexcept { const lambda<size_t(const size_t, const list<T>&)> lengthRef = [&lengthRef](const size_t c, const list<T>& p) -> const size_t { - if(isNil(p)) + if(isNull(p)) return c; return lengthRef(c + 1, cdr(p)); }; @@ -412,7 +412,7 @@ template<typename T> inline const size_t length(const list<T>& p) noexcept { * Appends a list and a lambda function returning a list. */ template<typename T> inline const list<T> append(const list<T>&a, const lambda<const list<T>()>& fb) noexcept { - if(isNil(a)) + if(isNull(a)) return fb(); return cons<T>(car(a), [a, fb]() { return append(cdr(a), fb); }); } @@ -439,7 +439,7 @@ template<typename T, typename V> const list<T> inline operator+(const list<T>& l * Run a map lambda function on a list. */ template<typename T, typename R> inline const list<R> map(const lambda<const R(const T)>& f, const list<T>& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list<R> (); return cons(f(car(p)), map(f, cdr(p))); } @@ -449,7 +449,7 @@ template<typename T, typename R> inline const list<R> map(const lambda<const R(c */ template<typename T, typename R> inline const R reduce(const lambda<const R(const R, const T)>& f, const R& initial, const list<T>& p) noexcept { const lambda<const R(const R&, const list<T>&p)> reduceAccumulate = [f, &reduceAccumulate](const R& acc, const list<T>& p) -> R { - if(isNil(p)) + if(isNull(p)) return acc; return reduceAccumulate(f(acc, car(p)), cdr(p)); }; @@ -458,7 +458,7 @@ template<typename T, typename R> inline const R reduce(const lambda<const R(cons template<typename T, typename R> inline const R reduceRight(const lambda<const R(const T, const R)>& f, const R& initial, const list<T>& p) noexcept { const lambda<const R(const list<T>&p, const R&)> reduceRightAccumulate = [f, &reduceRightAccumulate](const list<T>& 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<typename T, typename R> inline const R reduceRight(const lambda<const R * Run a filter lambda function on a list. */ template<typename T> inline const list<T> filter(const lambda<const bool(const T)>& f, const list<T>& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list<T> (); if(f(car(p))) { const lambda<const list<T>(const lambda<const bool(const T)>, const list<T>)> ff(filter<T>); @@ -482,7 +482,7 @@ template<typename T> inline const list<T> filter(const lambda<const bool(const T * Returns a list pointing to a member of a list. */ template<typename T> inline const list<T> member(const T& t, const list<T>& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list<T> (); if(t == car(p)) return p; @@ -493,7 +493,7 @@ template<typename T> inline const list<T> member(const T& t, const list<T>& p) n * Reverse a list. */ template<typename T> inline const list<T> reverseIter(const list<T>& acc, const list<T>& p) noexcept { - if(isNil(p)) + if(isNull(p)) return acc; return reverseIter(cons(car(p), acc), cdr(p)); } @@ -528,7 +528,7 @@ template<typename T> inline const T listRef(const list<T>& l, const size_t i) no template<typename T> inline const list<T> listTail(const list<T>& 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<typename T> inline const list<T> listTail(const list<T>& l, const size_ * Substitute elements in a list. */ template<typename T> inline const list<T> subst(const T& o, const T& n, const list<T>& p) noexcept { - if(isNil(p)) + if(isNull(p)) return p; if(o == car(p)) return cons<T>(n, subst(o, n, cdr(p))); @@ -548,7 +548,7 @@ template<typename T> inline const list<T> subst(const T& o, const T& n, const li * Returns the first pair matching a key from a list of key value pairs. */ template<typename T> inline const list<T> assoc(const T& k, const list<list<T> >& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list<T>(); if(k == car(car(p))) return car(p); @@ -560,7 +560,7 @@ template<typename T> inline const list<T> assoc(const T& k, const list<list<T> > * Requires T to support isList and cast to list<T>. */ template<typename T> inline const list<T> assoc(const T& k, const list<T>& p) noexcept { - if(isNil(p)) + if(isNull(p)) return list<T>(); const T c = car(p); if(isList(c) && k == car<T>(c)) @@ -572,7 +572,7 @@ template<typename T> inline const list<T> assoc(const T& k, const list<T>& p) no * Returns a list of lists containing elements from two input lists. */ template<typename T> inline const list<list<T> > zip(const list<T>& a, const list<T>& b) noexcept { - if (isNil(a) || isNil(b)) + if (isNull(a) || isNull(b)) return list<list<T> >(); return cons<list<T> >(mklist<T>(car(a), car(b)), zip(cdr(a), cdr(b))); } @@ -581,13 +581,13 @@ template<typename T> inline const list<list<T> > zip(const list<T>& a, const lis * Converts a list of key value pairs to a list containing the list of keys and the list of values. */ template<typename T> inline const list<T> unzipKeys(const list<list<T> >& l) noexcept { - if (isNil(l)) + if (isNull(l)) return list<T>(); return cons(car(car(l)), unzipKeys(cdr(l))); } template<typename T> inline const list<T> unzipValues(const list<list<T> >& l) noexcept { - if (isNil(l)) + if (isNull(l)) return list<T>(); return cons(cadr(car(l)), unzipValues(cdr(l))); } @@ -600,7 +600,7 @@ template<typename T> inline const list<list<T> > unzip(const list<list<T> >& l) * Delete assocs matching a key from a list of assocs. */ template<typename T> inline const list<list<T> > delAssoc(const T& k, const list<list<T> >& 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<typename T> inline const list<list<T> > delAssoc(const T& k, const list * Requires T to support isList, isAssoc, and cast to list<T>. */ template<typename T> inline const list<T> delAssoc(const T& k, const list<T>& p) noexcept { - if(isNil(p)) + if(isNull(p)) return p; const T c = car(p); if(isList(c) && k == car<T>(c)) @@ -624,7 +624,7 @@ template<typename T> inline const list<T> delAssoc(const T& k, const list<T>& p) * Substitute assocs with matching keys in a list of assocs. */ template<typename T> inline const list<list<T> > substAssoc(const T& k, const list<T>& n, const list<list<T> >& p, const bool add = false) noexcept { - if(isNil(p)) + if(isNull(p)) return add? mklist<list<T> >(n) : p; if(k == car(car(p))) return cons<list<T> >(n, substAssoc(k, n, cdr(p), false)); @@ -636,7 +636,7 @@ template<typename T> inline const list<list<T> > substAssoc(const T& k, const li * Requires T to support isList, isAssoc, and cast to list<T>. */ template<typename T> inline const list<T> substAssoc(const T& k, const list<T>& n, const list<T>& p, const bool add = false) noexcept { - if(isNil(p)) + if(isNull(p)) return add? mklist<T>(n) : p; const T c = car(p); if(isList(c) && k == car<T>(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<future<int> > submitSquares(worker& w, const int max, const int i) { } bool checkSquareResults(const list<future<int> > 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<future<long int> > submitTLSSets(worker& w, wqueue<bool>& wq, wqueue< } const bool checkTLSSets(const list<future<long int> > s) { - if (isNil(s)) + if (isNull(s)) return true; assert(car(s) == 0); return checkTLSSets(cdr(s)); @@ -174,7 +174,7 @@ const list<future<bool> > submitTLSChecks(worker& w, wqueue<bool>& wq, wqueue<bo } const bool checkTLSResults(const list<future<bool> > 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<typename R> inline const future<R> submit(const worker& w, const lambda * Enqueues shutdown requests. */ inline const bool shutdownEnqueue(const list<pthread_t>& threads, wqueue<blambda>& 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<pthread_t>& threads, wqueue<blambda * Waits for shut down threads to terminate. */ inline const bool shutdownJoin(const list<pthread_t>& 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<pthread_t>& 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<string>& 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<string>)buf)) + if (isNull((const list<string>)buf)) return emptyString; char* const sbuf = gc_cnew(len + 1); writeList(buf, sbuf + len); @@ -239,10 +239,10 @@ inline const list<string> tokenize(const char* const sep, const string& str) { inline const string join(const char* const sep, const list<string>& l) { ostringstream os; const lambda<ostringstream&(const char* const, const list<string>&, ostringstream&)> join = [&join](const char* const sep, const list<string>& 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<string> fragment(const list<string>& l, const size_t max) { * Write a list of strings to an output stream. */ inline ostream& write(const list<string>& 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<string>& l, ostream& os) { * Convert a list of strings to a string. */ inline const string write(const list<string>& 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<T>. */ template<typename T> inline const list<T> treeDelAssoc(const list<T>& k, const list<T>& l) noexcept { - if (isNil(k) || isNil(l)) + if (isNull(k) || isNull(l)) return l; const list<T> lv = l; // If list is an assoc and matches, skip it if (isAssoc(lv)) { - if (car<T>(lv) == car(k) && isNil(cdr(k))) + if (car<T>(lv) == car(k) && isNull(cdr(k))) return list<T>(); } @@ -56,23 +56,23 @@ template<typename T> inline const list<T> treeDelAssoc(const list<T>& k, const l if (!isList(a)) return cons<T>(a, treeDelAssoc<T>(k, cdr(lv))); const list<T> da = treeDelAssoc<T>(k, a); - return isNil(da)? treeDelAssoc<T>(k, cdr(lv)) : cons<T>(da, treeDelAssoc<T>(k, cdr(lv))); + return isNull(da)? treeDelAssoc<T>(k, cdr(lv)) : cons<T>(da, treeDelAssoc<T>(k, cdr(lv))); } // If we found a match, skip it and lookup children and rest of the list if (car<T>(a) == car(k)) { - if (isNil(cdr(k))) + if (isNull(cdr(k))) return treeDelAssoc<T>(k, cdr(lv)); return cons<T>(cons<T>(car<T>(a), treeDelAssoc<T>(cdr(k), cdr<T>(a))), treeDelAssoc<T>(k, cdr(lv))); } // No match, lookup children and rest of the list - if (isNil(cdr<T>(a))) + if (isNull(cdr<T>(a))) return cons<T>(a, treeDelAssoc<T>(k, cdr(lv))); if (!isList(cadr<T>(a))) return cons<T>(cons<T>(car<T>(a), cons<T>(cadr<T>(a), treeDelAssoc<T>(k, cddr<T>(a)))), treeDelAssoc<T>(k, cdr(lv))); const list<T> da = treeDelAssoc<T>(k, cadr<T>(a)); - if (isNil(da)) + if (isNull(da)) return cons<T>(cons<T>(car<T>(a), treeDelAssoc<T>(k, cddr<T>(a))), treeDelAssoc<T>(k, cdr(lv))); return cons<T>(cons<T>(car<T>(a), cons<T>(da, treeDelAssoc<T>(k, cddr<T>(a)))), treeDelAssoc<T>(k, cdr(lv))); } @@ -83,12 +83,12 @@ template<typename T> inline const list<T> treeDelAssoc(const list<T>& k, const l * Requires T to support isList, isAssoc, and cast to list<T>. */ template<typename T> inline const list<T> treeSubstAssoc(const list<T>& k, const list<T>& n, const list<T>& 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<T>(lv) == car(k) && isNil(cdr(k))) + if (car<T>(lv) == car(k) && isNull(cdr(k))) return n; } @@ -102,13 +102,13 @@ template<typename T> inline const list<T> treeSubstAssoc(const list<T>& k, const // If we found a match, substitute it and lookup children and rest of the list if (car<T>(a) == car(k)) { - if (isNil(cdr(k))) + if (isNull(cdr(k))) return cons<T>(n, treeSubstAssoc<T>(k, n, cdr(lv))); return cons<T>(cons<T>(car<T>(a), treeSubstAssoc<T>(cdr(k), n, cdr<T>(a))), treeSubstAssoc<T>(k, n, cdr(lv))); } // No match, lookup children and rest of the list - if (isNil(cdr<T>(a))) + if (isNull(cdr<T>(a))) return cons<T>(a, treeSubstAssoc<T>(k, n, cdr(lv))); if (!isList(cadr<T>(a))) return cons<T>(cons<T>(car<T>(a), cons<T>(cadr<T>(a), treeSubstAssoc<T>(k, n, cddr<T>(a)))), treeSubstAssoc<T>(k, n, cdr(lv))); @@ -121,12 +121,12 @@ template<typename T> inline const list<T> treeSubstAssoc(const list<T>& k, const * Requires T to support isList, isAssoc, and cast to list<T>. */ template<typename T> inline const list<T> treeSelectAssoc(const list<T>& k, const list<T>& lv) noexcept { - if (isNil(k) || isNil(lv)) + if (isNull(k) || isNull(lv)) return list<T>(); // If list is an assoc and matches, select it if (isAssoc(lv)) { - if (car<T>(lv) == car(k) && isNil(cdr(k))) + if (car<T>(lv) == car(k) && isNull(cdr(k))) return mklist<T>(lv); } @@ -140,13 +140,13 @@ template<typename T> inline const list<T> treeSelectAssoc(const list<T>& k, cons // If we found a match, select it and lookup children and rest of the list if (car<T>(a) == car(k)) { - if (isNil(cdr(k))) + if (isNull(cdr(k))) return cons<T>(a, treeSelectAssoc<T>(k, cdr(lv))); return append<T>(treeSelectAssoc<T>(cdr(k), cdr<T>(a)), treeSelectAssoc<T>(k, cdr(lv))); } // No match, lookup children and rest of the list - if (isNil(cdr<T>(a))) + if (isNull(cdr<T>(a))) return treeSelectAssoc<T>(k, cdr(lv)); if (!isList(cadr<T>(a))) return append<T>(treeSelectAssoc<T>(k, cddr<T>(a)), treeSelectAssoc<T>(k, cdr(lv))); @@ -164,7 +164,7 @@ template<typename T> inline const list<T> mkrbtree(const T& e, const list<T>& le * Find a leaf with the given key in a rooted binary tree. */ template<typename T> inline const list<T> rbtreeAssoc(const T& k, const list<T>& tree) { - if (isNil(tree)) + if (isNull(tree)) return tree; if (k == car<T>(car(tree))) return car(tree); @@ -177,7 +177,7 @@ template<typename T> inline const list<T> rbtreeAssoc(const T& k, const list<T>& * Construct a new rooted binary tree from a leaf and a tree. */ template<typename T> inline const list<T> rbtreeCons(const T& e, const list<T>& tree) { - if (isNil(tree)) + if (isNull(tree)) return mkrbtree(e, list<T>(), list<T>()); if (e == car(tree)) return tree; @@ -190,7 +190,7 @@ template<typename T> inline const list<T> rbtreeCons(const T& e, const list<T>& * Make a rooted binary tree from an unordered list of leaves. */ template<typename T> inline const list<T> mkrbtree(const list<T>& l) { - if (isNil(l)) + if (isNull(l)) return l; return rbtreeCons(car(l), mkrbtree(cdr(l))); } @@ -199,7 +199,7 @@ template<typename T> inline const list<T> mkrbtree(const list<T>& l) { * Convert a rooted binary tree to an ordered list of leaves. */ template<typename T> inline const list<T> flatten(const list<T>& tree) { - if (isNil(tree)) + if (isNull(tree)) return tree; return append<T>(flatten<T>(cadr(tree)), cons<T>(car(tree), flatten<T>(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<value>)exp)) + if(isList(exp) && !isNull((list<value>)exp)) return car((list<value>)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<value>)exp) && isSymbol(car<value>(exp)); + return isList(exp) && !isNull((list<value>)exp) && isSymbol(car<value>(exp)); } /** * Make a list of values from a list of other things. */ template<typename T> inline const list<value> mkvalues(const list<T>& l) noexcept { - if (isNil(l)) + if (isNull(l)) return nilListValue; return cons<value>(car(l), mkvalues(cdr(l))); } @@ -571,7 +571,7 @@ template<typename T> inline const list<value> mkvalues(const list<T>& l) noexcep * Convert a list of values to a list of other things. */ template<typename T> inline const list<T> convertValues(const list<value>& l) noexcept { - if (isNil(l)) + if (isNull(l)) return list<T>(); return cons<T>(car(l), convertValues<T>(cdr(l))); } @@ -580,7 +580,7 @@ template<typename T> inline const list<T> convertValues(const list<value>& l) no * Convert a list of lists of values to a list of values. */ inline const list<value> listOfValues(const list<list<value> >& l) noexcept { - if (isNil(l)) + if (isNull(l)) return nilListValue; return cons<value>(car(l), listOfValues(cdr(l))); } @@ -589,7 +589,7 @@ inline const list<value> listOfValues(const list<list<value> >& l) noexcept { * Convert a list of values to a list of lists of values. */ inline const list<list<value> > listOfListOfValues(const list<value>& l) noexcept { - if (isNil(l)) + if (isNull(l)) return list<list<value> >(); return cons<list<value> >(type(car(l)) == value::List? list<value>(car(l)) : nilPairValue, listOfListOfValues(cdr(l))); } @@ -613,7 +613,7 @@ inline const list<value> pathValues(const value& p) noexcept { * Convert a path represented as a list of values to a string value. */ inline const value path(const list<value>& 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<value> entryElementValues(const list<value>& e) { const list<value> lt = elementChildren("title", e); - const list<value> t = nilListValue + element + value("title") + (isNil(lt)? value(emptyString) : elementValue(car(lt))); + const list<value> t = nilListValue + element + value("title") + (isNull(lt)? value(emptyString) : elementValue(car(lt))); const list<value> li = elementChildren("id", e); - const list<value> i = nilListValue + element + value("id") + (isNil(li)? value(emptyString) : elementValue(car(li))); + const list<value> i = nilListValue + element + value("id") + (isNull(li)? value(emptyString) : elementValue(car(li))); const list<value> la = elementChildren("author", e); - const list<value> lan = isNil(la)? nilListValue : elementChildren("name", car(la)); - const list<value> lae = isNil(la)? nilListValue : elementChildren("email", car(la)); - const list<value> laa = isNil(lan)? lae : lan; - const list<value> a = isNil(laa)? nilListValue : mklist<value>(nilListValue + element + value("author") + elementValue(car(laa))); + const list<value> lan = isNull(la)? nilListValue : elementChildren("name", car(la)); + const list<value> lae = isNull(la)? nilListValue : elementChildren("email", car(la)); + const list<value> laa = isNull(lan)? lae : lan; + const list<value> a = isNull(laa)? nilListValue : mklist<value>(nilListValue + element + value("author") + elementValue(car(laa))); const list<value> lu = elementChildren("updated", e); - const list<value> u = isNil(lu)? nilListValue : mklist<value>(nilListValue + element + value("updated") + elementValue(car(lu))); + const list<value> u = isNull(lu)? nilListValue : mklist<value>(nilListValue + element + value("updated") + elementValue(car(lu))); const list<value> lc = elementChildren("content", e); - const list<value> c = isNil(lc)? nilListValue : isAttribute(elementValue(car(lc)))? nilListValue : + const list<value> c = isNull(lc)? nilListValue : isAttribute(elementValue(car(lc)))? nilListValue : mklist<value>(nilListValue + element + value("content") + elementValue(car(lc))); return append<value>(append<value>(append<value>(nilListValue + element + entry + value(t) + value(i), a), u), c); @@ -71,7 +71,7 @@ const list<value> entryElementValues(const list<value>& e) { * Convert a list of elements to a list of element values representing ATOM entries. */ const list<value> entriesElementValues(const list<value>& e) { - if (isNil(e)) + if (isNull(e)) return e; return cons<value>(entryElementValues(car(e)), entriesElementValues(cdr(e))); } @@ -99,7 +99,7 @@ const bool isATOMEntry(const list<string>& ls) { */ const failable<list<value> > readATOMEntry(const list<string>& ilist) { const list<value> e = content(xml::readElements(ilist)); - if (isNil(e)) + if (isNull(e)) return mkfailure<list<value> >("Empty entry"); return mklist<value>(entryElementValues(car(e))); } @@ -109,7 +109,7 @@ const failable<list<value> > readATOMEntry(const list<string>& ilist) { */ const failable<list<value> > readATOMFeed(const list<string>& ilist) { const list<value> f = content(xml::readElements(ilist)); - if (isNil(f)) + if (isNull(f)) return mkfailure<list<value> >("Empty feed"); const list<value> t = elementChildren("title", car(f)); const list<value> i = elementChildren("id", car(f)); @@ -136,18 +136,18 @@ const list<value> entryElement(const list<value>& 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<value>(nilListValue + element + "content" + (nilListValue + attribute + "type" + (text? "text" : "application/xml")), text? mklist<value>(elementValue(content)) : contentElementChildren(content))) @@ -158,7 +158,7 @@ const list<value> entryElement(const list<value>& l) { * Convert a list of element values representing ATOM entries to a list of elements. */ const list<value> entriesElements(const list<value>& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons<value>(entryElement(car(l)), entriesElements(cdr(l))); } @@ -167,7 +167,7 @@ const list<value> entriesElements(const list<value>& l) { * Convert a list of element values representing an ATOM entry to an ATOM entry. */ template<typename R> const failable<R> writeATOMEntry(const lambda<const R(const string&, const R)>& reduce, const R& initial, const list<value>& ll) { - const list<value> l = isNil(ll)? ll : (list<value>)car(ll); + const list<value> l = isNull(ll)? ll : (list<value>)car(ll); return xml::writeElements<R>(reduce, initial, mklist<value>(entryElement(l))); } @@ -182,11 +182,11 @@ const failable<list<string> > writeATOMEntry(const list<value>& l) { * Convert a list of element values representing an ATOM feed to an ATOM feed. */ template<typename R> const failable<R> writeATOMFeed(const lambda<const R(const string&, const R)>& reduce, const R& initial, const list<value>& ll) { - const list<value> l = isNil(ll)? ll : (list<value>)car(ll); + const list<value> l = isNull(ll)? ll : (list<value>)car(ll); const list<value> 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<value> 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<value> 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<typename R> const failable<R> writeATOMFeed(const lambda<const R(const // Write ATOM entries const list<value> le = elementChildren(entry, l); - if (isNil(le)) + if (isNull(le)) return xml::writeElements<R>(reduce, initial, mklist<value>(f)); // Write a single ATOM entry element with a list of values - if (!isNil(le) && !isNil(car(le)) && isList(car<value>(caddr<value>(car(le))))) { + if (!isNull(le) && !isNull(car(le)) && isList(car<value>(caddr<value>(car(le))))) { const list<value> fe = append(f, entriesElements(caddr<value>(car(le)))); return xml::writeElements<R>(reduce, initial, mklist<value>(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<string>)rcx.ilist)) + if (isNull((const list<string>)rcx.ilist)) return 0; const list<string> f(fragment(rcx.ilist, size * nmemb)); const string s = car(f); @@ -403,7 +403,7 @@ template<typename R> 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<string>& 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<value> evalExpr(const value& expr, const string& url, const CURLS * Find and return a header. */ const maybe<string> header(const char* const prefix, const list<string>& h) { - if (isNil(h)) + if (isNull(h)) return maybe<string>(); const string s = car(h); if (find(s, prefix) != 0) @@ -676,7 +676,7 @@ const failable<list<list<string> > > contentRequest(const value& c, unused const // Write in the format requested by the client, if any const list<value> fmt = assoc<value>("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<list<list<string> > > contentRequest(const value& c, unused const } // Write an empty list as a JSON value - if (isNil((list<value>)c)) { + if (isNull((list<value>)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<value>(c)) && !isNil(cdr<value>(c)) && isList(cadr<value>(c))) + if (isString(car<value>(c)) && !isNull(cdr<value>(c)) && isList(cadr<value>(c))) return writeRequest(convertValues<string>(cadr<value>(c)), car<value>(c)); // Write an assoc value as a JSON value - if (isSymbol(car<value>(c)) && !isNil(cdr<value>(c))) { + if (isSymbol(car<value>(c)) && !isNull(cdr<value>(c))) { debug(c, "http::contentRequest::assoc"); return writeRequest(json::writeValue(c), "application/json; charset=utf-8"); } // Write an ATOM feed or entry const list<value> e = valuesToElements(c); - if (isList(car<value>(e)) && !isNil(car<value>(e))) { + if (isList(car<value>(e)) && !isNull(car<value>(e))) { const list<value> el = car<value>(e); - if (isSymbol(car<value>(el)) && car<value>(el) == element && !isNil(cdr<value>(el)) && isSymbol(cadr<value>(el)) && elementHasChildren(el) && !elementHasValue(el)) { + if (isSymbol(car<value>(el)) && car<value>(el) == element && !isNull(cdr<value>(el)) && isSymbol(cadr<value>(el)) && elementHasChildren(el) && !elementHasValue(el)) { if (cadr<value>(el) == atom::feed) return writeRequest(atom::writeATOMFeed(e), "application/atom+xml; charset=utf-8"); if (cadr<value>(el) == atom::entry) @@ -943,14 +943,14 @@ const failable<size_t> 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<value>& args, ostringstream& os) { - if (isNil(args)) + if (isNull(args)) return os; const list<value> 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<value> pathInfo(const list<value>& uri, const list<value>& path) { - if (isNil(path)) + if (isNull(path)) return uri; return pathInfo(cdr(uri), cdr(path)); } @@ -347,14 +347,14 @@ const list<value> unescapeArgs(const list<value>& args) { const value queryArg(const string& s) { debug(s, "httpd::queryArg::string"); const list<string> t = tokenize("=", s); - if (isNil(cdr(t))) + if (isNull(cdr(t))) return mklist<value>(c_str(car(t)), emptyString); return mklist<value>(c_str(car(t)), cadr(t)); } const string fixupQueryArgs(const string& a) { const list<string> 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<value> queryArgs(const request_rec* const r) { * Converts the args received in a POST to a list of key value pairs. */ const list<value> postArgs(const list<value>& a) { - if (isNil(a)) + if (isNull(a)) return nilListValue; const list<value> l = car(a); return cons<value>(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<int> checkAuthnzProviders(const string& user, const string& pw, request_rec* const r, const list<AuthnProviderConf>& apcs) { - if(isNil(apcs)) + if(isNull(apcs)) return mkfailure<int>("Authentication failure for: " + user, HTTP_UNAUTHORIZED); const AuthnProviderConf apc = car<AuthnProviderConf>(apcs); if(apc.provider == NULL || !apc.provider->check_password) @@ -145,7 +145,7 @@ const failable<int> checkAuthnz(const string& user, const string& pw, request_re if(substr(user, 0, 1) == "/" && pw == "password") return mkfailure<int>(string("Encountered FakeBasicAuth spoof: ") + user, HTTP_UNAUTHORIZED); - if(isNil((const list<AuthnProviderConf>)dc.apcs)) { + if(isNull((const list<AuthnProviderConf>)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>(AuthnProviderConf(AUTHN_DEFAULT_PROVIDER, provider))); } @@ -181,10 +181,10 @@ const failable<value> userInfoFromCookie(const value& sid, const string& realm, const list<value> info = httpd::queryArgs(sid); debug(info, "modopenauth::userInfoFromCookie::info"); const list<value> user = assoc<value>(realm + "-user", info); - if(isNil(user)) + if(isNull(user)) return userInfoFromSession(realm, r); const list<value> pw = assoc<value>(realm + "-pw", info); - if(isNil(pw)) + if(isNull(pw)) return mkfailure<value>("Couldn't retrieve password", HTTP_UNAUTHORIZED); return value(mklist<value>(mklist<value>("realm", realm), mklist<value>("id", cadr(user)), mklist<value>("password", cadr(pw)))); } @@ -217,12 +217,12 @@ const failable<int> authenticated(const list<value>& info, request_rec* const r) // Store user info in the request const list<value> realm = assoc<value>("realm", info); - if(isNil(realm) || isNil(cdr(realm))) + if(isNull(realm) || isNull(cdr(realm))) return mkfailure<int>("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<value> id = assoc<value>("id", info); - if(isNil(id) || isNil(cdr(id))) + if(isNull(id) || isNull(cdr(id))) return mkfailure<int>("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<value>("openid_identifier", args))) + if(!isNull(assoc<value>("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<string> sessionID(const list<string>& c, const string& key) { - if (isNil(c)) + if (isNull(c)) return maybe<string>(); const string cn = cookieName(c_str(car(c))); const size_t i = find(cn, "="); if (i < length(cn)) { const list<string> kv = mklist<string>(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<int> login(const string& page, const value& ref, const value& attempt, request_rec* const r) { - const list<value> rarg = ref == string("/")? nilListValue : mklist<value>(mklist<value>("openauth_referrer", httpd::escape(httpd::url(isNil(ref)? r->uri : ref, r)))); - const list<value> aarg = isNil(attempt)? nilListValue : mklist<value>(mklist<value>("openauth_attempt", attempt)); + const list<value> rarg = ref == string("/")? nilListValue : mklist<value>(mklist<value>("openauth_referrer", httpd::escape(httpd::url(isNull(ref)? r->uri : ref, r)))); + const list<value> aarg = isNull(attempt)? nilListValue : mklist<value>(mklist<value>("openauth_attempt", attempt)); const list<value> 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<value> 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<value>& 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<value>& 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<value>& types, const list<value>& 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<value> evalClass(const JavaRuntime& jr, const value& expr, const // Lookup the Java function named as the expression operand const list<value> func = assoc<value>(car<value>(expr), jc.m); - if (isNil(func)) { + if (isNull(func)) { // The start, stop, and restart functions are optional const value fn = car<value>(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 <T> Iterable<T> append(final Object a, final Object b) { - if (isNil(a)) + if (isNull(a)) return (Iterable<T>)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 <T> Iterable<T> 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<T> cdr(); - abstract Boolean isNil(); + abstract Boolean isNull(); @Override public int size() { - return this.isNil()? 0 : 1 + ((List<T>)this.cdr()).size(); + return this.isNull()? 0 : 1 + ((List<T>)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<Object> n = list(); - assert isNil(n); + assert isNull(n); assert n.toString().equals("[]"); final Iterable<Object> 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<Object> al = new ArrayList<Object>(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<String> 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) == '<?xml'; } @@ -120,7 +120,7 @@ function parseXML(l) { */ function readXMLDocument(doc) { var root = childElements(doc); - if (isNil(root)) + if (isNull(root)) return mklist(); return mklist(readElement(car(root), childAttributes)); } @@ -133,7 +133,7 @@ function readXHTMLElement(xhtml) { function ieChildAttributes(e) { var a = filter(function(n) { // Filter out empty and internal DOM attributes - if (n.nodeType != 2 || isNil(n.nodeValue) || n.nodeValue == '') + if (n.nodeType != 2 || isNull(n.nodeValue) || n.nodeValue == '') return false; if (n.nodeName == 'contentEditable' || n.nodeName == 'maxLength' || n.nodeName == 'loop' || n.nodeName == 'start') return false; @@ -174,13 +174,13 @@ function writeXMLDocument(doc) { * Write a list of XML element and attribute tokens. */ function expandElementValues(n, l) { - if (isNil(l)) + if (isNull(l)) return l; return cons(cons(element, cons(n, car(l))), expandElementValues(n, cdr(l))); } function writeList(l, node, doc) { - if (isNil(l)) + if (isNull(l)) return node; var token = car(l); @@ -196,7 +196,7 @@ function writeList(l, node, doc) { function mkelem(tok, doc) { function xmlns(l) { - if (isNil(l)) + if (isNull(l)) return null; var t = car(l); if (isTaggedList(t, attribute)) { diff --git a/sca-cpp/trunk/modules/json/json.hpp b/sca-cpp/trunk/modules/json/json.hpp index 497624070b..caef19b835 100644 --- a/sca-cpp/trunk/modules/json/json.hpp +++ b/sca-cpp/trunk/modules/json/json.hpp @@ -58,13 +58,13 @@ public: * Returns true if a list represents a JS array. */ inline const bool isJSArray(const list<value>& 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<value>)v) && isSymbol(car<value>(v))) + if(!isNull((list<value>)v) && isSymbol(car<value>(v))) return false; } return true; @@ -94,7 +94,7 @@ inline const list<value> jsPropertiesToValues(const list<value>& 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<value> (mklist<value> (element, c_str(name), val), propertiesSoFar), o, json_object_iter_next(o, i)); if (substr(name, 0, 1) == atsign) return jsPropertiesToValues(cons<value>(mklist<value>(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<value>& 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<value>& 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<value>& l) * Return true if a list of strings contains a JSON document. */ inline const bool isJSON(const list<string>& 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<value> queryParams(const list<value>& a) { - if (isNil(a)) + if (isNull(a)) return nilListValue; const list<value> 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<int> checkAuthnzProviders(const string& user, request_rec* const r, const list<AuthnProviderConf>& apcs) { - if (isNil(apcs)) + if (isNull(apcs)) return mkfailure<int>("Authentication failure for: " + user, HTTP_UNAUTHORIZED); const AuthnProviderConf apc = car<AuthnProviderConf>(apcs); if (apc.provider == NULL || !apc.provider->check_password) @@ -122,7 +122,7 @@ const failable<int> checkAuthnz(const string& user, request_rec* const r, const if (substr(user, 0, 1) == "/") return mkfailure<int>(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>(AuthnProviderConf(AUTHN_DEFAULT_PROVIDER, provider))); } @@ -142,11 +142,11 @@ const failable<value> userInfo(const value& sid, const memcache::MemCached& mc) const failable<int> authenticated(const list<value>& userinfo, const bool check, request_rec* const r, const list<value>& scopeattrs, const list<AuthnProviderConf>& apcs) { debug(userinfo, "modoauth2::authenticated::userinfo"); - if (isNil(scopeattrs)) { + if (isNull(scopeattrs)) { // Store user id in an environment variable const list<value> id = assoc<value>("id", userinfo); - if (isNil(id) || isNil(cdr(id))) + if (isNull(id) || isNull(cdr(id))) return mkfailure<int>("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<int> authenticated(const list<value>& userinfo, const bool check, // Store each configured OAuth scope attribute in an environment variable const list<value> a = car(scopeattrs); const list<value> v = assoc<value>(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<value>("oauth_consumer_key", args))) << "\", "; const list<value> atok = assoc<value>("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<string> sign(const string& verb, const string& uri, const list<value> const failable<int> authorize(const list<value>& args, request_rec* const r, const list<value>& appkeys, const memcache::MemCached& mc) { // Extract authorize, access_token, client ID and info URIs const list<value> ref = assoc<value>("openauth_referrer", args); - if (isNil(ref) || isNil(cdr(ref))) + if (isNull(ref) || isNull(cdr(ref))) return mkfailure<int>("Missing openauth_referrer parameter"); const list<value> req = assoc<value>("oauth1_request_token", args); - if (isNil(req) || isNil(cdr(req))) + if (isNull(req) || isNull(cdr(req))) return mkfailure<int>("Missing oauth1_request_token parameter"); const list<value> auth = assoc<value>("oauth1_authorize", args); - if (isNil(auth) || isNil(cdr(auth))) + if (isNull(auth) || isNull(cdr(auth))) return mkfailure<int>("Missing oauth1_authorize parameter"); const list<value> tok = assoc<value>("oauth1_access_token", args); - if (isNil(tok) || isNil(cdr(tok))) + if (isNull(tok) || isNull(cdr(tok))) return mkfailure<int>("Missing oauth1_access_token parameter"); const list<value> cid = assoc<value>("oauth1_client_id", args); - if (isNil(cid) || isNil(cdr(cid))) + if (isNull(cid) || isNull(cdr(cid))) return mkfailure<int>("Missing oauth1_client_id parameter"); const list<value> info = assoc<value>("oauth1_info", args); - if (isNil(info) || isNil(cdr(info))) + if (isNull(info) || isNull(cdr(info))) return mkfailure<int>("Missing oauth1_info parameter"); // Build the redirect URI @@ -248,7 +248,7 @@ const failable<int> authorize(const list<value>& args, request_rec* const r, con // Lookup client app configuration const list<value> app = assoc<value>(cadr(cid), appkeys); - if (isNil(app) || isNil(cdr(app))) + if (isNull(app) || isNull(cdr(app))) return mkfailure<int>(string("client id not found: ") + (string)cadr(cid)); list<value> appkey = cadr(app); @@ -271,13 +271,13 @@ const failable<int> authorize(const list<value>& args, request_rec* const r, con // Retrieve the request token const list<value> conf = assoc<value>("oauth_callback_confirmed", resargs); - if (isNil(conf) || isNil(cdr(conf)) || cadr(conf) != "true") + if (isNull(conf) || isNull(cdr(conf)) || cadr(conf) != "true") return mkfailure<int>("Couldn't confirm oauth_callback"); const list<value> tv = assoc<value>("oauth_token", resargs); - if (isNil(tv) || isNil(cdr(tv))) + if (isNull(tv) || isNull(cdr(tv))) return mkfailure<int>("Couldn't retrieve oauth_token"); const list<value> sv = assoc<value>("oauth_token_secret", resargs); - if (isNil(sv) || isNil(cdr(sv))) + if (isNull(sv) || isNull(cdr(sv))) return mkfailure<int>("Couldn't retrieve oauth_token_secret"); // Store the request token in memcached @@ -301,12 +301,12 @@ const failable<list<value> > profileUserInfo(const value& cid, const string& inf if (b == "[") { // Twitter JSON profile const list<value> infov(content(json::readValue(mklist<string>(info)))); - if (isNil(infov)) + if (isNull(infov)) return mkfailure<list<value> >("Couldn't retrieve user info"); debug(infov, "modoauth1::access_token::info"); const list<value> uv = assoc<value>("user", car(infov)); debug(uv, "modoauth1::access_token::userInfo"); - if (isNil(uv) || isNil(cdr(uv))) + if (isNull(uv) || isNull(cdr(uv))) return mkfailure<list<value> >("Couldn't retrieve user info"); const list<value> iv = cdr(uv); return cons<value>(mklist<value>("realm", cid), iv); @@ -314,12 +314,12 @@ const failable<list<value> > profileUserInfo(const value& cid, const string& inf if (b == "{") { // Foursquare JSON profile const list<value> infov(content(json::readValue(mklist<string>(info)))); - if (isNil(infov)) + if (isNull(infov)) return mkfailure<list<value> >("Couldn't retrieve user info"); debug(infov, "modoauth1::access_token::info"); const list<value> uv = assoc<value>("user", infov); debug(uv, "modoauth1::access_token::userInfo"); - if (isNil(uv) || isNil(cdr(uv))) + if (isNull(uv) || isNull(cdr(uv))) return mkfailure<list<value> >("Couldn't retrieve user info"); const list<value> iv = cdr(uv); return cons<value>(mklist<value>("realm", cid), iv); @@ -327,12 +327,12 @@ const failable<list<value> > profileUserInfo(const value& cid, const string& inf if (b == "<") { // XML profile const list<value> infov = elementsToValues(content(xml::readElements(mklist<string>(info)))); - if (isNil(infov)) + if (isNull(infov)) return mkfailure<list<value> >("Couldn't retrieve user info"); debug(infov, "modoauth1::access_token::info"); const list<value> pv = car(infov); debug(pv, "modoauth1::access_token::userInfo"); - if (isNil(pv) || isNil(cdr(pv))) + if (isNull(pv) || isNull(cdr(pv))) return mkfailure<list<value> >("Couldn't retrieve user info"); const list<value> iv = cdr(pv); return cons<value>(mklist<value>("realm", cid), iv); @@ -347,27 +347,27 @@ const failable<int> accessToken(const list<value>& args, request_rec* r, const l // Extract access_token URI, client ID and verification code const list<value> ref = assoc<value>("openauth_referrer", args); - if (isNil(ref) || isNil(cdr(ref))) + if (isNull(ref) || isNull(cdr(ref))) return mkfailure<int>("Missing openauth_referrer parameter"); const list<value> tok = assoc<value>("oauth1_access_token", args); - if (isNil(tok) || isNil(cdr(tok))) + if (isNull(tok) || isNull(cdr(tok))) return mkfailure<int>("Missing oauth1_access_token parameter"); const list<value> cid = assoc<value>("oauth1_client_id", args); - if (isNil(cid) || isNil(cdr(cid))) + if (isNull(cid) || isNull(cdr(cid))) return mkfailure<int>("Missing oauth1_client_id parameter"); const list<value> info = assoc<value>("oauth1_info", args); - if (isNil(info) || isNil(cdr(info))) + if (isNull(info) || isNull(cdr(info))) return mkfailure<int>("Missing oauth1_info parameter"); const list<value> tv = assoc<value>("oauth_token", args); - if (isNil(tv) || isNil(cdr(tv))) + if (isNull(tv) || isNull(cdr(tv))) return mkfailure<int>("Missing oauth_token parameter"); const list<value> vv = assoc<value>("oauth_verifier", args); - if (isNil(vv) || isNil(cdr(vv))) + if (isNull(vv) || isNull(cdr(vv))) return mkfailure<int>("Missing oauth_verifier parameter"); // Lookup client app configuration const list<value> app = assoc<value>(cadr(cid), appkeys); - if (isNil(app) || isNil(cdr(app))) + if (isNull(app) || isNull(cdr(app))) return mkfailure<int>(string("client id not found: ") + (string)cadr(cid)); const list<value> appkey = cadr(app); @@ -395,10 +395,10 @@ const failable<int> accessToken(const list<value>& args, request_rec* r, const l // Retrieve the access token const list<value> atv = assoc<value>("oauth_token", tokresargs); - if (isNil(atv) || isNil(cdr(atv))) + if (isNull(atv) || isNull(cdr(atv))) return mkfailure<int>("Couldn't retrieve oauth_token"); const list<value> asv = assoc<value>("oauth_token_secret", tokresargs); - if (isNil(asv) || isNil(cdr(asv))) + if (isNull(asv) || isNull(cdr(asv))) return mkfailure<int>("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<value>("openid_identifier", args))) + if ((substr(string(r->uri), 0, 8) == "/oauth2/") || !isNull(assoc<value>("openid_identifier", args))) return DECLINED; r->ap_auth_type = const_cast<char*>(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<value>)sc.appkeys)) + if (isNull((list<value>)sc.appkeys)) sc.appkeys = mainsc.appkeys; - if (isNil((list<string>)sc.mcaddrs)) + if (isNull((list<string>)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<string>)sc.mcaddrs)) + if (isNull((list<string>)sc.mcaddrs)) sc.mc = *(new (gc_new<memcache::MemCached>()) memcache::MemCached("localhost", 11211)); else sc.mc = *(new (gc_new<memcache::MemCached>()) 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<int> checkAuthnzProviders(const string& user, request_rec* const r, const list<AuthnProviderConf>& apcs) { - if (isNil(apcs)) + if (isNull(apcs)) return mkfailure<int>("Authentication failure for: " + user, HTTP_UNAUTHORIZED); const AuthnProviderConf apc = car<AuthnProviderConf>(apcs); if (apc.provider == NULL || !apc.provider->check_password) @@ -116,7 +116,7 @@ const failable<int> checkAuthnz(const string& user, request_rec* const r, const if (substr(user, 0, 1) == "/") return mkfailure<int>(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>(AuthnProviderConf(AUTHN_DEFAULT_PROVIDER, provider))); } @@ -136,11 +136,11 @@ const failable<value> userInfo(const value& sid, const memcache::MemCached& mc) const failable<int> authenticated(const list<value>& userinfo, const bool check, request_rec* const r, const list<value>& scopeattrs, const list<AuthnProviderConf>& apcs) { debug(userinfo, "modoauth2::authenticated::userinfo"); - if (isNil(scopeattrs)) { + if (isNull(scopeattrs)) { // Store user id in an environment variable const list<value> id = assoc<value>("id", userinfo); - if (isNil(id) || isNil(cdr(id))) + if (isNull(id) || isNull(cdr(id))) return mkfailure<int>("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<int> authenticated(const list<value>& userinfo, const bool check, // Store each configured OAuth scope attribute in an environment variable const list<value> a = car(scopeattrs); const list<value> v = assoc<value>(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<int> authenticated(const list<value>& userinfo, const bool check, const failable<int> authorize(const list<value>& args, request_rec* const r, const list<value>& appkeys) { // Extract authorize, access_token, client ID and info URIs const list<value> ref = assoc<value>("openauth_referrer", args); - if (isNil(ref) || isNil(cdr(ref))) + if (isNull(ref) || isNull(cdr(ref))) return mkfailure<int>("Missing openauth_referrer parameter"); const list<value> auth = assoc<value>("oauth2_authorize", args); - if (isNil(auth) || isNil(cdr(auth))) + if (isNull(auth) || isNull(cdr(auth))) return mkfailure<int>("Missing oauth2_authorize parameter"); const list<value> tok = assoc<value>("oauth2_access_token", args); - if (isNil(tok) || isNil(cdr(tok))) + if (isNull(tok) || isNull(cdr(tok))) return mkfailure<int>("Missing oauth2_access_token parameter"); const list<value> cid = assoc<value>("oauth2_client_id", args); - if (isNil(cid) || isNil(cdr(cid))) + if (isNull(cid) || isNull(cdr(cid))) return mkfailure<int>("Missing oauth2_client_id parameter"); const list<value> info = assoc<value>("oauth2_info", args); - if (isNil(info) || isNil(cdr(info))) + if (isNull(info) || isNull(cdr(info))) return mkfailure<int>("Missing oauth2_info parameter"); const list<value> scope = assoc<value>("oauth2_scope", args); - if (isNil(scope) || isNil(cdr(scope))) + if (isNull(scope) || isNull(cdr(scope))) return mkfailure<int>("Missing oauth2_scope parameter"); const list<value> display = assoc<value>("oauth2_display", args); @@ -205,12 +205,12 @@ const failable<int> authorize(const list<value>& args, request_rec* const r, con // Lookup client app configuration const list<value> app = assoc<value>(cadr(cid), appkeys); - if (isNil(app) || isNil(cdr(app))) + if (isNull(app) || isNull(cdr(app))) return mkfailure<int>(string("client id not found: ") + (string)cadr(cid)); list<value> appkey = cadr(app); // Redirect to the authorize URI - const list<value> adisplay = (isNil(display) || isNil(cdr(display)))? nilListValue : mklist<value>("display", cadr(display)); + const list<value> adisplay = (isNull(display) || isNull(cdr(display)))? nilListValue : mklist<value>("display", cadr(display)); const list<value> aargs = mklist<value>(mklist<value>("response_type", "code"), mklist<value>("client_id", car(appkey)), mklist<value>("scope", cadr(scope)), adisplay, mklist<value>("redirect_uri", httpd::escape(redir)), mklist<value>("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<int> accessToken(const list<value>& args, request_rec* r, const l // Extract access_token URI, client ID and authorization code parameters const list<value> state = assoc<value>("state", args); - if (isNil(state) || isNil(cdr(state))) + if (isNull(state) || isNull(cdr(state))) return mkfailure<int>("Missing state parameter"); const list<value>& stargs = httpd::queryArgs(httpd::unescape(cadr(state))); const list<value> ref = assoc<value>("openauth_referrer", stargs); - if (isNil(ref) || isNil(cdr(ref))) + if (isNull(ref) || isNull(cdr(ref))) return mkfailure<int>("Missing openauth_referrer parameter"); const list<value> tok = assoc<value>("oauth2_access_token", stargs); - if (isNil(tok) || isNil(cdr(tok))) + if (isNull(tok) || isNull(cdr(tok))) return mkfailure<int>("Missing oauth2_access_token parameter"); const list<value> cid = assoc<value>("oauth2_client_id", stargs); - if (isNil(cid) || isNil(cdr(cid))) + if (isNull(cid) || isNull(cdr(cid))) return mkfailure<int>("Missing oauth2_client_id parameter"); const list<value> info = assoc<value>("oauth2_info", stargs); - if (isNil(info) || isNil(cdr(info))) + if (isNull(info) || isNull(cdr(info))) return mkfailure<int>("Missing oauth2_info parameter"); const list<value> code = assoc<value>("code", args); - if (isNil(code) || isNil(cdr(code))) + if (isNull(code) || isNull(cdr(code))) return mkfailure<int>("Missing code parameter"); // Lookup client app configuration const list<value> app = assoc<value>(cadr(cid), appkeys); - if (isNil(app) || isNil(cdr(app))) + if (isNull(app) || isNull(cdr(app))) return mkfailure<int>(string("client id not found: ") + (string)cadr(cid)); list<value> appkey = cadr(app); @@ -274,12 +274,12 @@ const failable<int> accessToken(const list<value>& args, request_rec* r, const l return mkfailure<int>(ftr); const value tr = content(ftr); debug(tr, "modoauth2::access_token::response"); - if (!isList(tr) || isNil(tr)) + if (!isList(tr) || isNull(tr)) return mkfailure<int>("Empty access token"); const list<value> tv = isString(car<value>(tr)) ? assoc<value>("access_token", httpd::queryArgs(join("", convertValues<string>(cadr<value>(tr))))) : assoc<value>("access_token", tr); - if (isNil(tv) || isNil(cdr(tv))) + if (isNull(tv) || isNull(cdr(tv))) return mkfailure<int>("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<value>("openid_identifier", args))) + if ((substr(string(r->uri), 0, 8) == "/oauth1/") || !isNull(assoc<value>("openid_identifier", args))) return DECLINED; r->ap_auth_type = const_cast<char*>(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<value>)sc.appkeys)) + if (isNull((list<value>)sc.appkeys)) sc.appkeys = mainsc.appkeys; - if (isNil((list<string>)sc.mcaddrs)) + if (isNull((list<string>)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<string>)sc.mcaddrs)) + if (isNull((list<string>)sc.mcaddrs)) sc.mc = *(new (gc_new<memcache::MemCached>()) memcache::MemCached("localhost", 11211)); else sc.mc = *(new (gc_new<memcache::MemCached>()) 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<value> 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<OpenCLBuffer> 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<OpenCLBuffer>& 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<OpenCLBuffer> valueToKernelArg(const value& v, const cl_uint i, c * Convert a list of values to kernel args. */ const failable<list<OpenCLBuffer>> valuesToKernelArgsListHelper(const list<value>& v, const cl_uint i, const OpenCLKernel& kernel, const OpenCLContext& cl, const cl_command_queue cq) { - if (isNil(v)) + if (isNull(v)) return list<OpenCLBuffer>(); const failable<OpenCLBuffer> 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<value> 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<value>& 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<future<bool> > submitEvals(worker& w, const int max, const int i, PyO } const bool checkEvalResults(const list<future<bool> > 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<value> entryElementValues(const list<value>& e) { const list<value> 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<value> 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<value> ld = elementChildren("description", e); return append<value>(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>(value(nilListValue + element + value("content") + elementValue(car(ld))))); } @@ -61,7 +61,7 @@ const list<value> entryElementValues(const list<value>& e) { * Convert a list of elements to a list of element values representing ATOM entries. */ const list<value> entriesElementValues(const list<value>& e) { - if (isNil(e)) + if (isNull(e)) return e; return cons<value>(entryElementValues(car(e)), entriesElementValues(cdr(e))); } @@ -80,7 +80,7 @@ const bool isRSSFeed(const list<string>& ls) { */ const failable<list<value> > readRSSEntry(const list<string>& ilist) { const list<value> e = content(xml::readElements(ilist)); - if (isNil(e)) + if (isNull(e)) return mkfailure<list<value> >("Empty entry"); return mklist<value>(entryElementValues(car(e))); } @@ -90,7 +90,7 @@ const failable<list<value> > readRSSEntry(const list<string>& ilist) { */ const failable<list<value> > readRSSFeed(const list<string>& ilist) { const list<value> f = content(xml::readElements(ilist)); - if (isNil(f)) + if (isNull(f)) return mkfailure<list<value> >("Empty feed"); const list<value> c = elementChildren("channel", car(f)); const list<value> t = elementChildren("title", car(c)); @@ -109,12 +109,12 @@ const list<value> entryElement(const list<value>& 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<value>(nilListValue + element + "item" + (nilListValue + element + "title" + title) + (nilListValue + element + "link" + id), - isNil(content)? + isNull(content)? nilListValue : mklist<value>(append<value>(nilListValue + element + "description", text? mklist<value>(elementValue(content)) : elementChildren(content)))); @@ -124,7 +124,7 @@ const list<value> entryElement(const list<value>& l) { * Convert a list of values representing RSS entries to a list of elements. */ const list<value> entriesElements(const list<value>& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons<value>(entryElement(car(l)), entriesElements(cdr(l))); } @@ -134,7 +134,7 @@ const list<value> entriesElements(const list<value>& l) { * The first two values in the list are the entry id and title. */ template<typename R> const failable<R> writeRSSEntry(const lambda<const R(const string&, const R)>& reduce, const R& initial, const list<value>& ll) { - const list<value> l = isNil(ll)? ll : (list<value>)car(ll); + const list<value> l = isNull(ll)? ll : (list<value>)car(ll); return xml::writeElements<R>(reduce, initial, mklist<value>(entryElement(l))); } @@ -150,11 +150,11 @@ const failable<list<string> > writeRSSEntry(const list<value>& l) { * The first two values in the list are the feed id and title. */ template<typename R> const failable<R> writeRSSFeed(const lambda<const R(const string&, const R)>& reduce, const R& initial, const list<value>& ll) { - const list<value> l = isNil(ll)? ll : (list<value>)car(ll); + const list<value> l = isNull(ll)? ll : (list<value>)car(ll); const list<value> 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<value> 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<value> c = nilListValue + (nilListValue + element + "title" + t) + (nilListValue + element + "link" + i) @@ -162,7 +162,7 @@ template<typename R> const failable<R> writeRSSFeed(const lambda<const R(const s // Write RSS entries const list<value> le = elementChildren(entry, l); - if (isNil(le)) { + if (isNull(le)) { const list<value> fe = nilListValue + element + "rss" + (nilListValue + attribute + "version" + "2.0") + append(nilListValue + element + "channel", c); @@ -170,7 +170,7 @@ template<typename R> const failable<R> writeRSSFeed(const lambda<const R(const s } // Write a single RSS entry element with a list of values - if (!isNil(le) && !isNil(car(le)) && isList(car<value>(caddr<value>(car(le))))) { + if (!isNull(le) && !isNull(car(le)) && isList(car<value>(caddr<value>(car(le))))) { const list<value> ce = append(c, entriesElements(caddr<value>(car(le)))); const list<value> 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<value> components(const value& l) { const list<value> cs = elementChildren("composite", l); - if (isNil(cs)) + if (isNull(cs)) return cs; return elementChildren("component", car(cs)); } @@ -50,7 +50,7 @@ const list<value> components(const value& l) { */ const list<value> promotions(const value& l) { const list<value> 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<value> nameToElementAssoc(const list<value>& l) { - if (isNil(l)) + if (isNull(l)) return l; const value e(car(l)); return cons<value>(mklist<value>(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<value> c = filter<value>(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<value>(v)), "implementation."); }; const list<value> n = filter<value>(filterImplementation, l); - if (isNil(n)) + if (isNull(n)) return nilValue; return car(n); } @@ -148,17 +148,17 @@ const list<value> bindings(const value& l) { * Returns the target of a reference. */ const value bindingsTarget(const list<value>& 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<value> referenceToTargetAssoc(const list<value>& r) { - if (isNil(r)) + if (isNull(r)) return r; const value ref(car(r)); return cons<value>(mklist<value>(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<value>& variables, const list<value> 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<value>(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<value> 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<value>& vars, const list<value>& 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<value> operands(const value& exp) { } const list<value> listOfValues(const list<value> exps, Env& env) { - if(isNil(exps)) + if(isNull(exps)) return list<value> (); 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<value>& seq) { - return isNil(cdr(seq)); + return isNull(cdr(seq)); } const value firstExp(const list<value>& seq) { @@ -151,7 +151,7 @@ const value applyProcedure(const value& procedure, list<value>& arguments) { } const value sequenceToExp(const list<value> 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<value> )exp))))) + if(!isNull(cdr(cdr(cdr((list<value> )exp))))) return car(cdr(cdr(cdr((list<value> )exp)))); return false; } @@ -201,12 +201,12 @@ const value makeIf(value predicate, value consequent, value alternative) { } const value expandClauses(const list<value>& clauses) { - if(isNil(clauses)) + if(isNull(clauses)) return false; const value first = car(clauses); const list<value> 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<value> quotedParameters(const list<value>& p) { - if (isNil(p)) + if (isNull(p)) return p; return cons<value>(mklist<value>(quoteSymbol, car(p)), quotedParameters(cdr(p))); } @@ -268,7 +268,7 @@ const list<value> quotedParameters(const list<value>& p) { * Evaluate an expression against a script provided as a list of values. */ const value evalScriptLoop(const value& expr, const list<value>& 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<list<string> > 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<value>)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<value>& args) { inline const value nullProc(const list<value>& args) { const value v(car(args)); - if (isNil(v)) + if (isNull(v)) return true; if (isList(v)) - return isNil(list<value>(v)); + return isNull(list<value>(v)); return false; } @@ -138,13 +138,13 @@ inline const value lesserProc(const list<value>& args) { } inline const value addProc(const list<value>& 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<value>& 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<value>& args) { } inline const value displayProc(const list<value>& args) { - if (isNil(args)) { + if (isNull(args)) { displayStream() << endl; return true; } @@ -171,7 +171,7 @@ inline const value displayProc(const list<value>& args) { } inline const value logProc(const list<value>& 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<future<bool> > startPost(worker& w, const int threads, const blambda& } const bool checkPost(const list<future<bool> >& r) { - if (isNil(r)) + if (isNull(r)) return true; assert(car(r) == true); return checkPost(cdr(r)); @@ -244,7 +244,7 @@ const list<pid_t> startPost(const int procs, const blambda& l) { } const bool checkPost(const list<pid_t>& 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<value> failableResult(const value& func, const list<value>& 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<lvvlambda > 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>()) lib(fpath + dynlibExt))); const failable<lvvlambda > fappl(dynlambda<const value(const list<value>&)>("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<value> failableResult(const list<value>& v) { - if (isNil(cdr(v))) + if (isNull(cdr(v))) return car(v); - return mkfailure<value>(string(cadr(v)), isNil(cddr(v))? -1 : (int)caddr(v), false); + return mkfailure<value>(string(cadr(v)), isNull(cddr(v))? -1 : (int)caddr(v), false); } /** @@ -207,7 +207,7 @@ public: // Lookup the component implementation const list<value> impl(rbtreeAssoc<value>(cname, (list<value>)impls)); - if (isNil(impl)) + if (isNull(impl)) return mkfailure<value>(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<value> aparams = cons<value>(car(params), cddr(params)); debug(uri, "modeval::implProxy::wiredByImpl::uri"); @@ -313,7 +313,7 @@ const value mkrefProxy(const value& ref, const gc_mutable_ref<list<value> >& 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<list<value> >& imp } const list<value> refProxies(const list<value>& refs, const gc_mutable_ref<list<value> >& 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<RequestConf>(currentRequest, &mod_tuscany_eval); - const value a = isNil((const list<value>)reqc.vpath)? v : car((const list<value>)reqc.vpath); + const value a = isNull((const list<value>)reqc.vpath)? v : car((const list<value>)reqc.vpath); debug(a, "modeval::appPropProxy::value"); return a; }; @@ -463,7 +463,7 @@ const value mkpropProxy(const value& prop) { } const list<value> propProxies(const list<value>& 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<value> componentToImplementationAssoc(const list<value>& c, const string& contribPath, const gc_mutable_ref<list<value> >& impls, const lvvlambda& lifecycle, const SSLConf& sslc, const int timeout) { - if (isNil(c)) + if (isNull(c)) return c; return cons<value>(mklist<value>(scdl::name(car(c)), evalComponent(contribPath, car(c), impls, lifecycle, sslc, timeout)), @@ -531,11 +531,11 @@ const failable<list<value> > getComponents(const lvvlambda& contributor, const s return mkfailure<list<value> >(val); debug(content(val), "modeval::getComponents::val"); const list<value> valc = assoc<value>(value("content"), cdr<value>(car<value>(content(val)))); - if (isNil(valc)) + if (isNull(valc)) return mkfailure<list<value> >(string("Could not get composite: ") + name); const list<value> comp = assoc<value>(value("composite"), cdr<value>(valc)); debug(comp, "modeval::getComponents::comp"); - if (isNil(comp)) + if (isNull(comp)) return mkfailure<list<value> >(string("Could not get composite: ") + name); const failable<list<string> > x = xml::writeElements(car<value>(valuesToElements(mklist<value>(mklist<value>(comp))))); if (!hasContent(x)) @@ -548,7 +548,7 @@ const failable<list<value> > getComponents(const lvvlambda& contributor, const s * Return the functions returned by the component implementations. */ const failable<list<value> > applyLifecycleExpr(const list<value>& impls, const list<value>& expr) { - if (isNil(impls)) + if (isNull(impls)) return nilListValue; // Evaluate lifecycle expression against a component implementation lambda @@ -559,7 +559,7 @@ const failable<list<value> > applyLifecycleExpr(const list<value>& 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<list<value> > nr = applyLifecycleExpr(cdr(impls), expr); @@ -577,7 +577,7 @@ const list<value> componentReferenceToTargetTree(const value& c) { } const list<value> componentReferenceToTargetAssoc(const list<value>& c) { - if (isNil(c)) + if (isNull(c)) return c; return cons<value>(componentReferenceToTargetTree(car(c)), componentReferenceToTargetAssoc(cdr(c))); } @@ -591,26 +591,26 @@ const list<value> defaultBindingURI(const string& cn, const string& sn) { } const list<value> bindingToComponentAssoc(const string& cn, const string& sn, const list<value>& b) { - if (isNil(b)) + if (isNull(b)) return b; const value uri(scdl::uri(car(b))); - if (isNil(uri)) + if (isNull(uri)) return cons<value>(mklist<value>(defaultBindingURI(cn, sn), cn), bindingToComponentAssoc(cn, sn, cdr(b))); return cons<value>(mklist<value>(pathValues(c_str(string(uri))), cn), bindingToComponentAssoc(cn, sn, cdr(b))); } const list<value> serviceToComponentAssoc(const string& cn, const list<value>& s) { - if (isNil(s)) + if (isNull(s)) return s; const string sn(scdl::name(car(s))); const list<value> btoc(bindingToComponentAssoc(cn, sn, scdl::bindings(car(s)))); - if (isNil(btoc)) + if (isNull(btoc)) return cons<value>(mklist<value>(defaultBindingURI(cn, sn), cn), serviceToComponentAssoc(cn, cdr(s))); return append<value>(btoc, serviceToComponentAssoc(cn, cdr(s))); } const list<value> uriToComponentAssoc(const list<value>& c) { - if (isNil(c)) + if (isNull(c)) return c; return append<value>(serviceToComponentAssoc(scdl::name(car(c)), scdl::services(car(c))), uriToComponentAssoc(cdr(c))); } @@ -625,7 +625,7 @@ const failable<Composite> confComponents(const string& contribPath, const string debug(vhost, "modeval::confComponents::vhost"); debug(impls, "modeval::confComponents::impls"); - const failable<list<value> > fcomps = isNil(contributor)? + const failable<list<value> > 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<Composite> confComponents(const string& contribPath, const string debug(flatten(svcs), "modeval::confComponents::svcs"); const list<value> 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<int> get(const list<value>& rpath, request_rec* const r, const lv const list<value> 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<int> get(const list<value>& 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<value> fmt = assoc<value>("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<int> get(const list<value>& rpath, request_rec* const r, const lv } // Write an empty list as a JSON value - if (isNil((list<value>)c)) { + if (isNull((list<value>)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<value>(c)) && !isNil(cdr<value>(c)) && isList(cadr<value>(c))) + if (isString(car<value>(c)) && !isNull(cdr<value>(c)) && isList(cadr<value>(c))) return httpd::writeResult(convertValues<string>(cadr<value>(c)), car<value>(c), r); // Write an assoc value as a JSON value - if (isSymbol(car<value>(c)) && !isNil(cdr<value>(c))) { + if (isSymbol(car<value>(c)) && !isNull(cdr<value>(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<value> e = valuesToElements(c); - if (isList(car<value>(e)) && !isNil(car<value>(e))) { + if (isList(car<value>(e)) && !isNull(car<value>(e))) { const list<value> el = car<value>(e); - if (isSymbol(car<value>(el)) && car<value>(el) == element && !isNil(cdr<value>(el)) && isSymbol(cadr<value>(el)) && elementHasChildren(el) && !elementHasValue(el)) { + if (isSymbol(car<value>(el)) && car<value>(el) == element && !isNull(cdr<value>(el)) && isSymbol(cadr<value>(el)) && elementHasChildren(el) && !elementHasValue(el)) { if (cadr<value>(el) == atom::feed) return httpd::writeResult(atom::writeATOMFeed(e), "application/atom+xml; charset=utf-8", r); if (cadr<value>(el) == atom::entry) @@ -829,7 +829,7 @@ const failable<int> post(const list<value>& 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<int> put(const list<value>& 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<int> patch(const list<value>& 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<int> del(const list<value>& 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<value>& 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<value> 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<value>& 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<value> 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<value> ref(rbtreeAssoc<value>(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<value>& rpath, const lis * Find a leaf matching a request path in a tree of URI paths. */ const int matchPath(const list<value>& k, const list<value>& 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<value>& k, const list<value>& p) { } const list<value> assocPath(const value& k, const list<value>& tree) { - if (isNil(tree)) + if (isNull(tree)) return tree; if (matchPath(k, car<value>(car(tree)))) return car(tree); @@ -1041,10 +1041,10 @@ int translateService(request_rec* const r, const list<value>& 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<value> 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<value>& rpath, const list< const int translateRequest(request_rec* const r, const list<value>& rpath, const list<value>& vpath, const list<value>& refs, const list<value>& svcs, const list<value>& 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<value>& 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<request_rec*> 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<value>& 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<value> 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<Composite> 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<Composite> 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<value>& rpath, request_rec* const r, const li // Get the component implementation lambda const list<value> impl(rbtreeAssoc<value>(cadr(rpath), impls)); - if (isNil(impl)) { + if (isNull(impl)) { mkfailure<int>(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<value>)reqc.rpath)) + if (isNull((const list<value>)reqc.rpath)) return HTTP_NOT_FOUND; // Get the server configuration const ServerConf& sc = httpd::serverConf<ServerConf>(r, &mod_tuscany_eval); // Handle a request targeting a component in a virtual host - if (!isNil((const list<value>)reqc.vpath)) { + if (!isNull((const list<value>)reqc.vpath)) { // Start the components in the virtual host const failable<list<value> > 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<ServerConf>(r, &mod_tuscany_eval); - if (isNil(sc.vhostc.authenticator)) { + if (isNull(sc.vhostc.authenticator)) { mkfailure<int>("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<value> hcontent = isList(hval) && !isNil(hval) && isList(car<value>(hval)) && !isNil(car<value>(hval))? assoc<value>(value("content"), cdr<value>(car<value>(hval))) : nilListValue; - const list<value> hassoc = isNil(hcontent)? nilListValue : assoc<value>(value("hash"), cdr<value>(hcontent)); - if (isNil(hassoc)) { + const list<value> hcontent = isList(hval) && !isNull(hval) && isList(car<value>(hval)) && !isNull(car<value>(hval))? assoc<value>(value("content"), cdr<value>(car<value>(hval))) : nilListValue; + const list<value> hassoc = isNull(hcontent)? nilListValue : assoc<value>(value("hash"), cdr<value>(hcontent)); + if (isNull(hassoc)) { mkfailure<int>(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<value> impl(rbtreeAssoc<value>((string)sc.vhostc.contributorName, (const list<value>)sc.compos.impls)); - if (isNil(impl)) { + if (isNull(impl)) { mkfailure<int>(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<value> impl(rbtreeAssoc<value>((string)sc.vhostc.authenticatorName, (const list<value>)sc.compos.impls)); - if (isNil(impl)) { + if (isNull(impl)) { mkfailure<int>(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<value> primitiveProcedures(const list<value>& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons<value>(mklist<value>(scheme::primitiveSymbol, car(l)), primitiveProcedures(cdr(l))); } @@ -58,7 +58,7 @@ const failable<lvvlambda > evalImplementation(const string& path, const value& i if (fail(is)) return mkfailure<lvvlambda >(string("Could not read implementation: ") + fpath); const value script = scheme::readScript(is); - if (isNil(script)) + if (isNull(script)) return mkfailure<lvvlambda >(string("Could not read implementation: ") + fpath); const list<value> pxproc = scheme::quotedParameters(primitiveProcedures(px)); @@ -68,7 +68,7 @@ const failable<lvvlambda > 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<value>(nilValue, string("Could not evaluate expression")) : mklist<value>(res); + const value val = isNull(res)? mklist<value>(nilValue, string("Could not evaluate expression")) : mklist<value>(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] != "<?xml": return False @@ -86,12 +86,12 @@ def readXML(l): # Write a list of XML element and attribute tokens def expandElementValues(n, l): - if isNil(l): + if isNull(l): return l return cons(cons(element, cons(n, car(l))), expandElementValues(n, cdr(l))) def writeList(l, xml): - if isNil(l): + if isNull(l): return xml token = car(l) if isTaggedList(token, attribute): diff --git a/sca-cpp/trunk/modules/xml/xml.hpp b/sca-cpp/trunk/modules/xml/xml.hpp index 0a04d5f90a..70747e2157 100644 --- a/sca-cpp/trunk/modules/xml/xml.hpp +++ b/sca-cpp/trunk/modules/xml/xml.hpp @@ -192,7 +192,7 @@ inline const value readToken(XMLReader& reader) { */ inline const list<value> readList(const list<value>& 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<value>(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<string>)rc.ilist)) + if (isNull((const list<string>)rc.ilist)) return 0; const list<string> 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<string>& ls) { - if (isNil(ls)) + if (isNull(ls)) return false; return substr(car(ls), 0, 5) == "<?xml"; } @@ -266,13 +266,13 @@ const char* const encoding = "UTF-8"; * Write a list of XML element or attribute tokens. */ inline const list<value> expandElementValues(const value& n, const list<value>& l) { - if (isNil(l)) + if (isNull(l)) return l; return cons<value>(value(cons<value>(element, cons<value>(n, isList(car(l))? (list<value>)car(l) : mklist(car(l))))), expandElementValues(n, cdr(l))); } inline const failable<bool> writeList(const list<value>& 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<value> 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<value>)cart; } @@ -65,7 +65,7 @@ const failable<value> post(unused const list<value>& collection, const value& it * Find an item in the cart. */ const value find(const value& id, const list<value>& cart) { - if (isNil(cart)) + if (isNull(cart)) return mklist<value>(mklist<value>("entry", mklist<value>("title", string("Item")), mklist<value>("id", "0"))); if (id == cadr<value>(caddr<value>(car(cart)))) return mklist<value>(car(cart)); @@ -76,7 +76,7 @@ const value find(const value& id, const list<value>& cart) { * Return items from the cart. */ const failable<value> get(const list<value>& id, const lvvlambda& cache) { - if (isNil(id)) + if (isNull(id)) return value(mklist<value>(append(mklist<value>("feed", mklist<value>("title", string("Your Cart")), mklist<value>("id", cartId)), getcart(cartId, cache)))); return find(car(id), getcart(cartId, cache)); } @@ -85,7 +85,7 @@ const failable<value> get(const list<value>& id, const lvvlambda& cache) { * Delete items from the cart. */ const failable<value> del(const list<value>& id, unused const lvvlambda& cache) { - if (isNil(id)) + if (isNull(id)) return cache(mklist<value>("delete", mklist<value>(cartId))); return trueValue; } @@ -101,7 +101,7 @@ const double price(const list<value>& item) { * Sum the prices of a list of items. */ const double sum(const list<value>& 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<String> 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<String> id, final Service cache) { - if(isNil(id)) { + if(isNull(id)) { final Iterable<String> 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)); } |