Skip to content

Commit

Permalink
0.0.9 release
Browse files Browse the repository at this point in the history
  • Loading branch information
s-m-e committed Mar 21, 2018
2 parents 32db77f + e8fd35d commit 4686180
Show file tree
Hide file tree
Showing 37 changed files with 1,122 additions and 427 deletions.
10 changes: 7 additions & 3 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
zugbruecke contributors
=======================
zugbruecke authors
==================

In alphabetical order:
Core developer:

- Sebastian M. Ernst <[email protected]>

Contributors, in alphabetical order:

- Jimmy M. Gong <[email protected]>
13 changes: 13 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Changes
=======

0.0.9 (2018-03-21)
------------------

* FIX: Arch "win64" was broken because of wrong download URL for embedded CPython for win64/amd64, see issue #27.
* FIX: Function pointers in struct types were not handled, see issue #28.
* FIX: Memsync directives pointing to elements within structs were not handled properly, see issue #29.
* FIX: Missing DLLs of type windll and oledll now raise OSError as expected, see issue #30.
* FIX: Missing routines in DLLs now raise AttributeError as expected, see issue #31.
* FIX: Wrong or unconfigured argtypes as well as wrong number of arguments do raise appropriate errors (ValueError, ArgumentError or TypeError), see issue #32.
* Isolated argument packing and unpacking code, preparing to solve issue #25.
* Renamed "logwrite" parameter & command line option into "log_write".
* Reduced number of RPC servers to one per side (Unix and Wine).

0.0.8 (2018-03-18)
------------------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ zugbruecke is **built on top of Wine**. A stand-alone Windows Python interpreter
launched in the background is used to execute the called DLL routines.
Communication between the Unix-side and the Windows/Wine-side is based on Python's
build-in multiprocessing connection capability.
zugbruecke has (limited) support for pointers and struct types.
zugbruecke has (limited) support for pointers, struct types and call-back functions.
zugbruecke comes with extensive logging features allowing to debug problems
associated with both itself and with Wine.
zugbruecke is written using **Python 3 syntax** and primarily targets the
Expand Down
82 changes: 82 additions & 0 deletions demo_dll/demo_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,26 @@ void __stdcall DEMODLL bubblesort(
}


void __stdcall DEMODLL bubblesort_struct(
bubblesort_data *data
)
{
int i, j;
for (i = 0; i < data->n - 1; ++i)
{
for (j = 0; j < data->n - i - 1; ++j)
{
if (data->a[j] > data->a[j + 1])
{
float tmp = data->a[j];
data->a[j] = data->a[j + 1];
data->a[j + 1] = tmp;
}
}
}
}


void __stdcall DEMODLL mix_rgb_colors(
int8_t color_a[3],
int8_t color_b[3],
Expand Down Expand Up @@ -219,11 +239,55 @@ vector3d __stdcall DEMODLL *vector3d_add(
int16_t __stdcall DEMODLL sqrt_int(
int16_t a
)
{
return sqrt(a);
}


int16_t __stdcall DEMODLL square_int(
int16_t a
)
{
return a * a;
}


int16_t __stdcall DEMODLL add_ints(
int16_t a,
int16_t b
)
{
return a + b;
}


float __stdcall DEMODLL add_floats(
float a,
float b
)
{
return a + b;
}


int16_t __stdcall DEMODLL subtract_ints(
int16_t a,
int16_t b
)
{
return a - b;
}


int16_t __stdcall DEMODLL pow_ints(
int16_t a,
int16_t b
)
{
return pow(a, b);
}


int16_t __stdcall DEMODLL get_const_int(void)
{
return sqrt(49);
Expand Down Expand Up @@ -287,6 +351,24 @@ int16_t __stdcall DEMODLL sum_elements_from_callback(
}


int16_t __stdcall DEMODLL sum_elements_from_callback_in_struct(
struct conveyor_belt_data *data
)
{

int16_t sum = 0;
int16_t i;

for(i = 0; i < data->len; i++)
{
sum += data->get_data(i);
}

return sum;

}


// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// DLL infrastructure
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
42 changes: 42 additions & 0 deletions demo_dll/demo_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ void __stdcall DEMODLL bubblesort(
int n
);

typedef struct bubblesort_data {
float *a;
int n;
} bubblesort_data;

void __stdcall DEMODLL bubblesort_struct(
bubblesort_data *data
);

void __stdcall DEMODLL mix_rgb_colors(
int8_t color_a[3],
int8_t color_b[3],
Expand All @@ -126,6 +135,30 @@ int16_t __stdcall DEMODLL sqrt_int(
int16_t a
);

int16_t __stdcall DEMODLL square_int(
int16_t a
);

int16_t __stdcall DEMODLL add_ints(
int16_t a,
int16_t b
);

float __stdcall DEMODLL add_floats(
float a,
float b
);

int16_t __stdcall DEMODLL subtract_ints(
int16_t a,
int16_t b
);

int16_t __stdcall DEMODLL pow_ints(
int16_t a,
int16_t b
);

int16_t __stdcall DEMODLL get_const_int(void);

struct test
Expand Down Expand Up @@ -162,6 +195,15 @@ int16_t __stdcall DEMODLL sum_elements_from_callback(
conveyor_belt get_data
);

typedef struct conveyor_belt_data {
int16_t len;
conveyor_belt get_data;
} conveyor_belt_data;

int16_t __stdcall DEMODLL sum_elements_from_callback_in_struct(
struct conveyor_belt_data *data
);


// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// DLL infrastructure
Expand Down
2 changes: 1 addition & 1 deletion docs/bugs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ your current working directory or *zugbruecke*'s configuration directory (likely

.. code:: javascript
{"log_level": 10, "logwrite": true}
{"log_level": 10, "log_write": true}
The higher the log level, the more output you will get. Default is 0 for no logs.
The on-screen log is color-coded for readability. The log can also, in addition,
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ Tells *zugbuecke* to show messages its sub-processes are writing to ``stdout``.
Tells *zugbuecke* to show messages its sub-processes are writing to ``stderr``.
``True`` by default.

``logwrite`` (bool)
^^^^^^^^^^^^^^^^^^^
``log_write`` (bool)
^^^^^^^^^^^^^^^^^^^^

Tells *zugbuecke* to write its logs to disk into the current working directory.
``False`` by default.
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Unices / *Unix*-like systems such as *Linux*, *MacOS* or *BSD*.
launched in the background is used to execute the called DLL routines.
Communication between the *Unix*-side and the *Windows*/*Wine*-side is based on *Python*'s
build-in multiprocessing connection capability.
*zugbruecke* has (limited) support for pointers and struct types.
*zugbruecke* has (limited) support for pointers, struct types and call-back functions.
*zugbruecke* comes with extensive logging features allowing to debug problems
associated with both itself and with *Wine*.
*zugbruecke* is written using *Python* 3 syntax and primarily targets the
Expand Down
4 changes: 2 additions & 2 deletions docs/session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ Instance: ``zugbruecke.current_session``
This is the default session of *zugbruecke*. It will be started during import.
Like every session, it can be :ref:`re-configured <reconfiguration>`
during run-time. If any of the usual *ctypes* members are imported from
*zugbruecke*, like for instance ``cdll``, ``CDLL``, ``windll``, ``WinDLL``,
``oledll``, ``OleDLL``, ``FormatError``, ``get_last_error``, ``GetLastError``,
*zugbruecke*, like for instance ``cdll``, ``CDLL``, ``CFUNCTYPE``, ``windll``, ``WinDLL``,
``WINFUNCTYPE``, ``oledll``, ``OleDLL``, ``FormatError``, ``get_last_error``, ``GetLastError``,
``set_last_error`` or ``WinError``, this session will be used.
17 changes: 17 additions & 0 deletions examples/test_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,20 @@ def get_data(index):

test_sum = sum_elements_from_callback(len(DATA), get_data)
print(('sum', 48, test_sum))

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

class conveyor_belt_data(ctypes.Structure):
_fields_ = [
('len', ctypes.c_int16),
('get_data', conveyor_belt)
]

sum_elements_from_callback_in_struct = dll.sum_elements_from_callback_in_struct
sum_elements_from_callback_in_struct.argtypes = (ctypes.POINTER(conveyor_belt_data),)
sum_elements_from_callback_in_struct.restype = ctypes.c_int16

in_struct = conveyor_belt_data(len(DATA), get_data)

test_struct_sum = sum_elements_from_callback_in_struct(in_struct)
print(('sum', 48, test_struct_sum))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


# Bump version HERE!
_version_ = '0.0.8'
_version_ = '0.0.9'


# List all versions of Python which are supported
Expand Down
18 changes: 6 additions & 12 deletions src/zugbruecke/_server_.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,16 @@
'--id', type = str, nargs = 1
)
parser.add_argument(
'--port_socket_ctypes', type = int, nargs = 1
'--port_socket_unix', type = int, nargs = 1
)
parser.add_argument(
'--port_socket_callback', type = int, nargs = 1
)
parser.add_argument(
'--port_socket_log_main', type = int, nargs = 1
'--port_socket_wine', type = int, nargs = 1
)
parser.add_argument(
'--log_level', type = int, nargs = 1
)
parser.add_argument(
'--logwrite', type = int, nargs = 1
'--log_write', type = int, nargs = 1
)
args = parser.parse_args()

Expand All @@ -71,13 +68,10 @@
'platform': 'WINE',
'stdout': False,
'stderr': False,
'logwrite': bool(args.logwrite[0]),
'remote_log': True,
'log_write': bool(args.log_write[0]),
'log_level': args.log_level[0],
'log_server': False,
'port_socket_ctypes': args.port_socket_ctypes[0],
'port_socket_callback': args.port_socket_callback[0],
'port_socket_log_main': args.port_socket_log_main[0]
'port_socket_wine': args.port_socket_wine[0],
'port_socket_unix': args.port_socket_unix[0]
}

# Fire up wine server session with parsed parameters
Expand Down
4 changes: 2 additions & 2 deletions src/zugbruecke/_wrapper_.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def _check_HRESULT(result): # EXPORT
WINFUNCTYPE = current_session.ctypes_WINFUNCTYPE # EXPORT

# Used as cache by CFUNCTYPE and WINFUNCTYPE
_c_functype_cache = current_session.cache_dict['func_type'][_FUNCFLAG_CDECL] # EXPORT
_win_functype_cache = current_session.cache_dict['func_type'][_FUNCFLAG_STDCALL] # EXPORT
_c_functype_cache = current_session.data.cache_dict['func_type'][_FUNCFLAG_CDECL] # EXPORT
_win_functype_cache = current_session.data.cache_dict['func_type'][_FUNCFLAG_STDCALL] # EXPORT


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
Loading

0 comments on commit 4686180

Please sign in to comment.