summaryrefslogtreecommitdiff
path: root/README
blob: 039bd6adf13b8b9cb71ae1a8a5f76a099e6e92d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
genjsbind
=========

This is a tool to generate javascript to dom bindings from w3c webidl
files and a binding configuration file.

building
--------

The tool requires bison and flex as pre-requisites

Commandline
-----------

nsgenbind [-v] [-g] [-D] [-W] [-I idlpath] inputfile outputdir

-v
The verbose switch makes the tool verbose about what operations it is
performing instead of teh default of only reporting errors.

-g
The generated code will be augmented with runtime debug logging so it
can be traced

-D
The tool will generate output to allow debugging of output conversion.
This includes dumps of the binding and IDL files AST

-W
This switch will make the tool generate warnings about various issues
with the binding or IDL files being processed.

-I
An additional search path may be given so idl files can be located.

The tool requires a binding file as input and an output directory in
which to place its output.


Debug output
------------

as well as the generated source the tool will output seevral debugging
files with the -D switch in use.

interface.dot

  The interfaces IDL dot file contains all the interfaces and their
   relationship. graphviz can be used to convert this into a visual
   representation which is sometimes useful to help in debugging
   missing or incorrect IDL inheritance.

  Processing the dot file with graphviz can produce very large files
   so care must be taken with options. Some examples that produce
   adequate output:

  # classical tree
  dot -O -Tsvg interface.dot

  # radial output
  twopi -Granksep=10.0 -Gnodesep=1.0 -Groot=0009 -O -Tsvg interface.dot


Web IDL
-------

The IDL is specified in a w3c document[1] but the second edition is in
draft[2] and covers many of the features actually used in the whatwg
dom and html spec.

The principal usage of the IDL is to define the interface between
scripts and a browsers internal state. For example the DOM[3] and
HTML[4] specs contain all the IDL for acessing the DOM and interacting
with a web browser (this not strictly true as there are several
interfaces simply not in the standards such as console).

The IDL uses some slightly strange names than other object orientated
systems.

   IDL     |  JS              |  OOP           |  Notes
-----------+------------------+----------------+----------------------------
 interface | prototype        | class          | The data definition of
           |                  |                |  the object
 constants | read-only value  | class variable | Belong to class, one copy
           |  property on the |                |
           |  prototype       |                |
 operation | method           | method         | functions that can be called
 attribute | property         | property       | Variables set per instance
-----------+------------------+----------------+----------------------------

[1] http://www.w3.org/TR/WebIDL/
[2] https://heycam.github.io/webidl/
[3] https://dom.spec.whatwg.org/
[4] https://html.spec.whatwg.org/