# Path: src/zugbruecke/core/const.py
# _FUNCFLAG_STDCALL = 0 # EXPORT
# 
# FLAG_POINTER = -1
# 
# GROUP_VOID = 1
# 
# GROUP_FUNDAMENTAL = 2
# 
# GROUP_STRUCT = 4
# 
# GROUP_FUNCTION = 8


import ctypes
from ctypes import _FUNCFLAG_CDECL
from ..const import (
	_FUNCFLAG_STDCALL,
	FLAG_POINTER,
	GROUP_VOID,
	GROUP_FUNDAMENTAL,
	GROUP_STRUCT,
	GROUP_FUNCTION
	)
		# Generate actual class
		self.cache_dict['struct_type'][struct_d_dict['t']] = type(
			struct_d_dict['t'], # Potenial BUG: Ends up in __main__ scope, problematic?
			(ctypes.Structure,),
			{'_fields_': fields}
			)


	def __pack_definition_dict__(self, datatype, field_name = None):

		# Not all datatypes have a name, let's handle that
		type_name = None
		# Get name of datatype, such as c_int, if there is one
		if hasattr(datatype, '__name__'):
			type_name = datatype.__name__

		# Get group of datatype
		group_name = type(datatype).__name__
		# Can be: 'PyCSimpleType', 'PyCStructType', PyCArrayType or 'PyCPointerType'

		# List of flags: Pointer flag or length of array (one entry per dimension)
		flag_list = []

		# Strip away all pointers and arrays until simple type or struct type is left & keep order
		while group_name in ['PyCPointerType', 'PyCArrayType']:

			# Catch pointer
			if group_name == 'PyCPointerType':

				# Append pointer flag to list of flags

# Path: src/zugbruecke/core/const.py
# _FUNCFLAG_STDCALL = 0 # EXPORT
# 
# FLAG_POINTER = -1
# 
# GROUP_VOID = 1
# 
# GROUP_FUNDAMENTAL = 2
# 
# GROUP_STRUCT = 4
# 
# GROUP_FUNCTION = 8


# Path: src/zugbruecke/core/data/arg_definition.py
import ctypes
from ctypes import _FUNCFLAG_CDECL
from ..const import (
	_FUNCFLAG_STDCALL,
	FLAG_POINTER,
	GROUP_VOID,
	GROUP_FUNDAMENTAL,
	GROUP_STRUCT,
	GROUP_FUNCTION
	)

		# Generate actual class
		self.cache_dict['struct_type'][struct_d_dict['t']] = type(
			struct_d_dict['t'], # Potenial BUG: Ends up in __main__ scope, problematic?
			(ctypes.Structure,),
			{'_fields_': fields}
			)


	def __pack_definition_dict__(self, datatype, field_name = None):

		# Not all datatypes have a name, let's handle that
		type_name = None
		# Get name of datatype, such as c_int, if there is one
		if hasattr(datatype, '__name__'):
			type_name = datatype.__name__

		# Get group of datatype
		group_name = type(datatype).__name__
		# Can be: 'PyCSimpleType', 'PyCStructType', PyCArrayType or 'PyCPointerType'

		# List of flags: Pointer flag or length of array (one entry per dimension)
		flag_list = []

		# Strip away all pointers and arrays until simple type or struct type is left & keep order
		while group_name in ['PyCPointerType', 'PyCArrayType']:

			# Catch pointer
			if group_name == 'PyCPointerType':

				# Append pointer flag to list of flags

				flag_list.append(FLAG_POINTER)