20230322
[shlib.git] / shlib / strnode-param / itemnode-param.shlib
blobe788c3f901d68932e89ef8012f51204a631a4887
1 #!/bin/bash
2 ############################################################
3 # source: general-srcpkg.shlib
4 # author: devenkong(18151155@qq.com)
5 # date: 2023-01-10
6 ############################################################
7 # Copyright (C) 2022- Free Software Foundation, Inc.
8 # This configure script is free software; the Free Software
9 # Foundation gives unlimited permission to copy, distribute
10 # and modify it.
11 ############################################################
12 # note:
13 # paramters about general sh/c/clib src-pkg for
14 # strnode.shlib.
16 ############################################################
19 #. shlibinc
21 #include stdio.shlib
22 #include gplib.shlib
23 #include attr.shlib
24 #include strfmt.shlib
28 ##############################
29 # section: public comment info
30 ##############################
34 ##############################
35 # section: variable define
36 ##############################
38 # @ a src-pkg with sh/shlib/c.
39 # shlib is the main lib code.
40 # sh for utility program.
41 # lib/c for shlib builtin/loadables.
42 # src/c for binary utility.
43 # it can be used for shlib, clib, cbinary.
44 # if it need to use cpp, changge c to cpp.
45 # @ genlib-srcpkg-dir
46 # texdocdir:tex;
47 # htmldocdir:html;
48 # mddocdir:md;
49 # tutodir:ttyrec;
50 # designdir:desc/md/catalog/imi/uml;
51 # testdir:shunit/stdout/timecost;
52 # unittestdir:cunit/shunit/stdout/timecost;
53 # [shunititem] bindir:sh;
54 # [shlibmodule] shlibdir:shlib/vala/mdl;
55 # [shlibunititem] shlibdir:shlib;
56 # [shbuiltin] libdir:def/h; shlibdir:shlib;
58 # [cmodule] libdir:desc/c/h/cunit/vala/mdl;
59 # [cmdlitem] libdir:c/h/cunit/vala/mdl;
60 # [cunit] libdir:desc/c/h/cunit;
61 # [cunititem] libdir:c/h/cunit;
63 # [clibmodule] srcdir:desc/c/h/cunit/vala/mdl;
64 # [clibmdlitem] srcdir:c/h/cunit/vala/mdl;
65 # [clibunit] srcdir:desc/c/h/cunit;
66 # [clibunititem] srcdir:c/h/cunit;
69 ################################################################################################
70 # @ node defination for catalog.
71 # in this section, it defines catanode, dirnode, itemnode, contnode, and the corresponding dirnode
72 # and itemnode in different OUTPUT_DIR.
73 ################################################################################################
75 # catanode for catalog
76 # [catanode]
77 #########################
78 attr_create catalog::catanode::STR_FMT='<@{NCATAID}>@{ALIAN}[@{NTYPE}]@{ALIAN}@{NNAME}@{ALIAN}[@{NDESC}]'
79 #attr_create catalog::catanode::regex='<([a-zA-Z0-9_ ]*)> [([a-zA-Z0-9_ ]*)] ([a-zA-Z0-9_ ]*) "([a-zA-Z0-9_ ]*)"'
80 # it's used for multi-blank seperator recognizing between data columns.
81 attr_create catalog::catanode::ALIAN_REGEX='${ALIAN_REGEX}'
82 # when generating catalog, set ' ' as the seperator char.
83 attr_create catalog::catanode::ALIAN=' '
84 attr_create catalog::catanode::PAIRCHARS='<>[]""{}'
86 # [dirnode]
87 #########################
88 attr_create catalog::dirnode::NFTYPE='srcdir/testdir/designdir:descfile'
90 # [itemnode]
91 #########################
92 # it's the node under current dir. and NODEDIR=''.
93 # it's used for code under a dirnode directly.
94 attr_create catalog::itemnode::NODEDIR=''
95 attr_create catalog::itemnode::NFTYPE='
96 srcdir:c/h/cunittest;
97 testdir:shtest/stdout/timecost;
98 docdir/designdir:md'
102 testdir:shunit/stdout/timecost;
103 unittestdir:cunit/shunit/stdout/timecost;
106 # [shunititem] bindir:sh;
107 #########################
108 attr_create catalog::itemnode::NODEDIR=''
109 attr_create catalog::itemnode::NFTYPE='
110 bindir:sh;
111 testdir:shtest/stdout/timecost;
112 docdir/designdir:md'
114 # [shlibmodule] shlibdir:shlib/vala/mdl;
115 #########################
116 # it's the node under current dir. and NODEDIR='@{node}'.
117 # '@{node}' is under dirnode, and all code under the dir of '@{node}'.
118 attr_create catalog::itemshlibnode::NODEDIR='@{node}'
119 attr_create catalog::itemshlibnode::NFTYPE='
120 srcdir:shlib;
121 testdir:shtest/stdout/timecost;
122 docdir/designdir:md'
124 # [shlibunititem] shlibdir:shlib;
125 #########################
127 # [shbuiltin] libdir:def/h; shlibdir:shlib;
128 #########################
131 #########################
133 # [cmodule] libdir:desc/c/h/cunit/vala/mdl;
134 #########################
136 # [cmdlitem] libdir:c/h/cunit/vala/mdl;
137 #########################
139 # [cunit] libdir:desc/c/h/cunit;
140 #########################
142 # [cunititem] libdir:c/h/cunit;
143 #########################
146 #########################
148 # [clibmodule] srcdir:desc/c/h/cunit/vala/mdl;
149 #########################
151 # [clibmdlitem] srcdir:c/h/cunit/vala/mdl;
152 #########################
154 # [clibunit] srcdir:desc/c/h/cunit;
155 #########################
157 # [clibunititem] srcdir:c/h/cunit;
158 #########################
168 # [itemshlibnode]
169 #########################
170 # it's the node under current dir. and NODEDIR='@{node}'.
171 # '@{node}' is under dirnode, and all code under the dir of '@{node}'.
172 attr_create catalog::itemshlibnode::NODEDIR='@{node}'
173 attr_create catalog::itemshlibnode::NFTYPE='
174 srcdir:shlib;
175 testdir:shtest/stdout/timecost;
176 docdir/designdir:md'
179 # [itemcnode]
180 #########################
181 # it's the node under current dir. and NODEDIR='@{node}'.
182 # '@{node}' is under dirnode, and all code under the dir of '@{node}'.
183 attr_create catalog::itemcnode::NODEDIR='@{node}'
184 attr_create catalog::itemcnode::NFTYPE='
185 srcdir:c/h/cunittest/mdl;
186 testdir:shtest/stdout/timecost;
187 docdir/designdir:md'
189 # [itemcppnode]
190 #########################
191 # it's the node under current dir. and NODEDIR='@{node}'.
192 # '@{node}' is under dirnode, and all code under the dir of '@{node}'.
193 attr_create catalog::itemcppnode::NODEDIR='@{node}'
194 attr_create catalog::itemcppnode::NFTYPE='
195 srcdir:cpp/h/cppunittest;
196 testdir:shtest/stdout/timecost;
197 docdir/designdir:md'
199 # [itemmdlnode]
200 #########################
201 # it's the node under current dir. and NODEDIR='@{node}'.
202 # '@{node}' is under dirnode, and all code under the dir of '@{node}'.
203 attr_create catalog::itemmdlnode::NODEDIR='@{node}'
204 attr_create catalog::itemmdlnode::NFTYPE='
205 srcdir:c/h/cunittest/mdl;
206 testdir:shtest/stdout/timecost;
207 docdir/designdir:md'
209 # [itemvalanode]
210 #########################
211 # it's the node under current dir. and NODEDIR='@{node}'.
212 # '@{node}' is under dirnode, and all code under the dir of '@{node}'.
213 attr_create catalog::itemvalanode::NODEDIR='@{node}'
214 attr_create catalog::itemvalanode::NFTYPE='
215 srcdir:c/h/cunittest/vala;
216 testdir:shtest/stdout/timecost;
217 docdir/designdir:md'
219 # content node string
220 # the output of content string is generated by STR_FMT, but the reverse procedure is produced
221 # by tmpl.
222 # [contnode]
223 #########################
224 #attr_create catalog::contnode::STR_FMT='@{NDESC}'
225 #attr_create catalog::contnode::regex='<([a-zA-Z0-9_ ]*)> [([a-zA-Z0-9_ ]*)] ([a-zA-Z0-9_ ]*) "([a-zA-Z0-9_ ]*)"'
226 #attr_create catalog::contnode::sepchar='.'
227 #attr_create catalog::contnode::attr_wrap=( "none" "wrap1" "wrap2" "wrap3" "<" "<<" "<<<" "[" "\"" "[" )
228 #attr_create catalog::contnode::attr_idx=\( NDESC \)
229 #attr_create catalog::contnode::nid_idx= 0
232 #############################################################
233 # test dir
234 #############################################################
236 # [testdir]
237 #########################
238 # main file for itemnode.
239 attr_create catalog::testdir::SUBDIR='testing'
240 attr_create catalog::testdir::OUTPUT_DIR_FMT='@{SRCPKG_DIR}/@{SUBDIR}/@{LAYEDDIR}/@(NODEDIR)'
241 attr_create catalog::testdir::STR_FMT='@{NCATAID}.@{NNAME}.@{NTYPE}'
242 attr_create catalog::testdir::SEPCHAR='.'
243 attr_create catalog::testdir::sfx='.@{NTYPE}'
245 # dir node string
246 # it's used for node listing, under a dir.
247 # [dirnode]
248 #########################
250 attr_create catalog::testdir::dirnode::STR_FMT='@{NCATAID}.@{NNAME}.@{NTYPE}'
251 attr_create catalog::testdir::dirnode::SEPCHAR='.'
252 # list files under a dir. get the main node info, and use it to get item info.
253 # -1, list one file per line.
254 # -d, list dir without its content.
255 # -X, list dir first, then files. it's the default opt.
256 # -U, do not sort. all those sorting opt are actived in cmdline opt sequence.
257 # -f, do not sort. enable -aU, disable -ls --color.
258 # -v, natual sort. by number. if @{NCATAID} specified in generating, file/dir with name
259 # of id, which can be used for sorting, and filter other un-matched file. put this opt
260 # at the last position.
261 # -S, sort by size, largest first.
262 # -t, sort by modify time.
263 # -c, sort by create time.
264 # --sort=time, sort by access time. valid arguments are none, time, size, extension, version.
265 # @{NFEXT_LIST}, main/major ext-name, the first file ext-name defined in NFTYPE. or ext-name list.
266 # or use specified ext-name directly.
267 # @{NTYPE_LIST},
268 # -r, reverse order while sorting.
269 attr_create catalog::testdir::dirnode::ls_opt_fmt='-f -1 -d -v @{NFEXT_LIST} @{NTYPE_LIST} | grep -v "@{NFEXT_DISABLE_LIST}"'
270 #attr_create catalog::testdir::dirnode::NFEXT_DISABLE_LIST='_test\.sh'
271 # it should be defined in global info.
272 attr_create catalog::testdir::dirnode::NFEXT_LIST='*.sh'
273 # it should be defined in global info.
274 attr_create catalog::testdir::dirnode::NTYPE_LIST='*.item *.dir *.module *.unit'
276 # item node string
277 # [itemnode]
278 #########################
279 # used for dir creating, all sub-files put in it. if not defined, it do not use dir creating step.
280 #attr_create catalog::dirnode::STR_FMT='@{NNAME}.desc.@{NFEXT}'
281 # it's used for itemnode files listing.
282 # or use @{get_ext_opt_list} to run script func.
283 attr_create catalog::testdir::itemnode::ls_opt_fmt='-f -1 -d -v @{NFEXT_LIST} | grep -e "@{NFEXT_DISABLE_LIST}"'
284 attr_create catalog::testdir::itemnode::NFEXT_DISABLE_LIST='_test\.sh'
285 # this paramter is generated when catalog::itemXXXnode analyzing. the file ext-name list is generated by
286 # catalog::<file-type>::sfx, and <file-type> is defined in catalog::itemXXXnode::NFTYPE.
287 attr_create catalog::testdir::itemnode::NFEXT_LIST='*_test.sh *.stdout *.timecost *.desc'
288 attr_create catalog::testdir::itemnode::SEPCHAR='.'
291 #############################################################
292 # src dir
293 #############################################################
295 # [srcdir]
296 #########################
297 # main file for itemnode.
298 attr_create catalog::srcdir::SUBDIR='src'
299 attr_create catalog::srcdir::OUTPUT_DIR_FMT='@{SRCPKG_DIR}/@{SUBDIR}/@{LAYEDDIR}/@(NODEDIR)'
300 attr_create catalog::srcdir::STR_FMT='@{NCATAID}.@{NNAME}.@{NTYPE}'
301 attr_create catalog::srcdir::SEPCHAR='.'
302 attr_create catalog::srcdir::sfx='.@{NTYPE}'
304 # dir node string
305 # it's used for node listing, under a dir.
306 # [dirnode]
307 #########################
308 attr_create catalog::srcdir::dirnode::STR_FMT='@{NCATAID}.@{NNAME}.@{NTYPE}'
309 attr_create catalog::srcdir::dirnode::SEPCHAR='.'
310 attr_create catalog::srcdir::dirnode::ls_opt_fmt='-f -1 -d -v @{NFEXT_LIST} @{NTYPE_LIST} | grep -v "@{NFEXT_DISABLE_LIST}"'
311 attr_create catalog::srcdir::dirnode::NFEXT_DISABLE_LIST='_test\.sh'
312 attr_create catalog::srcdir::dirnode::NFEXT_LIST='*.sh'
313 attr_create catalog::srcdir::dirnode::NTYPE_LIST='*.item *.dir *.module *.unit'
315 # item node string
316 # [itemnode]
317 #########################
318 #attr_create catalog::dirnode::STR_FMT='@{NNAME}.desc.@{NFEXT}'
319 attr_create catalog::srcdir::itemnode::ls_opt_fmt='-f -1 -d -v @{NFEXT_LIST} | grep -e "@{NFEXT_DISABLE_LIST}"'
320 attr_create catalog::srcdir::itemnode::NFEXT_DISABLE_LIST='_test\.c'
321 attr_create catalog::srcdir::itemnode::NFEXT_LIST='*.c *.h *_test.c'
322 attr_create catalog::srcdir::itemnode::SEPCHAR='.'
325 #############################################################
326 # design dir
327 #############################################################
329 # [designdir]
330 #########################
331 # main file for itemnode.
332 attr_create catalog::designdir::SUBDIR='doc/design-doc'
333 attr_create catalog::designdir::OUTPUT_DIR_FMT='@{SRCPKG_DIR}/@{SUBDIR}/@{LAYEDDIR}/@(NODEDIR)'
334 attr_create catalog::designdir::STR_FMT='@{NCATAID}.@{NNAME}'
335 attr_create catalog::designdir::SEPCHAR='.'
337 # dir node string
338 # it's used for node listing, under a dir.
339 # [dirnode]
340 #########################
341 attr_create catalog::designdir::dirnode::STR_FMT='@{NCATAID}.@{NNAME}.@{NTYPE}'
342 attr_create catalog::designdir::dirnode::SEPCHAR='.'
343 attr_create catalog::designdir::dirnode::ls_opt_fmt='-f -1 -d -v @{NFEXT_LIST} @{NTYPE_LIST} | grep -v "@{NFEXT_DISABLE_LIST}"'
344 attr_create catalog::designdir::dirnode::NFEXT_DISABLE_LIST='_test\.sh'
345 attr_create catalog::designdir::dirnode::NFEXT_LIST='*.sh'
346 attr_create catalog::designdir::dirnode::NTYPE_LIST='*.item *.dir *.module *.unit'
348 # item node string
349 # [itemnode]
350 #########################
351 #attr_create catalog::dirnode::STR_FMT='@{NNAME}.desc.@{NFEXT}'
352 attr_create catalog::designdir::itemnode::ls_opt_fmt='-f -1 -d -v @{NFEXT_LIST} | grep -e "@{NFEXT_DISABLE_LIST}"'
353 attr_create catalog::designdir::itemnode::NFEXT_DISABLE_LIST='_test\.sh'
354 attr_create catalog::designdir::itemnode::NFEXT_LIST='*.sh *.stdout *.timecost'
355 attr_create catalog::designdir::itemnode::SEPCHAR='.'
358 #############################################################
359 # doc dir
360 #############################################################
362 # [docdir]
363 #########################
364 # main file for itemnode.
365 attr_create catalog::docdir::SUBDIR='doc/manual'
366 attr_create catalog::docdir::STR_FMT='@{NCATAID}.@{NNAME}'
367 attr_create catalog::docdir::SEPCHAR='.'
369 # dir node string
370 # it's used for node listing, under a dir.
371 # [dirnode]
372 #########################
373 attr_create catalog::docdir::dirnode::STR_FMT='@{NCATAID}.@{NNAME}.@{NTYPE}'
374 attr_create catalog::docdir::dirnode::SEPCHAR='.'
375 attr_create catalog::docdir::dirnode::ls_opt_fmt='-f -1 -d -v @{NFEXT_LIST} @{NTYPE_LIST} | grep -v "@{NFEXT_DISABLE_LIST}"'
376 attr_create catalog::docdir::dirnode::NFEXT_DISABLE_LIST='_test\.sh'
377 attr_create catalog::docdir::dirnode::NFEXT_LIST='*.sh'
378 attr_create catalog::docdir::dirnode::NTYPE_LIST='*.item *.dir *.module *.unit'
380 # item node string
381 # [itemnode]
382 #########################
383 #attr_create catalog::dirnode::STR_FMT='@{NNAME}.desc.@{NFEXT}'
384 attr_create catalog::docdir::itemnode::ls_opt_fmt='-f -1 -d -v @{NFEXT_LIST} | grep -e "@{NFEXT_DISABLE_LIST}"'
385 attr_create catalog::docdir::itemnode::NFEXT_DISABLE_LIST='_test\.sh'
386 attr_create catalog::docdir::itemnode::NFEXT_LIST='*.sh *.stdout *.timecost'
387 attr_create catalog::docdir::itemnode::SEPCHAR='.'
391 ##############################
392 # section: file tail
393 ##############################