9741b1cf51
This reverts commit 003f3713f0.
56 lines
1.1 KiB
Racket
56 lines
1.1 KiB
Racket
#lang racket/base
|
|
|
|
(require simple-ini/class
|
|
simple-log
|
|
)
|
|
|
|
(provide cfg-get
|
|
cfg-set!
|
|
dbg-git
|
|
info-git
|
|
err-git
|
|
warn-git
|
|
fatal-git
|
|
sync-log-git
|
|
)
|
|
|
|
(sl-def-log git)
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; Internal state / functions
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(define ini #f)
|
|
|
|
(define (check-ini)
|
|
(when (eq? ini #f)
|
|
(set! ini (new ini% [file 'git-cli]))))
|
|
|
|
(define mutex (make-semaphore 1))
|
|
|
|
(define-syntax critical
|
|
(syntax-rules ()
|
|
((_ b1 ...)
|
|
(dynamic-wind
|
|
(λ () (semaphore-wait mutex))
|
|
(λ () b1 ...)
|
|
(λ () (semaphore-post mutex)))
|
|
)
|
|
)
|
|
)
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; Provided functions
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(define (cfg-set! section key value)
|
|
(critical
|
|
(check-ini)
|
|
(send ini set! section key value)))
|
|
|
|
(define (cfg-get section key default-value)
|
|
(critical
|
|
(check-ini)
|
|
(send ini get section key default-value)))
|
|
|