119370Spst/* Modula 2 language support routines for GDB, the GNU debugger.
2130803Smarcel   Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2002, 2003, 2004
398944Sobrien   Free Software Foundation, Inc.
419370Spst
598944Sobrien   This file is part of GDB.
619370Spst
798944Sobrien   This program is free software; you can redistribute it and/or modify
898944Sobrien   it under the terms of the GNU General Public License as published by
998944Sobrien   the Free Software Foundation; either version 2 of the License, or
1098944Sobrien   (at your option) any later version.
1119370Spst
1298944Sobrien   This program is distributed in the hope that it will be useful,
1398944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1498944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1598944Sobrien   GNU General Public License for more details.
1619370Spst
1798944Sobrien   You should have received a copy of the GNU General Public License
1898944Sobrien   along with this program; if not, write to the Free Software
1998944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
2098944Sobrien   Boston, MA 02111-1307, USA.  */
2119370Spst
2219370Spst#include "defs.h"
2319370Spst#include "symtab.h"
2419370Spst#include "gdbtypes.h"
2519370Spst#include "expression.h"
2619370Spst#include "parser-defs.h"
2719370Spst#include "language.h"
2819370Spst#include "m2-lang.h"
2919370Spst#include "c-lang.h"
3098944Sobrien#include "valprint.h"
3119370Spst
3298944Sobrienextern void _initialize_m2_language (void);
3398944Sobrienstatic struct type *m2_create_fundamental_type (struct objfile *, int);
3498944Sobrienstatic void m2_printstr (struct ui_file * stream, char *string,
3598944Sobrien			 unsigned int length, int width,
3698944Sobrien			 int force_ellipses);
3798944Sobrienstatic void m2_printchar (int, struct ui_file *);
3898944Sobrienstatic void m2_emit_char (int, struct ui_file *, int);
3946283Sdfr
4019370Spst/* Print the character C on STREAM as part of the contents of a literal
4119370Spst   string whose delimiter is QUOTER.  Note that that format for printing
4219370Spst   characters and strings is language specific.
4319370Spst   FIXME:  This is a copy of the same function from c-exp.y.  It should
4419370Spst   be replaced with a true Modula version.
4519370Spst */
4619370Spst
4719370Spststatic void
48130803Smarcelm2_emit_char (int c, struct ui_file *stream, int quoter)
4919370Spst{
5019370Spst
5119370Spst  c &= 0xFF;			/* Avoid sign bit follies */
5219370Spst
5319370Spst  if (PRINT_LITERAL_FORM (c))
5419370Spst    {
5519370Spst      if (c == '\\' || c == quoter)
5619370Spst	{
5719370Spst	  fputs_filtered ("\\", stream);
5819370Spst	}
5919370Spst      fprintf_filtered (stream, "%c", c);
6019370Spst    }
6119370Spst  else
6219370Spst    {
6319370Spst      switch (c)
6419370Spst	{
6519370Spst	case '\n':
6619370Spst	  fputs_filtered ("\\n", stream);
6719370Spst	  break;
6819370Spst	case '\b':
6919370Spst	  fputs_filtered ("\\b", stream);
7019370Spst	  break;
7119370Spst	case '\t':
7219370Spst	  fputs_filtered ("\\t", stream);
7319370Spst	  break;
7419370Spst	case '\f':
7519370Spst	  fputs_filtered ("\\f", stream);
7619370Spst	  break;
7719370Spst	case '\r':
7819370Spst	  fputs_filtered ("\\r", stream);
7919370Spst	  break;
8019370Spst	case '\033':
8119370Spst	  fputs_filtered ("\\e", stream);
8219370Spst	  break;
8319370Spst	case '\007':
8419370Spst	  fputs_filtered ("\\a", stream);
8519370Spst	  break;
8619370Spst	default:
8719370Spst	  fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
8819370Spst	  break;
8919370Spst	}
9019370Spst    }
9119370Spst}
9219370Spst
9319370Spst/* FIXME:  This is a copy of the same function from c-exp.y.  It should
9419370Spst   be replaced with a true Modula version. */
9519370Spst
9619370Spststatic void
9798944Sobrienm2_printchar (int c, struct ui_file *stream)
9819370Spst{
9919370Spst  fputs_filtered ("'", stream);
10046283Sdfr  LA_EMIT_CHAR (c, stream, '\'');
10119370Spst  fputs_filtered ("'", stream);
10219370Spst}
10319370Spst
10419370Spst/* Print the character string STRING, printing at most LENGTH characters.
10519370Spst   Printing stops early if the number hits print_max; repeat counts
10619370Spst   are printed as appropriate.  Print ellipses at the end if we
10719370Spst   had to stop before printing LENGTH characters, or if FORCE_ELLIPSES.
10819370Spst   FIXME:  This is a copy of the same function from c-exp.y.  It should
10919370Spst   be replaced with a true Modula version. */
11019370Spst
11119370Spststatic void
11298944Sobrienm2_printstr (struct ui_file *stream, char *string, unsigned int length,
11398944Sobrien	     int width, int force_ellipses)
11419370Spst{
115130803Smarcel  unsigned int i;
11619370Spst  unsigned int things_printed = 0;
11719370Spst  int in_quotes = 0;
11819370Spst  int need_comma = 0;
11919370Spst
12019370Spst  if (length == 0)
12119370Spst    {
12219370Spst      fputs_filtered ("\"\"", gdb_stdout);
12319370Spst      return;
12419370Spst    }
12519370Spst
12619370Spst  for (i = 0; i < length && things_printed < print_max; ++i)
12719370Spst    {
12819370Spst      /* Position of the character we are examining
12998944Sobrien         to see whether it is repeated.  */
13019370Spst      unsigned int rep1;
13119370Spst      /* Number of repetitions we have detected so far.  */
13219370Spst      unsigned int reps;
13319370Spst
13419370Spst      QUIT;
13519370Spst
13619370Spst      if (need_comma)
13719370Spst	{
13819370Spst	  fputs_filtered (", ", stream);
13919370Spst	  need_comma = 0;
14019370Spst	}
14119370Spst
14219370Spst      rep1 = i + 1;
14319370Spst      reps = 1;
14419370Spst      while (rep1 < length && string[rep1] == string[i])
14519370Spst	{
14619370Spst	  ++rep1;
14719370Spst	  ++reps;
14819370Spst	}
14919370Spst
15019370Spst      if (reps > repeat_count_threshold)
15119370Spst	{
15219370Spst	  if (in_quotes)
15319370Spst	    {
15419370Spst	      if (inspect_it)
15519370Spst		fputs_filtered ("\\\", ", stream);
15619370Spst	      else
15719370Spst		fputs_filtered ("\", ", stream);
15819370Spst	      in_quotes = 0;
15919370Spst	    }
16019370Spst	  m2_printchar (string[i], stream);
16119370Spst	  fprintf_filtered (stream, " <repeats %u times>", reps);
16219370Spst	  i = rep1 - 1;
16319370Spst	  things_printed += repeat_count_threshold;
16419370Spst	  need_comma = 1;
16519370Spst	}
16619370Spst      else
16719370Spst	{
16819370Spst	  if (!in_quotes)
16919370Spst	    {
17019370Spst	      if (inspect_it)
17119370Spst		fputs_filtered ("\\\"", stream);
17219370Spst	      else
17319370Spst		fputs_filtered ("\"", stream);
17419370Spst	      in_quotes = 1;
17519370Spst	    }
17646283Sdfr	  LA_EMIT_CHAR (string[i], stream, '"');
17719370Spst	  ++things_printed;
17819370Spst	}
17919370Spst    }
18019370Spst
18119370Spst  /* Terminate the quotes if necessary.  */
18219370Spst  if (in_quotes)
18319370Spst    {
18419370Spst      if (inspect_it)
18519370Spst	fputs_filtered ("\\\"", stream);
18619370Spst      else
18719370Spst	fputs_filtered ("\"", stream);
18819370Spst    }
18919370Spst
19019370Spst  if (force_ellipses || i < length)
19119370Spst    fputs_filtered ("...", stream);
19219370Spst}
19319370Spst
19419370Spst/* FIXME:  This is a copy of c_create_fundamental_type(), before
19519370Spst   all the non-C types were stripped from it.  Needs to be fixed
19619370Spst   by an experienced Modula programmer. */
19719370Spst
19819370Spststatic struct type *
19998944Sobrienm2_create_fundamental_type (struct objfile *objfile, int typeid)
20019370Spst{
201130803Smarcel  struct type *type = NULL;
20219370Spst
20319370Spst  switch (typeid)
20419370Spst    {
20598944Sobrien    default:
20698944Sobrien      /* FIXME:  For now, if we are asked to produce a type not in this
20798944Sobrien         language, create the equivalent of a C integer type with the
20898944Sobrien         name "<?type?>".  When all the dust settles from the type
20998944Sobrien         reconstruction work, this should probably become an error. */
21098944Sobrien      type = init_type (TYPE_CODE_INT,
21198944Sobrien			TARGET_INT_BIT / TARGET_CHAR_BIT,
21298944Sobrien			0, "<?type?>", objfile);
21398944Sobrien      warning ("internal error: no Modula fundamental type %d", typeid);
21498944Sobrien      break;
21598944Sobrien    case FT_VOID:
21698944Sobrien      type = init_type (TYPE_CODE_VOID,
21798944Sobrien			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
21898944Sobrien			0, "void", objfile);
21998944Sobrien      break;
22098944Sobrien    case FT_BOOLEAN:
22198944Sobrien      type = init_type (TYPE_CODE_BOOL,
22298944Sobrien			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
22398944Sobrien			TYPE_FLAG_UNSIGNED, "boolean", objfile);
22498944Sobrien      break;
22598944Sobrien    case FT_STRING:
22698944Sobrien      type = init_type (TYPE_CODE_STRING,
22798944Sobrien			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
22898944Sobrien			0, "string", objfile);
22998944Sobrien      break;
23098944Sobrien    case FT_CHAR:
23198944Sobrien      type = init_type (TYPE_CODE_INT,
23298944Sobrien			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
23398944Sobrien			0, "char", objfile);
23498944Sobrien      break;
23598944Sobrien    case FT_SIGNED_CHAR:
23698944Sobrien      type = init_type (TYPE_CODE_INT,
23798944Sobrien			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
23898944Sobrien			0, "signed char", objfile);
23998944Sobrien      break;
24098944Sobrien    case FT_UNSIGNED_CHAR:
24198944Sobrien      type = init_type (TYPE_CODE_INT,
24298944Sobrien			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
24398944Sobrien			TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
24498944Sobrien      break;
24598944Sobrien    case FT_SHORT:
24698944Sobrien      type = init_type (TYPE_CODE_INT,
24798944Sobrien			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
24898944Sobrien			0, "short", objfile);
24998944Sobrien      break;
25098944Sobrien    case FT_SIGNED_SHORT:
25198944Sobrien      type = init_type (TYPE_CODE_INT,
25298944Sobrien			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
25398944Sobrien			0, "short", objfile);	/* FIXME-fnf */
25498944Sobrien      break;
25598944Sobrien    case FT_UNSIGNED_SHORT:
25698944Sobrien      type = init_type (TYPE_CODE_INT,
25798944Sobrien			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
25898944Sobrien			TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
25998944Sobrien      break;
26098944Sobrien    case FT_INTEGER:
26198944Sobrien      type = init_type (TYPE_CODE_INT,
26298944Sobrien			TARGET_INT_BIT / TARGET_CHAR_BIT,
26398944Sobrien			0, "int", objfile);
26498944Sobrien      break;
26598944Sobrien    case FT_SIGNED_INTEGER:
26698944Sobrien      type = init_type (TYPE_CODE_INT,
26798944Sobrien			TARGET_INT_BIT / TARGET_CHAR_BIT,
26898944Sobrien			0, "int", objfile);	/* FIXME -fnf */
26998944Sobrien      break;
27098944Sobrien    case FT_UNSIGNED_INTEGER:
27198944Sobrien      type = init_type (TYPE_CODE_INT,
27298944Sobrien			TARGET_INT_BIT / TARGET_CHAR_BIT,
27398944Sobrien			TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
27498944Sobrien      break;
27598944Sobrien    case FT_FIXED_DECIMAL:
27698944Sobrien      type = init_type (TYPE_CODE_INT,
27798944Sobrien			TARGET_INT_BIT / TARGET_CHAR_BIT,
27898944Sobrien			0, "fixed decimal", objfile);
27998944Sobrien      break;
28098944Sobrien    case FT_LONG:
28198944Sobrien      type = init_type (TYPE_CODE_INT,
28298944Sobrien			TARGET_LONG_BIT / TARGET_CHAR_BIT,
28398944Sobrien			0, "long", objfile);
28498944Sobrien      break;
28598944Sobrien    case FT_SIGNED_LONG:
28698944Sobrien      type = init_type (TYPE_CODE_INT,
28798944Sobrien			TARGET_LONG_BIT / TARGET_CHAR_BIT,
28898944Sobrien			0, "long", objfile);	/* FIXME -fnf */
28998944Sobrien      break;
29098944Sobrien    case FT_UNSIGNED_LONG:
29198944Sobrien      type = init_type (TYPE_CODE_INT,
29298944Sobrien			TARGET_LONG_BIT / TARGET_CHAR_BIT,
29398944Sobrien			TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
29498944Sobrien      break;
29598944Sobrien    case FT_LONG_LONG:
29698944Sobrien      type = init_type (TYPE_CODE_INT,
29798944Sobrien			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
29898944Sobrien			0, "long long", objfile);
29998944Sobrien      break;
30098944Sobrien    case FT_SIGNED_LONG_LONG:
30198944Sobrien      type = init_type (TYPE_CODE_INT,
30298944Sobrien			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
30398944Sobrien			0, "signed long long", objfile);
30498944Sobrien      break;
30598944Sobrien    case FT_UNSIGNED_LONG_LONG:
30698944Sobrien      type = init_type (TYPE_CODE_INT,
30798944Sobrien			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
30898944Sobrien			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
30998944Sobrien      break;
31098944Sobrien    case FT_FLOAT:
31198944Sobrien      type = init_type (TYPE_CODE_FLT,
31298944Sobrien			TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
31398944Sobrien			0, "float", objfile);
31498944Sobrien      break;
31598944Sobrien    case FT_DBL_PREC_FLOAT:
31698944Sobrien      type = init_type (TYPE_CODE_FLT,
31798944Sobrien			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
31898944Sobrien			0, "double", objfile);
31998944Sobrien      break;
32098944Sobrien    case FT_FLOAT_DECIMAL:
32198944Sobrien      type = init_type (TYPE_CODE_FLT,
32298944Sobrien			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
32398944Sobrien			0, "floating decimal", objfile);
32498944Sobrien      break;
32598944Sobrien    case FT_EXT_PREC_FLOAT:
32698944Sobrien      type = init_type (TYPE_CODE_FLT,
32798944Sobrien			TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
32898944Sobrien			0, "long double", objfile);
32998944Sobrien      break;
33098944Sobrien    case FT_COMPLEX:
33198944Sobrien      type = init_type (TYPE_CODE_COMPLEX,
33298944Sobrien			2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
33398944Sobrien			0, "complex", objfile);
33498944Sobrien      TYPE_TARGET_TYPE (type)
33598944Sobrien	= m2_create_fundamental_type (objfile, FT_FLOAT);
33698944Sobrien      break;
33798944Sobrien    case FT_DBL_PREC_COMPLEX:
33898944Sobrien      type = init_type (TYPE_CODE_COMPLEX,
33998944Sobrien			2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
34098944Sobrien			0, "double complex", objfile);
34198944Sobrien      TYPE_TARGET_TYPE (type)
34298944Sobrien	= m2_create_fundamental_type (objfile, FT_DBL_PREC_FLOAT);
34398944Sobrien      break;
34498944Sobrien    case FT_EXT_PREC_COMPLEX:
34598944Sobrien      type = init_type (TYPE_CODE_COMPLEX,
34698944Sobrien			2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
34798944Sobrien			0, "long double complex", objfile);
34898944Sobrien      TYPE_TARGET_TYPE (type)
34998944Sobrien	= m2_create_fundamental_type (objfile, FT_EXT_PREC_FLOAT);
35098944Sobrien      break;
35198944Sobrien    }
35219370Spst  return (type);
35319370Spst}
35498944Sobrien
35519370Spst
35619370Spst/* Table of operators and their precedences for printing expressions.  */
35719370Spst
35898944Sobrienstatic const struct op_print m2_op_print_tab[] =
35998944Sobrien{
36098944Sobrien  {"+", BINOP_ADD, PREC_ADD, 0},
36198944Sobrien  {"+", UNOP_PLUS, PREC_PREFIX, 0},
36298944Sobrien  {"-", BINOP_SUB, PREC_ADD, 0},
36398944Sobrien  {"-", UNOP_NEG, PREC_PREFIX, 0},
36498944Sobrien  {"*", BINOP_MUL, PREC_MUL, 0},
36598944Sobrien  {"/", BINOP_DIV, PREC_MUL, 0},
36698944Sobrien  {"DIV", BINOP_INTDIV, PREC_MUL, 0},
36798944Sobrien  {"MOD", BINOP_REM, PREC_MUL, 0},
36898944Sobrien  {":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
36998944Sobrien  {"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
37098944Sobrien  {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
37198944Sobrien  {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
37298944Sobrien  {"=", BINOP_EQUAL, PREC_EQUAL, 0},
37398944Sobrien  {"<>", BINOP_NOTEQUAL, PREC_EQUAL, 0},
37498944Sobrien  {"<=", BINOP_LEQ, PREC_ORDER, 0},
37598944Sobrien  {">=", BINOP_GEQ, PREC_ORDER, 0},
37698944Sobrien  {">", BINOP_GTR, PREC_ORDER, 0},
37798944Sobrien  {"<", BINOP_LESS, PREC_ORDER, 0},
37898944Sobrien  {"^", UNOP_IND, PREC_PREFIX, 0},
37998944Sobrien  {"@", BINOP_REPEAT, PREC_REPEAT, 0},
38098944Sobrien  {"CAP", UNOP_CAP, PREC_BUILTIN_FUNCTION, 0},
38198944Sobrien  {"CHR", UNOP_CHR, PREC_BUILTIN_FUNCTION, 0},
38298944Sobrien  {"ORD", UNOP_ORD, PREC_BUILTIN_FUNCTION, 0},
38398944Sobrien  {"FLOAT", UNOP_FLOAT, PREC_BUILTIN_FUNCTION, 0},
38498944Sobrien  {"HIGH", UNOP_HIGH, PREC_BUILTIN_FUNCTION, 0},
38598944Sobrien  {"MAX", UNOP_MAX, PREC_BUILTIN_FUNCTION, 0},
38698944Sobrien  {"MIN", UNOP_MIN, PREC_BUILTIN_FUNCTION, 0},
38798944Sobrien  {"ODD", UNOP_ODD, PREC_BUILTIN_FUNCTION, 0},
38898944Sobrien  {"TRUNC", UNOP_TRUNC, PREC_BUILTIN_FUNCTION, 0},
38998944Sobrien  {NULL, 0, 0, 0}
39019370Spst};
39119370Spst
39219370Spst/* The built-in types of Modula-2.  */
39319370Spst
39419370Spststruct type *builtin_type_m2_char;
39519370Spststruct type *builtin_type_m2_int;
39619370Spststruct type *builtin_type_m2_card;
39719370Spststruct type *builtin_type_m2_real;
39819370Spststruct type *builtin_type_m2_bool;
39919370Spst
40098944Sobrienstruct type **const (m2_builtin_types[]) =
40119370Spst{
40219370Spst  &builtin_type_m2_char,
40398944Sobrien    &builtin_type_m2_int,
40498944Sobrien    &builtin_type_m2_card,
40598944Sobrien    &builtin_type_m2_real,
40698944Sobrien    &builtin_type_m2_bool,
40798944Sobrien    0
40819370Spst};
40919370Spst
41098944Sobrienconst struct language_defn m2_language_defn =
41198944Sobrien{
41219370Spst  "modula-2",
41319370Spst  language_m2,
41419370Spst  m2_builtin_types,
41519370Spst  range_check_on,
41619370Spst  type_check_on,
41798944Sobrien  case_sensitive_on,
418130803Smarcel  &exp_descriptor_standard,
41919370Spst  m2_parse,			/* parser */
42019370Spst  m2_error,			/* parser error function */
42119370Spst  m2_printchar,			/* Print character constant */
42219370Spst  m2_printstr,			/* function to print string constant */
42346283Sdfr  m2_emit_char,			/* Function to print a single character */
42419370Spst  m2_create_fundamental_type,	/* Create fundamental type in this language */
42519370Spst  m2_print_type,		/* Print a type using appropriate syntax */
42619370Spst  m2_val_print,			/* Print a value using appropriate syntax */
42719370Spst  c_value_print,		/* Print a top-level value */
428130803Smarcel  NULL,				/* Language specific skip_trampoline */
429130803Smarcel  value_of_this,		/* value_of_this */
430130803Smarcel  basic_lookup_symbol_nonlocal,	/* lookup_symbol_nonlocal */
431130803Smarcel  basic_lookup_transparent_type,/* lookup_transparent_type */
432130803Smarcel  NULL,				/* Language specific symbol demangler */
43398944Sobrien  {"", "", "", ""},		/* Binary format info */
43498944Sobrien  {"%loB", "", "o", "B"},	/* Octal format info */
43598944Sobrien  {"%ld", "", "d", ""},		/* Decimal format info */
43698944Sobrien  {"0%lXH", "0", "X", "H"},	/* Hex format info */
43719370Spst  m2_op_print_tab,		/* expression operators for printing */
43819370Spst  0,				/* arrays are first-class (not c-style) */
43919370Spst  0,				/* String lower bound */
44098944Sobrien  &builtin_type_m2_char,	/* Type of string elements */
441130803Smarcel  default_word_break_characters,
44219370Spst  LANG_MAGIC
44319370Spst};
44419370Spst
44519370Spst/* Initialization for Modula-2 */
44619370Spst
44719370Spstvoid
44898944Sobrien_initialize_m2_language (void)
44919370Spst{
45019370Spst  /* Modula-2 "pervasive" types.  NOTE:  these can be redefined!!! */
45119370Spst  builtin_type_m2_int =
45219370Spst    init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
45319370Spst	       0,
45419370Spst	       "INTEGER", (struct objfile *) NULL);
45519370Spst  builtin_type_m2_card =
45619370Spst    init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
45719370Spst	       TYPE_FLAG_UNSIGNED,
45819370Spst	       "CARDINAL", (struct objfile *) NULL);
45919370Spst  builtin_type_m2_real =
46019370Spst    init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
46119370Spst	       0,
46219370Spst	       "REAL", (struct objfile *) NULL);
46319370Spst  builtin_type_m2_char =
46419370Spst    init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
46519370Spst	       TYPE_FLAG_UNSIGNED,
46619370Spst	       "CHAR", (struct objfile *) NULL);
46719370Spst  builtin_type_m2_bool =
46819370Spst    init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT,
46919370Spst	       TYPE_FLAG_UNSIGNED,
47019370Spst	       "BOOLEAN", (struct objfile *) NULL);
47119370Spst
47219370Spst  add_language (&m2_language_defn);
47319370Spst}
474