edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Adam Thompson <arthompson1990@gmail.com>
To: Karl Dahlke <eklhad@comcast.net>
Cc: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] tag list
Date: Sun, 2 Mar 2014 13:47:52 +0000	[thread overview]
Message-ID: <20140302134752.GM19851@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <20140201142432.eklhad@comcast.net>

[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]

On Sat, Mar 01, 2014 at 02:24:32PM -0500, Karl Dahlke wrote:
> Yeah, this is something I got confused about too,
> until Chris set me straight.
> Duh - I wrote it - and then I got confused about it.
> I can be dumb as a box of rocks sometimes.

I remembered something about this after I replied but couldn't remember the 
details.
At some stage I really need to familiarise myself with the html code.

> The linked list or array or vector or whatever holds pointers
> to struct htmlTag, not the struct itself.
> So structs can go ahead and point to each other as parents and children,
> because the structs don't move.
> The growing vector simply reallocates the list of pointers to those structures.

Stupid question, and appologies if this's already been asked,
but why are we storing a list of pointers?
> 
> I already do this, don't I?
> t->controller is the form that owns the input tag,
> and for an option t->controller is the select that owns the option.
> Just rename controller parent and you're halfway there.

We also need to store a list of children in each tag, i.e. in the code:
<body>
<div>
<p>whatever</p>
<p>Some more text</p>
</div>
<div>
<p>Footer text</p>
</div>
</body>

The body would have a list of two pointers to the two div tags,
the first div tag would need to hold a list of two pointers to the two p tags
under it, whilst the second div tag only has one pointer to the p tag under it.
As you say though, each tag only needs a single parent link,
which simplifies things.
> 
> So with this in mind 
> 
> static list < struct htmlTag *>htmlStack;
> 
> becomes
> 
> static vector < struct htmlTag *>htmlStack;
> 
> Then sure it's all normal after that, and I'd just love to
> set cw->tags to htmlStack, but cw->tags
> is one of those things that is in C, not C++.
> In fact it's in eb.h, thus in every C file,
> so we'd have to use void * or some such, or convert the whole project to C++.

Or according to [1] set it to:
cw->tags = &htmlStack.front();
> But that's the idea, and we can certainly move forward there.

No need to do this rewrite at the moment,
and I think we need to get the js stuff sorted before we start contemplating
any possible benefits (I'm still not entirely convinced honestly) of doing this.

> Then there is no trouble adding new tags as we need to,
> as js creates new thingees for us.

Yeah, as long as we ensure we append the correct child list and set the parent
pointer correctly.

Cheers,
Adam.
[1] http://stackoverflow.com/questions/6485496/how-to-get-stdvector-pointer-to-the-raw-data

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-03-02 13:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-01 19:24 Karl Dahlke
2014-03-02 13:47 ` Adam Thompson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-03-02 14:15 Karl Dahlke
2014-03-02 19:28 ` Adam Thompson
2014-03-01 14:00 Karl Dahlke
2014-03-01 19:01 ` Adam Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140302134752.GM19851@toaster.adamthompson.me.uk \
    --to=arthompson1990@gmail.com \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    --cc=eklhad@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).