ffi/build.py
def special_xkeys_module():
  "Create a special X11/Xutil.h keys module"
  CDEF_LINE_FMT = "const int Key_{key};"
  CODE_LINE_FMT = "const int Key_{key} = {val}; /* XK_{key} */".strip()
  cdef_lines = []
  code_lines = []
  for line in open("/usr/include/X11/keysymdef.h"):
    if line.startswith("#define XK_"):
      tokens = line.strip().split()
      keyname, keyval = tokens[1][3:], tokens[2]
      cdef_line = CDEF_LINE_FMT.format(key=keyname)
      code_line = CODE_LINE_FMT.format(key=keyname, val=keyval)
      cdef_lines.append(cdef_line)
      code_lines.append(code_line)
  return {
    "name": "xkeys",
    "cdef": "\n".join(cdef_lines),
    "code": "\n".join(code_lines),
    "extra_args": (),
    "extra_kwargs": {}
  }
Create a special X11/Xutil.h keys module
Create a special X11/Xutil.h keys module
Create a special X11 / Xutil . h keys module
def special_xkeys_module():
  CDEF_LINE_FMT = "const int Key_{key};"
  CODE_LINE_FMT = "const int Key_{key} = {val}; /* XK_{key} */".strip()
  cdef_lines = []
  code_lines = []
  for line in open("/usr/include/X11/keysymdef.h"):
    if line.startswith("#define XK_"):
      tokens = line.strip().split()
      keyname, keyval = tokens[1][3:], tokens[2]
      cdef_line = CDEF_LINE_FMT.format(key=keyname)
      code_line = CODE_LINE_FMT.format(key=keyname, val=keyval)
      cdef_lines.append(cdef_line)
      code_lines.append(code_line)
  return {
    "name": "xkeys",
    "cdef": "\n".join(cdef_lines),
    "code": "\n".join(code_lines),
    "extra_args": (),
    "extra_kwargs": {}
  }
def special_xkeys_module ( ) : CDEF_LINE_FMT = "const int Key_{key};" CODE_LINE_FMT = "const int Key_{key} = {val}; /* XK_{key} */" . strip ( ) cdef_lines = [ ] code_lines = [ ] for line in open ( "/usr/include/X11/keysymdef.h" ) : if line . startswith ( "#define XK_" ) : tokens = line . strip ( ) . split ( ) keyname , keyval = tokens [ 1 ] [ 3 : ] , tokens [ 2 ] cdef_line = CDEF_LINE_FMT . format ( key = keyname ) code_line = CODE_LINE_FMT . format ( key = keyname , val = keyval ) cdef_lines . append ( cdef_line ) code_lines . append ( code_line ) return { "name" : "xkeys" , "cdef" : "\n" . join ( cdef_lines ) , "code" : "\n" . join ( code_lines ) , "extra_args" : ( ) , "extra_kwargs" : { } }
Create a special X11/Xutil.h keys module
Create a special X11 / Xutil . h keys module
"Create a special X11/Xutil.h keys module"