Added parse_struct() to parser.py
This commit is contained in:
+12
-56
@@ -14,7 +14,6 @@
|
|||||||
; You should have received a copy of the GNU Lesser General Public
|
; You should have received a copy of the GNU Lesser General Public
|
||||||
; License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
; License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
; Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||||
@@ -22,25 +21,19 @@
|
|||||||
; files for a list of changes. These files are distributed with
|
; files for a list of changes. These files are distributed with
|
||||||
; GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
; GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%ifndef __GTK_WINDOW_H__
|
%ifndef __GTK_WINDOW_H__
|
||||||
%define __GTK_WINDOW_H__
|
%define __GTK_WINDOW_H__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
%if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||||
%error "Only "gtk/gtk.inc" can be included directly."
|
%error "Only "gtk/gtk.inc" can be included directly."
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%include "gtk/gtkapplication.inc"
|
%include "gtk/gtkapplication.inc"
|
||||||
%include "gtk/gtkaccelgroup.inc"
|
%include "gtk/gtkaccelgroup.inc"
|
||||||
%include "gtk/gtkbin.inc"
|
%include "gtk/gtkbin.inc"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%define GTK_TYPE_WINDOW (gtk_window_get_type ())
|
%define GTK_TYPE_WINDOW (gtk_window_get_type ())
|
||||||
%define GTK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow))
|
%define GTK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow))
|
||||||
@@ -48,19 +41,21 @@
|
|||||||
%define GTK_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WINDOW))
|
%define GTK_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WINDOW))
|
||||||
%define GTK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW))
|
%define GTK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW))
|
||||||
%define GTK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass))
|
%define GTK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass))
|
||||||
|
|
||||||
|
|
||||||
struc GtkWindowPrivate;
|
struc GtkWindowPrivate
|
||||||
struc GtkWindowClass;
|
endstruc
|
||||||
struc GtkWindowGeometryInfo;
|
struc GtkWindowClass
|
||||||
struc GtkWindowGroup;
|
endstruc
|
||||||
struc GtkWindowGroupClass;
|
struc GtkWindowGeometryInfo
|
||||||
struc GtkWindowGroupPrivate;
|
endstruc
|
||||||
|
struc GtkWindowGroup
|
||||||
|
endstruc
|
||||||
|
struc GtkWindowGroupClass
|
||||||
|
endstruc
|
||||||
|
struc GtkWindowGroupPrivate
|
||||||
|
endstruc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; GtkWindowClass:
|
; GtkWindowClass:
|
||||||
; @parent_class: The parent class.
|
; @parent_class: The parent class.
|
||||||
@@ -72,21 +67,14 @@ struc GtkWindowGroupPrivate;
|
|||||||
; @enable_debugging: Class handler for the #GtkWindow::enable-debugging
|
; @enable_debugging: Class handler for the #GtkWindow::enable-debugging
|
||||||
; keybinding signal. Since: 3.14
|
; keybinding signal. Since: 3.14
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; G_SIGNAL_ACTION signals for keybindings
|
; G_SIGNAL_ACTION signals for keybindings
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Padding for future expansion
|
; Padding for future expansion
|
||||||
|
|
||||||
|
|
||||||
; GtkWindowType:
|
; GtkWindowType:
|
||||||
; @GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog.
|
; @GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog.
|
||||||
@@ -108,7 +96,6 @@ struc GtkWindowGroupPrivate;
|
|||||||
|
|
||||||
GTK_WINDOW_TOPLEVEL EQU 0
|
GTK_WINDOW_TOPLEVEL EQU 0
|
||||||
GTK_WINDOW_POPUP EQU 1
|
GTK_WINDOW_POPUP EQU 1
|
||||||
|
|
||||||
|
|
||||||
; GtkWindowPosition:
|
; GtkWindowPosition:
|
||||||
; @GTK_WIN_POS_NONE: No influence is made on placement.
|
; @GTK_WIN_POS_NONE: No influence is made on placement.
|
||||||
@@ -127,77 +114,46 @@ GTK_WIN_POS_CENTER EQU 1
|
|||||||
GTK_WIN_POS_MOUSE EQU 2
|
GTK_WIN_POS_MOUSE EQU 2
|
||||||
GTK_WIN_POS_CENTER_ALWAYS EQU 3
|
GTK_WIN_POS_CENTER_ALWAYS EQU 3
|
||||||
GTK_WIN_POS_CENTER_ON_PARENT EQU 4
|
GTK_WIN_POS_CENTER_ON_PARENT EQU 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const gchar ; gtk_window_get_title (GtkWindow *window);
|
const gchar ; gtk_window_get_title (GtkWindow *window);
|
||||||
const gchar ; gtk_window_get_role (GtkWindow *window);
|
const gchar ; gtk_window_get_role (GtkWindow *window);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const gchar ; gtk_window_get_icon_name (GtkWindow *window);
|
const gchar ; gtk_window_get_icon_name (GtkWindow *window);
|
||||||
const gchar ; gtk_window_get_default_icon_name (void);
|
const gchar ; gtk_window_get_default_icon_name (void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; If window is set modal, input will be grabbed when show and released when hide
|
; If window is set modal, input will be grabbed when show and released when hide
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Set initial default size of the window (does not constrain user
|
; Set initial default size of the window (does not constrain user
|
||||||
; resize operations)
|
; resize operations)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Ignore this unless you are writing a GUI builder
|
; Ignore this unless you are writing a GUI builder
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Window grips
|
; Window grips
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif ; __GTK_WINDOW_H__
|
#endif ; __GTK_WINDOW_H__
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ class PARSEOBJECT:
|
|||||||
self.typedef_struct = False
|
self.typedef_struct = False
|
||||||
self.struct_begin = False
|
self.struct_begin = False
|
||||||
self.enum_begin = False
|
self.enum_begin = False
|
||||||
|
self.struct = False
|
||||||
|
self.struct_end = False
|
||||||
|
|
||||||
def inc_passes(self):
|
def inc_passes(self):
|
||||||
self.passes = next(self._passes)
|
self.passes = next(self._passes)
|
||||||
@@ -123,7 +125,8 @@ class PARSEOBJECT:
|
|||||||
templine = []
|
templine = []
|
||||||
tempstr = ""
|
tempstr = ""
|
||||||
if l == []:
|
if l == []:
|
||||||
tempfile.append("\n")
|
templine.append("")
|
||||||
|
tempfile.append(templine)
|
||||||
continue
|
continue
|
||||||
if "TOKEN_CSTART" in l:
|
if "TOKEN_CSTART" in l:
|
||||||
self.inside_comment = True
|
self.inside_comment = True
|
||||||
@@ -146,7 +149,10 @@ class PARSEOBJECT:
|
|||||||
tempfile.append(templine)
|
tempfile.append(templine)
|
||||||
if self.typedef_struct == True:
|
if self.typedef_struct == True:
|
||||||
templine.append('struc')
|
templine.append('struc')
|
||||||
templine.append(l[-1])
|
templine.append(l[-1][:-1])
|
||||||
|
tempfile.append(templine)
|
||||||
|
templine = []
|
||||||
|
templine.append('endstruc')
|
||||||
tempfile.append(templine)
|
tempfile.append(templine)
|
||||||
continue
|
continue
|
||||||
if "typedef" in l:
|
if "typedef" in l:
|
||||||
@@ -158,9 +164,15 @@ class PARSEOBJECT:
|
|||||||
tempfile.append(templine)
|
tempfile.append(templine)
|
||||||
if self.typedef_struct == True:
|
if self.typedef_struct == True:
|
||||||
templine.append('struc')
|
templine.append('struc')
|
||||||
templine.append(l[-1])
|
templine.append(l[-1][:-1])
|
||||||
|
tempfile.append(templine)
|
||||||
|
templine = []
|
||||||
|
templine.append('endstruc')
|
||||||
tempfile.append(templine)
|
tempfile.append(templine)
|
||||||
continue
|
continue
|
||||||
|
if "struct" in l:
|
||||||
|
self.parse_struct(l)
|
||||||
|
|
||||||
if "TOKEN_PREPROCESS" in l:
|
if "TOKEN_PREPROCESS" in l:
|
||||||
tempfile.append(self.parse_preprocess(l))
|
tempfile.append(self.parse_preprocess(l))
|
||||||
continue
|
continue
|
||||||
@@ -202,6 +214,21 @@ class PARSEOBJECT:
|
|||||||
continue
|
continue
|
||||||
return tempfile
|
return tempfile
|
||||||
|
|
||||||
|
def parse_struct(self, l):
|
||||||
|
templine = []
|
||||||
|
for w in l:
|
||||||
|
if w == "struct":
|
||||||
|
self.struct = True
|
||||||
|
templine.append('struc')
|
||||||
|
continue
|
||||||
|
if w != "":
|
||||||
|
templine.append(w)
|
||||||
|
continue
|
||||||
|
if w == "{" and self.struct == True:
|
||||||
|
self.struct_begin = True
|
||||||
|
continue
|
||||||
|
return templine
|
||||||
|
|
||||||
def parse_typedef(self, l):
|
def parse_typedef(self, l):
|
||||||
templine = []
|
templine = []
|
||||||
for w in l:
|
for w in l:
|
||||||
|
|||||||
Reference in New Issue
Block a user