Changeset 35052 in project


Ignore:
Timestamp:
01/22/18 17:56:47 (9 months ago)
Author:
kon
Message:

let compiler inline , fewer anon procs , alias sub-exprs (exposition)

Location:
release/4/apropos/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/apropos/trunk/apropos.scm

    r35049 r35052  
    108108(define system-macro-environment ##sys#macro-environment)
    109109
    110 (define-inline (global-symbol-bound? sym)
     110(define (global-symbol-bound? sym)
    111111  (##sys#symbol-has-toplevel-binding? sym) )
    112112
    113 (define-inline (global-symbol-ref sym)
     113(define (global-symbol-ref sym)
    114114  (##sys#slot sym 0) )
    115115
    116 (define-inline (symbol-macro-in-environment? sym macenv)
     116(define (symbol-macro-in-environment? sym macenv)
    117117  (and sym macenv (##sys#macro? sym macenv)) )
    118118
    119 (define-inline (qualified-symbol? sym)
     119(define (qualified-symbol? sym)
    120120  (and sym (##sys#qualified-symbol? sym)) )
    121121
     
    149149
    150150(define-check+error-type search-pattern search-pattern?
    151   "symbol/keyword/string/irregex/irregex-sre/quoted-symbol/keyword/string")
     151  "symbol/keyword/string/irregex/irregex-sre/quoted")
    152152
    153153(define-check+error-type sort-key sort-key? "#:name, #:module, #:type or #f")
     
    357357            (not (qualified-symbol? x))
    358358            (global-symbol-bound? x))))))
     359    ;
    359360    (search-system-environment-symbols env
    360361      (lambda (sym)
     
    589590      (apropos-interning))))))
    590591
    591 (define-inline (string->display-symbol str)
     592(define (string->display-symbol str)
    592593  ((if (apropos-interning) string->symbol string->uninterned-symbol) str) )
    593594
     
    801802    (lessp
    802803      (case sort-key
    803         ((#:name)
    804           (cut information-identifier<? <> <> #:name) )
    805         ((#:mod #:module)
    806           (cut information-identifier<? <> <> #:module) )
     804        ((#:name #:module)
     805          (cut information-identifier<? <> <> sort-key) )
    807806        ((#:type)
    808807          (cut information<? <> <> #:name) )
     
    10051004        (error-sort-key loc "unknown sort key" arg) ) ) ) )
    10061005
     1006(define *csi-apropos-help*
     1007  ",a PATT ARG...    Apropos of PATT with ARG from mac, qual, ci, sort [nam|mod|typ|#f] Or ?")
     1008
    10071009;rmvd ", raw, base [#]"
    1008 (define *csi-apropos-help*
    1009   ;0 ...             2
    1010   ;0 ...             0
    1011   ",a PATT ARG...    Apropos of PATT with ARG from mac, qual, ci, sort [nam|mod|typ|#f] Or ?")
     1010(define (display-apropos-help)
     1011  (print #<<EOS
     1012Apropos arguments:
     1013
     1014 macros            Include macro bound symbols
     1015 qualified         Include "qualified" symbols
     1016 ci | case-insensitive
     1017                   Pattern has no capitals
     1018 sort [name | module | type | #f]
     1019                   Order items (optional when last argument)
     1020 all               Means "ci qual mac""
     1021 krl               Means "all sort mod""
     1022 base              For number valued pattern
     1023 raw               No symbol interpretation
     1024
     1025 Use a PATT of "?" to list symbols containing a #\?.
     1026EOS
     1027  ) )
    10121028
    10131029(define (parse-csi-apropos-arguments iargs)
     
    10741090          ;
    10751091          ((?)
    1076             (print #<<EOS
    1077 macros                                include macro bound symbols
    1078 qualified                             include "qualified" symbols
    1079 ci | case-insensitive                 pattern has no capitals
    1080 sort [name | module | type | #f]      order items
    1081 all                                   ci qual mac
    1082 krl                                   all sort mod
    1083 base                                  for number valued pattern
    1084 raw                                   no symbol interpretation
    1085 
    1086 Note The 'sort' order argument is optional only when the last argument.
    1087 EOS
    1088             )
    10891092            (loop '() '()) )
    10901093          ;
     
    10921095            (loop (cdr args) (cons arg oargs)) ) ) ) ) ) )
    10931096
     1097(define (csi-apropos-command)
     1098  (let* (
     1099    (cmdlin (read-line) )
     1100    (istr (string-trim-both cmdlin) )
     1101    (iargs (with-input-from-string istr read-file) )
     1102    (aargs (parse-csi-apropos-arguments iargs)))
     1103    ;NOTE will not dump the symbol-table unless explicit ; use '(: (* any))
     1104    (if (null? aargs)
     1105      (display-apropos-help)
     1106      (apply apropos aargs) ) ) )
     1107
     1108;;; Main
     1109
    10941110(when (feature? csi:)
    1095   (toplevel-command 'a
    1096     (lambda ()
    1097       (let (
    1098         (args
    1099           (parse-csi-apropos-arguments
    1100             (with-input-from-string
    1101               (string-trim-both (read-line))
    1102               read-file))))
    1103         ;NOTE will not dump the symbol-table unless explicit ; use '(: (* any))
    1104         (unless (null? args)
    1105           (apply apropos args) ) ) )
    1106     *csi-apropos-help*) )
     1111  (toplevel-command 'a csi-apropos-command *csi-apropos-help*) )
    11071112
    11081113) ;module apropos
  • release/4/apropos/trunk/apropos.setup

    r35049 r35052  
    99  (exit 1) )
    1010
    11 (setup-shared-extension-module 'apropos (extension-version "2.6.3")
     11(setup-shared-extension-module 'apropos (extension-version "2.6.4")
    1212  #:types? #t
    1313  #:inline? #t
Note: See TracChangeset for help on using the changeset viewer.