예제 #1
0
파일: data.c 프로젝트: mishavetl/huskylang
Test(data, types_identical_with_single_types) {
    struct type type1 = init_type(),
                type2 = init_type();
    
    type1.single = tid_integral;
    type2.single = tid_integral;
    cr_assert(types_identical(&type1, &type2));

    type1.single = tid_integral;
    type2.single = tid_real;
    cr_assert_not(types_identical(&type1, &type2));

    type1.single = tid_integral;
    cr_assert(types_identical(NULL, NULL));
    cr_assert_not(types_identical(&type1, NULL));
    cr_assert_not(types_identical(NULL, &type1));

    type1.single = tid_alpha;
    type2.single = tid_tuple;
    cr_assert(types_identical(&type1, &type2));
    type2.single = tid_real;
    cr_assert(types_identical(&type1, &type2));
    type2.single = tid_integral;
    cr_assert(types_identical(&type2, &type1));
    type2.single = tid_alpha;
    cr_assert(types_identical(&type1, &type2));
}
예제 #2
0
파일: data.c 프로젝트: mishavetl/huskylang
Test(data, types_identical_with_infinity_multsize) {
    struct type type1 = init_type(),
                type2 = init_type(),
                type3 = init_type(),
                type4 = init_type();

    type1.single = tid_tuple;
    type2.single = tid_tuple;
    type3.single = tid_real;
    type4.single = tid_atom;
    struct type *mult1[3] = {&type3, &type4, NULL};
    struct type *mult2[9] = {
        &type3, &type4,
        &type3, &type4,
        &type3, &type4,
        &type3, &type4,
        NULL
    };
    type1.multsize = INFINITY;
    type2.multsize = 8;
    type1.multiple = mult1;
    type2.multiple = mult2;
    type3.multiple = NULL;
    type4.multiple = NULL;
    cr_assert(types_identical(&type1, &type2));
}
예제 #3
0
파일: main.c 프로젝트: cherry-wb/Hot-Fuzz
PUBLIC int main(int ac, char **av)
{
     int i, n_files;
     char **files;

     argc = ac; argv = av;

     while (--argc > 0 && (*++argv)[0] == '-')
          do_flags(*argv);
     files = argv;
     n_files = argc;

     if (debflag('v')) {
	  fprintf(errout, "%s\n%s\n%s\n", 
		  fuzz_banner, fuzz_rcsid, fuzz_copyright);
	  fflush(errout);
     }

     debugging = debflag('p');
     init_sym();
     init_type();
     init_dict();
     open_prelude();
     read_a_file();
     if (dflag) {
	  check_file();
	  clear_temp((univ) NULL);
     }

     debugging = TRUE;
     if (n_files == 0) {
	  /* Finished prelude, no args: read stdin */
	  file_name = "standard input";
	  yyrestart(stdin);
	  read_a_file();
     }
     else {
	  for (i = 0; i < n_files; i++) {
	       reopen_input(files[i]);
	       yyrestart(yyin);
	       read_a_file();
	  }
     }
     if (dflag) {
	  check_file();
	  clear_temp((univ) NULL);
     }

#ifdef DEBUG
     if (debflag('h'))
	  dump_hash();
#endif

     return (n_errors > 0 ? 1 : 0);
}
예제 #4
0
static void Print_usage (char **argv) {
    char *usage = "\n\
        Initialize RPG adaptation data.\n\
        Options:\n\
            -t init_type (Specifies initialization type. e.g. init, clear)\n\
            -h (Print usage info)\n";

    printf ("Usage:  %s [options]\n", argv[0]);
    printf ("%s\n", usage);

    exit (0);
}
// Register a singleton Python type.
int qpyqml_register_singleton_type(PyTypeObject *py_type, const char *uri,
        int major, int minor, const char *type_name, PyObject *factory)
{
    // Initialise the registration data structure.
    QQmlPrivate::RegisterSingletonType *rt = init_type(py_type, factory);

    if (!rt)
        return -1;

    rt->uri = uri;
    rt->versionMajor = major;
    rt->versionMinor = minor;
    rt->typeName = type_name;

    return register_type(rt);
}
예제 #6
0
DDS::Boolean be_sequence::SetName
   (const DDS_StdString& _scope, const DDS_StdString& _name)
{
   DDS::Boolean ret = FALSE;

   if (anonymous)
   {
      anonymous = FALSE;

      init_type (_scope, _name);

      ret = TRUE;
   }

   return ret;
}
예제 #7
0
파일: data.c 프로젝트: mishavetl/huskylang
Test(data, types_identical_with_multiple_types) {
    struct type type1 = init_type(),
                type2 = init_type(),
                type3 = init_type(),
                type4 = init_type(),
                type5 = init_type(),
                type6 = init_type(),
                type7 = init_type(),
                type8 = init_type();
    
    type1.single = tid_tuple;
    type6.single = tid_tuple;
    type2.single = tid_integral;
    type3.single = tid_real;
    type4.single = tid_integral;
    type5.single = tid_real;
    struct type *mult1[3] = {&type2, &type3, NULL};
    struct type *mult6[3] = {&type4, &type5, NULL};
    type1.multiple = mult1;
    type6.multiple = mult6;
    cr_assert(types_identical(&type1, &type6));

    type1.single = tid_string;
    type2.single = tid_tuple;
    type3.single = tid_tuple;
    type4.single = tid_list;
    type5.single = tid_list;
    type6.single = tid_string;
    type7.single = tid_real;
    type8.single = tid_real;
    struct type *mult2[3] = {&type1, &type4, NULL};
    struct type *mult3[3] = {&type6, &type5, NULL};
    struct type *mult4[2] = {&type7, NULL};
    struct type *mult5[2] = {&type8, NULL};
    type1.multiple = NULL;
    type2.multiple = mult2;
    type3.multiple = mult3;
    type4.multiple = mult4;
    type5.multiple = mult5;
    type6.multiple = NULL;
    cr_assert(types_identical(&type2, &type3));
}
예제 #8
0
파일: main.c 프로젝트: he110world/junk
PUBLIC int main(int argc, char **argv)
{
     init_lex();
     init_symtab();
     init_type();
     init_lib();

     if (argc != 2) 
	  filename = "standard input";
     else {
	  filename = argv[1];
	  if ((yyin = fopen(filename, "r")) == NULL) {
	       perror(filename);
	       exit(1);
	  }
     }

     yyparse();
     return (err_count == 0 ? 0 : 1);
}
예제 #9
0
파일: data.c 프로젝트: mishavetl/huskylang
Test(data, init_type) {
    struct type type = init_type();
    cr_assert_eq(type.single, __tid_size);
    cr_assert_null(type.multiple);
}
예제 #10
0
파일: input.cpp 프로젝트: lotuskip/yuxtapa
bool Input::inputhandle()
{
	if(clientstate == CS_TYPE_CHAT || clientstate == CS_TYPE_SHOUT)
	{
		if(check_typing()) // returns true if done typing
		{
			clientstate = CS_NORMAL;
			Base::def_cursor();
		}
		return false;
	}
	// else
	
	int key = getch();
	if(key != ERR) // there is some key
	{
		if(key == KEYCODE_INT)
			return true; // ^C quits

		if(clientstate == CS_HELP || clientstate == CS_TEAM_INFO)
		{
			// any key in help screen closes help
			leave_limbo(); // not leaving limbo, but the functionality is the same
			return false;
		}

		// Quickshouts handled regardless of clientstate:
		if(ClassCPV::im_alive())
		{
			for(char f = 1; f <= MAX_QUICK_SHOUTS; ++f)
			{
				if(key == KEY_F(f))
				{
					if(!Config::quick_shout(--f).empty())
						Network::send_line(Config::quick_shout(f), false);
					return false;
				}
			}
		}

		if(clientstate == CS_LIMBO)
		{
			key = tolower(key);
			if(key <= 'k' && key >= 'a') // switch class
			{
				Network::send_spawn((unsigned char)(key - 'a'));
				leave_limbo();
			}
			else if(key == 't')
			{
				Network::send_switch();
				leave_limbo();
			}
			else if(key == 's')
			{
				Network::send_spawn(NO_CLASS);
				leave_limbo();
			}
			else if(key == 'l' || key == 27) // 27: escape
				leave_limbo();
		}
		else
		{
			if(key == '?') // help key
			{
				clientstate = CS_HELP;
				walkmode_off();
				redraw_view();
				Base::type_cursor(0);
				return false;
			}

			// if here, we need to convert the key:
			e_Key_binding kb = MAX_KEY_BINDING;
			if(key < 256) // fits in a byte; try to convert
				kb = Config::convert_key(char(key));
			// map arrow keys to the directions, for the n00bs:
			else if(key == KEY_UP)
				kb = KB_8;
			else if(key == KEY_DOWN)
				kb = KB_2;
			else if(key == KEY_LEFT)
				kb = KB_4;
			else if(key == KEY_RIGHT)
				kb = KB_6;
		
			if(kb < MAX_KEY_BINDING) // a recognized key
			{
			switch(kb)
			{
			/*
			 * The effect of these depends on clientstate & class.
			 * The handling is delegated to class_cpv.cpp
			 */
			case KB_1: // movement
			case KB_2: case KB_3: case KB_4: case KB_6: case KB_7: case KB_8: case KB_9:
				ClassCPV::move((last_dir = e_Dir(kb)));
				break;
			case KB_5: // special direction
				ClassCPV::five();
				last_dir = MAX_D;
				break;
			case KB_SPACE: // action key
				ClassCPV::space();
				walkmode_off();
				break;
			case KB_p: // follow previous key
				ClassCPV::follow_prev();
				walkmode_off();
				break;

			/*
			 * These can be done in the middle of unfinished actions, but will cause
			 * interruption:
			 */
			case KB_C: // say in chat
				clientstate = CS_TYPE_CHAT;
				init_type();
				walkmode_off();
				break;
			case KB_s: // say aloud
				clientstate = CS_TYPE_SHOUT;
				init_type();
				walkmode_off();
				break;
			case KB_c: // close a door
				Network::send_action(XN_CLOSE_DOOR);
				// interrupts any aiming/casting etc:
				clientstate = CS_NORMAL;
				walkmode_off();
				break;
			case KB_u: // torch handling
				Network::send_action(XN_TORCH_HANDLE);
				// interrupts any aiming/casting etc:
				clientstate = CS_NORMAL;
				walkmode_off();
				break;
			case KB_T: // trigger a trap
				Network::send_action(XN_TRAP_TRIGGER);
				// interrupts any aiming/casting etc:
				clientstate = CS_NORMAL;
				walkmode_off();
				break;
			case KB_X: // suicide
				ClassCPV::suicide();
				walkmode_off();
				break;
			case KB_l: // limbo toggle
				clientstate = CS_LIMBO;
				walkmode_off();
				redraw_view();
				Base::type_cursor(0);
				break;
			case KB_i: // request team info
				Network::send_teami_req();
				break;	
			case KB_Q: // quit
				return true; // confirmation? nah

			/*
			 * The following can be carried out in any clientstate except limbo
			 * without interruption:
			 */
			case KB_w: // walk toggle
				if(walkmode)
					walkmode_off();
				else
					Base::print_walk((walkmode = true));
				break;
			case KB_t: // titles toggle
				toggle_titles();
				break;
			case KB_d: // differentiate titles
				diff_titles();
				break;
			case KB_o: // ouching toggle
				add_msg(string("[Reacting to damage ") + offon[Config::toggle_ouch()], 15);
				break;
			case KB_PLUS:
				scroll_chat_up();
				break;
			case KB_MINUS:
				scroll_chat_down();
				break;
			case KB_PERCENT:
				add_msg(string("[Act per turn ") + offon[Config::toggle_act_per_turn()], 15);
				break;
			default: break;
			}
			} // a recognized key binding
		} // need to convert key
	} // key != ERR
	else if(clientstate == CS_NORMAL && walkmode && last_dir != MAX_D
		&& Network::not_acted())
		ClassCPV::move(last_dir);
	return false;
}
예제 #11
0
static void *
build_fortran_types (struct gdbarch *gdbarch)
{
  struct builtin_f_type *builtin_f_type
    = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_f_type);

  builtin_f_type->builtin_void =
    init_type (TYPE_CODE_VOID, 1,
	       0,
	       "VOID", (struct objfile *) NULL);

  builtin_f_type->builtin_character =
    init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
	       0,
	       "character", (struct objfile *) NULL);

  builtin_f_type->builtin_logical_s1 =
    init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
	       TYPE_FLAG_UNSIGNED,
	       "logical*1", (struct objfile *) NULL);

  builtin_f_type->builtin_integer_s2 =
    init_type (TYPE_CODE_INT,
	       gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
	       0, "integer*2", (struct objfile *) NULL);

  builtin_f_type->builtin_logical_s2 =
    init_type (TYPE_CODE_BOOL,
	       gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
	       TYPE_FLAG_UNSIGNED, "logical*2", (struct objfile *) NULL);

  builtin_f_type->builtin_integer =
    init_type (TYPE_CODE_INT, 
	       gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
	       0, "integer", (struct objfile *) NULL);

  builtin_f_type->builtin_logical =
    init_type (TYPE_CODE_BOOL, 
	       gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
	       TYPE_FLAG_UNSIGNED, "logical*4", (struct objfile *) NULL);

  builtin_f_type->builtin_real =
    init_type (TYPE_CODE_FLT,
	       gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
	       0,
	       "real", (struct objfile *) NULL);

  builtin_f_type->builtin_real_s8 =
    init_type (TYPE_CODE_FLT,
	       gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
	       0,
	       "real*8", (struct objfile *) NULL);

  builtin_f_type->builtin_real_s16 =
    init_type (TYPE_CODE_FLT,
	       gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
	       0,
	       "real*16", (struct objfile *) NULL);

  builtin_f_type->builtin_complex_s8 =
    init_type (TYPE_CODE_COMPLEX,
	       2 * gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
	       0,
	       "complex*8", (struct objfile *) NULL);
  TYPE_TARGET_TYPE (builtin_f_type->builtin_complex_s8)
    = builtin_f_type->builtin_real;

  builtin_f_type->builtin_complex_s16 =
    init_type (TYPE_CODE_COMPLEX,
	       2 * gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
	       0,
	       "complex*16", (struct objfile *) NULL);
  TYPE_TARGET_TYPE (builtin_f_type->builtin_complex_s16)
    = builtin_f_type->builtin_real_s8;

  /* We have a new size == 4 double floats for the
     complex*32 data type */

  builtin_f_type->builtin_complex_s32 =
    init_type (TYPE_CODE_COMPLEX,
	       2 * gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
	       0,
	       "complex*32", (struct objfile *) NULL);
  TYPE_TARGET_TYPE (builtin_f_type->builtin_complex_s32)
    = builtin_f_type->builtin_real_s16;

  return builtin_f_type;
}
예제 #12
0
struct type *
c_create_fundamental_type(struct objfile *objfile, int ctypeid)
{
  struct type *type = NULL;

  switch (ctypeid)
    {
    default:
      /* FIXME:  For now, if we are asked to produce a type not in this
         language, create the equivalent of a C integer type with the
         name "<?type?>".  When all the dust settles from the type
         reconstruction work, this should probably become an error. */
      type = init_type (TYPE_CODE_INT,
			TARGET_INT_BIT / TARGET_CHAR_BIT,
			0, "<?type?>", objfile);
      warning (_("internal error: no C/C++ fundamental type %d"), ctypeid);
      break;
    case FT_VOID:
      type = init_type (TYPE_CODE_VOID,
			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
			0, "void", objfile);
      break;
    case FT_BOOLEAN:
      type = init_type (TYPE_CODE_BOOL,
			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
			0, "bool", objfile);
      break;
    case FT_CHAR:
      type = init_type (TYPE_CODE_INT,
			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
			TYPE_FLAG_NOSIGN, "char", objfile);
      break;
    case FT_SIGNED_CHAR:
      type = init_type (TYPE_CODE_INT,
			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
			0, "signed char", objfile);
      break;
    case FT_UNSIGNED_CHAR:
      type = init_type (TYPE_CODE_INT,
			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
			TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
      break;
    case FT_SHORT:
      type = init_type (TYPE_CODE_INT,
			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
			0, "short", objfile);
      break;
    case FT_SIGNED_SHORT:
      type = init_type (TYPE_CODE_INT,
			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
			0, "short", objfile);	/* FIXME-fnf */
      break;
    case FT_UNSIGNED_SHORT:
      type = init_type (TYPE_CODE_INT,
			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
			TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
      break;
    case FT_INTEGER:
      type = init_type (TYPE_CODE_INT,
			TARGET_INT_BIT / TARGET_CHAR_BIT,
			0, "int", objfile);
      break;
    case FT_SIGNED_INTEGER:
      type = init_type (TYPE_CODE_INT,
			TARGET_INT_BIT / TARGET_CHAR_BIT,
			0, "int", objfile);	/* FIXME -fnf */
      break;
    case FT_UNSIGNED_INTEGER:
      type = init_type (TYPE_CODE_INT,
			TARGET_INT_BIT / TARGET_CHAR_BIT,
			TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
      break;
    case FT_LONG:
      type = init_type (TYPE_CODE_INT,
			TARGET_LONG_BIT / TARGET_CHAR_BIT,
			0, "long", objfile);
      break;
    case FT_SIGNED_LONG:
      type = init_type (TYPE_CODE_INT,
			TARGET_LONG_BIT / TARGET_CHAR_BIT,
			0, "long", objfile);	/* FIXME -fnf */
      break;
    case FT_UNSIGNED_LONG:
      type = init_type (TYPE_CODE_INT,
			TARGET_LONG_BIT / TARGET_CHAR_BIT,
			TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
      break;
    case FT_LONG_LONG:
      type = init_type (TYPE_CODE_INT,
			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
			0, "long long", objfile);
      break;
    case FT_SIGNED_LONG_LONG:
      type = init_type (TYPE_CODE_INT,
			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
			0, "signed long long", objfile);
      break;
    case FT_UNSIGNED_LONG_LONG:
      type = init_type (TYPE_CODE_INT,
			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
      break;
    case FT_FLOAT:
      type = init_type (TYPE_CODE_FLT,
			TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
			0, "float", objfile);
      break;
    case FT_DBL_PREC_FLOAT:
      type = init_type (TYPE_CODE_FLT,
			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
			0, "double", objfile);
      break;
    case FT_EXT_PREC_FLOAT:
      type = init_type (TYPE_CODE_FLT,
			TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
			0, "long double", objfile);
      break;
    case FT_COMPLEX:
      type = init_type (TYPE_CODE_FLT,
			2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
			0, "complex float", objfile);
      TYPE_TARGET_TYPE (type)
	= init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
		     0, "float", objfile);
      break;
    case FT_DBL_PREC_COMPLEX:
      type = init_type (TYPE_CODE_FLT,
			2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
			0, "complex double", objfile);
      TYPE_TARGET_TYPE (type)
	= init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
		     0, "double", objfile);
      break;
    case FT_EXT_PREC_COMPLEX:
      type = init_type (TYPE_CODE_FLT,
			2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
			0, "complex long double", objfile);
      TYPE_TARGET_TYPE (type)
	= init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
		     0, "long double", objfile);
      break;
    case FT_TEMPLATE_ARG:
      type = init_type (TYPE_CODE_TEMPLATE_ARG,
			0,
			0, "<template arg>", objfile);
      break;
    }
  return (type);
}
예제 #13
0
be_sequence::be_sequence (AST_Expression *v, AST_Type *t)
:
   AST_Decl
   (
      AST_Decl::NT_sequence,
      new UTL_ScopedName (new Identifier ("sequence", 1, 0, I_FALSE), NULL)
   ),
   AST_Sequence(v, t),
   initialized (pbfalse),
   maxSize (0),
   anonymous (pbtrue),
   deferred (pbfalse),
   isPrimitiveSeq (pbfalse),
   isStringSeq (pbfalse),
   isInterfaceSeq (pbfalse),
   baseType (0)
{
   // NOTE: BASE TYPE AND MAX SIZE ARE KNOWN
   assert(base_type());
   assert(max_size());

   static int sequence_count = 0;

   isAtModuleScope(pbfalse);
   idlType = this;

   if (base_type())
   {
      baseType = be_Type::_narrow(base_type());
      baseType = baseType->idlType;
      isStringSeq = baseType->IsStringType();
      isInterfaceSeq = baseType->IsInterfaceType();
      isValueSeq = baseType->IsValueType();
      isPrimitiveSeq = (baseType->IsPrimitiveType()
                        && baseType->IsFixedLength() // eliminates ANY, etc..
                        && !baseType->IsEnumeratedType());

      // Sequence of Typecode mem leak fix eCPP896
      be_predefined_type * pdt = be_predefined_type::_narrow(base_type());
      
      if (pdt && (pdt->pt() == AST_PredefinedType::PT_typecode))
      {
         isInterfaceSeq = TRUE;
      }
   }
   else
   {
      UTL_Error* oops = new UTL_Error;

      oops->error0(UTL_Error::EIDL_LOOKUP_ERROR);
      delete oops;
   }

   if (baseType->IsExceptionType())
   {
      UTL_Error* oops = new UTL_Error;

      oops->error0(UTL_Error::EIDL_ILLEGAL_USE);
      delete oops;
   }

   maxSize = ExprToULong(max_size());

   if (baseType)
   {
      be_Type * unaliasedBase = be_typedef::_beBase(base_type());

      baseTypeName = baseType->SequenceMemberTypeName();

      //
      // create type id (YO maybe should be the same as the equivalence id
      //
      localName = (DDS_StdString)"_s_" + baseType->TypeName() + "_";
      localName += BE_Globals::int_to_string(MaxSize());
      ColonToBar((char *)localName);

      //
      // create operational type equivalence id
      //
      m_any_op_id = (DDS_StdString)"_s_" + unaliasedBase->any_op_id() + "_";
      m_any_op_id += BE_Globals::int_to_string(MaxSize()) + "_";
      m_any_op_id += BE_Globals::int_to_string(sequence_count++);
      ColonToBar((char *)m_any_op_id);
   }

   // initialize typecode
   m_typecode->kind = DDS::tk_sequence;

   m_typecode->members.push_back(baseType->m_typecode);

   m_typecode->bounds = MaxSize();

   m_typecode->length = 0;

   if (!IsBounded())
   {
      m_typecode->bounds = 0;
   }

   if (isStringSeq)
   {
      m_typecode->id = "SEQ_DDS::String_" + BE_Globals::ulong_to_string(m_typecode->bounds);
   }

   init_type (enclosingScope, localName);
}
예제 #14
0
static void init_compiler (int	 argc,
			   char *argv[])
{
   extern void	init_lex (void);
   extern void	init_msg_processing (char *[]);
   extern void	init_src_input (void);
   extern void	init_type (void);
   extern void	process_cmd_line (int, char *[]);
   extern void	init_cond_comp(void);
   extern void	enter_predefined_macros(void);
   extern void	init_parse_prog_unit(void);
   extern void	init_PDGCS (void);
   extern void	set_up_token_tables(void);
   extern void  sgi_cmd_line(int *argc, char **argv[]);
   extern char *operator_str[];
   extern void	verify_semantic_tbls(void);

   	  int	idx;


   TRACE (Func_Entry, "init_compiler", NULL);

   init_date_time_info ();		/* set compilation data and time      */
   init_msg_processing (argv);		/* initialize for messages.  Must     */
					/* preceed process_cmd_line.	      */

# ifdef _DEBUG
   check_defines_compatibility();	/* Is the compiler built correctly?   */
   check_enums_for_change();	        /* Some enums must not be changed.    */
# endif

# if 0
   check_license();
# endif

   /* allocate memory for data structures required across compilation units.  */
   /* These must preceed process_cmd_line.                                    */

   TBL_ALLOC (global_line_tbl);
   TBL_ALLOC (global_name_tbl);
   TBL_ALLOC (global_attr_tbl);
   TBL_ALLOC (global_type_tbl);
   TBL_ALLOC (global_bounds_tbl);
   TBL_ALLOC (global_ir_tbl);
   TBL_ALLOC (global_ir_list_tbl);
   TBL_ALLOC (global_sh_tbl);
   TBL_ALLOC (file_path_tbl);
   TBL_ALLOC (str_pool);

   init_release_level ();		/* Set up release_level from system   */

   str_pool[0].name_long	= 0;
   str_pool[1].name_long	= 0;
   str_pool[2].name_long	= LARGE_WORD_FOR_TBL_SRCH;
   str_pool_idx			= 2;

   TBL_REALLOC_CK(global_name_tbl, 2);
   CLEAR_TBL_NTRY(global_name_tbl, 1);
   CLEAR_TBL_NTRY(global_name_tbl, 2);
   GN_NAME_IDX(1)	= 1;
   GN_NAME_LEN(1)	= HOST_BYTES_PER_WORD;
   GN_NAME_IDX(2)	= 2;
   GN_NAME_LEN(2)	= HOST_BYTES_PER_WORD;

   /* Initialize the bounds table for deferred shape arrays */

   TBL_REALLOC_CK(global_bounds_tbl, 7);

   for (idx = BD_DEFERRED_1_IDX; idx <= BD_DEFERRED_7_IDX; idx++) {
      CLEAR_TBL_NTRY(global_bounds_tbl, idx);
      GB_ARRAY_CLASS(idx)	= Deferred_Shape;
      GB_RANK(idx)		= idx;
   }

   /* Initialize the conditional compilation tables.  It must be done before  */
   /* the command line processing because of the -D and -U options.           */

   init_cond_comp ();

   get_machine_chars();

   set_up_token_tables();

   /* The following routines sets things such as target_ieee, target_triton   */
   /* two_word_fcd, word_byte_size ect...                                     */

   set_compile_info_for_target();


   comp_phase = Cmdline_Parsing;

   cif_name[0] = NULL_CHAR;

   assembly_listing_file[0] = NULL_CHAR;

   debug_file_name[0] = NULL_CHAR;

# if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX))
   /* sgi_cmd_line does some option manipulation, process SGI specific        */
   /* command line options, and strips out things that the front-end doesn't  */
   /* need to see.                                                            */

   sgi_cmd_line (&argc,&argv);
# endif


   process_cmd_line (argc, argv);	/* pass input args		      */


# if defined(_INTEGER_1_AND_2)

   if (on_off_flags.integer_1_and_2) {
      bit_size_tbl[Integer_1] = 8;
      bit_size_tbl[Integer_2] = 16;
      bit_size_tbl[Logical_1] = 8;
      bit_size_tbl[Logical_2] = 16;

      storage_bit_size_tbl[Integer_1] = 8;
      storage_bit_size_tbl[Integer_2] = 16;
      storage_bit_size_tbl[Logical_1] = 8;
      storage_bit_size_tbl[Logical_2] = 16;

      storage_bit_prec_tbl[Integer_1] = 8;
      storage_bit_prec_tbl[Integer_2] = 16;
      storage_bit_prec_tbl[Logical_1] = 8;
      storage_bit_prec_tbl[Logical_2] = 16;

      stride_mult_unit_in_bits[Integer_1] = 8;
      stride_mult_unit_in_bits[Integer_2] = 16;
      stride_mult_unit_in_bits[Logical_1] = 8;
      stride_mult_unit_in_bits[Logical_2] = 16;

      linear_to_arith[Integer_1] = AR_Int_8_S;
      linear_to_arith[Integer_2] = AR_Int_16_S;

      input_arith_type[Integer_1] = AR_Int_8_U;
      input_arith_type[Integer_2] = AR_Int_16_U;

      strcpy(arith_type_string[Integer_1], "AR_Int_8_U");
      strcpy(arith_type_string[Integer_2], "AR_Int_16_U");
   }
# endif

   comp_phase = Pass1_Parsing;

   /* only -V info requested */

   if (argc == 2 && cmd_line_flags.verify_option) {
      print_id_line();
      exit_compiler(RC_OKAY);
   }

   if (num_errors != 0) {		/* command line errors	      */
      PRINTMSG(0, 912, Log_Summary, 0, num_errors);
      exit_compiler(RC_USER_ERROR);
   }

   /* Call init_cif even if the user did NOT request Compiler Information     */
   /* File (CIF) output because the CIF is used for messaging.		      */
   
   init_cif(comp_date_time, release_level);

   some_scp_in_err	= FALSE;
   clearing_blk_stk	= FALSE;

   init_type();
        
   make_table_changes ();

   init_sytb ();		 /* Must be before src_input for err msgs */


   /* Enter conditional compilation predefined macros.  This must happen      */
   /* after process_cmd_line because it calls GETPMC (and the information     */
   /* from GETPMC is needed to set the predefined macros that depend on the   */
   /* target machine).  This call must also happen after target_triton and    */
   /* target_ieee have been set so that we can get _CRAYIEEE set correctly.   */
   /* And finally, this call must come before init_src_input because that     */
   /* procedure gets the first source line - which could be a conditional     */
   /* compilation directive.					              */

   enter_predefined_macros();

   /* Must do the first call here so that tables needed by conditional        */
   /* compilation are set up.						      */

   init_parse_prog_unit();	

   init_src_input();

   if (on_off_flags.preprocess_only) {
      preprocess_only_driver();
      issue_deferred_msgs();

      TRACE (Func_Exit, "init_compiler", NULL);

      return;
   }

   init_lex ();

   max_field_len = (long) sbrk(0);	/* Keep track of memory usage         */

# if defined(_HOST_OS_MAX)
   max_field_len &= (1 << 32) - 1;
# endif


   /* Pathological case:  The file is empty.  At least an END statement must  */
   /* be present to constitute a valid Fortran program.                       */

   if (LA_CH_CLASS == Ch_Class_EOF) {
      PRINTMSG(0, 1391, Log_Warning, 0, src_file);
      issue_deferred_msgs();
   }


# ifdef _NAME_SUBSTITUTION_INLINING
   if (!dump_flags.preinline)
# endif
      init_PDGCS();

# ifdef _DEBUG
   verify_semantic_tbls();	/* Make sure flags and messages agree. */

   if (strcmp(operator_str[The_Last_Opr], "The_Last_Opr") != 0) {
      PRINTMSG(1, 689, Internal, 0);
   }
# endif

   TRACE (Func_Exit, "init_compiler", NULL);

   return;
 
}  /* init_compiler */
예제 #15
0
파일: migcom.c 프로젝트: Prajna/mach
void
main(int argc, char **argv)
{
    FILE *uheader, *server, *user;
    FILE *iheader, *sheader;

    set_program_name("mig");
    parseArgs(argc, argv);
    init_global();
    init_type();

    LookNormal();
    (void) yyparse();

    if (errors > 0)
	exit(1);

    more_global();

    uheader = myfopen(UserHeaderFileName, "w");
    if (!UserFilePrefix)
	user = myfopen(UserFileName, "w");
    server = myfopen(ServerFileName, "w");
    if (ServerHeaderFileName)
	sheader = myfopen(ServerHeaderFileName, "w");
    if (IsKernelServer)
    {
	iheader = myfopen(InternalHeaderFileName, "w");
    }

    if (BeVerbose)
    {
	printf("Writing %s ... ", UserHeaderFileName);
	fflush(stdout);
    }
    WriteUserHeader(uheader, StatementList);
    fclose(uheader);
    if (ServerHeaderFileName)
    {
	if (BeVerbose)
	{
	    printf ("done.\nWriting %s ...", ServerHeaderFileName);
	    fflush (stdout);
	}
	WriteServerHeader(sheader, StatementList);
	fclose(sheader);
    }
    if (IsKernelServer)
    {
	if (BeVerbose)
	{
	    printf("done.\nWriting %s ... ", InternalHeaderFileName);
	    fflush(stdout);
	}
	WriteInternalHeader(iheader, StatementList);
	fclose(iheader);
    }
    if (UserFilePrefix)
    {
	if (BeVerbose)
	{
	    printf("done.\nWriting individual user files ... ");
	    fflush(stdout);
	}
	WriteUserIndividual(StatementList);
    }
    else
    {
	if (BeVerbose)
	{
	    printf("done.\nWriting %s ... ", UserFileName);
	    fflush(stdout);
	}
	WriteUser(user, StatementList);
	fclose(user);
    }
    if (BeVerbose)
    {
	printf("done.\nWriting %s ... ", ServerFileName);
	fflush(stdout);
    }
    WriteServer(server, StatementList);
    fclose(server);
    if (BeVerbose)
	printf("done.\n");

    exit(0);
}
예제 #16
0
/* Return a GDB type representing `struct gdb_gnu_v3_abi_vtable',
   described above, laid out appropriately for ARCH.

   We use this function as the gdbarch per-architecture data
   initialization function.  */
static void *
build_gdb_vtable_type (struct gdbarch *arch)
{
  struct type *t;
  struct field *field_list, *field;
  int offset;

  struct type *void_ptr_type
    = builtin_type (arch)->builtin_data_ptr;
  struct type *ptr_to_void_fn_type
    = builtin_type (arch)->builtin_func_ptr;

  /* ARCH can't give us the true ptrdiff_t type, so we guess.  */
  struct type *ptrdiff_type
    = init_type (TYPE_CODE_INT,
		 gdbarch_ptr_bit (arch) / TARGET_CHAR_BIT, 0,
                 "ptrdiff_t", 0);

  /* We assume no padding is necessary, since GDB doesn't know
     anything about alignment at the moment.  If this assumption bites
     us, we should add a gdbarch method which, given a type, returns
     the alignment that type requires, and then use that here.  */

  /* Build the field list.  */
  field_list = xmalloc (sizeof (struct field [4]));
  memset (field_list, 0, sizeof (struct field [4]));
  field = &field_list[0];
  offset = 0;

  /* ptrdiff_t vcall_and_vbase_offsets[0]; */
  FIELD_NAME (*field) = "vcall_and_vbase_offsets";
  FIELD_TYPE (*field)
    = create_array_type (0, ptrdiff_type,
                         create_range_type (0, builtin_type_int32, 0, -1));
  FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
  offset += TYPE_LENGTH (FIELD_TYPE (*field));
  field++;

  /* ptrdiff_t offset_to_top; */
  FIELD_NAME (*field) = "offset_to_top";
  FIELD_TYPE (*field) = ptrdiff_type;
  FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
  offset += TYPE_LENGTH (FIELD_TYPE (*field));
  field++;

  /* void *type_info; */
  FIELD_NAME (*field) = "type_info";
  FIELD_TYPE (*field) = void_ptr_type;
  FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
  offset += TYPE_LENGTH (FIELD_TYPE (*field));
  field++;

  /* void (*virtual_functions[0]) (); */
  FIELD_NAME (*field) = "virtual_functions";
  FIELD_TYPE (*field)
    = create_array_type (0, ptr_to_void_fn_type,
                         create_range_type (0, builtin_type_int32, 0, -1));
  FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT;
  offset += TYPE_LENGTH (FIELD_TYPE (*field));
  field++;

  /* We assumed in the allocation above that there were four fields.  */
  gdb_assert (field == (field_list + 4));

  t = init_type (TYPE_CODE_STRUCT, offset, 0, 0, 0);
  TYPE_NFIELDS (t) = field - field_list;
  TYPE_FIELDS (t) = field_list;
  TYPE_TAG_NAME (t) = "gdb_gnu_v3_abi_vtable";

  return t;
}