mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 13:23:47 +00:00
Estimated hours taken: 3
Prefix everything defined in runtime/mercury_{stacks,tags}.h MR_.
In the process, get rid of the grade component MR_DEBUG_NONDET_STACK,
since this makes the update to mercury_stacks.h simpler and its use is
long obsolete.
runtime/mercury_tags.h:
Put MR_ prefixes in front of everything defined here.
runtime/mercury_stacks.h:
Put MR_ prefixes in front of everything defined here.
Remove support for MR_DEBUG_NONDET_STACK. Replace most of the
lost functionality by calling an updated mkframe_msg.
Remove the definitions of push() and pop(). Their use conflicts with
the idea that everything on the det stack is part of a frame, which
the RTTI stuff depends on.
runtime/mercury_bootstrap.h:
Add backward compatibility macros for the old names in the above two
files.
Remove some old entries in this file which are no longer needed.
runtime/mercury_wrapper.c:
Remove the only uses of push() and pop().
Put MR_ in front of some things that need them.
runtime/mercury_engine.c:
Put MR_ in front of some things that need them.
runtime/mercury_misc.[ch]:
Make mkframe_msg get the name of the procedure that owns the stack
frame from an explicitly passed argument, rather than the prednm slot
(which no longer exists). This actually improves low-level debugging
support without MR_DEBUG_NONDET_STACK.
Remove unnecessary return statements.
runtime/mercury_debug.h:
Pass on the new arg of mkframe_msg.
Fix long lines.
runtime/mercury_conf_param.h:
Remove the documentation of MR_DEBUG_NONDET_STACK.
runtime/mercury_grade.h:
Remove the grade component of MR_DEBUG_NONDET_STACK.
doc/reference_manual.texi:
Document the MR_ prefixed versions of list_empty, list_cons etc.
library/io.m:
library/std_util.m:
library/string.m:
Add prefixes to some references to the runtime.
220 lines
7.0 KiB
C
220 lines
7.0 KiB
C
/*
|
|
** Copyright (C) 1999 The University of Melbourne.
|
|
** This file may only be copied under the terms of the GNU Library General
|
|
** Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
*/
|
|
|
|
/*
|
|
** mercury_bootstrap.h
|
|
**
|
|
** Temporary definitions only needed for bootstrapping and/or
|
|
** for backwards compatibility. All of the definitions here
|
|
** will go away eventually, so don't use them!
|
|
*/
|
|
|
|
#ifndef MERCURY_BOOTSTRAP_H
|
|
#define MERCURY_BOOTSTRAP_H
|
|
|
|
#ifndef MR_NO_BACKWARDS_COMPAT
|
|
|
|
/*
|
|
** The list manipulation macros are available for use by ordinary Mercury
|
|
** programmers. People may have written code using these macros before their
|
|
** documented names were changed, so removing backward compatibility for them
|
|
** requires more warning than for the other things in this file.
|
|
*/
|
|
|
|
#define list_is_empty(l) MR_list_is_empty(l)
|
|
#define list_head(l) MR_list_head(l)
|
|
#define list_tail(l) MR_list_tail(l)
|
|
#define list_empty() MR_list_empty()
|
|
#define list_cons(h, t) MR_list_cons((h), (t))
|
|
|
|
#define succip MR_succip
|
|
#define hp MR_hp
|
|
#define sp MR_sp
|
|
#define curfr MR_curfr
|
|
#define maxfr MR_maxfr
|
|
|
|
/* stuff from mercury_stacks.h */
|
|
|
|
#define detstackvar(n) MR_stackvar(n)
|
|
|
|
#define incr_sp_push_msg(n, m) MR_incr_sp_push_msg((n), (m))
|
|
#define decr_sp_pop_msg(n) MR_decr_sp_pop_msg(n)
|
|
#define incr_sp(n) MR_incr_sp(n)
|
|
#define decr_sp(n) MR_decr_sp(n)
|
|
|
|
#define push(w) ( \
|
|
*MR_sp = (Word) (w), \
|
|
debugpush(*MR_sp, MR_sp), \
|
|
MR_sp = MR_sp + 1, \
|
|
detstack_overflow_check(), \
|
|
(void)0 \
|
|
)
|
|
|
|
#define pop() ( \
|
|
MR_sp = MR_sp - 1, \
|
|
debugpop(*MR_sp, MR_sp), \
|
|
detstack_underflow_check(), \
|
|
/* return */ *MR_sp \
|
|
)
|
|
|
|
#define NONDET_FIXED_SIZE MR_NONDET_FIXED_SIZE
|
|
|
|
#define framevar(n) MR_framevar((n) + 1)
|
|
|
|
#define bt_prevfr(fr) MR_prevfr_slot(fr)
|
|
#define bt_redoip(fr) MR_redoip_slot(fr)
|
|
#define bt_redofr(fr) MR_redofr_slot(fr)
|
|
#define bt_succip(fr) MR_succip_slot(fr)
|
|
#define bt_succfr(fr) MR_succfr_slot(fr)
|
|
#define bt_prednm(fr) MR_prednm_slot(fr)
|
|
#define bt_var(fr, n) MR_based_framevar(fr, (n) + 1)
|
|
|
|
#define curprevfr MR_prevfr_slot(MR_curfr)
|
|
#define curredoip MR_redoip_slot(MR_curfr)
|
|
#define curredofr MR_redofr_slot(MR_curfr)
|
|
#define cursuccip MR_succip_slot(MR_curfr)
|
|
#define cursuccfr MR_succfr_slot(MR_curfr)
|
|
#define curprednm MR_prednm_slot(MR_curfr)
|
|
|
|
#define prednm_slot(fr) "unknown"
|
|
#define MR_prednm_slot(fr) "unknown"
|
|
|
|
#define mkframe(p, s, r) MR_mkframe((p), (s), (r))
|
|
#define mkpragmaframe(p,s,n,r) MR_mkpragmaframe((p), (s), n, (r))
|
|
#define mktempframe(r) MR_mktempframe(r)
|
|
#define mkdettempframe(r) MR_mkdettempframe(r)
|
|
#define succeed() MR_succeed()
|
|
#define succeed_discard() MR_succeed_discard()
|
|
#define fail() MR_fail()
|
|
#define redo() MR_redo()
|
|
|
|
/* stuff from mercury_tags.h */
|
|
|
|
#define WORDBITS MR_WORDBITS
|
|
|
|
#define mktag(t) MR_mktag(t)
|
|
#define unmktag(w) MR_unmktag(w)
|
|
#define tag(w) MR_tag(w)
|
|
#define mkbody(i) MR_mkbody(i)
|
|
#define unmkbody(w) MR_unmkbody(w)
|
|
#define body(w, t) MR_body((w), (t))
|
|
#define strip_tag(w) MR_strip_tag(w)
|
|
|
|
#define mkword(t, p) MR_mkword((t), (p))
|
|
#define field(t, p, i) MR_field((t), (p), (i))
|
|
#define const_field(t, p, i) MR_const_field((t), (p), (i))
|
|
#define mask_field(p, i) MR_mask_field((p), (i))
|
|
#define const_mask_field(p, i) MR_const_mask_field((p), (i))
|
|
|
|
/*
|
|
** The code generated by Mercury 0.8 includes references to these macros.
|
|
*/
|
|
|
|
#define MR_OBTAIN_GLOBAL_C_LOCK() MR_OBTAIN_GLOBAL_LOCK("pragma c code")
|
|
#define MR_RELEASE_GLOBAL_C_LOCK() MR_RELEASE_GLOBAL_LOCK("pragma c code")
|
|
|
|
|
|
/*
|
|
** Generated code will create references to base_type_* which has been
|
|
** renamed. Builtin types use hand-defined type_ctor_*, so we need to
|
|
** #define the old names for these structures so the stage 1 compiler
|
|
** will link. The stage 2 compiler will just generate type_ctor_*
|
|
** references anyway, so then these #defines are not needed.
|
|
*/
|
|
|
|
#define MR_INIT_BASE_TYPE_INFO MR_INIT_TYPE_CTOR_INFO
|
|
|
|
#define mercury_data_array__base_type_functors_array_1 \
|
|
mercury_data_array__type_ctor_functors_array_1
|
|
|
|
#define mercury_data_array__base_type_functors_array_1_struct \
|
|
mercury_data_array__type_ctor_functors_array_1_struct
|
|
|
|
#define mercury_data_array__base_type_layout_array_1 \
|
|
mercury_data_array__type_ctor_layout_array_1
|
|
|
|
#define mercury_data_array__base_type_layout_array_1_struct \
|
|
mercury_data_array__type_ctor_layout_array_1_struct
|
|
|
|
|
|
#define mercury_data_builtin__base_type_functors_c_pointer_0 \
|
|
mercury_data_builtin__type_ctor_functors_c_pointer_0
|
|
|
|
#define mercury_data_builtin__base_type_functors_c_pointer_0_struct \
|
|
mercury_data_builtin__type_ctor_functors_c_pointer_0_struct
|
|
|
|
#define mercury_data_builtin__base_type_layout_c_pointer_0 \
|
|
mercury_data_builtin__type_ctor_layout_c_pointer_0
|
|
|
|
#define mercury_data_builtin__base_type_layout_c_pointer_0_struct \
|
|
mercury_data_builtin__type_ctor_layout_c_pointer_0_struct
|
|
|
|
|
|
#define mercury_data_std_util__base_type_functors_type_info_0 \
|
|
mercury_data_std_util__type_ctor_functors_type_info_0
|
|
|
|
#define mercury_data_std_util__base_type_functors_type_info_0_struct \
|
|
mercury_data_std_util__type_ctor_functors_type_info_0_struct
|
|
|
|
#define mercury_data_std_util__base_type_layout_type_info_0 \
|
|
mercury_data_std_util__type_ctor_layout_type_info_0
|
|
|
|
#define mercury_data_std_util__base_type_layout_type_info_0_struct \
|
|
mercury_data_std_util__type_ctor_layout_type_info_0_struct
|
|
|
|
|
|
#define mercury_data_std_util__base_type_functors_univ_0 \
|
|
mercury_data_std_util__type_ctor_functors_univ_0
|
|
|
|
#define mercury_data_std_util__base_type_functors_univ_0_struct \
|
|
mercury_data_std_util__type_ctor_functors_univ_0_struct
|
|
|
|
#define mercury_data_std_util__base_type_layout_univ_0 \
|
|
mercury_data_std_util__type_ctor_layout_univ_0
|
|
|
|
#define mercury_data_std_util__base_type_layout_univ_0_struct \
|
|
mercury_data_std_util__type_ctor_layout_univ_0_struct
|
|
|
|
#define mercury_data___base_type_info_int_0_struct \
|
|
mercury_data___type_ctor_info_int_0_struct
|
|
|
|
#define mercury_data___base_type_info_int_0 \
|
|
mercury_data___type_ctor_info_int_0
|
|
|
|
#define mercury_data___base_type_info_string_0_struct \
|
|
mercury_data___type_ctor_info_string_0_struct
|
|
|
|
#define mercury_data___base_type_info_string_0 \
|
|
mercury_data___type_ctor_info_string_0
|
|
|
|
#define mercury_data___base_type_info_character_0 \
|
|
mercury_data___type_ctor_info_character_0
|
|
|
|
#define mercury_data___base_type_info_character_0_struct \
|
|
mercury_data___type_ctor_info_character_0_struct
|
|
|
|
#define mercury_data___base_type_info_float_0 \
|
|
mercury_data___type_ctor_info_float_0
|
|
|
|
#define mercury_data___base_type_info_float_0_struct \
|
|
mercury_data___type_ctor_info_float_0_struct
|
|
|
|
#define mercury_data___base_type_info_pred_0 \
|
|
mercury_data___type_ctor_info_pred_0
|
|
|
|
#define mercury_data___base_type_info_pred_0_struct \
|
|
mercury_data___type_ctor_info_pred_0_struct
|
|
|
|
#define mercury_data_private_builtin__base_type_info_type_info_1 \
|
|
mercury_data_private_builtin__type_ctor_info_type_info_1
|
|
|
|
#define mercury_data_private_builtin__base_type_info_type_info_1_struct \
|
|
mercury_data_private_builtin__type_ctor_info_type_info_1_struct
|
|
|
|
#endif /* not MR_NO_BACKWARDS_COMPAT */
|
|
|
|
#endif /* MERCURY_BOOTSTRAP_H */
|