Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienos.com/blob/main/om/site/copy.om # aienos.com Source of www.aienos.com, served from my own hardware Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienos.com / om / site / copy.om` 181 lines ยท 3579 bytes Raw Blame History 1 note Checked public-tree copy and emitted-file inventory. No symlinks, private crumbs, or stale HTML. 2 note Linux ARM64 stat mode at byte 16; getdents64 record length at 16 and filename at 19. 3 note WolframLanguageEvaluator: {256*11,FromDigits["170000",8],FromDigits["040000",8],FromDigits["100000",8],FromDigits["200000",8]} -> {2816,61440,16384,32768,65536}. 4 global sxmode uchar 1 5 text sxcrumb ".crumb" 6 text sxlocal ".crumb.local" 7 text sxsuf ".html" 8 text sxindex "index.html" 9 text sxinv "inventory.txt" 10 11 text SX0001 ".well-known" 12 text SX0002 ".nojekyll" 13 text SX0003 "\n" 14 text SX0004 "site: public HTML absent from canonical registry\n" 15 text SX0005 "site: public assets must be regular files or directories\n" 16 text SX0006 "site: cannot read asset directory\n" 17 18 fn sx_private name view uchar * to bool 19 if eq len name 0 20 ret true 21 end 22 if sr_equal name sxcrumb 23 ret true 24 end 25 if sr_equal name sxlocal 26 ret true 27 end 28 if eq get name 0 46 29 if sr_equal name SX0001 30 ret false 31 end 32 if sr_equal name SX0002 33 ret false 34 end 35 ret true 36 end 37 ret false 38 end 39 40 fn sx_html path view uchar * to bool 41 if lt len path len sxsuf 42 ret false 43 end 44 ret sr_equal part path sub len path len sxsuf len sxsuf sxsuf 45 end 46 47 fn sx_registered path view uchar * to bool 48 buf = new uchar 8192 0 49 routebuf = new uchar 1024 0 50 for i ulong get stcount 0 51 if st_match i 5 path 52 ret true 53 end 54 n = st_html_path i routebuf 55 m = st_append buf stpub 0 56 m = st_append buf part routebuf 0 n m 57 if sr_equal path part buf 0 m 58 ret true 59 end 60 end 61 ret false 62 end 63 64 fn sx_file path view uchar * to void 65 dest = new uchar 8192 0 66 if eq get sxmode 0 1 67 n = add get stoutn 0 1 68 sr_raw part path n sub len path n 69 sr_raw SX0003 70 ret 71 end 72 if sx_html path 73 if not sx_registered path 74 st_fail SX0004 75 end 76 ret 77 end 78 if lt len path 7 79 trap 10 80 end 81 dn = st_append dest part path 7 sub len path 7 0 82 if si_generated part dest 0 dn 83 ret 84 end 85 if eq get sxmode 0 2 86 si_line part dest 0 dn 87 ret 88 end 89 st_copy path part dest 0 dn 90 end 91 92 fn sx_entry parent view uchar * name view uchar * depth ulong to void 93 pathbuf = new uchar 8192 0 94 statbuf = new uchar 128 0 95 n = st_append pathbuf parent 0 96 n = st_append pathbuf stslash n 97 n = st_append pathbuf name n 98 r = lstat pathbuf 0 n statbuf 0 len statbuf 99 if lt r 0 100 trap 10 101 end 102 mode = and or uint get statbuf 16 shl uint get statbuf 17 8 61440 103 if eq mode 16384 104 sx_tree part pathbuf 0 n add depth 1 105 else 106 if ne mode 32768 107 st_fail SX0005 108 end 109 sx_file part pathbuf 0 n 110 end 111 end 112 113 fn sx_record parent view uchar * entry view uchar * depth ulong to void 114 if lt len entry 20 115 trap 10 116 end 117 n = ulong 19 118 while lt n len entry bound 4096 119 if eq get entry n 0 120 break 121 end 122 n = add n 1 123 end 124 if eq n len entry 125 trap 10 126 end 127 if not sx_private part entry 19 sub n 19 128 sx_entry parent part entry 19 sub n 19 depth 129 end 130 end 131 132 fn sx_tree path view uchar * depth ulong to void 133 entries = new uchar 65536 0 134 if gt depth 16 135 trap 3 136 end 137 note arm64 O_DIRECTORY is octal 040000 (16384); generic `0200000` is O_DIRECT here. 138 fd = fopen path 0 len path 16384 0 139 if lt fd 0 140 st_fail SX0006 141 end 142 while true bound 65536 143 n = getdnts int fd entries 0 len entries 144 if lt n 0 145 trap 10 146 end 147 if eq n 0 148 break 149 end 150 p = ulong 0 151 while lt p ulong n bound 4096 152 if lt sub ulong n p 20 153 trap 10 154 end 155 size = ulong get entries add p 16 156 size = or size shl ulong get entries add p 17 8 157 if or lt size 20 gt size sub ulong n p 158 trap 10 159 end 160 sx_record path part entries p size depth 161 p = add p size 162 end 163 end 164 r = fclose int fd 165 if ne r 0 166 trap 10 167 end 168 end 169 170 fn sx_inventory to void 171 pathbuf = new uchar 8192 0 172 n = get stoutn 0 173 for i ulong n 174 put pathbuf i get stout i 175 end 176 st_open sxinv 177 put sxmode 0 1 178 sx_tree part pathbuf 0 n 0 179 sr_close 180 put sxmode 0 0 181 end