diff --git a/Makefile b/Makefile index c538a849d053f24eacab9cb656c5998e2d880a30..3b16422d2b298ab308bafdeb62a2ed8b67c9826e 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/include/binary_c_python.h b/include/binary_c_python.h index 9c65d76767755485bdcdf78fff31b9b7df60ad72..7af7f13d76b65972d7797d725ea77849b3b3488a 100644 --- a/include/binary_c_python.h +++ b/include/binary_c_python.h @@ -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, diff --git a/setup.py b/setup.py index 915b72e621e733aa5536fdc8ece815a18dcd0785..0eecc9110bc49d8aa46750b702942b2d1bb50761 100644 --- a/setup.py +++ b/setup.py @@ -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( @@ -119,8 +119,8 @@ BINARY_C_DEFINE_MACROS.extend([("BINARY_C_API_H", API_h)]) ############################################################ INCLUDE_DIRS = ( [ - os.path.join(BINARY_C_DIR, "src"), - os.path.join(BINARY_C_DIR, "src", "API"), + os.path.join(BINARY_C_DIR, "src"), + os.path.join(BINARY_C_DIR, "src", "API"), "include", ] + BINARY_C_INCDIRS @@ -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 diff --git a/src/binary_c_python.c b/src/binary_c_python.c index dd184d5fdd5271f09d6556c51e73248578b52374..ac0e8a7260a32fae061c5dbaf4831bd46d2a17ed 100644 --- a/src/binary_c_python.c +++ b/src/binary_c_python.c @@ -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(""); diff --git a/src/binary_c_python_api.c b/src/binary_c_python_api.c index bd2b2f3a76f99b33b38c99a8312a0c4a148baabd..404e217021b4963713ce575f7d45609958646994 100644 --- a/src/binary_c_python_api.c +++ b/src/binary_c_python_api.c @@ -71,15 +71,19 @@ 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 */ if(write_logfile != 1) @@ -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 */