How did an array table(row,column)? the cell(row,column) is a string which has a different sizes.

Posted on 2005-12-07 02:59:39 by dcskm4200
you can build it as linked list of structures

pcol1 dd ?
pcol2 dd ?
pcol3 dd ?
pcol4 dd ?
pnext dd ?

each will point to its strings. adding strings/rows should be simple, removing/editing will need memory control. regards!
if you will need variable column number, you can use linked lists for columns also instead of fixed number of pointers: more complex, but more flexible. regards!
Posted on 2005-12-07 03:19:24 by Shoo
Hello, Shoo
Thanks you for answer.

(row,column)--------> ----------->strings(anysizes,depends on a user, not a coder)
can't waste memory, everystring follow on the heels of another string.
it looks as ListView, but without ListView.
How many rows and columns, a coder don't know.

how do i write or read the strings from the table?

Posted on 2005-12-07 05:40:16 by dcskm4200
of course, strings will go one by one in memory (see pict). i ment i just have no ready solution to manage such array, but it should not to be too hard - eg. a set of small functions. if "pointers" to strings in structures will be offsets from start of structure - then such block (structure + strings) became moveable. this will be nessesary when you will edit string and it became larger: you can move it to the end of the list where is some free space, shift full list/part here/there etc - it will need to be studied for timing/resource consumption.
Posted on 2005-12-07 06:10:53 by Shoo
If you set up an array of pointers to each string which is not all that hard to do, you can simply treat the pointer array as a table and access it in sequential steps and by this I mean array member 0, 16, 32, 48 etc .... then 1, 17, 33, 49 etc ....

This is probably the most flexible way and its access is certainly fast enough.
Posted on 2005-12-07 06:39:28 by hutch--
how do i write or read the strings from the table >
reading is simple:
proc GetStringPointer,_tab,_row,_col
   push ebx
   mov ebx,[_tab]
   mov ecx,[_row]
   test ebx,ebx
   jz  .error
   dec ecx
   jecxz @F
   mov ebx,
   jmp @B
   mov eax,[_col]
   mov eax,
    add eax,ebx ; oi! i forgot it
   pop ebx
   xor eax,eax
   pop ebx

writing will be more complex: you must be sure you will fit new string in its place. to do this you may need shift strings in one block or shift full list (tooo slow) or move one/some blocks to the end of list. it would be good to have string length at the start of the string - faster calculation. to reduce list shifting/block moving you may use some amount of memory for each block as minimal ("micro-heap" ;) ) and use it when string become larger after edition: then you will need move blocks only if new string will exceed that "heap". it is very wide topic. there is no good universal solution. i'm interesting to see what you will work out with all of this ;) regards!
Posted on 2005-12-07 06:46:06 by Shoo
Hello,Hutch-- and Shoo
Thanks you for guiding.

I'm faint, mess with this, need to hard study.
no work to do, wasting leisure times, really making fun.
another question:
have you a demo about arithmetic of sparse matrix?
best regards
Posted on 2005-12-07 08:27:36 by dcskm4200