• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

シェルスクリプト言語xyzshのソースコード。


Commit MetaInfo

修订版63acfe8dce71092121ca1ab96da222d177889fa1 (tree)
时间2012-11-02 22:09:01
作者ab25cq <ab25cq@gmai...>
Commiterab25cq

Log Message

v1.1.8 release

更改概述

差异

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,11 @@
11
2+2012 30th Octorber version 1.1.8
3+
4+ Added -index option to "add" inner command and "del" inner command.
5+
6+ Added ~/.xyzsh/program mechanizm to entry external program for root
7+ object. See USAGE or USAGE.ja
8+
29 2012 30th Octorber version 1.1.7a
310
411 Deleted castamized code for CYGWIN. It has not been required.
--- a/README
+++ b/README
@@ -100,6 +100,7 @@ Used files
100100 ~/.xyzsh/macro --> macro which is runned by typing C-x on command line uses this file
101101 ~/.xyzsh/jump --> jump inner command uses this file
102102 ~/.xyzsh/menu --> menu inner command uses this file
103+ ~/.xyzsh/program --> program list which is entried to root object
103104
104105 Encoding and Line field
105106 xyzsh script source file must be written with UTF-8 encode and LF Linefield. But, xyzsh can treat UTF8, EUCJP, and SJIS encodings and can treat LF, CR, LFCR line fields. (EUCJP and SJIS are for Japanese)
--- a/USAGE
+++ b/USAGE
@@ -493,17 +493,15 @@
493493
494494 However, fulequently used commands are entried on root object with refference.
495495
496- --- xyzsh.xyzsh ---
497-
498- print "cat ls pwd cp mv rm rmdir ln make vi vim perl ruby python sed awk grep egrep find less wc sudo echo which whoami head tail" | split | each (
499- | chomp | var -local prog
500-
501- try ( sys::run ( root::ref $prog ) | ref $prog) catch ()
502- )
503-
504496 So you can use ls without sys::
505497
506498 > ls
499+
500+ If you want to entry new external program for root object, you may add new program name to ~/.xyzsh/program like below and run rehash inner command.
501+
502+ > print dmesg\n >> ~/.xyzsh/program
503+ > rehash
504+ > dmesg
507505
508506
509507 2.4 subshell
--- a/USAGE.ja
+++ b/USAGE.ja
@@ -507,24 +507,22 @@
507507
508508 2.3 外部コマンド
509509
510- 外部コマンドは起動時にrehashされてsysオブジェクトの中に外部コマンドオブジェクトとして入れられます。
510+ 外部コマンドは起動時にrehashされてeysオブジェクトの中に外部コマンドオブジェクトとして入れられます。
511511 rehash内部コマンドが実行されるたびにsysオブジェクトの中に新しく作られます。
512512
513513 > sys::dmesg # dmesg外部コマンドを実行
514514
515515 ただし、lsなど使用頻度が高いコマンドについてはリファレンスによってルートオブジェクトに登録されています。
516516
517- --- xyzsh.xyzsh より ---
518-
519- print "cat ls pwd cp mv rm rmdir ln make vi vim perl ruby python sed awk grep egrep find less wc sudo echo which whoami head tail" | split | each (
520- | chomp | var -local prog
521-
522- try ( sys::run ( root::ref $prog ) | ref $prog) catch ()
523- )
524-
525517 よってlsなどはsys::を付けなくても実行できます。
526518
527519 > ls # sys::lsでなくても良い
520+
521+ sys::を省略したい外部プログラムを追加するには~/.xyzsh/programにあるプログラム一覧にプログラム名を追加してください。その後rehashをすると追加されます。
522+
523+ > print dmesg\n >> ~/.xyzsh/program
524+ > rehash
525+ > dmesg
528526
529527
530528 2.4 サブシェル
--- a/help.xyzsh
+++ b/help.xyzsh
@@ -844,6 +844,7 @@ add 文字列
844844 -
845845 文字列をパイプに追加するフィルター。
846846
847+-index 数値 数値の位置に文字列を追加する
847848 -number 数値 数値の位置に文字列を追加する
848849 -byte バイトコードとして処理する
849850 -utf8 UTF8コードとして処理する
@@ -854,6 +855,7 @@ del インデックス
854855 -
855856 パイプの中のインデックスの位置の文字を一文字削除して残りを出力するフィルター。
856857
858+-index 文字数 文字数分削除する
857859 -number 文字数 文字数分削除する
858860 -byte バイトコードとして処理する
859861 -utf8 UTF8コードとして処理する
@@ -1677,6 +1679,7 @@ add (string)
16771679 -
16781680 It is a filter for adding string to pipe data.
16791681
1682+-index (number) add the string at the number position.
16801683 -number (number) add the string at the number position.
16811684 -byte assume text encode as byte code.
16821685 -utf8 assume text encode as utf-8 code.
@@ -1687,6 +1690,7 @@ del (index)
16871690 -
16881691 It is a filter for removing a character on pipe data.
16891692
1693+-index (number) Number characters are removed.
16901694 -number (number) Number characters are removed.
16911695 -byte assume text encode as byte code.
16921696 -utf8 assume text encode as utf-8 code.
--- a/src/cmd_str.c
+++ b/src/cmd_str.c
@@ -1875,6 +1875,9 @@ BOOL cmd_add(sObject* nextin, sObject* nextout, sRunInfo* runinfo)
18751875 if(argument = sCommand_option_with_argument_item(command, "-number")) {
18761876 number = atoi(argument);
18771877 }
1878+ else if(argument = sCommand_option_with_argument_item(command, "-index")) {
1879+ number = atoi(argument);
1880+ }
18781881 else {
18791882 number = -1;
18801883 }
@@ -1956,6 +1959,9 @@ BOOL cmd_del(sObject* nextin, sObject* nextout, sRunInfo* runinfo)
19561959 if(argument = sCommand_option_with_argument_item(command, "-number")) {
19571960 number = atoi(argument);
19581961 }
1962+ else if(argument = sCommand_option_with_argument_item(command, "-index")) {
1963+ number = atoi(argument);
1964+ }
19591965 else {
19601966 number = 1;
19611967 }
--- a/src/uobject.c
+++ b/src/uobject.c
@@ -240,10 +240,12 @@ void uobject_root_init(sObject* self)
240240
241241 nfun = NFUN_NEW_GC(cmd_add, NULL, TRUE);
242242 (void)nfun_put_option_with_argument(nfun, STRDUP("-number"));
243+ (void)nfun_put_option_with_argument(nfun, STRDUP("-index"));
243244 uobject_put(self, "add", nfun);
244245
245246 nfun = NFUN_NEW_GC(cmd_del, NULL, TRUE);
246247 (void)nfun_put_option_with_argument(nfun, STRDUP("-number"));
248+ (void)nfun_put_option_with_argument(nfun, STRDUP("-index"));
247249 uobject_put(self, "del", nfun);
248250
249251 nfun = NFUN_NEW_GC(cmd_index, NULL, TRUE);
--- a/src/xyzsh.c
+++ b/src/xyzsh.c
@@ -112,7 +112,7 @@ static void xyzsh_read_rc()
112112
113113 void xyzsh_init(enum eAppType app_type, BOOL no_runtime_script)
114114 {
115- setenv("XYZSH_VERSION", "1.1.7a", 1);
115+ setenv("XYZSH_VERSION", "1.1.8", 1);
116116 setenv("XYZSH_DATAROOTDIR", DATAROOTDIR, 1);
117117
118118 stack_init(1);;
--- a/xyzsh.xyzsh
+++ b/xyzsh.xyzsh
@@ -15,12 +15,26 @@ print ~/.xyzsh | if(| -e) (
1515 print 1000 | export XYZSH_HISTSIZE
1616 print ~/.xyzsh/history | export XYZSH_HISTFILE
1717
18-print "tee find unzip diff seq env sleep ps kill killall pkill autoconf automake od nm gcc uname chgrp chmod chown sed awk make git ssh scp tar sudo gzip bash cat ls pwd cp mv rm rmdir ln vi vim grep egrep find less wc echo which whoami head tail uniq mkdir touch man" | split | each (
18+print ~/.xyzsh/program | if(! | -e) (
19+ print "tee find unzip diff seq env sleep ps kill killall pkill autoconf automake od nm gcc uname chgrp chmod chown sed awk make git ssh scp tar sudo gzip bash cat ls pwd cp mv rm rmdir ln vi vim grep egrep find less wc echo which whoami head tail uniq mkdir touch man" | split > ~/.xyzsh/program
20+)
21+
22+sys::cat ~/.xyzsh/program | each (
1923 | chomp | var -local prog
2024
2125 try ( sys::run ( root::ref $prog ) | ref $prog) catch ()
2226 )
2327
28+def rehash -inherit (
29+ inherit
30+
31+ sys::cat ~/.xyzsh/program | each (
32+ | chomp | var -local prog
33+
34+ try ( sys::run ( root::ref $prog ) | ref $prog) catch ()
35+ )
36+)
37+
2438 prompt ( pwd | chomp | add " > " )
2539
2640 def jump (
@@ -40,6 +54,7 @@ def menu (
4054 vim ~/.xyzsh/menu
4155 vim ~/.xyzsh/macro
4256 vim ~/.xyzsh/jump
57+vim ~/.xyzsh/program
4358 ls -al | uc| less
4459 pwd | scan . | less
4560 ls | each ( if(|chomp | -d) ( | print ) )