Skip to content

Commit

Permalink
Add in a few more auto-generated include files. Change the way we bui…
Browse files Browse the repository at this point in the history
…lt utilities to allow transluding the include files instead of having to manually write forward declarations. A few other misc fixes
  • Loading branch information
Whiteknight committed Nov 20, 2011
1 parent 224ef59 commit 769de5f
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,3 +10,4 @@ src/utilities/installable_*
rosella/*.winxed
rosella/*.pir
rosella/*.pbc
rosella/installable_*
33 changes: 21 additions & 12 deletions setup.winxed
Expand Up @@ -325,22 +325,31 @@ function setup_experimental_libraries(var rosella)
function setup_utilities(var rosella)
{
var utilities = {
"winxed_repl" : "winxed_repl",
"test_all_lib" : "rosella_test_all_lib",
"test_template" : "rosella_test_template",
"mk_winxed_header" : "winxed_mk_header",
"harness" : "rosella_harness"
"winxed_repl" : ["winxed_repl", ["Core"]],
"test_all_lib" : ["rosella_test_all_lib", ["Core", "FileSystem", "Template", "CommandLine"]],
"test_template" : ["rosella_test_template", ["Core", "FileSystem", "Template", "CommandLine"]],
"mk_winxed_header" : ["winxed_mk_header", ["Core", "FileSystem", "CommandLine"]],
"harness" : ["rosella_harness", ["Core", "Harness"]]
};
string prefix = "src/utilities/";
string src_prefix = "src/utilities/";
string dest_prefix = "rosella/";
for (string util_source in utilities) {
string winxed_file = prefix + util_source + ".winxed";
string pir_file = prefix + util_source + ".pir";
string pbc_file = prefix + util_source + ".pbc";
string util = string(utilities[util_source]);

string src_file = src_prefix + util_source + ".winxed";
string dest_file_base = string(utilities[util_source][0]);
string winxed_file = dest_prefix + dest_file_base + ".winxed";
string pir_file = dest_prefix + dest_file_base + ".pir";
string pbc_file = dest_prefix + dest_file_base + ".pbc";

var files = [];
var includes = utilities[util_source][1];
for (string include in includes)
push(files, "src/include/" + include + ".winxed");
push(files, src_file);

rosella["winxed_winxed"][winxed_file] = files;
rosella["pir_winxed"][pir_file] = winxed_file;
rosella["pbc_pir"][pbc_file] = pir_file;
rosella["installable_pbc"][util] = pbc_file;
rosella["installable_pbc"][dest_file_base] = pbc_file;
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/include/CommandLine.winxed
@@ -0,0 +1,11 @@
namespace Rosella.CommandLine
{
class Arguments;
class Program;
class ProgramMode;
}

function __load_commandline[anon, load, init]()
{
Rosella.load_bytecode_file("rosella/commandline.pbc", "load");
}
39 changes: 39 additions & 0 deletions src/include/Harness.winxed
@@ -0,0 +1,39 @@
namespace Rosella.Harness
{
class FileResult;
class TapParser;
class TestExecutor;
class TestFile;
class TestRun;
class View;
extern function default_testexecutor_factory;
extern function set_testexecutor_factory;
extern function default_tapparser_factory;
extern function set_tapparser_factory;
extern function default_fileresult_factory;
extern function set_fileresult_factory;
}

namespace Rosella
{
class Harness;
}

namespace Rosella.Harness.TestFile
{
class Automatic;
class Factory;
class NQP;
class PIR;
class Winxed;
}

namespace Rosella.Harness.TestRun
{
class Factory;
}

function __load_harness[anon, load, init]()
{
Rosella.load_bytecode_file("rosella/harness.pbc", "load");
}
36 changes: 36 additions & 0 deletions src/include/Template.winxed
@@ -0,0 +1,36 @@
namespace Rosella.Template
{
class Engine;
class Context;
class Handler;
class Node;
extern function get_standard_template_file;
extern function get_standard_template_text;
}

namespace Rosella.Template.Handler
{
class Children;
class Factory;
class For;
class Repeat;
class If;
class Unless;
class Include;
class Set;
}

namespace Rosella.Template.Node
{
class Factory;
class Master;
class Logic;
class Data;
class Eval;
class Literal;
}

function __load_template[anon, load, init]()
{
Rosella.load_bytecode_file("rosella/template.pbc", "load");
}
7 changes: 0 additions & 7 deletions src/utilities/harness.winxed
@@ -1,10 +1,5 @@
// TAP Test Harness

// Forward declaration of classes.
namespace Rosella {
class Harness;
}

// Harness Main. Execute tests in directories and display results.
function harness_main(var args)
{
Expand Down Expand Up @@ -43,8 +38,6 @@ directories: (t/).
// Main function. Load in the libraries and run the test, catching errors.
function main[main](var args)
{
var rosella = load_packfile("rosella/core.pbc");
var(Rosella.initialize_rosella)("harness");
var(Rosella.Parrot.try_report)(function() {
string program_name = args.shift();
if (elements(args) == 1 && args[0] == "--help")
Expand Down
13 changes: 0 additions & 13 deletions src/utilities/mk_winxed_header.winxed
@@ -1,13 +1,3 @@
// Forward declarations.
namespace Rosella {
namespace IO {
extern function sayf;
extern function printf;
}
namespace CommandLine { class Program; }
namespace FileSystem { class FilePath; }
}

// Entry object to collect information from the packfile
class NamespaceEntry {
var classes;
Expand Down Expand Up @@ -39,9 +29,6 @@ const int PF_FLAG_LOAD = 0x20;
// Main entry point. Parse the arguments and call the main function
function main[main](var args)
{
var rosella = load_packfile("rosella/core.pbc");
var(Rosella.initialize_rosella)("commandline", "filesystem");

var p = new Rosella.CommandLine.Program(args.shift());
p.default_mode().set_function(mk_header_main)
.require_positional("libpath", 0);
Expand Down
22 changes: 0 additions & 22 deletions src/utilities/test_all_lib.winxed
@@ -1,23 +1,3 @@
// Forward declarations.
namespace Rosella
{
namespace Error { extern function invalid; }
namespace IO {
extern function sayf;
extern function printf;
}
namespace Template {
class Engine;
extern function get_standard_template_file;
}
namespace FileSystem {
class File;
class FilePath;
class Directory;
}
namespace CommandLine { class Program; }
}

// Constants.
const int SUB_FLAG_METHOD = 0x04;
const int SUB_FLAG_INIT = 0x400;
Expand Down Expand Up @@ -60,8 +40,6 @@ class NamespaceEntry
// Main entry point. Parse arguments and dispatch to the main handler
function main[main](var args)
{
var rosella = load_packfile("rosella/core.pbc");
var(Rosella.initialize_rosella)("filesystem", "template", "commandline");
var p = new Rosella.CommandLine.Program(args.shift());
p.default_mode().set_function(test_all_main)
.require_positional("language", 0)
Expand Down
12 changes: 0 additions & 12 deletions src/utilities/test_template.winxed
@@ -1,20 +1,8 @@
const string TEMPLATE_FILE_FMT = "%s.%s.template";

namespace Rosella {
namespace CommandLine { class Program; }
namespace Template { class Engine; }
namespace FileSystem {
class File;
class FilePath;
}
}

// Entry point. Parse args and dispatch
function main[main](var args)
{
var rosella = load_packfile("rosella/core.pbc");
var(Rosella.initialize_rosella)("commandline", "filesystem", "template");

var program = new Rosella.CommandLine.Program(args.shift());
program.add_mode("help").set_flag("--help").set_function(show_help);
program.add_mode("version").set_flag("--version").set_function(show_version);
Expand Down

0 comments on commit 769de5f

Please sign in to comment.