免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1605 | 回复: 2
打印 上一主题 下一主题

[学习共享] [tcl] jimtcl Introduction [复制链接]

论坛徽章:
84
每日论坛发贴之星
日期:2015-12-29 06:20:00每日论坛发贴之星
日期:2016-01-16 06:20:00每周论坛发贴之星
日期:2016-01-17 22:22:00程序设计版块每日发帖之星
日期:2016-01-20 06:20:00每日论坛发贴之星
日期:2016-01-20 06:20:00程序设计版块每日发帖之星
日期:2016-01-21 06:20:00每日论坛发贴之星
日期:2016-01-21 06:20:00程序设计版块每日发帖之星
日期:2016-01-23 06:20:00程序设计版块每日发帖之星
日期:2016-01-31 06:20:00数据库技术版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-14 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-02-15 16:34 |只看该作者 |倒序浏览
本帖最后由 yjh777 于 2016-02-15 16:34 编辑

Introduction

Jim is an opensource small-footprint implementation of the Tcl programming language. It implements a large subset of Tcl and adds new features like references with garbage collection, closures, built-in Object Oriented Programming system, Functional Programming commands, first-class arrays and UTF-8 support. All this with a binary size of about 100-200kB (depending upon selected options).

The Jim core is very stable. Jim passes over 3000 unit tests and many Tcl programs run unmodified. Jim is highly modular with the possiblity to configure many components as loadable modules, or omitted entirely. A number of extensions are included with Jim which may be built as loadable modules.

Jim cross compiles easily and is in use in many embedded environments. It runs under many operating systems, including Linux, FreeBSD, QNX, eCos, Windows (cygwin and mingw32).

Jim has built-in command line editing for the interactive shell, jimsh.

评分

参与人数 2可用积分 +10 信誉积分 +10 收起 理由
tc1989tc + 10 赞一个!
MMMIX + 10 赞一个!

查看全部评分

论坛徽章:
84
每日论坛发贴之星
日期:2015-12-29 06:20:00每日论坛发贴之星
日期:2016-01-16 06:20:00每周论坛发贴之星
日期:2016-01-17 22:22:00程序设计版块每日发帖之星
日期:2016-01-20 06:20:00每日论坛发贴之星
日期:2016-01-20 06:20:00程序设计版块每日发帖之星
日期:2016-01-21 06:20:00每日论坛发贴之星
日期:2016-01-21 06:20:00程序设计版块每日发帖之星
日期:2016-01-23 06:20:00程序设计版块每日发帖之星
日期:2016-01-31 06:20:00数据库技术版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-14 06:20:00
2 [报告]
发表于 2016-02-17 15:00 |只看该作者
谢谢大家 关注

跟官方的tcl版本不同(使用fossil做代码管理)
    jimtcl 使用github托管代码,直接 git clone 就可以,代码可读性还是挺好的;

    可以自己改改代码,添加一些自己的命令玩一玩,比如给list添加切片功能的命令
          (默认list只有lrange, 如果你只想把 第5个第7和第10个拿出来就比较麻烦)

论坛徽章:
84
每日论坛发贴之星
日期:2015-12-29 06:20:00每日论坛发贴之星
日期:2016-01-16 06:20:00每周论坛发贴之星
日期:2016-01-17 22:22:00程序设计版块每日发帖之星
日期:2016-01-20 06:20:00每日论坛发贴之星
日期:2016-01-20 06:20:00程序设计版块每日发帖之星
日期:2016-01-21 06:20:00每日论坛发贴之星
日期:2016-01-21 06:20:00程序设计版块每日发帖之星
日期:2016-01-23 06:20:00程序设计版块每日发帖之星
日期:2016-01-31 06:20:00数据库技术版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-14 06:20:00
3 [报告]
发表于 2016-02-17 21:43 |只看该作者
添加一个命令 lslice
  1. diff --git a/jim.c b/jim.c
  2. index 8c72777..4011bf4 100644
  3. --- a/jim.c
  4. +++ b/jim.c
  5. @@ -14951,6 +14951,26 @@ static int Jim_LrangeCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *a
  6.      return JIM_OK;
  7. }

  8. +/* [lslice] */
  9. +static int Jim_LsliceCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
  10. +{
  11. +    Jim_Obj *tmpobjPtr = NULL;
  12. +    Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0);
  13. +    int i = 0;
  14. +
  15. +    if (argc < 3) {
  16. +        Jim_WrongNumArgs(interp, 1, argv, "list ?index | first-last ...?");
  17. +        return JIM_ERR;
  18. +    }
  19. +    for (i = 2; i < argc; i++) {
  20. +        if ((tmpobjPtr = Jim_ListRange(interp, argv[1], argv[i], argv[i])) == NULL)
  21. +            return JIM_ERR;
  22. +        ListAppendElement(objPtr, tmpobjPtr);
  23. +    }
  24. +    Jim_SetResult(interp, objPtr);
  25. +    return JIM_OK;
  26. +}
  27. +
  28. /* [lrepeat] */
  29. static int Jim_LrepeatCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
  30. {
  31. @@ -15240,6 +15260,7 @@ static const struct {
  32.      {"scan", Jim_ScanCoreCommand},
  33.      {"error", Jim_ErrorCoreCommand},
  34.      {"lrange", Jim_LrangeCoreCommand},
  35. +    {"lslice", Jim_LsliceCoreCommand},
  36.      {"lrepeat", Jim_LrepeatCoreCommand},
  37.      {"env", Jim_EnvCoreCommand},
  38.      {"source", Jim_SourceCoreCommand},
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP