Overview
Artifact ID: | 7d5d92c98e9680b19b4f7c0730fe7e6469ffc4a3 |
---|---|
Ticket: | 127ac40147407d703ee7ccd70c865c6a87c53c56
Output C89 data from dir2c.tcl |
User & Date: | anonymous on 2020-04-17 13:33:49 |
Changes
- comment changed to:
<div>Dear Sean,</div><div><br /></div><div>thank you for great C-VFS. I am trying to get it working by little steps.</div><div>There might be a wiki recipe on success for the medium programmer of this wizard program.<br /></div><div><br /></div><div>Just a note. TCL and Metakit is normally C89 clean. The output of dir2c.tcl is not, as it uses this style of initialization:</div><div><br /></div><div><verbatim></div><div>static struct cvfs_data cvfs_tcl_data[] = {<br /> {<br /> /* Index 0 cannot be used because we use the value 0 to represent failure */<br /> .name = NULL,<br /> .index = 0,<br /> .type = 0,<br /> .size = 0,<br /> .data = NULL,<br /> .free = 0,<br /> },</div><div></verbatim><br /></div><div><br /></div><div>Unfortunately, C89 does not allow to name the structure items.</div><div>The patch below transforms this output into:</div><div><br /></div><div><verbatim></div><div>static struct cvfs_data cvfs_tcl_data[] = {<br /> {<br /> /* Index 0 cannot be used because we use the value 0 to represent failure */<br /> /* name */ NULL,<br /> /* index */ 0,<br /> /* type */ 0,<br /> /* size */ 0,<br /> /* data */ NULL,<br /> /* free */ 0,<br /> },<br /></div><div></verbatim></div><div><br /></div><div>Here is the patch:</div><div><br /></div><div><verbatim></div><div>--- C:/oehhar/elmicron/projekte/el1005_scanlink_dll/source/c-vfs/dir2c_ori.tcl Wed Jan 22 20:53:52 2020<br />+++ C:/oehhar/elmicron/projekte/el1005_scanlink_dll/source/c-vfs/dir2c.tcl Fri Apr 17 10:20:20 2020<br />@@ -306,20 +306,20 @@<br /> <br /> # endif /* !LOADED_CVFS_COMMON */}<br /> puts ""<br /> <br /> puts "static struct cvfs_data ${code_tag}_data\[\] = {"<br /> puts "\t{"<br /> puts "\t\t/* Index 0 cannot be used because we use the value 0 to represent failure */"<br />-puts "\t\t.name = NULL,"<br />-puts "\t\t.index = 0,"<br />-puts "\t\t.type = 0,"<br />-puts "\t\t.size = 0,"<br />-puts "\t\t.data = NULL,"<br />-puts "\t\t.free = 0,"<br />+puts "\t\t/* name */ NULL,"<br />+puts "\t\t/* index */ 0,"<br />+puts "\t\t/* type */ 0,"<br />+puts "\t\t/* size */ 0,"<br />+puts "\t\t/* data */ NULL,"<br />+puts "\t\t/* free */ 0,"<br /> puts "\t},"<br /> for {set idx 1} {$idx < [llength $files]} {incr idx} {<br /> set file [lindex $files $idx]<br /> set shortfile [shorten_file $startdir $file]<br /> <br /> unset -nocomplain finfo type<br /> file stat $file finfo<br />@@ -345,20 +345,20 @@<br /> set type "CVFS_FILETYPE_DIR"<br /> set data "NULL"<br /> set size 0<br /> }<br /> }<br /> <br /> puts "\t{"<br />- puts "\t\t.name = \"$shortfile\","<br />- puts "\t\t.index = $idx,"<br />- puts "\t\t.type = $type,"<br />- puts "\t\t.size = $size,"<br />- puts "\t\t.data = $data,"<br />- puts "\t\t.free = 0,"<br />+ puts "\t\t/* name */ \"$shortfile\","<br />+ puts "\t\t/* index */ $idx,"<br />+ puts "\t\t/* type */ $type,"<br />+ puts "\t\t/* size */ $size,"<br />+ puts "\t\t/* data */ $data,"<br />+ puts "\t\t/* free */ 0,"<br /> puts "\t},"<br /> }<br /> puts "};"<br /> puts ""<br /> <br /> puts "static unsigned long ${code_tag}_lookup_index(const char *path) {"<br /> puts "\tswitch (cvfs_hash((unsigned char *) path)) {"</verbatim><br /></div><div><br /></div><div>Thank you and best regards,</div><div>Harald<br /></div>
- login: "anonymous"
- severity changed to: "Critical"
- status changed to: "Open"
- title changed to: "Output C89 data from dir2c.tcl"
- type changed to: "Code Defect"