\f
/* Interval allocation. */
-#ifdef USE_TEXT_PROPERTIES
#define INTERVAL_BLOCK_SIZE \
((1020 - sizeof (struct interval_block *)) / sizeof (struct interval))
} \
}
-#else /* no interval use */
-
-#define INIT_INTERVALS
-
-#define UNMARK_BALANCE_INTERVALS(i)
-#define MARK_INTERVAL_TREE(i)
-
-#endif /* no interval use */
\f
/* Floating point allocation. */
/* We must give strings in pure storage some kind of interval. So we
give them a null one. */
-#if defined (USE_TEXT_PROPERTIES)
XSTRING (new)->intervals = NULL_INTERVAL;
-#endif
pureptr += size;
return new;
}
(make_number (0), make_number (0)),
#endif /* not LISP_FLOAT_TYPE */
Fcons (Fcons
-#ifdef USE_TEXT_PROPERTIES
(make_number (total_intervals),
make_number (total_free_intervals)),
-#else /* not USE_TEXT_PROPERTIES */
- (make_number (0), make_number (0)),
-#endif /* not USE_TEXT_PROPERTIES */
Qnil)))))));
}
\f
}
#endif /* LISP_FLOAT_TYPE */
-#ifdef USE_TEXT_PROPERTIES
/* Put all unmarked intervals on free list */
{
register struct interval_block *iblk;
total_intervals = num_used;
total_free_intervals = num_free;
}
-#endif /* USE_TEXT_PROPERTIES */
/* Put all unmarked symbols on free list */
{
/* Store the actual size in the size field. */
newaddr->size = size;
-#ifdef USE_TEXT_PROPERTIES
/* Now that the string has been relocated, rebalance its
interval tree, and update the tree's parent pointer. */
if (! NULL_INTERVAL_P (newaddr->intervals))
XSETSTRING (* (Lisp_Object *) &newaddr->intervals->parent,
newaddr);
}
-#endif /* USE_TEXT_PROPERTIES */
}
else if (size_byte < 0)
size_byte = size;
end_byte - start_byte);
/* If desired, update and copy the text properties. */
-#ifdef USE_TEXT_PROPERTIES
if (props)
{
update_buffer_properties (start, end);
copy_intervals_to_string (result, current_buffer, start,
end - start);
}
-#endif
return result;
}
update_buffer_properties (start, end)
int start, end;
{
-#ifdef USE_TEXT_PROPERTIES
/* If this buffer has some access functions,
call them, specifying the range of the buffer being accessed. */
if (!NILP (Vbuffer_access_fontify_functions))
else
Frun_hook_with_args (3, args);
}
-#endif
}
DEFUN ("buffer-substring", Fbuffer_substring, Sbuffer_substring, 2, 2, 0,
int combined_before_bytes_2, combined_after_bytes_2;
struct gcpro gcpro1, gcpro2;
-#ifdef USE_TEXT_PROPERTIES
INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2;
cur_intv = BUF_INTERVALS (current_buffer);
-#endif /* USE_TEXT_PROPERTIES */
validate_region (&startr1, &endr1);
validate_region (&startr2, &endr2);
modify_region (current_buffer, start1, end2);
record_change (start1, len1 + len2);
-#ifdef USE_TEXT_PROPERTIES
tmp_interval1 = copy_intervals (cur_intv, start1, len1);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
Fset_text_properties (make_number (start1), make_number (end2),
Qnil, Qnil);
-#endif /* USE_TEXT_PROPERTIES */
/* First region smaller than second. */
if (len1_byte < len2_byte)
if (len1_byte > 20000)
free (temp);
}
-#ifdef USE_TEXT_PROPERTIES
graft_intervals_into_buffer (tmp_interval1, start1 + len2,
len1, current_buffer, 0);
graft_intervals_into_buffer (tmp_interval2, start1,
len2, current_buffer, 0);
-#endif /* USE_TEXT_PROPERTIES */
}
/* Non-adjacent regions, because end1 != start2, bleagh... */
else
modify_region (current_buffer, start2, end2);
record_change (start1, len1);
record_change (start2, len2);
-#ifdef USE_TEXT_PROPERTIES
tmp_interval1 = copy_intervals (cur_intv, start1, len1);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
Fset_text_properties (make_number (start1), make_number (end1),
Qnil, Qnil);
Fset_text_properties (make_number (start2), make_number (end2),
Qnil, Qnil);
-#endif /* USE_TEXT_PROPERTIES */
if (len1_byte > 20000)
temp = (unsigned char *) xmalloc (len1_byte);
bcopy (temp, start2_addr, len1_byte);
if (len1_byte > 20000)
free (temp);
-#ifdef USE_TEXT_PROPERTIES
graft_intervals_into_buffer (tmp_interval1, start2,
len1, current_buffer, 0);
graft_intervals_into_buffer (tmp_interval2, start1,
len2, current_buffer, 0);
-#endif /* USE_TEXT_PROPERTIES */
}
else if (len1_byte < len2_byte) /* Second region larger than first */
{
modify_region (current_buffer, start1, end2);
record_change (start1, (end2 - start1));
-#ifdef USE_TEXT_PROPERTIES
tmp_interval1 = copy_intervals (cur_intv, start1, len1);
tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
Fset_text_properties (make_number (start1), make_number (end2),
Qnil, Qnil);
-#endif /* USE_TEXT_PROPERTIES */
/* holds region 2 */
if (len2_byte > 20000)
bcopy (temp, start1_addr, len2_byte);
if (len2_byte > 20000)
free (temp);
-#ifdef USE_TEXT_PROPERTIES
graft_intervals_into_buffer (tmp_interval1, end2 - len1,
len1, current_buffer, 0);
graft_intervals_into_buffer (tmp_interval_mid, start1 + len2,
len_mid, current_buffer, 0);
graft_intervals_into_buffer (tmp_interval2, start1,
len2, current_buffer, 0);
-#endif /* USE_TEXT_PROPERTIES */
}
else
/* Second region smaller than first. */
record_change (start1, (end2 - start1));
modify_region (current_buffer, start1, end2);
-#ifdef USE_TEXT_PROPERTIES
tmp_interval1 = copy_intervals (cur_intv, start1, len1);
tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
Fset_text_properties (make_number (start1), make_number (end2),
Qnil, Qnil);
-#endif /* USE_TEXT_PROPERTIES */
/* holds region 1 */
if (len1_byte > 20000)
bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte);
if (len1_byte > 20000)
free (temp);
-#ifdef USE_TEXT_PROPERTIES
graft_intervals_into_buffer (tmp_interval1, end2 - len1,
len1, current_buffer, 0);
graft_intervals_into_buffer (tmp_interval_mid, start1 + len2,
len_mid, current_buffer, 0);
graft_intervals_into_buffer (tmp_interval2, start1,
len2, current_buffer, 0);
-#endif /* USE_TEXT_PROPERTIES */
}
}