Random Bits of Open Code

Check-in [46f419b7b7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:updated add-eval-string in mtconfigf to uniquify added strings
Timelines: family | ancestors | descendants | both | modularize-debug
Files: files | file ages | folders
SHA1:46f419b7b720b69fafc0d2ead864d505ace282c5
User & Date: bjbarcla 2019-01-07 17:17:16
Context
2019-01-07
18:18
fixed rget in mtconfigf check-in: 3602c6e29e user: bjbarcla tags: modularize-debug
17:17
updated add-eval-string in mtconfigf to uniquify added strings check-in: 46f419b7b7 user: bjbarcla tags: modularize-debug
2019-01-05
03:04
removed dependency on m(t)args from mtconfigf and mtdebug; removed dep on mtdebug from mtconfigf check-in: 18926076cc user: bjbarcla tags: modularize-debug
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mtutils/mtconfigf/mtconfigf.scm.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
136
137
138
139
140
141
142

143
144
145
146
147
148
149
150
...
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.
;;
;;======================================================================

;; NOTE: This is the configf module, long term it will replace configf.scm.
(print "before mtdebug")
;;(use (prefix mtargs    args:))
;; TODO: ensure mtdebug (debug printers) are defined from application and not directly "used" as below (achieves decoupling)
;;(use (prefix mtdebug debug:))
;;(print "after mtdebug")

(module mtconfigf
        (
	 set-debug-printers
	 lazy-convert
	 assoc-safe-add
	 section-var-set!
................................................................................
(define (lazy-convert inval)
  (let* ((as-num (if (string? inval)(string->number inval) #f)))
    (or as-num inval)))


(define *eval-string* "")
(define (add-eval-string str)

  (set! *eval-string* (conc *eval-string* " " str)))

;; Moved to common
;;
;; return list (path fullpath configname)
(define (find-config configname #!key (toppath #f))
  (if toppath
      (let ((cfname (conc toppath "/" configname)))
................................................................................
				((get g)   
				 (let* ((parts (string-split cmd))
					(sect  (car parts))
					(var   (cadr parts)))
				   (conc "(lambda (ht)" allsnip " (configf:lookup ht \"" sect "\" \"" var "\"))")))
				;;((runconfigs-get rget) (conc "(lambda (ht)" allsnip "(configf:runconfigs-get ht \"" cmd "\"))"))
                                ((runconfigs-get rget)
                                 (print "BB> hello!")
                                 (runconfigs-get ht cmd))
				(else "(lambda (ht)(print \"ERROR\") \"ERROR\")"))))

		(handle-exceptions
		    exn
		    (let ((arguments ((condition-property-accessor 'exn 'arguments) exn))
			  (message    ((condition-property-accessor 'exn 'message) exn)))







<
<
<
<
<







 







>
|







 







<







15
16
17
18
19
20
21





22
23
24
25
26
27
28
...
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
356
357
358
359
360
361
362

363
364
365
366
367
368
369
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.
;;
;;======================================================================

;; NOTE: This is the configf module, long term it will replace configf.scm.






(module mtconfigf
        (
	 set-debug-printers
	 lazy-convert
	 assoc-safe-add
	 section-var-set!
................................................................................
(define (lazy-convert inval)
  (let* ((as-num (if (string? inval)(string->number inval) #f)))
    (or as-num inval)))


(define *eval-string* "")
(define (add-eval-string str)
  (if (not (string-contains *eval-string* str))
      (set! *eval-string* (conc *eval-string* " " str))))

;; Moved to common
;;
;; return list (path fullpath configname)
(define (find-config configname #!key (toppath #f))
  (if toppath
      (let ((cfname (conc toppath "/" configname)))
................................................................................
				((get g)   
				 (let* ((parts (string-split cmd))
					(sect  (car parts))
					(var   (cadr parts)))
				   (conc "(lambda (ht)" allsnip " (configf:lookup ht \"" sect "\" \"" var "\"))")))
				;;((runconfigs-get rget) (conc "(lambda (ht)" allsnip "(configf:runconfigs-get ht \"" cmd "\"))"))
                                ((runconfigs-get rget)

                                 (runconfigs-get ht cmd))
				(else "(lambda (ht)(print \"ERROR\") \"ERROR\")"))))

		(handle-exceptions
		    exn
		    (let ((arguments ((condition-property-accessor 'exn 'arguments) exn))
			  (message    ((condition-property-accessor 'exn 'message) exn)))