summary refs log tree commit diff stats
path: root/lib/pure/strformat.nim
Commit message (Expand)AuthorAgeFilesLines
* Markdown code blocks migration part 8 (#22478)Andrey Makarov2023-08-151-3/+6
* replace `doAssert false` with `raiseAssert` in lib, which works better with s...ringabout2023-08-111-1/+1
* line info for strformat + fix issue with typed templates (#21761)metagn2023-05-021-8/+22
* Markdown indented code blocks (#20473)Andrey Makarov2022-10-051-4/+4
* Implement Markdown definition lists (+ migration) (#20333)Andrey Makarov2022-09-111-3/+3
* string is missing formatting when calling fmt (#19780)Alfred Morgan2022-05-101-2/+2
* move assertions out of system (#19599)flywind2022-03-231-0/+4
* Fix #19107 (#19286) [backport]Tomohiro2021-12-251-2/+10
* various small documentation improvements (#18602)Miran2021-07-281-23/+23
* strformat.fmt now supports non-literal const strings (#18274)Timothee Cour2021-06-181-25/+38
* CIs: attempt to use csources_v1 (#16282)Andreas Rumpf2021-04-211-2/+2
* followup strformat PR. backslash escapes, tests, docs (#17700)shirleyquirk2021-04-121-4/+29
* [feature] add arbitrary code execution to strformat (#17694)shirleyquirk2021-04-111-9/+28
* Improve the strformat module (#17106)konsumlamm2021-02-201-180/+159
* use typeof instead type (#16962)flywind2021-02-081-3/+3
* move tests to testament (#16101)flywind2020-11-241-142/+0
* add docs and more tests for debug format strings (#14861)flywind2020-07-081-1/+46
* add debug fmt string like python's (#14808)flywind2020-06-301-2/+12
* fixes #14054 [backport:1.2] (#14061)Andreas Rumpf2020-04-301-2/+2
* fix #13218: avoid some irrelevant warnings for nim doc,rst2html,--app:lib, + ...Timothee Cour2020-03-131-2/+0
* fixes a critical times.nim bug reported on IRC [backport] (#13216)Andreas Rumpf2020-01-211-0/+3
* fix #8242, fix #12586: fix 'formatFloat' with 'precision = 0' (#12592)Miran2019-11-051-3/+2
* [feature]strformat: add 2 'fmt' macros that use specified characters instead ...Tomohiro2019-10-281-14/+25
* [backport] run nimpretty on string stuffnarimiran2019-09-301-16/+21
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-2/+2
* typoAndreas Rumpf2019-09-101-1/+1
* fixes #11723Araq2019-07-151-2/+2
* styleCheck: make the compiler and large parts of the stdlib compatible with -...Araq2019-07-101-1/+1
* fixes #1192Araq2019-04-231-0/+7
* fixes #11089Araq2019-04-231-1/+7
* strformat: minor style changesAraq2019-04-231-4/+4
* fixes another regression; the behaviour of 'array' formatting was changedAraq2019-04-151-8/+0
* fixes #11012Araq2019-04-151-28/+10
* add strformat limitations section (#10982)Arne Döring2019-04-091-0/+59
* make strformat work as NimScript againAraq2019-04-061-2/+5
* Strformat symbol binding (#10927)Arne Döring2019-04-051-135/+102
* Initial version of the hot-code reloading support for native targets (#10729)zah2019-02-261-1/+5
* New implementations of times.parse & times.format (#8094)Oscar Nihlgård2018-07-091-2/+2
* Fixes #8100 (#8101)Oscar Nihlgård2018-06-291-1/+6
* Fix strformat neg zero (#7954)skilchen2018-06-051-1/+6
* Fix strformat precision handling for strings (#7941)skilchen2018-06-041-0/+4
* fix strformat zeropadding for floats (#7934)skilchen2018-06-011-2/+20
* fixes #7749Araq2018-05-021-1/+1
* rename SomeReal to SomeFloat (#7617)Arne Döring2018-04-151-4/+4
* Improves documentation for strformat module.Dominik Picheta2018-03-011-149/+192
* fixes #7078Araq2018-01-141-111/+111
* strformat: fixes new 'fmt' templateAndreas Rumpf2018-01-131-0/+1
* strformat: introduce 'fmt' as an alias for '%'; ensure overloading resolution...Araq2018-01-121-1/+18
* rename strformat.fmt to `%` as it works better with backslash escape sequence...Araq2018-01-111-107/+107
* Add additional $ fallback to fmtOscar Nihlgård2018-01-091-1/+3
"p">; lineNum = lineNum.substr(1); /* strip off '#' */ if (lineNum.indexOf('L') == -1) { lineNum = 'L'+lineNum; } var lineElem = document.getElementById(lineNum); /* Always jump to new location even if the line was hidden inside a fold, or * we corrected the raw number to a line ID. */ if (lineElem) { lineElem.scrollIntoView(true); } return true; } if ('onhashchange' in window) { window.onhashchange = JumpToLine; } --> </script> </head> <body onload='JumpToLine();'> <a href='https://github.com/akkartik/mu/blob/master/051test.subx'>https://github.com/akkartik/mu/blob/master/051test.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Rudimentary test harness</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span>== code <span id="L4" class="LineNr"> 4 </span><span class="subxComment"># instruction effective address register displacement immediate</span> <span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span> <span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span> <span id="L7" class="LineNr"> 7 </span> <span id="L8" class="LineNr"> 8 </span><span class="SpecialChar">Entry</span>: <span class="subxComment"># manual test</span> <span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># check-ints-equal(34, 34)</span> <span id="L10" class="LineNr"> 10 </span> <span class="subxS2Comment"># . . push args</span> <span id="L11" class="LineNr"> 11 </span> 68/push <span class="Constant">&quot;error in check-ints-equal&quot;</span>/imm32 <span id="L12" class="LineNr"> 12 </span> 68/push 34/imm32 <span id="L13" class="LineNr"> 13 </span> 68/push 34/imm32 <span id="L14" class="LineNr"> 14 </span> <span class="subxS2Comment"># . . call</span> <span id="L15" class="LineNr"> 15 </span> e8/call <a href='051test.subx.html#L24'>check-ints-equal</a>/disp32 <span id="L16" class="LineNr"> 16 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L17" class="LineNr"> 17 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to esp</span> <span id="L18" class="LineNr"> 18 </span> <span class="subxComment"># syscall(exit, 0)</span> <span id="L19" class="LineNr"> 19 </span> bb/copy-to-ebx 0/imm32 <span id="L20" class="LineNr"> 20 </span> b8/copy-to-eax 1/imm32/exit <span id="L21" class="LineNr"> 21 </span> cd/syscall 0x80/imm8 <span id="L22" class="LineNr"> 22 </span> <span id="L23" class="LineNr"> 23 </span><span class="subxComment"># print msg to stderr if a != b, otherwise print &quot;.&quot;</span> <span id="L24" class="LineNr"> 24 </span><span class="subxFunction">check-ints-equal</span>: <span class="subxComment"># a : int, b : int, msg : (address array byte)</span> <span id="L25" class="LineNr"> 25 </span> <span class="subxS1Comment"># . prologue</span> <span id="L26" class="LineNr"> 26 </span> 55/push-ebp <span id="L27" class="LineNr"> 27 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span> <span id="L28" class="LineNr"> 28 </span> <span class="subxS1Comment"># . save registers</span> <span id="L29" class="LineNr"> 29 </span> 50/push-eax <span id="L30" class="LineNr"> 30 </span> 51/push-ecx <span id="L31" class="LineNr"> 31 </span> 53/push-ebx <span id="L32" class="LineNr"> 32 </span> <span class="subxComment"># load first 2 args into eax and ebx</span> <span id="L33" class="LineNr"> 33 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to eax</span> <span id="L34" class="LineNr"> 34 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to ebx</span> <span id="L35" class="LineNr"> 35 </span> <span class="subxComment"># if (eax == ebx) success</span> <span id="L36" class="LineNr"> 36 </span> 39/compare 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare eax and ebx</span> <span id="L37" class="LineNr"> 37 </span> 75/jump-if-unequal $check-ints-equal:else/disp8 <span id="L38" class="LineNr"> 38 </span> <span class="subxS1Comment"># . _write(2/stderr, '.')</span> <span id="L39" class="LineNr"> 39 </span> <span class="subxS2Comment"># . . push args</span> <span id="L40" class="LineNr"> 40 </span> 68/push <span class="Constant">&quot;.&quot;</span>/imm32 <span id="L41" class="LineNr"> 41 </span> 68/push 2/imm32/stderr <span id="L42" class="LineNr"> 42 </span> <span class="subxS2Comment"># . . call</span> <span id="L43" class="LineNr"> 43 </span> e8/call <a href='050_write.subx.html#L37'>_write</a>/disp32 <span id="L44" class="LineNr"> 44 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L45" class="LineNr"> 45 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L46" class="LineNr"> 46 </span> <span class="subxS1Comment"># . return</span> <span id="L47" class="LineNr"> 47 </span> eb/jump $check-ints-equal:end/disp8 <span id="L48" class="LineNr"> 48 </span> <span class="subxComment"># otherwise print error message</span> <span id="L49" class="LineNr"> 49 </span><span class="Constant">$check-ints-equal:else</span>: <span id="L50" class="LineNr"> 50 </span> <span class="subxS1Comment"># . _write(2/stderr, msg)</span> <span id="L51" class="LineNr"> 51 </span> <span class="subxS2Comment"># . . push args</span> <span id="L52" class="LineNr"> 52 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0x10/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+16) to ecx</span> <span id="L53" class="LineNr"> 53 </span> 51/push-ecx <span id="L54" class="LineNr"> 54 </span> 68/push 2/imm32/stderr <span id="L55" class="LineNr"> 55 </span> <span class="subxS2Comment"># . . call</span> <span id="L56" class="LineNr"> 56 </span> e8/call <a href='050_write.subx.html#L37'>_write</a>/disp32 <span id="L57" class="LineNr"> 57 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L58" class="LineNr"> 58 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L59" class="LineNr"> 59 </span> <span class="subxS1Comment"># . _write(2/stderr, Newline)</span> <span id="L60" class="LineNr"> 60 </span> <span class="subxS2Comment"># . . push args</span> <span id="L61" class="LineNr"> 61 </span> 68/push <span class="SpecialChar"><a href='051test.subx.html#L83'>Newline</a></span>/imm32 <span id="L62" class="LineNr"> 62 </span> 68/push 2/imm32/stderr <span id="L63" class="LineNr"> 63 </span> <span class="subxS2Comment"># . . call</span> <span id="L64" class="LineNr"> 64 </span> e8/call <a href='050_write.subx.html#L37'>_write</a>/disp32 <span id="L65" class="LineNr"> 65 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L66" class="LineNr"> 66 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span> <span id="L67" class="LineNr"> 67 </span> <span class="subxComment"># increment Num-test-failures</span> <span id="L68" class="LineNr"> 68 </span> ff 0/subop/increment 0/mod/indirect 5/rm32/.disp32 <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="SpecialChar"><a href='051test.subx.html#L90'>Num-test-failures</a></span>/disp32 <span class="subxComment"># increment *Num-test-failures</span> <span id="L69" class="LineNr"> 69 </span><span class="Constant">$check-ints-equal:end</span>: <span id="L70" class="LineNr"> 70 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L71" class="LineNr"> 71 </span> 5b/pop-to-ebx <span id="L72" class="LineNr"> 72 </span> 59/pop-to-ecx <span id="L73" class="LineNr"> 73 </span> 58/pop-to-eax <span id="L74" class="LineNr"> 74 </span> <span class="subxS1Comment"># . epilogue</span> <span id="L75" class="LineNr"> 75 </span> 89/copy 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 5/r32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ebp to esp</span> <span id="L76" class="LineNr"> 76 </span> 5d/pop-to-ebp <span id="L77" class="LineNr"> 77 </span> c3/return <span id="L78" class="LineNr"> 78 </span> <span id="L79" class="LineNr"> 79 </span>== data <span id="L80" class="LineNr"> 80 </span> <span id="L81" class="LineNr"> 81 </span><span class="subxComment"># length-prefixed string containing just a single newline</span> <span id="L82" class="LineNr"> 82 </span><span class="subxComment"># convenient to have when printing messages and so on</span> <span id="L83" class="LineNr"> 83 </span><span class="SpecialChar">Newline</span>: <span class="subxComment"># (ref array byte)</span> <span id="L84" class="LineNr"> 84 </span> <span class="subxComment"># size : int</span> <span id="L85" class="LineNr"> 85 </span> 1/imm32 <span id="L86" class="LineNr"> 86 </span> <span class="subxComment"># data</span> <span id="L87" class="LineNr"> 87 </span> 0a/newline <span id="L88" class="LineNr"> 88 </span> <span id="L89" class="LineNr"> 89 </span><span class="subxComment"># every test failure increments this counter</span> <span id="L90" class="LineNr"> 90 </span><span class="SpecialChar">Num-test-failures</span>: <span class="subxComment"># int</span> <span id="L91" class="LineNr"> 91 </span> 0/imm32 <span id="L92" class="LineNr"> 92 </span> <span id="L93" class="LineNr"> 93 </span><span class="subxComment"># length-prefixed string containing just a single space</span> <span id="L94" class="LineNr"> 94 </span><span class="SpecialChar">Space</span>: <span class="subxComment"># (ref array byte)</span> <span id="L95" class="LineNr"> 95 </span> <span class="subxComment"># size : int</span> <span id="L96" class="LineNr"> 96 </span> 1/imm32 <span id="L97" class="LineNr"> 97 </span> <span class="subxComment"># data</span> <span id="L98" class="LineNr"> 98 </span> 20/space <span id="L99" class="LineNr"> 99 </span> <span id="L100" class="LineNr">100 </span><span class="subxComment"># length-prefixed string containing just a single slash</span> <span id="L101" class="LineNr">101 </span><span class="SpecialChar">Slash</span>: <span class="subxComment"># (ref array byte)</span> <span id="L102" class="LineNr">102 </span> <span class="subxComment"># size : int</span> <span id="L103" class="LineNr">103 </span> 1/imm32 <span id="L104" class="LineNr">104 </span> <span class="subxComment"># data</span> <span id="L105" class="LineNr">105 </span> 2f/slash <span id="L106" class="LineNr">106 </span> <span id="L107" class="LineNr">107 </span><span class="subxS2Comment"># . . vim&#0058;nowrap:textwidth=0</span> </pre> </body> </html> <!-- vim: set foldmethod=manual : -->