diff options
Diffstat (limited to 'libguile/stacks.c')
-rw-r--r-- | libguile/stacks.c | 105 |
1 files changed, 52 insertions, 53 deletions
diff --git a/libguile/stacks.c b/libguile/stacks.c index c4dd317f7..36842920b 100644 --- a/libguile/stacks.c +++ b/libguile/stacks.c @@ -1,46 +1,51 @@ -/* A stack holds a frame chain - * - * Copyright (C) 1996, 1997, 2000, 2001, 2006-2015, 2017, 2018 - * Free Software Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ +/* Copyright 1996-1997,2000-2001,2006-2015,2017-2019 + Free Software Foundation, Inc. + + This file is part of Guile. + + Guile is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Guile is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with Guile. If not, see + <https://www.gnu.org/licenses/>. */ + #ifdef HAVE_CONFIG_H # include <config.h> #endif -#include "libguile/_scm.h" -#include "libguile/control.h" -#include "libguile/eval.h" -#include "libguile/debug.h" -#include "libguile/continuations.h" -#include "libguile/struct.h" -#include "libguile/macros.h" -#include "libguile/procprop.h" -#include "libguile/modules.h" -#include "libguile/strings.h" -#include "libguile/vm.h" /* to capture vm stacks */ -#include "libguile/frames.h" /* vm frames */ - -#include "libguile/validate.h" -#include "libguile/stacks.h" -#include "libguile/private-options.h" +#include "boolean.h" +#include "continuations.h" +#include "control.h" +#include "debug.h" +#include "eval.h" +#include "fluids.h" +#include "frames.h" /* vm frames */ +#include "gsubr.h" +#include "list.h" +#include "macros.h" +#include "modules.h" +#include "numbers.h" +#include "pairs.h" +#include "private-options.h" +#include "procprop.h" +#include "strings.h" +#include "struct.h" +#include "symbols.h" +#include "threads.h" +#include "vm.h" /* to capture vm stacks */ + +#include "stacks.h" static SCM scm_sys_stacks; @@ -97,13 +102,13 @@ stack_depth (enum scm_vm_frame_kind kind, const struct scm_frame *frame) * encountered. */ -static scm_t_ptrdiff +static ptrdiff_t find_prompt (SCM key) { - scm_t_ptrdiff fp_offset; + ptrdiff_t fp_offset; if (!scm_dynstack_find_prompt (&SCM_I_CURRENT_THREAD->dynstack, key, - NULL, &fp_offset, NULL, NULL, NULL)) + NULL, &fp_offset, NULL, NULL, NULL, NULL)) scm_misc_error ("make-stack", "Prompt tag not found while narrowing stack", scm_list_1 (key)); @@ -148,14 +153,14 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame, && scm_is_integer (scm_cdr (inner_cut))) { /* Cut until an IP within the given range is found. */ - scm_t_uintptr low_pc, high_pc, pc; + uintptr_t low_pc, high_pc, pc; low_pc = scm_to_uintptr_t (scm_car (inner_cut)); high_pc = scm_to_uintptr_t (scm_cdr (inner_cut)); for (; len ;) { - pc = (scm_t_uintptr) frame->ip; + pc = (uintptr_t) frame->ip; len--; scm_c_frame_previous (kind, frame); if (low_pc <= pc && pc < high_pc) @@ -176,7 +181,7 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame, else { /* Cut until the given prompt tag is seen. */ - scm_t_ptrdiff fp_offset = find_prompt (inner_cut); + ptrdiff_t fp_offset = find_prompt (inner_cut); for (; len; len--, scm_c_frame_previous (kind, frame)) if (fp_offset == frame->fp_offset) break; @@ -202,7 +207,7 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame, && scm_is_integer (scm_cdr (outer_cut))) { /* Cut until an IP within the given range is found. */ - scm_t_uintptr low_pc, high_pc, pc; + uintptr_t low_pc, high_pc, pc; long i, new_len; struct scm_frame tmp; @@ -214,7 +219,7 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame, /* Cut until the given procedure is seen. */ for (new_len = i = 0; i < len; i++, scm_c_frame_previous (kind, &tmp)) { - pc = (scm_t_uintptr) tmp.ip; + pc = (uintptr_t) tmp.ip; if (low_pc <= pc && pc < high_pc) new_len = i; } @@ -236,7 +241,7 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame, /* Cut until the given prompt tag is seen. */ long i; struct scm_frame tmp; - scm_t_ptrdiff fp_offset = find_prompt (outer_cut); + ptrdiff_t fp_offset = find_prompt (outer_cut); memcpy (&tmp, frame, sizeof tmp); @@ -329,7 +334,7 @@ SCM_DEFINE (scm_make_stack, "make-stack", 1, 0, 1, frame.stack_holder = c; frame.fp_offset = c->fp_offset; frame.sp_offset = c->stack_size; - frame.ip = c->ra; + frame.ip = c->vra; } else if (SCM_VM_FRAME_P (obj)) { @@ -468,11 +473,5 @@ scm_init_stacks () SCM_UNDEFINED); scm_set_struct_vtable_name_x (scm_stack_type, scm_from_utf8_symbol ("stack")); -#include "libguile/stacks.x" +#include "stacks.x" } - -/* - Local Variables: - c-file-style: "gnu" - End: -*/ |