show subscripts in dump - help and ideas requested - SOLVED
- Posted by petelomax May 13, 2015
- 1974 views
I am re-visiting the general purpose value dump in ex.err. What I would really like to see is something like:
symtab[1..15] = {1,0,3,4,0,0,0,8,0,0,0,12,0,0,15} symtab[16][1] = "C:\\Program Files (x86)\\Phix\\builtins\\" symtab[16][2] = "C:\\Program Files (x86)\\Phix\\" symtab[16][3] = "C:\\Program Files (x86)\\Phix\\demo\\misc\\eubins-mingw32\\" symtab[17][1..2] = {{3, "someotherfile.exw"}, {3, "somefile.e"}} symtab[17][3..5] = {{1, "prtnid2.e"}, {1, "psprint.e"}, {1, "pprntf.e"}} symtab[18..20] = {26,2,{-1073741819,0,32463637,32017528,253,32049420,0,0}} symtab[21][1..11] = {-1,8,1,2304,0,253, "P", 0,0,0,32452560} symtab[21][12][1..11] = {0,-77,28,35'#',38'&',-1,41')',46'.',-1,49'1',52'4'} symtab[21][12][12..22] = {55'7',-1,58':',-1,124'|',155,163,210,256,259,280} symtab[21][12][23..35] = {291,307,345,352,396,434,-1,436,478,483,-2,501,550} symtab[21][12][36..48] = {-1,561,-3,577,625,662,700,712,727,738,-1,744,782} symtab[21][12][49..61] = {790,808,852,890,905,950,-2,957,962,970,972,983,-2} symtab[21][12][62..65] = {991,1033,1038,1048} symtab[21][13..14] = {1,0} symtab[22] = 0 simple = 1 text = "text" shortsq = {-1,0-,1}I had a couple of goes but it is clearly a difficult thing to wrap my head around, and right now what I'm really doing is writing a statement of desired results to go and sleep on. Obviously I don't really care about details such as '#', the big problem is that what happens earlier on is dependent on what we find later. I think the above covers most of what I want, apart perhaps from splitting uber-long strings, which might get messy mid-long-sub-sequence.
Should you fancy a go, your not necessarily accurate starter for 10, for which you provide a clever_dump() routine, is:
constant symtab = {1,0,3,4,0,0,0,8,0,0,0,12,0,0,15, {"C:\\Program Files (x86)\\Phix\\builtins\\", "C:\\Program Files (x86)\\Phix\\", "C:\\Program Files (x86)\\Phix\\demo\\misc\\eubins-mingw32\\"}, {{3, "someotherfile.exw"}, {3, "somefile.e"}, {1, "prtnid2.e"}, {1, "psprint.e"}, {1, "pprntf.e"}}, 26,2, {-1073741819,0,32463637,32017528,253,32049420,0,0}, {-1,8,1,2304,0,253, "P", 0,0,0,32452560, {0,-77,28,35,38,-1,41,46,-1,49,52, 55,-1,58,-1,124,155,163,210,256,259,280, 291,307,345,352,396,434,-1,436,478,483,-2,501,550, -1,561,-3,577,625,662,700,712,727,738,-1,744,782, 790,808,852,890,905,950,-2,957,962,970,972,983,-2, 991,1033,1038,1048}, 1,0}, 0} clever_dump("symtab",symtab) clever_dump("simple",1) clever_dump("text","text") clever_dump("shortsq",{-1,0,1})
Oh, someone recently mentioned a /std string type which will hopefully be fine for this.
Of course I would be perfectly happy to have a simple flag which creates the older index-free style ex.err, please let me know if you think that's worthwhile doing.
And, I have to ask, does anyone else think this is a good idea, if we can do it?
Pete