-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchess_v6_single_thread.anatella
200 lines (191 loc) · 15.2 KB
/
chess_v6_single_thread.anatella
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?xml version="1.0" encoding="utf-16"?>
<ANATELLA version='2.04'>
<GlobalParameters wDirLoc='1' dataDirRead='F:/TIMi/chess' dataDirWrite=':/' fileParameterDir='F:\TIMi\chess\ChessData-master'>
</GlobalParameters>
<WorkingSpace>AAAA/wAAAAD9AAAAAgAAAAEAAAEAAAABg/wCAAAAAfsAAAAcAEEAbABsAEEAYwB0AGkAbwBuAHMARABvAGMAawEAAABBAAABgwAAAHgA////AAAAAwAABgQAAAGv/AEAAAAC+wAAACgAQQBjAHQAaQBvAG4AUAByAG8AcABlAHIAdABpAGUAcwBEAG8AYwBrAQAAAAAAAAQGAAABcgD////8AAAECgAAAfoAAAGXAP////oAAAAAAQAAAAL7AAAADgBMAG8AZwBEAG8AYwBrAQAAAAD/////AAAAYAD////7AAAAGgBEAGEAdABhAFQAYQBiAGwAZQBEAG8AYwBrAQAAAAD/////AAABlwD///8AAAUAAAABgwAAAAQAAAAEAAAACAAAAAj8AAAAAQAAAAIAAAAFAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIBAAAAAP////8AAAAAAAAAAAAAABAAUgBUAG8AbwBsAGIAYQByAQAAAgv/////AAAAAAAAAAAAAAAaAFAAeQB0AGgAbwBuAFQAbwBvAGwAQgBhAHIBAAACPv////8AAAAAAAAAAAAAABYAdABlAHgAdABUAG8AbwBsAEIAYQByAQAAAnH/////AAAAAAAAAAAAAAAeAGcAcgBvAHUAcABCAG8AeABUAG8AbwBsAEIAYQByAQAABGD/////AAAAAAAAAAA=</WorkingSpace>
<ACTIONS>
<Generic idx='1' x='342.15' y='-199.423' id='listFiles'
longName='List Files inside directory'
nPinIn='0'
nPinInMin='0'
le='1501371033733'
image='/listFiles.png'
author='Frank Vanden Berghen'
revision='0.10'
tags='600_System Tools'
pdfDestination='5_20_4_list_files'>
<Description>
List the files inside a user-defined directory
</Description>
<Parameters>
<Parameter id='myFileFilter' text='file filter' type='string'>*.pgn</Parameter>
<Parameter id='myDir' text='directory to list' type='onedir'><data>:/ChessData-master2</data></Parameter>
<Parameter id='myOutput' text='output' type='combobox'><meta><i>All files sorted by name</i><i>All files sorted by time</i><i>All files sorted by size</i><i>First file (by name)</i><i>First file (by time)</i><i>First file (by size)</i><i>Last file (by name)</i><i>Last file (by time)</i><i>Last file (by size)</i></meta><data>0</data></Parameter>
<Parameter id='myDateFormat' text='date time format' type='string'>yyyy-MM-dd hh:mm:ss</Parameter>
<Parameter id='getFileSizes' text='get file sizes' type='bool'>1</Parameter>
<Parameter id='recurse' text='recurse in (sub)directories?' type='bool'>1</Parameter>
<Parameter id='idItemType' text='Items to output' type='combobox'><meta><i>Files</i><i>Directories</i><i>File and directories</i></meta><data>0</data></Parameter>
<Parameter id='nothingFound' text='if no files are found:' type='combobox'><meta><i>return an empty table</i><i>abort anatella process with a warning</i><i>abort anatella process with an error</i></meta><data>0</data></Parameter>
</Parameters>
<Script>
var r,a,i,formatter,dirsToProcess,sm,isEmpty,itemTypes;
function addDirToProcess(d)
{
var thisDirs=dirList(d,"",DirSort_DoNotSort,DirFilter_AllDirs|DirFilter_NoDotAndDotDot);
if (thisDirs==null) return;
var i=thisDirs.length;
if (d[d.length-1]=='/') d=d.substr(0,d.length-1);
while(i--) dirsToProcess.push(d+"/"+thisDirs[i].fileName)
}
function initA()
{
i=0;
if (!a.length) return;
switch(myOutput)
{
case 3: case 4: case 5: a=[a[0]]; return;
case 6: case 7: case 8: a=[a[a.length-1]]; return;
}
}
function init()
{
isEmpty=true;
var n=10+(getFileSizes?1:0);
setOutputRowSize(0,n);
r=new Row(n);
rowSetColumnName(r,0,"filePath");
rowSetColumnName(r,1,"fileName");
rowSetColumnName(r,2,"created");
rowSetColumnName(r,3,"modified");
rowSetColumnName(r,4,"lastAccessed");
rowSetColumnName(r,5,"absolutePath");
rowSetColumnName(r,6,"isHidden");
rowSetColumnName(r,7,"isReadable");
rowSetColumnName(r,8,"isWritable");
rowSetColumnName(r,9,"isExecutable");
if (getFileSizes) rowSetColumnName(r,10,"size");
switch(myOutput)
{
case 0: case 3: case 6: sm=DirSort_ByName+DirSort_IgnoreCase; break;
case 1: case 4: case 7: sm=DirSort_ByTime; break;
case 2: case 5: case 8: sm=DirSort_BySize; break;
}
if (myFileFilter.indexOf("**")>=0) recurse=false;
if (recurse)
{
if (myFileFilter.indexOf("*")>=0)
{
myFileFilter=myFileFilter.replace("*","**");
recurse=false;
} else
{
dirsToProcess=new Array();
addDirToProcess(myDir);
}
}
switch(idItemType)
{
case 0: itemTypes=DirFilter_Files; break;
case 1: itemTypes=DirFilter_Dirs+DirFilter_NoDot+DirFilter_NoDotDot ; break;
case 2: itemTypes=DirFilter_Files+DirFilter_Dirs+DirFilter_NoDot+DirFilter_NoDotDot ; break;
}
a=dirList(myDir,myFileFilter,sm,itemTypes,getFileSizes);
initA(a)
formatter=new DateTool(myDateFormat);
return 0;
}
function processEnd()
{
if (!isEmpty) return;
switch(nothingFound)
{
case 1: exit(1);
case 2: exit(2);
}
}
function run()
{
if (i==a.length)
{
if (!recurse) { processEnd(); return 1; }
do
{
if (!dirsToProcess.length) { processEnd(); return 1; }
var d=dirsToProcess.pop();
addDirToProcess(d);
a=dirList(d,myFileFilter,sm,itemTypes);
} while(!a.length);
initA(a);
}
isEmpty=false;
var s=a[i].absolutePath;
if (s[s.length-1]!='/') s+="/";
r.setColumn(0,s+a[i].fileName);
r.setColumn(1,a[i].fileName);
r.setColumn(2,formatter.print(a[i].created));
r.setColumn(3,formatter.print(a[i].modified));
r.setColumn(4,formatter.print(a[i].lastRead));
r.setColumn(5,a[i].absolutePath);
r.setColumn(6,a[i].isHidden?1:0);
r.setColumn(7,a[i].isReadable?1:0);
r.setColumn(8,a[i].isWritable?1:0);
r.setColumn(9,a[i].isExecutable?1:0);
if (getFileSizes) r.setColumn(10,a[i].size);
i++;
r.write();
writeEOL();
return 0;
}
</Script>
</Generic>
<readCSV idx='2' x='483.837' y='-198.423' sep=',' firstLineContainsColumnNames='0' fillInEOL='0' parsing='0' fileNameFromPin='1' fileName=''/>
<aggregate idx='6' x='778.987' y='-194' inRAMAlgo='1'>
<OneAggregate counts='1'>
<GroupBy>
<v name='C0' type='0'/>
</GroupBy>
<OutputVars>
</OutputVars>
</OneAggregate>
</aggregate>
<writeCSV idx='22' x='1202.61' y='-190.697' sep=',' segmentSize='0.1' filename=':/chess_results_st.txt'/>
<RunToFinishLine idx='23' x='1336.61' y='-189.697'/>
<readCSV idx='26' x='1089.43' y='-64.5603' sep=',' fillInEOL='0' fileName=':/chess_results_st.txt'/>
<aggregate idx='27' x='1219.43' y='-64.5603' inRAMAlgo='1' omitSuffix='1'>
<OneAggregate>
<GroupBy>
</GroupBy>
<OutputVars>
<v name='count' sum='1'/>
</OutputVars>
</OneAggregate>
</aggregate>
<RegularExpressionTest module='DefaultActions' idx='57' x='624.659' y='-195.255' result='' regexp='^\[Res.*' column='C0'/>
<ChangeDataType idx='63' x='1346.43' y='-66.5603' floatToString='%.16g'>
<toStringFromFloat><c>count</c></toStringFromFloat>
</ChangeDataType>
<ColumnRename module='DefaultActions' idx='64' x='923.317' y='-192.648'><before>
<c>C0</c></before><after>
<c>Game Outcome</c></after>
<QuickRename ></QuickRename>
</ColumnRename>
<ChangeDataType idx='65' x='1063.84' y='-195.3' floatToString='%.16g'>
<toStringFromFloat><c>count</c></toStringFromFloat>
</ChangeDataType>
</ACTIONS>
<CONNECTORS>
<Connection idxSrc='22' idxDest='23'/>
<Connection idxSrc='26' idxDest='27'/>
<Connection idxSrc='27' idxDest='63'/>
<Connection idxSrc='57' idxDest='6'/>
<Connection idxSrc='64' idxDest='65'/>
<Connection idxSrc='65' idxDest='22'/>
<Connection idxSrc='1' idxDest='2'/>
<Connection idxSrc='6' idxDest='64'/>
<Connection idxSrc='2' idxDest='57'/>
</CONNECTORS>
<TEXTANNOTATIONS>
</TEXTANNOTATIONS>
<GROUPBOXANNOTATIONS>
</GROUPBOXANNOTATIONS>
</ANATELLA>