?

Log in

No account? Create an account
Previous Entry Share Next Entry
The shortest way....
ajose
In my case, lately, truly the shortest way was to go back and change the way I was going on the SGML parser as it was getting too complex to get the right addresses and length of the string where the message is, while being parsed, to get the TAG data and CONTAINER's data.

So, I wen on another path.
Now, I have a special word that compiles a word with a data structure where I have ALL elements data (their address, length and type) and 3 index tables, one for the TAGs, another for TEXT elements and another for ENTITIES.
So, now, if I want to know how many elements I have, I just have to use:

-1  0  MML_ROOT_DATA

and get the address where I have the total number of elements.

If I want to know how many TAGs I have, I just use

1  0  MML_ROOT_DATA

and for the first TAG I use:

1  1  MML_ROOT_DATA, etc.

For text elements, the 1st value is 2 instead of 1 and for ENTITIES is 3.

So, now it's a piece of cake to see if a TAG is a simple TAG or a CONTAINER and to extract their parameters and or contents, in the cae of the containers!