/** A data value (opaque type). */
typedef struct yasm_dataval yasm_dataval;
-/** A list of data values (opaque type). */
+/** A list of data values. */
typedef struct yasm_datavalhead yasm_datavalhead;
+/** Linked list of data values. */
/*@reldef@*/ STAILQ_HEAD(yasm_datavalhead, yasm_dataval);
/** Add a dependent span for a bytecode.
* A generic fill-in for this is yasm_bc_tobytes_common(), but as this
* function internal errors when called, be very careful when using it!
* \param bc bytecode
- * \param buf byte representation destination buffer
- * \param bufsize size of buf (in bytes) prior to call; size of the
- * generated data after call
- * \param gap if nonzero, indicates the data does not really
- * need to exist in the object file; if nonzero,
- * contents of buf are undefined [output]
+ * \param bufp byte representation destination buffer;
+ * should be incremented as it's written to,
+ * so that on return its delta from the
+ * passed-in buf matches the bytecode length
+ * (it's okay not to do this if an error
+ * indication is returned)
* \param d data to pass to each call to
* output_value/output_reloc
* \param output_value function to call to convert values into their byte
* representation
* \param output_reloc function to call to output relocation entries
* for a single sym
- * \return Newly allocated buffer that should be used instead of buf for
- * reading the byte representation, or NULL if buf was big enough
- * to hold the entire byte representation.
+ * \return Nonzero on error, 0 on success.
* \note May result in non-reversible changes to the bytecode, but it's
* preferable if calling this function twice would result in the
* same output.
* \param headp list of data values
*/
void yasm_dvs_initialize(yasm_datavalhead *headp);
+#ifndef YASM_DOXYGEN
#define yasm_dvs_initialize(headp) STAILQ_INIT(headp)
+#endif
/** Delete (free allocated memory for) a list of data values.
* \param headp list of data values
* \return Newly allocated expression identical to e.
*/
yasm_expr *yasm_expr_copy(const yasm_expr *e);
+#ifndef YASM_DOXYGEN
#define yasm_expr_copy(e) yasm_expr__copy_except(e, -1)
+#endif
/** Destroy (free allocated memory for) an expression.
* \param e expression
typedef struct yasm_reloc yasm_reloc;
struct yasm_reloc {
- /*@reldef@*/ STAILQ_ENTRY(yasm_reloc) link;
+ /*@reldef@*/ STAILQ_ENTRY(yasm_reloc) link; /**< Link to next reloc */
yasm_intnum *addr; /**< Offset (address) within section */
/*@dependent@*/ yasm_symrec *sym; /**< Relocated symbol */
};
* \return Next relocation for section. NULL if no more relocations.
*/
/*@null@*/ yasm_reloc *yasm_section_reloc_next(yasm_reloc *reloc);
+#ifndef YASM_DOXYGEN
#define yasm_section_reloc_next(x) STAILQ_NEXT((x), link)
+#endif
/** Get the basic relocation information for a relocation.
* \param reloc relocation
/*@reldef@*/ STAILQ_ENTRY(yasm_valparam) link; /**< Next pair in list */
/*@owned@*/ /*@null@*/ char *val; /**< Value */
+ /** Parameter type. */
enum yasm_param_type {
YASM_PARAM_ID, /**< Identifier */
YASM_PARAM_STRING, /**< String */
YASM_PARAM_EXPR /**< Expression */
} type; /**< Parameter type */
+ /** Parameter value. */
union yasm_param {
/*@owned@*/ char *id; /**< Identifier */
/*@owned@*/ char *str; /**< String */
/*@owned@*/ yasm_expr *e; /**< Expression */
} param; /**< Parameter */
- /* Prefix character that indicates a raw identifier. When yasm_vp_string()
- * is called on a #YASM_PARAM_ID, all characters are returned. When
- * yasm_vp_id() is called on a #YASM_PARAM_ID, if the identifier begins
- * with this character, this character is stripped from the returned
- * value.
+ /** Prefix character that indicates a raw identifier. When
+ * yasm_vp_string() is called on a #YASM_PARAM_ID, all characters are
+ * returned. When yasm_vp_id() is called on a #YASM_PARAM_ID, if the
+ * identifier begins with this character, this character is stripped
+ * from the returned value.
*/
char id_prefix;
};
* \param headp linked list
*/
void yasm_vps_initialize(/*@out@*/ yasm_valparamhead *headp);
+#ifndef YASM_DOXYGEN
#define yasm_vps_initialize(headp) STAILQ_INIT(headp)
+#endif
/** Destroy (free allocated memory for) linked list of valparams (created with
* yasm_vps_initialize).
* \param vp valparam
*/
void yasm_vps_append(yasm_valparamhead *headp, /*@keep@*/ yasm_valparam *vp);
+#ifndef YASM_DOXYGEN
#define yasm_vps_append(headp, vp) do { \
if (vp) \
STAILQ_INSERT_TAIL(headp, vp, link); \
} while(0)
+#endif
/** Get first valparam in linked list.
* \param headp linked list
*/
/*@null@*/ /*@dependent@*/ yasm_valparam *yasm_vps_first
(yasm_valparamhead *headp);
+#ifndef YASM_DOXYGEN
#define yasm_vps_first(headp) STAILQ_FIRST(headp)
+#endif
/** Get next valparam in linked list.
* \param cur previous valparam in linked list
* \return Next valparam in linked list.
*/
/*@null@*/ /*@dependent@*/ yasm_valparam *yasm_vps_next(yasm_valparam *cur);
+#ifndef YASM_DOXYGEN
#define yasm_vps_next(cur) STAILQ_NEXT(cur, link)
+#endif
/** Iterate through linked list of valparams.
* \internal
* \param iter iterator variable
* \param headp linked list
*/
+#ifndef YASM_DOXYGEN
#define yasm_vps_foreach(iter, headp) STAILQ_FOREACH(iter, headp, link)
+#endif
/** Print linked list of valparams. For debugging purposes.
* \param f file