Commit a313d9ec authored by David Hendriks's avatar David Hendriks
Browse files

debugging the new bindings, but I need to change this repo to a different name

parent b8460981
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ PY_OPTIONS := build_ext --inplace
all:
	$(CC) -DBINARY_C=$(BINARY_C) $(CFLAGS) $(INCDIRS) $(C_SRC) -o $(OBJECTS) $(OBJ_FLAGS) $(LIBS) 
	$(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) -o $(SO_NAME) $(OBJECTS)
	@echo pythoniajiajjaaiajaij
	$(PY_EXEC) $(PY_SETUP) $(PY_OPTIONS)

test:	
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
 * Include binary_C's API
 */
#include "binary_c_API.h"
#include "binary_c_API_prototypes.h"
// #include "binary_c_API_prototypes.h"

/* Binary_c's python API prototypes */
int run_system(char * argstring,
+15 −15
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ def check_version(installed_binary_c_version, required_binary_c_version):
    assert installed_binary_c_version == required_binary_c_version, message

###
REQUIRED_BINARY_C_VERSION = '2.1.6'
REQUIRED_BINARY_C_VERSION = '2.1.7'

####
GSL_DIR = os.getenv("GSL_DIR", None)
@@ -61,7 +61,7 @@ BINARY_C_VERSION = (
    .stdout.decode("utf-8")
    .split()
)
check_version(BINARY_C_VERSION[0], REQUIRED_BINARY_C_VERSION)
# check_version(BINARY_C_VERSION[0], REQUIRED_BINARY_C_VERSION)

BINARY_C_INCDIRS = (
    subprocess.run(
@@ -145,17 +145,17 @@ RUNTIME_LIBRARY_DIRS = [
    # os.path.join(CWD, "binarycpython/core/"),
] + BINARY_C_LIBDIRS

# print('\n')
# print("BINARY_C_CONFIG: ", str(BINARY_C_CONFIG) + "\n")
# print("incdirs: ", str(INCLUDE_DIRS) + "\n")
# print("BINARY_C_LIBS: ", str(BINARY_C_LIBS) + "\n")
# print("LIBRARIES: ", str(LIBRARIES) + "\n")
# print("LIBRARY_DIRS: ", str(LIBRARY_DIRS) + "\n")
# print("RUNTIME_LIBRARY_DIRS: ", str(RUNTIME_LIBRARY_DIRS) + "\n")
# print("BINARY_C_CFLAGS: ", str(BINARY_C_CFLAGS) + "\n")
# print("API_h: ", str(API_h) + "\n")
# print("macros: ", str(BINARY_C_DEFINE_MACROS) + "\n")
# print('\n')
print('\n')
print("BINARY_C_CONFIG: ", str(BINARY_C_CONFIG) + "\n")
print("incdirs: ", str(INCLUDE_DIRS) + "\n")
print("BINARY_C_LIBS: ", str(BINARY_C_LIBS) + "\n")
print("LIBRARIES: ", str(LIBRARIES) + "\n")
print("LIBRARY_DIRS: ", str(LIBRARY_DIRS) + "\n")
print("RUNTIME_LIBRARY_DIRS: ", str(RUNTIME_LIBRARY_DIRS) + "\n")
print("BINARY_C_CFLAGS: ", str(BINARY_C_CFLAGS) + "\n")
print("API_h: ", str(API_h) + "\n")
print("macros: ", str(BINARY_C_DEFINE_MACROS) + "\n")
print('\n')

############################################################
# Making the extension function
+2 −2
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ static PyObject* binary_c_create_binary(PyObject *self, PyObject *args)
    /* Allocate memory for binaries */
    for(i=0;i<N;i++){
        stardata[i] = NULL;
        binary_c_new_system(&stardata[i], NULL, NULL, &store, &empty_str, -1);
        binary_c_new_system(&stardata[i], NULL, NULL, &store, NULL, &empty_str, -1);
    }

    /* Return the evolved binary */
@@ -172,7 +172,7 @@ static PyObject* binary_c_new_binary_system(PyObject *self, PyObject *args)
    /* Allocate memory for binaries */
    char * empty_str = "";
    stardata = NULL;
    binary_c_new_system(&stardata, NULL, NULL, &store, &empty_str, -1);
    binary_c_new_system(&stardata, NULL, NULL, &store, NULL, &empty_str, -1);
    
    /* Return an object containing the stardata */
    PyObject *ret = Py_BuildValue("");
+65 −49
Original line number Diff line number Diff line
@@ -71,14 +71,18 @@ int run_system(char * argstring,
        store = NULL;
    }

    struct persistent_data_t * persistent_data;

    /* make new stardata */
    stardata = NULL;
    binary_c_new_system(&stardata,
                        NULL,
                        NULL,
                        &store,
                        &argstring,
                        -1);
    binary_c_new_system(&stardata,          // stardata
                        NULL,               // previous_stardatas
                        NULL,               // preferences
                        &store,             // store
                        &persistent_data,   // persistent_data TODO: see if this use is correct
                        &argstring,         // argv
                        -1                  // argc
    );

    // Add flag to enable
    /* disable logging */
@@ -122,8 +126,8 @@ int run_system(char * argstring,
        TRUE,                       // free_preferences
        TRUE,                       // free_stardata
        FALSE,                      // free_store
        FALSE                       // free_raw_buffer
        TRUE,                       // free_persistent TODO: check if this is correct here
        FALSE,                      // free_raw_buffer
        TRUE                        // free_persistent TODO: check if this is correct here
    );

    // add flag or logic to free store contents.
@@ -151,12 +155,15 @@ int return_arglines(char ** const buffer,
    /* make new stardata */
    stardata = NULL;
    char * empty_str = "";
    binary_c_new_system(&stardata,
                        NULL,
                        NULL,
                        &store,
                        &empty_str,
                        -1);
    binary_c_new_system(&stardata,          // stardata
                        NULL,               // previous_stardatas
                        NULL,               // preferences
                        &store,             // store
                        NULL,               // persistent_data
                        &empty_str,         // argv
                        -1                  // argc
    );


    /* disable logging */
    snprintf(stardata->preferences->log_filename,
@@ -189,8 +196,8 @@ int return_arglines(char ** const buffer,
        TRUE,                       // free_preferences
        TRUE,                       // free_stardata
        FALSE,                      // free_store
        FALSE                       // free_raw_buffer
        TRUE,                       // free_persistent TODO: check if this is correct here
        FALSE,                      // free_raw_buffer
        TRUE                        // free_persistent TODO: check if this is correct here
    );
    
    // TODO: check what this does
@@ -211,12 +218,14 @@ int return_help_info(char * argstring,

    /* make new stardata */
    stardata = NULL;
    binary_c_new_system(&stardata,
                        NULL,
                        NULL,
                        &store,
                        &argstring,
                        -1);
    binary_c_new_system(&stardata,          // stardata
                        NULL,               // previous_stardatas
                        NULL,               // preferences
                        &store,             // store
                        NULL,               // persistent_data
                        &argstring,         // argv
                        -1                  // argc
    );

    /* output to strings */
    stardata->preferences->internal_buffering = INTERNAL_BUFFERING_STORE;
@@ -239,8 +248,8 @@ int return_help_info(char * argstring,
        TRUE,                       // free_preferences
        TRUE,                       // free_stardata
        FALSE,                      // free_store
        FALSE                       // free_raw_buffer
        TRUE,                       // free_persistent TODO: check if this is correct here
        FALSE,                      // free_raw_buffer
        TRUE                        // free_persistent TODO: check if this is correct here
    );

    // Ask rob whether this can be replaced with setting the thing above to true
@@ -260,12 +269,14 @@ int return_help_all_info(char ** const buffer,
    /* make new stardata */
    stardata = NULL;
    char * empty_str = "";
    binary_c_new_system(&stardata,
                        NULL,
                        NULL,
                        &store,
                        &empty_str,
                        -1);
    binary_c_new_system(&stardata,          // stardata
                        NULL,               // previous_stardatas
                        NULL,               // preferences
                        &store,             // store
                        NULL,               // persistent_data
                        &empty_str,         // argv
                        -1                  // argc
    );

    /* output to strings */
    stardata->preferences->internal_buffering = INTERNAL_BUFFERING_STORE;
@@ -288,8 +299,8 @@ int return_help_all_info(char ** const buffer,
        TRUE,                       // free_preferences
        TRUE,                       // free_stardata
        FALSE,                      // free_store
        FALSE                       // free_raw_buffer
        TRUE,                       // free_persistent TODO: check if this is correct here
        FALSE,                      // free_raw_buffer
        TRUE                        // free_persistent TODO: check if this is correct here
    );


@@ -309,12 +320,14 @@ int return_version_info(char ** const buffer,
    /* make new stardata */
    stardata = NULL;
    char * empty_str = "";
    binary_c_new_system(&stardata,
                        NULL,
                        NULL,
                        &store,
                        &empty_str,
                        -1);
    binary_c_new_system(&stardata,          // stardata
                        NULL,               // previous_stardatas
                        NULL,               // preferences
                        &store,             // store
                        NULL,   // persistent_data TODO: see if this use is correct
                        &empty_str,         // argv
                        -1                  // argc
    );

    /* output to strings */
    stardata->preferences->internal_buffering = INTERNAL_BUFFERING_STORE;
@@ -337,8 +350,8 @@ int return_version_info(char ** const buffer,
        TRUE,                       // free_preferences
        TRUE,                       // free_stardata
        FALSE,                      // free_store
        FALSE                       // free_raw_buffer
        TRUE,                       // free_persistent TODO: check if this is correct here
        FALSE,                      // free_raw_buffer
        TRUE                        // free_persistent TODO: check if this is correct here
    );

    binary_c_free_store_contents(store);
@@ -360,12 +373,15 @@ long int return_store(char * argstring,

    /* make new stardata */
    stardata = NULL;
    binary_c_new_system(&stardata,
                        NULL,
                        NULL,
                        &store,
                        &argstring,
                        -1);
    binary_c_new_system(&stardata,          // stardata
                        NULL,               // previous_stardatas
                        NULL,               // preferences
                        &store,             // store
                        NULL,               // persistent_data
                        &argstring,         // argv
                        -1                  // argc
    );


    /* output to strings */
    // stardata->preferences->internal_buffering = INTERNAL_BUFFERING_STORE;
@@ -385,8 +401,8 @@ long int return_store(char * argstring,
        TRUE,                       // free_preferences
        TRUE,                       // free_stardata
        FALSE,                      // free_store
        FALSE                       // free_raw_buffer
        TRUE,                       // free_persistent TODO: check if this is correct here
        FALSE,                      // free_raw_buffer
        TRUE                       // free_persistent TODO: check if this is correct here
    );

    /* convert the pointer */