Changeset 37126 in project


Ignore:
Timestamp:
01/26/19 03:11:34 (8 months ago)
Author:
Kon Lovett
Message:

comment, add parameter, dep global, better internal check, fix doc

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

Legend:

Unmodified
Added
Removed
  • release/5/apropos/trunk/apropos-api.scm

    r37110 r37126  
    571571  (cond
    572572    (raw?
    573       (cons *toplevel-module-symbol* sym) )
     573      (cons (toplevel-module-symbol) sym) )
    574574    (else
    575575      (let-values (
     
    747747        (mod-padlen (symbol-pad-length mod maxmodlen) ) )
    748748        ;
    749         (if (eq? *toplevel-module-symbol* mod)
     749        (if (eq? (toplevel-module-symbol) mod)
    750750          (display (make-string+ (fx+ *tab-width* mod-padlen)))
    751751          (begin
  • release/5/apropos/trunk/apropos-csi.scm

    r37095 r37126  
    6868 The quoted PATT:
    6969
    70     '(PATT . PATT)  performs as if `PATT+PATT split module+name` worked.
    71     '(PATT . _)     synonym for `PATT split module`.
    72     '(_ . PATT)     synonym for `PATT split name`.
    73     '(_ . _)        synonym for `(: (* any))` or match any.
    74 
    75   '<atom>
    76 
    77     interpret `<atom>` as an irregex.
     70  '(PATT . PATT)  performs as if `PATT+PATT split module+name` worked.
     71  '(PATT . _)     synonym for `PATT split module`.
     72  '(_ . PATT)     synonym for `PATT split name`.
     73  '(_ . _)        synonym for `(: (* any))` or match any.
     74
     75  '<atom>         interpret `<atom>` as an irregex.
    7876
    7977 Use "?" as a PATT to list symbols containing a `?`.
  • release/5/apropos/trunk/apropos.egg

    r37110 r37126  
    55
    66((synopsis "CHICKEN apropos")
    7  (version "3.3.1")
     7 (version "3.3.2")
    88 (category misc)
    99 (author "[[kon lovett]]")
  • release/5/apropos/trunk/symbol-access.scm

    r37095 r37126  
    1010(;export
    1111  ;
     12  *toplevel-module-symbol*
     13  toplevel-module-symbol
     14  ;
    1215  global-symbol-bound?
    1316  global-symbol-ref
     
    1518  internal-module-name?
    1619  ;
    17   *toplevel-module-symbol*
    1820  split-prefixed-symbol)
    1921
     
    2224  (chicken fixnum)
    2325  (chicken type)
    24   (only (srfi 13) string-prefix? string-drop string-take string-index))
     26  (only (srfi 13) string-skip string-drop string-take string-index))
    2527
    26 ;;; Raw Access Renames
     28;;;
     29
     30;;
     31
     32(define (internal-marker-prefix-length str)
     33  (cond
     34    ((string-skip str #\#) => identity)
     35    (else                             0)) )
     36
     37(define (global-symbol-name-offset str)
     38  (string-index str #\# (internal-marker-prefix-length str)) )
     39
     40;;;
     41
     42;; Toplevel Symbols
     43
     44(define-constant TOPLEVEL-MODULE-SYMBOL '||)
     45
     46(: *toplevel-module-symbol* (deprecated toplevel-module-symbol))
     47(define *toplevel-module-symbol* TOPLEVEL-MODULE-SYMBOL)
     48
     49(define toplevel-module-symbol (make-parameter TOPLEVEL-MODULE-SYMBOL (lambda (x)
     50  (or
     51    (and (symbol? x) x)
     52    (toplevel-module-symbol)))))
     53
     54(define *toplevel-module-string* (symbol->string (toplevel-module-symbol)))
     55
     56;; Raw Access Renames
    2757
    2858(define (global-symbol-bound? sym) (##sys#symbol-has-toplevel-binding? sym))
     
    3060(define (global-symbol-ref sym) (##sys#slot sym 0))
    3161
    32 (define (global-symbol-name-offset str)
    33   (if (string-prefix? "##" str) 2 0) )
    34 
    35 ;;; Toplevel Symbols
    36 
    37 (define *toplevel-module-symbol* '||)
    38 
    39 (define *toplevel-module-string* (symbol->string *toplevel-module-symbol*))
     62;;
    4063
    4164(: internal-module-name? (string --> boolean))
    4265;
    4366(define (internal-module-name? str)
    44   (not (zero? (global-symbol-name-offset str))) )
     67  (not (zero? (internal-marker-prefix-length str))) )
    4568
    4669(: split-prefixed-symbol (symbol --> string string))
     70;=> module-name identifier-name
    4771;
    4872(define (split-prefixed-symbol sym)
    4973  (let* (
     74    ;symbol name (keyword w/o print-mark)
    5075    (str (symbol->string sym))
    51     (idx (string-index str #\# (global-symbol-name-offset str)))
    52     (mod (if idx (string-take str idx) *toplevel-module-string*))
    53     (nam (if idx (string-drop str (fx+ 1 idx)) str)) )
    54     ;
    55     (values mod nam) ) )
     76    ;module break char index
     77    (idx (global-symbol-name-offset str)) )
     78    ;module?
     79    (if idx
     80      (values (string-take str idx) (string-drop str (fx+ 1 idx)))
     81      (values *toplevel-module-string* str) ) ) )
    5682
    5783) ;module symbol-access
Note: See TracChangeset for help on using the changeset viewer.