198944Sobrien/* Scheme/Guile language support routines for GDB, the GNU debugger.
298944Sobrien
3130803Smarcel   Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software
4130803Smarcel   Foundation, Inc.
5130803Smarcel
698944Sobrien   This file is part of GDB.
798944Sobrien
898944Sobrien   This program is free software; you can redistribute it and/or modify
998944Sobrien   it under the terms of the GNU General Public License as published by
1098944Sobrien   the Free Software Foundation; either version 2 of the License, or
1198944Sobrien   (at your option) any later version.
1298944Sobrien
1398944Sobrien   This program is distributed in the hope that it will be useful,
1498944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1598944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1698944Sobrien   GNU General Public License for more details.
1798944Sobrien
1898944Sobrien   You should have received a copy of the GNU General Public License
1998944Sobrien   along with this program; if not, write to the Free Software
2098944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
2198944Sobrien   Boston, MA 02111-1307, USA.  */
2298944Sobrien
2319370Spst#define SICP
2419370Spst#include "scm-tags.h"
2519370Spst#undef SCM_NCELLP
2619370Spst#define SCM_NCELLP(x) 	((SCM_SIZE-1) & (int)(x))
2719370Spst#define SCM_ITAG8_DATA(X)	((X)>>8)
2819370Spst#define SCM_ICHR(x)	((unsigned char)SCM_ITAG8_DATA(x))
2919370Spst#define SCM_ICHRP(x)    (SCM_ITAG8(x) == scm_tc8_char)
3019370Spst#define scm_tc8_char 0xf4
3119370Spst#define SCM_IFLAGP(n)            ((0x87 & (int)(n))==4)
3219370Spst#define SCM_ISYMNUM(n)           ((int)((n)>>9))
3319370Spst#define SCM_ISYMCHARS(n)         (scm_isymnames[SCM_ISYMNUM(n)])
3419370Spst#define SCM_ILOCP(n)             ((0xff & (int)(n))==0xfc)
3519370Spst#define SCM_ITAG8(X)             ((int)(X) & 0xff)
3619370Spst#define SCM_TYP7(x)              (0x7f & (int)SCM_CAR(x))
3719370Spst#define SCM_LENGTH(x) (((unsigned long)SCM_CAR(x))>>8)
3819370Spst#define SCM_NCONSP(x) (1 & (int)SCM_CAR(x))
3919370Spst#define SCM_NECONSP(x) (SCM_NCONSP(x) && (1 != SCM_TYP3(x)))
4019370Spst#define SCM_CAR(x) scm_get_field (x, 0)
4119370Spst#define SCM_CDR(x) scm_get_field (x, 1)
4219370Spst#define SCM_VELTS(x) ((SCM *)SCM_CDR(x))
4319370Spst#define SCM_CLOSCAR(x) (SCM_CAR(x)-scm_tc3_closure)
4419370Spst#define SCM_CODE(x) SCM_CAR(SCM_CLOSCAR (x))
4519370Spst#define SCM_MAKINUM(x) (((x)<<2)+2L)
4619370Spst
4798944Sobrien/* Forward decls for prototypes */
4819370Spststruct value;
4919370Spst
5098944Sobrienextern int scm_value_print (struct value *, struct ui_file *,
5198944Sobrien			    int, enum val_prettyprint);
5219370Spst
5398944Sobrienextern int scm_val_print (struct type *, char *, int, CORE_ADDR,
5498944Sobrien			  struct ui_file *, int, int, int,
5598944Sobrien			  enum val_prettyprint);
5619370Spst
5798944Sobrienextern LONGEST scm_get_field (LONGEST, int);
5819370Spst
5998944Sobrienextern void scm_scmval_print (LONGEST, struct ui_file *, int, int, int,
6098944Sobrien			      enum val_prettyprint);
6119370Spst
6298944Sobrienextern int is_scmvalue_type (struct type *);
6319370Spst
6498944Sobrienextern void scm_printchar (int, struct ui_file *);
6519370Spst
6698944Sobrienextern struct value *scm_evaluate_string (char *, int);
6719370Spst
6819370Spstextern struct type *builtin_type_scm;
6919370Spst
7098944Sobrienextern int scm_parse (void);
7119370Spst
72130803Smarcelextern LONGEST scm_unpack (struct type *, const char *, enum type_code);
73