From d368350ff8f93b3ccf42d0401884355b7bc29f98 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 7 Feb 2020 16:47:25 -0500 Subject: [PATCH] reorg code and work on module loading --- compile.rb | 5 +++-- example.src => lib/main.m | 2 +- lib/posix.m | 6 ++++++ lib/x11.m | 20 ++++++++++++++++++++ lib/xsel.m | 6 ++++++ 5 files changed, 36 insertions(+), 3 deletions(-) rename example.src => lib/main.m (95%) create mode 100644 lib/posix.m create mode 100644 lib/x11.m create mode 100644 lib/xsel.m diff --git a/compile.rb b/compile.rb index 0cd437b..2380530 100755 --- a/compile.rb +++ b/compile.rb @@ -576,6 +576,7 @@ class Package parse = Parser.new(path) @name = parse.module() @imports = parse.imports() +p @imports @definitions = parse.definitions() end @@ -591,5 +592,5 @@ class Package end end -pkg = Package.new("example.src") -pkg.dump() +pkg = Package.new("lib/main.m") +#pkg.dump() diff --git a/example.src b/lib/main.m similarity index 95% rename from example.src rename to lib/main.m index a74f835..161f91a 100644 --- a/example.src +++ b/lib/main.m @@ -23,7 +23,7 @@ $main(args : [String]) : Int X11.init(x) X11.mkwin(x, 1, 1, X11.PropertyChangeMask) XSel.init(x) - X11.loop(x, nil) + X11.loop(x) return 0 } diff --git a/lib/posix.m b/lib/posix.m new file mode 100644 index 0000000..9186ada --- /dev/null +++ b/lib/posix.m @@ -0,0 +1,6 @@ +module Posix +imports () + +$exec(cmd : [String]) +{ +} diff --git a/lib/x11.m b/lib/x11.m new file mode 100644 index 0000000..667e06b --- /dev/null +++ b/lib/x11.m @@ -0,0 +1,20 @@ +module X11 +imports () + +$PropertyChangeMask : int = 42; + +$Config is { + foo = bar +} + +$init(x : Config) +{ +} + +$mkwin(x : Config, w : int, h : int, mask : int) +{ +} + +$loop(x : Config) +{ +} \ No newline at end of file diff --git a/lib/xsel.m b/lib/xsel.m new file mode 100644 index 0000000..6510df0 --- /dev/null +++ b/lib/xsel.m @@ -0,0 +1,6 @@ +module XSel +imports (X11) + +$init(x : X11.Config) +{ +} -- 2.52.0