diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..54a12b2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,79 @@ +This Software is MIT licensed but builds upon third-party libraries. + +MIT License + +Copyright (c) 2016 Nidium Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +############################################################################### +Nunjucks - A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired) +############################################################################### +Copyright (c) 2012-2015, James Long +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +############################################################################### +WebIDL2s - IDL Parse for node +############################################################################### +The MIT License (MIT) + +Copyright (c) 2014 Robin Berjon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/Makefile b/Makefile deleted file mode 100644 index cb509da..0000000 --- a/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -NODE=nodejs -NPM=npm -CLANGFORMAT=clang-format-3.5 -style=Mozilla - -PROJECT=./examples/Hello.idl -OUTPUT_DIR=./output/Hello -TEMPLATE_DIR=./templates - -TEMPLATES=$(shell find $(TEMPLATE_DIR) -type f) -TARGET=$(OUTPUT_DIR)/base_Hello.h - -all: $(TARGET) - -setup: package.json - @$(NPM) install - -$(TARGET): parse.js $(PROJECT) $(TEMPLATES) - @echo "creating" - @$(NODE) parse.js $(PROJECT) $(TEMPLATE_DIR) $(OUTPUT_DIR) - @echo "formatting" - @$(CLANGFORMAT) -i $(OUTPUT_DIR)/* - - -.PHONY: clean - -clean: - @echo "cleaning" - @rm -rf $(shell find $(OUTPUT_DIR)/ -type f) diff --git a/README.md b/README.md index e29ad27..7189d8d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,44 @@ # Generate CPP for JS based on IDL See [WebIDL spec](http://heycam.github.io/webidl/) for details + +# Usage: + +Currently there are 3 example projects. +In any of these directories you can start with: + +``` +make +``` +If not all dependencies are met, make should complain. + +The idl input files are supposed to be in the 'idl' subdirectory +The generated cpp code will be written in the cpp subdirectory. + +# Status + +This is a work in progress, allthough the first resulst look promissing. + +The following fields require more work: + +* UnionType +* OtherType +* callbacks +* dictionaries +* events +* .. + +# Spec + +There is no final specification yet, only an rough outline that is under discussion. +Details will follow asap. + +# Dependencies + +executables: 'npm', 'nodejs' +NodeJs modules: 'nunjucks', 'webidl2' + +# License + +Copyright 2016 Nidium Inc. All rights reserved. Use of this source code is governed by a MIT license that can be found in the LICENSE file. + diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..7d78949 --- /dev/null +++ b/config.mk @@ -0,0 +1,26 @@ +# Copyright 2016 Nidium Inc. All rights reserved. +# Use of this source code is governed by a MIT license +# that can be found in the LICENSE file. + +BIN_CLANGFORMAT := $(shell command -v clang-format-3.5 2> /dev/null) +BIN_NPM := $(shell command -v npm 2> /dev/null) +BIN_NODEJS := $(shell command -v nodejs 2> /dev/null) + +ifndef BIN_CLANGFORMAT + $(error "clang-format-3.5 is not available. Please install") +endif + +ifndef BIN_NPM + $(error "npm is not available. Please install") +endif + +ifndef BIN_NODEJS + $(error "nodejs is not available. Please install") +endif + +.PHONY: setup + +setup: package.json + @$(BIN_NPM) install + @echo "All node dependencies are installed; Have a look at the examples" + diff --git a/examples/Demo/.gitignore b/examples/Demo/.gitignore new file mode 100644 index 0000000..80a53cd --- /dev/null +++ b/examples/Demo/.gitignore @@ -0,0 +1 @@ +cpp diff --git a/examples/Demo/Makefile b/examples/Demo/Makefile new file mode 100755 index 0000000..b3883af --- /dev/null +++ b/examples/Demo/Makefile @@ -0,0 +1,23 @@ +# Copyright 2016 Nidium Inc. All rights reserved. +# Use of this source code is governed by a MIT license +# that can be found in the LICENSE file. + +INPUT_DIR=./idl +OUTPUT_DIR=./cpp +IMPL_PREFIX=sm_JS_ + +INPUT_FILES = $(shell find $(INPUT_DIR) -type f -name '*.idl') + +TARGETS = $(addprefix \ + $(join $(OUTPUT_DIR)/, $(IMPL_PREFIX)), \ + $(addsuffix .h, $(basename \ + $(notdir $(INPUT_FILES) ) \ + ) \ + ) \ + ) + +all: $(TARGETS) + @echo $(TARGETS) + +include ../common.mk + diff --git a/examples/Demo/idl/Fragment.idl b/examples/Demo/idl/Fragment.idl new file mode 100644 index 0000000..5a8de16 --- /dev/null +++ b/examples/Demo/idl/Fragment.idl @@ -0,0 +1,27 @@ +exception GraphicsException { + DOMString reason; +}; + +interface Paint { }; + +interface SolidColor : Paint { + attribute float red; + attribute float green; + attribute float blue; +}; + +interface Pattern : Paint { + attribute DOMString imageURL; +}; + +[Constructor] +interface GraphicalWindow { + readonly attribute unsigned long width; + readonly attribute unsigned long height; + + attribute Paint currentPaint; + + void drawRectangle(float x, float y, float width, float height); + + void drawText(float x, float y, DOMString text); +}; diff --git a/examples/Hello.idl b/examples/Demo/idl/Hello.idl similarity index 79% rename from examples/Hello.idl rename to examples/Demo/idl/Hello.idl index d57d947..d5bbdd7 100644 --- a/examples/Hello.idl +++ b/examples/Demo/idl/Hello.idl @@ -5,7 +5,7 @@ };*/ [ - Constructor(cstring ip, unsigned short port), + Constructor(cstring ip, (unsigned short or cstring) port), className=Hello ] interface Hello { @@ -14,4 +14,3 @@ }; - diff --git a/examples/Nidium/.gitignore b/examples/Nidium/.gitignore new file mode 100644 index 0000000..ae7126a --- /dev/null +++ b/examples/Nidium/.gitignore @@ -0,0 +1,2 @@ +cpp + diff --git a/examples/Nidium/Makefile b/examples/Nidium/Makefile new file mode 100644 index 0000000..72eb432 --- /dev/null +++ b/examples/Nidium/Makefile @@ -0,0 +1,31 @@ +# Copyright 2016 Nidium Inc. All rights reserved. +# Use of this source code is governed by a MIT license +# that can be found in the LICENSE file. + +INPUT_DIR=./idl +OUTPUT_DIR=./cpp +IMPL_PREFIX=sm_JS_ + +DOC_DIR = ../../..Nidium/docs +DOC2IDL=./../../NativeTools/IDL/doc2idl_transformer.py + +INPUT_FILES = $(shell find $(INPUT_DIR) -type f -name '*.idl') + +TARGETS = $(addprefix \ + $(join $(OUTPUT_DIR)/, $(IMPL_PREFIX)), \ + $(addsuffix .h, $(basename \ + $(notdir $(INPUT_FILES) ) \ + ) \ + ) \ + ) + +all: $(TARGETS) + @echo $(TARGETS) + +$(OUTPUT_DIR)/$(IMPL_PREFIX)%.h: $(DOC_DIR)/%.cpp.py $(DOC2IDL) + $(DOC2IDL) $< $@ + +include ../common.mk + + + diff --git a/examples/Nidium/README.md b/examples/Nidium/README.md new file mode 100644 index 0000000..a590430 --- /dev/null +++ b/examples/Nidium/README.md @@ -0,0 +1,5 @@ +# Please note + +The files in the idl directory are automatically generated based on nidiums documentation. +It is *very likely* that these will be overwritten any time. +These are only commited here, to gather some experience with IDL. diff --git a/examples/Nidium/idl/.gitignore b/examples/Nidium/idl/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/examples/Nidium/idl/JSAV.idl b/examples/Nidium/idl/JSAV.idl new file mode 100644 index 0000000..3808bcd --- /dev/null +++ b/examples/Nidium/idl/JSAV.idl @@ -0,0 +1,408 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:42.507856 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSAV.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JS_GLOBALAudioThread, + HeaderFile=JS_GLOBALAudioThread, + classname = _GLOBALAudioThread + + +] interface _GLOBALAudioThread { + + + /* methods */ + + static void console( ); + + + +}; + + + +/* anon_callbacks */ + + callback AudioNode_assignSetter_Callback = void( DOMString key, any value, _GLOBALAudioThread scope ); + + callback AudioNode_assignSeek_Callback = void( float postition, _GLOBALAudioThread scope ); + + callback AudioNode_assignProcessor_Callback = void( object frame, _GLOBALAudioThread scope ); + + callback AudioNode_assignInit_Callback = void( _GLOBALAudioThread scope ); + + + +/* callbacks */ + + callback interface AudioNodePlayEventHandler { + + void play( any dummy ); + +}; + + callback interface AudioNodePauseEventHandler { + + void pause( any dummy ); + +}; + + callback interface AudioNodeEndEventHandler { + + void end( any dummy ); + +}; + + callback interface AudioNodeErrorEventHandler { + + void error( object event ); + +}; + + callback interface AudioNodeReadyEventHandler { + + void ready( any dummy ); + +}; + + callback interface AudioNodeMessageEventHandler { + + void message( object event ); + +}; + + callback interface AudioNodeBufferingEventHandler { + + void buffering( object event ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + + + HasEvents=True, + + + ImplementedAs=JSAudioNode, + HeaderFile=JSAudioNode, + classname = AudioNode + + +] interface AudioNode { + + /* properties */ + + readonly attribute integer bitrate; + + readonly attribute AudioNodeLink[] input; + + readonly attribute integer duration; + + attribute integer position; + + readonly attribute Object metadata; + + readonly attribute DOMString type; + + readonly attribute AudioNodeLink[] output; + + + + /* methods */ + + any get( DOMString key ); + + void assignSeek( AudioNode_assignSeek_Callback cb ); + + void set( DOMString key, any value ); + + void pause( ); + + void play( ); + + void close( ); + + void assignProcessor( AudioNode_assignProcessor_Callback processor ); + + void stop( ); + + void assignSetter( AudioNode_assignSetter_Callback cb ); + + void assignInit( AudioNode_assignInit_Callback cb ); + + void send( ); + + void open( DOMString src ); + + + + /* events */ + + void play( any dummy); + + void pause( any dummy); + + void end( any dummy); + + void error( AudioNodeErrorEventHandler event); + + void ready( any dummy); + + void message( AudioNodeMessageEventHandler event); + + void buffering( AudioNodeBufferingEventHandler event); + + +}; + + + + +/* callbacks */ + + callback interface VideoPlayEventHandler { + + void play( any dummy ); + +}; + + callback interface VideoPauseEventHandler { + + void pause( any dummy ); + +}; + + callback interface VideoEndEventHandler { + + void end( any dummy ); + +}; + + callback interface VideoFrameEventHandler { + + void frame( Video video ); + +}; + + callback interface VideoErrorEventHandler { + + void error( object event ); + +}; + + callback interface VideoReadyEventHandler { + + void ready( any dummy ); + +}; + + callback interface VideoBufferingEventHandler { + + void buffering( object event ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( Canvas canvas ), + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSVideo, + HeaderFile=JSVideo, + classname = Video + + +] interface Video { + + /* properties */ + + readonly attribute Object metadata; + + attribute integer position; + + readonly attribute integer height; + + readonly attribute integer width; + + readonly attribute integer bitrate; + + readonly attribute integer duration; + + + + /* methods */ + + AudioNode? getAudioNode( ); + + + + /* events */ + + void play( any dummy); + + void pause( any dummy); + + void end( any dummy); + + void frame( Video video); + + void error( VideoErrorEventHandler event); + + void ready( any dummy); + + void buffering( VideoBufferingEventHandler event); + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSAudioNodeLink, + HeaderFile=JSAudioNodeLink, + classname = AudioNodeLink + + +] interface AudioNodeLink { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSAudio, + HeaderFile=JSAudio, + classname = Audio + + +] interface Audio { + + + /* methods */ + + static AudioContext getContext( optional integer buffersize, optional integer channels, optional integer sampleRate ); + + + +}; + + + +/* anon_callbacks */ + + callback AudioContext_run_Callback = void( ); + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSAudioContext, + HeaderFile=JSAudioContext, + classname = AudioContext + + +] interface AudioContext { + + /* properties */ + + attribute integer volume; + + readonly attribute integer sampleRate; + + readonly attribute integer bufferSize; + + readonly attribute integer channels; + + + + /* methods */ + + void run( AudioContext_run_Callback cb ); + + void connect( AudioNodeLink output, AudioNodeLink input ); + + AudioNode createNode( DOMString type, integer inputChannels, integer outputChannels ); + + void disconnect( AudioNodeLink output, AudioNodeLink input ); + + static void pFFT( float[] xArray, float[] yArray, integer length, integer dir ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:42.507856 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSCanvas.idl b/examples/Nidium/idl/JSCanvas.idl new file mode 100644 index 0000000..bc7e2df --- /dev/null +++ b/examples/Nidium/idl/JSCanvas.idl @@ -0,0 +1,308 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:47.444631 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSCanvas.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSCanvasInherrit, + HeaderFile=JSCanvasInherrit, + classname = CanvasInherrit + + +] interface CanvasInherrit { + + + +}; + + + + +/* callbacks */ + + callback interface CanvasLoadEventHandler { + + void load( object event ); + +}; + + callback interface CanvasMousewheelEventHandler { + + void mousewheel( object event ); + +}; + + callback interface CanvasDropEventHandler { + + void drop( object event ); + +}; + + callback interface CanvasMouseupEventHandler { + + void mouseup( object event ); + +}; + + callback interface CanvasMousemoveEventHandler { + + void mousemove( object event ); + +}; + + callback interface CanvasDragendEventHandler { + + void dragend( object event ); + +}; + + callback interface CanvasMousedownEventHandler { + + void mousedown( object event ); + +}; + + callback interface CanvasResizeEventHandler { + + void resize( object event ); + +}; + + callback interface CanvasDragstartEventHandler { + + void dragstart( CanvasDragendEventHandler event ); + +}; + + callback interface CanvasDragoverEventHandler { + + void dragover( CanvasDropEventHandler event ); + +}; + + callback interface CanvasDblclickEventHandler { + + void dblclick( object event ); + +}; + + callback interface CanvasChangeEventHandler { + + void change( object obj ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( integer width, integer height,optional object options ), + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSCanvas, + HeaderFile=JSCanvas, + classname = Canvas + + +] interface Canvas { + + /* properties */ + + attribute DOMString id; + + readonly attribute Canvas ctx; + + attribute boolean visible; + + attribute float marginLeft; + + readonly attribute boolean __fixed; + + attribute integer scrollTop; + + attribute integer maxWidth; + + readonly attribute integer clientTop; + + attribute integer minWidth; + + readonly attribute boolean __visible; + + readonly attribute integer innerHeight; + + attribute boolean fluidWidth; + + attribute DOMString position; + + attribute boolean staticLeft; + + readonly attribute integer innerWidth; + + attribute integer minHeight; + + attribute float top; + + attribute float marginRight; + + readonly attribute boolean __outofbound; + + attribute float coating; + + attribute boolean staticRight; + + readonly attribute float __top; + + attribute float left; + + readonly attribute CanvasInherrit inherrit; + + attribute integer height; + + attribute float opacity; + + readonly attribute integer clientHeight; + + readonly attribute integer clientWidth; + + attribute integer scrollLeft; + + attribute boolean staticTop; + + readonly attribute integer clientLeft; + + attribute boolean marginBottom; + + attribute float right; + + attribute boolean marginTop; + + readonly attribute integer contentHeight; + + attribute integer maxHeight; + + attribute boolean overflow; + + attribute boolean allowNegativeScroll; + + attribute boolean staticBottom; + + readonly attribute float __left; + + readonly attribute integer contentWidth; + + attribute float bottom; + + attribute boolean fluidHeight; + + attribute integer width; + + + + /* methods */ + + ( CanvasRenderingContext2D? or WebGLRenderingContext? ) getContext( DOMString mode ); + + Canvas? getPrevSibling( ); + + void removeFromParent( ); + + void bringToFront( ); + + void setContext( CanvasRenderingContext2D obj ); + + void cursor( DOMString type ); + + void clear( ); + + void setCoordinates( integer left, integer right ); + + void add( Canvas child ); + + void setZoom( float factor ); + + void show( ); + + void insertBefore( Canvas insert, Canvas reference ); + + void setSize( integer width, integer height ); + + Canvas[] getChildren( ); + + Canvas? getLastChild( ); + + Canvas? getFirstChild( ); + + void insertAfter( Canvas insert, Canvas reference ); + + void setScale( integer x_pos, integer y_pos ); + + Canvas? getParent( ); + + void hide( ); + + object getVisibleRect( ); + + void sendToBack( ); + + Canvas? getNextSibling( ); + + void translate( integer left, integer right ); + + + + /* events */ + + void load( CanvasLoadEventHandler event); + + void mousewheel( CanvasMousewheelEventHandler event); + + void drop( CanvasDropEventHandler event); + + void mouseup( CanvasMouseupEventHandler event); + + void mousemove( CanvasMousemoveEventHandler event); + + void dragend( CanvasDragendEventHandler event); + + void mousedown( CanvasMousedownEventHandler event); + + void resize( CanvasResizeEventHandler event); + + void dragstart( CanvasDragendEventHandler event); + + void dragover( CanvasDropEventHandler event); + + void dblclick( CanvasDblclickEventHandler event); + + void change( CanvasChangeEventHandler obj); + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:47.444631 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSCanvas2DContext.idl b/examples/Nidium/idl/JSCanvas2DContext.idl new file mode 100644 index 0000000..5429207 --- /dev/null +++ b/examples/Nidium/idl/JSCanvas2DContext.idl @@ -0,0 +1,304 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:46.813776 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSCanvas2DContext.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSCanvasGradient, + HeaderFile=JSCanvasGradient, + classname = CanvasGradient + + +] interface CanvasGradient { + + + /* methods */ + + static void addColorStop( float position, DOMString color ); + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSCanvasRenderingContext2D, + HeaderFile=JSCanvasRenderingContext2D, + classname = CanvasRenderingContext2D + + +] interface CanvasRenderingContext2D { + + /* properties */ + + /*[static=True] static */ attribute float shadowOffsetX; + + /*[static=True] static */ attribute float shadowOffsetY; + + /*[static=True] static */ attribute DOMString fontFamily; + + /*[static=True] static */ attribute float miterLimit; + + /*[static=True] static */ attribute DOMString fontStyle; + + /*[static=True] static */ attribute DOMString textAlign; + + /*[static=True] static */ attribute boolean imageSmoothingEnabled; + + /*[static=True] static */ attribute integer width; + + /*[static=True] static */ attribute float globalAlpha; + + /*[static=True] static */ attribute float shadowBlur; + + /*[static=True] static */ attribute float lineWidth; + + /*[static=True] static */ attribute DOMString fontFile; + + /*[static=True] static */ attribute DOMString globalCompositionOperation; + + /*[static=True] static */ attribute integer height; + + /*[static=True] static */ attribute DOMString textBaseline; + + /*[static=True] static */ attribute DOMString lineCap; + + /*[static=True] static */ attribute DOMString shadowColor; + + /*[static=True] static */ attribute float fontSize; + + /*[static=True] static */ attribute float fontSkew; + + /*[static=True] static */ attribute DOMString lineJoin; + + /*[static=True] static */ attribute ( DOMString or CanvasGradient ) fillStyle; + + + + /* methods */ + + void strokeText( DOMString text, integer x, integer y, integer maxWidth ); + + CanvasGLProgram attachFragmentShader( DOMString glsl ); + + CanvasGradient createRadialGradient( float x1, float y1, float r1, float x2, float y2, float r2 ); + + CanvasPattern createPattern( Image image, DOMString mode ); + + void bezierCurveTo( float cx1, float cy1, float cx2, float cy2, float x, float y ); + + void fill( ); + + void quadraticCurveTo( float cx, float cy, float x, float y ); + + object measureText( DOMString text ); + + void scale( float x, float y ); + + void rect( float x, float y, float width, float height ); + + void fillText( DOMString text, integer x, integer y, integer maxWidth ); + + ImageData getImageData( integer left, integer top, integer width, integer heigth ); + + boolean isPointPath( float x, float y ); + + void transform( float scaleX, float skewX, float skewY, float scaleY, float translateX, float translateY, optional float rotate ); + + void arc( float x, float y, float radius, float start, float end, optional boolean ccw ); + + void drawImage( Image image, integer x, integer y, optional integer width, optional integer heigth ); + + ImageData createImageData( integer x, integer y ); + + void setTransform( float scaleX, float skewX, float skewY, float scaleY, float translateX, float translateY ); + + void iTransform( float scaleX, float skewX, float skewY, float scaleY, float translateX, float translateY ); + + void clip( ); + + void translate( float x, float y ); + + void setVertexOffset( integer vertex, float x, float y ); + + object breakText( DOMString text, float maxWidth ); + + void stroke( ); + + void detachFragmentShader( ); + + void rotate( float angle ); + + void strokRect( float x, float y, float width, float height, float rx, float ry ); + + void fillRect( float x1, float y1, float width, float height, optional float rx, optional float ry ); + + void save( ); + + void lineTo( float x, float y ); + + void arcTo( integer x1, integer y1, integer x2, integer y2, float radius ); + + void moveTo( float x, float y ); + + void clearRect( float x, float y, float width, float height ); + + void beginPath( ); + + void restore( ); + + void putImageData( ImageData image, integer width, integer heigth ); + + object getPathBounds( ); + + void closePath( ); + + CanvasGradient createLinearGradient( float x1, float y1, float x2, float y2 ); + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSCanvasGLProgram, + HeaderFile=JSCanvasGLProgram, + classname = CanvasGLProgram + + +] interface CanvasGLProgram { + + + /* methods */ + + static void uniform3i( integer location, integer value1, integer value2, integer value3 ); + + static void uniform2i( integer location, integer value1, integer value2, integer value3 ); + + static void uniform2f( integer location, float value1, float value2, float value3 ); + + static void uniform1i( integer location, integer value1, integer value2, integer value3 ); + + static void uniform1f( integer location, float value1, float value2, float value3 ); + + static integer getUniformLocation( DOMString location ); + + static void uniform3f( integer location, float value1, float value2, float value3 ); + + static void light( float x, float y, float z ); + + static object getUniforms( ); + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSImageData, + HeaderFile=JSImageData, + classname = ImageData + + +] interface ImageData { + + /* properties */ + + readonly attribute integer height; + + readonly attribute ArrayBuffer data; + + readonly attribute integer width; + + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSCanvasPattern, + HeaderFile=JSCanvasPattern, + classname = CanvasPattern + + +] interface CanvasPattern { + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:46.813776 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSConsole.idl b/examples/Nidium/idl/JSConsole.idl new file mode 100644 index 0000000..0ef3274 --- /dev/null +++ b/examples/Nidium/idl/JSConsole.idl @@ -0,0 +1,54 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:33.492318 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSConsole.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSConsole, + HeaderFile=JSConsole, + classname = Console + + +] interface Console { + + + /* methods */ + + static void log( optional DOMString text ); + + static void clear( ); + + static void error( optional DOMString text ); + + static void write( optional DOMString text ); + + static void hide( ); + + static void warn( optional DOMString text ); + + static void show( ); + + static void info( optional DOMString text ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:33.492318 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSDB.idl b/examples/Nidium/idl/JSDB.idl new file mode 100644 index 0000000..3373740 --- /dev/null +++ b/examples/Nidium/idl/JSDB.idl @@ -0,0 +1,50 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:34.786330 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSDB.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( ), + + + Exposed=module, + + + + ImplementedAs=JSDB, + HeaderFile=JSDB, + classname = DB + + +] interface DB { + + + /* methods */ + + void close( ); + + void drop( ); + + void set( DOMString key, any value ); + + void delete( ); + + any get( DOMString key ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:34.786330 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSDebug.idl b/examples/Nidium/idl/JSDebug.idl new file mode 100644 index 0000000..8375462 --- /dev/null +++ b/examples/Nidium/idl/JSDebug.idl @@ -0,0 +1,72 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:33.882429 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSDebug.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSglobal, + HeaderFile=JSglobal, + classname = global + + +] interface global { + + /* properties */ + + readonly attribute object Debug; + + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSNidiumDebug, + HeaderFile=JSNidiumDebug, + classname = NidiumDebug + + +] interface NidiumDebug { + + + /* methods */ + + static any[] serialize( object obj ); + + static any unserialize( ArrayBuffer arraybuf, optional unsigned long offset ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:33.882429 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSDebugger.idl b/examples/Nidium/idl/JSDebugger.idl new file mode 100644 index 0000000..8731a4d --- /dev/null +++ b/examples/Nidium/idl/JSDebugger.idl @@ -0,0 +1,47 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:40.748712 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSDebugger.cpp.py +*/ + + + + +/* anon_callbacks */ + + callback DebuggerCompartment_run_Callback = void( DebuggerCompartment debugger, optional any[] params ); + + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( ), + + + Exposed=class, + + + + ImplementedAs=JSDebuggerCompartment, + HeaderFile=JSDebuggerCompartment, + classname = DebuggerCompartment + + +] interface DebuggerCompartment { + + + /* methods */ + + static any run( DebuggerCompartment context, DebuggerCompartment_run_Callback cb, optional any argn ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:40.748712 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSDocument.idl b/examples/Nidium/idl/JSDocument.idl new file mode 100644 index 0000000..23b9d8f --- /dev/null +++ b/examples/Nidium/idl/JSDocument.idl @@ -0,0 +1,59 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:37.211997 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSDocument.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSNidiumDocument, + HeaderFile=JSNidiumDocument, + classname = NidiumDocument + + +] interface NidiumDocument { + + /* properties */ + + /*[static=True] static */ attribute object stylesheet; + + + + /* methods */ + + static NidiumDocument parse( DOMString ast ); + + static void getPasteBuffer( DOMString content ); + + static DOMString setPasteBuffer( ); + + static Canvas? getCanvasById( DOMString id ); + + static object getScreenData( Canvas element ); + + static boolean loadFont( DOMString name ); + + static void run( DOMString location ); + + static void showFPS( boolean show ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:37.211997 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSFS.idl b/examples/Nidium/idl/JSFS.idl new file mode 100644 index 0000000..b519fb1 --- /dev/null +++ b/examples/Nidium/idl/JSFS.idl @@ -0,0 +1,43 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:36.854363 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSFS.cpp.py +*/ + + + + +/* anon_callbacks */ + + callback fs_readDir_Callback = void( optional integer err, object entry ); + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSfs, + HeaderFile=JSfs, + classname = fs + + +] interface fs { + + + /* methods */ + + static void readDir( DOMString dir, fs_readDir_Callback fn ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:36.854363 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSFile.idl b/examples/Nidium/idl/JSFile.idl new file mode 100644 index 0000000..19ce4f5 --- /dev/null +++ b/examples/Nidium/idl/JSFile.idl @@ -0,0 +1,92 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:52.066408 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSFile.cpp.py +*/ + + + + +/* anon_callbacks */ + + callback File_open_Callback = void( DOMString Error ); + + callback File_Callback = void( DOMString err, ( DOMString or ArrayBuffer ) buffer ); + + callback File_seek_Callback = void( DOMString err ); + + callback File_read_Callback = void( DOMString err, DOMString buffer ); + + callback File_write_Callback = void( DOMString err ); + + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( DOMString path,optional object options, File_Callback cb ), + + + Exposed=class, + + + + ImplementedAs=JSFile, + HeaderFile=JSFile, + classname = File + + +] interface File { + + /* properties */ + + readonly attribute DOMString filesize; + + readonly attribute DOMString filename; + + + + /* methods */ + + void closeSync( ); + + void rm( ); + + boolean isDir( ); + + ( DOMString or ArrayBuffer ) readSync( optional integer readSize ); + + void seek( integer offset, File_seek_Callback cb ); + + void listFiles( ); + + void read( integer bytes, File_read_Callback cb ); + + void writeSync( ( DOMString or ArrayBuffer ) buffer ); + + void write( ( DOMString or ArrayBuffer ) buffer, File_write_Callback cb ); + + void openSync( ); + + void close( ); + + void open( DOMString mode, File_open_Callback cb ); + + void seekSync( integer offset ); + + void rmrf( ); + + static DOMString readSync( DOMString path, optional object options ); + + static DOMString read( DOMString path, optional object options, File_read_Callback cb ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:52.066408 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSGlobal.idl b/examples/Nidium/idl/JSGlobal.idl new file mode 100644 index 0000000..4a358fe --- /dev/null +++ b/examples/Nidium/idl/JSGlobal.idl @@ -0,0 +1,68 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:37.485084 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSGlobal.cpp.py +*/ + + + + +/* anon_callbacks */ + + callback global_setTimeout_Callback = void( ); + + callback global_setInterval_Callback = void( ); + + callback global_setImmediate_Callback = void( ); + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSglobal, + HeaderFile=JSglobal, + classname = global + + +] interface global { + + /* properties */ + + /*[static=True] static */ readonly attribute DOMString __dirname; + + /*[static=True] static */ attribute Window window; + + /*[static=True] static */ readonly attribute DOMString __filename; + + + + /* methods */ + + static void setImmediate( global_setImmediate_Callback fn, any[] args ); + + static void clearInterval( integer identifier ); + + static integer setTimeout( global_setTimeout_Callback fn, integer timeout, any args ); + + static integer setInterval( global_setInterval_Callback fn, integer timeout, any[] args ); + + static void load( DOMString path ); + + static void clearTimeout( integer identifier ); + + static DOMString btoa( DOMString binary ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:37.485084 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSHTTP.idl b/examples/Nidium/idl/JSHTTP.idl new file mode 100644 index 0000000..955f65e --- /dev/null +++ b/examples/Nidium/idl/JSHTTP.idl @@ -0,0 +1,89 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:41.487233 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSHTTP.cpp.py +*/ + + + + +/* anon_callbacks */ + + callback HTTP_Callback = void( object event ); + + + +/* callbacks */ + + callback interface HTTPHeadersEventHandler { + + void headers( object event ); + +}; + + callback interface HTTPProgressEventHandler { + + void progress( object event ); + +}; + + callback interface HTTPResponseEventHandler { + + void response( object event ); + +}; + + callback interface HTTPErrorEventHandler { + + void error( object event ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( DOMString url,optional object params,optional HTTP_Callback cb ), + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSHTTP, + HeaderFile=JSHTTP, + classname = HTTP + + +] interface HTTP { + + + /* methods */ + + HTTP request( optional object params ); + + HTTP stop( ); + + + + /* events */ + + void headers( HTTPHeadersEventHandler event); + + void progress( HTTPProgressEventHandler event); + + void response( HTTPResponseEventHandler event); + + void error( HTTPErrorEventHandler event); + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:41.487233 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSHTTPServer.idl b/examples/Nidium/idl/JSHTTPServer.idl new file mode 100644 index 0000000..0abc2cc --- /dev/null +++ b/examples/Nidium/idl/JSHTTPServer.idl @@ -0,0 +1,143 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:50.812112 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSHTTPServer.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSHTTPRequest, + HeaderFile=JSHTTPRequest, + classname = HTTPRequest + + +] interface HTTPRequest { + + /* properties */ + + readonly attribute object headers; + + readonly attribute object client; + + readonly attribute DOMString method; + + readonly attribute DOMString url; + + readonly attribute DOMString data; + + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSHTTPServerResponse, + HeaderFile=JSHTTPServerResponse, + classname = HTTPServerResponse + + +] interface HTTPServerResponse { + + + /* methods */ + + void end( ( DOMString or ArrayBuffer ) data ); + + void writeHead( integer statuscode, object kvpairs ); + + void write( ( DOMString or ArrayBuffer ) data ); + + + +}; + + + + +/* callbacks */ + + callback interface HTTPServerOndisconnectEventHandler { + + void onDisconnect( ); + +}; + + callback interface HTTPServerOnrequestEventHandler { + + void onrequest( HTTPRequest request, HTTPServerResponse response ); + +}; + + callback interface HTTPServerOndataEventHandler { + + void ondata( ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( DOMString ip, integer port,optional object options ), + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSHTTPServer, + HeaderFile=JSHTTPServer, + classname = HTTPServer + + +] interface HTTPServer { + + + + /* events */ + + void onDisconnect( ); + + void onrequest( HTTPRequest request, HTTPServerResponse response); + + void ondata( ); + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:50.812112 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSImage.idl b/examples/Nidium/idl/JSImage.idl new file mode 100644 index 0000000..db23276 --- /dev/null +++ b/examples/Nidium/idl/JSImage.idl @@ -0,0 +1,70 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:36:48.771628 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSImage.cpp.py +*/ + + + + + +/* callbacks */ + + callback interface ImageLoadEventHandler { + + void load( object event ); + +}; + + callback interface ImageErrorEventHandler { + + void error( object event ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( ), + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSImage, + HeaderFile=JSImage, + classname = Image + + +] interface Image { + + /* properties */ + + readonly attribute integer width; + + attribute ( DOMString or Image ) src; + + readonly attribute integer height; + + + + + /* events */ + + void load( ImageLoadEventHandler event); + + void error( ImageErrorEventHandler event); + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:36:48.771628 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSModules.idl b/examples/Nidium/idl/JSModules.idl new file mode 100644 index 0000000..7c8ef2a --- /dev/null +++ b/examples/Nidium/idl/JSModules.idl @@ -0,0 +1,75 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:38.030511 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSModules.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSglobal, + HeaderFile=JSglobal, + classname = global + + +] interface global { + + /* properties */ + + /*[static=True] static */ readonly attribute Module[] modules; + + + + /* methods */ + + static DOMString require( DOMString path ); + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSModule, + HeaderFile=JSModule, + classname = Module + + +] interface Module { + + /* properties */ + + /*[static=True] static */ readonly attribute integer id; + + /*[static=True] static */ readonly attribute any exports; + + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:38.030511 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSOS.idl b/examples/Nidium/idl/JSOS.idl new file mode 100644 index 0000000..7ee2314 --- /dev/null +++ b/examples/Nidium/idl/JSOS.idl @@ -0,0 +1,42 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:34.358226 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSOS.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=module, + + + + ImplementedAs=JSOS, + HeaderFile=JSOS, + classname = OS + + +] interface OS { + + /* properties */ + + /*[static=True] static */ readonly attribute DOMString language; + + /*[static=True] static */ readonly attribute DOMString platform; + + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:34.358226 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSProcess.idl b/examples/Nidium/idl/JSProcess.idl new file mode 100644 index 0000000..1287bd5 --- /dev/null +++ b/examples/Nidium/idl/JSProcess.idl @@ -0,0 +1,90 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:35.989401 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSProcess.cpp.py +*/ + + + + +/* anon_callbacks */ + + callback NidiumProcess_setSignalHandler_Callback = void( ); + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSNidiumProcess, + HeaderFile=JSNidiumProcess, + classname = NidiumProcess + + +] interface NidiumProcess { + + /* properties */ + + readonly attribute integer workerId; + + readonly attribute object argv; + + + + /* methods */ + + void setOwner( ( DOMString or integer ) user, optional ( DOMString or integer ) group ); + + void exit( ); + + object getOwner( ); + + void setSignalHandler( NidiumProcess_setSignalHandler_Callback cb ); + + static DOMString cwd( ); + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSglobal, + HeaderFile=JSglobal, + classname = global + + +] interface global { + + /* properties */ + + readonly attribute object process; + + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:35.989401 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSSocket.idl b/examples/Nidium/idl/JSSocket.idl new file mode 100644 index 0000000..77b5177 --- /dev/null +++ b/examples/Nidium/idl/JSSocket.idl @@ -0,0 +1,178 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:49.435763 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSSocket.cpp.py +*/ + + + + + +/* callbacks */ + + callback interface SocketClientOndisconnectEventHandler { + + void ondisconnect( SocketClient clientSocket ); + +}; + + callback interface SocketClientOnreadEventHandler { + + void onread( SocketClient socketClient, DOMString data ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + + + HasEvents=True, + + + ImplementedAs=JSSocketClient, + HeaderFile=JSSocketClient, + classname = SocketClient + + +] interface SocketClient { + + /* properties */ + + readonly attribute DOMString ip; + + + + /* methods */ + + integer write( ( DOMString or ArrayBuffer ) data ); + + void disconnect( ); + + + + /* events */ + + void ondisconnect( SocketClient clientSocket); + + void onread( SocketClient socketClient, DOMString data); + + +}; + + + + +/* callbacks */ + + callback interface SocketOnconnectEventHandler { + + void onconnect( ); + +}; + + callback interface SocketOnacceptEventHandler { + + void onaccept( SocketClient clientSocket ); + +}; + + callback interface SocketOndisconnectEventHandler { + + void ondisconnect( SocketClient client ); + +}; + + callback interface SocketOndrainEventHandler { + + void ondrain( ); + +}; + + callback interface SocketOnreadEventHandler { + + void onread( DOMString data ); + +}; + + callback interface SocketOnmessageEventHandler { + + void onmessage( DOMString data, object details ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( DOMString host, integer port ), + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSSocket, + HeaderFile=JSSocket, + classname = Socket + + +] interface Socket { + + /* properties */ + + attribute boolean binary; + + attribute boolean readline; + + attribute integer timeout; + + attribute DOMString encoding; + + + + /* methods */ + + integer write( ( DOMString or ArrayBuffer ) data ); + + void close( ); + + void sendTo( DOMString ip, integer port, ( DOMString or ArrayBuffer ) data ); + + Socket connect( optional DOMString mode ); + + Socket listen( optional DOMString mode ); + + + + /* events */ + + void onconnect( ); + + void onaccept( SocketClient clientSocket); + + void ondisconnect( SocketClient client); + + void ondrain( ); + + void onread( DOMString data); + + void onmessage( DOMString data, SocketOnmessageEventHandler details); + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:49.435763 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSStream.idl b/examples/Nidium/idl/JSStream.idl new file mode 100644 index 0000000..63d7c33 --- /dev/null +++ b/examples/Nidium/idl/JSStream.idl @@ -0,0 +1,75 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:40.264164 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSStream.cpp.py +*/ + + + + + +/* callbacks */ + + callback interface StreamOnavailabledataEventHandler { + + void onavailabledata( ); + +}; + + callback interface StreamOnprogressEventHandler { + + void onProgress( integer buffered, integer total ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( DOMString url ), + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSStream, + HeaderFile=JSStream, + classname = Stream + + +] interface Stream { + + /* properties */ + + attribute integer fileSize; + + + + /* methods */ + + Stream? getNextPacket( ); + + void start( integer packetlen ); + + void seek( integer pos ); + + + + /* events */ + + void onavailabledata( ); + + void onProgress( integer buffered, integer total); + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:40.264164 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSThread.idl b/examples/Nidium/idl/JSThread.idl new file mode 100644 index 0000000..8bf256b --- /dev/null +++ b/examples/Nidium/idl/JSThread.idl @@ -0,0 +1,119 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:35.234833 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSThread.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JS_GLOBALThread, + HeaderFile=JS_GLOBALThread, + classname = _GLOBALThread + + +] interface _GLOBALThread { + + + /* methods */ + + static void send( ); + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSThreadMessageEvent, + HeaderFile=JSThreadMessageEvent, + classname = ThreadMessageEvent + + +] interface ThreadMessageEvent { + + + +}; + + + + +/* callbacks */ + + callback interface ThreadOncompleteEventHandler { + + void oncomplete( object event ); + +}; + + callback interface ThreadOnmessageEventHandler { + + void onmessage( object event ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSThread, + HeaderFile=JSThread, + classname = Thread + + +] interface Thread { + + + /* methods */ + + void start( any args ); + + + + /* events */ + + void oncomplete( ThreadOncompleteEventHandler event); + + void onmessage( ThreadOnmessageEventHandler event); + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:35.234833 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSWebGL.idl b/examples/Nidium/idl/JSWebGL.idl new file mode 100644 index 0000000..7ef67a1 --- /dev/null +++ b/examples/Nidium/idl/JSWebGL.idl @@ -0,0 +1,1121 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:38.795563 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSWebGL.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSWebGLTexture, + HeaderFile=JSWebGLTexture, + classname = WebGLTexture + + +] interface WebGLTexture { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSWebGL, + HeaderFile=JSWebGL, + classname = WebGL + + +] interface WebGL { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSWebGLShader, + HeaderFile=JSWebGLShader, + classname = WebGLShader + + +] interface WebGLShader { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSWebGLActiveInfo, + HeaderFile=JSWebGLActiveInfo, + classname = WebGLActiveInfo + + +] interface WebGLActiveInfo { + + /* properties */ + + /*[static=True] static */ attribute DOMString name; + + /*[static=True] static */ attribute DOMString type; + + /*[static=True] static */ attribute integer size; + + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSWebGLShaderPrecisionFormat, + HeaderFile=JSWebGLShaderPrecisionFormat, + classname = WebGLShaderPrecisionFormat + + +] interface WebGLShaderPrecisionFormat { + + /* properties */ + + /*[static=True] static */ attribute integer rangeMax; + + /*[static=True] static */ attribute integer precision; + + /*[static=True] static */ attribute integer rangeMin; + + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + + ImplementedAs=JSWebGLUniformLocation, + HeaderFile=JSWebGLUniformLocation, + classname = WebGLUniformLocation + + +] interface WebGLUniformLocation { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSWebGLRenderbuffer, + HeaderFile=JSWebGLRenderbuffer, + classname = WebGLRenderbuffer + + +] interface WebGLRenderbuffer { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( ), + + + + + ImplementedAs=JSWebGLRenderingContext, + HeaderFile=JSWebGLRenderingContext, + classname = WebGLRenderingContext + + +] interface WebGLRenderingContext { + + /* properties */ + + /*[static=True] static */ readonly attribute integer DITHER; + + /*[static=True] static */ readonly attribute integer SUBPIXEL_BITS; + + /*[static=True] static */ readonly attribute integer FUNC_REVERSE_SUBTRACT; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; + + /*[static=True] static */ readonly attribute integer ELEMENT_ARRAY_BUFFER; + + /*[static=True] static */ readonly attribute integer TRIANGLE_STRIP; + + /*[static=True] static */ readonly attribute integer MAX_COMBINED_TEXTURE_IMAGE_UNITS; + + /*[static=True] static */ readonly attribute integer RGBA; + + /*[static=True] static */ readonly attribute integer DEPTH_BUFFER_BIT; + + /*[static=True] static */ readonly attribute integer ELEMENT_ARRAY_BUFFER_BINDING; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER; + + /*[static=True] static */ readonly attribute integer DEPTH_STENCIL_ATTACHMENT; + + /*[static=True] static */ readonly attribute integer STENCIL_BUFFER_BIT; + + /*[static=True] static */ readonly attribute integer NO_ERROR; + + /*[static=True] static */ readonly attribute integer NICEST; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_BLUE_SIZE; + + /*[static=True] static */ readonly attribute integer BLEND_SRC_RGB; + + /*[static=True] static */ readonly attribute integer SAMPLE_COVERAGE_VALUE; + + /*[static=True] static */ readonly attribute integer LINK_STATUS; + + /*[static=True] static */ readonly attribute integer SRC_ALPHA_SATURATE; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_INTERNAL_FORMAT; + + /*[static=True] static */ readonly attribute integer RGB; + + /*[static=True] static */ readonly attribute integer FLOAT_MAT4; + + /*[static=True] static */ readonly attribute integer TEXTURE_WRAP_S; + + /*[static=True] static */ readonly attribute integer TEXTURE14; + + /*[static=True] static */ readonly attribute integer STENCIL_ATTACHMENT; + + /*[static=True] static */ readonly attribute integer DST_ALPHA; + + /*[static=True] static */ readonly attribute integer TRIANGLES; + + /*[static=True] static */ readonly attribute integer IMPLEMENTATION_COLOR_READ_FORMAT; + + /*[static=True] static */ readonly attribute integer STENCIL_BACK_REF; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_COMPLETE; + + /*[static=True] static */ readonly attribute integer UNPACK_COLORSPACE_CONVERSION_WEBGL; + + /*[static=True] static */ readonly attribute integer ONE_MINUS_CONSTANT_COLOR; + + /*[static=True] static */ readonly attribute integer CLAMP_TO_EDGE; + + /*[static=True] static */ readonly attribute integer UNSIGNED_SHORT_4_4_4_4; + + /*[static=True] static */ readonly attribute integer DEPTH_STENCIL; + + /*[static=True] static */ readonly attribute integer TEXTURE11; + + /*[static=True] static */ readonly attribute integer LINEAR; + + /*[static=True] static */ readonly attribute integer MAX_RENDERBUFFER_SIZE; + + /*[static=True] static */ readonly attribute integer VERSION; + + /*[static=True] static */ readonly attribute integer FLOAT_MAT3; + + /*[static=True] static */ readonly attribute integer MAX_VERTEX_ATTRIBS; + + /*[static=True] static */ readonly attribute integer ONE_MINUS_SRC_ALPHA; + + /*[static=True] static */ readonly attribute integer UNPACK_FLIP_Y_WEBGL; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_INCOMPLETE_ATTACHMENT; + + /*[static=True] static */ readonly attribute integer ACTIVE_TEXTURE; + + /*[static=True] static */ readonly attribute integer TEXTURE12; + + /*[static=True] static */ readonly attribute integer STENCIL_CLEAR_VALUE; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_RED_SIZE; + + /*[static=True] static */ readonly attribute integer STENCIL_TEST; + + /*[static=True] static */ readonly attribute integer ES_VERSION_2_0; + + /*[static=True] static */ readonly attribute integer LINEAR_MIPMAP_LINEAR; + + /*[static=True] static */ readonly attribute integer STENCIL_BACK_PASS_DEPTH_PASS; + + /*[static=True] static */ readonly attribute integer CCW; + + /*[static=True] static */ readonly attribute integer MAX_VERTEX_TEXTURE_IMAGE_UNITS; + + /*[static=True] static */ readonly attribute integer TEXTURE_MAG_FILTER; + + /*[static=True] static */ readonly attribute integer INCR; + + /*[static=True] static */ readonly attribute integer BLEND_SRC_ALPHA; + + /*[static=True] static */ readonly attribute integer ONE_MINUS_CONSTANT_ALPHA; + + /*[static=True] static */ readonly attribute integer INVERT; + + /*[static=True] static */ readonly attribute integer TEXTURE19; + + /*[static=True] static */ readonly attribute integer ACTIVE_ATTRIBUTE_MAX_LENGTH; + + /*[static=True] static */ readonly attribute integer BLUE_BITS; + + /*[static=True] static */ readonly attribute integer BLEND_DST_ALPHA; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_ATTACHMENT_OBJECT_NAME; + + /*[static=True] static */ readonly attribute integer LUMINANCE; + + /*[static=True] static */ readonly attribute integer RGB5_A1; + + /*[static=True] static */ readonly attribute integer MAX_VERTEX_UNIFORM_VECTORS; + + /*[static=True] static */ readonly attribute integer POINTS; + + /*[static=True] static */ readonly attribute integer STENCIL_REF; + + /*[static=True] static */ readonly attribute integer GREEN_BITS; + + /*[static=True] static */ readonly attribute integer VERTEX_ATTRIB_ARRAY_POINTER; + + /*[static=True] static */ readonly attribute integer VERTEX_ATTRIB_ARRAY_BUFFER_BINDING; + + /*[static=True] static */ readonly attribute integer FRONT_FACE; + + /*[static=True] static */ readonly attribute integer FLOAT_VEC3; + + /*[static=True] static */ readonly attribute integer FLOAT_VEC2; + + /*[static=True] static */ readonly attribute integer DEPTH_BITS; + + /*[static=True] static */ readonly attribute integer PACK_ALIGNMENT; + + /*[static=True] static */ readonly attribute integer BLEND_COLOR; + + /*[static=True] static */ readonly attribute integer DEPTH_TEST; + + /*[static=True] static */ readonly attribute integer MIRRORED_REPEAT; + + /*[static=True] static */ readonly attribute integer OUT_OF_MEMORY; + + /*[static=True] static */ readonly attribute integer STENCIL_PASS_DEPTH_PASS; + + /*[static=True] static */ readonly attribute integer LINEAR_MIPMAP_NEAREST; + + /*[static=True] static */ readonly attribute integer BLEND_EQUATION; + + /*[static=True] static */ readonly attribute integer LINE_WIDTH; + + /*[static=True] static */ readonly attribute integer STENCIL_WRITEMASK; + + /*[static=True] static */ readonly attribute integer TEXTURE_CUBE_MAP; + + /*[static=True] static */ readonly attribute integer BLEND_EQUATION_RGB; + + /*[static=True] static */ readonly attribute integer ALIASED_POINT_SIZE_RANGE; + + /*[static=True] static */ readonly attribute integer TEXTURE_BINDING_2D; + + /*[static=True] static */ readonly attribute integer SHADER_TYPE; + + /*[static=True] static */ readonly attribute integer SRC_COLOR; + + /*[static=True] static */ readonly attribute integer STATIC_DRAW; + + /*[static=True] static */ readonly attribute integer STENCIL_FAIL; + + /*[static=True] static */ readonly attribute integer SHADER_SOURCE_LENGTH; + + /*[static=True] static */ readonly attribute integer VERTEX_ATTRIB_ARRAY_STRIDE; + + /*[static=True] static */ readonly attribute integer TEXTURE_BINDING_CUBE_MAP; + + /*[static=True] static */ readonly attribute integer ALIASED_LINE_WIDTH_RANGE; + + /*[static=True] static */ readonly attribute integer HIGH_INT; + + /*[static=True] static */ readonly attribute integer CULL_FACE; + + /*[static=True] static */ readonly attribute integer SRC_ALPHA; + + /*[static=True] static */ readonly attribute integer KEEP; + + /*[static=True] static */ readonly attribute integer ACTIVE_ATTRIBUTES; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_UNSUPPORTED; + + /*[static=True] static */ readonly attribute integer DONT_CARE; + + /*[static=True] static */ readonly attribute integer DEPTH_ATTACHMENT; + + /*[static=True] static */ readonly attribute integer TEXTURE_CUBE_MAP_NEGATIVE_Z; + + /*[static=True] static */ readonly attribute integer LESS; + + /*[static=True] static */ readonly attribute integer TEXTURE_CUBE_MAP_NEGATIVE_X; + + /*[static=True] static */ readonly attribute integer TEXTURE_CUBE_MAP_NEGATIVE_Y; + + /*[static=True] static */ readonly attribute integer INVALID_FRAMEBUFFER_OPERATION; + + /*[static=True] static */ readonly attribute integer FRONT; + + /*[static=True] static */ readonly attribute integer GENERATE_MIPMAP_HINT; + + /*[static=True] static */ readonly attribute integer MAX_TEXTURE_IMAGE_UNITS; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL; + + /*[static=True] static */ readonly attribute integer NOTEQUAL; + + /*[static=True] static */ readonly attribute integer VIEWPORT; + + /*[static=True] static */ readonly attribute integer FLOAT_MAT2; + + /*[static=True] static */ readonly attribute integer TEXTURE_WRAP_T; + + /*[static=True] static */ readonly attribute integer UNSIGNED_BYTE; + + /*[static=True] static */ readonly attribute integer FRONT_AND_BACK; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_BINDING; + + /*[static=True] static */ readonly attribute integer RENDERER; + + /*[static=True] static */ readonly attribute integer ARRAY_BUFFER_BINDING; + + /*[static=True] static */ readonly attribute integer TEXTURE_MIN_FILTER; + + /*[static=True] static */ readonly attribute integer STENCIL_PASS_DEPTH_FAIL; + + /*[static=True] static */ readonly attribute integer UNPACK_ALIGNMENT; + + /*[static=True] static */ readonly attribute integer NUM_COMPRESSED_TEXTURE_FORMATS; + + /*[static=True] static */ readonly attribute integer ONE_MINUS_DST_ALPHA; + + /*[static=True] static */ readonly attribute integer STREAM_DRAW; + + /*[static=True] static */ readonly attribute integer EQUAL; + + /*[static=True] static */ readonly attribute integer STENCIL_BACK_FUNC; + + /*[static=True] static */ readonly attribute integer POLYGON_OFFSET_UNITS; + + /*[static=True] static */ readonly attribute integer UNSIGNED_SHORT_5_6_5; + + /*[static=True] static */ readonly attribute integer IMPLEMENTATION_COLOR_READ_TYPE; + + /*[static=True] static */ readonly attribute integer ONE_MINUS_DST_COLOR; + + /*[static=True] static */ readonly attribute integer VERTEX_ATTRIB_ARRAY_ENABLED; + + /*[static=True] static */ readonly attribute integer EXTENSIONS; + + /*[static=True] static */ readonly attribute integer ALWAYS; + + /*[static=True] static */ readonly attribute integer BLEND_EQUATION_ALPHA; + + /*[static=True] static */ readonly attribute integer LINES; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_HEIGHT; + + /*[static=True] static */ readonly attribute integer TEXTURE; + + /*[static=True] static */ readonly attribute integer TEXTURE_CUBE_MAP_POSITIVE_Z; + + /*[static=True] static */ readonly attribute integer COMPRESSED_TEXTURE_FORMATS; + + /*[static=True] static */ readonly attribute integer TEXTURE_CUBE_MAP_POSITIVE_X; + + /*[static=True] static */ readonly attribute integer TEXTURE_CUBE_MAP_POSITIVE_Y; + + /*[static=True] static */ readonly attribute integer INT_VEC2; + + /*[static=True] static */ readonly attribute integer INT_VEC3; + + /*[static=True] static */ readonly attribute integer VENDOR; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_WIDTH; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE; + + /*[static=True] static */ readonly attribute integer LUMINANCE_ALPHA; + + /*[static=True] static */ readonly attribute integer COLOR_WRITEMASK; + + /*[static=True] static */ readonly attribute integer SHORT; + + /*[static=True] static */ readonly attribute integer TEXTURE_2D; + + /*[static=True] static */ readonly attribute integer MAX_VARYING_VECTORS; + + /*[static=True] static */ readonly attribute integer RGB565; + + /*[static=True] static */ readonly attribute integer COLOR_CLEAR_VALUE; + + /*[static=True] static */ readonly attribute integer MEDIUM_INT; + + /*[static=True] static */ readonly attribute integer LOW_FLOAT; + + /*[static=True] static */ readonly attribute integer HIGH_FLOAT; + + /*[static=True] static */ readonly attribute integer INFO_LOG_LENGTH; + + /*[static=True] static */ readonly attribute integer STENCIL_BACK_PASS_DEPTH_FAIL; + + /*[static=True] static */ readonly attribute integer DEPTH_COMPONENT; + + /*[static=True] static */ readonly attribute integer BACK; + + /*[static=True] static */ readonly attribute integer BYTE; + + /*[static=True] static */ readonly attribute integer BLEND_DST_RGB; + + /*[static=True] static */ readonly attribute integer BLEND; + + /*[static=True] static */ readonly attribute integer SHADING_LANGUAGE_VERSION; + + /*[static=True] static */ readonly attribute integer GREATER; + + /*[static=True] static */ readonly attribute integer SAMPLE_ALPHA_TO_COVERAGE; + + /*[static=True] static */ readonly attribute integer NEAREST_MIPMAP_NEAREST; + + /*[static=True] static */ readonly attribute integer STENCIL_FUNC; + + /*[static=True] static */ readonly attribute integer VERTEX_ATTRIB_ARRAY_NORMALIZED; + + /*[static=True] static */ readonly attribute integer DEPTH_COMPONENT16; + + /*[static=True] static */ readonly attribute integer FUNC_ADD; + + /*[static=True] static */ readonly attribute integer DYNAMIC_DRAW; + + /*[static=True] static */ readonly attribute integer FUNC_SUBTRACT; + + /*[static=True] static */ readonly attribute integer DEPTH_WRITEMASK; + + /*[static=True] static */ readonly attribute integer DEPTH_CLEAR_VALUE; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_DEPTH_SIZE; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_GREEN_SIZE; + + /*[static=True] static */ readonly attribute integer CURRENT_VERTEX_ATTRIB; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE; + + /*[static=True] static */ readonly attribute integer TEXTURE31; + + /*[static=True] static */ readonly attribute integer TEXTURE30; + + /*[static=True] static */ readonly attribute integer BOOL_VEC4; + + /*[static=True] static */ readonly attribute integer SAMPLE_BUFFERS; + + /*[static=True] static */ readonly attribute integer TEXTURE1; + + /*[static=True] static */ readonly attribute integer LINE_STRIP; + + /*[static=True] static */ readonly attribute integer TEXTURE3; + + /*[static=True] static */ readonly attribute integer TEXTURE2; + + /*[static=True] static */ readonly attribute integer TEXTURE5; + + /*[static=True] static */ readonly attribute integer ATTACHED_SHADERS; + + /*[static=True] static */ readonly attribute integer TEXTURE7; + + /*[static=True] static */ readonly attribute integer TEXTURE6; + + /*[static=True] static */ readonly attribute integer ZERO; + + /*[static=True] static */ readonly attribute integer TEXTURE8; + + /*[static=True] static */ readonly attribute integer DST_COLOR; + + /*[static=True] static */ readonly attribute integer UNPACK_PREMULTIPLY_ALPHA_WEBGL; + + /*[static=True] static */ readonly attribute integer TEXTURE0; + + /*[static=True] static */ readonly attribute integer RGBA4; + + /*[static=True] static */ readonly attribute integer LOW_INT; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_INCOMPLETE_DIMENSIONS; + + /*[static=True] static */ readonly attribute integer MAX_VIEWPORT_DIMS; + + /*[static=True] static */ readonly attribute integer UNSIGNED_SHORT_5_5_5_1; + + /*[static=True] static */ readonly attribute integer ARRAY_BUFFER; + + /*[static=True] static */ readonly attribute integer MEDIUM_FLOAT; + + /*[static=True] static */ readonly attribute integer TEXTURE10; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_ALPHA_SIZE; + + /*[static=True] static */ readonly attribute integer UNSIGNED_SHORT; + + /*[static=True] static */ readonly attribute integer POLYGON_OFFSET_FACTOR; + + /*[static=True] static */ readonly attribute integer STENCIL_BACK_FAIL; + + /*[static=True] static */ readonly attribute integer NEVER; + + /*[static=True] static */ readonly attribute integer CONTEXT_LOST_WEBGL; + + /*[static=True] static */ readonly attribute integer VALIDATE_STATUS; + + /*[static=True] static */ readonly attribute integer TEXTURE28; + + /*[static=True] static */ readonly attribute integer TEXTURE29; + + /*[static=True] static */ readonly attribute integer BUFFER_USAGE; + + /*[static=True] static */ readonly attribute integer DELETE_STATUS; + + /*[static=True] static */ readonly attribute integer MAX_TEXTURE_SIZE; + + /*[static=True] static */ readonly attribute integer TEXTURE21; + + /*[static=True] static */ readonly attribute integer TEXTURE22; + + /*[static=True] static */ readonly attribute integer FASTEST; + + /*[static=True] static */ readonly attribute integer TEXTURE24; + + /*[static=True] static */ readonly attribute integer TEXTURE25; + + /*[static=True] static */ readonly attribute integer TEXTURE26; + + /*[static=True] static */ readonly attribute integer TEXTURE27; + + /*[static=True] static */ readonly attribute integer FLOAT_VEC4; + + /*[static=True] static */ readonly attribute integer REPEAT; + + /*[static=True] static */ readonly attribute integer CULL_FACE_MODE; + + /*[static=True] static */ readonly attribute integer STENCIL_BITS; + + /*[static=True] static */ readonly attribute integer MAX_CUBE_MAP_TEXTURE_SIZE; + + /*[static=True] static */ readonly attribute integer CW; + + /*[static=True] static */ readonly attribute integer BOOL_VEC2; + + /*[static=True] static */ readonly attribute integer BOOL_VEC3; + + /*[static=True] static */ readonly attribute integer SAMPLER_2D; + + /*[static=True] static */ readonly attribute integer SHADER_COMPILER; + + /*[static=True] static */ readonly attribute integer ALPHA_BITS; + + /*[static=True] static */ readonly attribute integer NEAREST_MIPMAP_LINEAR; + + /*[static=True] static */ readonly attribute integer BOOL; + + /*[static=True] static */ readonly attribute integer SCISSOR_TEST; + + /*[static=True] static */ readonly attribute integer FRAMEBUFFER_BINDING; + + /*[static=True] static */ readonly attribute integer SAMPLE_COVERAGE_INVERT; + + /*[static=True] static */ readonly attribute integer TEXTURE4; + + /*[static=True] static */ readonly attribute integer TEXTURE20; + + /*[static=True] static */ readonly attribute integer COLOR_BUFFER_BIT; + + /*[static=True] static */ readonly attribute integer INVALID_ENUM; + + /*[static=True] static */ readonly attribute integer DECR; + + /*[static=True] static */ readonly attribute integer FRAGMENT_SHADER; + + /*[static=True] static */ readonly attribute integer STENCIL_BACK_WRITEMASK; + + /*[static=True] static */ readonly attribute integer MAX_FRAGMENT_UNIFORM_VECTORS; + + /*[static=True] static */ readonly attribute integer LINE_LOOP; + + /*[static=True] static */ readonly attribute integer POLYGON_OFFSET_FILL; + + /*[static=True] static */ readonly attribute integer RENDERBUFFER_STENCIL_SIZE; + + /*[static=True] static */ readonly attribute integer GEQUAL; + + /*[static=True] static */ readonly attribute integer TEXTURE15; + + /*[static=True] static */ readonly attribute integer TEXTURE9; + + /*[static=True] static */ readonly attribute integer TEXTURE17; + + /*[static=True] static */ readonly attribute integer TEXTURE16; + + /*[static=True] static */ readonly attribute integer DEPTH_RANGE; + + /*[static=True] static */ readonly attribute integer CONSTANT_ALPHA; + + /*[static=True] static */ readonly attribute integer TEXTURE13; + + /*[static=True] static */ readonly attribute integer NEAREST; + + /*[static=True] static */ readonly attribute integer VERTEX_ATTRIB_ARRAY_SIZE; + + /*[static=True] static */ readonly attribute integer LEQUAL; + + /*[static=True] static */ readonly attribute integer TEXTURE18; + + /*[static=True] static */ readonly attribute integer BROWSER_DEFAULT_WEBGL; + + /*[static=True] static */ readonly attribute integer VERTEX_ATTRIB_ARRAY_TYPE; + + /*[static=True] static */ readonly attribute integer ONE; + + /*[static=True] static */ readonly attribute integer CONSTANT_COLOR; + + /*[static=True] static */ readonly attribute integer FIXED; + + /*[static=True] static */ readonly attribute integer INT; + + /*[static=True] static */ readonly attribute integer ONE_MINUS_SRC_COLOR; + + /*[static=True] static */ readonly attribute integer STENCIL_INDEX; + + /*[static=True] static */ readonly attribute integer DEPTH_FUNC; + + /*[static=True] static */ readonly attribute integer SAMPLER_CUBE; + + /*[static=True] static */ readonly attribute integer COLOR_ATTACHMENT0; + + /*[static=True] static */ readonly attribute integer SAMPLES; + + /*[static=True] static */ readonly attribute integer COMPILE_STATUS; + + /*[static=True] static */ readonly attribute integer RED_BITS; + + /*[static=True] static */ readonly attribute integer BUFFER_SIZE; + + /*[static=True] static */ readonly attribute integer DECR_WRAP; + + /*[static=True] static */ readonly attribute integer CURRENT_PROGRAM; + + /*[static=True] static */ readonly attribute integer INVALID_OPERATION; + + /*[static=True] static */ readonly attribute integer UNSIGNED_INT; + + /*[static=True] static */ readonly attribute integer INVALID_VALUE; + + /*[static=True] static */ readonly attribute integer ALPHA; + + /*[static=True] static */ readonly attribute integer VERTEX_SHADER; + + /*[static=True] static */ readonly attribute integer STENCIL_INDEX8; + + /*[static=True] static */ readonly attribute integer INCR_WRAP; + + /*[static=True] static */ readonly attribute integer ACTIVE_UNIFORM_MAX_LENGTH; + + /*[static=True] static */ readonly attribute integer STENCIL_VALUE_MASK; + + /*[static=True] static */ readonly attribute integer SAMPLE_COVERAGE; + + /*[static=True] static */ readonly attribute integer ACTIVE_UNIFORMS; + + /*[static=True] static */ readonly attribute integer INT_VEC4; + + /*[static=True] static */ readonly attribute integer FLOAT; + + /*[static=True] static */ readonly attribute integer NONE; + + /*[static=True] static */ readonly attribute integer REPLACE; + + /*[static=True] static */ readonly attribute integer STENCIL_BACK_VALUE_MASK; + + /*[static=True] static */ readonly attribute integer TEXTURE23; + + /*[static=True] static */ readonly attribute integer TRIANGLE_FAN; + + /*[static=True] static */ readonly attribute integer SCISSOR_BOX; + + + + /* methods */ + + void vertexAttrib3fv( integer index, float[] array ); + + void cullFace( integer mode ); + + void renderBufferStorage( integer target, integer internalFormat, integer width, integer height ); + + void vertexAttrib1fv( integer index, float[] array ); + + void depthMask( boolean flag ); + + void bindRenderbuffer( integer target, WebGLRenderbuffer buffer ); + + void uniform2fv( WebGLUniformLocation location, float[] array ); + + void deleteProgram( WebGLProgram Object ); + + void uniform4f( integer x_pos, integer y_pos, integer z_index, integer w_pos ); + + WebGLProgram createProgram( ); + + void vertexAttrib4f( integer index, integer v0, integer v1, integer v2, integer v3 ); + + void disable( integer cap ); + + void blendFunc( integer sfactor, integer dfactor ); + + void getActiveUniform( integer target ); + + void blendEquation( integer mode ); + + void uniform2iv( WebGLUniformLocation location, boolean transpose, float[] array ); + + DOMString getShaderInfoLog( WebGLShader shader ); + + WebGLRenderbuffer createRenderBuffer( ); + + void clearStencil( integer stencil ); + + WebGLShader createShader( integer type ); + + void getExtension( ); + + void uniform4i( WebGLUniformLocation location, integer x_pos, integer y_pos, integer z_index, integer width ); + + void bindAttribLocation( WebGLProgram program, integer vertex, DOMString name ); + + void framebufferRenderbuffer( integer target, integer attach, integer renderbuffer_target, WebGLRenderbuffer renderbuffer ); + + void drawArrays( integer mode, integer first, integer count ); + + WebGLBuffer createBuffer( ); + + void depthFunc( integer func ); + + void depthRange( float near, float far ); + + boolean isContextLost( ); + + void vertexAttrib3f( integer index, integer v0, integer v1, integer v2, integer v3 ); + + void drawElements( integer mode, integer first, integer count, integer offset ); + + void uniform4fv( WebGLUniformLocation location, float[] array ); + + void pixelStorei( integer param, integer value ); + + DOMString getProgramInfoLog( WebGLProgram program ); + + void framebufferTexture2D( integer target, integer attach, integer texture_target, WebGLTexture texture, integer level ); + + void disableVertexAttribArray( integer cap ); + + void bufferData( integer target, WebGLBuffer array, integer usage ); + + void bindBuffer( integer target, WebGLBuffer buffer ); + + integer getError( ); + + void vertexAttrib2f( integer index, integer v0, integer v1, integer v2, integer v3 ); + + void texParameteri( integer target, integer name, integer value ); + + void texImage2D( integer target, integer level, integer internalFormat, integer width, integer height, integer border, integer format, integer type ); + + void compileShader( optional WebGLShader shader ); + + void uniform1iv( WebGLUniformLocation location, boolean transpose, float[] array ); + + void generateMipmap( integer target ); + + void clearColor( float red, float green, float blue, float alpha ); + + void vertexAttrib2fv( integer index, float[] array ); + + void lineWidth( integer width ); + + void enableVertexAttribArray( integer attr ); + + void uniform1i( WebGLUniformLocation location, integer x_pos, integer y_pos, integer z_index, integer width ); + + void uniform1fv( WebGLUniformLocation location, float[] array ); + + void enable( integer bits ); + + void uniform1f( integer x_pos, integer y_pos, integer z_index, integer w_pos ); + + void vertexAttrib1f( integer index, integer v0, integer v1, integer v2, integer v3 ); + + void linkProgram( WebGLProgram program ); + + void deleteTexture( WebGLTexture Object ); + + void bufferSubData( integer target, integer offset, WebGLBuffer array ); + + WebGLFramebuffer createFrameBuffer( ); + + void uniform3fv( WebGLUniformLocation location, float[] array ); + + void blendEquationSeparate( integer rgb, integer alpha ); + + void frontFace( integer mode ); + + void vertexAttribPointer( integer attr, integer size, integer type, boolean normalized, integer stride, integer offset ); + + void detachShader( WebGLProgram program, WebGLShader shader ); + + integer getShaderParameter( WebGLShader shader, integer param ); + + WebGLActiveInfo getActiveAttrib( WebGLProgram program, integer index ); + + void shaderSource( WebGLShader shader, DOMString source ); + + void vertexAttrib4fv( integer index, float[] array ); + + void deleteRenderbuffer( WebGLRenderbuffer Object ); + + void bindTexture( integer target, WebGLTexture texture ); + + void activeTexture( integer texture ); + + void deleteBuffer( WebGLBuffer Object ); + + void copyTexImage2D( integer target, integer level, integer internal, integer x_pos, integer y_pos, integer width, integer height, integer border ); + + void uniform3f( integer x_pos, integer y_pos, integer z_index, integer w_pos ); + + void flush( ); + + WebGLShaderPrecisionFormat getShaderPrecisionFormat( integer shader, integer precision ); + + void uniform3i( WebGLUniformLocation location, integer x_pos, integer y_pos, integer z_index, integer width ); + + void deleteFramebuffer( WebGLFramebuffer Object ); + + void viewPort( integer x_pos, integer y_pos, integer width, integer height ); + + WebGLTexture createTexture( ); + + void useProgram( WebGLProgram program ); + + void copyTexSubImage2D( integer target, integer level, integer internal, integer x_pos, integer y_pos, integer width, integer height, integer border ); + + any getParameter( WebGLProgram program, integer attr ); + + WebGLUniformLocation getUniformLocation( WebGLProgram program, DOMString name ); + + void uniform4iv( WebGLUniformLocation location, boolean transpose, float[] array ); + + void colorMask( optional float red, optional float green, optional float blue, optional float alpha ); + + void uniform2f( integer x_pos, integer y_pos, integer z_index, integer w_pos ); + + void uniform3iv( WebGLUniformLocation location, boolean transpose, float[] array ); + + void bindFramebuffer( integer target, WebGLFramebuffer buffer ); + + void uniform2i( WebGLUniformLocation location, integer x_pos, integer y_pos, integer z_index, integer width ); + + void attachShader( WebGLProgram program, WebGLShader shader ); + + void clearDepth( float depth ); + + void deleteShader( WebGLShader Object ); + + void finish( ); + + WebGLUniformLocation getAttribLocation( WebGLProgram program, DOMString attr ); + + void clear( ); + + void blendFuncSeparate( integer srcRgb, integer dstRgb, integer srcAlpha, integer dstAlpha ); + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSWebGLFramebuffer, + HeaderFile=JSWebGLFramebuffer, + classname = WebGLFramebuffer + + +] interface WebGLFramebuffer { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSWebGLBuffer, + HeaderFile=JSWebGLBuffer, + classname = WebGLBuffer + + +] interface WebGLBuffer { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSWebGLProgram, + HeaderFile=JSWebGLProgram, + classname = WebGLProgram + + +] interface WebGLProgram { + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:38.795563 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSWebSocket.idl b/examples/Nidium/idl/JSWebSocket.idl new file mode 100644 index 0000000..c2b619a --- /dev/null +++ b/examples/Nidium/idl/JSWebSocket.idl @@ -0,0 +1,93 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:50.241100 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSWebSocket.cpp.py +*/ + + + + + +/* callbacks */ + + callback interface WebSocketServerOnmessageEventHandler { + + void onmessage( WebSocketServerClient client, object event ); + +}; + + callback interface WebSocketServerOnopenEventHandler { + + void onopen( WebSocketServerClient client ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + Constructor( DOMString host,optional DOMString protocol ), + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSWebSocketServer, + HeaderFile=JSWebSocketServer, + classname = WebSocketServer + + +] interface WebSocketServer { + + + + /* events */ + + void onmessage( WebSocketServerClient client, WebSocketServerOnmessageEventHandler event); + + void onopen( WebSocketServerClient client); + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSWebSocketServerClient, + HeaderFile=JSWebSocketServerClient, + classname = WebSocketServerClient + + +] interface WebSocketServerClient { + + + /* methods */ + + integer? send( ( DOMString or ArrayBuffer ) message ); + + void close( ); + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:50.241100 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSWebSocketClient.idl b/examples/Nidium/idl/JSWebSocketClient.idl new file mode 100644 index 0000000..998ebf3 --- /dev/null +++ b/examples/Nidium/idl/JSWebSocketClient.idl @@ -0,0 +1,103 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:46.190535 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSWebSocketClient.cpp.py +*/ + + + + + +/* callbacks */ + + callback interface WebSocketServerOnmessageEventHandler { + + void onmessage( WebSocketServerClient client, object event ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSWebSocketServer, + HeaderFile=JSWebSocketServer, + classname = WebSocketServer + + +] interface WebSocketServer { + + + + /* events */ + + void onmessage( WebSocketServerClient client, WebSocketServerOnmessageEventHandler event); + + +}; + + + + +/* callbacks */ + + callback interface WebSocketOnopenEventHandler { + + void onopen( WebSocketServerClient client ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + + Exposed=class, + + + HasEvents=True, + + + ImplementedAs=JSWebSocket, + HeaderFile=JSWebSocket, + classname = WebSocket + + +] interface WebSocket { + + + /* methods */ + + integer? send( ( DOMString or ArrayBuffer ) message ); + + WebSocket? ping( DOMString url, optional DOMString protocol ); + + void close( ); + + + + /* events */ + + void onopen( WebSocketServerClient client); + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:46.190535 */ \ No newline at end of file diff --git a/examples/Nidium/idl/JSWindow.idl b/examples/Nidium/idl/JSWindow.idl new file mode 100644 index 0000000..52405cb --- /dev/null +++ b/examples/Nidium/idl/JSWindow.idl @@ -0,0 +1,430 @@ +/* DO NOT EDIT MANUALLY, THIS FILE IS GENERATED + at... : 2017-01-05T12:35:44.203057 + by... : ../../doc2idl_transformer.py + for.. : ../../../../Nidium/docs/JSWindow.cpp.py +*/ + + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSNMLEvent, + HeaderFile=JSNMLEvent, + classname = NMLEvent + + +] interface NMLEvent { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSkeyEvent, + HeaderFile=JSkeyEvent, + classname = keyEvent + + +] interface keyEvent { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSMouseEvent, + HeaderFile=JSMouseEvent, + classname = MouseEvent + + +] interface MouseEvent { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSTextInputEvent, + HeaderFile=JSTextInputEvent, + classname = TextInputEvent + + +] interface TextInputEvent { + + + +}; + + + +/* anon_callbacks */ + + callback Window_requestAnimationFrame_Callback = void( string[] list ); + + callback Window_openDirDialog_Callback = void( string[] list ); + + callback Window_openFileDialog_Callback = void( string[] list ); + + + +/* callbacks */ + + callback interface Window_onfiledragdropEventHandler { + + void _onFileDragDrop( object event ); + +}; + + callback interface Window_ontextinputEventHandler { + + void _ontextinput( object event ); + +}; + + callback interface Window_onfiledragEventHandler { + + void _onFileDrag( object event ); + +}; + + callback interface Window_onfocusEventHandler { + + void _onfocus( ); + +}; + + callback interface Window_onmousedownEventHandler { + + void _onmousedown( object event ); + +}; + + callback interface Window_onmousewheelEventHandler { + + void _onmousewheel( object event ); + +}; + + callback interface Window_oncloseEventHandler { + + void _onclose( WindowEvent event ); + +}; + + callback interface Window_onmousemoveEventHandler { + + void _onmousemove( object event ); + +}; + + callback interface Window_onfiledragleaveEventHandler { + + void _onFileDragLeave( object event ); + +}; + + callback interface Window_onmouseupEventHandler { + + void _onmouseup( object event ); + +}; + + callback interface Window_onsystemtrayclickEventHandler { + + void _onsystemtrayclick( object event ); + +}; + + callback interface Window_onassetreadyEventHandler { + + void _onassetready( object event ); + +}; + + callback interface Window_onfiledragenterEventHandler { + + void _onFileDragEnter( object event ); + +}; + + callback interface Window_onkeydownEventHandler { + + void _onkeydown( object event ); + +}; + + callback interface Window_onblurEventHandler { + + void _onblur( ); + +}; + + callback interface Window_onreadyEventHandler { + + void _onready( WindowEvent event ); + +}; + + callback interface Window_onkeyupEventHandler { + + void _onkeyup( object event ); + +}; + + + +/* class */ + + +[ + + /* extended properties*/ + + + + HasEvents=True, + + + ImplementedAs=JSWindow, + HeaderFile=JSWindow, + classname = Window + + +] interface Window { + + /* properties */ + + /*[static=True] static */ attribute integer top; + + /*[static=True] static */ attribute Canvas canvas; + + /*[static=True] static */ attribute DOMString cursor; + + /*[static=True] static */ attribute integer outerHeight; + + /*[static=True] static */ attribute integer left; + + /*[static=True] static */ readonly attribute object __nidium__; + + /*[static=True] static */ attribute integer innerHeight; + + /*[static=True] static */ attribute integer titleBarColor; + + /*[static=True] static */ readonly attribute Navigator navigator; + + /*[static=True] static */ attribute integer innerWidth; + + /*[static=True] static */ attribute DOMString title; + + /*[static=True] static */ attribute integer titleBarControlOffsetY; + + /*[static=True] static */ attribute integer titleBarControlOffsetX; + + + + /* methods */ + + static void requestAnimationFrame( Window_requestAnimationFrame_Callback fn ); + + static void setFrame( ( integer or DOMString ) x_pos, ( integer or DOMString ) y_pos, integer hh, integer nn ); + + static void openDirDialog( Window_openDirDialog_Callback fn ); + + static void openURL( DOMString url ); + + static void center( integer x_pos, integer y_pos ); + + static void openFileDialog( string[] types, Window_openFileDialog_Callback fn ); + + static void quit( ); + + static void exec( DOMString cmd ); + + static void setSize( integer width, integer heigth ); + + static void notify( object config ); + + static void close( ); + + + + /* events */ + + void _onFileDragDrop( Window_onfiledragdropEventHandler event); + + void _ontextinput( Window_ontextinputEventHandler event); + + void _onFileDrag( Window_onfiledragEventHandler event); + + void _onfocus( ); + + void _onmousedown( Window_onmousedownEventHandler event); + + void _onmousewheel( Window_onmousewheelEventHandler event); + + void _onclose( WindowEvent event); + + void _onmousemove( Window_onmousemoveEventHandler event); + + void _onFileDragLeave( Window_onfiledragleaveEventHandler event); + + void _onmouseup( Window_onmouseupEventHandler event); + + void _onsystemtrayclick( Window_onsystemtrayclickEventHandler event); + + void _onassetready( Window_onassetreadyEventHandler event); + + void _onFileDragEnter( Window_onfiledragenterEventHandler event); + + void _onkeydown( Window_onkeydownEventHandler event); + + void _onblur( ); + + void _onready( WindowEvent event); + + void _onkeyup( Window_onkeyupEventHandler event); + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSWindowEvent, + HeaderFile=JSWindowEvent, + classname = WindowEvent + + +] interface WindowEvent { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSMouseDrag, + HeaderFile=JSMouseDrag, + classname = MouseDrag + + +] interface MouseDrag { + + + +}; + + + + + +/* class */ + + +[ + + /* extended properties*/ + + + + + ImplementedAs=JSNavigator, + HeaderFile=JSNavigator, + classname = Navigator + + +] interface Navigator { + + /* properties */ + + /*[static=True] static */ readonly attribute DOMString appVersion; + + /*[static=True] static */ readonly attribute boolean vibrate; + + /*[static=True] static */ readonly attribute DOMString userAgent; + + /*[static=True] static */ readonly attribute DOMString platform; + + /*[static=True] static */ readonly attribute DOMString language; + + /*[static=True] static */ readonly attribute DOMString appName; + + + + +}; + +/* END OF GENERATED FILE 2017-01-05T12:35:44.203057 */ \ No newline at end of file diff --git a/examples/NidiumModules/.gitignore b/examples/NidiumModules/.gitignore new file mode 100644 index 0000000..80a53cd --- /dev/null +++ b/examples/NidiumModules/.gitignore @@ -0,0 +1 @@ +cpp diff --git a/examples/NidiumModules/Makefile b/examples/NidiumModules/Makefile new file mode 100755 index 0000000..b3883af --- /dev/null +++ b/examples/NidiumModules/Makefile @@ -0,0 +1,23 @@ +# Copyright 2016 Nidium Inc. All rights reserved. +# Use of this source code is governed by a MIT license +# that can be found in the LICENSE file. + +INPUT_DIR=./idl +OUTPUT_DIR=./cpp +IMPL_PREFIX=sm_JS_ + +INPUT_FILES = $(shell find $(INPUT_DIR) -type f -name '*.idl') + +TARGETS = $(addprefix \ + $(join $(OUTPUT_DIR)/, $(IMPL_PREFIX)), \ + $(addsuffix .h, $(basename \ + $(notdir $(INPUT_FILES) ) \ + ) \ + ) \ + ) + +all: $(TARGETS) + @echo $(TARGETS) + +include ../common.mk + diff --git a/examples/NidiumModules/idl/.gitignore b/examples/NidiumModules/idl/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/examples/NidiumModules/idl/Hello.idl b/examples/NidiumModules/idl/Hello.idl new file mode 100644 index 0000000..805818a --- /dev/null +++ b/examples/NidiumModules/idl/Hello.idl @@ -0,0 +1,14 @@ +[ + Constructor(cstring bar, optional unsigned short foo), + classname = Hello /* obligated, but could default to the file's basename*/ + ,headerfile=HelloBase /*optional; '.h' is added */ + /*,exposed=class *//*'class'|'embed'|'module'|/a-z+/ thus 'once' or not defined at all to not expose */ + /*missing attributes: Alias ImplementedAs*/ + +] interface Hello { + readonly attribute unsigned short foo; + attribute cstring bar; + boolean foobar(unsigned short foo); + static unsigned short barfoo(unsigned short bar); +}; + diff --git a/_clang-format b/examples/_clang-format similarity index 74% rename from _clang-format rename to examples/_clang-format index 8c69764..defda6c 100644 --- a/_clang-format +++ b/examples/_clang-format @@ -1,23 +1,27 @@ +# Copyright 2016 Nidium Inc. All rights reserved. +# Use of this source code is governed by a MIT license +# that can be found in the LICENSE file. + # BasedOnStyle: WebKit AccessModifierOffset: -4 -AlignAfterOpenBracket: true -AlignConsecutiveAssignments: true +#AlignAfterOpenBracket: true +#AlignConsecutiveAssignments: true AlignEscapedNewlinesLeft: true -AlignOperands: true +#AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false +#AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: true AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None +#AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: true -BinPackArguments: true -BinPackParameters: false -BreakBeforeBinaryOperators: All -BreakBeforeBraces: Mozilla +#BinPackArguments: true +#BinPackParameters: false +BreakBeforeBinaryOperators: false +BreakBeforeBraces: GNU BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false ColumnLimit: 80 @@ -34,11 +38,11 @@ IndentCaseLabels: true IndentWidth: 4 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' +#MacroBlockBegin: '' +#MacroBlockEnd: '' MaxEmptyLinesToKeep: 2 NamespaceIndentation: None -ObjCBlockIndentWidth: 4 +#ObjCBlockIndentWidth: 4 ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true PenaltyBreakBeforeFirstCallParameter: 19 @@ -48,7 +52,7 @@ PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Right -SpaceAfterCStyleCast: false +#SpaceAfterCStyleCast: false SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements SpaceInEmptyParentheses: false @@ -57,7 +61,7 @@ SpacesInAngles: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false -SpacesInSquareBrackets: false +#SpacesInSquareBrackets: false Standard: Cpp11 TabWidth: 8 UseTab: Never diff --git a/examples/common.mk b/examples/common.mk new file mode 100644 index 0000000..6b56560 --- /dev/null +++ b/examples/common.mk @@ -0,0 +1,25 @@ +# Copyright 2016 Nidium Inc. All rights reserved. +# Use of this source code is governed by a MIT license +# that can be found in the LICENSE file. + +include ../../config.mk + +PARSE=../../parse.js + +TEMPLATE_DIR=../../templates +TEMPLATES=$(shell find $(TEMPLATE_DIR) -type f) + +$(OUTPUT_DIR): + mkdir -p $(OUTPUT_DIR) + +$(OUTPUT_DIR)/$(IMPL_PREFIX)%.h: $(INPUT_DIR)/%.idl $(PARSE) $(TEMPLATES) $(OUTPUT_DIR) ../_clang-format + @$(eval CMD = $(BIN_NODEJS) $(PARSE) $< $(TEMPLATE_DIR) $(OUTPUT_DIR) $(IMPL_PREFIX)) + @$(eval CREATED = $(shell $(CMD))) + @echo "$(CMD)" + $(BIN_CLANGFORMAT) -style=file -i $(CREATED) + +.PHONY: clean + +clean: + @echo "cleaning" + @rm -rf $(shell find $(OUTPUT_DIR)/ -type f) diff --git a/package.json b/package.json index f60c2aa..252f94f 100644 --- a/package.json +++ b/package.json @@ -1,3 +1,9 @@ +/* + Copyright 2016 Nidium Inc. All rights reserved. + Use of this source code is governed by a MIT license + that can be found in the LICENSE file. +*/ + { "name": "IDLMonkey", "version": "0.0.0", diff --git a/parse.js b/parse.js index fe2dfbb..1c97b82 100644 --- a/parse.js +++ b/parse.js @@ -1,13 +1,81 @@ +/* + Copyright 2016 Nidium Inc. All rights reserved. + Use of this source code is governed by a MIT license + that can be found in the LICENSE file. +*/ + var WebIDL2 = require("webidl2"); var nunjucks = require('nunjucks'); var fs = require('fs'); var util = require("util"); +var mapping = { + "boolean": { + "c": "bool", + "convert": "ToBoolean", + "jsval": "boolean" + }, + + "cstring": { + "c": "char *", + "jsval": "string" + }, + + "byte": { + "c": "int8_t", + "convert": "ToInt16" + }, + + "octet": { + "c": "uint8_t", + "convert": "ToUint16" + }, + + "short": { + "c": "int16_t", + "convert": "ToInt16" + }, + + "unsigned short": { + "c": "uint16_t", + "convert": "ToUint16" + }, + + "long": { + "c": "int32_t", + "convert": "ToInt32" + }, + + "unsigned long": { + "c": "uint32_t", + "convert": "ToUint32" + }, + + "long long": { + "c": "int64_t", + "convert": "ToInt64" + }, + + "unsigned long long": { + "c": "uint64_t", + "convert": "ToUint64" + }, + + "float": { + "c": "double", + "convert": "ToNumber" + }, + + "double": { + "c": "double", + "convert": "ToNumber" + } +} -var NidiumIDL = function(file) { +var NidiumIDL = function(file, templatePath) { - this.env = nunjucks.configure({ + this.env = nunjucks.configure(templatePath, { trimBlocks: true, lstripBlocks: true }); @@ -33,7 +101,8 @@ var NidiumIDL = function(file) { } NidiumIDL.prototype.loadConf = function() { - this.typeMapping = JSON.parse(fs.readFileSync("./types_mapping.json", {encoding: "utf8"})); + this.typeMapping = mapping; + //this.typeMapping = JSON.parse(fs.readFileSync("./types_mapping.json", {encoding: "utf8"})); } NidiumIDL.prototype.parse = function() { @@ -44,40 +113,76 @@ NidiumIDL.prototype.printTree = function() { console.log(util.inspect(this.tree, {colors: true, depth: 16})); } -NidiumIDL.prototype.generate = function(templatePath, outputPath) { + +NidiumIDL.prototype.generate = function(outputPath, prefix) { + var created_files = []; for (var i = 0; i < this.tree.length; i++) { var obj = this.tree[i]; + obj.getProperties = function(members) { + var properties = [] + if ( members ) { + for (var j = 0; j < members.length; j++){ + if (members[j].type == 'attribute' ) { + properties.push(members[j]); + } + } + } + return properties; + }; + obj.getMethods = function(members, thatAreStatic) { + var methods = [] + if ( members ) { + for (var j = 0; j < members.length; j++){ + var operation = members[j]; + if (operation.type == 'operation' && operation.static == thatAreStatic ) { + methods.push(operation); + } + } + } + return methods; + }; + obj.hasAttr = function(extAttrs, key) { + for( var j = 0; j < extAttrs.length; j++) { + if (extAttrs[j].name == key) { + return extAttrs[j]; + } + } + return false; + }; switch(obj.type) { case 'interface': - this.createInterface(templatePath, outputPath, obj); + created_files = created_files.concat(this.createInterface(outputPath, obj, prefix)); break; case 'dictionary': - this.createDict(templatePath, outputPath, obj); + create_files = created_files.concat(this.createDict(outputPath, obj, prefix)); break; } } + + return created_files; } -NidiumIDL.prototype.createInterface = function(templatePath, outputPath, obj) +NidiumIDL.prototype.createInterface = function(outputPath, obj, prefix) { /* Scan for constructor */ obj.ctor = false; - var constructors = { maxArgs: 0, lst: [] }; + var fileNames = []; for (var i = 0; i < obj.extAttrs.length; i++) { var attr = obj.extAttrs[i]; if (attr.name == 'Constructor') { obj.ctor = true; constructors.lst.push(attr); - constructors.maxArgs = Math.max(constructors.maxArgs, attr.arguments.length); + var curArg = (attr.arguments) ? attr.arguments.length : 0; + constructors.maxArgs = Math.max(constructors.maxArgs, curArg); continue; } @@ -85,51 +190,70 @@ NidiumIDL.prototype.createInterface = function(templatePath, outputPath, obj) obj.className = attr.rhs.value; } } + if (! obj.className) { + obj.className = obj.name; + } var operations = {}; for (var i = 0; i < obj.members.length; i++) { var member = obj.members[i]; - if (member.type != 'operation') continue; - - if (!operations[member.name]) { - var op = operations[member.name] = {lst: [], maxArgs: 0, name: member.name}; + if (member.type == 'operation') { + if (!operations[member.name]) { + var op = operations[member.name] = {lst: [], maxArgs: 0, name: member.name}; + } + op.lst.push(member); + op.maxArgs = Math.max(op.maxArgs, member.arguments.length); } - - op.lst.push(member); - op.maxArgs = Math.max(op.maxArgs, member.arguments.length); } obj.constructors = constructors; obj.operations = operations; + obj.prefix = prefix; - //console.log(obj.operations); - var interfaceHeader = this.env.render(templatePath + '/base_class.tpl.h', obj); - var fileName = outputPath + "/base_" + obj.className + ".h"; - fs.writeFile(fileName, interfaceHeader, function(err) { + console.log(obj.hasAttr(obj.extAttrs, 'exposed')); + //console.log(obj.operations['foobar'].lst[0].idlType); + var interfaceHeader = this.env.render('impl_class.tpl.h', obj); + var fileNameHeader = outputPath + "/" + prefix + obj.className + ".h"; + fileNames.push(fileNameHeader); + fs.writeFile(fileNameHeader, interfaceHeader, function(err) { if (err) { return console.log(err); } - console.log("Wrote " + fileName); }); + var interfaceCode = this.env.render('impl_class.tpl.cpp', obj); + var fileNameCode = outputPath + "/" + prefix + obj.className + ".cpp"; + fileNames.push(fileNameCode); + fs.writeFile(fileNameCode, interfaceCode, function(err) { + if (err) { + return console.log(err); + } + }); + + return fileNames; } -NidiumIDL.prototype.createDict = function(templatePath, outputPath, obj) { - var dictHeader = this.env.render(templatePath + '/dict_class.h', obj); - var fileName = outputPath + "/dict_" + obj.className + ".h"; +NidiumIDL.prototype.createDict = function(outputPath, obj, prefix) { + var fileNames = []; + //console.log(obj); + var dictHeader = this.env.render('dict_class.tpl.h', obj); + var fileName = outputPath + "/" + prefix + obj.className + ".h"; + fileNames.push(fileName); fs.writeFile(fileName, dictHeader, function(err) { if (err) { return console.log(err); } - console.log("Wrote " + fileName); }); + + return fileNames; } -if (process.argv.length < 5) { - console.log("Usage : " + process.argv[0] + " " + process.argv[1] + " idlfile templatepath outputpath\n"); +if (process.argv.length < 6) { + console.log("Usage : " + process.argv[0] + " " + process.argv[1] + " idlfile templatepath outputpath prefix\n"); } else { - var idl = new NidiumIDL(process.argv[2]); + var idl = new NidiumIDL(process.argv[2], process.argv[3]); idl.parse(); //idl.printTree(); - idl.generate(process.argv[3], process.argv[4]); + var created = idl.generate(process.argv[4], process.argv[5]); + console.log(created.join(" ")); } diff --git a/templates/base_class.cpp b/templates/base_class.cpp deleted file mode 100644 index 81a0407..0000000 --- a/templates/base_class.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -//#include "{{ classname }}.h" - -namespace Nidium { -namespace Binding { - -// {{{ Class {{ classname }} - - -// }}} -} // namespace Binding -} // namespace Nidium diff --git a/templates/base_class.tpl.h b/templates/base_class.tpl.h deleted file mode 100644 index 166f2e2..0000000 --- a/templates/base_class.tpl.h +++ /dev/null @@ -1,225 +0,0 @@ -{% macro arglst(args) %} - {% for arg in args %}{{arg.idlType.idlType|ctype}} {{arg.name}}{{ ', ' if not loop.last }}{% endfor %} -{% endmacro %} - -{% macro jsval2c(jval, need, dest) %} - {% if need == 'cstring' %} - JS::RootedString __curstr(cx, JS::ToString(cx, {{jval}})); - if (!__curstr) { - JS_ReportError(cx, "TypeError"); - return false; - } - JSAutoByteString __curstr_c; - __curstr_c.encodeUtf8(cx, __curstr); - - char *{{dest}} = __curstr_c.ptr(); - {% else %} - {{need|ctype}} {{dest}}; - if (!JS::{{ need|convert }}(cx, {{jval}}, &{{dest}})) { - JS_ReportError(cx, "TypeError"); - return false; - } - {% endif %} -{% endmacro %} - -#pragma once -#include - -namespace Nidium { -namespace Binding { - -{% raw %}// {{{ {% endraw %} {{ name }} - -class Interface_{{name}} -{ -public: - - template - static bool registerObject(JSContext *cx, JS::HandleObject exports = JS::NullPtr()); - - {% if ctor %} - /* These static(s) must be implemented */ - {% for constructor in constructors.lst %} - //static Interface_{{name}} *Constructor({{arglst(constructor.arguments)}}); - {% endfor %} - - template - static bool js_{{name}}_Constructor(JSContext *cx, unsigned argc, JS::Value *vp); - {% endif %} - - {% for attr in members %} - {% if attr.type == 'operation'%} - virtual {{ attr.idlType.idlType|ctype }} {{attr.name}}({{arglst(attr.arguments)}})=0; - {%endif%} - {% endfor %} - - /* JS Natives */ - - {% for attrName, attrData in operations %} - static bool js_{{attrName}}(JSContext *cx, unsigned argc, JS::Value *vp); - {% endfor %} - - static void JSFinalize(JSFreeOp *fop, JSObject *obj) - { - - } -private: -}; -{% raw %}// }}} {% endraw %} - -{% raw %}// {{{ {% endraw %} Preamble -static JSClass {{ className }}_class = { - "{{ className }}", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Interface_{{name}}::JSFinalize, - nullptr, nullptr, nullptr, nullptr, JSCLASS_NO_INTERNAL_MEMBERS -}; - -static JSFunctionSpec {{ className }}_funcs[] = { - {% for attrName, attrData in operations %} - JS_FN("{{attrName}}", Interface_{{name}}::js_{{attrName}}, {{attrData.maxArgs}}, 0), - {% endfor %} - JS_FS_END -}; -{% raw %}// }}} {% endraw %} - -{% raw %}// {{{ {% endraw %} Implementation -{% raw %}// {{{ {% endraw %} Construction -{% if ctor %} -template -bool Interface_{{name}}::js_{{name}}_Constructor(JSContext *cx, unsigned argc, JS::Value *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - if (!args.isConstructing()) { - JS_ReportError(cx, "Bad constructor"); - return false; - } - - unsigned argcMin = (({{constructors.maxArgs}} > argc) ? (argc) : ({{constructors.maxArgs}})); - - switch (argcMin) { - {% for op in constructors.lst %} - case {{op.arguments.length}}: - { - /* Start arguments convertion */ - - {% for arg in op.arguments %} - /* Handle argument #{{ loop.index0 }} of type "{{ arg.idlType.idlType }}" */ - {% if not arg.idlType.nullable %} - if (args[{{ loop.index0 }}].isNull()) { - JS_ReportError(cx, "TypeError"); - return false; - } - {% endif %} - {{jsval2c('args['~ loop.index0 ~']', arg.idlType.idlType, 'inArg_' ~ loop.index0)}} - {% endfor %} - /* End of arguments convertion */ - - T *ret = T::Constructor({% for i in range(0, op.arguments.length) %}inArg_{{i}}{{ ', ' if not loop.last }}{%endfor%}); - - if (!ret) { - JS_ReportError(cx, "TypeError"); - return false; - } - - JS::RootedObject rthis(cx, JS_NewObjectForConstructor(cx, &{{ className }}_class, args)); - - JS_SetPrivate(rthis, ret); - - args.rval().setObjectOrNull(rthis); - - break; - } - {% endfor %} - default: - JS_ReportError(cx, "TypeError: wrong number of arguments"); - return false; - break; - } - - return true; -} - -{% endif %} -{% raw %}// }}} {% endraw %} - -{% raw %}// {{{ {% endraw %} Operations -{% for attrName, attrData in operations %} -bool Interface_{{name}}::js_{{attrName}}(JSContext *cx, unsigned argc, JS::Value *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject caller(cx, JS_THIS_OBJECT(cx, vp)); - - if (!caller) { - JS_ReportError(cx, "Illegal invocation"); - return false; - } - - Interface_{{name}} *obj = (Interface_{{name}} *)JS_GetInstancePrivate(cx, caller, &{{ className }}_class, NULL); - if (!obj) { - JS_ReportError(cx, "Illegal invocation"); - return false; - } - - unsigned argcMin = (({{attrData.maxArgs}} > argc) ? (argc) : ({{attrData.maxArgs}})); - - switch (argcMin) { - {% for op in attrData.lst %} - case {{op.arguments.length}}: - { - /* Start arguments convertion */ - - {% for arg in op.arguments %} - /* Handle argument #{{ loop.index0 }} of type "{{ arg.idlType.idlType }}" */ - {% if not arg.idlType.nullable %} - if (args[{{ loop.index0 }}].isNull()) { - JS_ReportError(cx, "TypeError"); - return false; - } - {% endif %} - {{jsval2c('args['~ loop.index0 ~']', arg.idlType.idlType, 'inArg_' ~ loop.index0)}} - {% endfor %} - /* End of arguments convertion */ - - {%if op.idlType.idlType != 'void'%} - {{ op.idlType.idlType|ctype }} _opret = - {%endif%} - obj->{{attrName}}({% for i in range(0, op.arguments.length) %}inArg_{{i}}{{ ', ' if not loop.last }}{%endfor%}); - - args.rval().set{{ op.idlType.idlType|jsvaltype|capitalize }}(_opret); - - break; - } - {% endfor %} - default: - JS_ReportError(cx, "TypeError: wrong number of arguments"); - return false; - break; - } - - return true; -} -{% raw %}// }}} {% endraw %} -{% endfor %} -{% raw %}// }}} {% endraw %} - -{% raw %}// {{{ {% endraw %} Registration -template -bool Interface_{{name}}::registerObject(JSContext *cx, - JS::HandleObject exports) -{ - {% if ctor %} - JS::RootedObject to(cx); - - to = exports ? exports : JS::CurrentGlobalOrNull(cx); - - JS_InitClass(cx, to, JS::NullPtr(), &{{ className }}_class, - Interface_{{name}}::js_{{name}}_Constructor, - 0, NULL, {{ className }}_funcs, NULL, NULL); - {% endif %} - return true; -} -{% raw %}// }}} {% endraw %} - -} // namespace Binding -} // namespace Nidium diff --git a/templates/defs.tpl b/templates/defs.tpl new file mode 100644 index 0000000..22684fd --- /dev/null +++ b/templates/defs.tpl @@ -0,0 +1,42 @@ +{% macro argcall(args) %} + {% for arg in args %} + {{ arg.name }}{{ ' ' if loop.last else ', ' }} + {% endfor %} +{% endmacro %} + +{% macro arglst(args) %} + {% for arg in args %} + {% if arg.idlType.idlType|ctype %} + {{ arg.idlType.idlType|ctype }} {{ arg.name }}{{ ' ' if loop.last else ', ' }} + {% else %} + {#{ arg.idlType.idlType.name }} {{ arg.name }}{{ ' ' if loop.last else ', ' }#} + {% endif %} + {% endfor %} +{% endmacro %} + +{% macro jsval2c(jval, need, dest, returning='false') %} + //.. {{ need }} + {% if need == 'cstring' %} + JS::RootedString __curstr(cx, JS::ToString(cx, {{ jval }})); + if (!__curstr) { + JS_ReportError(cx, "TypeError"); + return {{ returning }}; + } + JSAutoByteString __curstr_c; + __curstr_c.encodeUtf8(cx, __curstr); + + char *{{ dest }} = __curstr_c.ptr(); + {% elif need == 'boolean' %} + {{ need|ctype }} {{ dest }} = JS::ToBoolean( {{ jval }}); + {% elif need == 'unknown' %} + //TODO: Interface {{ need.name }} : {{ jval }} {{ need }} {{dest}} {{returning}} + {% else %} + {{ need|ctype }} {{ dest }}; + if (!JS::{{ need | convert }}(cx, {{ jval }}, &{{ dest }})) { + JS_ReportError(cx, "TypeError"); + return {{ returning }}; + } + {% endif %} +{% endmacro %} + + diff --git a/templates/dict_class.h b/templates/dict_class.h deleted file mode 100644 index 28fab6f..0000000 --- a/templates/dict_class.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include - -namespace Nidium { -namespace Binding { - -{% raw %}// {{{ {% endraw %} Dict_{{name}} -class Dict_{{name}} : public Dict -{ -public: - Dict_{{name}}() { - {% for attr in members %} - {% set type = attr.idlType.idlType %} - {% if type == 'cstring' %} - m_{{attr.name}} = {% if not attr.default %}NULL{%else%}strdup("{{ attr.default.value }}"){%endif%}; - {% else %} - m_{{attr.name}} = {% if not attr.default %}NULL{%else%}{{ attr.default.value }}{%endif%}; - {% endif %} - {% endfor %} - } - - /* - TODO dtor - */ - - bool initWithJSVal(JSContext *cx, JS::HandleValue v) - { - if (!v.isObject()) { - return false; - } - JS::RootedObject curobj(cx, &v.toObject()); - JS::RootedValue curopt(cx); - {% for attr in members %} - {% set type = attr.idlType.idlType %} - - if (!JS_GetProperty(cx, curobj, "{{ attr.name }}", &curopt)) { - return false; - } else { - {% if type == 'cstring' %} - JS::RootedString curstr(cx, JS::ToString(cx, curopt)); - JSAutoByteString c_curstr(cx, curstr); - - m_{{attr.name}} = strdup(c_curstr.ptr()); - {% elif type == 'unsigned short' %} - if (!JS::ToUint16(cx, curopt, &m_{{attr.name}})) { - return false; - } - {% endif %} - } - {% endfor %} - - return true; - } - - {% for attr in members %} - {% set type = attr.idlType.idlType %} - const {{type|ctype}} {{attr.name}}() const { - return m_{{attr.name}}; - } - - {% endfor %} -private: - {% for attr in members %} - {% set type = attr.idlType.idlType %} - {{ type|ctype }} m_{{attr.name}}; - {% endfor %} -}; -{% raw %}// }}} {% endraw %} - -} // namespace Binding -} // namespace Nidium diff --git a/templates/dict_class.tpl.h b/templates/dict_class.tpl.h new file mode 100644 index 0000000..e486070 --- /dev/null +++ b/templates/dict_class.tpl.h @@ -0,0 +1,77 @@ +/* + Copyright 2016 Nidium Inc. All rights reserved. + Use of this source code is governed by a MIT license + that can be found in the LICENSE file. +*/ + +{% import "defs.tpl" as defs %} + +#pragma once + +#include + +namespace Nidium { +namespace Binding { + +// {{ '{{{' }} Dict_{{ prefix }}{{ name }} +class Dict_{{prefix}}{{ name }} : public Dict +{ +public: + Dict_{{ name }}() { + {% for attr in members %} + {% set type = attr.idlType.idlType %} + {% if type == 'cstring' %} + m_{{ attr.name }} = {{ 'NULL' if not attr.default else "strdup(" + attr.default.value + ");" }} + {% else %} + m_{{ attr.name }} = {{ 'NULL' if not attr.default else attr.default.value }}; + {% endif %} + {% endfor %} + } + + /* + TODO dtor + */ + bool initWithJSVal(JSContext *cx, JS::HandleValue v) + { + if (!v.isObject()) { + return false; + } + JS::RootedObject curobj(cx, &v.toObject()); + JS::RootedValue curopt(cx); + {% for attr in members %} + {% set type = attr.idlType.idlType %} + if (!JS_GetProperty(cx, curobj, "{{ attr.name }}", &curopt)) { + return false; + } else { + {% if type == 'cstring' %} + JS::RootedString curstr(cx, JS::ToString(cx, curopt)); + JSAutoByteString c_curstr(cx, curstr); + + m_{{ attr.name }} = strdup(c_curstr.ptr()); + {% elif type == 'unsigned_short' %} + if (!JS::ToUint16(cx, curopt, &m_{{ attr.name }})) { + return false; + } + {% endif %} + } + {% endfor %} + + return true; + } + {% for attr in members %} + {% set type = attr.idlType.idlType %} + const {{ attr.name }} {{ attr.name }}() const { + return m_{{ attr.name }}; + } + {% endfor %} +private: + {% for attr in members %} + {% set type = attr.idlType.idlType %} + {{ type|ctype }} m_{{ attr.name }}; + {% endfor %} +}; +// {{ '}}}' }} + +} // namespace Binding +} // namespace Nidium + diff --git a/templates/impl_class.tpl.cpp b/templates/impl_class.tpl.cpp new file mode 100644 index 0000000..1d297f9 --- /dev/null +++ b/templates/impl_class.tpl.cpp @@ -0,0 +1,309 @@ +/* + Copyright 2016 Nidium Inc. All rights reserved. + Use of this source code is governed by a MIT license + that can be found in the LICENSE file. +*/ + +{% import 'defs.tpl' as defs %} + +{% set static_methods = getMethods(members, true) %} +{% set normal_methods = getMethods(members, false ) %} +{% set properties = getProperties(members) %} +{% set exposed = hasAttr(extAttrs, 'exposed') %} + +#include +#include "{{ prefix }}{{ className }}.h" + +{% if exposed.rhs.value == 'module' or exposed.rhs.value == 'embed' %} +#include "Binding/JSModules.h" +{% endif %} + +namespace Nidium { +namespace Binding { + +// {{ '{{{' }} JSBinding + +{% if ctor %} + // {{ '{{{' }} Start Constructor + {{ prefix }}{{ className }} *{{ prefix }}{{ className }}::Constructor(JSContext *cx, JS::CallArgs &args, + JS::HandleObject obj) + { + unsigned argc = args.length(); + unsigned argcMin = (({{ constructors.maxArgs }} > argc) ? (argc) : ({{ constructors.maxArgs }})); + + switch (argcMin) { + {% for op in constructors.lst %} + case {{ op.arguments|length }}: + { + /* Start argument conversion */ + {% for arg in op.arguments %} + /* Handle argument #{{ loop.index0 }} of type "{{ arg.idlType.idlType }}" */ + {% if not arg.idlType.nullable %} + if (args[{{ loop.index0 }}].isNull()) { + JS_ReportError(cx, "TypeError"); + return nullptr; + } + {% endif %} + {{ defs.jsval2c('args[' ~ loop.index0 ~ ']', arg.idlType.idlType, 'inArg_' ~ loop.index0 , 'nullptr') }} + {% endfor %} + /* End of argument conversion */ + + {{ prefix }}{{ className }} *n_{{ prefix }}{{ className }} = new {{ prefix }}{{ className }}( + {% for i in range(0, op.arguments|length) %} + inArg_{{ i }}{{ ' ' if loop.last else ', ' }} + {% endfor %} + ); + + return n_{{ prefix }}{{ className }}; + break; + } + {% endfor %} + default: + JS_ReportError(cx, "TypeError: wrong number of arguments"); + return nullptr; + break; + } + + return nullptr; + } + // {{ '}}}' }} End Constructor +{% endif %} + +{% if (normal_methods|length + static_methods|length) > 0 %} + // {{ '{{{' }} Methods + {% if normal_methods|length > 0 %} + // List normal methods + JSFunctionSpec * {{ prefix }}{{ className }}::ListMethods() + { + static JSFunctionSpec funcs[] = { + {% for attr in normal_methods %} + {% set maxArgs = operations[attr.name].maxArgs %} + {% if hasAttr(attr.extAttrs, 'Alias') %} + CLASSMAPPER_FN_ALIAS({{ prefix }}{{ className }}, {{ attr.name }}, {{ maxArgs }}, {{ hasAttr( attr.extAttrs, 'Alias') }}), + {% endif %} + CLASSMAPPER_FN({{ prefix }}{{ className }}, {{ attr.name }}, {{ maxArgs }} ), + {% endfor %} + + JS_FS_END + }; + + return funcs; + } + {% endif %} + + {% if static_methods|length > 0 %} + // List static methods + JSFunctionSpec * {{ prefix }}{{ className }}::ListStaticMethods() + { + static JSFunctionSpec funcs[] = { + {% for attr in static_methods %} + {% set maxArgs = operations[attr.name].maxArgs %} + {% if hasAttr(attr.extAttrs, 'Alias') %} + CLASSMAPPER_FN_ALIAS({{ prefix }}{{ className }}, {{ attr.name }}, {{ maxArgs }}, {{ hasAttr(attr.extAttrs, 'Alias') }}), + {% endif %} + {% if attr.static %} + CLASSMAPPER_FN_STATIC({{ prefix }}{{ className }}, {{ attr.name }}, {{ maxArgs }} ), + {% else %} + CLASSMAPPER_FN({{ prefix }}{{ className }}, {{ attr.name }}, {{ maxArgs }} ), + {% endif %} + {% endfor %} + + JS_FS_END + }; + + return funcs; + } + {% endif %} + + // Methods implementation + {% for method_list in [normal_methods, static_methods ] %} + {% for attr in method_list %} + {% set maxArgs = operations[attr.name].maxArgs %} + // {{ '{{{' }} Start method {{ attr.name }} + {% if attr.static %} + bool {{ prefix }}{{ className }}::JSStatic_{{ attr.name }}(JSContext *cx, JS::CallArgs &args) + {% else %} + bool {{ prefix }}{{ className }}::JS_{{ attr.name }}(JSContext *cx, JS::CallArgs &args) + {%endif %} + { + unsigned argc = args.length(); + unsigned argcMin = (({{maxArgs }} > argc) ? (argc) : ({{ maxArgs }})); + {#TODO: optimize when argcMin == 0 #} + switch (argcMin) { + {% for op in operations[attr.name].lst %} + case {{ op.arguments|length }}: + { + /* Start argument conversion */ + {% for arg in op.arguments %} + /* Handle argument #{{ loop.index0 }} of type "{{ arg.idlType.idlType }}" */ + {% if not arg.idlType.nullable %} + if (args[{{ loop.index0 }}].isNull()) { + JS_ReportError(cx, "TypeError"); + return false; + } + {% endif %} + {# TODO union-types #} + {% if arg.idlType.idlType != 'UNKNOWN' %} + {{ defs.jsval2c('args[' ~ loop.index0 ~ ']', arg.idlType.idlType, 'inArg_' ~ loop.index0) }} + {% else %} + {{ defs.jsval2c('args[' ~ loop.index0 ~ ']', arg.type, 'inArg_' ~ loop.index0) }} + {% endif %} + {% endfor %} + + /* End of argument conversion */ + {# if op.idlType.idlType|ctype != 'void' #} + {{ op.idlType.idlType|ctype }} _opret = + {#endif #} + {% if attr.static %}{{ prefix }}{{ className }}::{% else %}this->{% endif %} + {{ attr.name }}( + {% for i in range(0, op.arguments|length) %} + inArg_{{ i }}{{ ' ' if loop.last else ', ' }} + {% endfor %} + ); + {% set need = attr.idlType.idlType %} + {% if need == 'cstring' %} + JS::RootedString jstr0(cx, JS_NewStringCopyZ(cx, _opret)); + args.rval().setString(jstr); + {% elif need == 'boolean' %} + args.rval().setBoolean(_opret); + {% elif attr.idlType.idlType == 'unknown' %} + {# TODO InterfaceType {{ need }} {{ need.idlType}} #} + {% else %} + JS::RootedValue jval(cx); + if (!JS::{{ need | convert }}(cx, jval, &_opret)) { + JS_ReportError(cx, "TypeError"); + return false; + } + args.rval().set(jval); + {% endif %} + + break; + } + {% endfor %} + default: + JS_ReportError(cx, "TypeError: wrong number of arguments"); + return false; + break; + } + + return true; + } + // {{ '}}}' }} End method {{ attr.name }} + {% endfor %} + {% endfor %} + + // {{ '}}}' }} End Methods + {% endif %} + +{% if properties|length > 0 %} + // {{ '{{{' }} Properties + // List properties + JSPropertySpec *{{ prefix }}{{ className }}::ListProperties() + { + static JSPropertySpec props[] = { + {% for attr in properties %} + {# TODO: ONLY-SETTER #} + {% if not attr.readonly %} + CLASSMAPPER_PROP_GS({{ prefix }}{{ className }}, {{ attr.name }}), + {% else %} + CLASSMAPPER_PROP_G({{ prefix }}{{ className }}, {{ attr.name }}), + {% endif %} + {% endfor %} + JS_PS_END + }; + + return props; + } + + {% for attr in properties %} + // {{ '{{{' }} Start property {{ attr.name }} + {% if not attr.readonly %} + // Setter {{ attr.name }} + bool {{ prefix }}{{ className }}::JSSetter_{{ attr.name }}(JSContext *cx, JS::MutableHandleValue vp) + { + {# TODO: uniontype attr.idlType #} + {{ defs.jsval2c('vp', attr.idlType.idlType, 'inArg_0') }} + + return this->set_{{ attr.name }}(inArg_0); + } + {% endif %} + // Getter {{ attr.name }} + bool {{ prefix }}{{ className }}::JSGetter_{{ attr.name }}(JSContext *cx, JS::MutableHandleValue vp) + { + {% set need = attr.idlType.idlType %} + + {% if need == 'cstring' %} + JS::RootedString jstr(cx, JS_NewStringCopyZ(cx, this->get_{{ attr.name }}())); + vp.setString(jstr); + {% elif need == 'boolean' %} + {{ need|ctype }} cval = this->get_{{ attr.name }}(); + vp.setBoolean(cval); + {% elif attr.idlType.idlType == 'unknown' %} + {# TODO InterfaceType {{ need.name }} {{attr.type.__class__}} #} + {% else %} + {{ need|ctype }} cval = this->get_{{ attr.name }}(); + JS::RootedValue jval(cx); + if (!JS::{{ need | convert }}(cx, jval, &cval)) { + JS_ReportError(cx, "TypeError"); + return false; + } + vp.set(jval); + {% endif %} + + return true; + } + // {{ '}}}' }} End property {{ attr.name }} + {% endfor %} + +// {{ '}}}' }} End Properties +{% endif %} + +{% if exposed %} +// {{ '{{{' }} Registration + {% if exposed.rhs.value == 'class' %} + {# nothing special #} + {% elif exposed.rhs.value == 'embed' %} + static JSObject *registerCallback(JSContext *cx) + { + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); + {{ prefix }}{{ className }}::ExposeClass<1>(cx, "{{ className }}", 0, {{ prefix }}{{ className }}::kEmpty_ExposeFlag, obj); + JS::RootedValue val(cx); + if (!JS_GetProperty(cx, obj, "{{ className }}", &val)) { + return nullptr; + } + JS::RootedObject ret(cx, val.toObjectOrNull()); + + return ret; + } + {% elif exposed.rhs.value == 'module' %} + JSObject *{{ prefix }}{{ className }}::RegisterModule(JSContext *cx) + { + JS::RootedObject exports(cx, {{ prefix }}{{ className }}::ExposeObject(cx, "{{ name }}")); + + return exports; + } + {% else %} + {# thus this exposed == 'once', the rhs.value is the name to expose to #} + {% endif %} + + void {{ prefix }}{{ className }}::RegisterObject(JSContext *cx) + { + {# TODO: HAS_RESERVED_SLOTS #} + {% if exposed.rhs.value == 'class' %} + {% elif exposed.rhs.value == 'embed' %} + JSModules::RegisterEmbedded("{{ className }}", registerCallback); + {% elif exposed.rhs.value == 'module' %} + JSModules::RegisterEmbedded("{{ className }}", {{ prefix }}{{ className }}::RegisterModule); + {% else %} + {# thus this exposed == 'once', the rhs.value is the name to expose to #} + {{ prefix }}{{ className }}::ExposeClass(cx, "{{ className }}"); + {{ prefix }}{{ className }}::CreateUniqueInstance(cx, new {{ prefix}}{{ className }}(), "{{ exposed.rhs.value }}"); + {% endif %} + {# //todo: call the created instances->registrationHook();#} + } +{% endif %} +// {{ '}}}' }} + +} // namespace Binding +} // namespace Nidium + diff --git a/templates/impl_class.tpl.h b/templates/impl_class.tpl.h new file mode 100644 index 0000000..5382e1e --- /dev/null +++ b/templates/impl_class.tpl.h @@ -0,0 +1,172 @@ +/* + Copyright 2016 Nidium Inc. All rights reserved. + Use of this source code is governed by a MIT license + that can be found in the LICENSE file. +*/ + +#include +#include +{% import "defs.tpl" as defs %} + +{% set static_methods = getMethods(members, true) %} +{% set normal_methods = getMethods(members, false) %} +{% set properties = getProperties(members) %} +{% set exposed = hasAttr(extAttrs, 'exposed') %} + +#ifndef binding_{{ prefix }}{{ className }}_h__ +#define binding_{{ prefix }}{{ className }}_h__ + +{% set header = hasAttr(extAttrs, 'headerfile') %} +{% if header %} +#include "{{ header.rhs.value }}.h" +{% endif %} + +#include "Binding/ClassMapper.h" + +namespace Nidium { +namespace Binding { + +// {{ '{{{' }} fake {{ className }}Base +#if 0 +//This is a model of our imaginary base class '{{ className }}Base' + +class {{ className }}Base +{ +public: + // Constructor + {% if ctor %} + {% for constructor in constructors.lst %} + {{ className }}Base({{ defs.arglst(constructor.arguments) }}); + {% endfor %} + {% endif %} + {% if exposed.rhs.value == 'class' %} + {# nothing special #} + {% elif exposed.rhs.value == 'embed' %} + {# nothing special #} + {% elif exposed.rhs.value == 'module' %} + {% else %} + {# thus this exposed == 'once', the rhs.value is the name to expose to #} + {# todo only generate the default constructor if that was not already generated by .lst #} + {{ className }}Base (); + {% endif %} +protected: + void registrationHook() = 0; + // Methods + {% for method_list in [normal_methods, static_methods ] %} + {% for op in method_list %} + {% if operations[op.name].lst|length > 1 %} + // Overloading {{ op.name}}-s methods + {% endif %} + {% for attr in operations[op.name].lst %} + {% if attr.static %}static {% endif %} + {# if op.idlType.idlType|ctype != 'void' #} + {{ op.idlType.idlType|ctype }} + {#endif #} + {{ attr.return_type.idlType|ctype }} {{ attr.name }}({{ defs.arglst(attr.arguments) }}); + {% endfor %} + {% endfor %} + {% endfor %} + // Properties + {% if properties|length > 0 %} + {# TODO Setter only #} + {% for attr in properties %} + {% if not attr.readonly %} + bool set_{{ attr.name }}({{ attr.idlType.idlType|ctype }} {{attr.name }}); + {% endif %} + {% if attr.idlType.idlType|ctype %} + {{ attr.idlType.idlType|ctype }} get_{{ attr.name }}(); + {% else %} + {{ attr.name }} get_{{ attr.name }}(); + {% endif %} + {% endfor %} + {% endif %} +private: + // Properties + {% for attr in properties %} + {% if attr.idlType.idlType != 'UNKNOWN' %} + {{ attr.idlType.idlType|ctype }} {{ attr.name }}; + {% else %} + {{ attr.name }} {{ attr.name }}; + {% endif %} + {% endfor %} +}; +#endif +// {{ '}}}' }} + +class {{ prefix }}{{ className }} : public ClassMapper{% if hasAttr(extAttrs, 'Events') %} + WithEvents + {% endif %}<{{ prefix }}{{ className }}>, public {{ className }}Base +{ +public: +{% if ctor %} + {% for constructor in constructors.lst %} + {{ prefix }}{{ className }}( {{ defs.arglst(constructor.arguments) }}) + : {{ className }}Base( {{ defs.argcall(constructor.arguments) }} ) { } + {% endfor %} +{% else %} + {{ className }}()::{{className}}Base(){} +{% endif %} + {% if exposed.rhs.value == 'class' %} + {# nothing special #} + {% elif exposed.rhs.value == 'embed' %} + {# nothing special #} + {% elif exposed.rhs.value == 'module' %} + {% else %} + {# thus this exposed == 'once', the rhs.value is the name to expose to #} + {# todo only generate the default constructor if that was not already generated by .lst #} + {{ prefix }}{{ className }}() { + {{ className }}Base (); + } + {% endif %} + + ~{{ prefix }}{{ className }}(); + {% if ctor %} + //Constructor + static {{ prefix }}{{ className }} * Constructor(JSContext *cx, JS::CallArgs &args, + JS::HandleObject obj); + {% endif %} + //Listings + {% if normal_methods|length > 0 %} + static JSFunctionSpec * ListMethods(); + {% endif %} + {% if static_methods|length > 0 %} + static JSFunctionSpec * ListStaticMethods(); + {% endif %} + {% if properties|length > 0 %} + static JSPropertySpec * ListProperties(); + {% endif %} + //Registration + {% if hasAttr(extAttrs, 'exposed') %} + static void RegisterObject(JSContext *cx); + {% endif %} +protected: + //Methods + {% for attr in static_methods %} + {# this is one js entry point, no method overloading #} + NIDIUM_DECL_JSCALL_STATIC({{ attr.name }}); + {% endfor %} + {% for attr in normal_methods %} + {# this is one js entry point, no method overloading #} + NIDIUM_DECL_JSCALL({{ attr.name }}); + {% endfor %} + {# TODO ONLY-SETTER #} + //Properties + {% for attr in properties %} + {% if not attr.readonly %} + NIDIUM_DECL_JSGETTERSETTER({{ attr.name }}); + {% else %} + NIDIUM_DECL_JSGETTER({{ attr.name }}); + {% endif %} + {% endfor %} + //Registration + {% if exposed.rhs.value == 'module' %} + static JSObject *RegisterModule(JSContext *cx); + {% endif %} + +private: +}; +} // namespace Binding +} // namespace Nidium + +#endif + diff --git a/types_mapping.json b/types_mapping.json deleted file mode 100644 index 07cbfe7..0000000 --- a/types_mapping.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "boolean": { - "c": "bool", - "convert": "ToBoolean", - "jsval": "boolean" - }, - - "cstring": { - "c": "char *", - "jsval": "string" - }, - - "byte": { - "c": "int8_t", - "convert": "ToInt16" - }, - - "octet": { - "c": "uint8_t", - "convert": "ToUint16" - }, - - "short": { - "c": "int16_t", - "convert": "ToInt16" - }, - - "unsigned short": { - "c": "uint16_t", - "convert": "ToUint16" - }, - - "long": { - "c": "int32_t", - "convert": "ToInt32" - }, - - "unsigned long": { - "c": "uint32_t", - "convert": "ToUint32" - }, - - "long long": { - "c": "int64_t", - "convert": "ToInt64" - }, - - "unsigned long long": { - "c": "uint64_t", - "convert": "ToUint64" - }, - - "float": { - "c": "double", - "convert": "ToNumber" - }, - - "double": { - "c": "double", - "convert": "ToNumber" - } -} \ No newline at end of file