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/omega-pdf/blob/main/src/main.om # omega-pdf Omega PDF: read and write PDF files in Omega 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 `omega-pdf / src / main.om` 104 lines ยท 1518 bytes Raw Blame History 1 note CLI: bounds are validated before any page indexing or output creation. 2 text musage "usage: opdf info FILE | pages FILE | text FILE [FIRST LAST] | split FILE FIRST LAST OUT | merge OUT A [B ...]" 3 text minfo "info" 4 text mpages "pages" 5 text mtext "text" 6 text msplit "split" 7 text mmerge "merge" 8 fn musageout to void 9 pquit 1 musage 10 end 11 fn mnumber arg ulong to ulong 12 b = new uchar 24 0 13 r = argread arg b 0 24 14 if or le r 0 gt r 10 15 musageout 16 end 17 v = ulong 0 18 for i ulong ulong r bound 24 19 c = ulong get b i 20 if or lt c 48 gt c 57 21 musageout 22 end 23 v = add mul v 10 sub c 48 24 end 25 if or eq v 0 gt v 4096 26 musageout 27 end 28 ret v 29 end 30 fn mrange first ulong last ulong to void 31 if or gt first last gt last get pcount 0 32 musageout 33 end 34 end 35 fn main to int 36 b = new uchar 16 0 37 n = ulong argcnt 38 if lt n 3 39 musageout 40 end 41 r = argread 1 b 0 16 42 if le r 0 43 musageout 44 end 45 crcinit 46 tabinit 47 if tx_eq part b 0 ulong r mmerge 48 if lt n 4 49 musageout 50 end 51 wmerge 2 3 n 52 ret 0 53 end 54 if tx_eq part b 0 ulong r minfo 55 if ne n 3 56 musageout 57 end 58 popen 2 59 pinfoout 60 pclose 61 ret 0 62 end 63 if tx_eq part b 0 ulong r mpages 64 if ne n 3 65 musageout 66 end 67 popen 2 68 ppagesout 69 pclose 70 ret 0 71 end 72 if tx_eq part b 0 ulong r mtext 73 if and ne n 3 ne n 5 74 musageout 75 end 76 popen 2 77 first = ulong 1 78 last = get pcount 0 79 if eq n 5 80 first = mnumber 3 81 last = mnumber 4 82 mrange first last 83 end 84 if gt last 0 85 tpages first last 86 end 87 pclose 88 ret 0 89 end 90 if tx_eq part b 0 ulong r msplit 91 if ne n 6 92 musageout 93 end 94 first = mnumber 3 95 last = mnumber 4 96 popen 2 97 mrange first last 98 wsplit first last 5 99 pclose 100 ret 0 101 end 102 musageout 103 ret 1 104 end