edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Adam Thompson <arthompson1990@gmail.com>
To: Chris Brannon <chris@the-brannons.com>
Cc: edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] Javascript support
Date: Sun, 22 Dec 2013 19:10:49 +0000	[thread overview]
Message-ID: <20131222191049.GA16257@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <87lhzcd96f.fsf@mushroom.PK5001Z>

On Sun, Dec 22, 2013 at 10:36:56AM -0800, Chris Brannon wrote:
> Adam Thompson <arthompson1990@gmail.com> writes:
> 
> > "SpiderMonkey now provides a fully C++ interface,
> > so embedders relying on embeddability in C projects will have to convert to
> > C++, or implement their own adapter code."
> 
> Thank you ever so much for doing the research.

That's ok, I've been thinking of looking at this for a while,
though it's not until now that I've had the time.

> Years ago, we batted around the idea of rewriting edbrowse in C++.

Yeah, I noticed it in the todo.

> Those string objects would sure be nice, and after all, edbrowse is very
> string-intensive.  We also use lists in some places, and we could use
> STL's list container instead.  But it never happened.  C++ is a
> complicated beast.  The people who work on edbrowse are more comfortable
> with C.  I used to be decent with C++, but I've managed to forget most
> of what I knew.  So I'm not chomping at the bit to do this.

I also prefer working in C, but have been forced to become fairly decent in c++ in
order to use certain c++-only libraries.
Honestly, although the string objects would be nice in terms of moving code out
of edbrowse, and the same for stl lists,
personally I've never really minded handling this kind of thing in C. Also as you
said c++ brings its own set of complications.

> I wonder how difficult the adapter code will be?  I assume it'll just be tedious.

I've got an idea how to do it whilst hopefully minimising the changes.
I think the main files to alter are jsdom.c and jsloc.c.
I'd then provide a jsdom.h and jsloc.h (or something)
which is included in the rest of the program.
This, with a few more changes, should *hopefully* allow the c++ code to be
isolated to these 2 files.
In the makefile, these would then be built with the c++ compiler,
with the rest of the project still built using the c compiler.
This assumes of course that there aren't additional functions in other files
which require bits of the javascript library.
If so, they'd have to be added to the adapter api.

This approach'd also have the nice side-effect that,
if in the future we decide to abandon SpiderMonkey altogether,
we'd only have to change the implementation of the api exposed to edbrowse.
At least that's the theory.

Does this sound sensible?  Anything I've missed?

Cheers,
Adam.

  reply	other threads:[~2013-12-22 19:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 18:45 [Edbrowse-dev] html unicode translations in edbrowse Karl Dahlke
2013-12-19 12:20 ` Adam Thompson
2013-12-21 18:00 ` [Edbrowse-dev] Javascript support MENGUAL Jean-Philippe
2013-12-22 15:42   ` Chris Brannon
2013-12-22 16:48     ` Adam Thompson
2013-12-22 18:36       ` Chris Brannon
2013-12-22 19:10         ` Adam Thompson [this message]
2014-01-08 12:50   ` Adam Thompson
2013-12-22 22:26 Karl Dahlke
2013-12-23  9:26 ` Adam Thompson
2013-12-23 14:26   ` Chris Brannon
2013-12-24  9:25     ` Adam Thompson
2013-12-23 14:29 Karl Dahlke

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=20131222191049.GA16257@toaster.adamthompson.me.uk \
    --to=arthompson1990@gmail.com \
    --cc=chris@the-brannons.com \
    --cc=edbrowse-dev@lists.the-brannons.com \
    /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).