Commit 42528fdd authored by Nicolas Denoyelle's avatar Nicolas Denoyelle

Merge branch 'aml-version' into 'master'

Aml version

See merge request !35
parents 41667393 f41a6039
Pipeline #6789 passed with stage
in 18 minutes and 42 seconds
......@@ -34,3 +34,11 @@ High-level building blocks use the low-level ones to provide fancier memory
management facilities, including:
- *dmas:* moving data across areas
- *scratchpads:* using an area as an explicitly managed cache of another one
# Version Management
AML versionning is similar to [semantic versionning](https://semver.org/).
AML version is a string composed of 3 integers separated by a dot: "0.1.0"
The first integer is the major version and all versions with the same
major version are supposed ABI compatible except for major version 0 which is
considered unstable.
# see semver.org for version info
AC_INIT([aml],[0.0.1],[swann@anl.gov])
AC_INIT([aml],[0.0.2],[swann@anl.gov])
# are we in the right source dir ?
AC_CONFIG_SRCDIR([include/aml.h])
......@@ -67,7 +67,7 @@ ac_configure_args="$ac_configure_args \
'--with-install-suffix=-aml'"
AC_CONFIG_SUBDIRS([jemalloc])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_FILES([Makefile
src/Makefile
......
......@@ -32,6 +32,33 @@
#include <aml/utils/bitmap.h>
#include <aml/utils/vector.h>
/*
* If AML_ABI_VERSION != aml_get_major_version(),
* the header is not the same version as linked library.
*/
#define AML_ABI_VERSION (0)
extern const char* aml_version_string;
int aml_get_major_version();
int aml_get_minor_version();
int aml_get_patch_version();
/*******************************************************************************
* General functions:
* Initialize internal structures, cleanup everything at the end.
******************************************************************************/
/*
* Initializes the library.
* "argc": pointer to the main()'s argc argument; contents can get modified.
* "argv": pointer to the main()'s argv argument; contents can get modified.
* Returns 0 if successful; an error code otherwise.
*/
int aml_init(int *argc, char **argv[]);
/*
* Terminates the library.
* Returns 0 if successful; an error code otherwise.
*/
int aml_finalize(void);
/*******************************************************************************
* Forward Declarations:
......@@ -1305,22 +1332,4 @@ void* aml_scratch_baseptr(const struct aml_scratch *scratch);
*/
int aml_scratch_release(struct aml_scratch *scratch, int scratchid);
/*******************************************************************************
* General functions:
* Initialize internal structures, cleanup everything at the end.
******************************************************************************/
/*
* Initializes the library.
* "argc": pointer to the main()'s argc argument; contents can get modified.
* "argv": pointer to the main()'s argv argument; contents can get modified.
* Returns 0 if successful; an error code otherwise.
*/
int aml_init(int *argc, char **argv[]);
/*
* Terminates the library.
* Returns 0 if successful; an error code otherwise.
*/
int aml_finalize(void);
#endif
......@@ -10,9 +10,52 @@
#include "config.h"
#include "aml.h"
#include <string.h>
const char* aml_version_string = VERSION;
int aml_major_version = -1;
int aml_minor_version = -1;
int aml_patch_version = -1;
int aml_get_major_version(){
if(aml_major_version < 0){
char version[strlen(VERSION)+1];
strcpy(version, VERSION);
return atoi(strtok(version, "."));
}
return aml_major_version;
}
int aml_get_minor_version(){
if(aml_major_version < 0){
char version[strlen(VERSION)+1];
strcpy(version, VERSION);
strtok(version, ".");
return atoi(strtok(version, "."));
}
return aml_minor_version;
}
int aml_get_patch_version(){
if(aml_major_version < 0){
char version[strlen(VERSION)+1];
strcpy(version, VERSION);
strtok(version, ".");
strtok(version, ".");
return atoi(strtok(version, "."));
}
return aml_minor_version;
}
int aml_init(int *argc, char **argv[])
{
char version[strlen(VERSION)+1];
strcpy(version, VERSION);
aml_major_version = atoi(strtok(version, "."));
if(aml_major_version != AML_ABI_VERSION)
return -1;
aml_minor_version = atoi(strtok(NULL, "."));
aml_patch_version = atoi(strtok(NULL, "."));
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment