;; HACK: script-fu loads script-fu.init, then script-fu-compat.init ;; and plug-in-compat.init} in the first search path directory it ;; encounters, but doesn't look them up any further directories and ;; skips any possible user init. Therefore, if this file is loaded up ;; first, it needs to load up the system init files, then perform all ;; other definitions. ;; NOTE: at this time during initialization, there is no ;; list/map/for-each/..., therefore the code is as dumbed down as ;; possible (define (path-join a b) (string-append a DIR-SEPARATOR b)) (define gimp-system-scripts-directory (path-join gimp-data-directory "scripts")) (define (gimp-system-scripts-path path) (path-join gimp-system-scripts-directory path)) (load (gimp-system-scripts-path "script-fu.init")) (load (gimp-system-scripts-path "script-fu-compat.init")) (load (gimp-system-scripts-path "plug-in-compat.init")) ;;; scheme compat definitions (define stderr (open-output-file "/dev/stderr")) (define (current-error-port) stderr) ;;; utils (define (opt-arg alist key default) (let ((value (assv key alist))) (if value (cadr value) default))) (define-macro (define-with-optionals procedure required-args . opt-args) (let ((original-procedure-sym (gensym)) (opts-sym (gensym))) `(begin (define ,original-procedure-sym ,procedure) (define ,procedure (lambda (,@required-args . ,opts-sym) (,original-procedure-sym ,@required-args ,@(map (lambda (arg) `(opt-arg ,opts-sym ',(car arg) ,(cadr arg))) opt-args))))))) ;;; wrappers (define-with-optionals plug-in-gauss (run-mode image drawable radius) (vertical-radius radius) (method 0)) (define compression-format/bc3/dxt5 3) (define mipmaps/generate 1) (define-with-optionals file-dds-save (run-mode image drawable filename) (raw-filename filename) (compression-format 0) (mipmaps 0) (savetype 0) (format 0) (transparent-index -1) (mipmap-filter 0) (gamma-correct 0) (srgb 0) (gamma 2.2) (perceptual-metric 0) (preserve-alpha-coverage 0) (alpha-test-threshold 0)) (define (sf-adjustment value lower upper step-inc page-inc digits type) (list value lower upper step-inc page-inc digits type)) (define-with-optionals sf-adjustment (value lower upper) (step-inc 10) (page-inc 50) (digits 0) (type 0))