Permalink
Browse files

GPSEE mostly working

  • Loading branch information...
1 parent a5781c2 commit b44de778abdadbe9205639e16b4753c74d65d611 @cadorn cadorn committed Sep 21, 2011
View
@@ -3,4 +3,5 @@
.pinf-*
*.local.*
/.build/
-/node_modules/
+/node_modules/
+.*.jsc
View
@@ -32,9 +32,29 @@ OSX 10.7:
make build
sudo make install
-
Make sure GPSEE is available and working:
gsr -h
gsr -f ./scripts/helloworld.js
./scripts/helloworld
+
+Usage
+=====
+
+ gsr -f ../../pinf-loader.js -- -v ../HelloWorld
+
+If the above does not work, ensure it works with nodejs first:
+
+ node ../../pinf-loader.js ../HelloWorld
+
+
+Development
+===========
+
+Updating GPSEE:
+
+ cd ./gpsee
+ hg pull
+ hg update
+ make build
+ sudo make install
@@ -0,0 +1,6 @@
+var ffi = require('gffi');
+['S_IFREG','S_IFDIR','O_RDONLY'].forEach(function(mac){
+ ['std','gpsee'].forEach(function(group){
+ print(group+'.'+mac+' = '+ffi[group][mac])
+ })
+});
@@ -0,0 +1,117 @@
+// Authors:
+// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
+
+// @see http://ringojs.org/api/v0.8/
+
+var API;
+
+var SYSTEM = require("system"),
+ FS_BASE = require("fs-base");
+
+exports.init = function(api)
+{
+ API = api;
+
+ api.ENV.platform = "gpsee";
+
+ var platformModules = {};
+
+ api.ENV.platformRequire = function(id)
+ {
+ throw new Error("ENV.platformRequire not implemented!");
+ };
+
+ api.ENV.verifyNativeModuleIdentifier = function(pkg, moduleIdentifier, args)
+ {
+ throw new Error("ENV.verifyNativeModuleIdentifier not implemented!");
+ }
+
+ // TODO: Get OS name
+ api.SYSTEM.os = "NYI-OS";
+
+ api.SYSTEM.pwd = "/pinf/workspaces/github.com/pinf/loader-js/demos/GPSEE"; //FS_BASE.workingDirectory();
+
+ api.ENV.loaderRoot = API.FILE.dirname(API.FILE.dirname(API.FILE.dirname(API.FILE.dirname(module.id))));
+
+ api.SYSTEM.env = SYSTEM.env;
+
+ if (typeof api.SYSTEM.print == "undefined")
+ {
+ api.SYSTEM.print = api.SYSTEM.plainPrint(function(msg)
+ {
+ print(msg);
+// print((""+msg).replace(/\n$/, ""));
+ });
+ }
+
+ api.SYSTEM.formatErrorStack = function(e)
+ {
+ return e.stack;
+ }
+
+ api.SYSTEM.parseArgs(SYSTEM.args);
+
+ api.SYSTEM.exec = null;
+
+/*
+ api.UTIL.setTimeout = function(callback, timeout)
+ {
+ callback();
+ };
+*/
+
+ api.UTIL.eval = function(code, scope, file, line)
+ {
+ with(scope)
+ {
+ eval(code);
+ }
+ };
+
+ /*
+ api.FILE.normalizePath = function(path)
+ {
+ return path;
+ }
+ */
+
+ api.FILE.exists = function(filename)
+ {
+ return FS_BASE.exists(filename);
+ }
+
+ api.FILE.isFile = function(filename)
+ {
+ return FS_BASE.isFile(filename);
+ }
+
+ api.FILE.read = function(filename, encoding)
+ {
+ return ""+FS_BASE.openRaw(filename, {
+ read: true
+ }).read();
+ }
+
+ api.FILE.mkdirs = function(filename)
+ {
+ throw new Error("NYI - FILE.mkdirs");
+ }
+
+ api.FILE.write = function(filename, data, encoding)
+ {
+ throw new Error("NYI - FILE.write");
+ }
+ api.FILE.rename = function(from, to)
+ {
+ throw new Error("NYI - FILE.rename");
+ }
+
+ api.NET.download = function(url, path, callback)
+ {
+ throw new Error("NYI - NET.download");
+ }
+
+ api.JSON.parse = JSON.parse;
+ api.JSON.stringify = JSON.stringify;
+}
+
@@ -56,8 +56,6 @@ exports.init = function(api)
api.SYSTEM.exec = null;
- var sandbox;
-
api.UTIL.setTimeout = SCHEDULER.setTimeout;
api.UTIL.eval = function(code, scope, file, line)
@@ -31,8 +31,9 @@ Plugin.prototype.init = function()
id = id.replace(/^\w*!/, "");
- var parts = id.split("@/"),
- id = parts[0];
+ var parts = id.split("@/");
+
+ id = parts[0];
if (/@$/.test(id))
id = id.substring(0, id.length-1);
@@ -215,7 +216,7 @@ Plugin.prototype.init = function()
Plugin.prototype.requireModule = function(id)
{
if (!id)
- return;
+ return false;
// The text plugins need special handeling
if (id.match(/^text!/))
@@ -229,6 +230,7 @@ Plugin.prototype.requireModule = function(id)
}
return true;
}
+ return false;
}
Plugin.prototype.newRequire = function(helpers)
@@ -252,7 +254,7 @@ Plugin.prototype.newRequire = function(helpers)
{
callback(newRequire(id));
});
- return;
+ return false;
}
if (helpers.deps && helpers.deps[moduleIdentifier])
return helpers.deps[moduleIdentifier]();
@@ -411,9 +413,9 @@ Plugin.prototype.normalizeLocator = function(locator, context)
locator.location = locator.location.substring(0, locator.location.length -1);
if (typeof locator.location != "undefined") {
- var context = this.bravojs.contextForId(locator.location);
- if(context && context.uid) {
- locator.uid = context.uid;
+ var newContext = this.bravojs.contextForId(locator.location);
+ if(newContext && newContext.uid) {
+ locator.uid = newContext.uid;
}
}
@@ -494,11 +496,11 @@ Plugin.prototype.normalizeModuleIdentifier = function(moduleIdentifier, relative
if (typeof moduleIdentifier.descriptor != "undefined" && typeof moduleIdentifier.descriptor.main != "undefined")
return finalNormalization(this.bravojs.realpath(id + "@/" + moduleIdentifier.descriptor.main, false));
- var context = this.bravojs.contextForId(id);
- if (typeof context.descriptor == "undefined" || typeof context.descriptor.main == "undefined")
- throw new Error("'main' property not set in package descriptor for: " + context.id);
+ var newContext = this.bravojs.contextForId(id);
+ if (typeof newContext.descriptor == "undefined" || typeof newContext.descriptor.main == "undefined")
+ throw new Error("'main' property not set in package descriptor for: " + newContext.id);
- return finalNormalization(this.bravojs.realpath(context.id + "@/" + context.descriptor.main, false));
+ return finalNormalization(this.bravojs.realpath(newContext.id + "@/" + newContext.descriptor.main, false));
}
// See if moduleIdentifier matches a mapping alias exactly
Oops, something went wrong.

0 comments on commit b44de77

Please sign in to comment.