diff --git a/mps/code/arenacv.c b/mps/code/arenacv.c
index 62f6e788d70..e8b5788e8b9 100644
--- a/mps/code/arenacv.c
+++ b/mps/code/arenacv.c
@@ -339,8 +339,8 @@ static void testPageTable(ArenaClass class, Size size, Addr addr)
Count tractsPerPage;
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size, size);
- MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_ADDR, addr, addr);
+ MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size);
+ MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_ADDR, addr);
MPS_ARGS_DONE(args);
die(ArenaCreate(&arena, class, args), "ArenaCreate");
} MPS_ARGS_END(args);
@@ -378,7 +378,7 @@ static void testSize(Size size)
do {
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size, size);
+ MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size);
MPS_ARGS_DONE(args);
res = ArenaCreate(&arena, class, args);
} MPS_ARGS_END(args);
diff --git a/mps/code/cbs.c b/mps/code/cbs.c
index 14e13b51b01..250f69444de 100644
--- a/mps/code/cbs.c
+++ b/mps/code/cbs.c
@@ -1,7 +1,7 @@
/* cbs.c: COALESCING BLOCK STRUCTURE IMPLEMENTATION
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
*
* .intro: This is a portable implementation of coalescing block
* structures.
@@ -287,8 +287,8 @@ Res CBSInit(Arena arena, CBS cbs, void *owner,
SplayTreeInit(splayTreeOfCBS(cbs), &cbsSplayCompare,
fastFind ? &cbsUpdateNode : NULL);
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, MPS_KEY_MFS_UNIT_SIZE, size, sizeof(CBSBlockStruct));
- MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, size, sizeof(CBSBlockStruct) * 64);
+ MPS_ARGS_ADD(args, MPS_KEY_MFS_UNIT_SIZE, sizeof(CBSBlockStruct));
+ MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, sizeof(CBSBlockStruct) * 64);
MPS_ARGS_DONE(args);
res = PoolCreate(&(cbs->blockPool), arena, PoolClassMFS(), args);
} MPS_ARGS_END(args);
@@ -1658,7 +1658,7 @@ Res CBSDescribe(CBS cbs, mps_lib_FILE *stream)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/dbgpool.c b/mps/code/dbgpool.c
index 88dec0532b6..3d670d8d361 100644
--- a/mps/code/dbgpool.c
+++ b/mps/code/dbgpool.c
@@ -1,7 +1,7 @@
/* dbgpool.c: POOL DEBUG MIXIN
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
* Portions copyright (C) 2002 Global Graphics Software.
*
* .source: design.mps.object-debug
@@ -186,8 +186,8 @@ static Res DebugPoolInit(Pool pool, ArgList args)
/* This pool has to be like the arena control pool: the blocks */
/* allocated must be accessible using void*. */
MPS_ARGS_BEGIN(pcArgs) {
- MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, size, debug->tagSize); /* FIXME: Check this */
- MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, size, debug->tagSize);
+ MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, debug->tagSize); /* FIXME: Check this */
+ MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, debug->tagSize);
MPS_ARGS_DONE(pcArgs);
res = PoolCreate(&debug->tagPool, PoolArena(pool), PoolClassMFS(), pcArgs);
} MPS_ARGS_END(pcArgs);
@@ -687,7 +687,7 @@ void PoolClassMixInDebug(PoolClass class)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/mps.h b/mps/code/mps.h
index 8bf1ee9ce1a..67d1f77738c 100644
--- a/mps/code/mps.h
+++ b/mps/code/mps.h
@@ -1,7 +1,7 @@
/* mps.h: RAVENBROOK MEMORY POOL SYSTEM C INTERFACE
*
* $Id$
- * Copyright (c) 2001-2012 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
* Portions copyright (c) 2002 Global Graphics Software.
*
* THIS HEADER IS NOT DOCUMENTATION.
@@ -123,26 +123,36 @@ extern mps_arg_s mps_args_none[];
extern const struct mps_key_s _mps_key_arena_size;
#define MPS_KEY_ARENA_SIZE (&_mps_key_arena_size)
+#define MPS_KEY_ARENA_SIZE_FIELD() size
extern const struct mps_key_s _mps_key_format;
#define MPS_KEY_FORMAT (&_mps_key_format)
+#define MPS_KEY_FORMAT_FIELD() format
extern const struct mps_key_s _mps_key_chain;
#define MPS_KEY_CHAIN (&_mps_key_chain)
+#define MPS_KEY_CHAIN_FIELD() chain
extern const struct mps_key_s _mps_key_rank;
-#define MPS_KEY_RANK (&_mps_key_rank)
+#define MPS_KEY_RANK (&_mps_key_rank)
+#define MPS_KEY_RANK_FIELD() rank
extern const struct mps_key_s _mps_key_extend_by;
#define MPS_KEY_EXTEND_BY (&_mps_key_extend_by)
+#define MPS_KEY_EXTEND_BY_FIELD() size
extern const struct mps_key_s _mps_key_min_size;
#define MPS_KEY_MIN_SIZE (&_mps_key_min_size)
+#define MPS_KEY_MIN_SIZE_FIELD() size
extern const struct mps_key_s _mps_key_mean_size;
#define MPS_KEY_MEAN_SIZE (&_mps_key_mean_size)
+#define MPS_KEY_MEAN_SIZE_FIELD() size
extern const struct mps_key_s _mps_key_max_size;
#define MPS_KEY_MAX_SIZE (&_mps_key_max_size)
+#define MPS_KEY_MAX_SIZE_FIELD() size
extern const struct mps_key_s _mps_key_align;
#define MPS_KEY_ALIGN (&_mps_key_align)
+#define MPS_KEY_ALIGN_FIELD() align
extern const struct mps_key_s _mps_key_vmw3_top_down;
#define MPS_KEY_VMW3_TOP_DOWN (&_mps_key_vmw3_top_down)
+#define MPS_KEY_VMW3_TOP_DOWN_FIELD() b
/* Maximum length of a keyword argument list. */
#define MPS_ARGS_MAX 32
@@ -153,25 +163,30 @@ extern const struct mps_key_s _mps_key_vmw3_top_down;
unsigned _var##_i = 0; \
BEGIN
-#define MPS_ARGS_ADD(_var, _key, _field, _val) \
+#define MPS_ARGS_ADD_FIELD(_var, _key, _field, _val) \
BEGIN \
- /* TODO: AVER(_var_i < MPS_ARGS_MAX); */ \
+ AVER(_var##_i < MPS_ARGS_MAX); \
_var[_var##_i].key = (_key); \
_var[_var##_i].val._field = (_val); \
++_var##_i; \
END
+#define MPS_ARGS_ADD(_var, _key, _val) \
+ MPS_ARGS_ADD_FIELD(_var, _key, _key##_FIELD(), _val)
+
#define MPS_ARGS_DONE(_var) \
BEGIN \
- /* TODO: AVER(_var##_i < MPS_ARGS_MAX); */ \
+ AVER(_var##_i < MPS_ARGS_MAX); \
_var[_var##_i].key = MPS_KEY_ARGS_END; \
- /* TODO: _var##_i = MPS_ARGS_MAX; */ \
+ _var##_i = MPS_ARGS_MAX; \
END
#define MPS_ARGS_END(_var) \
END; \
END
+#define MPS_ARG(_key, _val) ((mps_arg_s){(_key), {._key##_FIELD() = (_val)}})
+
/* Keep in sync with
* */
@@ -690,6 +705,7 @@ typedef struct mps_pool_debug_option_s {
extern const struct mps_key_s _mps_key_pool_debug_options;
#define MPS_KEY_POOL_DEBUG_OPTIONS (&_mps_key_pool_debug_options)
+#define MPS_KEY_VAL_POOL_DEBUG_OPTIONS pool_debug_options
extern void mps_pool_check_fenceposts(mps_pool_t);
extern void mps_pool_check_free_space(mps_pool_t);
@@ -740,7 +756,7 @@ extern mps_res_t _mps_fix2(mps_ss_t, mps_addr_t *);
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002, 2008 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/mpsacl.h b/mps/code/mpsacl.h
index ec7a21c027a..10f2bddf581 100644
--- a/mps/code/mpsacl.h
+++ b/mps/code/mpsacl.h
@@ -1,7 +1,7 @@
/* mpsacl.h: MEMORY POOL SYSTEM ARENA CLASS "CL"
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
*/
#ifndef mpsacl_h
@@ -12,6 +12,7 @@
/* Client arena base address argument */
extern const struct mps_key_s _mps_key_arena_cl_addr;
#define MPS_KEY_ARENA_CL_ADDR (&_mps_key_arena_cl_addr)
+#define MPS_KEY_ARENA_CL_ADDR_FIELD() addr
extern mps_arena_class_t mps_arena_class_cl(void);
@@ -21,7 +22,7 @@ extern mps_arena_class_t mps_arena_class_cl(void);
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/mpscams.h b/mps/code/mpscams.h
index f8013467a5d..f410c2734dd 100644
--- a/mps/code/mpscams.h
+++ b/mps/code/mpscams.h
@@ -1,7 +1,7 @@
/* mpscams.h: MEMORY POOL SYSTEM CLASS "AMS"
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
* Portions copyright (C) 2002 Global Graphics Software.
*/
@@ -12,6 +12,7 @@
extern const struct mps_key_s _mps_key_ams_support_ambiguous;
#define MPS_KEY_AMS_SUPPORT_AMBIGUOUS (&_mps_key_ams_support_ambiguous)
+#define MPS_KEY_AMS_SUPPORT_AMBIGUOUS_FIELD() b
extern mps_class_t mps_class_ams(void);
extern mps_class_t mps_class_ams_debug(void);
@@ -21,7 +22,7 @@ extern mps_class_t mps_class_ams_debug(void);
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/mpscawl.h b/mps/code/mpscawl.h
index a332c5057f1..5271560b11f 100644
--- a/mps/code/mpscawl.h
+++ b/mps/code/mpscawl.h
@@ -1,7 +1,7 @@
/* mpscaawl.h: MEMORY POOL SYSTEM CLASS "AWL"
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
*/
#ifndef mpscawl_h
@@ -11,6 +11,7 @@
extern const struct mps_key_s _mps_key_awl_find_dependent;
#define MPS_KEY_AWL_FIND_DEPENDENT (&_mps_key_awl_find_dependent)
+#define MPS_KEY_AWL_FIND_DEPENDENT_FIELD() addr_method
extern mps_class_t mps_class_awl(void);
@@ -21,7 +22,7 @@ typedef mps_addr_t (*mps_awl_find_dependent_t)(mps_addr_t addr);
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/mpscmfs.h b/mps/code/mpscmfs.h
index 734fa766d14..87f6e108424 100644
--- a/mps/code/mpscmfs.h
+++ b/mps/code/mpscmfs.h
@@ -1,7 +1,7 @@
/* mpscamfs.h: MEMORY POOL SYSTEM CLASS "MFS"
*
* $Id$
- * Copyright (c) 2001-2012 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
*/
#ifndef mpscmfs_h
@@ -11,6 +11,7 @@
extern const struct mps_key_s _mps_key_mfs_unit_size;
#define MPS_KEY_MFS_UNIT_SIZE (&_mps_key_mfs_unit_size)
+#define MPS_KEY_MFS_UNIT_SIZE_FIELD() size
extern mps_class_t mps_class_mfs(void);
@@ -19,7 +20,7 @@ extern mps_class_t mps_class_mfs(void);
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2012 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/mpscmvff.h b/mps/code/mpscmvff.h
index 6b13af35a22..09164872b76 100644
--- a/mps/code/mpscmvff.h
+++ b/mps/code/mpscmvff.h
@@ -1,7 +1,7 @@
/* mpscmvff.h: MEMORY POOL SYSTEM CLASS "MVFF"
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
*/
#ifndef mpscmvff_h
@@ -11,10 +11,13 @@
extern const struct mps_key_s _mps_key_mvff_slot_high;
#define MPS_KEY_MVFF_SLOT_HIGH (&_mps_key_mvff_slot_high)
+#define MPS_KEY_MVFF_SLOT_HIGH_FIELD() b
extern const struct mps_key_s _mps_key_mvff_arena_high;
#define MPS_KEY_MVFF_ARENA_HIGH (&_mps_key_mvff_arena_high)
+#define MPS_KEY_MVFF_ARENA_HIGH_FIELD() b
extern const struct mps_key_s _mps_key_mvff_first_fit;
#define MPS_KEY_MVFF_FIRST_FIT (&_mps_key_mvff_first_fit)
+#define MPS_KEY_MVFF_FIRST_FIT_FIELD() b
extern size_t mps_mvff_free_size(mps_pool_t mps_pool);
extern size_t mps_mvff_size(mps_pool_t mps_pool);
@@ -26,7 +29,7 @@ extern mps_class_t mps_class_mvff_debug(void);
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/mpscmvt.h b/mps/code/mpscmvt.h
index b02c6173fb1..2237639310b 100644
--- a/mps/code/mpscmvt.h
+++ b/mps/code/mpscmvt.h
@@ -1,7 +1,7 @@
/* mpscmvt.h: MEMORY POOL SYSTEM CLASS "MVT"
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
*/
#ifndef mpscmvt_h
@@ -11,8 +11,10 @@
extern const struct mps_key_s _mps_key_mvt_reserve_depth;
#define MPS_KEY_MVT_RESERVE_DEPTH (&_mps_key_mvt_reserve_depth)
+#define MPS_KEY_MVT_RESERVE_DEPTH_FIELD() count
extern const struct mps_key_s _mps_key_mvt_frag_limit;
#define MPS_KEY_MVT_FRAG_LIMIT (&_mps_key_mvt_frag_limit)
+#define MPS_KEY_MVT_FRAG_LIMIT_FIELD() count
/* The mvt pool class has five extra parameters to mps_pool_create:
* mps_res_t mps_pool_create(mps_pool_t * pool, mps_arena_t arena,
@@ -42,7 +44,7 @@ extern size_t mps_mvt_size(mps_pool_t mps_pool);
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c
index 59c4453c4ff..874b01b2b5d 100644
--- a/mps/code/poolamc.c
+++ b/mps/code/poolamc.c
@@ -1,7 +1,7 @@
/* poolamc.c: AUTOMATIC MOSTLY-COPYING MEMORY POOL CLASS
*
* $Id$
- * Copyright (c) 2001-2012 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
* Portions copyright (C) 2002 Global Graphics Software.
*
* .sources: .
@@ -1171,7 +1171,7 @@ static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn,
genNr = PoolGenNr(&gen->pgen);
SegPrefExpress(&segPrefStruct, SegPrefGen, &genNr);
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, amcKeySegType, p, &gen->type); /* .segtype */
+ MPS_ARGS_ADD_FIELD(args, amcKeySegType, p, &gen->type); /* .segtype */
MPS_ARGS_DONE(args);
res = SegAlloc(&seg, amcSegClassGet(), &segPrefStruct,
alignedSize, pool, withReservoirPermit, args);
@@ -2556,7 +2556,7 @@ static Bool AMCCheck(AMC amc)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2012 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c
index 3014376a8eb..e77256ee236 100644
--- a/mps/code/poolawl.c
+++ b/mps/code/poolawl.c
@@ -1,7 +1,7 @@
/* poolawl.c: AUTOMATIC WEAK LINKED POOL CLASS
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
*
*
* DESIGN
@@ -474,7 +474,7 @@ static Res AWLSegCreate(AWLSeg *awlsegReturn,
SegPrefExpress(&segPrefStruct, SegPrefCollected, NULL);
SegPrefExpress(&segPrefStruct, SegPrefGen, &awl->gen);
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, awlKeySegRankSet, u, rankSet);
+ MPS_ARGS_ADD_FIELD(args, awlKeySegRankSet, u, rankSet);
MPS_ARGS_DONE(args);
res = SegAlloc(&seg, AWLSegClassGet(), &segPrefStruct, size, pool,
reservoirPermit, args);
@@ -1316,7 +1316,7 @@ static Bool AWLCheck(AWL awl)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c
index fc93cc47d0b..b7cf9794361 100644
--- a/mps/code/poolmrg.c
+++ b/mps/code/poolmrg.c
@@ -1,7 +1,7 @@
/* poolmrg.c: MANUAL RANK GUARDIAN POOL
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
* Portions copyright (C) 2002 Global Graphics Software.
*
*
@@ -525,7 +525,7 @@ static Res MRGSegPairCreate(MRGRefSeg *refSegReturn, MRG mrg,
linkseg = Seg2LinkSeg(segLink);
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, mrgKeyLinkSeg, p, linkseg); /* .ref.initarg */
+ MPS_ARGS_ADD_FIELD(args, mrgKeyLinkSeg, p, linkseg); /* .ref.initarg */
MPS_ARGS_DONE(args);
res = SegAlloc(&segRefPart, EnsureMRGRefSegClass(),
SegPrefDefault(), mrg->extendBy, pool,
@@ -877,7 +877,7 @@ PoolClass PoolClassMRG(void)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c
index e827e9d69b6..812d3099266 100644
--- a/mps/code/poolmv.c
+++ b/mps/code/poolmv.c
@@ -1,7 +1,7 @@
/* poolmv.c: MANUAL VARIABLE POOL
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
* Portions copyright (C) 2002 Global Graphics Software.
*
* **** RESTRICTION: This pool may not allocate from the arena control
@@ -241,8 +241,8 @@ static Res MVInit(Pool pool, ArgList args)
}
MPS_ARGS_BEGIN(piArgs) {
- MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, size, blockExtendBy);
- MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, size, sizeof(MVBlockStruct));
+ MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, blockExtendBy);
+ MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(MVBlockStruct));
MPS_ARGS_DONE(piArgs);
res = PoolInit(&mv->blockPoolStruct.poolStruct, arena, PoolClassMFS(), piArgs);
} MPS_ARGS_END(piArgs);
@@ -252,8 +252,8 @@ static Res MVInit(Pool pool, ArgList args)
spanExtendBy = sizeof(MVSpanStruct) * (maxSize/extendBy);
MPS_ARGS_BEGIN(piArgs) {
- MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, size, spanExtendBy);
- MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, size, sizeof(MVSpanStruct));
+ MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, spanExtendBy);
+ MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(MVSpanStruct));
MPS_ARGS_DONE(piArgs);
res = PoolInit(&mv->spanPoolStruct.poolStruct, arena, PoolClassMFS(), piArgs);
} MPS_ARGS_END(piArgs);
@@ -903,7 +903,7 @@ Bool MVCheck(MV mv)
/* C. COPYRIGHT AND LICENSE
*
- * Copyright (C) 2001-2002 Ravenbrook Limited .
+ * Copyright (C) 2001-2013 Ravenbrook Limited .
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
diff --git a/mps/code/poolncv.c b/mps/code/poolncv.c
index c250e84d2cd..ef0b67eb75e 100644
--- a/mps/code/poolncv.c
+++ b/mps/code/poolncv.c
@@ -1,7 +1,7 @@
/* poolncv.c: NULL POOL COVERAGE TEST
*
* $Id$
- * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
+ * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
*/
#include "mpm.h"
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
{
testlib_unused(argc);
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size, 600000);
+ MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 600000);
MPS_ARGS_DONE(args);
testit((ArenaClass)mps_arena_class_vm(), args);
} MPS_ARGS_END(args);
diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c
index 8708db2348d..90269aa2abb 100644
--- a/mps/code/segsmss.c
+++ b/mps/code/segsmss.c
@@ -765,7 +765,7 @@ static void *test(void *arg, size_t s)
die(mps_fmt_create_A(&format, arena, dylan_fmt_A()), "fmt_create");
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format, format);
+ MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
MPS_ARGS_DONE(args);
die(mps_pool_create_k(&pool, arena, mps_class_amst(), args),
"pool_create(amst)");
diff --git a/mps/example/scheme/scheme-advanced.c b/mps/example/scheme/scheme-advanced.c
index 2c86aade2dd..a006f156de8 100644
--- a/mps/example/scheme/scheme-advanced.c
+++ b/mps/example/scheme/scheme-advanced.c
@@ -4471,7 +4471,7 @@ int main(int argc, char *argv[])
/* Create an MPS arena. There is usually only one of these in a process.
It holds all the MPS "global" state and is where everything happens. */
res = mps_arena_create_k(&arena, mps_arena_class_vm(),
- (mps_arg_s[]){{MPS_KEY_ARENA_SIZE, .val.size = 32 * 1024 * 1024},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create arena");
@@ -4489,8 +4489,8 @@ int main(int argc, char *argv[])
/* Create an Automatic Mostly-Copying (AMC) pool to manage the Scheme
objects. This is a kind of copying garbage collector. */
res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(),
- (mps_arg_s[]){{MPS_KEY_CHAIN, .val.chain = obj_chain},
- {MPS_KEY_FORMAT, .val.format = obj_fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_CHAIN, obj_chain),
+ MPS_ARG(MPS_KEY_FORMAT, obj_fmt),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create obj pool");
@@ -4504,8 +4504,8 @@ int main(int argc, char *argv[])
/* Create an Automatic Mostly-Copying Zero-rank (AMCZ) pool to
manage the leaf objects. */
res = mps_pool_create_k(&leaf_pool, arena, mps_class_amcz(),
- (mps_arg_s[]){{MPS_KEY_CHAIN, .val.chain = obj_chain},
- {MPS_KEY_FORMAT, .val.format = obj_fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_CHAIN, obj_chain),
+ MPS_ARG(MPS_KEY_FORMAT, obj_fmt),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create leaf pool");
@@ -4520,19 +4520,19 @@ int main(int argc, char *argv[])
/* Create an Automatic Weak Linked (AWL) pool to manage the hash table
buckets. */
res = mps_pool_create_k(&buckets_pool, arena, mps_class_awl(),
- (mps_arg_s[]){{MPS_KEY_FORMAT, .val.format = buckets_fmt},
- {MPS_KEY_AWL_FIND_DEPENDENT,
- .val.addr_method = buckets_find_dependent},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_FORMAT, buckets_fmt),
+ MPS_ARG(MPS_KEY_AWL_FIND_DEPENDENT,
+ buckets_find_dependent),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create buckets pool");
/* Create allocation points for weak and strong buckets. */
res = mps_ap_create_k(&strong_buckets_ap, buckets_pool,
- (mps_arg_s[]){{MPS_KEY_RANK, .val.rank = mps_rank_exact()},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_RANK, mps_rank_exact()),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create strong buckets allocation point");
res = mps_ap_create_k(&weak_buckets_ap, buckets_pool,
- (mps_arg_s[]){{MPS_KEY_RANK, .val.rank = mps_rank_weak()},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_RANK, mps_rank_weak()),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create weak buckets allocation point");
diff --git a/mps/example/scheme/scheme.c b/mps/example/scheme/scheme.c
index 2bac9c0042d..527d946b9e8 100644
--- a/mps/example/scheme/scheme.c
+++ b/mps/example/scheme/scheme.c
@@ -4392,7 +4392,7 @@ int main(int argc, char *argv[])
/* Create an MPS arena. There is usually only one of these in a process.
It holds all the MPS "global" state and is where everything happens. */
res = mps_arena_create_k(&arena, mps_arena_class_vm(),
- (mps_arg_s[]){{MPS_KEY_ARENA_SIZE, .val.size = 32 * 1024 * 1024},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create arena");
@@ -4410,8 +4410,8 @@ int main(int argc, char *argv[])
/* Create an Automatic Mostly-Copying (AMC) pool to manage the Scheme
objects. This is a kind of copying garbage collector. */
res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(),
- (mps_arg_s[]){{MPS_KEY_CHAIN, .val.chain = obj_chain},
- {MPS_KEY_FORMAT, .val.format = obj_fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_CHAIN, obj_chain),
+ MPS_ARG(MPS_KEY_FORMAT, obj_fmt),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create obj pool");
diff --git a/mps/manual/source/guide/advanced.rst b/mps/manual/source/guide/advanced.rst
index 7ab02a3141d..7ef3a7bea3d 100644
--- a/mps/manual/source/guide/advanced.rst
+++ b/mps/manual/source/guide/advanced.rst
@@ -713,7 +713,7 @@ Finally, we can create the buckets pool and its allocation points::
/* Create an Automatic Weak Linked (AWL) pool to manage the hash table
buckets. */
res = mps_pool_create_k(&buckets_pool, arena, mps_class_awl(),
- (mps_arg_s[]){{MPS_KEY_FORMAT, .val.format = buckets_fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_FORMAT, buckets_fmt),
{MPS_KEY_AWL_FIND_DEPENDENT,
.val.addr_method = buckets_find_dependent},
{MPS_KEY_ARGS_END}});
@@ -721,11 +721,11 @@ Finally, we can create the buckets pool and its allocation points::
/* Create allocation points for weak and strong buckets. */
res = mps_ap_create_k(&strong_buckets_ap, buckets_pool,
- (mps_arg_s[]){{MPS_KEY_RANK, .val.rank = mps_rank_exact()},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_RANK, mps_rank_exact()),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create strong buckets allocation point");
res = mps_ap_create_k(&weak_buckets_ap, buckets_pool,
- (mps_arg_s[]){{MPS_KEY_RANK, .val.rank = mps_rank_weak()},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_RANK, mps_rank_weak()),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create weak buckets allocation point");
@@ -893,8 +893,8 @@ Second, the leaf objects must be allocated on ``leaf_ap`` instead of
/* Create an Automatic Mostly-Copying Zero-rank (AMCZ) pool to
manage the leaf objects. */
res = mps_pool_create_k(&leaf_pool, arena, mps_class_amcz(),
- (mps_arg_s[]){{MPS_KEY_CHAIN, .val.chain = obj_chain},
- {MPS_KEY_FORMAT, .val.format = obj_fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_CHAIN, obj_chain),
+ MPS_ARG(MPS_KEY_FORMAT, obj_fmt),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create leaf pool");
diff --git a/mps/manual/source/guide/lang.rst b/mps/manual/source/guide/lang.rst
index edaee742830..d6d8943cabc 100644
--- a/mps/manual/source/guide/lang.rst
+++ b/mps/manual/source/guide/lang.rst
@@ -176,7 +176,7 @@ Let's reserve 32 megabytes::
mps_res_t res;
res = mps_arena_create_k(&arena, mps_arena_class_vm(),
- (mps_arg_s[]){{MPS_KEY_ARENA_SIZE, .val.size = 32 * 1024 * 1024},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create arena");
@@ -771,8 +771,8 @@ And finally the :term:`pool`::
mps_pool_t obj_pool;
res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(),
- (mps_arg_s[]){{MPS_KEY_CHAIN, .val.chain = obj_chain},
- {MPS_KEY_FORMAT, .val.format = obj_fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_CHAIN, obj_chain),
+ MPS_ARG(MPS_KEY_FORMAT, obj_fmt),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create obj pool");
diff --git a/mps/manual/source/pool/amc.rst b/mps/manual/source/pool/amc.rst
index 7c6c9927aec..376f22752cd 100644
--- a/mps/manual/source/pool/amc.rst
+++ b/mps/manual/source/pool/amc.rst
@@ -103,22 +103,20 @@ AMC interface
When creating an AMC pool, :c:func:`mps_pool_create_k` requires
two :term:`keyword arguments`:
- * :c:macro:`MPS_KEY_FORMAT` (member ``.val.format``; type
- :c:type:`mps_fmt_t`) specifies the :term:`object format` for the
- objects allocated in the pool. The format must provide a
- :term:`scan method`, a :term:`skip method`, a :term:`forward
- method`, an :term:`is-forwarded method` and a :term:`padding
- method`.
+ * :c:macro:`MPS_KEY_FORMAT` (type :c:type:`mps_fmt_t`) specifies
+ the :term:`object format` for the objects allocated in the pool.
+ The format must provide a :term:`scan method`, a :term:`skip
+ method`, a :term:`forward method`, an :term:`is-forwarded
+ method` and a :term:`padding method`.
- * :c:macro:`MPS_KEY_CHAIN` (member ``.val.chain``; type
- :c:type:`mps_chain_t`) specifies the :term:`generation chain`
- for the pool.
+ * :c:macro:`MPS_KEY_CHAIN` (type :c:type:`mps_chain_t`) specifies
+ the :term:`generation chain` for the pool.
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_amc(),
- (mps_arg_s[]){{MPS_KEY_CHAIN, .val.chain = chain},
- {MPS_KEY_FORMAT, .val.format = fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_CHAIN, chain),
+ MPS_ARG(MPS_KEY_FORMAT, fmt),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/amcz.rst b/mps/manual/source/pool/amcz.rst
index c3a01202532..d2cac80ca1e 100644
--- a/mps/manual/source/pool/amcz.rst
+++ b/mps/manual/source/pool/amcz.rst
@@ -62,21 +62,20 @@ AMCZ interface
When creating an AMCZ pool, :c:func:`mps_pool_create_k` requires
two :term:`keyword arguments`:
- * :c:macro:`MPS_KEY_FORMAT` (member ``.val.format``; type
- :c:type:`mps_fmt_t`) specifies the :term:`object format` for the
- objects allocated in the pool. The format must provide a
- :term:`skip method`, a :term:`forward method`, an
- :term:`is-forwarded method` and a :term:`padding method`.
+ * :c:macro:`MPS_KEY_FORMAT` (type :c:type:`mps_fmt_t`) specifies
+ the :term:`object format` for the objects allocated in the pool.
+ The format must provide a :term:`skip method`, a :term:`forward
+ method`, an :term:`is-forwarded method` and a :term:`padding
+ method`.
- * :c:macro:`MPS_KEY_CHAIN` (member ``.val.chain``; type
- :c:type:`mps_chain_t`) specifies the :term:`generation chain`
- for the pool.
+ * :c:macro:`MPS_KEY_CHAIN` (type :c:type:`mps_chain_t`) specifies
+ the :term:`generation chain` for the pool.
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_amcz(),
- (mps_arg_s[]){{MPS_KEY_CHAIN, .val.chain = chain},
- {MPS_KEY_FORMAT, .val.format = fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_CHAIN, chain),
+ MPS_ARG(MPS_KEY_FORMAT, fmt),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/ams.rst b/mps/manual/source/pool/ams.rst
index 0e9cac244c6..523ac6d5d2e 100644
--- a/mps/manual/source/pool/ams.rst
+++ b/mps/manual/source/pool/ams.rst
@@ -106,20 +106,20 @@ AMS interface
When creating an AMS pool, :c:func:`mps_pool_create_k` requires
two :term:`keyword arguments`:
- * :c:macro:`MPS_KEY_FORMAT` (member ``.val.format``; type
- :c:type:`mps_fmt_t`) specifies the :term:`object format` for the
- objects allocated in the pool. The format must provide a
- :term:`scan method` and a :term:`skip method`.
+ * :c:macro:`MPS_KEY_FORMAT` (type :c:type:`mps_fmt_t`) specifies
+ the :term:`object format` for the objects allocated in the pool.
+ The format must provide a :term:`scan method` and a :term:`skip
+ method`.
- * :c:macro:`MPS_KEY_CHAIN` (member ``.val.chain``; type
- :c:type:`mps_chain_t`) specifies the :term:`generation chain`
- for the pool. It must have a single generation.
+ * :c:macro:`MPS_KEY_CHAIN` (type :c:type:`mps_chain_t`) specifies
+ the :term:`generation chain` for the pool. It must have a single
+ generation.
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_ams(),
- (mps_arg_s[]){{MPS_KEY_CHAIN, .val.chain = chain},
- {MPS_KEY_FORMAT, .val.format = fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_CHAIN, chain),
+ MPS_ARG(MPS_KEY_FORMAT, fmt),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/awl.rst b/mps/manual/source/pool/awl.rst
index 61bbd202eed..a5379c321f1 100644
--- a/mps/manual/source/pool/awl.rst
+++ b/mps/manual/source/pool/awl.rst
@@ -321,21 +321,21 @@ AWL interface
When creating an AWL pool, :c:func:`mps_pool_create_k` requires
two :term:`keyword arguments`:
- * :c:macro:`MPS_KEY_FORMAT` (member ``.val.format``; type
- :c:type:`mps_fmt_t`) specifies the :term:`object format` for the
- objects allocated in the pool. The format must provide a :term:`scan
- method` and a :term:`skip method`.
+ * :c:macro:`MPS_KEY_FORMAT` (type :c:type:`mps_fmt_t`) specifies
+ the :term:`object format` for the objects allocated in the pool.
+ The format must provide a :term:`scan method` and a :term:`skip
+ method`.
- * :c:macro:`MPS_KEY_AWL_FIND_DEPENDENT` (member
- ``.val.addr_method``; type :c:type:`mps_awl_find_dependent_t`)
- is a function that specifies how to find the :term:`dependent
- object` for an object in the pool.
+ * :c:macro:`MPS_KEY_AWL_FIND_DEPENDENT` (type
+ :c:type:`mps_awl_find_dependent_t`) is a function that specifies
+ how to find the :term:`dependent object` for an object in the
+ pool.
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_awl(),
- (mps_arg_s[]){{MPS_KEY_FORMAT, .val.format = fmt},
- {MPS_KEY_AWL_FIND_DEPENDENT, .val.addr_method = find_dependent},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_FORMAT, fmt),
+ MPS_ARG(MPS_KEY_AWL_FIND_DEPENDENT, find_dependent),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
@@ -351,18 +351,17 @@ AWL interface
When creating an :term:`allocation point` on an AWL pool,
:c:func:`mps_ap_create_k` requires one keyword argument:
- * :c:macro:`MPS_KEY_RANK` (member ``.val.rank``; type
- :c:type:`mps_rank_t`) specifies the :term:`rank` of references
- in objects allocated on this allocation point. It must be
- :c:func:`mps_rank_exact` (if the objects allocated on this
- allocation point will contain :term:`exact references`), or
- :c:func:`mps_rank_weak` (if the objects will contain :term:`weak
- references (1)`).
+ * :c:macro:`MPS_KEY_RANK` (type :c:type:`mps_rank_t`) specifies
+ the :term:`rank` of references in objects allocated on this
+ allocation point. It must be :c:func:`mps_rank_exact` (if the
+ objects allocated on this allocation point will contain
+ :term:`exact references`), or :c:func:`mps_rank_weak` (if the
+ objects will contain :term:`weak references (1)`).
For example, in :term:`C99`::
res = mps_ap_create_k(&ap, awl_pool,
- (mps_arg_s[]){{MPS_KEY_RANK, .val.rank = mps_rank_weak()},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_RANK, mps_rank_weak()),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/lo.rst b/mps/manual/source/pool/lo.rst
index dad1997a4a1..f826d26b292 100644
--- a/mps/manual/source/pool/lo.rst
+++ b/mps/manual/source/pool/lo.rst
@@ -108,15 +108,14 @@ LO interface
When creating an LO pool, :c:func:`mps_pool_create_k` require one
:term:`keyword argument`:
- * :c:macro:`MPS_KEY_FORMAT` (member ``.val.format``; type
- :c:type:`mps_fmt_t`) specifies the :term:`object format` for the
- objects allocated in the pool. The format must provide a :term:`skip
- method`.
+ * :c:macro:`MPS_KEY_FORMAT` (type :c:type:`mps_fmt_t`) specifies
+ the :term:`object format` for the objects allocated in the pool.
+ The format must provide a :term:`skip method`.
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_lo(),
- (mps_arg_s[]){{MPS_KEY_FORMAT, .val.format = fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_FORMAT, fmt),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/mfs.rst b/mps/manual/source/pool/mfs.rst
index 9c6bf500f7d..d6aa1273907 100644
--- a/mps/manual/source/pool/mfs.rst
+++ b/mps/manual/source/pool/mfs.rst
@@ -80,24 +80,22 @@ MFS interface
When creating an MFS pool, :c:func:`mps_pool_create_k` requires
two :term:`keyword arguments`:
- * :c:macro:`MPS_KEY_MFS_UNIT_SIZE` (member ``.val.size``; type
- :c:type:`size_t`) is the :term:`size` of blocks that will be
- allocated from this pool, in :term:`bytes (1)`. It must be at
- least one :term:`word`.
+ * :c:macro:`MPS_KEY_MFS_UNIT_SIZE` (type :c:type:`size_t`) is the
+ :term:`size` of blocks that will be allocated from this pool, in
+ :term:`bytes (1)`. It must be at least one :term:`word`.
- * :c:macro:`MPS_KEY_EXTEND_BY` (member ``.val.size``; type
- :c:type:`size_t`) is the :term:`size` of segment that the pool
- will request from the :term:`arena`. It must be at least as big
- as the unit size specified by the
- :c:macro:`MPS_KEY_MFS_UNIT_SIZE` keyword argument. If this is
- not a multiple of the unit size, there will be wasted space in
- each segment.
+ * :c:macro:`MPS_KEY_EXTEND_BY` (type :c:type:`size_t`) is the
+ :term:`size` of segment that the pool will request from the
+ :term:`arena`. It must be at least as big as the unit size
+ specified by the :c:macro:`MPS_KEY_MFS_UNIT_SIZE` keyword
+ argument. If this is not a multiple of the unit size, there will
+ be wasted space in each segment.
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_mfs(),
- (mps_arg_s[]){{MPS_KEY_MFS_UNIT_SIZE, .val.size = 1024},
- {MPS_KEY_EXTEND_BY, .val.size = 1024 * 1024},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_MFS_UNIT_SIZE, 1024),
+ MPS_ARG(MPS_KEY_EXTEND_BY, 1024 * 1024),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/mv.rst b/mps/manual/source/pool/mv.rst
index dccb5abe0ee..815534e7934 100644
--- a/mps/manual/source/pool/mv.rst
+++ b/mps/manual/source/pool/mv.rst
@@ -75,17 +75,17 @@ MV interface
When creating an MV pool, :c:func:`mps_pool_create_k` requires
three :term:`keyword arguments`:
- * :c:macro:`MPS_KEY_EXTEND_BY` (member ``.val.size``; type
- :c:type:`size_t`) is the :term:`size` of segment that the pool
- will request from the :term:`arena`.
+ * :c:macro:`MPS_KEY_EXTEND_BY` (type :c:type:`size_t`) is the
+ :term:`size` of segment that the pool will request from the
+ :term:`arena`.
- * :c:macro:`MPS_KEY_MEAN_SIZE` (member ``.val.size``; type
- :c:type:`size_t`) is the predicted mean size of blocks that
- will be allocated from the pool.
+ * :c:macro:`MPS_KEY_MEAN_SIZE` (type :c:type:`size_t`) is the
+ predicted mean size of blocks that will be allocated from the
+ pool.
- * :c:macro:`MPS_KEY_MAX_SIZE` (member ``.val.size``; type
- :c:type:`size_t`) is the predicted maximum size of blocks that
- will be allocated from the pool.
+ * :c:macro:`MPS_KEY_MAX_SIZE` (type :c:type:`size_t`) is the
+ predicted maximum size of blocks that will be allocated from the
+ pool.
The mean and maximum sizes are *hints* to the MPS: the pool will be
less efficient if these are wrong, but nothing will break.
@@ -93,9 +93,9 @@ MV interface
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_mfs(),
- (mps_arg_s[]){{MPS_KEY_MEAN_SIZE, .val.size = 32},
- {MPS_KEY_MAX_SIZE, .val.size = 1024},
- {MPS_KEY_EXTEND_BY, .val.size = 1024 * 1024},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_MEAN_SIZE, 32),
+ MPS_ARG(MPS_KEY_MAX_SIZE, 1024),
+ MPS_ARG(MPS_KEY_EXTEND_BY, 1024 * 1024),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/mvff.rst b/mps/manual/source/pool/mvff.rst
index df91ab9007c..bca01de026f 100644
--- a/mps/manual/source/pool/mvff.rst
+++ b/mps/manual/source/pool/mvff.rst
@@ -115,44 +115,43 @@ MVFF interface
When creating an MVFF pool, :c:func:`mps_pool_create_k` requires
six :term:`keyword arguments`:
- * :c:macro:`MPS_KEY_EXTEND_BY` (member ``.val.size``; type
- :c:type:`size_t`) is the :term:`size` of segment that the pool
- will request from the :term:`arena`.
+ * :c:macro:`MPS_KEY_EXTEND_BY` (type :c:type:`size_t`) is the
+ :term:`size` of segment that the pool will request from the
+ :term:`arena`.
- * :c:macro:`MPS_KEY_MEAN_SIZE` (member ``.val.size``; type
- :c:type:`size_t`) is the predicted mean size of blocks that will
- be allocated from the pool. This is a *hint* to the MPS: the
- pool will be less efficient if this is wrong, but nothing will
- break.
+ * :c:macro:`MPS_KEY_MEAN_SIZE` (type :c:type:`size_t`) is the
+ predicted mean size of blocks that will be allocated from the
+ pool. This is a *hint* to the MPS: the pool will be less
+ efficient if this is wrong, but nothing will break.
- * :c:macro:`MPS_KEY_ALIGN` (member ``.val.align``; type
- :c:type:`mps_align_t`) is the :term:`alignment` of addresses for
- allocation (and freeing) in the pool. If an unaligned size is
- passed to :c:func:`mps_alloc` or :c:func:`mps_free`, it will be
- rounded up to the pool's alignment. The minimum alignment
- supported by pools of this class is ``sizeof(void *)``.
+ * :c:macro:`MPS_KEY_ALIGN` (type :c:type:`mps_align_t`) is the
+ :term:`alignment` of addresses for allocation (and freeing) in
+ the pool. If an unaligned size is passed to :c:func:`mps_alloc`
+ or :c:func:`mps_free`, it will be rounded up to the pool's
+ alignment. The minimum alignment supported by pools of this
+ class is ``sizeof(void *)``.
- * :c:macro:`MPS_KEY_MVFF_ARENA_HIGH` (member ``.val.b``; type
- :c:type:`mps_bool_t`) indicates whether new segments for
- buffered allocation are acquired at high addresses (if true), or
- at low addresses (if false).
+ * :c:macro:`MPS_KEY_MVFF_ARENA_HIGH` (type :c:type:`mps_bool_t`)
+ indicates whether new segments for buffered allocation are
+ acquired at high addresses (if true), or at low addresses (if
+ false).
- * :c:macro:`MPS_KEY_MVFF_SLOT_HIGH` (member ``.val.b``; type
- :c:type:`mps_bool_t`) is undocumented. It must have the same
- value as :c:macro:`MPS_KEY_MVFF_ARENA_HIGH`.
+ * :c:macro:`MPS_KEY_MVFF_SLOT_HIGH` (type :c:type:`mps_bool_t`) is
+ undocumented. It must have the same value as
+ :c:macro:`MPS_KEY_MVFF_ARENA_HIGH`.
- * :c:macro:`MPS_KEY_MVFF_FIRST_FIT` (member ``.val.b``; type
- :c:type:`mps_bool_t`) is undocumented and must be set to true.
+ * :c:macro:`MPS_KEY_MVFF_FIRST_FIT` (type :c:type:`mps_bool_t`) is
+ undocumented and must be set to true.
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_mvff(),
- (mps_arg_s[]){{MPS_KEY_EXTEND_BY, .val.size = },
- {MPS_KEY_MEAN_SIZE, .val.size = },
- {MPS_KEY_ALIGN, .val.align = },
- {MPS_KEY_MVFF_ARENA_HIGH, .val.b = 0},
- {MPS_KEY_MVFF_SLOT_HIGH, .val.b = 0},
- {MPS_KEY_MVFF_FIRST_FIT, .val.b = 1},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_EXTEND_BY, 1024 * 1024),
+ MPS_ARG(MPS_KEY_MEAN_SIZE, 32),
+ MPS_ARG(MPS_KEY_ALIGN, 8),
+ MPS_ARG(MPS_KEY_MVFF_ARENA_HIGH, 0),
+ MPS_ARG(MPS_KEY_MVFF_SLOT_HIGH, 0),
+ MPS_ARG(MPS_KEY_MVFF_FIRST_FIT, 1),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/mvt.rst b/mps/manual/source/pool/mvt.rst
index b670c96998e..2fa90a802c8 100644
--- a/mps/manual/source/pool/mvt.rst
+++ b/mps/manual/source/pool/mvt.rst
@@ -115,30 +115,30 @@ MVT interface
When creating an MVT pool, :c:func:`mps_pool_create_k` requires
five :term:`keyword arguments`:
- * :c:macro:`MPS_KEY_MIN_SIZE` (member ``.val.size``; type
- :c:type:`size_t`) is the predicted minimum size of blocks that
- will be allocated from the pool.
+ * :c:macro:`MPS_KEY_MIN_SIZE` (type :c:type:`size_t`) is the
+ predicted minimum size of blocks that will be allocated from the
+ pool.
- * :c:macro:`MPS_KEY_MEAN_SIZE` (member ``.val.size``; type
- :c:type:`size_t`) is the predicted mean size of blocks that will
- be allocated from the pool.
+ * :c:macro:`MPS_KEY_MEAN_SIZE` (type :c:type:`size_t`) is the
+ predicted mean size of blocks that will be allocated from the
+ pool.
- * :c:macro:`MPS_KEY_MAX_SIZE` (member ``.val.size``; type
- :c:type:`size_t`) is the predicted maximum size of blocks that
- will be allocated from the pool. Partial freeing is not
- supported for blocks larger than this; doing so will
- result in the storage of the block never being reused.
+ * :c:macro:`MPS_KEY_MAX_SIZE` (type :c:type:`size_t`) is the
+ predicted maximum size of blocks that will be allocated from the
+ pool. Partial freeing is not supported for blocks larger than
+ this; doing so will result in the storage of the block never
+ being reused.
These three arguments are *hints* to the MPS: the pool will be
less efficient if they are wrong, but the only thing that will
break is the partial freeing of large blocks.
- * :c:macro:`MPS_KEY_MVT_RESERVE_DEPTH` (member ``.val.count``;
- type :c:type:`mps_count_t`) is the expected hysteresis of the
+ * :c:macro:`MPS_KEY_MVT_RESERVE_DEPTH` (type
+ :c:type:`mps_count_t`) is the expected hysteresis of the
population of the pool. When blocks are freed, the pool will
- retain sufficient storage to allocate this many blocks of the mean
- size for near term allocations (rather than immediately making
- that storage available to other pools).
+ retain sufficient storage to allocate this many blocks of the
+ mean size for near term allocations (rather than immediately
+ making that storage available to other pools).
If a pool has a stable population, or one which only grows over
the lifetime of the pool, or one which grows steadily and then
@@ -158,17 +158,16 @@ MVT interface
object population does vary, at a slight cost in efficiency. The
reserve does not guarantee any particular amount of allocation.
- * :c:macro:`MPS_KEY_MVT_FRAG_LIMIT` (member ``.val.count``; type
- :c:type:`mps_count_t`) is a percentage from 1 to 100
- (inclusive). It sets an upper limit on the space overhead of an
- MVT pool, in case block death times and allocations do not
- correlate well. If the free space managed by the pool as a ratio
- of all the space managed by the pool exceeds the fragmentation
- limit, the pool falls back to a first fit allocation policy,
- exploiting space more efficiently at a cost in time efficiency.
- A fragmentation limit of 0 would cause the pool to operate as a
- first-fit pool, at a significant cost in time efficiency:
- therefore this is not permitted.
+ * :c:macro:`MPS_KEY_MVT_FRAG_LIMIT` (type :c:type:`mps_count_t`)
+ is a percentage from 1 to 100 (inclusive). It sets an upper
+ limit on the space overhead of an MVT pool, in case block death
+ times and allocations do not correlate well. If the free space
+ managed by the pool as a ratio of all the space managed by the
+ pool exceeds the fragmentation limit, the pool falls back to a
+ first fit allocation policy, exploiting space more efficiently
+ at a cost in time efficiency. A fragmentation limit of 0 would
+ cause the pool to operate as a first-fit pool, at a significant
+ cost in time efficiency: therefore this is not permitted.
A fragmentation limit of 100 causes the pool to always use
temporal fit (unless resources are exhausted). If the objects
@@ -182,11 +181,11 @@ MVT interface
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_mvt(),
- (mps_arg_s[]){{MPS_KEY_MIN_SIZE, .val.size = 4},
- {MPS_KEY_MEAN_SIZE, .val.size = 32},
- {MPS_KEY_MAX_SIZE, .val.size = 1024},
- {MPS_KEY_MVT_RESERVE_DEPTH, .val.count = 256},
- {MPS_KEY_MVT_FRAG_LIMIT, .val.count = 50},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_MIN_SIZE, 4),
+ MPS_ARG(MPS_KEY_MEAN_SIZE, 32),
+ MPS_ARG(MPS_KEY_MAX_SIZE, 1024),
+ MPS_ARG(MPS_KEY_MVT_RESERVE_DEPTH, 256),
+ MPS_ARG(MPS_KEY_MVT_FRAG_LIMIT, 50),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/pool/snc.rst b/mps/manual/source/pool/snc.rst
index 04fd8d548ee..805beb0e892 100644
--- a/mps/manual/source/pool/snc.rst
+++ b/mps/manual/source/pool/snc.rst
@@ -98,16 +98,15 @@ SNC introspection
When creating an SNC pool, :c:func:`mps_pool_create_k` requires one
:term:`keyword argument`:
- * :c:macro:`MPS_KEY_FORMAT` (member ``.val.format``; type
- :c:type:`mps_fmt_t`) specifies the :term:`object format` for the
- objects allocated in the pool. The format must provide a
- :term:`scan method`, a :term:`skip method`, and a :term:`padding
- method`.
+ * :c:macro:`MPS_KEY_FORMAT` (type :c:type:`mps_fmt_t`) specifies
+ the :term:`object format` for the objects allocated in the pool.
+ The format must provide a :term:`scan method`, a :term:`skip
+ method`, and a :term:`padding method`.
For example, in :term:`C99`::
res = mps_pool_create_k(&pool, arena, mps_class_snc(),
- (mps_arg_s[]){{MPS_KEY_FORMAT, .val.format = fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_FORMAT, fmt),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
@@ -122,15 +121,14 @@ SNC introspection
When creating an :term:`allocation point` on an SNC pool,
:c:func:`mps_ap_create_k` requires one keyword argument:
- * :c:macro:`MPS_KEY_RANK` (member ``.val.rank``; type
- :c:type:`mps_rank_t`) specifies the :term:`rank` of references
- in objects allocated on this allocation point. It must be
- :c:func:`mps_rank_exact`.
+ * :c:macro:`MPS_KEY_RANK` (type :c:type:`mps_rank_t`) specifies
+ the :term:`rank` of references in objects allocated on this
+ allocation point. It must be :c:func:`mps_rank_exact`.
For example, in :term:`C99`::
res = mps_ap_create_k(&ap, awl_pool,
- (mps_arg_s[]){{MPS_KEY_RANK, .val.rank = mps_rank_exact()},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_RANK, mps_rank_exact()),
{MPS_KEY_ARGS_END}});
.. deprecated:: starting with version 1.112.
diff --git a/mps/manual/source/topic/arena.rst b/mps/manual/source/topic/arena.rst
index 264ae0409b1..4dbbdcc9925 100644
--- a/mps/manual/source/topic/arena.rst
+++ b/mps/manual/source/topic/arena.rst
@@ -158,18 +158,18 @@ Client arenas
When creating a client arena, :c:func:`mps_arena_create_k` requires two
:term:`keyword arguments`:
- * :c:macro:`MPS_KEY_ARENA_CL_ADDR` (member ``.val.addr``; type
- :c:type:`mps_addr_t`) is the :term:`address` of the chunk of memory
- that will be managed by the arena.
+ * :c:macro:`MPS_KEY_ARENA_CL_ADDR` (type :c:type:`mps_addr_t`) is
+ the :term:`address` of the chunk of memory that will be managed
+ by the arena.
- * :c:macro:`MPS_KEY_ARENA_SIZE` (member ``.val.size``; type
- :c:type:`size_t`) is its size.
+ * :c:macro:`MPS_KEY_ARENA_SIZE` (type :c:type:`size_t`) is its
+ size.
For example (in :term:`C99`)::
res = mps_arena_create_k(&arena, mps_arena_class_cl(),
- (mps_arg_s[]){{MPS_KEY_ARENA_CL_ADDR, .val.addr = base},
- {MPS_KEY_ARENA_SIZE, .val.size = size},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_ARENA_CL_ADDR, base),
+ MPS_ARG(MPS_KEY_ARENA_SIZE, size),
{MPS_KEY_ARGS_END}});
If the chunk is too small to hold the internal arena structures,
@@ -234,46 +234,36 @@ Virtual memory arenas
When creating a virtual memory arena, :c:func:`mps_arena_create_k`
requires one :term:`keyword argument`:
- * :c:macro:`MPS_KEY_ARENA_SIZE` (member ``.val.size``; type
- :c:type:`size_t`).
+ * :c:macro:`MPS_KEY_ARENA_SIZE` (type :c:type:`size_t`). is the
+ initial amount of virtual address space, in :term:`bytes (1)`,
+ that the arena will reserve (this space is initially reserved so
+ that the arena can subsequently use it without interference from
+ other parts of the program, but most of it is not committed, so
+ it doesn't require any RAM or backing store). The arena may
+ allocate more virtual address space beyond this initial
+ reservation as and when it deems it necessary. The MPS is most
+ efficient if you reserve an address space that is several times
+ larger than your peak memory usage.
- For example (in :term:`C99`)::
+ .. note::
- res = mps_arena_create_k(&arena, mps_arena_class_cl(),
- (mps_arg_s[]){{MPS_KEY_ARENA_SIZE, .val.size = size},
- {MPS_KEY_ARGS_END}});
-
- ``size`` is the initial amount of virtual address space, in
- :term:`bytes (1)`, that the arena will reserve (this space is
- initially reserved so that the arena can subsequently use it
- without interference from other parts of the program, but most of
- it is not committed, so it doesn't require any RAM or backing
- store). The arena may allocate more virtual address space beyond
- this initial reservation as and when it deems it necessary. The
- MPS is most efficient if you reserve an address space that is
- several times larger than your peak memory usage.
-
- .. note::
-
- The MPS asks for more address space if it runs out, but the
- more times it has to extend its address space, the less
- efficient garbage collection will become.
+ The MPS asks for more address space if it runs out, but the
+ more times it has to extend its address space, the less
+ efficient garbage collection will become.
An optional :term:`keyword argument` may be passed, but is
only used on the Windows operating system:
- * :c:macro:`MPS_KEY_VMW3_TOP_DOWN` (member ``.val.b``; type
- :c:type:`mps_bool_t`).
+ * :c:macro:`MPS_KEY_VMW3_TOP_DOWN` (type :c:type:`mps_bool_t`). If
+ true, the arena will allocate address space starting at the
+ highest possible address and working downwards through memory.
- If true, the arena will allocate address space starting at the
- highest possible address and working downwards through memory.
+ .. note::
- .. note::
+ This causes the arena to pass the ``MEM_TOP_DOWN`` flag to
+ `VirtualAlloc`_.
- This causes the arena to pass the ``MEM_TOP_DOWN`` flag to
- `VirtualAlloc`_.
-
- .. _VirtualAlloc: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366887%28v=vs.85%29.aspx
+ .. _VirtualAlloc: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366887%28v=vs.85%29.aspx
If the MPS fails to reserve adequate address space to place the
arena in, :c:func:`mps_arena_create_k` returns
@@ -285,6 +275,12 @@ Virtual memory arenas
:c:macro:`MPS_RES_MEMORY`. Either ``size`` was far too small or
the operating system refused to provide enough memory.
+ For example (in :term:`C99`)::
+
+ res = mps_arena_create_k(&arena, mps_arena_class_cl(),
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_ARENA_SIZE, size),
+ {MPS_KEY_ARGS_END}});
+
.. deprecated:: starting with version 1.112.
When using :c:func:`mps_arena_create`, pass the size like
diff --git a/mps/manual/source/topic/debugging.rst b/mps/manual/source/topic/debugging.rst
index 32524d7869e..c7c372e3b2b 100644
--- a/mps/manual/source/topic/debugging.rst
+++ b/mps/manual/source/topic/debugging.rst
@@ -72,9 +72,9 @@ For example::
mps_pool_t pool;
mps_res_t res;
res = mps_pool_create_k(&pool, arena, mps_class_ams_debug(),
- (mps_arg_s[]){{MPS_KEY_POOL_DEBUG_OPTIONS, .val.pool_debug_options = &debug_options},
- {MPS_KEY_FORMAT, .val.format = &fmt},
- {MPS_KEY_CHAIN, .val.chain = &chain},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_POOL_DEBUG_OPTIONS, &debug_options),
+ MPS_ARG(MPS_KEY_FORMAT, &fmt),
+ MPS_ARG(MPS_KEY_CHAIN, &chain),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("can't create debug pool");
diff --git a/mps/manual/source/topic/format.rst b/mps/manual/source/topic/format.rst
index f3b4fd330bd..fd91f19e823 100644
--- a/mps/manual/source/topic/format.rst
+++ b/mps/manual/source/topic/format.rst
@@ -93,7 +93,7 @@ For example::
/* obj_fmt created successfully */
res = mps_pool_create_k(&obj_pool, arena, pool_class,
- (mps_arg_s[]){{MPS_KEY_FORMAT, .val.format = obj_fmt},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_FORMAT, obj_fmt),
{MPS_KEY_ARGS_END}});
if (res != MPS_RES_OK) error("Couldn't create obj pool");
diff --git a/mps/manual/source/topic/keyword.rst b/mps/manual/source/topic/keyword.rst
index 1acf73e34bf..74c5f17e662 100644
--- a/mps/manual/source/topic/keyword.rst
+++ b/mps/manual/source/topic/keyword.rst
@@ -30,19 +30,20 @@ For convenience and robustness, the MPS interface includes macros to
help with forming keyword argument lists::
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size, 6553600);
- MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_ADDR, addr, base_address);
+ MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 6553600);
+ MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_ADDR, base_address);
MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_cl(), args);
} MPS_ARGS_END(args);
-But if you are writing :term:`C99`, you can write this more concisely as::
+But if you are writing :term:`C99`, you can write this more concisely
+using the helper macro :c:func:`MPS_ARG`::
mps_res_t res;
mps_arena_t arena;
res = mps_arena_create_k(&arena, mps_arena_class_cl(),
- (mps_arg_s[]){{MPS_KEY_ARENA_SIZE, .val.size = 6553600},
- {MPS_KEY_ARENA_CL_ADDR, .val.addr = base_address},
+ (mps_arg_s[]){MPS_ARG(MPS_KEY_ARENA_SIZE, 6553600),
+ MPS_ARG(MPS_KEY_ARENA_CL_ADDR, base_address),
{MPS_KEY_ARGS_END}});
The argument array must not be ``NULL``, and must end with
@@ -87,9 +88,15 @@ now :c:macro:`MPS_KEY_ARGS_END`.
``key`` identifies the key. It must be one of the legal values
of :c:type:`mps_key_t` listed in the documentation for that type.
- ``val`` is the corresponding value. The documentation for each
- value of the type :c:type:`mps_key_t` explains which structure
- member is used by that keyword.
+ ``val`` is the corresponding value. The table given in the
+ documentation for :c:type:`mps_key_t` explains which structure
+ field is used by that keyword.
+
+ .. note::
+
+ If you use the convenience macros :c:func:`MPS_ARGS_ADD` and
+ :c:func:`MPS_ARG` you don't need to know the name of the
+ field.
.. c:macro:: mps_args_none
@@ -106,7 +113,7 @@ now :c:macro:`MPS_KEY_ARGS_END`.
following values:
======================================== ====================== ==========================================================
- Keyword Value slot See
+ Keyword Field See
======================================== ====================== ==========================================================
:c:macro:`MPS_KEY_ARGS_END` *none* *see above*
:c:macro:`MPS_KEY_ALIGN` ``align`` :c:func:`mps_class_mvff`
@@ -138,15 +145,16 @@ now :c:macro:`MPS_KEY_ARGS_END`.
be used like this::
MPS_ARGS_BEGIN(args) {
- MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size, 6553600);
- MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_ADDR, addr, base_address);
+ MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 6553600);
+ MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_ADDR, base_address);
MPS_ARGS_DONE(args);
res = mps_arena_create_k(&arena, mps_arena_class_cl(), args);
} MPS_ARGS_END(args);
- That is, you must call :c:func:`MPS_ARGS_ADD` zero or more times,
- and then call :c:func:`MPS_ARGS_DONE` before passing the arguments
- to a function.
+ That is, you must call :c:func:`MPS_ARGS_ADD` (or
+ :c:func:`MPS_ARGS_ADD_FIELD`) zero or more times, and then call
+ :c:func:`MPS_ARGS_DONE` before passing the arguments to a
+ function.
``args`` is the name of the array that contains the keyword
arguments. The array is stack-allocated, and exists between
@@ -166,6 +174,35 @@ now :c:macro:`MPS_KEY_ARGS_END`.
It must match the argument to the preceding call to
:c:func:`MPS_ARGS_BEGIN`.
+ ``key`` is the keyword identifying this argument. It must be one
+ of the key names starting with ``MPS_KEY_`` that are listed in the
+ table in the documentation for :c:type:`mps_key_t`.
+
+ ``value`` is the value for this argument.
+
+
+.. c:function:: MPS_ARGS_ADD_FIELD(mps_arg_s args[], mps_key_t key, field, value)
+
+ Add an argument to a list of keyword arguments. This macro must be
+ used only between :c:macro:`MPS_ARGS_BEGIN` and
+ :c:macro:`MPS_ARGS_END`.
+
+ ``args`` is the name of array that contains the keyword arguments.
+ It must match the argument to the preceding call to
+ :c:func:`MPS_ARGS_BEGIN`.
+
+ ``key`` is the keyword identifying this argument.
+
+ ``field`` is the name of the field in the ``val`` union in the
+ structure :c:type:`mps_args_s`.
+
+ ``value`` is the value for this argument.
+
+ .. note::
+
+ You should prefer to use :c:func:`MPS_ARGS_ADD`, because then
+ you don't need to look up the name of the field.
+
.. c:function:: MPS_ARGS_DONE(args)