• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

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


コミットメタ情報

リビジョンb56bf79aa8302b6c0b2629b8024c52d0366c4eb0 (tree)
日時2013-01-31 22:03:37
作者ab25cq <ab25cq@gmai...>
コミッターab25cq

ログメッセージ

1.3.3

変更サマリ

差分

--- /dev/null
+++ b/a.xyzsh
@@ -0,0 +1,5 @@
1+object a
2+co a
3+
4+pwo
5+self
--- a/src/ext/migemo.so.xyzsh
+++ b/src/ext/migemo.so.xyzsh
@@ -1,4 +1,3 @@
1-
21 print "welcome to migemo.so dynamic library. You can read help type with \"migemo::help 'command name'\""\n
32
43 compl::run( root::object migemo )
@@ -27,125 +26,126 @@ Compare migemo querry with input from pipe data and output the string ranges.
2726 EOS | help::set_helps
2827 )
2928
30-class MigemoCompletion (
31- def common_head (
32- | each (
33- | chomp| length -utf8
34- ) | max | var -local max_length
29+root::run(
30+ class MigemoCompletion (
31+ def common_head (
32+ | each (
33+ | chomp| length -utf8
34+ ) | max | var -local max_length
3535
36- print 0 | var -local point
36+ print 0 | var -local point
3737
38- while(true) (
39- | each (
40- | chomp | rows -utf8 0..$point | pomch
41- ) | sys::sort | uniq | length -line-num | strip | if(| != 1) (
42- -- point;
43- break
44- )
38+ while(true) (
39+ | each (
40+ | chomp | rows -utf8 0..$point | pomch
41+ ) | sys::sort | uniq | length -line-num | strip | if(| != 1) (
42+ -- point;
43+ break
44+ )
4545
46- ++ point;
46+ ++ point;
4747
48- if(point | -ge $max_length) (
49- -- point
50- break
48+ if(point | -ge $max_length) (
49+ -- point
50+ break
51+ )
5152 )
52- )
5353
54- if(point | -ne -1) (
55- | rows -utf8 0..$point
54+ if(point | -ne -1) (
55+ | rows -utf8 0..$point
56+ )
5657 )
57- )
5858
59- def is_all_ascii (
60- | length -byte | var -local LEN
59+ def is_all_ascii (
60+ | length -byte | var -local LEN
6161
62- LEN | -eq $(| length -utf8)
63- )
64-
65- def migemo_file_completion (
66- print $ARGV[0] | var -local inputing
67- print $ARGV[1] | var -local editing_line
68-
69- | each (
70- if (inputing | =~ '.*\/[a-zA-Z]+$') (
71- | if(|=~ '.*\/[a-zA-Z]+[^a-zA-z/]+$') (
72- (inputing; |print) | common_head | var -local same_head
62+ LEN | -eq $(| length -utf8)
63+ )
7364
74- same_head | var -local no_migemo_string
75- inputing | sub -no-regex $same_head '' | var -local migemo_string
76- ) else (
77- inputing | sub '(.*\/)[a-zA-Z]+$' '\1' | var -local no_migemo_string
78- inputing | sub '.*\/([a-zA-Z]+)$' '\1' | var -local migemo_string
79- )
80- ) elif (inputing | =~ '.*\/[^a-zA-Z]+[a-zA-Z]+$') (
81- inputing | sub '(.*\/[^a-zA-Z]+)[a-zA-Z]+$' '\1' | var -local no_migemo_string
82- inputing | sub '.*\/[^a-zA-Z]+([a-zA-Z]+)$' '\1' | var -local migemo_string
83- ) elif (inputing | =~ '[a-zA-Z]+$') (
84- | if(|=~ '[a-zA-Z]+[^a-zA-z/]+$') (
85- (inputing; |print) | common_head | var -local same_head
86-
87- same_head | var -local no_migemo_string
88- inputing | sub -no-regex $same_head '' | var -local migemo_string
65+ def migemo_file_completion (
66+ print $ARGV[0] | var -local inputing
67+ print $ARGV[1] | var -local editing_line
68+
69+ | each (
70+ if (inputing | =~ '.*\/[a-zA-Z]+$') (
71+ | if(|=~ '.*\/[a-zA-Z]+[^a-zA-z/]+$') (
72+ (inputing; |print) | common_head | var -local same_head
73+
74+ same_head | var -local no_migemo_string
75+ inputing | sub -no-regex $same_head '' | var -local migemo_string
76+ ) else (
77+ inputing | sub '(.*\/)[a-zA-Z]+$' '\1' | var -local no_migemo_string
78+ inputing | sub '.*\/([a-zA-Z]+)$' '\1' | var -local migemo_string
79+ )
80+ ) elif (inputing | =~ '.*\/[^a-zA-Z]+[a-zA-Z]+$') (
81+ inputing | sub '(.*\/[^a-zA-Z]+)[a-zA-Z]+$' '\1' | var -local no_migemo_string
82+ inputing | sub '.*\/[^a-zA-Z]+([a-zA-Z]+)$' '\1' | var -local migemo_string
83+ ) elif (inputing | =~ '[a-zA-Z]+$') (
84+ | if(|=~ '[a-zA-Z]+[^a-zA-z/]+$') (
85+ (inputing; |print) | common_head | var -local same_head
86+
87+ same_head | var -local no_migemo_string
88+ inputing | sub -no-regex $same_head '' | var -local migemo_string
89+ ) else (
90+ print "" | var -local no_migemo_string
91+ inputing | var -local migemo_string
92+ )
93+ ) elif (inputing | =~ '[^a-zA-Z]+[a-zA-Z]+$') (
94+ inputing | sub '([^a-zA-Z]+)[a-zA-Z]+$' '\1' | var -local no_migemo_string
95+ inputing | sub '[^a-zA-Z]+([a-zA-Z]+)$' '\1' | var -local migemo_string
8996 ) else (
9097 print "" | var -local no_migemo_string
91- inputing | var -local migemo_string
98+ print "" | var -local migemo_string
9299 )
93- ) elif (inputing | =~ '[^a-zA-Z]+[a-zA-Z]+$') (
94- inputing | sub '([^a-zA-Z]+)[a-zA-Z]+$' '\1' | var -local no_migemo_string
95- inputing | sub '[^a-zA-Z]+([a-zA-Z]+)$' '\1' | var -local migemo_string
96- ) else (
97- print "" | var -local no_migemo_string
98- print "" | var -local migemo_string
99- )
100100
101- | if(| sub -no-regex $no_migemo_string '' | chomp | migemo::match $migemo_string | lines 0 | = 0\n) (
102- | print
103- )
104- ) | (| common_head | var -local COMMON_HEAD; | length -line-num | var -local NUM)
101+ | if(| sub -no-regex $no_migemo_string '' | chomp | migemo::match $migemo_string | lines 0 | = 0\n) (
102+ | print
103+ )
104+ ) | (| common_head | var -local COMMON_HEAD; | length -line-num | var -local NUM)
105105
106- if(COMMON_HEAD | chomp | -n && COMMON_HEAD | length | -gt $(inputing | length)) (
107- rl::delete_text $(editing_line | rindex $inputing) $(rl::point)
108- rl::insert_text $COMMON_HEAD
109- if(NUM | chomp | -eq 1 && COMMON_HEAD| chomp | rows -1 | != /) ( rl::insert_text " " )
110- )
111- )
106+ if(COMMON_HEAD | chomp | -n && COMMON_HEAD | length | -gt $(inputing | length)) (
107+ rl::delete_text $(editing_line | rindex $inputing) $(rl::point)
108+ rl::insert_text $COMMON_HEAD
109+ if(NUM | chomp | -eq 1 && COMMON_HEAD| chomp | rows -1 | != /) ( rl::insert_text " " )
110+ )
111+ )
112112
113- def file_completion (
114- | split '(?<!\\) +' | lines -1 | var -local inputing
113+ def file_completion (
114+ | split '(?<!\\) +' | lines -1 | var -local inputing
115115
116- if(inputing | index -quiet /) (
117- sys::dirname $(inputing|chomp| if (|rows -1 | = /) ( |add aaa ) else ( | print ) ) | var -local DIR
116+ if(inputing | index -quiet /) (
117+ sys::dirname $(inputing|chomp| if (|rows -1 | = /) ( |add aaa ) else ( | print ) ) | var -local DIR
118118
119- ls $(DIR|xyzsh_dequote|chomp) | each (
120- | if (|chomp | add -number 0 $(DIR|xyzsh_dequote|chomp)/ | -d) (
121- |chomp | xyzsh_quote | add -number 0 $DIR/ | add / | pomch
122- ) else (
123- |chomp | xyzsh_quote | add -number 0 $DIR/ | pomch
124- )
125- ) | migemo_file_completion $inputing $(|print)
126- ) else (
127- ls | each (
128- | if (|chomp| -d) (
129- | chomp | xyzsh_quote | add / | pomch
130- ) else (
131- |chomp | xyzsh_quote| pomch
132- )
133- ) | migemo_file_completion $inputing $(|print)
119+ ls $(DIR|xyzsh_dequote|chomp) | each (
120+ | if (|chomp | add -number 0 $(DIR|xyzsh_dequote|chomp)/ | -d) (
121+ |chomp | xyzsh_quote | add -number 0 $DIR/ | add / | pomch
122+ ) else (
123+ |chomp | xyzsh_quote | add -number 0 $DIR/ | pomch
124+ )
125+ ) | migemo_file_completion $inputing $(|print)
126+ ) else (
127+ ls | each (
128+ | if (|chomp| -d) (
129+ | chomp | xyzsh_quote | add / | pomch
130+ ) else (
131+ |chomp | xyzsh_quote| pomch
132+ )
133+ ) | migemo_file_completion $inputing $(|print)
134+ )
134135 )
135- )
136136
137- completion __all__ (
138- | file_completion
139- )
137+ completion __all__ (
138+ | file_completion
139+ )
140140
141- root::compl::run( root::object sys )
141+ root::compl::run( root::object sys )
142142
143- completion sys::__all__ (
144- | file_completion
143+ completion sys::__all__ (
144+ | file_completion
145+ )
145146 )
146-)
147147
148-readline "Do you want to use migemo completion which is Japanese ROMAJI completion?(y/n)" | chomp | if(|=~ -ignore-case ^y) (
149- MigemoCompletion
148+ if(MIGEMO_COMPLETION_AUTO_LOAD | = 1\n || readline "Do you want to use migemo completion which is Japanese ROMAJI completion?(y/n)" | chomp |=~ -ignore-case ^y) (
149+ MigemoCompletion
150+ )
150151 )
151-
--- a/src/run.c
+++ b/src/run.c
@@ -1130,10 +1130,11 @@ static BOOL statment_tree(sStatment* statment, sObject* pipein, sObject* pipeout
11301130 for(i=0; i<statment->mCommandsNum; i++) {
11311131 sCommand* command = runinfo->mCommand = statment->mCommands + i;
11321132
1133- runinfo->mCurrentObject = current_object;
11341133 const BOOL last_program = runinfo->mLastProgram = i == statment->mCommandsNum-1;
11351134 runinfo->mFilter = i != 0 || (statment->mFlags & (STATMENT_FLAGS_CONTEXT_PIPE|STATMENT_FLAGS_GLOBAL_PIPE_IN));
11361135
1136+ runinfo->mCurrentObject = current_object;
1137+
11371138 sRunInfo_command_new(runinfo);
11381139
11391140 /// expand env ///
@@ -1798,9 +1799,10 @@ BOOL load_so_file(char* fname, sObject* nextin, sObject* nextout, sRunInfo* runi
17981799
17991800 //dlclose(handle);
18001801
1801- snprintf(path, PATH_MAX, "%s.xyzsh", path);
1802- if(access(path, F_OK) == 0) {
1803- if(!load_file(path, nextin, nextout, runinfo, NULL, 0)) {
1802+ char path2[PATH_MAX];
1803+ snprintf(path2, PATH_MAX, "%s.xyzsh", path);
1804+ if(access(path2, F_OK) == 0) {
1805+ if(!load_file(path2, nextin, nextout, runinfo, NULL, 0)) {
18041806 return FALSE;
18051807 }
18061808 }