added the upiwin_tmp module definitions
This commit is contained in:
		
							parent
							
								
									ebc5ae5afc
								
							
						
					
					
						commit
						ffae4e3329
					
				@ -1,5 +1,5 @@
 | 
				
			|||||||
OBJS=main.o sysinput.o ep_init.o ep_upiwin.o ep_backlight.o ep_util.o fbinit.o fbprimitive.o log.o gpio.o msg_queue.o \
 | 
					OBJS=main.o sysinput.o ep_init.o ep_upiwin.o ep_backlight.o ep_upiwin_tmp.o ep_util.o fbinit.o fbprimitive.o \
 | 
				
			||||||
     time_func.o config.o splash.o
 | 
					     log.o gpio.o msg_queue.o time_func.o config.o splash.o
 | 
				
			||||||
LIBS=-lpython3.7m -lcrypt -lbcm2835 -lpthread -ldl -lutil -lm
 | 
					LIBS=-lpython3.7m -lcrypt -lbcm2835 -lpthread -ldl -lutil -lm
 | 
				
			||||||
CFLAGS=-I/usr/include/python3.7m -Wall -fstack-protector -fwrapv -fno-PIE -g -O3 -DDEBUG_ASSERT
 | 
					CFLAGS=-I/usr/include/python3.7m -Wall -fstack-protector -fwrapv -fno-PIE -g -O3 -DDEBUG_ASSERT
 | 
				
			||||||
LDFLAGS=-L/usr/lib/python3.7/config-3.7m-arm-linux-gnueabihf -Xlinker -export-dynamic -Wl,-O1 \
 | 
					LDFLAGS=-L/usr/lib/python3.7/config-3.7m-arm-linux-gnueabihf -Xlinker -export-dynamic -Wl,-O1 \
 | 
				
			||||||
 | 
				
			|||||||
@ -6,37 +6,16 @@
 | 
				
			|||||||
#include "ep_init.h"
 | 
					#include "ep_init.h"
 | 
				
			||||||
#include "ep_util.h"
 | 
					#include "ep_util.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const PCSTR Mod_UPIWIN = "upiwin";              /* name of the primary UPIWIN module */
 | 
					 | 
				
			||||||
const PCSTR Mod_UPIWIN_tmp = "upiwin_tmp";      /* name of the temporary UPIWIN module */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static wchar_t *python_name = NULL;       /* location of the Python executable */
 | 
					static wchar_t *python_name = NULL;       /* location of the Python executable */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PyObject *UPIWIN_module = NULL;
 | 
					PyObject *UPIWIN_module = NULL;
 | 
				
			||||||
PyObject *UPIWIN_tmp_module = NULL;
 | 
					PyObject *UPIWIN_tmp_module = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyModuleDef DefUPIWIN_tmp = {
 | 
					 | 
				
			||||||
  PyModuleDef_HEAD_INIT,   /* standard garbage */
 | 
					 | 
				
			||||||
  Mod_UPIWIN,              /* module name */
 | 
					 | 
				
			||||||
  NULL,                    /* no doc string */
 | 
					 | 
				
			||||||
  -1,                      /* no per-module memory */
 | 
					 | 
				
			||||||
  NULL,                    /* method defs will be added later */
 | 
					 | 
				
			||||||
  NULL,                    /* no slots for multi-phase init */
 | 
					 | 
				
			||||||
  NULL,                    /* no traversal proc */
 | 
					 | 
				
			||||||
  NULL,                    /* no clear function */
 | 
					 | 
				
			||||||
  NULL                     /* no free function */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static PyObject *init_upiwin_tmp_module(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  PyObject *module = PyModule_Create(&DefUPIWIN_tmp);
 | 
					 | 
				
			||||||
  return module;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* used to link the two modules into Python's init table */
 | 
					/* used to link the two modules into Python's init table */
 | 
				
			||||||
static struct _inittab upiwin_inittab[] = {
 | 
					static struct _inittab upiwin_inittab[] = {
 | 
				
			||||||
  { Mod_UPIWIN,     Epython_init_upiwin_module },
 | 
					  { MOD_NAME_UPIWIN,     Epython_init_upiwin_module     },
 | 
				
			||||||
  { Mod_UPIWIN_tmp, init_upiwin_tmp_module     },
 | 
					  { MOD_NAME_UPIWIN_TMP, Epython_init_upiwin_tmp_module },
 | 
				
			||||||
  { NULL,           NULL                       }
 | 
					  { NULL,                NULL                           }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void epython_cleanup(void)
 | 
					static void epython_cleanup(void)
 | 
				
			||||||
@ -82,14 +61,14 @@ HRESULT Epython_setup(void)
 | 
				
			|||||||
  Py_Initialize();
 | 
					  Py_Initialize();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Import the modules */
 | 
					  /* Import the modules */
 | 
				
			||||||
  UPIWIN_module = PyImport_ImportModule(Mod_UPIWIN);
 | 
					  UPIWIN_module = PyImport_ImportModule(MOD_NAME_UPIWIN);
 | 
				
			||||||
  if (!UPIWIN_module)
 | 
					  if (!UPIWIN_module)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    Log(LFATAL, "error importing the upiwin module");
 | 
					    Log(LFATAL, "error importing the upiwin module");
 | 
				
			||||||
    hr = Epython_trace_exception();
 | 
					    hr = Epython_trace_exception();
 | 
				
			||||||
    goto error_1;
 | 
					    goto error_1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  UPIWIN_tmp_module = PyImport_ImportModule(Mod_UPIWIN_tmp);
 | 
					  UPIWIN_tmp_module = PyImport_ImportModule(MOD_NAME_UPIWIN_TMP);
 | 
				
			||||||
  if (!UPIWIN_tmp_module)
 | 
					  if (!UPIWIN_tmp_module)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    Log(LFATAL, "error importing the upiwin_tmp module");
 | 
					    Log(LFATAL, "error importing the upiwin_tmp module");
 | 
				
			||||||
 | 
				
			|||||||
@ -5,13 +5,14 @@
 | 
				
			|||||||
#include <Python.h>
 | 
					#include <Python.h>
 | 
				
			||||||
#include "wintype.h"
 | 
					#include "wintype.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern const PCSTR Mod_UPIWIN;
 | 
					#define MOD_NAME_UPIWIN      "upiwin"
 | 
				
			||||||
extern const PCSTR Mod_UPIWIN_tmp;
 | 
					#define MOD_NAME_UPIWIN_TMP  "upiwin_tmp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern PyObject *UPIWIN_module;
 | 
					extern PyObject *UPIWIN_module;
 | 
				
			||||||
extern PyObject *UPIWIN_tmp_module;
 | 
					extern PyObject *UPIWIN_tmp_module;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern PyObject *Epython_init_upiwin_module(void);
 | 
					extern PyObject *Epython_init_upiwin_module(void);
 | 
				
			||||||
 | 
					extern PyObject *Epython_init_upiwin_tmp_module(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern HRESULT Epython_setup(void);
 | 
					extern HRESULT Epython_setup(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@ static PyMethodDef UPIWINMethods[] = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static PyModuleDef DefUPIWIN = {
 | 
					static PyModuleDef DefUPIWIN = {
 | 
				
			||||||
  PyModuleDef_HEAD_INIT,     /* standard garbage */
 | 
					  PyModuleDef_HEAD_INIT,     /* standard garbage */
 | 
				
			||||||
  "upiwin",                  /* module name */
 | 
					  MOD_NAME_UPIWIN,           /* module name */
 | 
				
			||||||
  NULL,                      /* no doc string */
 | 
					  NULL,                      /* no doc string */
 | 
				
			||||||
  sizeof(UPIWIN_STATE),      /* per-module memory */
 | 
					  sizeof(UPIWIN_STATE),      /* per-module memory */
 | 
				
			||||||
  UPIWINMethods,             /* method defs */
 | 
					  UPIWINMethods,             /* method defs */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										81
									
								
								src/ep_upiwin_tmp.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								src/ep_upiwin_tmp.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,81 @@
 | 
				
			|||||||
 | 
					#define PY_SSIZE_T_CLEAN
 | 
				
			||||||
 | 
					#include <Python.h>
 | 
				
			||||||
 | 
					#include "scode.h"
 | 
				
			||||||
 | 
					#include "fbprimitive.h"
 | 
				
			||||||
 | 
					#include "ep_init.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static PyObject *do_setpixel(PyObject *self, PyObject *args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  INT32 x, y;
 | 
				
			||||||
 | 
					  UINT16 color, oldcolor;
 | 
				
			||||||
 | 
					  BOOL xor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!PyArg_ParseTuple(args, "iiHi", &x, &y, &color, &xor))
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
 | 
					  oldcolor = Fb_setpixel(x, y, color, xor);
 | 
				
			||||||
 | 
					  return PyLong_FromLong((long)oldcolor);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static PyObject *do_line(PyObject *self, PyObject *args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  INT32 x1, y1, x2, y2;
 | 
				
			||||||
 | 
					  UINT16 color;
 | 
				
			||||||
 | 
					  BOOL xor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!PyArg_ParseTuple(args, "iiiiHi", &x1, &y1, &x2, &y2, &color, &xor))
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
 | 
					  Fb_line(x1, y1, x2, y2, color, xor);
 | 
				
			||||||
 | 
					  Py_RETURN_NONE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static PyObject *do_rectangle(PyObject *self, PyObject *args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  INT32 x1, y1, x2, y2;
 | 
				
			||||||
 | 
					  UINT16 color;
 | 
				
			||||||
 | 
					  BOOL xor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!PyArg_ParseTuple(args, "iiiiHi", &x1, &y1, &x2, &y2, &color, &xor))
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
 | 
					  Fb_rectangle(x1, y1, x2, y2, color, xor);
 | 
				
			||||||
 | 
					  Py_RETURN_NONE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static PyObject *do_filled_rectangle(PyObject *self, PyObject *args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  INT32 x1, y1, x2, y2;
 | 
				
			||||||
 | 
					  UINT16 color;
 | 
				
			||||||
 | 
					  BOOL xor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!PyArg_ParseTuple(args, "iiiiHi", &x1, &y1, &x2, &y2, &color, &xor))
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
 | 
					  Fb_filled_rectangle(x1, y1, x2, y2, color, xor);
 | 
				
			||||||
 | 
					  Py_RETURN_NONE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static PyMethodDef UPIWIN_tmpMethods[] = {
 | 
				
			||||||
 | 
					  {"setpixel", do_setpixel, METH_VARARGS, "Set a single pixel on the display."},
 | 
				
			||||||
 | 
					  {"line", do_line, METH_VARARGS, "Draw a line on the display."},
 | 
				
			||||||
 | 
					  {"rectangle", do_rectangle, METH_VARARGS, "Draw a rectangle on the display."},
 | 
				
			||||||
 | 
					  {"filled_rectangle", do_filled_rectangle, METH_VARARGS, "Draw a filled rectangle on the display."},
 | 
				
			||||||
 | 
					  {NULL, NULL, 0, NULL}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static PyModuleDef DefUPIWIN_tmp = {
 | 
				
			||||||
 | 
					  PyModuleDef_HEAD_INIT,   /* standard garbage */
 | 
				
			||||||
 | 
					  MOD_NAME_UPIWIN_TMP,     /* module name */
 | 
				
			||||||
 | 
					  NULL,                    /* no doc string */
 | 
				
			||||||
 | 
					  -1,                      /* no per-module memory */
 | 
				
			||||||
 | 
					  UPIWIN_tmpMethods,       /* method defs */
 | 
				
			||||||
 | 
					  NULL,                    /* no slots for multi-phase init */
 | 
				
			||||||
 | 
					  NULL,                    /* no traversal proc */
 | 
				
			||||||
 | 
					  NULL,                    /* no clear function */
 | 
				
			||||||
 | 
					  NULL                     /* no free function */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PyObject *Epython_init_upiwin_tmp_module(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  PyObject *module;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  module = PyModule_Create(&DefUPIWIN);
 | 
				
			||||||
 | 
					  return module;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user