forked from EveryTimeIWill18/Cython_Repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCyTypes.pxd
55 lines (45 loc) · 1.35 KB
/
CyTypes.pxd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 24 07:51:07 2019
@author: wmurphy
CyTypes.pyx
==============
This cython module acts as a C header file. It creates the
definitions of the new types that will be used in modules
relying on this code.
"""
import os
import sys
import cytoolz
cimport cython
from cymem.cymem cimport Pool
from libc.math cimport sqrt
from libc.string cimport strcpy, strlen, memset, memcpy
from cpython.mem cimport PyMem_Malloc, PyMem_Realloc, PyMem_Free
# - Enums and Structs
###############################################################################
# - enum type: used for true false
cdef public enum boolean:
TRUE=True
FALSE=False
# - struct type: used for creation of file paths
cdef public struct __cy_path__:
char* path_name
Py_ssize_t length
boolean is_path
char** files_array
ctypedef __cy_path__ Path # - typedef for __cy_path__
# - struct type: used for creation of file stores
cdef public struct __cy_file__:
char* file_name
Py_ssize_t length
boolean is_file
ctypedef __cy_file__ File # - typedef for __cy_file__
# - Template Types
###############################################################################
ctypedef fused file_system_utils:
Path
File
# - Methods
###############################################################################
ctypedef Path* (*set_file_path)(char *)