+/* dseg_add_float **************************************************************
+
+ Adds an float value to the data segment. It tries to reuse
+ previously added values.
+
+*******************************************************************************/
+
+s4 dseg_add_float(codegendata *cd, float value)
+{
+ s4 disp;
+
+ /* search the data segment if the value is already stored */
+
+ disp = dseg_find_float(cd, value);
+
+ if (disp != 0)
+ return disp;
+
+ disp = dseg_add_float_intern(cd, value, DSEG_FLAG_READONLY);
+
+ return disp;
+}
+
+
+/* dseg_add_double_intern ******************************************************
+
+ Internal function to add a double value to the data segment.
+
+*******************************************************************************/
+
+static s4 dseg_add_double_intern(codegendata *cd, double value, u4 flags)
+{
+ dsegentry *de;
+
+ /* Increase data segment size, which is also the displacement into
+ the data segment. */
+
+ cd->dseglen = ALIGN(cd->dseglen + 8, 8);
+
+ /* allocate new entry */
+
+ de = DNEW(dsegentry);
+
+ de->type = TYPE_DBL;
+ de->flags = flags;
+ de->disp = -(cd->dseglen);
+ de->val.d = value;
+ de->next = cd->dseg;
+
+ /* insert into the chain */
+
+ cd->dseg = de;
+
+ return de->disp;
+}
+
+
+/* dseg_add_unique_double ******************************************************
+
+ Adds uniquely a double value to the data segment.
+
+*******************************************************************************/
+
+s4 dseg_add_unique_double(codegendata *cd, double value)
+{
+ s4 disp;
+
+ disp = dseg_add_double_intern(cd, value, DSEG_FLAG_UNIQUE);
+
+ return disp;
+}
+
+
+/* dseg_add_double *************************************************************
+
+ Adds a double value to the data segment. It tries to reuse
+ previously added values.
+
+*******************************************************************************/
+
+s4 dseg_add_double(codegendata *cd, double value)
+{
+ s4 disp;
+
+ /* search the data segment if the value is already stored */
+
+ disp = dseg_find_double(cd, value);
+
+ if (disp != 0)
+ return disp;
+
+ disp = dseg_add_double_intern(cd, value, DSEG_FLAG_READONLY);
+
+ return disp;
+}
+
+
+/* dseg_add_address_intern *****************************************************
+
+ Internal function to add an address pointer to the data segment.
+
+*******************************************************************************/
+
+static s4 dseg_add_address_intern(codegendata *cd, void *value, u4 flags)