Permalink
Browse files

add a version of the core library written in winxed. Expand the setup…

….winxed to be able to build several of the libraries.
  • Loading branch information...
1 parent c93c6c4 commit d4cd396579089ac9d0600dd0cb2eb3c716720936 @Whiteknight committed Feb 26, 2011
Showing with 229 additions and 8 deletions.
  1. +15 −0 core/winxed/Error.winxed
  2. +71 −0 core/winxed/Rosella.winxed
  3. +1 −0 winxed/Distutils.winxed
  4. +142 −8 winxed/setup.winxed
View
@@ -0,0 +1,15 @@
+namespace Rosella { namespace Error {
+
+ function must_subclass(string name) {
+ throw_error("Rosella (" + name + ") : You ust use a subclass instead");
+ }
+
+ function not_implemented(string class, string func) {
+ throw_error("Rosella (" + class + "." + func + ") : Not implemented");
+ }
+
+ function throw_error(string msg) {
+ die(msg);
+ }
+
+}}
View
@@ -0,0 +1,71 @@
+namespace Rosella
+{
+ function call_parrot_method(var object, var method, var pos [slurpy], var named [slurpy,named])
+ {
+ if (method instanceof String)
+ method = find_method(object, method);
+ return method(object, pos:[flat], named:[flat,named]);
+ }
+
+ function build(var proto, var pos [slurpy], var named [slurpy, named])
+ {
+ var object;
+ if (proto instanceof 'P6protoobject') {
+ object = proto.new();
+ } else {
+ var obj_class = get_type_class(proto);
+ ${ new object, obj_class };
+ }
+
+ var method;
+ try {
+ ${ find_method method, object, "BUILD" };
+ } catch() {
+ method = null;
+ }
+ if (method != null) {
+ object.BUILD(pos:[flat], named:[flat,named]);
+ }
+ return object;
+ }
+
+ function get_type_name(var type)
+ {
+ if (type instanceof "String")
+ return type;
+
+ if (type instanceof "P6protoobject")
+ type = type.HOW().get_parrotclass(type.HOW()).get_namespace();
+ else if (type instanceof "P6metaclass")
+ type = type.get_parrotclass().get_namespace();
+ else if (type instanceof "Class")
+ type = type.get_namespace();
+ else if (type instanceof "Key")
+ ${ get_namespace type, type };
+
+ if (type instanceof "NameSpace")
+ return join("::", type.get_name());
+ int is_array = 0;
+ ${ does is_array, type, "array" };
+ if (is_array)
+ return join("::", type);
+ return string(type);
+ }
+
+ function get_type_class(var type)
+ {
+ if (type instanceof "Class")
+ return type;
+ if (type instanceof "P6metaclass")
+ return type.get_parrotclass();
+ if (type instanceof "P6protoobject")
+ return type.HOW().get_parrotclass();
+
+ if (type instanceof "String")
+ type = split("::", type);
+ var class_obj;
+ ${ get_class class_obj, type };
+ return class_obj;
+ }
+}
+
View
@@ -6,6 +6,7 @@ namespace WinxedDistutils
using register_step_before;
using static build_winxed;
+ using static clean_winxed;
register_step_before("build", build_winxed);
register_step_before("clean", clean_winxed);
setup(cmds, data);
View
@@ -1,17 +1,151 @@
function main[main](argv) {
setup_distutils();
- var data = {
- "pir_winxed" : {
- "winxed/setup.pir" : "winxed/setup.winxed"
- },
- "pbc_pir" : {
- "winxed/setup.pbc" : "winxed/setup.pir"
- }
+ var rosella = {
+ "name" : 'Rosella',
+ "abstract" : 'Utilities Library for Parrot',
+ "authority" : 'http://github.com/Whiteknight',
+ "copyright_holder" : 'Andrew Whitworth',
+ "keywords" : ["test", "tap", "xunit", "event", "container", "dependency injection"],
+ "license_type" : 'Artistic License 2.0',
+ "license_uri" : 'http://www.perlfoundation.org/artistic_license_2_0',
+ "checkout_uri" : 'git://github.com/Whiteknight/rosella.git',
+ "browser_uri" : 'git://github.com/Whiteknight/rosella',
+ "project_uri" : 'git://github.com/Whiteknight/rosella',
+ "pir_nqp-rx" : {},
+ "pir_winxed" : {},
+ "pbc_pbc" : {},
+ "pbc_pir" : {},
+ "inst_lib" : []
};
+ //var core_files = [
+ // "core/Rosella",
+ // "core/Error"
+ //];
+ //setup_nqp_lib(rosella, "rosella/core.pbc", core_files);
+
+ var core_winxed_files = [
+ "core/winxed/Rosella",
+ "core/winxed/Error"
+ ];
+ setup_winxed_lib(rosella, "rosella/core.pbc", core_winxed_files);
+
+ var action_files = [
+ "include/Core",
+ "action/Action",
+ "action/ActionArg"
+ ];
+ setup_nqp_lib(rosella, "rosella/action.pbc", action_files);
+
+ var container_files = [
+ "include/Core",
+ "include/Action",
+ "container/Container",
+ "container/ItemBuilder",
+ "container/ObjectFactory"
+ ];
+ setup_nqp_lib(rosella, "rosella/container.pbc", container_files);
+
+// my @event_files := <
+// include/Core
+// include/Action
+// event/Event
+// event/EventManager
+// >;
+// setup_lib(%rosella, "rosella/event.pbc", @event_files);
+//
+// my @proto_files := <
+// include/Core
+// prototype/Item
+// prototype/Manager
+// >;
+// setup_lib(%rosella, "rosella/prototype.pbc", @proto_files);
+//
+// my @query_files := <
+// include/Core
+// query/Query
+// query/Provider
+// query/provider/Array
+// query/provider/Hash
+// query/Path
+// >;
+// setup_lib(%rosella, "rosella/query.pbc", @query_files);
+
+ var test_files = [
+ "include/Core",
+ "test/Builder"
+ ];
+ setup_nqp_lib(rosella, "rosella/test.pbc", test_files);
+
+ var xunit_files = [
+ "include/Core",
+ "include/Test",
+ "xunit/Assertions",
+ "xunit/Failure",
+ "xunit/Listener",
+ "xunit/Listener/TAP",
+ "xunit/Loader",
+ "xunit/Result",
+ "xunit/Suite",
+ "xunit/Testcase",
+ "xunit/UnitTestFailure"
+ ];
+ setup_nqp_lib(rosella, "rosella/xunit.pbc", xunit_files);
+
+// my @mockobject_files := <
+// include/Core
+// mockobject/Antiphon
+// mockobject/Cuckoo
+// mockobject/Cuculus
+// mockobject/MockFS
+// mockobject/Ovum
+// mockobject/SigMatcher
+// mockobject/Verifier
+// >;
+// setup_lib(%rosella, "rosella/mockobject.pbc", @mockobject_files);
+//
+// my @tap_harness_files := <
+// include/Core
+// tap_harness/Harness
+// tap_harness/Line
+// tap_harness/Loader
+// tap_harness/Output
+// tap_harness/TestFile
+// >;
+// setup_lib(%rosella, "rosella/tap_harness.pbc", @tap_harness_files);
+
+
using WinxedDistutils.winxed_setup;
argv.shift();
- winxed_setup(argv, data);
+ winxed_setup(argv, rosella);
+}
+
+function setup_nqp_lib(var rosella, string name, var files) {
+ var pbcs = [];
+ for (string path in files) {
+ string nqp_file = path + ".nqp";
+ string pir_file = path + ".pir";
+ string pbc_file = path + ".pbc";
+ rosella["pir_nqp-rx"][pir_file] = nqp_file;
+ rosella["pbc_pir"][pbc_file] = pir_file;
+ pbcs.push(pbc_file);
+ }
+ rosella["pbc_pbc"][name] = pbcs;
+ rosella["inst_lib"].push(name);
+}
+
+function setup_winxed_lib(var rosella, string name, var files) {
+ var pbcs = [];
+ for (string path in files) {
+ string winxed_file = path + ".winxed";
+ string pir_file = path + ".pir";
+ string pbc_file = path + ".pbc";
+ rosella["pir_winxed"][pir_file] = winxed_file;
+ rosella["pbc_pir"][pbc_file] = pir_file;
+ pbcs.push(pbc_file);
+ }
+ rosella["pbc_pbc"][name] = pbcs;
+ rosella["inst_lib"].push(name);
}
function setup_distutils() {

0 comments on commit d4cd396

Please sign in to comment.