diff options
Diffstat (limited to 'stdlib/source/lux/host/jvm.lux')
-rw-r--r-- | stdlib/source/lux/host/jvm.lux | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/stdlib/source/lux/host/jvm.lux b/stdlib/source/lux/host/jvm.lux new file mode 100644 index 000000000..bf9688d66 --- /dev/null +++ b/stdlib/source/lux/host/jvm.lux @@ -0,0 +1,69 @@ +(.module: + [lux (#- Name) + [data + [format + ["." binary (#+ Format)]] + [collection + ["." row (#+ Row)]]]] + [/ + ["/." version (#+ Version Minor Major)] + ["/." name (#+ Name)] + ["/." access (#+ Access)] + ["/." magic (#+ Magic)] + ["/." constant (#+ Constant)] + ["/." index (#+ Index)]]) + +(type: #export Field + Any) + +(type: #export Method + Any) + +(type: #export Attribute + Any) + +(type: #export Class + {#magic Magic + #minor-version Minor + #major-version Major + #constant-pool (Row Constant) + #access-flags Access + #this Index + #super Index + #interfaces (Row Index) + #fields (Row Field) + #methods (Row Method) + #attributes (Row Attribute)}) + +(def: #export (class version access super this) + (-> Major Access Name Name Class) + {#magic /magic.code + #minor-version (/version.version 0) + #major-version version + #constant-pool (|> row.empty + (row.add (#/constant.UTF8 (/name.read this))) + (row.add (#/constant.Class (/index.index 1))) + (row.add (#/constant.UTF8 (/name.read super))) + (row.add (#/constant.Class (/index.index 3)))) + #access-flags access + #this (/index.index 2) + #super (/index.index 4) + #interfaces row.empty + #fields row.empty + #methods row.empty + #attributes row.empty}) + +(def: #export classF + (Format Class) + ($_ binary.and + /magic.format + /version.format + /version.format + (binary.row/16' 1 /constant.format) + /access.format + /index.format + /index.format + (binary.row/16 (binary.ignore (/index.index 0))) + (binary.row/16 (binary.ignore [])) + (binary.row/16 (binary.ignore [])) + (binary.row/16 (binary.ignore [])))) |