Random Bits of Open Code

Check-in [99148c4a59]
Login

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

Overview
Comment:put back any? in mtargs
Timelines: family | ancestors | descendants | both | modularize-debug
Files: files | file ages | folders
SHA1:99148c4a595caee0df4f508618a358464664f8e0
User & Date: bjbarcla 2019-01-04 01:15:48
Context
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
2019-01-04
01:15
put back any? in mtargs check-in: 99148c4a59 user: bjbarcla tags: modularize-debug
00:59
added tests for mtconfigf check-in: a853d9731e user: bjbarcla tags: modularize-debug
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mtutils/mtargs/mtargs.scm.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;;     mtargs is distributed in the hope that it will be useful,
;;     but WITHOUT ANY WARRANTY; without even the implied warranty of
;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;     GNU General Public License for more details.
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with mtargs.  If not, see <http://www.gnu.org/licenses/>.


(module mtargs
    (
     arg-hash
     get-arg
     get-arg-from
     usage
................................................................................
(define help "")

(define (get-arg arg . default)
  (if (null? default)
      (hash-table-ref/default arg-hash arg #f)
      (hash-table-ref/default arg-hash arg (car default))))

(define (any-defined? . args)
  (not (null? (filter (lambda (x) x)
		      (map get-arg args)))))

(define (get-arg-from ht arg . default)
  (if (null? default)
      (hash-table-ref/default ht arg #f)
      (hash-table-ref/default ht arg (car default))))







>







 







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;;     mtargs is distributed in the hope that it will be useful,
;;     but WITHOUT ANY WARRANTY; without even the implied warranty of
;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;     GNU General Public License for more details.
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with mtargs.  If not, see <http://www.gnu.org/licenses/>.


(module mtargs
    (
     arg-hash
     get-arg
     get-arg-from
     usage
................................................................................
(define help "")

(define (get-arg arg . default)
  (if (null? default)
      (hash-table-ref/default arg-hash arg #f)
      (hash-table-ref/default arg-hash arg (car default))))

(define (any? . args)
  (not (null? (filter (lambda (x) x)
		      (map get-arg args)))))

(define (get-arg-from ht arg . default)
  (if (null? default)
      (hash-table-ref/default ht arg #f)
      (hash-table-ref/default ht arg (car default))))

Changes to mtutils/mtdebug/mtdebug.scm.

72
73
74
75
76
77
78

79
80
81
82
83
84
85
   (if (not (or (number? verbosity)
	        (list?   verbosity)))
       (begin
	 (oldprint "ERROR: Invalid debug value \"" vstr "\"")
	 #f)
       #t))


 (define (set-verbosity v)(set! *verbosity* v))

 (define (debugging-mtdebug?)
   (get-environment-variable "MTDEBUG_DEBUG"))
 
 (define (debug-mode n)
  (cond







>







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
   (if (not (or (number? verbosity)
	        (list?   verbosity)))
       (begin
	 (oldprint "ERROR: Invalid debug value \"" vstr "\"")
	 #f)
       #t))

 
 (define (set-verbosity v)(set! *verbosity* v))

 (define (debugging-mtdebug?)
   (get-environment-variable "MTDEBUG_DEBUG"))
 
 (define (debug-mode n)
  (cond