mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-06 17:12:50 +00:00
Beginning to remove old files.
Reviewed by me.
This commit is contained in:
1 parent
375b490678
commit
29b0aa7cde
16 files changed
-720
No files matched your search
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require '../common'
|
||||
require 'objective-j'
|
||||
require 'rake'
|
||||
require 'rake/clean'
|
||||
|
||||
|
||||
$PRODUCT = File.join($PRODUCT_DIR, 'Objective-J')
|
||||
$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'Objective-J')
|
||||
$LICENSE_PRODUCT = File.join($PRODUCT, 'LICENSE')
|
||||
|
||||
$LICENSE_FILE = File.join($HOME_DIR, 'Tools', 'Rake', 'lib', 'licenses', 'LGPL-v2.1')
|
||||
|
||||
$BROWSER_FILE = File.join($PRODUCT, 'Objective-J.js')
|
||||
$RHINO_FILE = File.join($PRODUCT, 'rhino.platform', 'Objective-J.js')
|
||||
|
||||
task :Products => [$BROWSER_FILE, $RHINO_FILE, $LICENSE_PRODUCT]
|
||||
|
||||
Files = FileList['constants.js', 'utilities.js', 'json2.js', 'runtime.js', 'dictionary.js', 'plist.js', 'file.js', 'exception.js', 'preprocess.js', 'evaluate.js', 'bootstrap.js']
|
||||
|
||||
if $CONFIGURATION == 'Debug'
|
||||
Files.add('debug.js')
|
||||
end
|
||||
|
||||
file_d $BROWSER_FILE => Files do |t|
|
||||
build_product(t.name, platform_flags(ObjectiveJ::Platform::Browser, ObjectiveJ::Platform::ObjJ))
|
||||
end
|
||||
|
||||
file_d $RHINO_FILE => Files do |t|
|
||||
flags = platform_flags(ObjectiveJ::Platform::Rhino, ObjectiveJ::Platform::ObjJ)
|
||||
flags += ' -DRHINO'
|
||||
|
||||
build_product(t.name, flags)
|
||||
end
|
||||
|
||||
#Framework in environment directory
|
||||
file_d $ENVIRONMENT_PRODUCT => [:Products] do
|
||||
rm_rf $ENVIRONMENT_PRODUCT
|
||||
cp_r($PRODUCT, $ENVIRONMENT_PRODUCT)
|
||||
end
|
||||
|
||||
file_d $LICENSE_PRODUCT => [$LICENSE_FILE] do
|
||||
cp($LICENSE_FILE, $LICENSE_PRODUCT)
|
||||
end
|
||||
|
||||
def platform_flags(*platforms)
|
||||
return '-DPLATFORMS="[' + platforms.uniq.map { |platform| '\"' + platform + '\"' }.join(', ') + ']"'
|
||||
end
|
||||
|
||||
def build_product(path, flags)
|
||||
IO.popen("gcc #{flags} -E -x c -P -", "w+") do |preprocessor|
|
||||
Files.select { |name| name.match(/\.js$/) }.each do |fileName|
|
||||
preprocessor.puts IO.read(fileName)
|
||||
end
|
||||
|
||||
preprocessor.close_write
|
||||
|
||||
File.open(path, "w") do |file|
|
||||
file.write(IO.read("header.txt") + preprocessor.read)
|
||||
end
|
||||
end
|
||||
rake abort if ($? != 0)
|
||||
end
|
||||
|
||||
task :build => [:Products, :build_subprojects, $ENVIRONMENT_PRODUCT]
|
||||
|
||||
task :clean => :clean_suprojects
|
||||
|
||||
task :clobber => :clobber_subprojects
|
||||
|
||||
subprojects = %w{Tools}
|
||||
|
||||
task :build_subprojects do
|
||||
subrake(subprojects, :build)
|
||||
end
|
||||
|
||||
task :clean_suprojects do
|
||||
subrake(subprojects, :clean)
|
||||
end
|
||||
|
||||
task :clobber_subprojects do
|
||||
subrake(subprojects, :clobber)
|
||||
end
|
||||
|
||||
#CLEAN.include() no temporary files.
|
||||
CLOBBER.include($PRODUCT, $ENVIRONMENT_PRODUCT)
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env narwhal
|
||||
|
||||
var FILE = require("file");
|
||||
|
||||
//require("jake/clean");
|
||||
require(FILE.absolute("../../common.jake"));
|
||||
|
||||
$ENVIRONMENT_NARWHAL_PRODUCT = $ENVIRONMENT_DIR
|
||||
$ENVIRONMENT_OBJJ_PRODUCT = FILE.join($ENVIRONMENT_NARWHAL_PRODUCT, 'packages', 'objj')
|
||||
|
||||
$EXECUTABLES = ['objj', 'objjc', 'cplutil'];
|
||||
|
||||
task ("build", function()
|
||||
{
|
||||
rm_rf($ENVIRONMENT_OBJJ_PRODUCT);
|
||||
cp_r("objj", $ENVIRONMENT_OBJJ_PRODUCT);
|
||||
|
||||
$EXECUTABLES.forEach(function(executable)
|
||||
{
|
||||
symlink_executable(FILE.join($ENVIRONMENT_BIN_DIR, executable));
|
||||
});
|
||||
});
|
||||
|
||||
//CLOBBER.include($ENVIRONMENT_OBJJ_PRODUCT);
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require '../../common'
|
||||
require 'objective-j'
|
||||
require 'rake'
|
||||
require 'rake/clean'
|
||||
|
||||
$ENVIRONMENT_NARWHAL_PRODUCT = $ENVIRONMENT_DIR
|
||||
$ENVIRONMENT_OBJJ_PRODUCT = File.join($ENVIRONMENT_NARWHAL_PRODUCT, 'packages', 'objj')
|
||||
|
||||
$EXECUTABLES = ['objj', 'objjc', 'cplutil']
|
||||
|
||||
task :build do
|
||||
rm_rf($ENVIRONMENT_OBJJ_PRODUCT)
|
||||
cp_r('objj', $ENVIRONMENT_OBJJ_PRODUCT)
|
||||
|
||||
$EXECUTABLES.each do |executable|
|
||||
symlink_executable File.join($ENVIRONMENT_BIN_DIR, executable)
|
||||
end
|
||||
end
|
||||
|
||||
CLOBBER.include($ENVIRONMENT_OBJJ_PRODUCT)
|
||||
Binary file not shown.
@@ -1,104 +0,0 @@
|
||||
#!/usr/bin/env narwhal
|
||||
|
||||
importClass(java.io.BufferedReader);
|
||||
importClass(java.io.FileReader);
|
||||
importClass(java.io.BufferedWriter);
|
||||
importClass(java.io.FileWriter);
|
||||
|
||||
|
||||
function printUsage()
|
||||
{
|
||||
print("this is where you say the usage");
|
||||
}
|
||||
|
||||
function main()
|
||||
{
|
||||
// FIXME: ARGS
|
||||
system.args.shift();
|
||||
|
||||
if (system.args.length < 1)
|
||||
return printUsage();
|
||||
|
||||
var allFiles = NO,
|
||||
format = nil,
|
||||
filePaths = [],
|
||||
outPath = nil,
|
||||
outExtension = nil;
|
||||
|
||||
index = 0,
|
||||
count = system.args.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var argument = system.args[index];
|
||||
|
||||
if (argument.charAt(0) === '-' && !allFiles)
|
||||
{
|
||||
if (filePaths.length > 0)
|
||||
return printUsage();
|
||||
|
||||
else if (argument === "-convert")
|
||||
format = system.args[++index];
|
||||
|
||||
else if (argument === "-o")
|
||||
outPath = system.args[++index];
|
||||
|
||||
else if (argument === "-e")
|
||||
outExtension = system.args[++index];
|
||||
|
||||
else if (argument === "--")
|
||||
allFiles = YES;
|
||||
|
||||
else if (argument === "-help")
|
||||
return printUsage();
|
||||
}
|
||||
else
|
||||
filePaths.push(system.args[index]);
|
||||
}
|
||||
|
||||
index = 0;
|
||||
count = filePaths.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
// Read the plist file
|
||||
var file = new java.io.File(filePaths[index]),
|
||||
reader = new BufferedReader(new FileReader(file)),
|
||||
fileContents = "";
|
||||
|
||||
// Get contents of the file
|
||||
while (reader.ready())
|
||||
fileContents += reader.readLine() + '\n';
|
||||
|
||||
reader.close();
|
||||
|
||||
var data = new objj_data();
|
||||
|
||||
data.string = fileContents;
|
||||
|
||||
var plistObject = new CPPropertyListCreateFromData(data);
|
||||
|
||||
if (format === "280north1")
|
||||
data = CPPropertyListCreate280NorthData(plistObject);
|
||||
|
||||
else if (format === "xml1")
|
||||
data = CPPropertyListCreateXMLData(plistObject);
|
||||
|
||||
var outFile = file;
|
||||
|
||||
if (outPath)
|
||||
outFile = new java.io.File(outPath);
|
||||
|
||||
// else if (outExtension)
|
||||
|
||||
|
||||
// Write out file
|
||||
var writer = new BufferedWriter(new FileWriter(outFile));
|
||||
|
||||
writer.write(data.string);
|
||||
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env narwhal
|
||||
|
||||
require("objj/objj").run(system.args);
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env narwhal
|
||||
|
||||
require("objj/objjc").main(system.args);
|
||||
@@ -1,23 +0,0 @@
|
||||
var objj = null;
|
||||
|
||||
function ObjectiveJLoader() {
|
||||
var loader = {};
|
||||
var factories = {};
|
||||
|
||||
loader.reload = function(topId, path) {
|
||||
if (!objj) objj = require("objj/objj");
|
||||
|
||||
//print("loading objective-j: " + topId + " (" + path + ")");
|
||||
factories[topId] = objj.make_narwhal_factory(system.fs.read(path), path);
|
||||
}
|
||||
|
||||
loader.load = function(topId, path) {
|
||||
if (!factories.hasOwnProperty(topId))
|
||||
loader.reload(topId, path);
|
||||
return factories[topId];
|
||||
}
|
||||
|
||||
return loader;
|
||||
};
|
||||
|
||||
require.loader.loaders.unshift([".j", ObjectiveJLoader()]);
|
||||
@@ -1,182 +0,0 @@
|
||||
var file = require("file"),
|
||||
readline = require("readline").readline;
|
||||
|
||||
var window = require("browser/window");
|
||||
|
||||
if (system.engine === "rhino") {
|
||||
window.__parent__ = null;
|
||||
window.__proto__ = global;
|
||||
}
|
||||
|
||||
// setup OBJJ_HOME, OBJJ_INCLUDE_PATHS, etc
|
||||
window.OBJJ_HOME = exports.OBJJ_HOME = file.resolve(module.path, "..", "..");
|
||||
|
||||
var frameworksPath = file.resolve(window.OBJJ_HOME, "lib/", "Frameworks/"),
|
||||
objectivejPath = file.resolve(frameworksPath, "Objective-J/", "rhino.platform/", "Objective-J.js");
|
||||
|
||||
window.OBJJ_INCLUDE_PATHS = [frameworksPath];
|
||||
if (system.env["OBJJ_INCLUDE_PATHS"])
|
||||
window.OBJJ_INCLUDE_PATHS = system.env["OBJJ_INCLUDE_PATHS"].split(":").concat(window.OBJJ_INCLUDE_PATHS);
|
||||
|
||||
// bring the "window" object into scope.
|
||||
// TODO: somehow make window object the top scope?
|
||||
with (window)
|
||||
{
|
||||
// read and eval Objective-J.js with the module's scope
|
||||
if (system.engine === "rhino")
|
||||
Packages.org.mozilla.javascript.Context.getCurrentContext().evaluateString(window, file.read(objectivejPath, { charset:"UTF-8" }), "Objective-J.js", 0, null);
|
||||
else
|
||||
eval(file.read(objectivejPath, { charset:"UTF-8" }));
|
||||
|
||||
// export desired variables. must eval variable name to obtain a reference.
|
||||
[
|
||||
"objj_preprocess",
|
||||
"FRAGMENT_FILE", "FRAGMENT_LOCAL",
|
||||
"MARKER_CODE", "MARKER_IMPORT_STD", "MARKER_IMPORT_LOCAL",
|
||||
"OBJJ_PREPROCESSOR_DEBUG_SYMBOLS",
|
||||
"objj_data",
|
||||
"CPPropertyListCreateData", "CPPropertyListCreateFromData",
|
||||
"kCFPropertyListXMLFormat_v1_0", "kCFPropertyList280NorthFormat_v1_0",
|
||||
"objj_dictionary"
|
||||
].forEach(function(v) {
|
||||
exports[v] = eval(v);
|
||||
});
|
||||
|
||||
// extra macros
|
||||
exports.SET_CONTEXT = function(aFragment, aContext) { aFragment.context = aContext; }
|
||||
exports.GET_CONTEXT = function(aFragment) { return aFragment.context; }
|
||||
|
||||
exports.SET_TYPE = function(aFragment, aType) { aFragment.type = aType; }
|
||||
exports.GET_TYPE = function(aFragment) { return aFragment.type; }
|
||||
|
||||
exports.GET_CODE = function(aFragment) { return aFragment.info; }
|
||||
exports.SET_CODE = function(aFragment, aCode) { aFragment.info = aCode; }
|
||||
|
||||
exports.GET_PATH = function(aFragment) { return aFragment.info; }
|
||||
exports.SET_PATH = function(aFragment, aPath) { aFragment.info = aPath; }
|
||||
|
||||
exports.GET_BUNDLE = function(aFragment) { return aFragment.bundle; }
|
||||
exports.SET_BUNDLE = function(aFragment, aBundle) { aFragment.bundle = aBundle; }
|
||||
|
||||
exports.GET_FILE = function(aFragment) { return aFragment.file; }
|
||||
exports.SET_FILE = function(aFragment, aFile) { aFragment.file = aFile; }
|
||||
|
||||
exports.IS_FILE = function(aFragment) { return (aFragment.type & FRAGMENT_FILE); }
|
||||
exports.IS_LOCAL = function(aFragment) { return (aFragment.type & FRAGMENT_LOCAL); }
|
||||
exports.IS_IMPORT = function(aFragment) { return (aFragment.type & FRAGMENT_IMPORT); }
|
||||
|
||||
/*
|
||||
objj_set_evaluator(function(code) {
|
||||
return function(OBJJ_CURRENT_BUNDLE) {
|
||||
with (window) {
|
||||
return eval("function(OBJJ_CURRENT_BUNDLE){"+code+"}");
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
// runs the objj repl or file provided in args
|
||||
exports.run = function(args)
|
||||
{
|
||||
args = args || [];
|
||||
window.args = args;
|
||||
|
||||
// FIXME: ARGS
|
||||
args.shift();
|
||||
|
||||
if (args.length > 0)
|
||||
{
|
||||
while (args.length && args[0].indexOf('-I') === 0)
|
||||
OBJJ_INCLUDE_PATHS = args.shift().substr(2).split(':').concat(OBJJ_INCLUDE_PATHS);
|
||||
|
||||
var mainFilePath = file.canonical(args.shift());
|
||||
|
||||
objj_import(mainFilePath, YES, function() {
|
||||
if (typeof main === "function")
|
||||
main.apply(main, args);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try {
|
||||
system.stdout.write("objj> ").flush();
|
||||
|
||||
var input = readline(),
|
||||
result = objj_eval(input);
|
||||
|
||||
if (result !== undefined)
|
||||
print(result);
|
||||
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
||||
require("browser/timeout").serviceTimeouts();
|
||||
}
|
||||
}
|
||||
|
||||
require("browser/timeout").serviceTimeouts();
|
||||
}
|
||||
|
||||
// synchronously evals Objective-J code
|
||||
var objj_eval = exports.objj_eval = function(code)
|
||||
{
|
||||
if (system.engine === "rhino")
|
||||
var result = Packages.org.mozilla.javascript.Context.getCurrentContext().evaluateString(window, objj_preprocess_sync(code), "objj_eval", 0, null);
|
||||
else
|
||||
var result = eval(objj_preprocess_sync(code));
|
||||
|
||||
//require("browser/timeout").serviceTimeouts();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// prepocesses Objective-J code into JavaScript, which will perform imports synchronously when eval'd
|
||||
var objj_preprocess_sync = function(code, path)
|
||||
{
|
||||
var fragments = objj_preprocess(code, new objj_bundle(), new objj_file(), OBJJ_PREPROCESSOR_DEBUG_SYMBOLS)
|
||||
|
||||
var preprocessed = [];
|
||||
|
||||
fragments.forEach(function(fragment) {
|
||||
if (fragment.type & FRAGMENT_CODE)
|
||||
preprocessed.push(fragment.info);
|
||||
else if (fragment.type & FRAGMENT_LOCAL)
|
||||
preprocessed.push("objj_import_sync('"+(path ? file.join(file.dirname(path), fragment.info) : fragment.info)+"',YES);");
|
||||
else
|
||||
preprocessed.push("objj_import_sync('"+fragment.info+"',NO);");
|
||||
});
|
||||
|
||||
return preprocessed.join("\n");
|
||||
}
|
||||
|
||||
// synchronously perform an import
|
||||
var objj_import_sync = function(pathOrPaths, isLocal)
|
||||
{
|
||||
var context = new objj_context();
|
||||
context.pushFragment(fragment_create_file(pathOrPaths, new objj_bundle(), isLocal, NULL));
|
||||
context.evaluate();
|
||||
|
||||
// HACK: need a real synchronous require
|
||||
// FIXME: this is bad. not really synchronous. shouldn't have to call serviceTimeouts.
|
||||
require("browser/timeout").serviceTimeouts();
|
||||
}
|
||||
|
||||
// creates a narwhal factory function in the objj module scope
|
||||
exports.make_narwhal_factory = function(code, path) {
|
||||
var OBJJ_CURRENT_BUNDLE = new objj_bundle();
|
||||
|
||||
var factoryText = "(function(require,exports,module,system,print){" + objj_preprocess_sync(code, path) + "/**/\n})";
|
||||
|
||||
if (system.engine === "rhino")
|
||||
return Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(window, factoryText, path, 0, null);
|
||||
else
|
||||
return eval(factoryText);
|
||||
}
|
||||
|
||||
} // end "with"
|
||||
|
||||
if (require.main == module.id)
|
||||
exports.run(system.args);
|
||||
@@ -1,169 +0,0 @@
|
||||
var FILE = require("file"),
|
||||
OS = require("os"),
|
||||
objj = require("./objj"),
|
||||
objj_preprocess = objj.objj_preprocess,
|
||||
IS_FILE = objj.IS_FILE,
|
||||
GET_CODE = objj.GET_CODE,
|
||||
IS_LOCAL = objj.IS_LOCAL,
|
||||
MARKER_IMPORT_STD = objj.MARKER_IMPORT_STD,
|
||||
MARKER_IMPORT_LOCAL = objj.MARKER_IMPORT_LOCAL,
|
||||
MARKER_CODE = objj.MARKER_CODE,
|
||||
GET_PATH = objj.GET_PATH;
|
||||
|
||||
require("objj/regexp-rhino-patch");
|
||||
|
||||
var OBJJ_PREPROCESSOR_DEBUG_SYMBOLS = exports.OBJJ_PREPROCESSOR_DEBUG_SYMBOLS = objj.OBJJ_PREPROCESSOR_DEBUG_SYMBOLS;
|
||||
var OBJJ_PREPROCESSOR_TYPE_SIGNATURES = exports.OBJJ_PREPROCESSOR_TYPE_SIGNATURES = objj.OBJJ_PREPROCESSOR_TYPE_SIGNATURES;
|
||||
var OBJJ_PREPROCESSOR_PREPROCESS = exports.OBJJ_PREPROCESSOR_PREPROCESS = 1 << 10;
|
||||
var OBJJ_PREPROCESSOR_COMPRESS = exports.OBJJ_PREPROCESSOR_COMPRESS = 1 << 11;
|
||||
var OBJJ_PREPROCESSOR_SYNTAX = exports.OBJJ_PREPROCESSOR_SYNTAX = 1 << 12;
|
||||
|
||||
var SHRINKSAFE_PATH = FILE.join(objj.OBJJ_HOME, "shrinksafe", "shrinksafe.jar"),
|
||||
RHINO_PATH = FILE.join(objj.OBJJ_HOME, "shrinksafe", "js.jar")
|
||||
|
||||
function compress(/*String*/ aCode, /*String*/ FIXME)
|
||||
{
|
||||
// FIXME: figure out why this doesn't work on Windows/Cygwin
|
||||
//var tmpFile = java.io.File.createTempFile("OBJJC", "");
|
||||
var tmpFile = new java.io.File(FIXME + ".tmp");
|
||||
tmpFile.deleteOnExit();
|
||||
tmpFile = tmpFile.getAbsolutePath();
|
||||
|
||||
FILE.write(tmpFile, aCode, { charset:"UTF-8" });
|
||||
|
||||
return OS.command(["java", "-Dfile.encoding=UTF-8", "-classpath", [RHINO_PATH, SHRINKSAFE_PATH].join(":"), "org.dojotoolkit.shrinksafe.Main", tmpFile]);
|
||||
}
|
||||
|
||||
exports.preprocess = function(inFile, outFile, flags, gccArgs)
|
||||
{
|
||||
print("Statically Preprocessing " + inFile);
|
||||
|
||||
if (flags === undefined)
|
||||
flags = OBJJ_PREPROCESSOR_PREPROCESS | OBJJ_PREPROCESSOR_SYNTAX;
|
||||
|
||||
var shouldObjjPreprocess = flags & OBJJ_PREPROCESSOR_PREPROCESS,
|
||||
shouldCheckSyntax = flags & OBJJ_PREPROCESSOR_SYNTAX,
|
||||
shouldCompress = flags & OBJJ_PREPROCESSOR_COMPRESS;
|
||||
|
||||
gccArgs = gccArgs ? gccArgs.join(" ") : "";
|
||||
|
||||
var gccCommand = "gcc -E -x c -P " + gccArgs + " " + inFile;
|
||||
|
||||
if (!shouldObjjPreprocess)
|
||||
{
|
||||
OS.system(gccCommand + " -o" + outFile);
|
||||
return;
|
||||
}
|
||||
|
||||
var gcc = OS.popen(gccCommand);
|
||||
|
||||
// Read file and preprocess it.
|
||||
var fileContents = "",
|
||||
chunk = "";
|
||||
|
||||
while (chunk = gcc.stdout.read())
|
||||
fileContents += chunk;
|
||||
|
||||
// Preprocess contents into fragments.
|
||||
var fragments = objj_preprocess(fileContents, { path : "/x" }, { path: FILE.basename(inFile) }, flags),
|
||||
preprocessed = "";
|
||||
|
||||
// Writer preprocessed fragments out.
|
||||
for (var index = 0; index < fragments.length; index++)
|
||||
{
|
||||
var fragment = fragments[index];
|
||||
|
||||
if (IS_FILE(fragment))
|
||||
preprocessed += (IS_LOCAL(fragment) ? MARKER_IMPORT_LOCAL : MARKER_IMPORT_STD) + ';' + GET_PATH(fragment).length + ';' + GET_PATH(fragment);
|
||||
else
|
||||
{
|
||||
var code = GET_CODE(fragment);
|
||||
|
||||
if (shouldCheckSyntax)
|
||||
{
|
||||
try
|
||||
{
|
||||
new Function(GET_CODE(fragment));
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
var lines = code.split("\n"),
|
||||
PAD = 3;
|
||||
|
||||
print("Syntax error in "+GET_FILE(fragment).path+
|
||||
" on preprocessed line number "+e.lineNumber+"\n"+
|
||||
"\t"+lines.slice(Math.max(0, e.lineNumber - 1 - PAD), e.lineNumber+PAD).join("\n\t"));
|
||||
|
||||
OS.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldCompress)
|
||||
{
|
||||
code = compress("function(){" + code + '}', outFile);
|
||||
|
||||
code = code.substr("function(){".length, code.length - "function(){};\n\n".length);
|
||||
}
|
||||
|
||||
preprocessed += MARKER_CODE + ';' + code.length + ';' + code;
|
||||
}
|
||||
}
|
||||
|
||||
// Write file.
|
||||
FILE.write(outFile, preprocessed, { charset: "UTF-8" });
|
||||
}
|
||||
|
||||
exports.main = function(args)
|
||||
{
|
||||
// FIXME: ARGS
|
||||
args.shift();
|
||||
|
||||
var filePaths = [],
|
||||
outFilePaths = [],
|
||||
|
||||
index = 0,
|
||||
count = args.length,
|
||||
|
||||
gccArgs = [],
|
||||
|
||||
flags = OBJJ_PREPROCESSOR_PREPROCESS | OBJJ_PREPROCESSOR_SYNTAX;
|
||||
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var argument = args[index];
|
||||
|
||||
if (argument === "-o")
|
||||
{
|
||||
if (++index < count)
|
||||
outFilePaths.push(args[index]);
|
||||
}
|
||||
|
||||
else if (argument.indexOf("-D") === 0)
|
||||
gccArgs.push(argument)
|
||||
|
||||
else if (argument.indexOf("-U") === 0)
|
||||
gccArgs.push(argument);
|
||||
|
||||
else if (argument.indexOf("-E") === 0)
|
||||
flags &= ~OBJJ_PREPROCESSOR_PREPROCESS;
|
||||
|
||||
else if (argument.indexOf("-S") === 0)
|
||||
flags &= ~OBJJ_PREPROCESSOR_SYNTAX;
|
||||
|
||||
else if (argument.indexOf("-g") === 0)
|
||||
flags |= OBJJ_PREPROCESSOR_DEBUG_SYMBOLS;
|
||||
|
||||
else if (argument.indexOf("-O") === 0)
|
||||
flags |= OBJJ_PREPROCESSOR_COMPRESS;
|
||||
|
||||
else
|
||||
filePaths.push(argument);
|
||||
}
|
||||
|
||||
for (index = 0, count = filePaths.length; index < count; ++index)
|
||||
exports.preprocess(filePaths[index], outFilePaths[index], flags, gccArgs);
|
||||
}
|
||||
|
||||
if (require.main == module.id)
|
||||
exports.main(system.args);
|
||||
@@ -1,15 +0,0 @@
|
||||
var file = require("file"),
|
||||
objj = require("./objj"),
|
||||
CPPropertyListCreateData = objj.CPPropertyListCreateData,
|
||||
kCFPropertyListXMLFormat_v1_0 = objj.kCFPropertyListXMLFormat_v1_0;
|
||||
|
||||
exports.readPlist = function(path) {
|
||||
var plistData = new objj.objj_data();
|
||||
plistData.string = file.read(path);
|
||||
return objj.CPPropertyListCreateFromData(plistData);
|
||||
}
|
||||
|
||||
exports.writePlist = function(path, plist, format) {
|
||||
format = format || objj.kCFPropertyListXMLFormat_v1_0;
|
||||
file.write(path, objj.CPPropertyListCreateData(plist, format).string);
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
var CachedRegexData = [];
|
||||
|
||||
function regexDataFromRegex(aRegex)
|
||||
{
|
||||
var source = "",
|
||||
flags = "";
|
||||
|
||||
if (typeof aRegex == "string")
|
||||
{
|
||||
if (CachedRegexData[aRegex])
|
||||
return CachedRegexData[aRegex];
|
||||
|
||||
string = aRegex;
|
||||
source = aRegex;
|
||||
}
|
||||
else
|
||||
{
|
||||
string = aRegex.toString();
|
||||
|
||||
if (CachedRegexData[string])
|
||||
return CachedRegexData[string];
|
||||
|
||||
var index = string.lastIndexOf('/');
|
||||
|
||||
source = string.substr(0, index);
|
||||
flags = string.substr(index + 1);
|
||||
}
|
||||
|
||||
source = source.replace("\\[\\^\\\\\\d\\]", ".", "g");
|
||||
source = source.replace("\\[([^\\]]*)\\\\b([^\\]]*)\\]", "[$1\\\\cH$2]", "g") // [...\b...] -> [...\cH...]
|
||||
source = source.replace("(?<!\\\\)\\{(?!\\d)", "\\\\{", "g");
|
||||
source = source.replace("(?<!(\\d,?|\\\\))\\}", "\\\\}", "g");
|
||||
|
||||
return CachedRegexData[string] = { pattern:java.util.regex.Pattern.compile(source, 0), flags:flags };
|
||||
}
|
||||
|
||||
function newMatch(regex)
|
||||
{
|
||||
var regexData = regexDataFromRegex(regex);
|
||||
|
||||
var matcher = regexData.pattern.matcher(new java.lang.String(this)),
|
||||
flags = regexData.flags;
|
||||
|
||||
if (!matcher.find())
|
||||
return [];
|
||||
|
||||
var index = matcher.start(0),
|
||||
groups = [];
|
||||
|
||||
if (flags.indexOf('g') != -1)
|
||||
{
|
||||
do
|
||||
{
|
||||
groups.push(matcher.group(0) + "");
|
||||
}
|
||||
while (matcher.find());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (index = 0; index <= matcher.groupCount(); ++index)
|
||||
{
|
||||
var group = matcher.group(index);
|
||||
|
||||
if (group != null)
|
||||
groups[index] = group;
|
||||
}
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
if (system.platform === "rhino")
|
||||
String.prototype.match = newMatch;
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "objj",
|
||||
"dependencies": ["narwhal", "jack", "browserjs"],
|
||||
"lib": "lib-js",
|
||||
"preload": ["objj/loader"],
|
||||
"description": "Objective-J and Cappuccino tools",
|
||||
"keywords": ["Objective-J", "Cappuccino"],
|
||||
"author": "280 North (http://280north.com/)",
|
||||
"contributors": [
|
||||
"Francisco Tolmasky (http://tolmasky.com/)",
|
||||
"Ross Boucher (http://rossboucher.com/)",
|
||||
"Tom Robinson (http://tlrobinson.net/)",
|
||||
"Numerous others (http://contributors.cappuccino.org/)"
|
||||
]
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user