#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>

#cmakedefine CHEMSH_ARCH "@CHEMSH_ARCH@"
#cmakedefine CHEMSH_PATH "@CHEMSH_PATH@"
#cmakedefine CHEMSH_TEST "@CHEMSH_TEST@"
// YL 26/02/2021: we can't let "undefined" happen to this variable
#define PYTHONPATH  "@PYTHONPATH@"
#define CHEMSH_SITE_PACKAGES "@CHEMSH_SITE_PACKAGES@"

char *get_arch() {
    const char *buff = CHEMSH_ARCH;
    const int len = strlen(buff);
    char *arch = (char *) malloc(sizeof(char)*(len+1));
    int i;
    for (i=0; i<len; ++i) {
        arch[i] = buff[i];
    }
    arch[len] = *"\0";
    return arch;
}

char *get_path() {
    const char *buff = CHEMSH_PATH;
    const int len = strlen(buff);
    char *path = (char *) malloc(sizeof(char)*(len+1));
    int i;
    for (i=0; i<len; ++i) {
        path[i] = buff[i];
    }
    path[len] = *"\0";
    return path;
}

// YL 26/02/2021: additional PYTHONPATH
char *get_pythonpath() {
    const char *buff = PYTHONPATH;
    const int len = strlen(buff);
    char *path = (char *) malloc(sizeof(char)*(len+1));
    int i;
    for (i=0; i<len; ++i) {
        path[i] = buff[i];
    }
    path[len] = *"\0";
    return path;
}

// YL 19/03/2021: an on-site PYTHONPATH for automatically installed dependencies
char *get_site_packages() {
    const char *buff = CHEMSH_SITE_PACKAGES;
    const int len = strlen(buff);
    char *path = (char *) malloc(sizeof(char)*(len+1));
    int i;
    for (i=0; i<len; ++i) {
        path[i] = buff[i];
    }
    path[len] = *"\0";
    return path;
}

char *get_test() {
    const char *buff = CHEMSH_TEST;
    const int len = strlen(buff);
    char *test = (char *) malloc(sizeof(char)*(len+1));
    int i;
    for (i=0; i<len; ++i) {
        test[i] = buff[i];
    }
    test[len] = *"\0";
    return test;
}


