edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev]    js engine process, version 1
@ 2014-12-23 22:50 Karl Dahlke
  2014-12-24  8:09 ` Adam Thompson
  0 siblings, 1 reply; 8+ messages in thread
From: Karl Dahlke @ 2014-12-23 22:50 UTC (permalink / raw)
  To: Edbrowse-dev

> it'd be nicer if the alert, prompt etc functions were done as part of the
> protocol, letting edbrowse handle user interaction I think.

Yeah I think so too, I was saving that for a future increment.

> I don't see why this can't be done via ipc messages.

I may not know enough, but I don't think ipc messages play nice with
select, looking toward the day when we must monitor
many input streams at the same time,
many events coming in from many sources.
You can select on many file descriptors, as I do in my adapter and
other programs, but I don't think you can select on 4 file
descriptors and an ipc message queue.
If I'm wrong, we can switch from pipes to messages in the future,
if it makes sense to do so.
Probably not a big difference either way.

Karl Dahlke

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [Edbrowse-dev]   js engine process, version 1
@ 2014-12-23 22:17 Karl Dahlke
  2014-12-23 22:31 ` Adam Thompson
  0 siblings, 1 reply; 8+ messages in thread
From: Karl Dahlke @ 2014-12-23 22:17 UTC (permalink / raw)
  To: Edbrowse-dev

I forgot about some of the handler functions.
Let me have a look and evaluate, and then I'll
bat it back into your court.

Karl Dahlke

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [Edbrowse-dev]  js engine process, version 1
@ 2014-12-23 19:50 Karl Dahlke
  2014-12-23 21:38 ` Adam Thompson
  0 siblings, 1 reply; 8+ messages in thread
From: Karl Dahlke @ 2014-12-23 19:50 UTC (permalink / raw)
  To: Edbrowse-dev

Adam offers:
> I may have a go at plugging in the new code at some stage.

Let me know if you want to take a whack at it. That would be great.
If not I may try it next week. Either is fine with me.

This is a roadmap.

struct tagInfo and htmlTag move back into eb.h.
In fact we won't need js.h at all.

Once the vital declarations move from js.h into eb.h,
change makefile so it doesn't refer to js.h or jsdom.cpp or jsloc.cpp.
Nor does it need the mozilla headers or libraries,
except for the target edbrowse-js, which builds properly today.
And include edbrowse-js under all:

struct htmlTag has the member jv, javascript variable,
which links this tag to the corresponding object in the js world.
currently HeapRootedObject jv; needs to be jsobjtype jv;

Rename createJavaContext1 to createJavaContext in ebjs.c
and similarly for freeJavaContext1.

Remove the block at the top of ebjs.c that is there just for stand alone
compilation.

Generate the prototypes for ebjs.c, I can do it with my tool if you like,
and put them into eb.p.
We won't need ebjs.p any more.

Many of these functions are plug in replacements for the old functions.
get_property_string(object, name)
it does what it did before.
So I'm hoping it is an easy process from here.
Put it all together and build the new edbrowse.

Make sure edbrowse-js is linked into your path, or edbrowse won't
be able to exec edbrowse-js - although you may want to test
that condition as well.

Lots of testing, websites, javascript, and of course exercising jsrt.

Once we have some confidence in the new architecture, delete js.h ebjs.p
jsdom.cpp jsloc.cpp.

Convert html.cpp back to html.c.
Sadly, there were a few times I used c++ strings in here, for convenience,
and I think you told me not to, and now I see why.
Switch these back to strings using my dynamic string management routines
in stringfile.c, then the file can go back to html.c

Change makefile flags and libraries so edbrowse is a C program again.

Globally replace eb_bool eb_true eb_false with bool true false,
and appropriate #defines in eb.h, as it was before.

3.5.3

Then we can take the next step and the next and the next.

Karl Dahlke

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [Edbrowse-dev] js engine process, version 1
@ 2014-12-22 20:23 Karl Dahlke
  2014-12-23 18:46 ` Adam Thompson
  0 siblings, 1 reply; 8+ messages in thread
From: Karl Dahlke @ 2014-12-22 20:23 UTC (permalink / raw)
  To: Edbrowse-dev

Just in time for Christmas - but don't get too excited,
because it is entirely untested. All I know is it compiles.
git pull
and read through jseng-moz.cpp
It corresponds to ebjs.c.
They send messages to each other in a coordinated fashion.

make edbrowse-js
Then run edbrowse-js to get the usage.
That's as far as I got.

I was almost ready to commit this file yesterday,
having worked on it for a week solid,
and then I deleted it. No shit!
I typed rm instead of mv or cp or whatever the hell I was trying to do,
and the file was gone, with absolutely no backups.
So I had to start over.
Fortunately most of it was still in my head,
and there was lots of copying and modifying from the existing files,
and I remembered how I did it, so stayed up all night
while it was fresh in my mind and banged it out again,
then sent it to github in a hurry!

The first thing you see is several small functions copied from
stringfile.c and url.c.
These are functions that I just need everywhere.
This is duplication, and that concerns me,
but I didn't want to drag in eb.h, and from there all of edbrowse,
so for now I copied the routines I needed.
Some day we might want to put these into common.c or some such.

Finally the real code begins at line 546.
Message management, much like that in ebjs.c, and the dom classes
and setters and side effects and all that.
If you like statistics, the new code is 3408 lines,
and the old code is 3100 lines.
Since the new has all sorts of messaging and message parsing,
that wasn't there before, it's fair to say I was able to optimize
much of the old code along the way.
One example is making use of the C preprocessor.
Look at the definitions for generic_class and generic_ctor
Now the classes and constructors are basically a list,
whereas they use to be pages of essentially the same C code
over and over and over again.
I feared this trick might derail indent,
but it seems to have indented the code properly,
except it keeps getting rid of the blank line after the list of classes,
not sure why.
Maybe I should put a semicolon in just to get it back on track.

As I say this is all untested.
I wanted to do some stand-alone tests,
but I'd have to write some nontrivial programs to do that.
It's probably about the same work to just take the plunge
and modify edbrowse to use the new interface,
and test it in battle.
I'm not going to attempt any of this until after christmas.
That gives you time to find some bugs in the code just by reading it.

Karl Dahlke

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-12-24  8:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-23 22:50 [Edbrowse-dev] js engine process, version 1 Karl Dahlke
2014-12-24  8:09 ` Adam Thompson
  -- strict thread matches above, loose matches on Subject: below --
2014-12-23 22:17 Karl Dahlke
2014-12-23 22:31 ` Adam Thompson
2014-12-23 19:50 Karl Dahlke
2014-12-23 21:38 ` Adam Thompson
2014-12-22 20:23 Karl Dahlke
2014-12-23 18:46 ` Adam Thompson

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).