all repos — min @ 1a5522dc15a5ddafbb292c296d72f0541e79982f

A small but practical concatenative programming language.

Removed nifty; compiling with --mm:refc
h3rald h3rald@h3rald.com
Tue, 15 Aug 2023 10:36:41 +0000
commit

1a5522dc15a5ddafbb292c296d72f0541e79982f

parent

86540c8ac7829e4d00302d8a05fbbf89aa35b8f3

8 files changed, 79 insertions(+), 67 deletions(-)

jump to
M min.nimmin.nim

@@ -7,7 +7,7 @@ os,

algorithm, minline, logging, - minpkg/packages/niftylogger, + minpkg/niftylogger, minpkg/core/baseutils, minpkg/core/env, minpkg/core/parser,
M min.nimblemin.nimble

@@ -18,8 +18,3 @@ requires "nim >= 1.6.12"

requires "zippy >= 0.5.6 & < 0.6.0" requires "nimquery >= 2.0.1 & < 3.0.0" requires "minline >= 0.1.1 & < 0.2.0" - -before install: - exec "nimble install -y nifty" - exec "nifty remove -f" - exec "nifty install"
M min.nimsmin.nims

@@ -9,7 +9,7 @@ switch("amd64.linux.gcc.exe", "x86_64-linux-musl-gcc")

switch("amd64.linux.gcc.linkerexe", "x86_64-linux-musl-gcc") switch("opt", "size") -switch("deepcopy", "on") +switch("mm", "refc") switch("threadAnalysis", "off") when not defined(dev):
M min.ymlmin.yml

@@ -2,4 +2,4 @@ author: Fabio Cevasco

description: A small but practical concatenative programming language and shell. id: 114841179 name: min -version: 0.39.1+version: 0.39.2
A minpkg/niftylogger.nim

@@ -0,0 +1,73 @@

+import + logging, + strutils, + terminal, + std/exitprocs + +if isatty(stdin): + addExitProc(resetAttributes) + +type + NiftyLogger* = ref object of Logger + +proc logPrefix*(level: Level): tuple[msg: string, color: ForegroundColor] = + case level: + of lvlDebug: + return ("---", fgMagenta) + of lvlInfo: + return ("(i)", fgCyan) + of lvlNotice: + return (" ", fgWhite) + of lvlWarn: + return ("(!)", fgYellow) + of lvlError: + return ("(!)", fgRed) + of lvlFatal: + return ("(x)", fgRed) + else: + return (" ", fgWhite) + +method log*(logger: NiftyLogger; level: Level; args: varargs[string, `$`]) = + var f = stdout + if level >= getLogFilter() and level >= logger.levelThreshold: + if level >= lvlWarn: + f = stderr + let ln = substituteLog(logger.fmtStr, level, args) + let prefix = level.logPrefix() + f.setForegroundColor(prefix.color) + f.write(prefix.msg) + f.write(ln) + resetAttributes() + f.write("\n") + if level in {lvlError, lvlFatal}: flushFile(f) + +proc newNiftyLogger*(levelThreshold = lvlAll; fmtStr = " "): NiftyLogger = + new result + result.fmtStr = fmtStr + result.levelThreshold = levelThreshold + +proc getLogLevel*(): string = + return LevelNames[getLogFilter()].toLowerAscii + +proc setLogLevel*(val: var string): string {.discardable.} = + var lvl: Level + case val: + of "debug": + lvl = lvlDebug + of "info": + lvl = lvlInfo + of "notice": + lvl = lvlNotice + of "warn": + lvl = lvlWarn + of "error": + lvl = lvlError + of "fatal": + lvl = lvlFatal + of "none": + lvl = lvlNone + else: + val = "warn" + lvl = lvlWarn + setLogFilter(lvl) + return val
M next-release.mdnext-release.md

@@ -1,4 +1,4 @@

### Fixes and Improvements -* Fixed compilation errors with Nim 2.0. - +* Removed depentency unnecessary dependency on nifty. +* Now compiling using `--mm:refc` to decrease memory usage.
D nifty.json

@@ -1,56 +0,0 @@

-{ - "storage": "minpkg/packages", - "commands": { - "install": { - "git+src": { - "cmd": "git clone {{src}} --depth 1" - }, - "nimble+name": { - "cmd": "nimble install {{name}}" - }, - "git+src+tag": { - "cmd": "git clone --branch {{tag}} {{src}} --depth 1" - }, - "curl+src+name": { - "cmd": "curl {{src}} -o {{name}}" - }, - "_syntax": "install [<package>]", - "_description": "Installs the specified package (or all mapped packages) to the storage directory." - }, - "update": { - "git+name": { - "cmd": "git pull", - "pwd": "{{name}}" - }, - "nimble+name": { - "cmd": "nimble upgrade {{name}}" - }, - "curl+src+name": { - "cmd": "curl {{src}} -o {{name}}" - }, - "_syntax": "update [<package>]", - "_description": "Updates the specified previously-installed package (or all packages)." - }, - "upgrade": { - "_syntax": "upgrade [<package>]", - "_description": "Upgrades the specified previously-installed package (or all packages).", - "git+name": { - "cmd": "git pull", - "pwd": "{{name}}" - }, - "nimble+name": { - "cmd": "nimble upgrade {{name}}" - }, - "curl+src+name": { - "cmd": "curl {{src}} -o {{name}}" - } - } - }, - "packages": { - "niftylogger.nim": { - "name": "niftylogger.nim", - "src": "https://raw.githubusercontent.com/h3rald/nifty/master/src/niftypkg/niftylogger.nim", - "curl": true - } - } -}
M site/settings.jsonsite/settings.json

@@ -6,5 +6,5 @@ "rules": "rules.min",

"temp": "temp", "templates": "templates", "title": "min language", - "version": "0.39.1" + "version": "0.39.2" }