ffi: update code with last syntax
authorJean Privat <jean@pryen.org>
Tue, 15 Apr 2014 12:52:43 +0000 (08:52 -0400)
committerJean Privat <jean@pryen.org>
Tue, 15 Apr 2014 12:52:43 +0000 (08:52 -0400)
use `extern class` and dotted notation for extern call and casts.

Signed-off-by: Jean Privat <jean@pryen.org>

36 files changed:
contrib/sort_downloads/src/sort_downloads.nit
examples/callback_monkey.nit
lib/curl/curl_c.nit
lib/curses/curses.nit
lib/egl.nit
lib/gtk3_4/gdk_enums.nit
lib/gtk3_4/gtk_assistant.nit
lib/gtk3_4/gtk_core.nit
lib/gtk3_4/gtk_dialogs.nit
lib/gtk3_4/gtk_enums.nit
lib/gtk3_4/gtk_widgets_ext.nit
lib/gtk3_6/gtk3_6.nit
lib/gtk3_8/gtk3_8.nit
lib/json/json_reader.nit
lib/json/json_writer.nit
lib/json/jsonable.nit
lib/jvm.nit
lib/mnit/opengles1.nit
lib/mnit_android/android_app.nit
lib/mnit_android/android_assets.nit
lib/mnit_android/android_sensor.nit
lib/mnit_linux/linux_opengles1.nit
lib/realtime.nit
lib/sdl.nit
lib/socket/socket_c.nit
lib/sqlite3/sqlite3.nit
lib/standard/exec.nit
lib/standard/file.nit
lib/standard/kernel.nit
tests/test_ffi_c_callback_extern_receiver.nit
tests/test_ffi_c_casts.nit
tests/test_ffi_c_global_ref.nit
tests/test_ffi_c_more.nit
tests/test_ffi_c_new.nit
tests/test_ffi_c_types.nit
tests/test_realtime.nit

index 99c4f87..65db74f 100755 (executable)
@@ -64,7 +64,7 @@ redef class String
 
        # Returns null on success
        fun file_rename_to(dest: String): nullable String import String.to_cstring,
-       NativeString.to_s, String as nullable `{
+       NativeString.to_s, String.as nullable `{
                int res = rename(String_to_cstring(recv), String_to_cstring(dest));
                if (res == 0) return null_String();
                return String_as_nullable(NativeString_to_s(strerror(errno)));
index 8b04b94..6e1ed26 100644 (file)
@@ -58,7 +58,7 @@ interface MonkeyActionCallable
 end
 
 # Defining my object type Monkey, which is, in a low level, a pointer to a C struct (CMonkey)
-extern Monkey `{ CMonkey * `}
+extern class Monkey `{ CMonkey * `}
        
        new `{
                CMonkey *monkey = malloc( sizeof(CMonkey) );
index 1dd3da9..b670cbe 100644 (file)
@@ -72,7 +72,7 @@ in "C body" `{
 `}
 
 # CURL Extern Type, reproduce CURL low level behaviors
-extern CCurl `{ CURL * `}
+extern class CCurl `{ CURL * `}
        # Constructor, CURL low level initializer
        new easy_init `{ return curl_easy_init(); `}
        # Check for correct initialization
@@ -229,7 +229,7 @@ extern CCurl `{ CURL * `}
 end
 
 # FILE Extern type, reproduce basic FILE I/O
-extern OFile `{ FILE* `}
+extern class OFile `{ FILE* `}
        # Open / Create a file from given name
        new open(str: NativeString) `{ return fopen(str, "wb"); `}
        # Check for File validity
@@ -260,7 +260,7 @@ interface CCurlCallbacks
 end
 
 # Extern Type to reproduce Enum of available Callback type
-extern CURLCallbackType `{ CURLcallbackType `}
+extern class CURLCallbackType `{ CURLcallbackType `}
        new header `{ return CURLcallbackTypeHeader; `}
        new body `{ return CURLcallbackTypeBody; `}
        new stream `{ return CURLcallbackTypeStream; `}
@@ -269,7 +269,7 @@ extern CURLCallbackType `{ CURLcallbackType `}
 end
 
 # CURL Code binding and helpers
-extern CURLCode `{ CURLcode `}
+extern class CURLCode `{ CURLcode `}
        new unknown_option `{ return CURLE_UNKNOWN_OPTION; `}
        new unsupported_protocol `{ return CURLE_UNSUPPORTED_PROTOCOL; `}
        new ok `{ return CURLE_OK; `}
@@ -286,7 +286,7 @@ extern CURLCode `{ CURLcode `}
 end
 
 # Extern Type of the Linked list type of CURL
-extern CURLSList `{ struct curl_slist * `}
+extern class CURLSList `{ struct curl_slist * `}
        # Empty constructor which allow us to avoid the use of Nit NULLABLE type
        private new `{ return NULL; `}
        # Constructor allow us to get list instancied by appending an element inside.
@@ -365,13 +365,13 @@ class CURLInfoResponseString
 end
 
 # Reproduce Enum of available CURL SList information, used for CCurl.easy_getinfo
-extern CURLInfoSList `{ CURLINFO `}
+extern class CURLInfoSList `{ CURLINFO `}
        new ssl_engines `{ return CURLINFO_SSL_ENGINES; `}
        new cookielist `{ return CURLINFO_COOKIELIST; `}
 end
 
 # Reproduce Enum of available CURL Long information, used for CCurl.easy_getinfo
-extern CURLInfoLong `{ CURLINFO `}
+extern class CURLInfoLong `{ CURLINFO `}
        new response_code `{ return CURLINFO_RESPONSE_CODE; `}
        new header_size `{ return CURLINFO_HEADER_SIZE; `}
        new http_connectcode `{ return CURLINFO_HTTP_CONNECTCODE; `}
@@ -393,7 +393,7 @@ extern CURLInfoLong `{ CURLINFO `}
 end
 
 # Reproduce Enum of available CURL Double information, used for CCurl.easy_getinfo
-extern CURLInfoDouble `{ CURLINFO `}
+extern class CURLInfoDouble `{ CURLINFO `}
        new total_time `{ return CURLINFO_TOTAL_TIME; `}
        new namelookup_time `{ return CURLINFO_NAMELOOKUP_TIME; `}
        new connect_time `{ return CURLINFO_CONNECT_TIME; `}
@@ -410,7 +410,7 @@ extern CURLInfoDouble `{ CURLINFO `}
 end
 
 # Reproduce Enum of available CURL Chars information, used for CCurl.easy_getinfo
-extern CURLInfoChars `{ CURLINFO `}
+extern class CURLInfoChars `{ CURLINFO `}
        new content_type `{ return CURLINFO_CONTENT_TYPE; `}
        new effective_url `{ return CURLINFO_EFFECTIVE_URL; `}
        new redirect_url `{ return CURLINFO_REDIRECT_URL; `}
@@ -422,7 +422,7 @@ extern CURLInfoChars `{ CURLINFO `}
 end
 
 # Reproduce Enum of HTTP Status Code
-extern CURLStatusCode `{ int `}
+extern class CURLStatusCode `{ int `}
        new proceed `{ return 100; `}
        new switching_protocols `{ return 101; `}
        new ok `{ return 200; `}
@@ -464,7 +464,7 @@ extern CURLStatusCode `{ int `}
 end
 
 # Reproduce Enum of CURL Options usable, used for CCurl.easy_setopt
-extern CURLOption `{ CURLoption `}
+extern class CURLOption `{ CURLoption `}
        new write_function `{ return CURLOPT_WRITEFUNCTION; `}
        new write_data `{ return CURLOPT_WRITEDATA; `}
 #      new     `{ return CURLOPT_FILE; `}
index d2caf35..b705cad 100644 (file)
@@ -20,7 +20,7 @@ in "C header" `{
 `}
 
 # A curse windows
-extern Window `{WINDOW *`}
+extern class Window `{WINDOW *`}
        # Initialize the screen
        new `{
                WINDOW *res;
index 841d6f6..d49ee03 100644 (file)
@@ -62,7 +62,7 @@ extern class EGLDisplay `{ EGLDisplay `}
        #fun get_configs: nullable Array[EGLConfig] import Array[EGLConfig].with_native `{
 
        # Returns some configs compatible with the specified `attributes`
-       fun choose_configs(attribs: Array[Int]): nullable Array[EGLConfig] import Array[Int].length, Array[Int].[], Array[EGLConfig], Array[EGLConfig].add, Array[EGLConfig] as nullable, report_egl_error `{
+       fun choose_configs(attribs: Array[Int]): nullable Array[EGLConfig] import Array[Int].length, Array[Int].[], Array[EGLConfig], Array[EGLConfig].add, Array[EGLConfig].as nullable, report_egl_error `{
                EGLConfig *configs;
                int n_configs;
                int n_attribs = Array_of_Int_length(attribs);
index 692ef2d..11804ef 100644 (file)
@@ -24,7 +24,7 @@ in "C Header" `{
 #enum GdkGravity
 #Defines the reference point of a window and the meaning of coordinates passed to gtk_window_move().
 #@https://developer.gnome.org/gdk3/stable/gdk3-Windows.html#GdkGravity
-extern GdkGravity `{GdkGravity`}
+extern class GdkGravity `{GdkGravity`}
        #The reference point is at the top left corner.
        new north_west `{ return GDK_GRAVITY_NORTH_WEST; `} 
 
@@ -59,7 +59,7 @@ end
 #enum GdkGWindowEdge
 #Determines a window edge or corner.
 #@https://developer.gnome.org/gdk3/stable/gdk3-Windows.html#GdkWindowEdge
-extern GdkWindowEdge `{GdkWindowEdge`}
+extern class GdkWindowEdge `{GdkWindowEdge`}
        #The top left corner.
        new north_west `{ return GDK_WINDOW_EDGE_NORTH_WEST; `} 
 
index 24248a0..c36c521 100644 (file)
@@ -25,7 +25,7 @@ in "C Header" `{
 
 #A widget used to guide users through multi-step operations
 #@https://developer.gnome.org/gtk3/stable/GtkAssistant.html
-extern GtkAssistant `{GtkAssistant *`}
+extern class GtkAssistant `{GtkAssistant *`}
        super GtkWindow
 
        new is extern `{
@@ -116,7 +116,7 @@ end
 #enum GtkAssistantPageType
 #An enum for determining the page role inside the GtkAssistant. It's used to handle buttons sensitivity and visibility.
 #@https://developer.gnome.org/gtk3/stable/GtkAssistant.html#GtkAssistantPageType
-extern GtkAssistantPageType `{GtkAssistantPageType`}
+extern class GtkAssistantPageType `{GtkAssistantPageType`}
        #The page has regular contents. Both the Back and forward buttons will be shown.
        new content `{ return GTK_ASSISTANT_PAGE_CONTENT; `}
 
index 351d9c2..561139b 100644 (file)
@@ -51,16 +51,16 @@ interface GtkCallable
        fun signal( sender : GtkWidget, user_data : nullable Object ) is abstract
 end
 
-extern GdkEvent `{GdkEvent *`}
+extern class GdkEvent `{GdkEvent *`}
 end
 
 
 #Base class for all widgets
 #@https://developer.gnome.org/gtk3/stable/GtkWidget.html
-extern GtkWidget `{GtkWidget *`}
+extern class GtkWidget `{GtkWidget *`}
        fun show_all is extern `{ gtk_widget_show_all( recv ); `}
 
-       fun signal_connect( signal_name : String, to_call : GtkCallable, user_data : nullable Object ) is extern import String.to_cstring, GtkCallable.signal, Object as not nullable `{
+       fun signal_connect( signal_name : String, to_call : GtkCallable, user_data : nullable Object ) is extern import String.to_cstring, GtkCallable.signal, Object.as not nullable `{
                NitGtkSignal *data = malloc( sizeof(NitGtkSignal) );
 
                GtkCallable_incr_ref( to_call );
@@ -120,7 +120,7 @@ end
 
 #Base class for widgets which contain other widgets
 #@https://developer.gnome.org/gtk3/stable/GtkContainer.html
-extern GtkContainer `{GtkContainer *`}
+extern class GtkContainer `{GtkContainer *`}
        super GtkWidget
 
        # Add a widget to the container
@@ -146,7 +146,7 @@ end
 
 #A container with just one child
 #@https://developer.gnome.org/gtk3/stable/GtkBin.html
-extern GtkBin `{GtkBin *`}
+extern class GtkBin `{GtkBin *`}
        super GtkContainer
 
        fun child : GtkWidget is extern `{
@@ -156,7 +156,7 @@ end
 
 #Toplevel which can contain other widgets
 #@https://developer.gnome.org/gtk3/stable/GtkWindow.html
-extern GtkWindow `{GtkWindow *`}
+extern class GtkWindow `{GtkWindow *`}
        super GtkBin
 
        new ( flag : Int ) is extern `{
@@ -278,7 +278,7 @@ end
 
 #A bin with a decorative frame and optional label
 #https://developer.gnome.org/gtk3/stable/GtkFrame.html
-extern GtkFrame `{GtkFrame *`}
+extern class GtkFrame `{GtkFrame *`}
        super GtkBin
 
        new ( lbl : String ) is extern import String.to_cstring`{
@@ -319,7 +319,7 @@ end
 
 #Pack widgets in a rows and columns
 #@https://developer.gnome.org/gtk3/3.3/GtkGrid.html
-extern GtkGrid `{GtkGrid *`}
+extern class GtkGrid `{GtkGrid *`}
        super GtkContainer
 
        # Create a grid with a fixed number of rows and columns
@@ -350,17 +350,17 @@ end
 
 #The tree interface used by GtkTreeView
 #@https://developer.gnome.org/gtk3/stable/GtkTreeModel.html
-extern GtkTreeModel `{GtkTreeModel *`}
+extern class GtkTreeModel `{GtkTreeModel *`}
 end
 
 #An abstract class for laying out GtkCellRenderers
 #@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
-extern GtkCellArea `{GtkCellArea *`}
+extern class GtkCellArea `{GtkCellArea *`}
 end
 
 #Base class for widgets with alignments and padding
 #@https://developer.gnome.org/gtk3/3.2/GtkMisc.html
-extern GtkMisc `{GtkMisc *`}
+extern class GtkMisc `{GtkMisc *`}
        super GtkWidget
 
        fun alignment : GtkAlignment is abstract
@@ -379,7 +379,7 @@ end
 
 #A single line text entry field
 #@https://developer.gnome.org/gtk3/3.2/GtkEntry.html
-extern GtkEntry `{GtkEntry *`}
+extern class GtkEntry `{GtkEntry *`}
        super GtkWidget
 
        new is extern `{
@@ -416,7 +416,7 @@ end
 
 #Base class for widgets which visualize an adjustment
 #@https://developer.gnome.org/gtk3/3.2/GtkRange.html
-extern GtkRange `{GtkRange *`}
+extern class GtkRange `{GtkRange *`}
        super GtkWidget
 
        #Gets the current position of the fill level indicator.
@@ -513,7 +513,7 @@ end
 
 #A slider widget for selecting a value from a range
 #@https://developer.gnome.org/gtk3/3.2/GtkScale.html
-extern GtkScale `{GtkScale *`}
+extern class GtkScale `{GtkScale *`}
        super GtkRange
 
        new ( orientation : GtkOrientation, adjustment : GtkAdjustment ) is extern `{
@@ -572,7 +572,7 @@ end
 
 #A scrollbar
 #@https://developer.gnome.org/gtk3/3.2/GtkScrollbar.html
-extern GtkScrollbar `{GtkScrollbar *`}
+extern class GtkScrollbar `{GtkScrollbar *`}
        super GtkRange
 
                new ( orientation : GtkOrientation, adjustment : GtkAdjustment ) is extern `{
@@ -582,7 +582,7 @@ end
 
 #A widget that displays a small to medium amount of text
 #@https://developer.gnome.org/gtk3/3.2/GtkLabel.html
-extern GtkLabel `{GtkLabel *`}
+extern class GtkLabel `{GtkLabel *`}
        super GtkMisc
 
        # Create a GtkLabel with text
@@ -615,7 +615,7 @@ end
 
 #A widget displaying an image
 #@https://developer.gnome.org/gtk3/3.2/GtkImage.html
-extern GtkImage `{GtkImage *`}
+extern class GtkImage `{GtkImage *`}
        super GtkMisc
 
        # Create a GtkImage
@@ -644,7 +644,7 @@ end
 #enum GtkImageType
 #Describes the image data representation used by a GtkImage.
 #@https://developer.gnome.org/gtk3/3.2/GtkImage.html#GtkImageType
-extern GtkImageType `{GtkImageType`}
+extern class GtkImageType `{GtkImageType`}
        # There is no image displayed by the widget.
        new empty `{ return GTK_IMAGE_EMPTY; `}
 
@@ -669,7 +669,7 @@ end
 
 #Displays an arrow
 #@https://developer.gnome.org/gtk3/3.2/GtkArrow.html
-extern GtkArrow `{GtkArrow *`}
+extern class GtkArrow `{GtkArrow *`}
        super GtkMisc
 
        new ( arrow_type : GtkArrowType, shadow_type : GtkShadowType ) is extern `{
@@ -683,7 +683,7 @@ end
 
 #A widget that emits a signal when clicked on
 #@https://developer.gnome.org/gtk3/stable/GtkButton.html
-extern GtkButton `{GtkButton *`}
+extern class GtkButton `{GtkButton *`}
        super GtkBin
 
        new is extern `{
@@ -715,7 +715,7 @@ end
 
 #A button which pops up a scale
 #@https://developer.gnome.org/gtk3/stable/GtkScaleButton.html
-extern GtkScaleButton `{GtkScaleButton *`}
+extern class GtkScaleButton `{GtkScaleButton *`}
        super GtkButton
 
        #const gchar **icons
@@ -726,7 +726,7 @@ end
 
 #Create buttons bound to a URL
 #@https://developer.gnome.org/gtk3/stable/GtkLinkButton.html
-extern GtkLinkButton `{GtkLinkButton *`}
+extern class GtkLinkButton `{GtkLinkButton *`}
        super GtkButton
 
        new( uri: String ) is extern import String.to_cstring `{
@@ -736,7 +736,7 @@ end
 
 #A container which can hide its child
 #https://developer.gnome.org/gtk3/stable/GtkExpander.html
-extern GtkExpander `{GtkExpander *`}
+extern class GtkExpander `{GtkExpander *`}
        super GtkBin
 
        new( lbl : String) is extern import String.to_cstring`{
@@ -815,7 +815,7 @@ end
 
 #An abstract class for laying out GtkCellRenderers
 #@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
-extern GtkComboBox `{GtkComboBox *`}
+extern class GtkComboBox `{GtkComboBox *`}
        super GtkBin
 
        new is extern `{
@@ -935,7 +935,7 @@ end
 
 #Show a spinner animation
 #@https://developer.gnome.org/gtk3/3.2/GtkSpinner.html
-extern GtkSpinner `{GtkSpinner *`}
+extern class GtkSpinner `{GtkSpinner *`}
        super GtkWidget
 
        new is extern `{
@@ -953,7 +953,7 @@ end
 
 #A "light switch" style toggle
 #@https://developer.gnome.org/gtk3/3.2/GtkSwitch.html
-extern GtkSwitch `{GtkSwitch *`}
+extern class GtkSwitch `{GtkSwitch *`}
        super GtkWidget
 
        new is extern `{
@@ -972,7 +972,7 @@ end
 
 #A widget which controls the alignment and size of its child
 #https://developer.gnome.org/gtk3/stable/GtkAlignment.html
-extern GtkAlignment `{GtkAlignment *`}
+extern class GtkAlignment `{GtkAlignment *`}
        super GtkBin
 
        new ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
@@ -989,11 +989,11 @@ end
 
 #A representation of an adjustable bounded value
 #@https://developer.gnome.org/gtk3/stable/GtkAdjustment.html#GtkAdjustment.description
-extern GtkAdjustment `{GtkAdjustment *`}
+extern class GtkAdjustment `{GtkAdjustment *`}
 
 end
 
-extern GdkColor `{GdkColor*`}
+extern class GdkColor `{GdkColor*`}
        new is extern `{
                GdkColor * col = malloc(sizeof(GdkColor));
                /*gdk_color_parse( "red", recv );*/
@@ -1002,7 +1002,7 @@ extern GdkColor `{GdkColor*`}
        `}
 end
 
-extern GdkRGBA `{GdkRGBA*`}
+extern class GdkRGBA `{GdkRGBA*`}
        new is extern `{
        `}
 end
index e39c9cb..7da083f 100644 (file)
@@ -25,7 +25,7 @@ in "C Header" `{
 
 #Create popup windows
 #@https://developer.gnome.org/gtk3/stable/GtkDialog.html
-extern GtkDialog `{GtkDialog *`}
+extern class GtkDialog `{GtkDialog *`}
        super GtkWindow
 
        new is extern `{
@@ -44,7 +44,7 @@ end
 
 #Display information about an application
 #@https://developer.gnome.org/gtk3/stable/GtkAboutDialog.html
-extern GtkAboutDialog `{GtkAboutDialog *`}
+extern class GtkAboutDialog `{GtkAboutDialog *`}
        super GtkDialog
 
        new is extern `{
@@ -126,7 +126,7 @@ end
 
 #An application chooser dialog
 #@https://developer.gnome.org/gtk3/stable/GtkAppChooserDialog.html
-extern GtkAppChooserDialog `{GtkAppChooserDialog *`}
+extern class GtkAppChooserDialog `{GtkAppChooserDialog *`}
        super GtkDialog
 
        #TODO - GFile
@@ -152,7 +152,7 @@ end
 
 #A dialog for choosing colors
 #@https://developer.gnome.org/gtk3/stable/GtkColorChooserDialog.html
-extern GtkColorChooserDialog `{GtkColorChooserDialog *`}
+extern class GtkColorChooserDialog `{GtkColorChooserDialog *`}
        super GtkDialog
 
        new ( title : String, parent : GtkWindow ) is extern import String.to_cstring `{
@@ -162,7 +162,7 @@ end
 
 #A file chooser dialog, suitable for "File/Open" or "File/Save" commands
 #@https://developer.gnome.org/gtk3/stable/GtkFileChooserDialog.html
-extern GtkFileChooserDialog `{GtkFileChooserDialog *`}
+extern class GtkFileChooserDialog `{GtkFileChooserDialog *`}
        super GtkDialog
 
        new ( title : String, parent : GtkWindow, action : GtkFileChooserAction ) is extern import String.to_cstring `{
@@ -173,7 +173,7 @@ end
 #enum GtkFileChooserAction
 #Describes whether a GtkFileChooser is being used to open existing files or to save to a possibly new file.
 #@https://developer.gnome.org/gtk3/stable/GtkFileChooser.html#GtkFileChooserAction
-extern GtkFileChooserAction `{GtkFileChooserAction`}
+extern class GtkFileChooserAction `{GtkFileChooserAction`}
        #Indicates open mode. The file chooser will only let the user pick an existing file.
        new open `{ return GTK_FILE_CHOOSER_ACTION_OPEN; `}
 
@@ -189,7 +189,7 @@ end
 
 #A dialog for selecting fonts
 #@https://developer.gnome.org/gtk3/stable/GtkFontChooserDialog.html
-extern GtkFontChooserDialog `{GtkFontChooserDialog *`}
+extern class GtkFontChooserDialog `{GtkFontChooserDialog *`}
        super GtkDialog
 
        new ( title : String, parent : GtkWindow ) is extern `{
@@ -199,7 +199,7 @@ end
 
 #A convenient message window
 #@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html
-extern GtkMessageDialog `{GtkMessageDialog *`}
+extern class GtkMessageDialog `{GtkMessageDialog *`}
        super GtkDialog
 
        new ( parent : GtkWindow, flags : GtkDialogFlags, msg_type : GtkMessageType, btn_type : GtkButtonsType, format : String ) is extern import String.to_cstring `{
@@ -210,7 +210,7 @@ end
 #enum GtkButtonsType
 #Prebuilt sets of buttons for the dialog. If none of these choices are appropriate, simply use GTK_BUTTONS_NONE then call gtk_dialog_add_buttons().
 #@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html#GtkButtonsType
-extern GtkButtonsType `{GtkButtonsType`}
+extern class GtkButtonsType `{GtkButtonsType`}
        #No buttons at all
        new none `{ return GTK_BUTTONS_NONE; `}
 
@@ -233,7 +233,7 @@ end
 #enum GtkMessageType
 #The type of message being displayed in the dialog.
 #@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html#GtkMessageType
-extern GtkMessageType `{GtkMessageType`}
+extern class GtkMessageType `{GtkMessageType`}
        #Informational message
        new info `{ return GTK_MESSAGE_INFO; `}
 
@@ -252,21 +252,21 @@ end
 
 #A page setup dialog
 #@https://developer.gnome.org/gtk3/stable/GtkPageSetupUnixDialog.html
-#extern GtkPageSetupUnixDialog `{GtkPageSetupUnixDialog *`}
+#extern class GtkPageSetupUnixDialog `{GtkPageSetupUnixDialog *`}
 #      super GtkDialog
 #
 #end
 
 #A print dialog
 #@https://developer.gnome.org/gtk3/stable/GtkPrintUnixDialog.html
-#extern GtkPrintUnixDialog `{GtkPrintUnixDialog *`}
+#extern class GtkPrintUnixDialog `{GtkPrintUnixDialog *`}
 #      super GtkDialog
 #
 #end
 
 #Displays recently used files in a dialog
 #@https://developer.gnome.org/gtk3/stable/GtkRecentChooserDialog.html
-extern GtkRecentChooserDialog `{GtkRecentChooserDialog *`}
+extern class GtkRecentChooserDialog `{GtkRecentChooserDialog *`}
        super GtkDialog
 
 end
@@ -275,7 +275,7 @@ end
 #enum GtkDialogFlags
 #Flags used to influence dialog construction.
 #@https://developer.gnome.org/gtk3/stable/GtkDialog.html#GtkDialogFlags
-extern GtkDialogFlags `{GtkDialogFlags`}
+extern class GtkDialogFlags `{GtkDialogFlags`}
        #Make the constructed dialog modal.
        new modal `{ return GTK_DIALOG_MODAL; `}
 
@@ -286,7 +286,7 @@ end
 #enum GtkResponseType
 #Predefined values for use as response ids in gtk_dialog_add_button().
 #@https://developer.gnome.org/gtk3/stable/GtkDialog.html#GtkResponseType
-extern GtkResponseType `{GtkResponseType`}
+extern class GtkResponseType `{GtkResponseType`}
        #Returned if an action widget has no response id, or if the dialog gets programmatically hidden or destroyed.
        new none `{ return GTK_RESPONSE_NONE; `}
 
index cadab2d..e0c0f04 100644 (file)
@@ -24,7 +24,7 @@ in "C Header" `{
 #enum GtkArrowPlacement
 #Used to specify the placement of scroll arrows in scrolling menus.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkArrowPlacement
-extern GtkArrowPlacement `{GtkArrowPlacement`}
+extern class GtkArrowPlacement `{GtkArrowPlacement`}
        #Place one arrow on each end of the menu.
        new both `{ return GTK_ARROWS_BOTH; `}
 
@@ -38,7 +38,7 @@ end
 #enum GtkArrowType
 #Used to indicate the direction in which a GtkArrow should point.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkArrowType
-extern GtkArrowType `{GtkArrowType`}
+extern class GtkArrowType `{GtkArrowType`}
        #Represents an upward pointing arrow.
        new up `{ return GTK_ARROW_UP; `}
 
@@ -58,7 +58,7 @@ end
 #enum GtkAttachOptions
 #Denotes the expansion properties that a widget will have when it (or its parent) is resized.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkAttachOptions
-extern GtkAttachOptions `{GtkAttachOptions`}
+extern class GtkAttachOptions `{GtkAttachOptions`}
        #The widget should expand to take up any extra space in its container that has been allocated.
        new expan `{ return GTK_EXPAND; `}
 
@@ -72,7 +72,7 @@ end
 #enum GtkButtonBoxStyle
 #Used to dictate the style that a GtkButtonBox uses to layout the buttons it contains.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkButtonBoxStyle
-extern GtkButtonBoxStyle `{GtkButtonBoxStyle`}
+extern class GtkButtonBoxStyle `{GtkButtonBoxStyle`}
        #Buttons are evenly spread across the box.
        new spread `{ return GTK_BUTTONBOX_SPREAD; `}
 
@@ -92,7 +92,7 @@ end
 #enum GtkCornerType
 #Specifies which corner a child widget should be placed in when packed into a GtkScrolledWindow. This is effectively the opposite of where the scroll bars are placed.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkCornerType
-extern GtkCornerType `{GtkCornerType`}
+extern class GtkCornerType `{GtkCornerType`}
        #Place the scrollbars on the right and bottom of the widget (default behaviour).
        new top_left `{ return GTK_CORNER_TOP_LEFT; `}
 
@@ -109,7 +109,7 @@ end
 #enum GtkExpanderStyle
 #Used to specify the style of the expanders drawn by a GtkTreeView.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkExpanderStyle
-extern GtkExpanderStyle `{GtkExpanderStyle`}
+extern class GtkExpanderStyle `{GtkExpanderStyle`}
        #The style used for a collapsed subtree.
        new collapsed `{ return GTK_EXPANDER_COLLAPSED; `}
 
@@ -126,7 +126,7 @@ end
 #enum GtkJustification
 #Used for justifying the text inside a GtkLabel widget.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkJustification
-extern GtkJustification `{GtkJustification`}
+extern class GtkJustification `{GtkJustification`}
        #The text is placed at the left edge of the label.
        new left `{ return GTK_JUSTIFY_LEFT; `}
 
@@ -143,7 +143,7 @@ end
 #enum GtkOrientation
 #Represents the orientation of widgets.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkOrientation
-extern GtkOrientation `{GtkOrientation`}
+extern class GtkOrientation `{GtkOrientation`}
        #The widget is in horizontal orientation.
        new horizontal `{ return GTK_ORIENTATION_HORIZONTAL; `}
 
@@ -154,7 +154,7 @@ end
 #enum GtkPackType
 #Represents the packing location GtkBox children.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkPackType
-extern GtkPackType `{GtkPackType`}
+extern class GtkPackType `{GtkPackType`}
        #The child is packed into the start of the box.
        new start `{ return GTK_PACK_START; `}
 
@@ -165,7 +165,7 @@ end
 #enum GtkPolicyType
 #Determines when a scroll bar will be visible.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkPolicyType
-extern GtkPolicyType `{GtkPolicyType`}
+extern class GtkPolicyType `{GtkPolicyType`}
        #The scrollbar is always visible.
        new always `{ return GTK_POLICY_ALWAYS; `}
 
@@ -179,7 +179,7 @@ end
 #enum GtkPositionType
 #Describes which edge of a widget a certain feature is positioned.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkPositionType
-extern GtkPositionType `{GtkPositionType`}
+extern class GtkPositionType `{GtkPositionType`}
        #The feature is at the left edge.
        new left `{ return GTK_POS_LEFT; `}
 
@@ -196,7 +196,7 @@ end
 #enum GtkReliefStyle
 #Indicates the relief to be drawn around a GtkButton.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkReliefStyle
-extern GtkReliefStyle `{GtkReliefStyle`}
+extern class GtkReliefStyle `{GtkReliefStyle`}
        #Draw a normal relief.
        new normal `{ return GTK_RELIEF_NORMAL; `}
 
@@ -209,7 +209,7 @@ end
 
 #enum GtkResizeMode
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkResizeMode
-extern GtkResizeMode `{GtkResizeMode`}
+extern class GtkResizeMode `{GtkResizeMode`}
        #Pass resize request to the parent.
        new parent `{ return GTK_RESIZE_PARENT; `}
 
@@ -219,7 +219,7 @@ end
 
 #enum GtkSelectionMode
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkSelectionMode
-extern GtkSelectionMode `{GtkResizeMode`}
+extern class GtkSelectionMode `{GtkResizeMode`}
        #No selection is possible.
        new none `{ return GTK_SELECTION_NONE; `}
 
@@ -236,7 +236,7 @@ end
 #enum GtkShadowType
 #Used to change the appearance of an outline typically provided by a GtkFrame.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkShadowType
-extern GtkShadowType `{GtkShadowType`}
+extern class GtkShadowType `{GtkShadowType`}
        #No outline.
        new none `{ return GTK_SHADOW_NONE; `}
 
@@ -256,7 +256,7 @@ end
 #enum GtkStateType
 #Indicates the current state of a widget; the state determines how the widget is drawn.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkStateType
-extern GtkStateType `{GtkStateType`}
+extern class GtkStateType `{GtkStateType`}
        #State during normal operation.
        new normal `{ return GTK_STATE_NORMAL; `}
 
@@ -282,7 +282,7 @@ end
 #enum GtkStateFlags
 #Describes a widget state.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkStateFlags
-extern GtkStateFlags `{GtkStateFlags`}
+extern class GtkStateFlags `{GtkStateFlags`}
        #State during normal operation.
        new normal `{ return GTK_STATE_FLAG_NORMAL; `}
 
@@ -308,7 +308,7 @@ end
 #enum GtkToolbarStyle
 #Used to customize the appearance of a GtkToolbar.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkToolbarStyle
-extern GtkToolbarStyle `{GtkToolbarStyle`}
+extern class GtkToolbarStyle `{GtkToolbarStyle`}
        #Buttons display only icons in the toolbar.
        new icons `{ return GTK_TOOLBAR_ICONS; `}
 
@@ -325,7 +325,7 @@ end
 #enum GtkWindowPosition
 #Window placement can be influenced using this enumeration.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkWindowPosition
-extern GtkWindowPosition `{GtkWindowPosition`}
+extern class GtkWindowPosition `{GtkWindowPosition`}
        #No influence is made on placement.
        new none `{ return GTK_WIN_POS_NONE; `}
 
@@ -345,7 +345,7 @@ end
 #enum GtkWindowType
 #A GtkWindow can be one of these types.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkWindowType
-extern GtkWindowType `{GtkWindowType`}
+extern class GtkWindowType `{GtkWindowType`}
        #A regular window, such as a dialog
        new toplevel `{ return GTK_WINDOW_TOPLEVEL; `}
 
@@ -356,7 +356,7 @@ end
 #enum GtkSortType
 #Determines the direction of a sort.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkSortType
-extern GtkSortType `{GtkSortType`}
+extern class GtkSortType `{GtkSortType`}
        #Sorting is in ascending order.
        new asc `{ return GTK_SORT_ASCENDING; `}
 
@@ -367,7 +367,7 @@ end
 #enum GtkBorderStyle
 #Describes how the border of a UI element should be rendered.
 #@https://developer.gnome.org/gtk3/3.2/gtk3-Standard-Enumerations.html#GtkBorderStyle
-extern GtkBorderStyle `{GtkBorderStyle`}
+extern class GtkBorderStyle `{GtkBorderStyle`}
        #No visible border.
        new none `{ return GTK_BORDER_STYLE_NONE; `}
 
@@ -382,7 +382,7 @@ extern GtkBorderStyle `{GtkBorderStyle`}
 end
 
 # Icon size enum
-extern GtkIconSize `{GtkIconSize`}
+extern class GtkIconSize `{GtkIconSize`}
        new invalid `{ return GTK_ICON_SIZE_INVALID; `}
        new menu `{ return GTK_ICON_SIZE_MENU; `}
        new small_toolbar `{ return GTK_ICON_SIZE_SMALL_TOOLBAR; `}
index db21f3e..05d5ace 100644 (file)
@@ -21,7 +21,7 @@ import gtk_core
 
 #Displays a calendar and allows the user to select a date
 #@https://developer.gnome.org/gtk3/3.2/GtkCalendar.html
-extern GtkCalendar `{GtkCalendar *`}
+extern class GtkCalendar `{GtkCalendar *`}
        super GtkWidget
 
        new is extern `{
@@ -67,7 +67,7 @@ end
 
 #enum GtkCalendarDisplayOptions
 #@https://developer.gnome.org/gtk3/3.2/GtkCalendar.html#GtkCalendarDisplayOptions
-extern GtkCalendarDisplayOptions `{GtkCalendarDisplayOptions`}
+extern class GtkCalendarDisplayOptions `{GtkCalendarDisplayOptions`}
        new show_heading `{ return GTK_CALENDAR_SHOW_HEADING; `}
        new show_day_names `{ return GTK_CALENDAR_SHOW_DAY_NAMES; `}
        new no_month_change `{ return GTK_CALENDAR_NO_MONTH_CHANGE; `}
@@ -77,7 +77,7 @@ end
 
 #A separator widget
 #@https://developer.gnome.org/gtk3/stable/GtkSeparator.html
-extern GtkSeparator `{GtkSeparator *`}
+extern class GtkSeparator `{GtkSeparator *`}
        super GtkWidget
 
        new ( orientation : GtkOrientation ) is extern `{
@@ -88,7 +88,7 @@ end
 
 #A widget which indicates progress visually
 #@https://developer.gnome.org/gtk3/3.2/GtkProgressBar.html
-extern GtkProgressBar `{GtkProgressBar *`}
+extern class GtkProgressBar `{GtkProgressBar *`}
        super GtkWidget
 
        new is extern `{
@@ -143,7 +143,7 @@ extern GtkProgressBar `{GtkProgressBar *`}
 
 end
 
-extern GtkColorSelectionDialog
+extern class GtkColorSelectionDialog
        super GtkWidget
        new ( title : String, parent : GtkWindow ) is extern  import String.to_cstring `{
                 return gtk_color_chooser_dialog_new( String_to_cstring( title ), parent );
@@ -160,7 +160,7 @@ end
 
 #Retrieve an integer or floating-point number from the user
 #@https://developer.gnome.org/gtk3/3.2/GtkSpinButton.html
-extern GtkSpinButton `{GtkSpinButton *`}
+extern class GtkSpinButton `{GtkSpinButton *`}
        super GtkEntry
 
        new ( adjustment : GtkAdjustment, climb_rate : Float, digits : Int )is extern `{
@@ -207,7 +207,7 @@ end
 #enum GtkSpinType
 #The values of the GtkSpinType enumeration are used to specify the change to make in gtk_spin_button_spin().
 #@https://developer.gnome.org/gtk3/stable/GtkSpinButton.html#GtkSpinType
-extern GtkSpinType `{GtkSpinType`}
+extern class GtkSpinType `{GtkSpinType`}
        #Increment by the adjustments step increment.
        new step_forward `{ return GTK_SPIN_STEP_FORWARD; `}
 
@@ -232,13 +232,13 @@ end
 
 #A widget to unlock or lock privileged operations
 #@https://developer.gnome.org/gtk3/stable/GtkLockButton.html
-extern GtkLockButton
+extern class GtkLockButton
        super GtkButton
 end
 
 #A button to launch a color selection dialog
 #@https://developer.gnome.org/gtk3/stable/GtkColorButton.html
-extern GtkColorButton `{GtkColorButton *`}
+extern class GtkColorButton `{GtkColorButton *`}
        super GtkButton
 
        new is extern `{
index dcae8ef..95dbdda 100644 (file)
@@ -21,7 +21,7 @@ import gtk3_4
 
 #An entry which shows a search icon
 #@https://developer.gnome.org/gtk3/stable/GtkSearchEntry.html
-extern GtkSearchEntry `{GtkSearchEntry *`}
+extern class GtkSearchEntry `{GtkSearchEntry *`}
        super GtkEntry
 
        new is extern `{
index d80121f..92ad173 100644 (file)
@@ -18,7 +18,7 @@ module gtk3_8
 
 import gtk3_6
 
-redef extern GtkWidget
+redef class GtkWidget
        # Get the visibility of the widget, check if it's parents are visible too
        fun visible: Bool is extern `{
                return gtk_widget_is_visible(recv);
index ab1cb2a..6af4fb8 100644 (file)
@@ -37,7 +37,7 @@ redef class String
        `}
 end
 
-redef extern JsonObject
+redef extern class JsonObject
        # Get this json object as a Map
        private fun json_to_map : nullable Map[String, nullable Jsonable] import NativeString.to_s, String.to_cstring, HashMap[String,nullable Jsonable], HashMap[String,nullable Jsonable].[]=, json_cross, HashMap[String, nullable Jsonable].as(nullable Map[String, nullable Jsonable]) `{
                HashMap_of_String_nullable_Jsonable map;
index 41454a0..fcbe7ea 100644 (file)
@@ -126,7 +126,7 @@ redef class JsonObject
        new `{ return json_object_new_object(); `}
 
        # Add a key and value to the object
-       fun add( key : String, val : nullable JsonObject ) import String.to_cstring, JsonObject as not nullable `{
+       fun add( key : String, val : nullable JsonObject ) import String.to_cstring, JsonObject.as not nullable `{
                char* native_key;
 
                native_key = String_to_cstring( key );
@@ -141,7 +141,7 @@ redef class JsonObject
        `}
 end
 
-private extern JsonArray
+private extern class JsonArray
        super JsonObject
 
        new `{ return json_object_new_array(); `}
index 08f8908..6eb95ac 100644 (file)
@@ -27,7 +27,7 @@ interface Jsonable
 end
 
 # Main object type used by C library
-private extern JsonObject `{ struct json_object* `}
+private extern class JsonObject `{ struct json_object* `}
        # Give up ownership of this object and decrease the reference count.
        fun put `{ json_object_put( recv ); `}
 
index 2672306..a0a7eec 100644 (file)
@@ -150,7 +150,7 @@ end
 # Represents a jni JavaVM
 extern class JavaVM `{JavaVM *`}
        # Create the JVM, returns its handle and store the a pointer to JniEnv in `env_ref`
-       new(args: JavaVMInitArgs, env_ref: JniEnvRef) import jni_error, JniEnvRef.jni_env=, JniEnv as nullable `{
+       new(args: JavaVMInitArgs, env_ref: JniEnvRef) import jni_error, JniEnvRef.jni_env=, JniEnv.as nullable `{
                JavaVM *jvm;
                JNIEnv *env;
                jint res;
@@ -228,49 +228,49 @@ extern class JniEnv `{JNIEnv *`}
        `}
 
        # Call a method on `obj` designed by `method_id` with an array `args` of arguments
-       fun call_void_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]) import Array[nullable Object] as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
+       fun call_void_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]) import Array[nullable Object].as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
                jvalue * args_tab = convert_array_of_Object_to_c(args, recv);
                (*recv)->CallVoidMethodA(recv, obj, method_id, args_tab);
                free(args_tab);
        `}
        
        # Call a method on `obj` designed by `method_id` with an array `args` of argument returning a JObject
-       fun call_object_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): JObject import Array[nullable Object] as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
+       fun call_object_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): JObject import Array[nullable Object].as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
                jvalue * args_tab = convert_array_of_Object_to_c(args, recv);
                (*recv)->CallObjectMethod(recv, obj, method_id, args_tab);
                free(args_tab);
        `}
        
        # Call a method on `obj` designed by `method_id` with an array `args` of arguments returning a Bool
-       fun call_boolean_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): Bool import Array[nullable Object] as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
+       fun call_boolean_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): Bool import Array[nullable Object].as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
                jvalue * args_tab = convert_array_of_Object_to_c(args, recv);
                return (*recv)->CallBooleanMethod(recv, obj, method_id, args_tab);
                free(args_tab);
        `}
 
        # Call a method on `obj` designed by `method_id` with an array `args` of arguments returning a Char
-       fun call_char_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): Char import Array[nullable Object] as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
+       fun call_char_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): Char import Array[nullable Object].as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
                jvalue * args_tab = convert_array_of_Object_to_c(args, recv);
                return (*recv)->CallCharMethod(recv, obj, method_id, args_tab);
                free(args_tab);
        `}
 
        # Call a method on `obj` designed by `method_id` with an array `args` of arguments returning an Int
-       fun call_int_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): Int import Array[nullable Object] as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
+       fun call_int_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): Int import Array[nullable Object].as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
                jvalue * args_tab = convert_array_of_Object_to_c(args, recv);
                return (*recv)->CallIntMethod(recv, obj, method_id, args_tab);
                free(args_tab);
        `}
        
        # Call a method on `obj` designed by `method_id` with an array `args` of arguments returning a Float
-       fun call_float_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): Float import Array[nullable Object] as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
+       fun call_float_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): Float import Array[nullable Object].as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring `{
                jvalue * args_tab = convert_array_of_Object_to_c(args, recv);
                return (*recv)->CallFloatMethod(recv, obj, method_id, args_tab);
                free(args_tab);
        `}
 
        # Call a method on `obj` designed by `method_id` with an array `args` of arguments returning a NativeString
-       fun call_string_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): NativeString import Array[nullable Object] as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring, String.length `{
+       fun call_string_method(obj: JObject, method_id: JMethodID, args: nullable Array[nullable Object]): NativeString import Array[nullable Object].as not nullable, Array[nullable Object].[], Array[nullable Object].length, nullable Object.as(Int), nullable Object.as(Char), nullable Object.as(Bool), nullable Object.as(Float), nullable Object.as(JObject), nullable Object.as(String), String.to_cstring, String.length `{
                jvalue * args_tab = convert_array_of_Object_to_c(args, recv);
                jobject jobj = (*recv)->CallObjectMethod(recv, obj, method_id, args_tab);
                free(args_tab);
index 1f081d6..a0233fa 100644 (file)
@@ -423,7 +423,7 @@ class Opengles1Display
        `}
 end
 
-extern Opengles1Image in "C" `{struct mnit_opengles_Texture *`}
+extern class Opengles1Image in "C" `{struct mnit_opengles_Texture *`}
        super Image
 
     redef fun destroy is extern `{ free( recv ); `}
@@ -467,7 +467,7 @@ extern Opengles1Image in "C" `{struct mnit_opengles_Texture *`}
 end
 
 # FIXME this class is broken
-extern Opengles1DrawableImage in "C" `{struct mnit_opengles_DrawableTexture*`}
+extern class Opengles1DrawableImage in "C" `{struct mnit_opengles_DrawableTexture*`}
        super DrawableImage
     new ( w, h: Int ) is extern `{
                struct mnit_opengles_DrawableTexture *image =
index d396bd0..3efae05 100644 (file)
@@ -240,7 +240,7 @@ in "C" `{
 `}
 
 
-extern InnerAndroidMotionEvent in "C" `{AInputEvent *`}
+extern class InnerAndroidMotionEvent in "C" `{AInputEvent *`}
        super Pointer
        private fun pointers_count: Int is extern `{
        return AMotionEvent_getPointerCount(recv);
@@ -345,7 +345,7 @@ class AndroidPointerEvent
        redef fun depressed do return not pressed
 end
 
-extern AndroidKeyEvent in "C" `{AInputEvent *`}
+extern class AndroidKeyEvent in "C" `{AInputEvent *`}
        super KeyEvent
        super AndroidInputEvent
 
index 27911f3..bf020cf 100644 (file)
@@ -52,9 +52,9 @@ in "C" `{
        }
 `}
 
-extern AndroidAsset in "C" `{struct AAsset*`}
+extern class AndroidAsset in "C" `{struct AAsset*`}
 
-       fun read(count: Int): nullable String is extern import String as nullable, NativeString.to_s `{
+       fun read(count: Int): nullable String is extern import String.as nullable, NativeString.to_s `{
                char *buffer = malloc(sizeof(char) * (count+1));
                int read = AAsset_read(recv, buffer, count);
                if (read != count)
@@ -103,7 +103,7 @@ redef class App
                return null
        end
 
-       protected fun load_asset_from_apk(path: String): nullable AndroidAsset is extern import String.to_cstring, AndroidAsset as nullable `{
+       protected fun load_asset_from_apk(path: String): nullable AndroidAsset is extern import String.to_cstring, AndroidAsset.as nullable `{
                struct AAsset* a = AAssetManager_open(mnit_java_app->activity->assetManager, String_to_cstring(path), AASSET_MODE_BUFFER);
                if (a == NULL)
                {
index f7dab3b..051d17c 100644 (file)
@@ -43,7 +43,7 @@ in "C" `{
        extern struct android_app *mnit_java_app;
 `}
 
-extern ASensorType `{int`}
+extern class ASensorType `{int`}
        new accelerometer: ASensorType `{return ASENSOR_TYPE_ACCELEROMETER;`}
        fun is_accelerometer: Bool `{return recv == ASENSOR_TYPE_ACCELEROMETER;`}
        new magnetic_field: ASensorType `{return ASENSOR_TYPE_MAGNETIC_FIELD;`}
index 00a1175..853f8dd 100644 (file)
@@ -77,7 +77,7 @@ redef class Opengles1Display
        end
 end
 
-redef extern Opengles1Image
+redef extern class Opengles1Image
        new from_sdl_image( sdl_image: SDLImage ) is extern `{
                return mnit_opengles_load_image( sdl_image->pixels, sdl_image->w, sdl_image->h, sdl_image->format->Amask );
        `}
index 3ae6346..fd0fe86 100644 (file)
@@ -21,7 +21,7 @@ in "C header" `{
 #include <time.h>
 `}
 
-extern Timespec `{struct timespec*`}
+extern class Timespec `{struct timespec*`}
        new ( s, ns : Int ) `{
                struct timespec* tv = malloc( sizeof(struct timespec) );
                tv->tv_sec = s; tv->tv_nsec = ns;
index 0ac97b4..318b4a6 100644 (file)
@@ -218,7 +218,7 @@ extern class SDLImage
        `}
 
        # Save the image into the specified file
-       fun save_to_file(path: String) import String::to_cstring `{ `}
+       fun save_to_file(path: String) import String.to_cstring `{ `}
 
        # Destroy the image and free the memory
        redef fun destroy `{ SDL_FreeSurface(recv); `}
@@ -441,7 +441,7 @@ extern class SDLFont `{TTF_Font *`}
        `}
 
        # Return the family name of the font
-       fun family_name: nullable String import String.to_cstring, String as nullable `{
+       fun family_name: nullable String import String.to_cstring, String.as nullable  `{
                char *fn = TTF_FontFaceFamilyName(recv);
 
                if (fn == NULL)
@@ -451,7 +451,7 @@ extern class SDLFont `{TTF_Font *`}
        `}
 
        # Return the style name of the font
-       fun style_name: nullable String import String.to_cstring, String as nullable `{
+       fun style_name: nullable String import String.to_cstring, String.as nullable  `{
                char *sn = TTF_FontFaceStyleName(recv);
 
                if (sn == NULL)
index 1d56bcb..241422c 100644 (file)
@@ -84,7 +84,7 @@ class PollFD
 end
 
 # Data structure used by the poll function
-private extern FFSocketPollFD `{ struct pollfd `}
+private extern class FFSocketPollFD `{ struct pollfd `}
        # File descriptor id
        private fun fd: Int `{ return recv.fd; `}
        # List of events to be watched
@@ -101,7 +101,7 @@ private extern FFSocketPollFD `{ struct pollfd `}
 
 end
 
-extern FFSocket `{ S_DESCRIPTOR* `}
+extern class FFSocket `{ S_DESCRIPTOR* `}
        new socket(domain: FFSocketAddressFamilies, socketType: FFSocketTypes, protocol: FFSocketProtocolFamilies) `{
                S_DESCRIPTOR *d = NULL; d = (S_DESCRIPTOR*) malloc( sizeof(S_DESCRIPTOR) );
                int ds = socket(domain, socketType, protocol);
@@ -187,7 +187,7 @@ extern FFSocket `{ S_DESCRIPTOR* `}
        end
 end
 
-extern FFSocketAcceptResult `{ S_ACCEPT_RESULT* `}
+extern class FFSocketAcceptResult `{ S_ACCEPT_RESULT* `}
        new (socket: FFSocket, addrIn: FFSocketAddrIn) `{
                S_ACCEPT_RESULT *sar = NULL;
                sar = malloc( sizeof(S_ACCEPT_RESULT) );
@@ -200,7 +200,7 @@ extern FFSocketAcceptResult `{ S_ACCEPT_RESULT* `}
        fun destroy `{ free(recv); `}
 end
 
-extern FFSocketAddrIn `{ S_ADDR_IN* `}
+extern class FFSocketAddrIn `{ S_ADDR_IN* `}
        new `{
                S_ADDR_IN *sai = NULL;
                sai = malloc( sizeof(S_ADDR_IN) );
@@ -228,7 +228,7 @@ extern FFSocketAddrIn `{ S_ADDR_IN* `}
        fun destroy `{ free(recv); `}
 end
 
-extern FFSocketHostent `{ S_HOSTENT* `}
+extern class FFSocketHostent `{ S_HOSTENT* `}
        private fun i_h_aliases(i: Int): String import NativeString.to_s `{ return NativeString_to_s(recv->h_aliases[i]); `}
        private fun i_h_aliases_reachable(i: Int): Bool `{ return (recv->h_aliases[i] != NULL); `}
        fun h_aliases: Array[String]
@@ -248,7 +248,7 @@ extern FFSocketHostent `{ S_HOSTENT* `}
        fun h_name: String import NativeString.to_s `{ return NativeString_to_s(recv->h_name); `}
 end
 
-extern FFTimeval `{ S_TIMEVAL* `}
+extern class FFTimeval `{ S_TIMEVAL* `}
        new (seconds: Int, microseconds: Int) `{
                S_TIMEVAL* tv = NULL;
                tv = malloc( sizeof(S_TIMEVAL) );
@@ -261,7 +261,7 @@ extern FFTimeval `{ S_TIMEVAL* `}
        fun destroy `{ free( recv ); `}
 end
 
-extern FFSocketSet `{ S_FD_SET* `}
+extern class FFSocketSet `{ S_FD_SET* `}
        new `{
                S_FD_SET *f = NULL;
                f = malloc( sizeof(S_FD_SET) );
@@ -287,13 +287,13 @@ class FFSocketObserver
        `}
 end
 
-extern FFSocketTypes `{ int `}
+extern class FFSocketTypes `{ int `}
        new sock_stream `{ return SOCK_STREAM; `}
        new sock_dgram `{ return SOCK_DGRAM; `}
        new sock_raw `{ return SOCK_RAW; `}
        new sock_seqpacket `{ return SOCK_SEQPACKET; `}
 end
-extern FFSocketAddressFamilies `{ int `}
+extern class FFSocketAddressFamilies `{ int `}
        new af_null `{ return 0; `}
        new af_unspec `{ return  AF_UNSPEC; `}          # unspecified
        new af_unix `{ return  AF_UNIX; `}              # local to host (pipes)
@@ -307,7 +307,7 @@ extern FFSocketAddressFamilies `{ int `}
        new af_inet6 `{ return  AF_INET6; `}            # IPv6
        new af_max `{ return  AF_MAX; `}
 end
-extern FFSocketProtocolFamilies `{ int `}
+extern class FFSocketProtocolFamilies `{ int `}
        new pf_null `{ return 0; `}
        new pf_unspec `{ return PF_UNSPEC; `}
        new pf_local `{ return PF_LOCAL; `}
@@ -323,7 +323,7 @@ extern FFSocketProtocolFamilies `{ int `}
        new pf_max `{ return PF_MAX; `}
 end
 # Level on which to set options
-extern FFSocketOptLevels `{ int `}
+extern class FFSocketOptLevels `{ int `}
        # Dummy for IP (As defined in C)
        new ip `{ return IPPROTO_IP;`}
        # Control message protocol
@@ -334,7 +334,7 @@ extern FFSocketOptLevels `{ int `}
        new socket `{ return SOL_SOCKET; `}
 end
 # Options for socket, use with setsockopt
-extern FFSocketOptNames `{ int `}
+extern class FFSocketOptNames `{ int `}
        # Enables debugging information
        new debug `{ return SO_DEBUG; `}
        # Authorizes the broadcasting of messages
@@ -345,7 +345,7 @@ extern FFSocketOptNames `{ int `}
        new keepalive `{ return SO_KEEPALIVE; `}
 end
 # Used for the poll function of a socket, mix several Poll values to check for events on more than one type of event
-extern FFSocketPollValues `{ int `}
+extern class FFSocketPollValues `{ int `}
        new pollin `{ return POLLIN; `}           # Data other than high-priority data may be read without blocking.
        new pollrdnorm `{ return POLLRDNORM; `}   # Normal data may be read without blocking.
        new pollrdband `{ return POLLRDBAND; `}   # Priority data may be read without blocking.
index 2814034..a187c3a 100644 (file)
@@ -134,7 +134,7 @@ extern class Sqlite3 `{sqlite3 *`}
                return sqlite3_exec(recv, String_to_cstring(sql), 0, 0, 0);
        `}
 
-       fun prepare(sql: String): nullable Statement import String.to_cstring, Statement as nullable `{
+       fun prepare(sql: String): nullable Statement import String.to_cstring, Statement.as nullable `{
                sqlite3_stmt *stmt;
                int res = sqlite3_prepare_v2(recv, String_to_cstring(sql), -1, &stmt, 0);
                if (res == SQLITE_OK)
index 166cef4..606c2bd 100644 (file)
@@ -184,7 +184,7 @@ redef class NativeString
        fun system: Int is extern "string_NativeString_NativeString_system_0"
 end
 
-private extern NativeProcess
+private extern class NativeProcess
        fun id: Int is extern "exec_NativeProcess_NativeProcess_id_0"
        fun is_finished: Bool is extern "exec_NativeProcess_NativeProcess_is_finished_0"
        fun status: Int is extern "exec_NativeProcess_NativeProcess_status_0"
index f2653d1..d6c800b 100644 (file)
@@ -507,7 +507,7 @@ extern class FileStat `{ struct stat * `}
 end
 
 # Instance of this class are standard FILE * pointers
-private extern NativeFile `{ FILE* `}
+private extern class NativeFile `{ FILE* `}
        fun io_read(buf: NativeString, len: Int): Int is extern "file_NativeFile_NativeFile_io_read_2"
        fun io_write(buf: NativeString, len: Int): Int is extern "file_NativeFile_NativeFile_io_write_2"
        fun io_close: Int is extern "file_NativeFile_NativeFile_io_close_0"
index ce6b69e..30e8449 100644 (file)
@@ -600,7 +600,7 @@ universal Char
 end
 
 # Pointer classes are used to manipulate extern C structures.
-extern Pointer
+extern class Pointer
        # Is the address behind this Object at NULL?
        fun address_is_null: Bool `{ return recv == NULL; `}
 
index 477dfc1..3fe526c 100644 (file)
@@ -22,7 +22,7 @@ module test_ffi_c_callback_extern_receiver
 #include <stdio.h>
 `}
 
-extern Test
+extern class Test
     new create_me is extern `{
         int* foobar = malloc(sizeof(int));
         *foobar = 12345;
index 1511348..8a497fa 100644 (file)
@@ -47,7 +47,7 @@ fun callbacks_with_as_casts(a: A, b: B) import B.foo, A.foo, B.as(A), A.as(B) `{
        B_foo(bb);
 `}
 
-fun callbacks_with_nullable_casts(a: A, b: nullable B) import B as not nullable, A as nullable, A.as(nullable B), B.foo `{
+fun callbacks_with_nullable_casts(a: A, b: nullable B) import B.as not nullable, A.as nullable, A.as(nullable B), B.foo `{
        if (!nullable_B_is_a_B(b)) {
                printf("Instance b is not a B (it is null)\n");
        } else {
@@ -63,7 +63,7 @@ fun callbacks_with_nullable_casts(a: A, b: nullable B) import B as not nullable,
        }
 `}
 
-fun callbacks_with_failed_checks(a: A, b: nullable B) import B as not nullable, B as nullable, A.as(B), B.as(A) `{
+fun callbacks_with_failed_checks(a: A, b: nullable B) import B.as not nullable, B.as nullable, A.as(B), B.as(A) `{
        if (!A_is_a_B(a)) {
                printf("Instance of A is not a B.\n");
        }
index 9b90564..4fff19f 100644 (file)
@@ -38,7 +38,7 @@ class A
        fun recover_unsafe( i : Int ) : ToBePreserved `{
                return global_tbps[i];
        `}
-       fun recover( i : Int ) : nullable ToBePreserved import ToBePreserved as nullable `{
+       fun recover( i : Int ) : nullable ToBePreserved import ToBePreserved.as nullable `{
                if ( global_tbps[i] != NULL ) {
                        return ToBePreserved_as_nullable( global_tbps[i] );
                } else {
index 04d82a9..7e9ec29 100644 (file)
@@ -30,7 +30,7 @@ in "C" `{
        }
 `}
 
-extern A
+extern class A
        new is extern `{ return malloc(1); `}
        new new_implicit `{ return malloc(1); `}
        new new_in_language is extern in "C" `{ return malloc(1); `}
@@ -62,18 +62,18 @@ extern A
        fun inline_implicit : Int `{ return  7; `}
 end
 
-extern B
+extern class B
 super A
 end
 
-extern C `{int*`}
+extern class C `{int*`}
 end
 
-extern D
+extern class D
 super C
 end
 
-extern E
+extern class E
 super C
 end
 
index d18d931..6f5a95a 100644 (file)
@@ -18,7 +18,7 @@
 int dv = 1234;
 `}
 
-extern A `{int *`}
+extern class A `{int *`}
        super Pointer
 
        new import p `{
index 9391d7c..071fa86 100644 (file)
@@ -8,7 +8,7 @@ in "C header" `{
                };
 `}
 
-extern A in "C" `{struct s_a*`}
+extern class A in "C" `{struct s_a*`}
        new `{
                struct s_a* v = malloc(sizeof(struct s_a));
                v->x = 1;
@@ -20,7 +20,7 @@ extern A in "C" `{struct s_a*`}
        `}
 end
 
-extern B in "C" `{struct s_b*`}
+extern class B in "C" `{struct s_b*`}
        super A
        new `{
                struct s_b* v = malloc(sizeof(struct s_b));
@@ -37,7 +37,7 @@ extern B in "C" `{struct s_b*`}
        `}
 end
 
-extern C
+extern class C
        super A
        new `{
                struct s_a* v = malloc(sizeof(struct s_a));
index 2d68ac2..6101a3d 100644 (file)
@@ -16,7 +16,7 @@
 
 import realtime
 
-redef extern Timespec
+redef extern class Timespec
        fun simplify : Int
        do
                return sec*1000000 + nanosec/1000