tcl-hacks

Check-in [4bf331f466]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:sketch how the interface should look
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4bf331f466e7671aab2966f24512d89c05b23454
User & Date: aspect 2018-05-15 08:31:25
Context
2018-05-15
09:39
make all instances belong to Getline, support -options in constructor check-in: 79692df96b user: aspect tags: trunk
08:31
sketch how the interface should look check-in: 4bf331f466 user: aspect tags: trunk
08:30
be conventional: member variables get Capitalised check-in: 65b27430fd user: aspect tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to getline/getline.tcl.

464
465
466
467
468
469
470






























471
472
473
474
475
476
    chan event stdin readable [info coroutine]
    set prompt "\[[info patch]\]% "
    while 1 {
        set input [getline]             ;# can return -code break/continue
        puts " -> {[srep $input]}"
    }
}































coroutine Main try {
    main {*}$argv
    exit
}
vwait forever







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
    chan event stdin readable [info coroutine]
    set prompt "\[[info patch]\]% "
    while 1 {
        set input [getline]             ;# can return -code break/continue
        puts " -> {[srep $input]}"
    }
}

if 0 {
    proc complete? {s} {info complete $s\n}
    proc complete-tcl-command {s} {
        # .. use procmap
        # return list of possible completions
    }
    # complete modes: first, cycle, showbelow, ..
    Getlines create getline \
                    -chan stdin \
                    -prompt "\[[info patchlevel]\]% " \
                    -history % \
                    -iscomplete complete? \
                    -complete-mode cycle \
                    -completer complete-tcl-command
    getline add-maps [read $mapsfile]
    while 1 {
        set cmd [getline getline]
        try {
            uplevel #0 $cmd
        } on ok {res opt} {
            # getline emit " $res" {bold}
            puts " $res"
        } on error {err opt} {
            # getline emit " $error" {fg red bold}
            puts stderr "Error: $err"
        }
    }
    getline destroy
}

coroutine Main try {
    main {*}$argv
    exit
}
vwait forever