summary refs log tree commit diff stats
path: root/lib/system
Commit message (Expand)AuthorAgeFilesLines
* revive #10228 (fix #9880) (#10610)Timothee Cour2019-02-132-5/+7
* Add note on channel usage with spawn (#10627) [ci skip]Federico Ceratto2019-02-131-3/+8
* sets: avoid calling countBits32 for 0 (#10619)Brent Pedersen2019-02-131-3/+3
* Move cpp exception handler from system to excpt next to the signal handler (#...cooldome2019-02-131-0/+18
* Merge branch 'devel' into araq-quirky-exceptionsAndreas Rumpf2019-02-0822-267/+593
|\
| * helpers2 now has a real nameAraq2019-02-072-1/+1
| * further system.nim cleanupsAndreas Rumpf2019-02-065-42/+31
| * system refactorings (#10559)Andreas Rumpf2019-02-0612-539/+773
| * fix #10488 GC memory leak regression (#10498)Timothee Cour2019-01-301-1/+4
| * gc: destructors is beginning to work (#10483)Andreas Rumpf2019-01-293-15/+30
| * Add link to nims.html (#10472) [ci skip]Federico Ceratto2019-01-271-0/+1
| * Increase verbosity of logGC (#10449)Matt Haggard2019-01-261-9/+16
| * gc:regions: undo the regression introducing changesAraq2019-01-251-2/+2
| * excpt.nim: code cleanup, don't produce nimFrame in -d:release modeAraq2019-01-231-21/+15
| * OutOfMemError is never raised so there is no need to check for it (produce le...Araq2019-01-231-13/+6
| * make --define:noSignalHandler compile againAraq2019-01-221-1/+1
| * Fix corner case of checked div/mod on x86 (#10406)LemonBoy2019-01-221-15/+29
| * allocators: introduce --define:nimMinHeapPages for tuning mmap calls (omg the...Andreas Rumpf2019-01-192-6/+29
| * Disable interior pointer checking by default for the Boehm GC. (#10316)Reimer Behrends2019-01-151-0/+3
| * Add stdin read support to nimscrit #3983 (#10292)genotrance2019-01-141-3/+26
| * fixes #10271 [backport]Araq2019-01-131-1/+2
| * make system.task compatible with NimScript; refs #10254Araq2019-01-131-2/+3
| * make the stdlib work with the changed docgenAraq2019-01-111-1/+1
| * add unsetControlCHook to remove a Ctrl-C hook after it was set (#7267)Vindaar2019-01-102-0/+6
| * add `isNamedTuple`; make $(1, 2) be (1, 2) instead of (Field0: 1, Field1: 2) ...Timothee Cour2019-01-082-1/+20
| * system/strmantle: avoid leaking docs to system.nim [ci skip] (#10233)alaviss2019-01-081-1/+1
| * fix system.nim documentations (#10168)alaviss2019-01-041-2/+2
| * Guard against null exception (#10162)rec2019-01-041-1/+1
* | --define:nimQuirky exception handling for Nim; in preparation of a blog postAndreas Rumpf2019-01-031-0/+2
|/
* `checkErr` now shows actual system error msg instead of unknown error (#9987)Timothee Cour2018-12-271-3/+14
* GC: avoid pathological behaviour; fixes #10040 [backport] (#10052)Andreas Rumpf2018-12-201-9/+9
* Give better error message when profiler and memProfiler used at same time (#9...Neelesh Chandola2018-12-191-0/+3
* see what breaks with a global config.nims (#10016)Andreas Rumpf2018-12-181-1/+1
|\
| * make tests green with a global config.nims fileAraq2018-12-171-1/+1
* | add `getCurrentCompilerExe` to vmops (eg allows to get nim compiler at CT); a...Timothee Cour2018-12-181-0/+1
|/
* fixes #9420Araq2018-12-161-5/+6
* timers.nim: avoid parser warningAraq2018-12-141-1/+1
* cleanup of excpt.nimAndreas Rumpf2018-12-111-1/+4
* Merge pull request #9923 from stefantalpalaru/calldepthAndreas Rumpf2018-12-111-3/+5
|\
| * replace misleading "stack overflow" message on call depth limitȘtefan Talpalaru2018-12-101-3/+5
* | refs #9880 show index and bound in lots of `index out of bounds` errorsTimothee Cour2018-12-092-1/+13
|/
* Fix fat pointers, object copying, magic double evals on JS (#9411) [backport]rec2018-12-042-3/+8
* Remove dead code (#9777)Jacek Sieka2018-11-265-147/+30
* don't raise exception in the default handler (#9783)alaviss2018-11-222-8/+8
* removes deprecated T/P typesAraq2018-11-1611-23/+2
* make testament compile again with -d:nimCoroutinesAraq2018-11-151-21/+21
* gc_common: fixes a typoAndreas Rumpf2018-11-151-19/+19
* deprecated ospaths (#9665)Andreas Rumpf2018-11-092-2/+3
* change system.nim to adhere to the style guideAraq2018-10-301-8/+8
* Implements #9434. Minimal Stacktrace for Exceptions in release mode (#9480)cooldome2018-10-281-1/+9
n> a single space> aa 0 aa # 5 # This means only color 5 in the default palette is similar to #aa00aa. fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) { var in-storage: (stream byte 0x10) var in/esi: (addr stream byte) <- address in-storage { # print prompt var x/eax: int <- draw-text-rightward screen, "Enter 3 hex bytes for r, g, b (lowercase; no 0x prefix) separated by a single space> ", 0x10/x, 0x80/xmax, 0x28/y, 3/fg/cyan, 0/bg # read line from keyboard clear-stream in { draw-cursor screen, 0x20/space var key/eax: byte <- read-key keyboard compare key, 0xa/newline break-if-= compare key, 0 loop-if-= var key2/eax: int <- copy key append-byte in, key2 var g/eax: grapheme <- copy key2 draw-grapheme-at-cursor screen, g, 0xf/fg, 0/bg move-cursor-right 0 loop } clear-screen screen # parse var a/ecx: int <- copy 0 var b/edx: int <- copy 0 var c/ebx: int <- copy 0 # a, b, c = r, g, b a, b, c <- parse in #? set-cursor-position screen, 0x10/x, 0x1a/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, a, 7/fg, 0/bg #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, b, 7/fg, 0/bg #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, c, 7/fg, 0/bg a, b, c <- hsl a, b, c # return all colors in the same quadrant in h, s and l print-nearby-colors screen, a, b, c # another metric var color/eax: int <- nearest-color-euclidean-hsl a, b, c set-cursor-position screen, 0x10/x, 0x26/y draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "nearest (euclidean, h/s/l): ", 0xf/fg, 0/bg draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen screen, color, 7/fg, 0/bg draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 0xf/fg, 0/bg draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 0/fg, color # loop } } # read exactly 3 words in a single line # Each word consists of exactly 1 or 2 hex bytes. No hex prefix. fn parse in: (addr stream byte) -> _/ecx: int, _/edx: int, _/ebx: int { # read first byte of r var tmp/eax: byte <- read-byte in { var valid?/eax: boolean <- hex-digit? tmp compare valid?, 0/false break-if-!= abort "invalid byte 0 of r" } tmp <- fast-hex-digit-value tmp var r/ecx: int <- copy tmp #? set-cursor-position 0/screen, 0x10/x, 0x10/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, r, 7/fg, 0/bg # read second byte of r tmp <- read-byte in { { var valid?/eax: boolean <- hex-digit? tmp compare valid?, 0/false } break-if-= r <- shift-left 4 tmp <- fast-hex-digit-value tmp #? { #? var foo/eax: int <- copy tmp #? set-cursor-position 0/screen, 0x10/x, 0x11/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, foo, 7/fg, 0/bg #? } r <- add tmp #? { #? set-cursor-position 0/screen, 0x10/x, 0x12/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, r, 7/fg, 0/bg #? } tmp <- read-byte in # skip space } # read first byte of g var tmp/eax: byte <- read-byte in { var valid?/eax: boolean <- hex-digit? tmp compare valid?, 0/false break-if-!= abort "invalid byte 0 of g" } tmp <- fast-hex-digit-value tmp var g/edx: int <- copy tmp #? set-cursor-position 0/screen, 0x10/x, 0x13/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, g, 7/fg, 0/bg # read second byte of g tmp <- read-byte in { { var valid?/eax: boolean <- hex-digit? tmp compare valid?, 0/false } break-if-= g <- shift-left 4 tmp <- fast-hex-digit-value tmp #? { #? var foo/eax: int <- copy tmp #? set-cursor-position 0/screen, 0x10/x, 0x14/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, foo, 7/fg, 0/bg #? } g <- add tmp #? { #? set-cursor-position 0/screen, 0x10/x, 0x15/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, g, 7/fg, 0/bg #? } tmp <- read-byte in # skip space } # read first byte of b var tmp/eax: byte <- read-byte in { var valid?/eax: boolean <- hex-digit? tmp compare valid?, 0/false break-if-!= abort "invalid byte 0 of b" } tmp <- fast-hex-digit-value tmp var b/ebx: int <- copy tmp #? set-cursor-position 0/screen, 0x10/x, 0x16/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, b, 7/fg, 0/bg # read second byte of b { { var done?/eax: boolean <- stream-empty? in compare done?, 0/false } break-if-!= tmp <- read-byte in { var valid?/eax: boolean <- hex-digit? tmp compare valid?, 0/false } break-if-= b <- shift-left 4 tmp <- fast-hex-digit-value tmp #? { #? var foo/eax: int <- copy tmp #? set-cursor-position 0/screen, 0x10/x, 0x17/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, foo, 7/fg, 0/bg #? } b <- add tmp #? { #? set-cursor-position 0/screen, 0x10/x, 0x18/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, b, 7/fg, 0/bg #? } } return r, g, b } # no error checking fn fast-hex-digit-value in: byte -> _/eax: byte { var result/eax: byte <- copy in compare result, 0x39 { break-if-> result <- subtract 0x30/0 return result } result <- subtract 0x61/a result <- add 0xa/10 return result } fn print-nearby-colors screen: (addr screen), h: int, s: int, l: int { #? set-cursor-position screen, 0x10/x, 0x1c/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, h, 7/fg, 0/bg #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, s, 7/fg, 0/bg #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, l, 7/fg, 0/bg # save just top 2 bits of each, so that we narrow down to 1/64th of the volume shift-right h, 6 shift-right s, 6 shift-right l, 6 #? set-cursor-position screen, 0x10/x, 0x1/y #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, h, 7/fg, 0/bg #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, s, 7/fg, 0/bg #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, l, 7/fg, 0/bg var a/ecx: int <- copy 0 var b/edx: int <- copy 0 var c/ebx: int <- copy 0 var color/eax: int <- copy 0 var y/esi: int <- copy 2 { compare color, 0x100 break-if->= a, b, c <- color-rgb color a, b, c <- hsl a, b, c a <- shift-right 6 b <- shift-right 6 c <- shift-right 6 { compare a, h break-if-!= compare b, s break-if-!= compare c, l break-if-!= set-cursor-position screen, 0x10/x, y draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen screen, color, 7/fg, 0/bg set-cursor-position screen, 0x14/x, y draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 0/fg, color #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, a, 7/fg, 0/bg #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, b, 7/fg, 0/bg #? draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, " ", 7/fg, 0/bg #? draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen screen, c, 7/fg, 0/bg y <- increment } color <- increment loop } }