src/conver.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
#ifndef CONVER_H
#define CONVER_H
#define CONVER_VERSION 0x100D
#define CONVER_DIR ".conver"
#define CONVER_DRAFT_FILE ".conver/draft.txt"
#define CONVER_RELEASE_FILE ".conver/release.txt"
#define CONVER_LEGACY_FILE ".conver/legacy.txt"
#define CONVER_HISTORY_FILE ".conver/history.txt"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdbool.h>
typedef enum conver_result_t {
CONVER_OK = 0,
CONVER_ERR_OPEN = 1,
CONVER_ERR_WRITE = 2,
CONVER_ERR_READ = 3,
CONVER_ERR_ALLOC = 4,
CONVER_ERR_STAT = 5,
CONVER_ERR_MKDIR = 6,
CONVER_ERR_INVALID_VALUE = 7,
CONVER_ERR_NO_DRAFT = 8,
CONVER_ERR_INVALID_DRAFT = 9,
CONVER_ERR_INVALID_RELEASE = 10,
CONVER_ERR_INVALID_DATE = 11,
CONVER_ERR_PAST_DATE = 12,
CONVER_ERR_FUTURE_DATE = 13,
CONVER_ERR_LOW_SCORE = 14,
} conver_result_t;
char *conver_errors[15] = {
"Success",
"Unable to open file.",
"Unable to write file",
"Unable to read file",
"Unable to allocate memory for file",
"Unable to get file/directory information",
"Unable to create directory",
"Invalid value",
"No draft version configured. Please run conver draft",
"Invalid draft version. Please re-run conver draft to fix."
"Invalid release",
"Invalid date",
"Date is in the past",
"Date is in the future",
"Specified score is too low",
};
typedef enum conver_stage_t
{
CONVER_STAGE_PROTOTYPE = 0,
CONVER_STAGE_OPERATIONAL = 1,
CONVER_STAGE_CONSOLIDATED = 2,
CONVER_STAGE_BEDROCK = 3,
} conver_stage_t;
char *conver_stages[4] = {
"Prototype",
"Operational",
"Consolidated",
"Bedrock",
};
typedef enum conver_size_t
{
CONVER_SIZE_S = 0,
CONVER_SIZE_M = 1,
CONVER_SIZE_L = 2,
CONVER_SIZE_X = 3,
} conver_size_t;
char *conver_sizes[4] = {
"Small",
"Medium",
"Large",
"Extra Large",
};
typedef enum conver_compatibility_t
{
CONVER_COMPAT_PRES = 0,
CONVER_COMPAT_BREAK = 1,
} conver_compatibility_t;
char *conver_compatibilities[2] = {
"Preserving",
"Breaking",
};
typedef enum conver_purpose_t
{
CONVER_PURPOSE_MAINT = 0,
CONVER_PURPOSE_ENHANCE = 1,
} conver_purpose_t;
char *conver_purposes[2] = {
"Maintenance",
"Enhancement",
};
typedef struct {
struct tm date;
bool widthdrawn;
uint16_t score;
uint8_t metadata;
char comment[256];
} conver_release_t;
#endif // CONVER_H
|