.
D 2020-04-17T13:33:49.924
J comment <div>Dear\sSean,</div><div><br\s/></div><div>thank\syou\sfor\sgreat\sC-VFS.\sI\sam\strying\sto\sget\sit\sworking\sby\slittle\ssteps.</div><div>There\smight\sbe\sa\swiki\srecipe\son\ssuccess\sfor\sthe\smedium\sprogrammer\sof\sthis\swizard\sprogram.<br\s/></div><div><br\s/></div><div>Just\sa\snote.\sTCL\sand\sMetakit\sis\snormally\sC89\sclean.\sThe\soutput\sof\sdir2c.tcl\sis\snot,\sas\sit\suses\sthis\sstyle\sof\sinitialization:</div><div><br\s/></div><div><verbatim></div><div>static\sstruct\scvfs_data\scvfs_tcl_data[]\s=\s{<br\s/> \s{<br\s/> \s/*\sIndex\s0\scannot\sbe\sused\sbecause\swe\suse\sthe\svalue\s0\sto\srepresent\sfailure\s*/<br\s/> \s.name \s=\sNULL,<br\s/> \s.index\s=\s0,<br\s/> \s.type \s=\s0,<br\s/> \s.size \s=\s0,<br\s/> \s.data \s=\sNULL,<br\s/> \s.free \s=\s0,<br\s/> \s},</div><div></verbatim><br\s/></div><div><br\s/></div><div>Unfortunately,\sC89\sdoes\snot\sallow\sto\sname\sthe\sstructure\sitems.</div><div>The\spatch\sbelow\stransforms\sthis\soutput\sinto:</div><div><br\s/></div><div><verbatim></div><div>static\sstruct\scvfs_data\scvfs_tcl_data[]\s=\s{<br\s/> \s{<br\s/> \s/*\sIndex\s0\scannot\sbe\sused\sbecause\swe\suse\sthe\svalue\s0\sto\srepresent\sfailure\s*/<br\s/> \s/*\sname \s*/\sNULL,<br\s/> \s/*\sindex\s*/\s0,<br\s/> \s/*\stype \s*/\s0,<br\s/> \s/*\ssize \s*/\s0,<br\s/> \s/*\sdata \s*/\sNULL,<br\s/> \s/*\sfree \s*/\s0,<br\s/> \s},<br\s/></div><div></verbatim></div><div><br\s/></div><div>Here\sis\sthe\spatch:</div><div><br\s/></div><div><verbatim></div><div>---\sC:/oehhar/elmicron/projekte/el1005_scanlink_dll/source/c-vfs/dir2c_ori.tcl \sWed\sJan\s22\s20:53:52\s2020<br\s/>+++\sC:/oehhar/elmicron/projekte/el1005_scanlink_dll/source/c-vfs/dir2c.tcl \sFri\sApr\s17\s10:20:20\s2020<br\s/>@@\s-306,20\s+306,20\s@@<br\s/> <br\s/> # \sendif\s/*\s!LOADED_CVFS_COMMON\s*/}<br\s/> puts\s""<br\s/> <br\s/> puts\s"static\sstruct\scvfs_data\s${code_tag}_data\\[\\]\s=\s{"<br\s/> puts\s"\\t{"<br\s/> puts\s"\\t\\t/*\sIndex\s0\scannot\sbe\sused\sbecause\swe\suse\sthe\svalue\s0\sto\srepresent\sfailure\s*/"<br\s/>-puts\s"\\t\\t.name \s=\sNULL,"<br\s/>-puts\s"\\t\\t.index\s=\s0,"<br\s/>-puts\s"\\t\\t.type \s=\s0,"<br\s/>-puts\s"\\t\\t.size \s=\s0,"<br\s/>-puts\s"\\t\\t.data \s=\sNULL,"<br\s/>-puts\s"\\t\\t.free \s=\s0,"<br\s/>+puts\s"\\t\\t/*\sname \s*/\sNULL,"<br\s/>+puts\s"\\t\\t/*\sindex\s*/\s0,"<br\s/>+puts\s"\\t\\t/*\stype \s*/\s0,"<br\s/>+puts\s"\\t\\t/*\ssize \s*/\s0,"<br\s/>+puts\s"\\t\\t/*\sdata \s*/\sNULL,"<br\s/>+puts\s"\\t\\t/*\sfree \s*/\s0,"<br\s/> puts\s"\\t},"<br\s/> for\s{set\sidx\s1}\s{$idx\s<\s[llength\s$files]}\s{incr\sidx}\s{<br\s/> \sset\sfile\s[lindex\s$files\s$idx]<br\s/> \sset\sshortfile\s[shorten_file\s$startdir\s$file]<br\s/> <br\s/> \sunset\s-nocomplain\sfinfo\stype<br\s/> \sfile\sstat\s$file\sfinfo<br\s/>@@\s-345,20\s+345,20\s@@<br\s/> \s \s \sset\stype\s"CVFS_FILETYPE_DIR"<br\s/> \s \s \sset\sdata\s"NULL"<br\s/> \s \s \sset\ssize\s0<br\s/> \s \s}<br\s/> \s}<br\s/> <br\s/> \sputs\s"\\t{"<br\s/>- \sputs\s"\\t\\t.name \s=\s\\"$shortfile\\","<br\s/>- \sputs\s"\\t\\t.index\s=\s$idx,"<br\s/>- \sputs\s"\\t\\t.type \s=\s$type,"<br\s/>- \sputs\s"\\t\\t.size \s=\s$size,"<br\s/>- \sputs\s"\\t\\t.data \s=\s$data,"<br\s/>- \sputs\s"\\t\\t.free \s=\s0,"<br\s/>+ \sputs\s"\\t\\t/*\sname \s*/\s\\"$shortfile\\","<br\s/>+ \sputs\s"\\t\\t/*\sindex\s*/\s$idx,"<br\s/>+ \sputs\s"\\t\\t/*\stype \s*/\s$type,"<br\s/>+ \sputs\s"\\t\\t/*\ssize \s*/\s$size,"<br\s/>+ \sputs\s"\\t\\t/*\sdata \s*/\s$data,"<br\s/>+ \sputs\s"\\t\\t/*\sfree \s*/\s0,"<br\s/> \sputs\s"\\t},"<br\s/> }<br\s/> puts\s"};"<br\s/> puts\s""<br\s/> <br\s/> puts\s"static\sunsigned\slong\s${code_tag}_lookup_index(const\schar\s*path)\s{"<br\s/> puts\s"\\tswitch\s(cvfs_hash((unsigned\schar\s*)\spath))\s{"</verbatim><br\s/></div><div><br\s/></div><div>Thank\syou\sand\sbest\sregards,</div><div>Harald<br\s/></div>
J login anonymous
J severity Critical
J status Open
J title Output\sC89\sdata\sfrom\sdir2c.tcl
J type Code\sDefect
K 127ac40147407d703ee7ccd70c865c6a87c53c56
U anonymous
Z 6127e5322bd86531aa3d86d47cf7d3bd