File: apply

package info (click to toggle)
sdc 1.0.8beta-8
  • links: PTS
  • area: contrib
  • in suites: slink
  • size: 1,400 kB
  • ctags: 874
  • sloc: lisp: 8,120; ansic: 967; makefile: 671; perl: 136; sh: 50
file content (17 lines) | stat: -rw-r--r-- 558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;			     -*-scheme-*-
;;; SYNTAX apply:hook-nick-name:filename
;;; DESC   load file and apply the result to hook's args

(let* ((args (string-split-string *-R-option-argument* ":"))
       (nargs (if (> (length args) 1) #t
		  (error "[rc/apply]"
			 "arg count < 2 in "
			 *-R-option-argument*)))
       (hook-name (cond
		   ((equal? (car args) "post") 'normalize-cooked)
		   (else 'normalize-raw)))
       (file (cadr args)))
  (hook hook-name 'add
      (lambda args
	(message 0 #"\nRunning apply on " file)
	(list (apply (require-load file) args)))))