summaryrefslogtreecommitdiffstats
path: root/src/opt.c
blob: 82e1be189e5e25b1a91ebe82088363d293e0de54 (plain)
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
#include <stdio.h>

#include "internal.h"
#include "opt.h"

rcc_option_value rccGetOption(rcc_context ctx, rcc_option option) {
    if ((!ctx)||(option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
    
    return ctx->options[option];
}

int rccOptionIsDefault(rcc_context ctx, rcc_option option) {
    if ((!ctx)||(option<0)||(option>=RCC_MAX_OPTIONS)) return -1;

    return ctx->default_options[option];
}

int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value) {
    if ((!ctx)||(option>=RCC_MAX_OPTIONS)) return -1;

    ctx->default_options[option] = 0;

    if (ctx->options[option] != value) {
	ctx->configure = 1;
	ctx->options[option]=value;
    }
    
    return 0;
}

int rccOptionSetDefault(rcc_context ctx, rcc_option option) {
    rcc_option_value value;
    if ((!ctx)||(option>=RCC_MAX_OPTIONS)) return -1;

    ctx->default_options[option] = 1;
    value = rccGetOptionDefaultValue(option);

    if (ctx->options[option] != value) {
	ctx->configure = 1;
	ctx->options[option]=value;
    }
    
    return 0;
}