Compare commits
19 Commits
master
...
Developmen
Author | SHA1 | Date | |
---|---|---|---|
3c6fed68cf | |||
fc56973157 | |||
6d50786773 | |||
3ef75f488a | |||
19f0c466f7 | |||
d5c4030527 | |||
b30b368820 | |||
bb3203bd33 | |||
21aa6f0b12 | |||
47e3272458 | |||
74a0d25926 | |||
687f2d157d | |||
4c9f661544 | |||
f91d3efc25 | |||
e1e97bc31c | |||
bcf74e384e | |||
ba69d83e2b | |||
3ea5002ded | |||
d5044a7f1e |
BIN
__pycache__/lineanalyzer.cpython-37.pyc
Normal file
BIN
__pycache__/lineanalyzer.cpython-37.pyc
Normal file
Binary file not shown.
18
comment.py
Normal file
18
comment.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from metaclasses import InstanceCounterMeta
|
||||
from rply import LexerGenerator
|
||||
|
||||
class comment(object, metaclass=InstanceCounterMeta):
|
||||
def __init__(self,com):
|
||||
self.id = next(self.__class__._ids)
|
||||
self.comment_lexer = LexerGenerator()
|
||||
self.comment_lexer.add("CSTART", r"(/*)")
|
||||
|
||||
self.comment_lexer.add("CEND", r"(*/)")
|
||||
self.comment_lexer.ignore(r'\s+')
|
||||
|
||||
|
||||
def parse_comment(self):
|
||||
com = self.comment
|
||||
if com.startswith('/*'):
|
||||
self.block_comment = True
|
||||
|
511
gtkwindow.inc
511
gtkwindow.inc
@@ -1,350 +1,429 @@
|
||||
; GTK - The GIMP Toolkit
|
||||
; Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
;
|
||||
; This library is free software; you can redistribute it and/or
|
||||
; modify it under the terms of the GNU Lesser General Public
|
||||
; License as published by the Free Software Foundation; either
|
||||
; version 2 of the License, or (at your option) any later version.
|
||||
;
|
||||
; This library is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS A PARTICULAR PURPOSE. See the GNU
|
||||
; Lesser General Public License for more details.
|
||||
;
|
||||
; 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/>.
|
||||
|
||||
;
|
||||
; Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
; file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
; files for a list of changes. These files are distributed with
|
||||
; GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
|
||||
%ifndef __GTK_WINDOW_H__
|
||||
%define __GTK_WINDOW_H__
|
||||
%if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
%error "Only "gtk/gtk.inc" can be included directly."
|
||||
%endif
|
||||
%include "gtk/gtkapplication.inc"
|
||||
%include "gtk/gtkaccelgroup.inc"
|
||||
%include "gtk/gtkbin.inc"
|
||||
%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_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WINDOW, GtkWindowClass))
|
||||
%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_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass))
|
||||
; typedef struct _GtkWindowPrivate GtkWindowPrivate;
|
||||
; typedef struct _GtkWindowClass GtkWindowClass;
|
||||
; typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo;
|
||||
; typedef struct _GtkWindowGroup GtkWindowGroup;
|
||||
; typedef struct _GtkWindowGroupClass GtkWindowGroupClass;
|
||||
; typedef struct _GtkWindowGroupPrivate GtkWindowGroupPrivate;
|
||||
; GtkWindowClass:
|
||||
; @parent_class: The parent class.
|
||||
; @set_focus: Sets child as the focus widget for the window.
|
||||
; @activate_focus: Activates the current focused widget within the window.
|
||||
; @activate_default: Activates the default widget for the window.
|
||||
; @keys_changed: Signal gets emitted when the set of accelerators or
|
||||
; mnemonics that are associated with window changes.
|
||||
; @enable_debugging: Class handler for the #GtkWindow::enable-debugging
|
||||
; keybinding signal. Since: 3.14
|
||||
|
||||
; G_SIGNAL_ACTION signals for keybindings
|
||||
; Padding for future expansion
|
||||
; GtkWindowType:
|
||||
; @GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog.
|
||||
; @GTK_WINDOW_POPUP: A special window such as a tooltip.
|
||||
;
|
||||
; A #GtkWindow can be one of these types. Most things you’d consider a
|
||||
; “window” should have type #GTK_WINDOW_TOPLEVEL; windows with this type
|
||||
; are managed by the window manager and have a frame by default (call
|
||||
; gtk_window_set_decorated() to toggle the frame). Windows with type
|
||||
; #GTK_WINDOW_POPUP are ignored by the window manager; window manager
|
||||
; keybindings won’t work on them, the window manager won’t decorate the
|
||||
; window with a frame, many GTK+ features that rely on the window
|
||||
; manager will not work (e.g. resize grips and
|
||||
; maximization/minimization). #GTK_WINDOW_POPUP is used to implement
|
||||
; widgets such as #GtkMenu or tooltips that you normally don’t think of
|
||||
; as windows per se. Nearly all windows should be #GTK_WINDOW_TOPLEVEL.
|
||||
; In particular, do not use #GTK_WINDOW_POPUP just to turn off
|
||||
; the window borders; use gtk_window_set_decorated() for that.
|
||||
|
||||
GTK_WINDOW_TOPLEVEL EQU 0
|
||||
|
||||
GTK_WINDOW_POPUP EQU 1
|
||||
|
||||
/** EQU 2
|
||||
|
||||
; GtkWindowPosition:
|
||||
; @GTK_WIN_POS_NONE: No influence is made on placement.
|
||||
; @GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen.
|
||||
; @GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position.
|
||||
; @GTK_WIN_POS_CENTER_ALWAYS: Keep window centered as it changes size, etc.
|
||||
; @GTK_WIN_POS_CENTER_ON_PARENT: Center the window on its transient
|
||||
; parent (see gtk_window_set_transient_for()).
|
||||
;
|
||||
; Window placement can be influenced using this enumeration. Note that
|
||||
; using #GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea.
|
||||
; It won’t necessarily work well with all window managers or on all windowing systems.
|
||||
|
||||
GTK_WIN_POS_NONE EQU 3
|
||||
|
||||
GTK_WIN_POS_CENTER EQU 4
|
||||
|
||||
GTK_WIN_POS_MOUSE EQU 5
|
||||
|
||||
GTK_WIN_POS_CENTER_ALWAYS EQU 6
|
||||
|
||||
GTK_WIN_POS_CENTER_ON_PARENT EQU 7
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 8
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 9
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 10
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 11
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 12
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 13
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 14
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 15
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 16
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 17
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 18
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 19
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 20
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 21
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 22
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 23
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 24
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 25
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 26
|
||||
|
||||
GDK_AVAILABLE_IN_3_4 EQU 27
|
||||
|
||||
GDK_AVAILABLE_IN_3_4 EQU 28
|
||||
|
||||
GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_set_opacity) EQU 29
|
||||
|
||||
GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_get_opacity) EQU 30
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 31
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 32
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 33
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 34
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 35
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 36
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 37
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 38
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 39
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 40
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 41
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 42
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 43
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 44
|
||||
|
||||
GDK_AVAILABLE_IN_3_4 EQU 45
|
||||
|
||||
GDK_AVAILABLE_IN_3_4 EQU 46
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 47
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 48
|
||||
|
||||
GDK_AVAILABLE_IN_3_2 EQU 49
|
||||
|
||||
GDK_AVAILABLE_IN_3_2 EQU 50
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 51
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 52
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 53
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 54
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 55
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 56
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 57
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 58
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 59
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 60
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 61
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 62
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 63
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 64
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 65
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 66
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 67
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 68
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 69
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 70
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 71
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 72
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 73
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 74
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 75
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 76
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 77
|
||||
|
||||
; If window is set modal, input will be grabbed when show and released when hide
|
||||
GDK_AVAILABLE_IN_ALL EQU 78
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 79
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 80
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 81
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 82
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 83
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 84
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 85
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 86
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 87
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 88
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 89
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 90
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 91
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 92
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 93
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 94
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 95
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 96
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 97
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 98
|
||||
|
||||
GDK_AVAILABLE_IN_3_18 EQU 99
|
||||
|
||||
GDK_AVAILABLE_IN_3_10 EQU 100
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 101
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 102
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 103
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 104
|
||||
|
||||
; Set initial default size of the window (does not constrain user
|
||||
; resize operations)
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 105
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 106
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 107
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 108
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 109
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 110
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 111
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 112
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 113
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 114
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 115
|
||||
|
||||
; Ignore this unless you are writing a GUI builder
|
||||
GDK_DEPRECATED_IN_3_10 EQU 116
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 117
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 118
|
||||
|
||||
GDK_AVAILABLE_IN_ALL EQU 119
|
||||
|
||||
; Window grips
|
||||
|
||||
GDK_DEPRECATED_IN_3_14 EQU 120
|
||||
|
||||
GDK_DEPRECATED_IN_3_14 EQU 121
|
||||
|
||||
GDK_DEPRECATED_IN_3_14 EQU 122
|
||||
|
||||
GDK_DEPRECATED_IN_3_14 EQU 123
|
||||
|
||||
GDK_AVAILABLE_IN_3_10 EQU 124
|
||||
|
||||
GDK_AVAILABLE_IN_3_16 EQU 125
|
||||
|
||||
GDK_AVAILABLE_IN_3_12 EQU 126
|
||||
|
||||
GDK_AVAILABLE_IN_3_14 EQU 127
|
||||
|
||||
G_END_DECLS EQU 128
|
||||
|
||||
%endif ; __GTK_WINDOW_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
502
gtkwindow.tokenized
Normal file
502
gtkwindow.tokenized
Normal file
@@ -0,0 +1,502 @@
|
||||
TOKEN_CSTART /* GTK - The GIMP Toolkit
|
||||
TOKEN_CMID * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
TOKEN_CMID *
|
||||
TOKEN_CMID * This library is free software; you can redistribute it and/or
|
||||
TOKEN_CMID * modify it under the terms of the GNU Lesser General Public
|
||||
TOKEN_CMID * License as published by the Free Software Foundation; either
|
||||
TOKEN_CMID * version 2 of the License, or (at your option) any later version.
|
||||
TOKEN_CMID *
|
||||
TOKEN_CMID * This library is distributed in the hope that it will be useful,
|
||||
TOKEN_CMID * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
TOKEN_CMID * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
TOKEN_CMID * Lesser General Public License for more details.
|
||||
TOKEN_CMID *
|
||||
TOKEN_CMID * You should have received a copy of the GNU Lesser General Public
|
||||
TOKEN_CMID * License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
TOKEN_CEND */
|
||||
|
||||
TOKEN_CSTART /*
|
||||
TOKEN_CMID * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
TOKEN_CMID * file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
TOKEN_CMID * files for a list of changes. These files are distributed with
|
||||
TOKEN_CMID * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
TOKEN_CEND */
|
||||
|
||||
TOKEN_IFNDEF #ifndef TOKEN_MACRO __GTK_WINDOW_H__
|
||||
TOKEN_DEFINE #define TOKEN_MACRO __GTK_WINDOW_H__
|
||||
|
||||
|
||||
TOKEN_IF #if TOKEN_NOT_DEFINED !defined TOKEN_MACRO (__GTK_H_INSIDE__) && TOKEN_NOT_DEFINED !defined TOKEN_MACRO (GTK_COMPILATION)
|
||||
TOKEN_ERROR #error "Only <gtk/gtk.h> can be included directly."
|
||||
TOKEN_ENDIF #endif
|
||||
|
||||
TOKEN_INCLUDE #include <gtk/gtkapplication.h>
|
||||
TOKEN_INCLUDE #include <gtk/gtkaccelgroup.h>
|
||||
TOKEN_INCLUDE #include <gtk/gtkbin.h>
|
||||
|
||||
TOKEN_MACRO G_BEGIN_DECLS
|
||||
|
||||
TOKEN_DEFINE #define TOKEN_MACRO GTK_TYPE_WINDOW TOKEN_FUNCTION (gtk_window_get_type ())
|
||||
TOKEN_DEFINE #define GTK_WINDOW(obj) TOKEN_MACRO (G_TYPE_CHECK_INSTANCE_CAST TOKEN_FUNCTION ((obj), TOKEN_MACRO GTK_TYPE_WINDOW, GtkWindow))
|
||||
TOKEN_DEFINE #define GTK_WINDOW_CLASS(klass) TOKEN_MACRO (G_TYPE_CHECK_CLASS_CAST TOKEN_FUNCTION ((klass), TOKEN_MACRO GTK_TYPE_WINDOW, GtkWindowClass))
|
||||
TOKEN_DEFINE #define GTK_IS_WINDOW(obj) TOKEN_MACRO (G_TYPE_CHECK_INSTANCE_TYPE TOKEN_FUNCTION ((obj), TOKEN_MACRO GTK_TYPE_WINDOW))
|
||||
TOKEN_DEFINE #define GTK_IS_WINDOW_CLASS(klass) TOKEN_MACRO (G_TYPE_CHECK_CLASS_TYPE TOKEN_FUNCTION ((klass), TOKEN_MACRO GTK_TYPE_WINDOW))
|
||||
TOKEN_DEFINE #define GTK_WINDOW_GET_CLASS(obj) TOKEN_MACRO (G_TYPE_INSTANCE_GET_CLASS TOKEN_FUNCTION ((obj), TOKEN_MACRO GTK_TYPE_WINDOW, GtkWindowClass))
|
||||
|
||||
TOKEN_TYPEDEF_STRUCT typedef struct _GtkWindowPrivate GtkWindowPrivate;
|
||||
TOKEN_TYPEDEF_STRUCT typedef struct _GtkWindowClass GtkWindowClass;
|
||||
TOKEN_TYPEDEF_STRUCT typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo;
|
||||
TOKEN_TYPEDEF_STRUCT typedef struct _GtkWindowGroup GtkWindowGroup;
|
||||
TOKEN_TYPEDEF_STRUCT typedef struct _GtkWindowGroupClass GtkWindowGroupClass;
|
||||
TOKEN_TYPEDEF_STRUCT typedef struct _GtkWindowGroupPrivate GtkWindowGroupPrivate;
|
||||
|
||||
TOKEN_STRUCT struct _GtkWindow
|
||||
{
|
||||
GtkBin TOKEN_FUNCTION bin;
|
||||
|
||||
GtkWindowPrivate TOKEN_FUNCTION *priv;
|
||||
TOKEN_ENDBRACE };
|
||||
|
||||
TOKEN_CSTART /**
|
||||
TOKEN_CMID * GtkWindowClass:
|
||||
TOKEN_CMID * @parent_class: The parent class.
|
||||
TOKEN_CMID * @set_focus: Sets child as the focus widget for the window.
|
||||
TOKEN_CMID * @activate_focus: Activates the current focused widget within the window.
|
||||
TOKEN_CMID * @activate_default: Activates the default widget for the window.
|
||||
TOKEN_CMID * @keys_changed: Signal gets emitted when the set of accelerators or
|
||||
TOKEN_CMID * mnemonics that are associated with window changes.
|
||||
TOKEN_CMID * @enable_debugging: Class handler for the #GtkWindow::enable-debugging
|
||||
TOKEN_CMID * keybinding signal. Since: 3.14
|
||||
TOKEN_CEND */
|
||||
TOKEN_STRUCT struct TOKEN_MEMBER _GtkWindowClass
|
||||
{
|
||||
GtkBinClass TOKEN_FUNCTION parent_class;
|
||||
|
||||
TOKEN_CSTART /*< public TOKEN_CEND >*/
|
||||
|
||||
TOKEN_VOID void TOKEN_FUNCTION_POINTER (* TOKEN_FUNCTION set_focus) (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkWidget TOKEN_FUNCTION *focus);
|
||||
|
||||
TOKEN_CSTART /* G_SIGNAL_ACTION signals for keybindings TOKEN_CEND */
|
||||
|
||||
TOKEN_VOID void TOKEN_FUNCTION_POINTER (* TOKEN_FUNCTION activate_focus) (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_VOID void TOKEN_FUNCTION_POINTER (* TOKEN_FUNCTION activate_default) (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_VOID void TOKEN_FUNCTION_POINTER (* TOKEN_FUNCTION keys_changed) (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION_POINTER (* TOKEN_FUNCTION enable_debugging) (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION toggle);
|
||||
|
||||
TOKEN_CSTART /*< private TOKEN_CEND >*/
|
||||
|
||||
TOKEN_CSTART /* Padding for future expansion TOKEN_CEND */
|
||||
TOKEN_VOID void TOKEN_FUNCTION_POINTER (*_gtk_reserved1) TOKEN_FUNCTION (void);
|
||||
TOKEN_VOID void TOKEN_FUNCTION_POINTER (*_gtk_reserved2) TOKEN_FUNCTION (void);
|
||||
TOKEN_VOID void TOKEN_FUNCTION_POINTER (*_gtk_reserved3) TOKEN_FUNCTION (void);
|
||||
TOKEN_ENDBRACE };
|
||||
|
||||
TOKEN_CSTART /**
|
||||
TOKEN_CMID * GtkWindowType:
|
||||
TOKEN_CMID * @GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog.
|
||||
TOKEN_CMID * @GTK_WINDOW_POPUP: A special window such as a tooltip.
|
||||
TOKEN_CMID *
|
||||
TOKEN_CMID * A #GtkWindow can be one of these types. Most things you’d consider a
|
||||
TOKEN_CMID * “window” should have type #GTK_WINDOW_TOPLEVEL; windows with this type
|
||||
TOKEN_CMID * are managed by the window manager and have a frame by default (call
|
||||
TOKEN_CMID * gtk_window_set_decorated() to toggle the frame). Windows with type
|
||||
TOKEN_CMID * #GTK_WINDOW_POPUP are ignored by the window manager; window manager
|
||||
TOKEN_CMID * keybindings won’t work on them, the window manager won’t decorate the
|
||||
TOKEN_CMID * window with a frame, many GTK+ features that rely on the window
|
||||
TOKEN_CMID * manager will not work (e.g. resize grips and
|
||||
TOKEN_CMID * maximization/minimization). #GTK_WINDOW_POPUP is used to implement
|
||||
TOKEN_CMID * widgets such as #GtkMenu or tooltips that you normally don’t think of
|
||||
TOKEN_CMID * as windows per se. Nearly all windows should be #GTK_WINDOW_TOPLEVEL.
|
||||
TOKEN_CMID * In particular, do not use #GTK_WINDOW_POPUP just to turn off
|
||||
TOKEN_CMID * the window borders; use gtk_window_set_decorated() for that.
|
||||
TOKEN_CEND */
|
||||
TOKEN_TYPEDEF_ENUM typedef enum
|
||||
{
|
||||
TOKEN_MACRO GTK_WINDOW_TOPLEVEL,
|
||||
TOKEN_MACRO GTK_WINDOW_POPUP
|
||||
TOKEN_RBRACE } GtkWindowType;
|
||||
|
||||
TOKEN_CSTART /**
|
||||
TOKEN_CMID * GtkWindowPosition:
|
||||
TOKEN_CMID * @GTK_WIN_POS_NONE: No influence is made on placement.
|
||||
TOKEN_CMID * @GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen.
|
||||
TOKEN_CMID * @GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position.
|
||||
TOKEN_CMID * @GTK_WIN_POS_CENTER_ALWAYS: Keep window centered as it changes size, etc.
|
||||
TOKEN_CMID * @GTK_WIN_POS_CENTER_ON_PARENT: Center the window on its transient
|
||||
TOKEN_CMID * parent (see gtk_window_set_transient_for()).
|
||||
TOKEN_CMID *
|
||||
TOKEN_CMID * Window placement can be influenced using this enumeration. Note that
|
||||
TOKEN_CMID * using #GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea.
|
||||
TOKEN_CMID * It won’t necessarily work well with all window managers or on all windowing systems.
|
||||
TOKEN_CEND */
|
||||
TOKEN_TYPEDEF_ENUM typedef enum
|
||||
{
|
||||
TOKEN_MACRO GTK_WIN_POS_NONE,
|
||||
TOKEN_MACRO GTK_WIN_POS_CENTER,
|
||||
TOKEN_MACRO GTK_WIN_POS_MOUSE,
|
||||
TOKEN_MACRO GTK_WIN_POS_CENTER_ALWAYS,
|
||||
TOKEN_MACRO GTK_WIN_POS_CENTER_ON_PARENT
|
||||
TOKEN_RBRACE } GtkWindowPosition;
|
||||
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GType TOKEN_FUNCTION gtk_window_get_type TOKEN_FUNCTION (void) TOKEN_MACRO G_GNUC_CONST;
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* TOKEN_FUNCTION gtk_window_new (GtkWindowType TOKEN_FUNCTION type);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_title (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_FUNCTION *title);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_MULT * TOKEN_FUNCTION gtk_window_get_title (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_wmclass (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_FUNCTION *wmclass_name,
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_FUNCTION *wmclass_class);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_role (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_FUNCTION *role);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_startup_id (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_FUNCTION *startup_id);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_MULT * TOKEN_FUNCTION gtk_window_get_role (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_add_accel_group (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkAccelGroup TOKEN_FUNCTION *accel_group);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_remove_accel_group (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkAccelGroup TOKEN_FUNCTION *accel_group);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_position (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkWindowPosition TOKEN_FUNCTION position);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_activate_focus (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_focus (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkWidget TOKEN_FUNCTION *focus);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget TOKEN_FUNCTION *gtk_window_get_focus (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_default (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkWidget TOKEN_FUNCTION *default_widget);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget TOKEN_FUNCTION *gtk_window_get_default_widget (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_activate_default (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_transient_for (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkWindow TOKEN_FUNCTION *parent);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GtkWindow TOKEN_FUNCTION *gtk_window_get_transient_for (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_4
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_attached_to (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkWidget TOKEN_FUNCTION *attach_widget);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_4
|
||||
GtkWidget TOKEN_FUNCTION *gtk_window_get_attached_to (GtkWindow TOKEN_FUNCTION *window);
|
||||
GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_set_opacity)
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_opacity (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gdouble TOKEN_FUNCTION opacity);
|
||||
GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_get_opacity)
|
||||
TOKEN_FUNCTION gdouble TOKEN_FUNCTION gtk_window_get_opacity (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_type_hint (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkWindowTypeHint TOKEN_FUNCTION hint);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GdkWindowTypeHint TOKEN_FUNCTION gtk_window_get_type_hint (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_skip_taskbar_hint (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_skip_taskbar_hint (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_skip_pager_hint (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_skip_pager_hint (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_urgency_hint (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_urgency_hint (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_accept_focus (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_accept_focus (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_focus_on_map (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_focus_on_map (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_destroy_with_parent (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_destroy_with_parent (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_4
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_hide_titlebar_when_maximized (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_4
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_hide_titlebar_when_maximized (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_mnemonics_visible (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_mnemonics_visible (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_2
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_focus_visible (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_2
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_focus_visible (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_resizable (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION resizable);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_resizable (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_gravity (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkGravity TOKEN_FUNCTION gravity);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GdkGravity TOKEN_FUNCTION gtk_window_get_gravity (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_geometry_hints (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkWidget TOKEN_FUNCTION *geometry_widget,
|
||||
GdkGeometry TOKEN_FUNCTION *geometry,
|
||||
GdkWindowHints TOKEN_FUNCTION geom_mask);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_screen (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkScreen TOKEN_FUNCTION *screen);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GdkScreen* TOKEN_FUNCTION gtk_window_get_screen (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_is_active (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_has_toplevel_focus (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_decorated (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_decorated (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_deletable (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_deletable (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_icon_list (GtkWindow TOKEN_FUNCTION *window,
|
||||
GList TOKEN_FUNCTION *list);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GList* TOKEN_FUNCTION gtk_window_get_icon_list (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_icon (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkPixbuf TOKEN_FUNCTION *icon);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_icon_name (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_FUNCTION *name);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_set_icon_from_file (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_FUNCTION *filename,
|
||||
GError TOKEN_FUNCTION **err);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GdkPixbuf* TOKEN_FUNCTION gtk_window_get_icon (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_MULT * TOKEN_FUNCTION gtk_window_get_icon_name (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_default_icon_list (GList TOKEN_FUNCTION *list);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GList* TOKEN_FUNCTION gtk_window_get_default_icon_list TOKEN_FUNCTION (void);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_default_icon (GdkPixbuf TOKEN_FUNCTION *icon);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_default_icon_name TOKEN_FUNCTION (const TOKEN_FUNCTION gchar TOKEN_FUNCTION *name);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_MULT * TOKEN_FUNCTION gtk_window_get_default_icon_name TOKEN_FUNCTION (void);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_set_default_icon_from_file TOKEN_FUNCTION (const TOKEN_FUNCTION gchar TOKEN_FUNCTION *filename,
|
||||
GError TOKEN_FUNCTION **err);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_auto_startup_notification TOKEN_FUNCTION (gboolean TOKEN_FUNCTION setting);
|
||||
|
||||
TOKEN_CSTART /* If window is set modal, input will be grabbed when show and released when hide TOKEN_CEND */
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_modal (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION modal);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_modal (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GList* TOKEN_FUNCTION gtk_window_list_toplevels TOKEN_FUNCTION (void);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_has_user_ref_count (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_add_mnemonic (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION guint TOKEN_FUNCTION keyval,
|
||||
GtkWidget TOKEN_FUNCTION *target);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_remove_mnemonic (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION guint TOKEN_FUNCTION keyval,
|
||||
GtkWidget TOKEN_FUNCTION *target);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_mnemonic_activate (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION guint TOKEN_FUNCTION keyval,
|
||||
GdkModifierType TOKEN_FUNCTION modifier);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_mnemonic_modifier (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkModifierType TOKEN_FUNCTION modifier);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GdkModifierType TOKEN_FUNCTION gtk_window_get_mnemonic_modifier (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_activate_key (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkEventKey TOKEN_FUNCTION *event);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_propagate_key_event (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkEventKey TOKEN_FUNCTION *event);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_present (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_present_with_time (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION guint32 TOKEN_FUNCTION timestamp);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_iconify (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_deiconify (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_stick (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_unstick (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_maximize (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_unmaximize (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_fullscreen (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_unfullscreen (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_18
|
||||
TOKEN_VOID void gtk_window_fullscreen_on_monitor(GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkScreen TOKEN_FUNCTION *screen,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION monitor);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_10
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_close (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_keep_above (GtkWindow TOKEN_FUNCTION *window, TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_keep_below (GtkWindow TOKEN_FUNCTION *window, TOKEN_FUNCTION gboolean TOKEN_FUNCTION setting);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_begin_resize_drag (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkWindowEdge TOKEN_FUNCTION edge,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION button,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION root_x,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION root_y,
|
||||
TOKEN_FUNCTION guint32 TOKEN_FUNCTION timestamp);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_begin_move_drag (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION button,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION root_x,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION root_y,
|
||||
TOKEN_FUNCTION guint32 TOKEN_FUNCTION timestamp);
|
||||
|
||||
TOKEN_CSTART /* Set initial default size of the window (does not constrain user
|
||||
TOKEN_CMID * resize operations)
|
||||
TOKEN_CEND */
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_default_size (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION width,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION height);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_get_default_size (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION *width,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION *height);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_resize (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION width,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION height);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_get_size (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION *width,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION *height);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_move (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION x,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION y);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_get_position (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION *root_x,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION *root_y);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_parse_geometry (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_CONST const TOKEN_FUNCTION gchar TOKEN_FUNCTION *geometry);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_default_geometry (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION width,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION height);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_resize_to_geometry (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION width,
|
||||
TOKEN_FUNCTION gint TOKEN_FUNCTION height);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GtkWindowGroup TOKEN_FUNCTION *gtk_window_get_group (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_has_group (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_CSTART /* Ignore this unless you are writing a GUI builder TOKEN_CEND */
|
||||
TOKEN_MACRO GDK_DEPRECATED_IN_3_10
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_reshow_with_initial_size (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GtkWindowType TOKEN_FUNCTION gtk_window_get_window_type (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
GtkApplication TOKEN_FUNCTION *gtk_window_get_application (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_ALL
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_application (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkApplication TOKEN_FUNCTION *application);
|
||||
|
||||
|
||||
TOKEN_CSTART /* Window grips
|
||||
TOKEN_CEND */
|
||||
TOKEN_MACRO GDK_DEPRECATED_IN_3_14
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_has_resize_grip (GtkWindow TOKEN_FUNCTION *window,
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION value);
|
||||
TOKEN_MACRO GDK_DEPRECATED_IN_3_14
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_has_resize_grip (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_DEPRECATED_IN_3_14
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_resize_grip_is_visible (GtkWindow TOKEN_FUNCTION *window);
|
||||
TOKEN_MACRO GDK_DEPRECATED_IN_3_14
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_get_resize_grip_area (GtkWindow TOKEN_FUNCTION *window,
|
||||
GdkRectangle TOKEN_FUNCTION *rect);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_10
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_titlebar (GtkWindow TOKEN_FUNCTION *window,
|
||||
GtkWidget TOKEN_FUNCTION *titlebar);
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_16
|
||||
GtkWidget TOKEN_FUNCTION *gtk_window_get_titlebar (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_12
|
||||
TOKEN_FUNCTION gboolean TOKEN_FUNCTION gtk_window_is_maximized (GtkWindow TOKEN_FUNCTION *window);
|
||||
|
||||
TOKEN_MACRO GDK_AVAILABLE_IN_3_14
|
||||
TOKEN_VOID void TOKEN_FUNCTION gtk_window_set_interactive_debugging TOKEN_FUNCTION (gboolean TOKEN_FUNCTION enable);
|
||||
|
||||
TOKEN_MACRO G_END_DECLS
|
||||
|
||||
TOKEN_ENDIF #endif TOKEN_CSTART /* __GTK_WINDOW_H__ TOKEN_CEND */
|
14
h2inc.py
14
h2inc.py
@@ -1,4 +1,6 @@
|
||||
"""Script for translating C-header files into nasm syntax include files"""
|
||||
'''
|
||||
Script for translating C-header files into nasm syntax include files
|
||||
'''
|
||||
import os
|
||||
import errno
|
||||
from parser import PARSER
|
||||
@@ -13,7 +15,9 @@ class H2INC:
|
||||
self.foldercnt = 0
|
||||
|
||||
def srcfilecnt(self, sourcedir):
|
||||
'''
|
||||
### Return the number of files, ending with '.h', in sourcedir - including subdirectories ###
|
||||
'''
|
||||
for folderName, subfolders, files in os.walk(self.sourcedir):
|
||||
for file in files:
|
||||
if file.lower().endswith('.h'):
|
||||
@@ -25,7 +29,9 @@ class H2INC:
|
||||
return False
|
||||
|
||||
def srcfoldercnt(self, src):
|
||||
'''
|
||||
### Return the number of folders, if it contains '*.h' files, in sourcedir - including subdirectories ###
|
||||
'''
|
||||
for folderName, subfolders, files in os.walk(src):
|
||||
if subfolders:
|
||||
for subfolder in subfolders:
|
||||
@@ -79,7 +85,7 @@ class H2INC:
|
||||
for lines in fh:
|
||||
self.tupfile.append(lines)
|
||||
fh.close()
|
||||
resultfile = parse.parseheader(self.tupfile)
|
||||
resultfile = parse.parseheader(self.tupfile, inputfile)
|
||||
print(resultfile)
|
||||
for l in resultfile:
|
||||
for w in l:
|
||||
@@ -87,8 +93,8 @@ class H2INC:
|
||||
outfile += "\n"
|
||||
outputfile = os.path.splitext(inputfile)[0]+'.inc'
|
||||
outputfile = str(outputfile).replace(self.sourcedir, self.destdir)
|
||||
print(outputfile)
|
||||
print(os.path.dirname(outputfile))
|
||||
#print(outputfile)
|
||||
#print(os.path.dirname(outputfile))
|
||||
self.write_file(outputfile,outfile)
|
||||
|
||||
def write_file(self, fn, data):
|
||||
|
BIN
lexers/comment_lexer.obj
Normal file
BIN
lexers/comment_lexer.obj
Normal file
Binary file not shown.
BIN
lexers/define_lexer.obj
Normal file
BIN
lexers/define_lexer.obj
Normal file
Binary file not shown.
123
lineanalyzer.py
Normal file
123
lineanalyzer.py
Normal file
@@ -0,0 +1,123 @@
|
||||
'''
|
||||
Contains class LINEANALYSER
|
||||
'''
|
||||
from contextlib import ContextDecorator
|
||||
from itertools import count
|
||||
|
||||
PREPROCESSOR_DIRECTIVES = ['#include','#define','#undef','#if','#ifdef','#ifndef','#error','#endif']
|
||||
|
||||
class ANALYZEOBJECT:
|
||||
_passes = count(0)
|
||||
_analyzed = []
|
||||
|
||||
def __init__(self):
|
||||
self.passes = 0
|
||||
self.analyzeline = []
|
||||
self.analyzed = []
|
||||
self.comment = False
|
||||
self.typedef = False
|
||||
self.members = False
|
||||
self.ts = ''
|
||||
|
||||
def analyze(self,l):
|
||||
if l == '' or l == '\n':
|
||||
return l
|
||||
if self.typedef == True:
|
||||
rv = self.analyze_typedef(l)
|
||||
if rv != False:
|
||||
return rv
|
||||
rv = self.analyze_comment(l)
|
||||
if rv != False:
|
||||
return rv
|
||||
rv = self.analyze_preproc(l)
|
||||
if rv != False:
|
||||
return rv
|
||||
rv = self.analyze_typedef(l)
|
||||
if rv != False:
|
||||
return rv
|
||||
return l
|
||||
|
||||
def analyze_comment(self,l):
|
||||
s = l.split()
|
||||
w = [w for w in s]
|
||||
if w[0] == '/*' or w[0] == '/**':
|
||||
self.comment = True
|
||||
if w[-1] == '*/' or w[-1] == '**/':
|
||||
self.comment = False
|
||||
return l
|
||||
if w[0] == '*/' or w[0] == '**/':
|
||||
self.comment = False
|
||||
return l
|
||||
if self.comment == True:
|
||||
if w[0] == '*':
|
||||
return l
|
||||
return False
|
||||
|
||||
def analyze_preproc(self,l):
|
||||
s = l.split()
|
||||
w = [w for w in s]
|
||||
if w[0] in PREPROCESSOR_DIRECTIVES:
|
||||
return l
|
||||
return False
|
||||
|
||||
def analyze_typedef(self,l):
|
||||
if self.typedef == False:
|
||||
self.ts = ''
|
||||
self.ts += l
|
||||
s = l.split()
|
||||
w = [w for w in s]
|
||||
if w[0] == 'typedef':
|
||||
if w[1] == 'struct':
|
||||
if w[-1].endswith(';'):
|
||||
self.typedef = False
|
||||
return self.ts
|
||||
else:
|
||||
self.typedef = True
|
||||
return 'next'
|
||||
if w[1] == 'enum':
|
||||
if w[-1].endswith(';'):
|
||||
self.typedef = False
|
||||
return self.ts
|
||||
else:
|
||||
self.typedef = True
|
||||
return 'next'
|
||||
if self.typedef == True:
|
||||
if w[0].startswith('{'):
|
||||
return self.ts
|
||||
if w[0].startswith('}'):
|
||||
self.typedef = False
|
||||
return self.ts
|
||||
return False
|
||||
|
||||
def analyze_struct(self,l):
|
||||
ts = ''
|
||||
ts += l
|
||||
s = l.split()
|
||||
w = [w for w in s]
|
||||
if w[0] == 'struct':
|
||||
if w[-1].endswith(';'):
|
||||
self.struct = False
|
||||
return ts
|
||||
else:
|
||||
self.struct = True
|
||||
return 'next'
|
||||
if self.struct == True:
|
||||
if w[0] == '{':
|
||||
if w[-1].endswith(';'):
|
||||
self.members = False
|
||||
return ts
|
||||
else:
|
||||
self.members = True
|
||||
return 'next'
|
||||
return False
|
||||
|
||||
class ANALYZER(ANALYZEOBJECT):
|
||||
_ids = count(0)
|
||||
_passes = count(0)
|
||||
|
||||
def __init__(self):
|
||||
ANALYZEOBJECT.__init__(self)
|
||||
self.id = next(self._ids)
|
||||
self.tupline = []
|
||||
self.tupfile = []
|
||||
self.passes = next(self._passes)
|
8
metaclasses.py
Normal file
8
metaclasses.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import itertools
|
||||
|
||||
class InstanceCounterMeta(type):
|
||||
""" Metaclass to make instance counter not share count with descendants
|
||||
"""
|
||||
def __init__(cls, name, bases, attrs):
|
||||
super().__init__(name, bases, attrs)
|
||||
cls._ids = itertools.count(1)
|
371
parser.py
371
parser.py
@@ -1,15 +1,24 @@
|
||||
"""Contains class PARSER"""
|
||||
'''
|
||||
Contains class PARSER
|
||||
'''
|
||||
from itertools import count
|
||||
import os
|
||||
from tokenizer import TOKENIZER
|
||||
from lineanalyzer import ANALYZER
|
||||
|
||||
#Element type definitions. Used in the parse process.
|
||||
ELEMENT_TYPE_PREPROCESS = 1
|
||||
ELEMENT_TYPE_REGULAR = 2
|
||||
|
||||
TOKENS = ['TOKEN_CSTART','TOKEN_CMID','TOKEN_CEND','TOKEN_RPAREN',
|
||||
'TOKEN_LPAREN','TOKEN_ENDLINE','TOKEN_RETVAL','TOKEN_PREPROCESS',
|
||||
'TOKEN_ID','TOKEN_PLUS','TOKEN_MINUS','TOKEN_DIV','TOKEN_MULT',
|
||||
'TOKEN_LPAREN','TOKEN_ENDLINE','TOKEN_RETVAL','TOKEN_TYPEDEF',
|
||||
'TOKEN_IF','TOKEN_PLUS','TOKEN_MINUS','TOKEN_DIV','TOKEN_MULT',
|
||||
'TOKEN_ASSIGN','TOKEN_EQUAL','TOKEN_LBRACE','TOKEN_RBRACE',
|
||||
'TOKEN_COMMA','TOKEN_SEMICOLON','TOKEN_LANGLE','TOKEN_RANGLE','TOKEN_POINTER']
|
||||
'TOKEN_COMMA','TOKEN_SEMICOLON','TOKEN_LANGLE','TOKEN_RANGLE',
|
||||
'TOKEN_POINTER', 'TOKEN_STRUCT','TOKEN_ENUM','TOKEN_MACRO',
|
||||
'TOKEN_FUNCTION','TOKEN_TYPEDEF_ENUM','TOKEN_TYPEDEF_STRUCT',
|
||||
'TOKEN_TYPEDEF_STRUCT_STRUCT','TOKEN_TAG_NAME','TOKEN_ALIAS',
|
||||
'TOKEN_ENUM']
|
||||
|
||||
RESERVED = {'auto' : 'AUTO','break' : 'BREAK','case' : 'CASE','char' : 'CHAR',
|
||||
'const' : 'CONST','continue' : 'CONTINUE','default' : 'DEFAULT','do' : 'DO',
|
||||
@@ -20,16 +29,24 @@ RESERVED = {'auto' : 'AUTO','break' : 'BREAK','case' : 'CASE','char' : 'CHAR',
|
||||
'double' : 'DOUBLE','else' : 'ELSE','enum' : 'ENUM','extern' : 'EXTERN',
|
||||
'float' : 'FLOAT','for' : 'FOR','goto' : 'GOTO','if' : 'IF'}
|
||||
|
||||
PREPROCESSOR_DIRECTIVES = {'#include' : 'TOKEN_PREPROCESS','#define' : 'TOKEN_PREPROCESS','#undef' : 'TOKEN_PREPROCESS',
|
||||
'#if' : 'TOKEN_PREPROCESS','#ifdef' : 'TOKEN_PREPROCESS','#ifndef' : 'TOKEN_PREPROCESS','#error' : 'TOKEN_PREPROCESS',
|
||||
'__FILE__' : 'TOKEN_PREPROCESS','__LINE__' : 'TOKEN_PREPROCESS','__DATE__' : 'TOKEN_PREPROCESS',
|
||||
'__TIME__' : 'TOKEN_PREPROCESS','__TIMESTAMP__' : 'TOKEN_PREPROCESS','pragma' : 'TOKEN_PREPROCESS',
|
||||
'#' : 'TOKEN_PREPROCESS','##' : 'TOKEN_PREPROCESS','#endif' : 'TOKEN_PREPROCESS'}
|
||||
PREPROCESSOR_DIRECTIVES = {'#include' : 'TOKEN_INCLUDE','#define' : 'TOKEN_DEFINE','#undef' : 'TOKEN_UNDEFINE',
|
||||
'#if' : 'TOKEN_IF','#ifdef' : 'TOKEN_IFDEF','#ifndef' : 'TOKEN_IFNDEF','#error' : 'TOKEN_ERROR',
|
||||
'__FILE__' : 'TOKEN_BASE_FILE','__LINE__' : 'TOKEN_BASE_LINE','__DATE__' : 'TOKEN_BASE_DATE',
|
||||
'__TIME__' : 'TOKEN_BASE_TIME','__TIMESTAMP__' : 'TOKEN_BASE_TIMESTAMP','pragma' : 'TOKEN_PRAGMA',
|
||||
'#' : 'TOKEN_HASH','##' : 'TOKEN_DOUBLEHASH','#endif' : 'TOKEN_ENDIF'}
|
||||
|
||||
REGULAR = {'/*' : 'TOKEN_CSTART','*/' : 'TOKEN_CEND', '*' : 'TOKEN_CMID', '=' : 'TOKEN_ASSIGN','==' : 'TOKEN_EQUAL',
|
||||
'{' : 'TOKEN_LBRACE','}' : 'TOKEN_RBRACE','\+' : 'TOKEN_PLUS','-' : 'TOKEN_MINUS',
|
||||
'\*' : 'TOKEN_MULT','/' : 'TOKEN_DIV','\(' : 'TOKEN_LPAREN','\)' : 'TOKEN_RPAREN',
|
||||
',' : 'TOKEN_COMMA',';' : 'TOKEN_SEMICOLON','\<' : 'TOKEN_LANGLE','\>' : 'TOKEN_RANGLE'}
|
||||
REGULAR = {'/*' : 'TOKEN_CSTART','/**' : 'TOKEN_CSTART','*/' : 'TOKEN_CEND', '*' : 'TOKEN_CMID', '=' : 'TOKEN_ASSIGN',
|
||||
'==' : 'TOKEN_EQUAL','{' : 'TOKEN_LBRACE','}' : 'TOKEN_RBRACE','};' : 'TOKEN_ENDBRACE','+' : 'TOKEN_PLUS','-' : 'TOKEN_MINUS',
|
||||
'*' : 'TOKEN_MULT','/' : 'TOKEN_DIV','(' : 'TOKEN_LPAREN',')' : 'TOKEN_RPAREN',',' : 'TOKEN_COMMA',
|
||||
';' : 'TOKEN_SEMICOLON','<' : 'TOKEN_LANGLE','>' : 'TOKEN_RANGLE','TYPEDEF' : 'TOKEN_TYPEDEF',
|
||||
'typedef' : 'TOKEN_TYPEDEF','enum' : 'TOKEN_ENUM','ENUM' : 'TOKEN_ENUM','struct' : 'TOKEN_STRUCT',
|
||||
'STRUCT' : 'TOKEN_STRUCT','char' : 'TOKEN_CHAR','CHAR' : 'TOKEN_CHAR','const' : 'TOKEN_CONST',
|
||||
'CONST' : 'TOKEN_CONST','int' : 'TOKEN_INT','INT' : 'TOKEN_INT','long' : 'TOKEN_LONG','LONG' : 'TOKEN_LONG',
|
||||
'short' : 'TOKEN_SHORT','SHORT' : 'TOKEN_SHORT','signed' : 'TOKEN_SIGNED','SIGNED' : 'TOKEN_SIGNED',
|
||||
'unsigned' : 'TOKEN_UNSIGNED','UNSIGNED' : 'TOKEN_UNSIGNED','void' : 'TOKEN_VOID','VOID' : 'TOKEN_VOID',
|
||||
'volatile' : 'TOKEN_VOLATILE','VOLATILE' : 'TOKEN_VOLATILE','double' : 'TOKEN_DOUBLE','DOUBLE' : 'TOKEN_DOUBLE',
|
||||
'float' : 'TOKEN_FLOAT','FLOAT' : 'TOKEN_FLOAT', '!defined' : 'TOKEN_NOT_DEFINED', '!DEFINED' : 'TOKEN_NOT_DEFINED',
|
||||
'boolean' : 'TOKEN_BOOLEAN', 'BOOLEAN' : 'TOKEN_BOOLEAN', '(*' : 'TOKEN_FUNCTION_POINTER'}
|
||||
|
||||
NASM_PREPROCESS_DIRECTIVES = {'#include' : '%include','#define' : '%define','#undef' : '%undef',
|
||||
'#if' : '%if','#ifdef' : '%ifdef','#ifndef' : '%ifndef','#endif' : '%endif',
|
||||
@@ -41,15 +58,35 @@ NASM_ENUM = "EQU"
|
||||
|
||||
NASM_REGULAR = {'/*' : ';', '*' : ';', '*/' : ''}
|
||||
|
||||
TOKENS += RESERVED.values()
|
||||
#REGULAR += RESERVED.values()
|
||||
|
||||
PARSER_TOKENS = ['PARSE_MULTILINE_COMMENT', 'PARSE_SINGLELINE_COMMENT', 'PARSE_TYPEDEF_ENUM', 'PARSE_TYPEDEF_STRUCT',
|
||||
'PARSE_TYPEDEF_STRUCT_STRUCT', 'PARSE_STRUCT', 'PARSE_TAG_NAME', 'PARSE_STRUCT_MEMBER', 'PARSE_ENDSTRUCT',
|
||||
'PARSE_ALIAS', 'PARSE_FUNCTION_POINTER', 'PARSE_FUNCTION', 'PARSE_IFNDEF']
|
||||
|
||||
COMMENT_SINGLE_LINE = 0
|
||||
COMMENT_MULTI_LINE = 1
|
||||
|
||||
inside_member = False
|
||||
inside_braces = False
|
||||
inside_typedef_struct_struct = False
|
||||
inside_typedef_struct = False
|
||||
inside_typedef_enum = False
|
||||
inside_typedef = False
|
||||
inside_struct = False
|
||||
inside_include = False
|
||||
inside_string = False
|
||||
inside_comment = False
|
||||
inside_if = False
|
||||
inside_ifndef = False
|
||||
substitute = False
|
||||
|
||||
class PARSEOBJECT:
|
||||
_passes = count(0)
|
||||
_lineanalyzer = ANALYZER()
|
||||
|
||||
def __init__(self):
|
||||
self.tokenize = TOKENIZER()
|
||||
self.parseline = []
|
||||
self.parsefile = []
|
||||
self.passes = 0
|
||||
@@ -61,17 +98,58 @@ class PARSEOBJECT:
|
||||
self.inside_comment = False
|
||||
self.inside_typedef = False
|
||||
self.typedef_enum = False
|
||||
self.typedef_struct = False
|
||||
self.struct_begin = False
|
||||
self.enum_begin = False
|
||||
self.struct = False
|
||||
self.struct_end = False
|
||||
|
||||
def inc_passes(self):
|
||||
self.passes = next(self._passes)
|
||||
|
||||
def parseheader(self, fl):
|
||||
def parseheader(self, fl, fn):
|
||||
tempfile = []
|
||||
tempfile1 = []
|
||||
templine = []
|
||||
outfile = ''
|
||||
rr = 'next'
|
||||
count = 0
|
||||
self.parse_reset()
|
||||
for l in fl:
|
||||
analyzed_line = self.analyzer(l)
|
||||
i = iter(fl)
|
||||
while i:
|
||||
try:
|
||||
rr = self._lineanalyzer.analyze(next(i))
|
||||
except StopIteration:
|
||||
i = False
|
||||
continue
|
||||
if rr == 'next':
|
||||
count += 1
|
||||
else:
|
||||
templine.append(rr)
|
||||
tempfile.append(templine)
|
||||
count += 1
|
||||
templine = []
|
||||
self.inc_passes()
|
||||
for l in tempfile:
|
||||
analyzed_line = self.token_analyzer(l)
|
||||
tempfile1.append(analyzed_line)
|
||||
for l in tempfile1:
|
||||
for w in l:
|
||||
outfile += w+" "
|
||||
outfile += "\n"
|
||||
outputfile = os.path.splitext(fn)[0]+'.tokenized'
|
||||
self.write_file(outputfile,outfile)
|
||||
self.inc_passes()
|
||||
tempfile = []
|
||||
for l in tempfile1:
|
||||
analyzed_line = self.parser_analyzer(l)
|
||||
tempfile.append(analyzed_line)
|
||||
for l in tempfile:
|
||||
for w in l:
|
||||
outfile += w+" "
|
||||
outfile += "\n"
|
||||
outputfile = os.path.splitext(fn)[0]+'.parsenized'
|
||||
self.write_file(outputfile,outfile)
|
||||
self.inc_passes()
|
||||
self.parsefile = self.parsetokens(tempfile)
|
||||
return self.parsefile
|
||||
@@ -87,6 +165,10 @@ class PARSEOBJECT:
|
||||
return tempstr
|
||||
|
||||
def tokenizer(self, w):
|
||||
global inside_comment
|
||||
global inside_string
|
||||
global inside_include
|
||||
global inside_struct
|
||||
token = ""
|
||||
if w in PREPROCESSOR_DIRECTIVES:
|
||||
token = PREPROCESSOR_DIRECTIVES.get(w)
|
||||
@@ -94,21 +176,187 @@ class PARSEOBJECT:
|
||||
if w in REGULAR:
|
||||
token = REGULAR.get(w)
|
||||
return token
|
||||
if w.startswith('/*'):
|
||||
inside_comment = True
|
||||
token = 'TOKEN_CSTART'
|
||||
return token
|
||||
if inside_comment == True:
|
||||
if w.endswith('*/'):
|
||||
inside_comment = False
|
||||
token = 'TOKEN_CEND'
|
||||
return token
|
||||
if w.startswith('"'):
|
||||
inside_string = True
|
||||
return False
|
||||
if w.endswith('"'):
|
||||
inside_string = False
|
||||
return False
|
||||
if w.isupper():
|
||||
if inside_string == True:
|
||||
return False
|
||||
else:
|
||||
token = 'TOKEN_MACRO'
|
||||
return token
|
||||
if w.islower():
|
||||
if inside_string == True or inside_include == True or inside_struct == True:
|
||||
return False
|
||||
else:
|
||||
if w.startswith('(*'):
|
||||
token = 'TOKEN_FUNCTION_POINTER'
|
||||
return token
|
||||
else:
|
||||
token = 'TOKEN_FUNCTION'
|
||||
return token
|
||||
return False
|
||||
|
||||
def analyzer(self, ln):
|
||||
global inside_include
|
||||
global inside_typedef
|
||||
global inside_typedef_enum
|
||||
global inside_typedef_struct
|
||||
global inside_typedef_struct_struct
|
||||
global inside_braces
|
||||
global inside_struct
|
||||
global inside_member
|
||||
analysed = []
|
||||
word = [w for w in ln.split()]
|
||||
for w in word:
|
||||
t = self.tokenizer(w)
|
||||
if t == 'TOKEN_INCLUDE':
|
||||
inside_include = True
|
||||
if t == 'TOKEN_TYPEDEF':
|
||||
inside_typedef = True
|
||||
if t == 'TOKEN_ENUM' and inside_typedef == True:
|
||||
inside_typedef_enum = True
|
||||
inside_typedef = False
|
||||
analysed.pop(0)
|
||||
analysed.insert(0,'TOKEN_TYPEDEF_ENUM')
|
||||
analysed.append(w)
|
||||
continue
|
||||
if t == 'TOKEN_STRUCT':
|
||||
if inside_typedef == True:
|
||||
if ln.endswith(';\n'):
|
||||
inside_typedef_struct = True
|
||||
inside_typedef = False
|
||||
analysed.pop(0)
|
||||
analysed.insert(0,'TOKEN_TYPEDEF_STRUCT')
|
||||
analysed.append(w)
|
||||
continue
|
||||
else:
|
||||
inside_typedef_struct_struct = True
|
||||
inside_typedef_struct = False
|
||||
inside_typedef = False
|
||||
analysed.pop(0)
|
||||
analysed.insert(0,'TOKEN_TYPEDEF_STRUCT_STRUCT')
|
||||
analysed.append(w)
|
||||
inside_typedef_struct_struct = False #### THIS needs to be further refined!
|
||||
continue
|
||||
else:
|
||||
inside_struct = True
|
||||
analysed.append(t)
|
||||
analysed.append(w)
|
||||
continue
|
||||
if t == 'TOKEN_LBRACE':
|
||||
inside_braces = True
|
||||
analysed.append(w)
|
||||
continue
|
||||
if t == 'TOKEN_RBRACE' and inside_struct == True:
|
||||
inside_braces = False
|
||||
inside_struct = False
|
||||
analysed.append(t)
|
||||
analysed.append(w)
|
||||
continue
|
||||
if inside_braces == True and inside_struct == True:
|
||||
if inside_member == True:
|
||||
inside_member = False
|
||||
analysed.append(w)
|
||||
continue
|
||||
else:
|
||||
t = 'TOKEN_MEMBER'
|
||||
inside_member = True
|
||||
analysed.append(t)
|
||||
analysed.append(w)
|
||||
continue
|
||||
if t == False:
|
||||
analysed.append(w)
|
||||
continue
|
||||
else:
|
||||
analysed.append(t)
|
||||
analysed.append(w)
|
||||
inside_include = False
|
||||
inside_struct = False
|
||||
return analysed
|
||||
|
||||
def token_analyzer(self, ln):
|
||||
global inside_comment
|
||||
analyzed = []
|
||||
for w in ln:
|
||||
if w == 'TOKEN_CSTART':
|
||||
inside_comment = True
|
||||
analyzed.append(w)
|
||||
continue
|
||||
if inside_comment == True:
|
||||
if w == 'TOKEN_MULT':
|
||||
analyzed.append('TOKEN_CMID')
|
||||
continue
|
||||
else:
|
||||
if w == 'TOKEN_CEND':
|
||||
analyzed.append(w)
|
||||
inside_comment = False
|
||||
continue
|
||||
else:
|
||||
if w.startswith('TOKEN'):
|
||||
continue
|
||||
analyzed.append(w)
|
||||
return analyzed
|
||||
|
||||
def parser_analyzer(self, ln):
|
||||
global inside_comment
|
||||
global inside_if
|
||||
global inside_ifndef
|
||||
global substitute
|
||||
analyzed = []
|
||||
subst = []
|
||||
for w in ln:
|
||||
if w == 'TOKEN_CSTART':
|
||||
inside_comment = True
|
||||
if ln[-1] != 'TOKEN_CEND':
|
||||
analyzed.append('PARSE_MULTILINE_COMMENT')
|
||||
continue
|
||||
else:
|
||||
analyzed.append('PARSE_SINGLELINE_COMMENT')
|
||||
continue
|
||||
if w == 'TOKEN_CMID':
|
||||
analyzed.append('PARSE_MULTILINE_COMMENT')
|
||||
continue
|
||||
if w == 'TOKEN_CEND':
|
||||
inside_comment = False
|
||||
continue
|
||||
if inside_comment == False:
|
||||
if w == '*/':
|
||||
continue
|
||||
if w == 'TOKEN_IF':
|
||||
inside_if = True
|
||||
analyzed.append('PARSE_IF')
|
||||
continue
|
||||
if inside_if == True:
|
||||
if w == 'TOKEN_NOT_DEFINED':
|
||||
substitute = True
|
||||
inside_if = False
|
||||
inside_ifndef = True
|
||||
subst.append('PARSE_IFNDEF')
|
||||
continue
|
||||
else:
|
||||
analyzed.append(w)
|
||||
continue
|
||||
if substitute == True:
|
||||
subst.append(w)
|
||||
continue
|
||||
else:
|
||||
analyzed.append(w)
|
||||
continue
|
||||
return analyzed
|
||||
|
||||
def parsetokens(self, fl):
|
||||
templine = []
|
||||
tempfile = []
|
||||
@@ -117,66 +365,111 @@ class PARSEOBJECT:
|
||||
for l in fl:
|
||||
templine = []
|
||||
tempstr = ""
|
||||
if len(l) == 0:
|
||||
templine.append("\n")
|
||||
if l == []:
|
||||
templine.append("")
|
||||
tempfile.append(templine)
|
||||
continue
|
||||
if l[0] == "TOKEN_CSTART" or l[0] == "TOKEN_CMID" or l[0] == "TOKEN_CEND":
|
||||
if "TOKEN_CSTART" in l:
|
||||
self.inside_comment = True
|
||||
tempfile.append(self.parse_comment(l))
|
||||
continue
|
||||
if l[0] == "TYPEDEF" or l[0] == "typedef":
|
||||
if "TOKEN_CMID" in l:
|
||||
self.inside_comment = True
|
||||
tempfile.append(self.parse_comment(l))
|
||||
continue
|
||||
if "TOKEN_CEND" in l:
|
||||
self.inside_comment = True
|
||||
tempfile.append(self.parse_comment(l))
|
||||
continue
|
||||
if "TYPEDEF" in l:
|
||||
self.parse_typedef(l)
|
||||
if self.typedef_enum == False:
|
||||
if self.typedef_enum == False and self.typedef_struct == False:
|
||||
templine.append("; ")
|
||||
for e in l:
|
||||
templine.append(e)
|
||||
tempfile.append(templine)
|
||||
if self.typedef_struct == True:
|
||||
templine.append('struc')
|
||||
templine.append(l[-1][:-1])
|
||||
tempfile.append(templine)
|
||||
templine = []
|
||||
templine.append('endstruc')
|
||||
tempfile.append(templine)
|
||||
continue
|
||||
if l[0] == "TOKEN_PREPROCESS":
|
||||
if "typedef" in l:
|
||||
self.parse_typedef(l)
|
||||
if self.typedef_enum == False and self.typedef_struct == False:
|
||||
templine.append("; ")
|
||||
for e in l:
|
||||
templine.append(e)
|
||||
tempfile.append(templine)
|
||||
if self.typedef_struct == True:
|
||||
templine.append('struc')
|
||||
templine.append(l[-1][:-1])
|
||||
tempfile.append(templine)
|
||||
templine = []
|
||||
templine.append('endstruc')
|
||||
tempfile.append(templine)
|
||||
continue
|
||||
if "struct" in l:
|
||||
self.parse_struct(l)
|
||||
|
||||
if "TOKEN_PREPROCESS" in l:
|
||||
tempfile.append(self.parse_preprocess(l))
|
||||
continue
|
||||
if self.inside_typedef == True:
|
||||
if self.typedef_enum == True:
|
||||
if l[0] == "TOKEN_LBRACE" and len(l) == 2:
|
||||
self.enum_begin = True
|
||||
enum_cnt = 0
|
||||
continue
|
||||
if len(l) == 1:
|
||||
if l[0].endswith(","):
|
||||
tempstr = l[0]
|
||||
templine.append(tempstr[:-1]+"\t")
|
||||
templine.append("EQU\t")
|
||||
templine.append(str(enum_cnt)+"\n")
|
||||
templine.append(str(enum_cnt))
|
||||
tempfile.append(templine)
|
||||
enum_cnt += 1
|
||||
continue
|
||||
else:
|
||||
templine.append(l[0]+"\t")
|
||||
templine.append("EQU\t")
|
||||
templine.append(str(enum_cnt)+"\n")
|
||||
templine.append(str(enum_cnt))
|
||||
tempfile.append(templine)
|
||||
enum_cnt += 1
|
||||
continue
|
||||
continue
|
||||
if len(l) == 3:
|
||||
if l[0].endswith(","):
|
||||
tempstr = l[0]
|
||||
enum_cnt = l[2]
|
||||
templine.append(tempstr[:-1]+"\t")
|
||||
templine.append("EQU"+"\t")
|
||||
templine.append(enum_cnt+"\n")
|
||||
templine.append(enum_cnt)
|
||||
tempfile.append(templine)
|
||||
continue
|
||||
continue
|
||||
if l[0] == "TOKEN_RBRACE" and len(l) == 3:
|
||||
self.enum_begin = False
|
||||
self.typedef_enum = False
|
||||
self.inside_typedef = False
|
||||
enum_cnt = 0
|
||||
continue
|
||||
continue
|
||||
continue
|
||||
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):
|
||||
templine = []
|
||||
for w in l:
|
||||
@@ -185,8 +478,12 @@ class PARSEOBJECT:
|
||||
continue
|
||||
if w == "ENUM" or w == "enum":
|
||||
self.typedef_enum = True
|
||||
self.typedef_struct = False
|
||||
continue
|
||||
if w == "STRUCT" or w == "struct":
|
||||
self.typedef_struct = True
|
||||
self.typedef_enum = False
|
||||
continue
|
||||
|
||||
|
||||
def parse_comment(self, l):
|
||||
templine = []
|
||||
@@ -216,6 +513,16 @@ class PARSEOBJECT:
|
||||
newline.append(w)
|
||||
return newline
|
||||
|
||||
def write_file(self, fn, data):
|
||||
if not os.path.exists(os.path.dirname(fn)):
|
||||
try:
|
||||
os.makedirs(os.path.dirname(fn))
|
||||
except OSError as exc: # Guard against race condition
|
||||
if exc.errno != errno.EEXIST:
|
||||
raise
|
||||
newfile = open(fn, "w")
|
||||
newfile.write(data)
|
||||
newfile.close()
|
||||
|
||||
class PARSER(PARSEOBJECT):
|
||||
_ids = count(0)
|
||||
|
BIN
parsers/comment_parser.obj
Normal file
BIN
parsers/comment_parser.obj
Normal file
Binary file not shown.
92
tokenizer.py
Normal file
92
tokenizer.py
Normal file
@@ -0,0 +1,92 @@
|
||||
'''
|
||||
Contains class TOKENIZER
|
||||
'''
|
||||
from contextlib import ContextDecorator
|
||||
from itertools import count
|
||||
|
||||
class TOKENIZEOBJECT:
|
||||
_passes = count(0)
|
||||
_analyzed = []
|
||||
|
||||
def __exit__(self, *exc):
|
||||
return False
|
||||
|
||||
def __init__(self):
|
||||
self.passes = 0
|
||||
self.analyzeline = []
|
||||
self.analyzed = []
|
||||
|
||||
class typedef_struct(ContextDecorator):
|
||||
def __enter__(self):
|
||||
TOKENIZER._analyzed.append('TOKEN_TYPEDEF_STRUCT')
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
return False
|
||||
|
||||
class typedef_enum(ContextDecorator):
|
||||
def __enter__(self):
|
||||
TOKENIZER._analyzed.append('TOKEN_TYPEDEF_ENUM')
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
return False
|
||||
|
||||
class enum(ContextDecorator):
|
||||
def __enter__(self):
|
||||
TOKENIZER._analyzed.append('TOKEN_ENUM')
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
return False
|
||||
|
||||
class tagname(ContextDecorator):
|
||||
def __enter__(self):
|
||||
TOKENIZER._analyzed.append('TOKEN_TAG_NAME')
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
return False
|
||||
|
||||
class alias(ContextDecorator):
|
||||
def __enter__(self):
|
||||
TOKENIZER._analyzed.append('TOKEN_ALIAS')
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
return False
|
||||
|
||||
@typedef_struct()
|
||||
def TD_struct(self, tsl):
|
||||
'''
|
||||
Takes a Typedef Struct 'list' and appends all items (i) in that list to _analyzed.
|
||||
'''
|
||||
for i in tsl:
|
||||
self._analyzed.append(i)
|
||||
return
|
||||
|
||||
@typedef_enum()
|
||||
def TD_enum(self, e):
|
||||
'''
|
||||
Takes a Typedef enum member and appends it to _analyzed.
|
||||
'''
|
||||
self._analyzed.append(e)
|
||||
return
|
||||
|
||||
@tagname()
|
||||
def TD_tagname(self, tn):
|
||||
'''
|
||||
Takes a Typedef tagname and appends it to _analyzed.
|
||||
'''
|
||||
self._analyzed.append(tn)
|
||||
return
|
||||
|
||||
class TOKENIZER(TOKENIZEOBJECT):
|
||||
_ids = count(0)
|
||||
_passes = count(0)
|
||||
|
||||
def __init__(self):
|
||||
self.id = next(self._ids)
|
||||
self.tupline = []
|
||||
self.tupfile = []
|
||||
self.passes = next(self._passes)
|
Reference in New Issue
Block a user