2020-02-17

tklib 0.7

tklib 釋出了一個新的正式版 v0.7。

Overview
========

    5  new packages                in 5  modules
    11 changed packages            in 9  modules
    2  internally changed packages in 1  modules
    47 unchanged packages          in 19 modules
    79 packages, total             in 31 modules, total

New in tklib 0.7
================

    Module                Package               New Version   Comments
    --------------------- --------------------- ------------- ----------
    canvas                canvas::gradient      0.2
    notifywindow          notifywindow          1.0
    persistentSelection   persistentSelection   1.0b1
    scrollutil            scrollutil::common    1.5
    widgetPlus            widgetPlus            1.0b2
    --------------------- --------------------- ------------- ----------

Changes from tklib 0.6 to 0.7
=============================

                                         tklib 0.6     tklib 0.7
    Module          Package              Old Version   New Version   Comments
    --------------- -------------------- ------------- ------------- ----------------
    controlwidget   rdial                0.3           0.7           D EF EX
    crosshair       crosshair            1.1           1.2           B EF EX
    datefield       datefield            0.2           0.3           D EF
    mentry          mentry::common       3.6           3.10          B D EF I
    plotchart       Plotchart            2.1.0         2.4.1         B D EF I
    --------------- -------------------- ------------- ------------- ----------------
    tablelist       tablelist::common    5.7                         API B D EF I P
                    tablelist::common                  6.8           API B D EF I P
    --------------- -------------------- ------------- ------------- ----------------
    tooltip         tooltip              1.4.4         1.4.6         B D EF
    --------------- -------------------- ------------- ------------- ----------------
    wcb             Wcb                  3.4           3.6           B D EF I P
                    wcb                  3.4           3.6           B D EF I P
    --------------- -------------------- ------------- ------------- ----------------
    widgetl         widget::listentry    0.1.1         0.1.2         D I
                    widget::listsimple   0.1.1         0.1.2         D I
    --------------- -------------------- ------------- ------------- ----------------

Invisible changes (documentation, testsuites)
=============================================

                                    tklib 0.6     tklib 0.7
    Module          Package         Old Version   New Version   Comments
    --------------- --------------- ------------- ------------- ----------
    controlwidget   controlwidget   0.1           0.1           D
                    meter           1.0           1.0           EX
    --------------- --------------- ------------- ------------- ----------

critcl 3.1.18

critcl

ChangeLog:
  1. Feature (Developer support). Merged pull request #96 from sebres/main-direct-invoke. Enables direct invokation of the "main.tcl" file for starkits from within a dev checkout, i.e. outside of a starkit, or starpack.
  2. Feature. Added channel types to the set of builtin argument and result types. The argument types are for simple channel access, access requiring unshared channels, and taking the channel fully into the C level, away from Tcl. The result type comes in variants for newly created channels, known channels, and to return taken channels back to Tcl. The first will register the returned value in the interpreter, the second assumes that it already is.
  3. Bugfix. Issue #96. Reworked the documentation around the argument type Tcl_Interp* to make its special status more visible, explain uses, and call it out from result types where its use will be necessary or at least useful.
  4. Feature. Package critcl::class bumped to version 1.1. Extended with the ability to create a C API for classes, and the ability to disable the generation of the Tcl API.
  5. Bugfix. Merged pull request #99 from pooryorick/master. Fixes to the target directory calculations done by the install code.
  6. Merged pull request #94 from andreas-kupries/documentation. A larger documentation cleanup. The main work was done by pooryorick, followed by tweaks done by myself.
  7. Extended the test suite with lots of cases based on the examples for the various generator packages. IOW the new test cases replicate/encapsulate the examples and demonstrate that the packages used by the examples generate working code.
  8. Bugfix. Issue #95. Changed the field critcl_bytes.s to unsigned char* to match Tcl's type. Further constified the field to make clear that read-only usage is the common case for it.
  9. Bugfix/Feature. Package critcl::cutil bumped to version 0.2. Fixed missing inclusion of header "string.h" in "critcl_alloc.h", needed for memcpy in macro STREP. Added macros ALLOC_PLUS and STRDUP. Moved documentation of STREP... macros into proper place (alloc section, not assert).
  10. Merged pull request #83 from apnadkarni/vc-fixes. Removed deprecated -Gs for MSVC builds, and other Windows fixups.
  11. Feature. Package critcl::iassoc bumped to version 1.1. Refactored internals to generate an include header for use by .c files. This now matches what other generator packages do. The template file is inlined and removed.
  12. Merged pull request #82 from gahr/home-symlink Modified tests to handle possibility of $HOME a symlink.
  13. Merged pull request #81 from gahr/test-not-installed Modified test support to find uninstalled critcl packages when running tests. Handles all but critcl::md5.
  14. Merged pull request #85 from snoe925/issue-84 to fix Issue #84 breaking installation on OSX.
  15. Merged pull request #87 from apnadkarni/tea-fixes to fix Issue #86, broken -tea option, generating an incomplete package.
  16. Feature. New package critcl::callback providing C-level functions and data structures to manage callbacks from C to Tcl.
  17. Feature. Package critcl::literals bumped to version 1.3. Added mode +list enabling the conversion of multiple literals into a list of their strings.
  18. Feature. Package critcl::enum bumped to version 1.1. Added basic mode handling, supporting tcl (default) and +list (extension enabling the conversion of multiple enum values into a list of their strings).
  19. Feature. Package critcl::emap bumped to version 1.2. Extended existing mode handling with +list extension enabling the conversion of multiple emap values into a list of their strings.
  20. Feature. Extended the set of available types by applying a few range restrictions to the scalar types (int, long, wideint, double, float).
    Example: int > 0 is now a viable type name.
    This is actually more limited than the description might let you believe.
    See the package reference for the details.

2020-02-02

Guess the number

因為週末沒有外出,所以寫的練習小程式,猜測一個位於 1 - 1000 內的數字。

#!/usr/bin/env tclsh

proc rand_range {min max} { 
    return [expr int(rand()*($max-$min+1)) + $min] 
}

set answer [rand_range 1 1000]
while {1} {
    puts -nonewline "Please input a number to guess (1-1000): "
    flush stdout
    gets stdin guess
    if {$guess == $answer} {
        break;
    } else {
        if {$guess < $answer} {
             puts "Please guess more higher"
        } else {
             puts "Please guess more lower"
        }
    }
}