aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/pnodespy.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/scripts/pnodespy.py b/scripts/pnodespy.py
index b4209bc90..1f95cac4d 100755
--- a/scripts/pnodespy.py
+++ b/scripts/pnodespy.py
@@ -30,18 +30,27 @@ def print_enum(name, vals):
print(" {0} = {1}".format(k, n))
-def print_file_header():
+def print_file_header(includeIntEnumunique=True,includeBindToLibGHDL=True):
print(dedent("""\
# Auto generated Python source file from Ada sources
# Call 'make' in 'src/vhdl' to regenerate:
#
- from enum import IntEnum, unique
- from pydecor import export
-
- from pyGHDL.libghdl._decorator import BindToLibGHDL
"""), end=''
)
+ if includeIntEnumunique:
+ print("from enum import IntEnum, unique")
+
+ print("from pydecor import export")
+
+ if includeBindToLibGHDL:
+ print(dedent("""\
+
+ from pyGHDL.libghdl._decorator import BindToLibGHDL
+
+ """), end=''
+ )
+
def do_class_kinds():
print_enum(pnodes.prefix_name.rstrip("_"), pnodes.kinds)
@@ -97,7 +106,7 @@ def do_iirs_subprg():
def do_libghdl_elocations():
classname = "vhdl__elocations"
- print_file_header()
+ print_file_header(includeIntEnumunique=False, includeBindToLibGHDL=False)
print("from pyGHDL.libghdl import libghdl")
print()
for k in pnodes.funcs:
@@ -147,7 +156,7 @@ def do_class_fields():
def read_enum(filename, type_name, prefix, class_name, g=lambda m: m.group(1)):
- """Read an enumeration declaration from :param filename:"""
+ """Read an enumeration declaration from :param filename:."""
pat_decl = re.compile(r" type {0} is$".format(type_name))
pat_enum = re.compile(r" {0}(\w+),?( *-- .*)?$".format(prefix))
pat_comment = re.compile(r" *-- .*$")
@@ -183,7 +192,7 @@ def read_enum(filename, type_name, prefix, class_name, g=lambda m: m.group(1)):
def read_spec_enum(type_name, prefix, class_name):
- """Read an enumeration declaration from iirs.ads"""
+ """Read an enumeration declaration from iirs.ads."""
read_enum(pnodes.kind_file, type_name, prefix, class_name)
@@ -335,7 +344,7 @@ def do_libghdl_names():
val_max = max(val_max, val)
dict[name_def] = val
res.append((name_def, val))
- print_file_header()
+ print_file_header(includeBindToLibGHDL=False)
print(dedent("""
@export
@@ -358,10 +367,6 @@ def do_libghdl_tokens():
def do_libghdl_errorout():
print_file_header()
print(dedent("""\
- from enum import IntEnum, unique
-
- from pyGHDL.libghdl import libghdl
-
@export
@BindToLibGHDL("errorout__enable_warning")
def Enable_Warning(Id: int, Enable: bool) -> None:
ring.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
Copyright 2018 listofoptions <listofoptions@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "quantum.h"

/* ,---------.  ,---------------------------------------------------------.  ,---------.    ,-------------------.
 * | res|stop|  |   f1|   f2|   f3|   f4|menu|user|   f5|   f6|   f7|   f8|  |clrl|clrd|    |    |    |    |    |
 * `---------'  `---------------------------------------------------------'  `---------'    `-------------------'
 * ,------------------------------------------------------------------------..---------.    ,-------------------.
 * |     `|   1|   2|   3|   4|   5|   6|   7|   8|   9|   0|   -|   +| back||insl|dell|    |   *|   /|   +|   -|
 * |------------------------------------------------------------------------||---------|    |-------------------|
 * |     tab|   q|   w|   e|   r|   t|   y|   u|   i|   o|   p|   [|  ]|   \||insc|delc|    |   7|   8|   9|pade|
 * |------------------------------------------------------------------------||---------|    |-------------------|
 * |caps|ctrl|   a|   s|   d|   f|   g|   h|   j|   k|   l|   ;|   '|   retr|| cur|prev|    |   4|   5|   6|   ,|
 * |------------------------------------------------------------------------------------    |-------------------|
 * |dele|lshf  |   z|   x|   c|   v|   b|   n|   m|   ,|   .|   /|rshf  |sel |  up|next|    |   1|   2|   3| tab|
 * |-------------------------------------------------------------------------|---------|    |---------------    |
 * |prnt|      |lalt|              space                    |ralt|      |left|down|rght|    |        0|   .|    |
 * `-----------------------------------------------------------------------------------'    `-------------------'
 */

#define LAYOUT( \
    KEY_RES, KEY_STOP, KEY_F1, KEY_F2, KEY_F3, KEY_F4,KEY_MENU,KEY_USER, KEY_F5, KEY_F6, KEY_F7, KEY_F8,                     KEY_CLRL, KEY_CLRD,   KEY_B1,   KEY_B2,  KEY_B3,  KEY_B4,   \
    KEY_GRAV,      KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, KEY_MINU, KEY_PLUS, KEY_BACK,       KEY_INSL, KEY_DELL,   KEY_MULT, KEY_DIV, KEY_ADD, KEY_SUBT, \
    KEY_TAB,          KEY_Q,KEY_W, KEY_E, KEY_R, KEY_T, KEY_Y, KEY_U, KEY_I, KEY_O, KEY_P, KEY_LBRA, KEY_RBRA, KEY_PIPE,     KEY_INSC, KEY_DELC,   KEY_P7,   KEY_P8,  KEY_P9,  KEY_PADE, \
    KEY_CAPS, KEY_CTRL,  KEY_A, KEY_S, KEY_D, KEY_F, KEY_G, KEY_H, KEY_J, KEY_K, KEY_L, KEY_SEMI, KEY_QUOT,        KEY_RETR, KEY_CUR,  KEY_PREV,   KEY_P4,   KEY_P5,  KEY_P6,  KEY_PCOM, \
    KEY_DELE, KEY_LSHF,     KEY_Z, KEY_X, KEY_C, KEY_V, KEY_B, KEY_N, KEY_M, KEY_COMA, KEY_DOT, KEY_SLAS,KEY_RSHF, KEY_SEL,  KEY_UP,   KEY_NEXT,   KEY_P1,   KEY_P2,  KEY_P3,  KEY_PTAB, \
    KEY_PRNT,               KEY_LALT,              KEY_SPACE                    ,               KEY_RALT,          KEY_LEFT, KEY_DOWN, KEY_RGHT,        KEY_P0,       KEY_PDOT           \
) { \
    {KEY_USER,  KEY_F5,   KEY_F6,   KEY_F7,   KEY_F8,   KEY_CLRL, KEY_CLRD, KEY_MENU }, \
    {KEY_9,     KEY_0,    KEY_MINU, KEY_PLUS, KEY_BACK, KEY_INSL, KEY_DELL, KEY_8    }, \
    {KEY_O,     KEY_P,    KEY_LBRA, KEY_RBRA, KEY_PIPE, KEY_INSC, KEY_DELC, KEY_I    }, \
    {KEY_K,     KEY_L,    KEY_SEMI, KEY_QUOT, KEY_RETR, KEY_CUR,  KEY_PREV, KEY_J    }, \
    {KEY_COMA,  KEY_DOT,  KEY_SLAS, KEY_1,    KEY_SEL,  KEY_UP,   KEY_NEXT, KEY_M    }, \
    {KEY_SPACE, KEY_LALT, KEY_RALT, KC_NO,    KEY_LEFT, KEY_DOWN, KEY_RGHT, KC_NO    }, \
    {KEY_F3,    KEY_F2,   KEY_F1,   KEY_GRAV, KEY_CTRL, KEY_STOP, KEY_G,    KEY_F4   }, \
    {KEY_6,     KEY_5,    KEY_4,    KEY_3,    KEY_CAPS, KEY_RSHF, KEY_LSHF, KEY_7    }, \
    {KEY_Y,     KEY_T,    KEY_R,    KEY_E,    KEY_W,    KEY_Q,    KEY_TAB,  KEY_U    }, \
    {KEY_RES,   KEY_F,    KEY_D,    KEY_S,    KEY_A,    KC_NO,    KEY_2,    KEY_H    }, \
    {KEY_P7,    KEY_P4,   KEY_P8,   KEY_P5,   KEY_P9,   KEY_P6,   KEY_PADE, KEY_PCOM }, \
    {KEY_MULT,  KEY_P1,   KEY_DIV,  KEY_P2,   KEY_PLUS, KEY_P3,   KEY_MINU, KEY_PTAB }, \
    {KEY_B1,    KEY_P0,   KEY_B2,   KC_NO,    KEY_B3,   KEY_PDOT, KEY_B4,   KC_NO    }, \
    {KEY_B,     KEY_V,    KEY_C,    KEY_X,    KEY_Z,    KEY_PRNT, KEY_DELE, KEY_N    }, \
}