Agar

<-- Back to AG_Intro.3

SYNOPSIS

#include <agar/core.h>

DESCRIPTION

The agar AG_Version interface encodes or decodes versioning information. This includes a magic string and two 32-bit version numbers:
typedef struct ag_version {
	Uint32 major, minor;
} AG_Version;

The major is incremented whenever a change introduces binary incompatibility with previous versions of the data files.

The minor member is incremented whenever a change is made in the data file, but binary compatibility is preserved.

Major changes that would otherwise break binary compatibility can be dealt with by increasing only the minor version number and adding compatibility code in the loader routine.

VERSIONING


int AG_ReadVersion (AG_DataSource *ds, const char *magic, const AG_Version *ver, AG_Version *rver)

void AG_WriteVersion (AG_DataSource *ds, const char *magic, const AG_Version *ver)

int AG_ReadObjectVersion (AG_DataSource *ds, AG_Object *obj)

void AG_WriteObjectVersion (AG_DataSource *ds, const AG_Object *obj)


The AG_ReadVersion() function reads version information from fd and returns 0 if the following data is binary compatible against the version represented by ver, or -1 if the data is not compatible. If rver is not NULL, it is initialized with the version information read from fd.

The AG_WriteVersion() function writes version information from the structure ver to ds.

The AG_ReadObjectVersion() and AG_WriteObjectVersion() variants use the version information contained in the AG_ObjectClass structure of AG_Object(3), using the name of the object class as a signature.

SEE ALSO

AG_DataSource(3), AG_Intro(3)

HISTORY

The AG_Version interface first appeared in Agar 1.0

Csoft.net ElectronTubeStore.com