Re: generic coding problem
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Aug 08, 2006
- 530 views
On Mon, 07 Aug 2006 11:46:54 -0700, ChrisBurch2 <guest at RapidEuphoria.com> wrote: >As much to write this down, as to ask for help. Understood. > >I create a 2d table, with an unknown number of columns, and an unknown number >of rows > >Each of the columns has an unknown, but uniform number of characters (ie each >cell in the column has the same length) So during/after creation of the 2d table are you checking down every column in the table to get the maxwidth? > >I want to print the table on a printer using fixed fonts. > >The printer can either support 80 or 124 characters. Printing switches from >80 to 124 if the total character count (with spaces) is greater than 80. > >When printing the row title must always be shown, but the column title does >not need to be shown, except as a first row > >All the data must be printed, word wrapping is not allowed. So after adding all the column maxwidths and finding it greater than 124, what are you doing? Do you want to find the column(s) which mini-wrap to give shortest overall report, eg: kernel32.dll OpenFile Some fairly long description which is probably the best thing to wordwrap... kernel32.dll ReadFile kernel32.dll WriteFile kernel32.dll CloseFile rather than: kernel32 Open Some fairly long description which is ... .dll File kernel32 Read .dll File kernel32 Write .dll File kernel32 Close .dll File Or is >124 an error, or just truncated? > >I started with the concept of a 'page' onto which I place the characters of >each cell, but my brain is exploding. I'd analyse everything, then build a format string (or two), then print in one pass at the end, possibly under control of some table I built in the analysis phase. >Has anyone done anything like this before. BTW this is not windows or >wxEuphoria programming, just raw stuff. The only thing which springs to mind for me is my common code analysis routine (now part of edita [eacca.e]) which outputs eg: -- 9095 9105 styleMask = xor_bits... -- 9096 | style = and_bits( style... -- 9097 9107 9159 9168 if style != curStyle then -- 9098 9160 VOID = w32Func... Now I know this is probably not relevant, but 9105..9107 (length 3) as the longest matching group gets prime position in column 1, then 9159..1960 (length 2) is next but since it can't all go in column 1 it all goes in column 2, and lastly 9168 (length 1) goes in the next available column, 3. So it is playing with columns, first calculating what needs to be printed, then where, but is unlikely to be the sort of thing you mean. Regards, Pete PS thanks for the startup monitor link.