(define belongs (call-table)) (define seen (call-table*)) (define (see thing) (aif (belongs thing) (seen it thing) #f)) (define file-name (second (argv))) (define (comment? str) (or (empty? str) (eq? #\; (string-ref str 0)))) (import tree) (for-each (fn (for-each (cut belongs <> (car x)) (cdr x))) '((define-options define-options) (sxml-serializer allow-prefix-redeclarations? conventional-ns-prefixes serialize-sxml) ((chicken file) delete-file copy-file directory delete-directory move-file file-writable? delete-file* file-exists? file-readable? file-executable? create-temporary-file create-temporary-directory find-files glob rename-file create-directory directory-exists?) ((rename uri-common (uri-reference reference) (absolute-uri absolute) (uri-path path) (uri-query query) (uri-fragment fragment) (uri-host host) (uri-reference? reference?) (absolute-uri? absolute?) (uri-path-absolute? path-absolute?) (uri-path-relative? path-relative?) (uri-relative-to relative-to) (uri-relative-from relative-from)) query uri-default-port? form-urlencoded-separator uri-scheme uri-password relative-from path update-uri uri-normalize-case uri-decode-string reference uri? uri-generic->uri path-relative? uri-username form-urlencode uri-port form-urldecode uri-normalize-path-segments char-set:sub-delims relative-ref? uri->string path-absolute? char-set:uri-unreserved make-uri host char-set:gen-delims uri->list uri-encode-string uri->uri-generic absolute fragment relative-to reference? absolute? char-set:uri-reserved) ((chicken port) make-concatenated-port port-fold make-output-port make-input-port port-map with-input-from-port port-position with-output-to-port make-broadcast-port set-port-name! with-error-output-to-port copy-port call-with-input-string with-error-output-to-string with-input-from-string terminal-port? set-buffering-mode! terminal-name with-output-to-string terminal-size port-for-each make-bidirectional-port call-with-output-string port-name) (miscmacros begin0 exchange! repeat* if* repeat pop! modify-location until let/cc define-parameter dotimes modify! ecase ignore-values inc! dec! while* define-optionals push! define-syntax-rule define-enum while ignore-errors) (srfi-42 any?-ec fold3-ec vector-of-length-ec min-ec apply last-ec product-ec sum-ec string-ec every?-ec list-ec max-ec first-ec fold-ec string-append-ec append-ec vector-ec do-ec) ((chicken io) read-buffered read-lines read-list read-string read-token write-string read-line write-line read-byte read-string! write-byte) (scsh-process pf process? run/port run/sexps |(\|\|| run/file* run/sexp* run/strings* process-sleep run/collecting* |...)| fork%/pipe+ run/sexps* run/file %fork proc:pid fork/pipe & run/collecting && run/string fork/pipe+ fork exec-path* %fork/pipe run/sexp run/port* exec-epf run/string* run exec-path run/strings wait proc? signal-process) (logical-combinators andf orf) ((clojurian syntax) if-let as-> ->>* if-let* -> ->* ->> and-> doto) (html-parser html-strip html->sxml make-html-parser) ((only sxpath sxpath) sxpath) (brev-separate call-string aif-with-result define-curry define-some call-table normalize-absolute-pathname call-table* define-closure fn call-table? match-define call-key*? define-ir-syntax make-tree-accessor scdr ct ctq ctq* niy call-vector with-result empty? call-string? is? 🍛 c for-each-line match-define-closure call-table*? ct* call-key* call-vector? make-sloppy-tree-accessor call-list? define-ir-syntax* like? eif call-record slice econd c_r call-record? descend call-list define-syntax-rules over as-list) ((chicken random) set-pseudo-random-seed! pseudo-random-real random-bytes pseudo-random-integer) ((chicken pretty-print) pretty-print-width pretty-print pp) ((chicken string) substring-index string-chop string-compare3 string-intersperse string-chomp ->string substring=? reverse-string-append string-translate string-split reverse-list->string conc string-translate*) ((only sxml-transforms pre-post-order* pre-post-order-splice*) pre-post-order-splice* pre-post-order*) ((chicken process-context posix) current-process-id current-user-name process-group-id current-effective-group-id current-effective-user-name current-user-id create-session current-effective-user-id parent-process-id change-directory* set-root-directory! current-group-id user-information) (bi-combinators bi-each) (strse strse strse?) (srfi-1 lset-union filter-map split-at! delete-duplicates! partition xcons take! map-in-order lset-xor! member unfold-right reduce fourth drop-while unzip3 unzip2 unzip5 unzip4 list-tabulate unzip1 take-right append! append-map reverse! third pair-for-each fold-right take-while! append-map! last lset-intersection! map filter remove list-copy break! find tenth any not-pair? concatenate! lset-diff+intersection proper-list? seventh pair-fold break filter! last-pair circular-list? drop-right count span! partition! lset-union! drop null-list? lset-adjoin alist-delete! append-reverse take-while alist-copy unfold lset= drop-right! second for-each car+cdr lset-xor delete-duplicates map! assoc sixth take lset-difference! find-tail list-index lset-diff+intersection! list= circular-list split-at span eighth every iota alist-cons remove! append-reverse! lset-difference first make-list fold dotted-list? zip concatenate delete! lset<= pair-fold-right alist-delete cons* length+ delete fifth ninth lset-intersection reduce-right) ((chicken file posix) file-read file-close file-size set-file-position! set-file-owner! file-control socket? directory? file-modification-time duplicate-fileno read-symbolic-link open-input-file* file-group file-truncate fifo? file-lock/blocking set-file-group! file-type file-write file-link character-device? file-position symbolic-link? file-select file-owner file-change-time create-symbolic-link file-mkstemp file-permissions set-file-times! set-file-permissions! block-device? create-fifo file-unlock file-creation-mode port->fileno file-open open-output-file* file-stat file-test-lock regular-file? file-lock file-access-time) (http-client http-authenticators delete-cookie! default-prepare-request retry-request? close-connection! determine-proxy-from-environment determine-username/password prepare-request get-cookies-for-uri call-with-input-request* with-input-from-request max-redirect-depth max-retry-attempts call-with-input-request close-all-connections! determine-proxy close-idle-connections! call-with-response default-server-connector store-cookie! determine-proxy-username/password server-connector client-software max-idle-connections) (srfi-69 hash-table-ref string-hash keyword-hash hash-by-identity hash-table-values hash-table-for-each string-hash-ci hash-table-weak-values hash-table-weak-keys hash-table-clear! hash-table-merge! hash recursive-hash-max-depth object-uid-hash hash-table-copy hash-table-hash-function hash-table-map hash-table-max-load hash-table-ref/default hash-table-delete! hash-table-set! eqv?-hash hash-table-remove! hash-table-min-load eq?-hash hash-table-update! equal?-hash recursive-hash-max-length hash-table-merge symbol-hash hash-table-keys hash-table-walk alist->hash-table hash-table-equivalence-function hash-table-has-initial? hash-table? number-hash hash-table->alist string-ci-hash hash-table-initial hash-table-fold hash-table-size hash-table-update!/default hash-table-exists? make-hash-table) ((chicken process-context) set-environment-variable! get-environment-variable executable-pathname command-line-arguments argv get-environment-variables current-directory change-directory program-name argc+argv unset-environment-variable!) (anaphora nwhile alist-recurser alambda awhile acond define-anaphor atree-recurser nif nlambda ncond aif nand awhen aand tree-recurser list-recurser define-properties anaphora nwhen) ((rename match-generics (define-dx define)) define) ((rename scheme (define define-og)) define-og))) (awhen (strse file-name (: ".brev" eos) ".scm" #f) (tree-walk-preorder see (with-input-from-file file-name read-list)) (print "Just hit return for \"No, keep it\" and any other response for \"False positive, remove it\".") (let ((spec (map car (filter-map (lambda (item) (print "Is " (car item) " a false positive? It matches " (delete-duplicates (cdr item))) (eif (read-line) #f item)) (hash-table->alist (seen))))) (orig (strse file-name (: (* nonl) "/") ""))) (with-output-to-file it (lambda () (eif spec (pp (cons 'import spec)) (void)) (unless (empty? spec) (newline)) (pp `(include ,orig))))))