Welcome to mirror list, hosted at ThFree Co, Russian Federation.

block.c « project « src - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7843407d519e693553cf608493c38fb52a7e7f67 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
 * \file   block.c
 * \brief  The configuration block class.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <assert.h>
#include <stdlib.h>
#include "premake.h"
#include "project/block.h"


struct FieldInfo BlockFieldInfo[] =
{
	{ "defines",    ListField,    NULL  },
	{ "objdir",     StringField,  NULL  },
	{  0,           0,            NULL  }
};


DEFINE_CLASS(Block)
{
	Fields fields;
};


/**
 * Create and initialize a new configuration block.
 * \returns A new configuration block.
 */
Block block_create()
{
	Block blk = ALLOC_CLASS(Block);
	blk->fields = fields_create(BlockFieldInfo);
	return blk;
}


/**
 * Destroy a configuration block and release the associated memory.
 * \param   blk   The configuration block to destroy.
 */
void block_destroy(Block blk)
{
	assert(blk);
	fields_destroy(blk->fields);
	free(blk);
}


/**
 * Retrieve the list of defines associated with a block.
 */
Strings block_get_defines(Block blk)
{
	assert(blk);
	return fields_get_values(blk->fields, BlockDefines);
}


/**
 * Retrieve the fields object for this block; used to unload values from the script.
 */
Fields block_get_fields(Block blk)
{
	assert(blk);
	return blk->fields;
}