diff options
author | Eduardo Julian | 2021-08-08 17:56:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-08 17:56:15 -0400 |
commit | f621a133e6e0a516c0586270fea8eaffb4829d82 (patch) | |
tree | 399396ee2f6a10df10cea9b78c51c76679b70e59 /stdlib/source/library/lux/data/format/tar.lux | |
parent | 17e7566be51df5e428a6b10e6469201a8a9468da (diff) |
No more #export magic syntax.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/format/tar.lux | 92 |
1 files changed, 53 insertions, 39 deletions
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 1f1451790..e60c13e05 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -56,28 +56,30 @@ (template [<exception> <limit> <size> <type> <in> <out> <writer> <suffix> <coercion>] - [(def: #export <limit> + [(def: .public <limit> Nat (|> ..octal_size (list.repeat <size>) (list\fold n.* 1) inc)) - (exception: #export (<exception> {value Nat}) + (exception: .public (<exception> {value Nat}) (exception.report ["Value" (%.nat value)] ["Maximum" (%.nat (dec <limit>))])) - (abstract: #export <type> + (abstract: .public <type> + {} + Nat - (def: #export (<in> value) + (def: .public (<in> value) (-> Nat (Try <type>)) (if (n.< <limit> value) (#try.Success (:abstraction value)) (exception.except <exception> [value]))) - (def: #export <out> + (def: .public <out> (-> <type> Nat) (|>> :representation)) @@ -108,7 +110,7 @@ as_big] ) -(exception: #export (wrong_character {expected Char} {actual Char}) +(exception: .public (wrong_character {expected Char} {actual Char}) (exception.report ["Expected" (%.nat expected)] ["Actual" (%.nat actual)])) @@ -152,6 +154,8 @@ (..big value))))) (abstract: Checksum + {} + Text (def: from_checksum @@ -217,12 +221,12 @@ (n.<= ..last_ascii char))) true))) -(exception: #export (not_ascii {text Text}) +(exception: .public (not_ascii {text Text}) (exception.report ["Text" (%.text text)])) -(def: #export name_size Size 31) -(def: #export path_size Size 99) +(def: .public name_size Size 31) +(def: .public path_size Size 99) (def: (un_padded string) (-> Binary (Try Binary)) @@ -241,16 +245,18 @@ (binary.slice 0 (inc end) string)))))))) (template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>] - [(abstract: #export <type> + [(abstract: .public <type> + {} + <representation> - (exception: #export (<exception> {value Text}) + (exception: .public (<exception> {value Text}) (exception.report ["Value" (%.text value)] ["Size" (%.nat (text.size value))] ["Maximum" (%.nat <size>)])) - (def: #export (<in> value) + (def: .public (<in> value) (-> <representation> (Try <type>)) (if (..ascii? value) (if (|> value (\ utf8.codec encode) binary.size (n.<= <size>)) @@ -258,7 +264,7 @@ (exception.except <exception> [value])) (exception.except ..not_ascii [value]))) - (def: #export <out> + (def: .public <out> (-> <type> <representation>) (|>> :representation)) @@ -285,7 +291,7 @@ text (\ utf8.codec decode ascii)] (<in> text))))) - (def: #export <none> + (def: .public <none> <type> (try.assumed (<in> ""))) )] @@ -297,6 +303,8 @@ (def: magic_size Size 7) (abstract: Magic + {} + Text (def: ustar (:abstraction "ustar ")) @@ -383,6 +391,8 @@ (..small_number ..device_size))) (abstract: Link_Flag + {} + Char (def: link_flag @@ -411,7 +421,7 @@ <options> ) - (exception: #export (invalid_link_flag {value Nat}) + (exception: .public (invalid_link_flag {value Nat}) (exception.report ["Value" (%.nat value)])) @@ -430,14 +440,16 @@ (exception.except ..invalid_link_flag [(.nat linkflag)])))))) ) -(abstract: #export Mode +(abstract: .public Mode + {} + Nat - (def: #export mode + (def: .public mode (-> Mode Nat) (|>> :representation)) - (def: #export (and left right) + (def: .public (and left right) (-> Mode Mode Mode) (:abstraction (i64.or (:representation left) @@ -450,7 +462,7 @@ try.assumed ..small_writer)) - (exception: #export (invalid_mode {value Nat}) + (exception: .public (invalid_mode {value Nat}) (exception.report ["Value" (%.nat value)])) @@ -472,7 +484,7 @@ ["2000" set_group_id_on_execution] ["4000" set_user_id_on_execution])] (template [<code> <name>] - [(def: #export <name> + [(def: .public <name> Mode (:abstraction (number.oct <code>)))] @@ -518,10 +530,12 @@ (list.repeat ..content_size) (list\fold n.* 1))) -(abstract: #export Content +(abstract: .public Content + {} + [Big Binary] - (def: #export (content content) + (def: .public (content content) (-> Binary (Try Content)) (do try.monad [size (..big (binary.size content))] @@ -531,35 +545,35 @@ (-> Content [Big Binary]) (|>> :representation)) - (def: #export data + (def: .public data (-> Content Binary) (|>> :representation product.right)) ) -(type: #export ID +(type: .public ID Small) -(def: #export no_id +(def: .public no_id ID (..as_small 0)) -(type: #export Owner +(type: .public Owner {#name Name #id ID}) -(type: #export Ownership +(type: .public Ownership {#user Owner #group Owner}) -(type: #export File +(type: .public File [Path Instant Mode Ownership Content]) -(type: #export Normal File) -(type: #export Symbolic_Link Path) -(type: #export Directory Path) -(type: #export Contiguous File) +(type: .public Normal File) +(type: .public Symbolic_Link Path) +(type: .public Directory Path) +(type: .public Contiguous File) -(type: #export Entry +(type: .public Entry (#Normal ..Normal) (#Symbolic_Link ..Symbolic_Link) (#Directory ..Directory) @@ -572,7 +586,7 @@ Device (try.assumed (..small 0))) -(type: #export Tar +(type: .public Tar (Row Entry)) (def: (blocks size) @@ -717,7 +731,7 @@ (def: end_of_archive_size Size (n.* 2 ..block_size)) -(def: #export writer +(def: .public writer (Writer Tar) (let [end_of_archive (binary.create ..end_of_archive_size)] (function (_ tar) @@ -727,7 +741,7 @@ tar) (format.segment ..end_of_archive_size end_of_archive))))) -(exception: #export (wrong_checksum {expected Nat} {actual Nat}) +(exception: .public (wrong_checksum {expected Nat} {actual Nat}) (exception.report ["Expected" (%.nat expected)] ["Actual" (%.nat actual)])) @@ -789,7 +803,7 @@ #major_device major_device #minor_device minor_device}))) -(exception: #export (wrong_link_flag {expected Link_Flag} {actual Link_Flag}) +(exception: .public (wrong_link_flag {expected Link_Flag} {actual Link_Flag}) (exception.report ["Expected" (%.nat (..link_flag expected))] ["Actual" (%.nat (..link_flag actual))])) @@ -854,7 +868,7 @@ (exception.assertion ..wrong_checksum [0 actual] (n.= 0 actual)))))) -(exception: #export invalid_end_of_archive) +(exception: .public invalid_end_of_archive) (def: end_of_archive_parser (Parser Any) @@ -865,7 +879,7 @@ (exception.assertion ..invalid_end_of_archive [] done?)))) -(def: #export parser +(def: .public parser (Parser Tar) (|> (<>.some entry_parser) (\ <>.monad map row.of_list) |