Ejemplo n.º 1
0
int main()
{
  for ( int i = 1 ; i <= 32 ; ++i ) {
    const size_t global_size = 16 * i ;
    const size_t global_box[3][2] = { { 0 , 65 } , { 0 , 65 } , { 0 , 65 } };
    if ( 30 < test_box( global_size , global_box , false ) ) {
      test_box( global_size , global_box , true );
    }
  }

//  test_elem();

  {
    std::cout << "test_fixture< Host >" << std::endl ;
    Kokkos::HostSpace::execution_space::initialize( 1 );
    Kokkos::Example::test_fixture< Kokkos::HostSpace::execution_space >();
    Kokkos::HostSpace::execution_space::finalize();
  }

#if defined( KOKKOS_HAVE_CUDA )
  {
    std::cout << "test_fixture< Cuda >" << std::endl ;
    Kokkos::HostSpace::execution_space::initialize();
    Kokkos::Cuda::initialize( Kokkos::Cuda::SelectDevice(0) );
    Kokkos::Example::test_fixture< Kokkos::Cuda >();
    Kokkos::Cuda::finalize();
    Kokkos::HostSpace::execution_space::finalize();
  }
#endif
}
Ejemplo n.º 2
0
int main(void)
{
  int i, strict;
  //  srand(time(NULL));
  srand(0);
  intdim = 0;
  /*for (intdim=1;intdim<2;intdim++) {*/

  for (strict=0;strict<2;strict++) {
    /* init */
    pk = pk_manager_alloc(strict);
    ppl = ap_ppl_poly_manager_alloc(strict);
    for (i=0;i<AP_EXC_SIZE;i++){
      pk->option.abort_if_exception[i] = true;
      ppl->option.abort_if_exception[i] = true;
    }
    
    printf("\n\ncomparing libraries:\n- %s (%s)\n- %s (%s)\nwith strict=%i int=%i\n\n",
	   pk->library,pk->version,ppl->library,ppl->version,strict,intdim);
    /* run tests */
    test_conv();
    test_join();
    test_meet();
    test_join_array();
    test_meet_array();
    test_dimadd();
    test_dimrem();
    test_forget();
    test_permute();
    test_expand();
    test_fold();
    test_add_lincons();
    test_add_ray();
    test_box();
    test_vbound();
    test_lbound();
    test_csat();
    test_isat();
    test_assign();
    test_par_assign();
    test_subst();
    test_par_subst();
    if (!strict) test_widen(); // behave differently in strict mode
   
    /* clean-up */
    ap_manager_free(pk);
    ap_manager_free(ppl);
  }

  /*}*/

  if (error_) printf("\n%i error(s)!\n",error_);
  else printf("\nall tests passed\n");
  return 0;
}
Ejemplo n.º 3
0
static bool
test_mipmap_tree(void)
{
	bool pass = true;
	int level;

	for (level = 0; level < TEX_LEVELS; level++) {
		pass = pass && test_box(level);
	}

	return pass;
}
Ejemplo n.º 4
0
int main( int argc , char * argv[] )
{
  int np_max = 256 ;
  int box[3][2] = { { 0 , 64 } , { 0 , 64 } , { 0 , 64 } };
  int np = 0 ;

  switch( argc ) {
  case 3:
    sscanf(argv[1],"%d",&np);
    sscanf(argv[2],"%dx%dx%d",& box[0][1] , & box[1][1] , & box[2][1] );
    if ( 0 < np ) { test_box(  (const int (*)[2]) box , np ); }
    if ( 0 < np ) { test_maps( (const int (*)[2]) box , np ); }
    break ;
  default:
    for ( np = 1 ; np <= np_max ; ++np ) {
      test_box(  (const int (*)[2]) box , np );
      test_maps( (const int (*)[2]) box , np );
    }
    break ;
  }
  return 0 ;
}
// This method resolves the cc bbox to a particular row and returns the row's
// xheight.
int ShiroRekhaSplitter::GetXheightForCC(Box* cc_bbox) {
  if (!segmentation_block_list_) {
    return global_xheight_;
  }
  // Compute the box coordinates in Tesseract's coordinate system.
  TBOX bbox(cc_bbox->x,
            pixGetHeight(orig_pix_) - cc_bbox->y - cc_bbox->h - 1,
            cc_bbox->x + cc_bbox->w,
            pixGetHeight(orig_pix_) - cc_bbox->y - 1);
  // Iterate over all blocks.
  BLOCK_IT block_it(segmentation_block_list_);
  for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
    BLOCK* block = block_it.data();
    // Iterate over all rows in the block.
    ROW_IT row_it(block->row_list());
    for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
      ROW* row = row_it.data();
      if (!row->bounding_box().major_overlap(bbox)) {
        continue;
      }
      // Row could be skewed, warped, etc. Use the position of the box to
      // determine the baseline position of the row for that x-coordinate.
      // Create a square TBOX whose baseline's mid-point lies at this point
      // and side is row's xheight. Take the overlap of this box with the input
      // box and check if it is a 'major overlap'. If so, this box lies in this
      // row. In that case, return the xheight for this row.
      float box_middle = 0.5 * (bbox.left() + bbox.right());
      int baseline = static_cast<int>(row->base_line(box_middle) + 0.5);
      TBOX test_box(box_middle - row->x_height() / 2,
                    baseline,
                    box_middle + row->x_height() / 2,
                    static_cast<int>(baseline + row->x_height()));
      // Compute overlap. If it is is a major overlap, this is the right row.
      if (bbox.major_overlap(test_box)) {
        return row->x_height();
      }
    }
  }
  // No row found for this bbox.
  return kUnspecifiedXheight;
}
Ejemplo n.º 6
0
void move_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity)
{
	// do the move
	vec2 pos = *inout_pos;
	vec2 vel = *inout_vel;

	float distance = length(vel);
	int max = (int)distance;

	if(distance > 0.00001f)
	{
		//vec2 old_pos = pos;
		float fraction = 1.0f/(float)(max+1);
		for(int i = 0; i <= max; i++)
		{
			//float amount = i/(float)max;
			//if(max == 0)
				//amount = 0;

			vec2 new_pos = pos + vel*fraction; // TODO: this row is not nice

			if(test_box(vec2(new_pos.x, new_pos.y), size))
			{
				int hits = 0;

				if(test_box(vec2(pos.x, new_pos.y), size))
				{
					new_pos.y = pos.y;
					vel.y *= -elasticity;
					hits++;
				}

				if(test_box(vec2(new_pos.x, pos.y), size))
				{
					new_pos.x = pos.x;
					vel.x *= -elasticity;
					hits++;
				}

				// neither of the tests got a collision.
				// this is a real _corner case_!
				if(hits == 0)
				{
					new_pos.y = pos.y;
					vel.y *= -elasticity;
					new_pos.x = pos.x;
					vel.x *= -elasticity;
				}
			}
			if(test_box_platte(vec2(new_pos.x, new_pos.y), size) && vel.y > 0)
			{
				int hits = 0;

				if(test_box_platte(vec2(pos.x, new_pos.y), size))
				{
					new_pos.y = pos.y;
					vel.y *= -elasticity;
					hits++;
				}

				if(test_box_platte(vec2(new_pos.x, pos.y), size))
				{
					new_pos.x = pos.x;
					vel.x *= -elasticity;
					hits++;
				}

				// neither of the tests got a collision.
				// this is a real _corner case_!
				if(hits == 0)
				{
					new_pos.y = pos.y;
					vel.y *= -elasticity;
					new_pos.x = pos.x;
					vel.x *= -elasticity;
				}
			}

			pos = new_pos;
		}
	}

	*inout_pos = pos;
	*inout_vel = vel;
}
Ejemplo n.º 7
0
bool OccluderConfig::update(const FBox &bbox) {
	//TODO: hiding when close to a door/window
	FBox test_box(bbox.min.x, bbox.min.y + 1.0f, bbox.min.z, bbox.max.x, 256, bbox.max.z);
	float3 mid_point = asXZY(test_box.center().xz(), bbox.min.y + 2.0f);

	bool vis_changed = update();
	vector<int> temp;
	temp.reserve(256);
	IRect test_rect = (IRect)worldToScreen(bbox);
	const Grid &grid = m_map.m_grid;
	grid.findAll(temp, test_rect);

	vector<int> temp2;
	temp2.reserve(256);

	PodArray<int> overlaps(m_map.size());
	memset(overlaps.data(), 0, m_map.size() * sizeof(int));

	for(int i = 0; i < (int)temp.size(); i++) {
		const auto &object = grid[temp[i]];
		if(object.occluder_id == -1)
			continue;

		const OccluderMap::Occluder &occluder = m_map[object.occluder_id];
		int order = drawingOrder(object.bbox, bbox);
		if(order == 1)
			overlaps[object.occluder_id] = order;
	}

	for(int n = 0; n < (int)m_states.size(); n++) {
		bool is_overlapping = false;
		const OccluderMap::Occluder &occluder = m_map[n];

		if(overlaps[n] == 1) {
			FBox bbox_around(bbox.min - float3(16, 0, 16), bbox.max + float3(16, 0, 16));
			bbox_around.min.y = 0;
			bbox_around.max.y = Grid::max_height;

			temp2.clear();
			grid.findAll(temp2, bbox_around);
			FBox local_box = FBox();

			for(int i = 0; i < (int)temp2.size(); i++) {
				const auto &object = grid[temp2[i]];
				if(object.occluder_id == n)
					local_box = local_box.empty()? object.bbox : sum(local_box, object.bbox);
			}

			is_overlapping = local_box.min.y > mid_point.y;
		}

		if(is_overlapping != m_states[n].is_overlapping) {
			m_states[n].is_overlapping = is_overlapping;
			vis_changed = true;
		}
	}

	if(!vis_changed)
		return false;

	for(int n= 0; n < (int)m_states.size(); n++)
		m_states[n].is_visible = !m_states[n].is_overlapping;

//TODO: isUnder can be precomputed
	for(int n = 0; n < (int)m_states.size(); n++) {
		if(!m_states[n].is_visible)
			continue;

		for(int i = 0; i < (int)m_states.size(); i++)
			if(!m_states[i].is_visible && m_map.isUnder(i, n)) {
				m_states[n].is_visible = false;
				break;
			}
	}

	return true;
}
int main(int argc, char* argv[])
{
    std::shared_ptr<Material> black = std::make_shared<Material>();
    float depth = 100.0;
    glm::vec3 offset(0, 0, 0);
    Box test_box(glm::vec3{-1.0,-1.0,5.0} + offset, glm::vec3{1.0,1.0,6.0} + offset,"testbox", black);
    Sphere test_kreis(glm::vec3{0.0,0.0,5.0}, 1.0,"testkreis", black);
    Triangle test_triangle({1,0,5},{-1,0,5},{0,1,5});
    Light sonne("bla" ,{5.0,5.0,0.0}, {0.0,10.1,10.0}, {10.0,10.1,10.0});

  int win_size_x=400;
  int win_size_y=400;
  float xpos_pro=1/float(win_size_x);
  float ypos_pro=1/float(win_size_y);
  Window win(glm::ivec2(win_size_x,win_size_y));



	glm::vec3 eye{0, 0, 0};
	float focal_length = 2.0;

	float t = 0;

	win.update();



while (!win.shouldClose()) {

  for(int i=0; i<win_size_x; i++){
    for(int u=0; u<win_size_y; u++){

      float x = float(i) / win_size_x;
      float y = float(u) / win_size_y;

      auto ray_dir = glm::normalize(glm::vec3{2*x-1, 2*y-1, focal_length});
      Ray charles(eye, ray_dir);
      Intersection isec = test_kreis.intersect(charles);
      // std::cout<<isec<<std::endl;
      glm::vec3 sunPos = sonne.getPos();
      glm::vec3 Lichtstrahl = sunPos - isec.position;
      float phong = float(cos(glm::dot(Lichtstrahl, isec.normal)*3.14159/180));

      glm::vec3 kreisPos = test_kreis.getcenter();
    std::cout<<isec.position[0]<<" "<<isec.position[1]<<" "<<isec.position[2]<<" "<<std::endl;
      if (isec.hit){
        win.drawPoint(x,y, 255*phong, 
                           255*phong, 
                           255*phong);
         }
            
    }
    
  }
  // eye.y = 2.0 * std::sin(t);
  // eye.x = 2.0 * std::cos(t);
  // float t = 1.0;
  // // t += 1e-2;
  win.update();
  
}

  return 0;
}
Ejemplo n.º 9
0
void CHARACTER::tick_defered()
{
	// advance the dummy
	{
		WORLD_CORE tempworld;
		reckoningcore.world = &tempworld;
		reckoningcore.tick(false);
		reckoningcore.move();
		reckoningcore.quantize();
	}
	
	//lastsentcore;
	/*if(!dead)
	{*/
		vec2 start_pos = core.pos;
		vec2 start_vel = core.vel;
		bool stuck_before = test_box(core.pos, vec2(28.0f, 28.0f));
		
		core.move();

		if(is_hitting_door())
		{
			reset_pos();
			if(is_hitting_door() && !doorstuck)
			{
				game.send_emoticon(player->client_id,  11);
				doorstuck = true;
			}
		}
		else
			doorstuck = false;

		bool stuck_after_move = test_box(core.pos, vec2(28.0f, 28.0f));
		core.quantize();
		bool stuck_after_quant = test_box(core.pos, vec2(28.0f, 28.0f));
		pos = core.pos;
		
		if(!stuck_before && (stuck_after_move || stuck_after_quant))
		{
			dbg_msg("player", "STUCK!!! %d %d %d %f %f %f %f %x %x %x %x", 
				stuck_before,
				stuck_after_move,
				stuck_after_quant,
				start_pos.x, start_pos.y,
				start_vel.x, start_vel.y,
				*((unsigned *)&start_pos.x), *((unsigned *)&start_pos.y),
				*((unsigned *)&start_vel.x), *((unsigned *)&start_vel.y));
		}

		int events = core.triggered_events;
		int mask = cmask_all_except_one(player->client_id);
		
		if(events&COREEVENT_GROUND_JUMP) game.create_sound(pos, SOUND_PLAYER_JUMP, mask);
		
		//if(events&COREEVENT_HOOK_LAUNCH) snd_play_random(CHN_WORLD, SOUND_HOOK_LOOP, 1.0f, pos);
		if(events&COREEVENT_HOOK_ATTACH_PLAYER) game.create_sound(pos, SOUND_HOOK_ATTACH_PLAYER, cmask_all());
		if(events&COREEVENT_HOOK_ATTACH_GROUND) game.create_sound(pos, SOUND_HOOK_ATTACH_GROUND, mask);
		if(events&COREEVENT_HOOK_HIT_NOHOOK) game.create_sound(pos, SOUND_HOOK_NOATTACH, mask);
		//if(events&COREEVENT_HOOK_RETRACT) snd_play_random(CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, pos);
	//}
	
	if(team == -1)
	{
		pos.x = input.target_x;
		pos.y = input.target_y;
	}
	
	// update the sendcore if needed
	{
		NETOBJ_CHARACTER predicted;
		NETOBJ_CHARACTER current;
		mem_zero(&predicted, sizeof(predicted));
		mem_zero(&current, sizeof(current));
		reckoningcore.write(&predicted);
		core.write(&current);

		// only allow dead reackoning for a top of 3 seconds
		if(reckoning_tick+server_tickspeed()*3 < server_tick() || mem_comp(&predicted, &current, sizeof(NETOBJ_CHARACTER)) != 0)
		{
			reckoning_tick = server_tick();
			sendcore = core;
			reckoningcore = core;
		}
	}
}
Ejemplo n.º 10
0
void
concater_rep::typeset (tree t, path ip) {
  // cout << "Typeset " << t << "\n";
  // cout << "Typeset " << t << ", " << ip << ", " << obtain_ip (t) << "\n";

  /*
  if (obtain_ip (t) != ip)
    cout << "TeXmacs] Wrong ip: " << t << "\n"
	 << "       ] " << obtain_ip (t) << " -> " << ip << "\n";
  */

  if (!is_accessible (ip)) {
    path ip2= obtain_ip (t);
    //if (ip2 != ip) cout << t << ", " << ip << " -> " << ip2 << "\n";
    if (ip2 != path (DETACHED))
      ip= ip2;
  }

  if (env->hl_lan != 0)
    env->lan->highlight (t);

  if (is_atomic (t)) {
    if      (env->mode == 1) typeset_text_string (t, ip, 0, N(t->label));
    else if (env->mode == 2) typeset_math_string (t, ip, 0, N(t->label));
    else if (env->mode == 3) typeset_prog_string (t, ip, 0, N(t->label));
    else                     typeset_text_string (t, ip, 0, N(t->label));
    return;
  }

  switch (L (t)) {
  case UNINIT:
  case ERROR:
    typeset_error (t, ip);
    break;
  case RAW_DATA:
    typeset_inactive (t, ip);
    break;
  case DOCUMENT:
    typeset_document (t, ip);
    break;
  case PARA:
    typeset_paragraph (t, ip);
    break;
  case SURROUND:
    typeset_surround (t, ip);
    break;
  case CONCAT:
    typeset_concat (t, ip);
    break;
  case RIGID:
    typeset_rigid (t, ip);
    break;
  case HIDDEN:
    //(void) env->exec (t);
    if (N(t) != 1) typeset_error (t, ip);
    else (void) typeset_as_concat (env, t[0], descend (ip, 0));
    break;
  case FREEZE:
    if (N(t) != 1) typeset_error (t, ip);
    else typeset (attach_middle (t[0], ip));
    //typeset (freeze (t[0]), decorate_middle (ip));
    break;
  case UNFREEZE:
    if (N(t) != 1) typeset_error (t, ip);
    else typeset (t[0], descend (ip, 0));
    break;
  case HSPACE:
    t= env->exec (t);
    typeset_hspace (t, ip);
    break;
  case VAR_VSPACE:
    flag (env->drd->get_name (L(t)), ip, brown);
    t= tree (VAR_VSPACE, env->exec (tree (TMLEN, A(t))));
    control (t, ip);
    break;
  case VSPACE:
    flag (env->drd->get_name (L(t)), ip, brown);
    t= tree (VSPACE, env->exec (tree (TMLEN, A(t))));
    control (t, ip);
    break;
  case SPACE:
    t= env->exec (t);
    typeset_space (attach_here (t, ip));
    break;
  case HTAB:
    if (N(t) != 1 && N(t) != 2) { typeset_error (t, ip); break; }
    if (N(a)==0) print (empty_box (ip, 0, 0, 0, env->fn->yx));
    print (space (env->as_length (t[0])));
    control (t, ip);
    break;
  case MOVE:
    typeset_move (t, ip);
    break;
  case SHIFT:
    typeset_shift (t, ip);
    break;
  case RESIZE:
    typeset_resize (t, ip);
    break;
  case CLIPPED:
    typeset_clipped (t, ip);
    break;
  case REPEAT:
    typeset_repeat (t, ip);
    break;
  case _FLOAT:
    typeset_float (t, ip);
    break;
  case DATOMS:
    typeset_formatting (t, ip, ATOM_DECORATIONS);
    break;
  case DLINES:
    typeset_formatting (t, ip, LINE_DECORATIONS);
    break;
  case DPAGES:
    typeset_formatting (t, ip, PAGE_DECORATIONS);
    break;
  case DBOX:
    typeset_decorated_box (t, ip);
    break;
  case LINE_NOTE:
    typeset_line_note (t, ip);
    break;
  case PAGE_NOTE:
    typeset_page_note (t, ip);
    break;

  case WITH_LIMITS:
    with_limits (LIMITS_DISPLAY);
    flag ("with-limits", ip, brown);
    control (t, ip);
    break;
  case LINE_BREAK:
    if (N(a)>0) a[N(a)-1]->penalty = 0;	
    flag ("line-break", ip, brown);
    control (t, ip);
    break;
  case NEW_LINE:
  case NEXT_LINE:
    {
      string name= env->drd->get_name (L(t));
      flag (name, ip, brown);
      control (t, ip);
      break;
    }
  case NO_BREAK:
    if (N(a)>0) a[N(a)-1]->penalty = HYPH_INVALID;
    if ((N(a)>1) &&
	(a[N(a)-1]->type == STRING_ITEM) &&
	(a[N(a)-1]->b->get_leaf_string () == ""))
      a[N(a)-2]->penalty = HYPH_INVALID;	
    flag ("no line break", ip, brown);
    control (t, ip);
    break;
  case YES_INDENT:
    flag ("yes-first-indent", ip, brown);
    control (tuple ("env_par", PAR_FIRST, env->read (PAR_FIRST)), ip);
    break;
  case NO_INDENT:
    flag ("no-first-indent", ip, brown);
    control (tuple ("env_par", PAR_FIRST, "0cm"), ip);
    break;
  case VAR_YES_INDENT:
    flag ("yes-first-indent-after", ip, brown);
    control (tuple ("env_par", PAR_NO_FIRST, "false"), ip);
    break;
  case VAR_NO_INDENT:
    flag ("no-first-indent-after", ip, brown);
    control (tuple ("env_par", PAR_NO_FIRST, "true"), ip);
    break;
  case VAR_PAGE_BREAK:
  case PAGE_BREAK:
  case VAR_NO_PAGE_BREAK:
  case NO_PAGE_BREAK:
  case VAR_NO_BREAK_HERE:
  case NO_BREAK_HERE:
  case NO_BREAK_START:
  case NO_BREAK_END:
  case VAR_NEW_PAGE:
  case NEW_PAGE:
  case VAR_NEW_DPAGE:
  case NEW_DPAGE:
    {
      string name= env->drd->get_name (L(t));
      flag (name, ip, brown);
      control (t, ip);
      break;
    }

  case AROUND:
  case VAR_AROUND:
  case BIG_AROUND:
    typeset_around (t, ip, env->get_string (MATH_NESTING_MODE) != "off");
    break;
  case LEFT:
    typeset_large (t, ip, LEFT_BRACKET_ITEM, OP_OPENING_BRACKET, "<left-");
    break;
  case MID:
    typeset_large (t, ip, MIDDLE_BRACKET_ITEM, OP_MIDDLE_BRACKET, "<mid-");
    break;
  case RIGHT:
    typeset_large (t, ip, RIGHT_BRACKET_ITEM, OP_CLOSING_BRACKET, "<right-");
    break;
  case BIG:
    typeset_bigop (t, ip);
    break;
  case LONG_ARROW:
    typeset_long_arrow (t, ip);
    break;
  case LPRIME:
    typeset_lprime (t, ip);
    break;
  case RPRIME:
    typeset_rprime (t, ip);
    break;
  case BELOW:
    typeset_below (t, ip);
    break;
  case ABOVE:
    typeset_above (t, ip);
    break;
  case LSUB:
  case LSUP:
    typeset_script (t, ip, false);
    break;
  case RSUB:
  case RSUP:
    typeset_script (t, ip, true);
    break;
  case FRAC:
    typeset_frac (t, ip);
    break;
  case SQRT:
    typeset_sqrt (t, ip);
    break;
  case WIDE:
    typeset_wide (t, ip, true);
    break;
  case VAR_WIDE:
    typeset_wide (t, ip, false);
    break;
  case NEG:
    typeset_neg (t, ip);
    break;
  case TREE:
    typeset_tree (t, ip);
    break;
  case SYNTAX:
    typeset_syntax (t, ip);
    break;

  case TFORMAT:
    if ((N(t)>0) && is_table (t[N(t)-1])) typeset_table (t, ip);
    else typeset_formatting (t, ip, CELL_FORMAT);
    break;
  case TWITH:
  case CWITH:
  case TMARKER:
    typeset_inactive (t, ip);
    break;
  case TABLE:
    typeset_table (t, ip);
    break;
  case ROW:
  case CELL:
  case SUBTABLE:
    break;

  case ASSIGN:
    typeset_assign (t, ip);
    break;
  case WITH:
    typeset_with (t, ip);
    break;
  case PROVIDES:
    typeset_executable (t, ip);
    break;
  case QUOTE_VALUE:
    typeset_inactive (t, ip);
    break;
  case VALUE:
    typeset_value (t, ip);
    break;
  case MACRO:
    typeset_inactive (t, ip);
    break;
  case DRD_PROPS:
    typeset_drd_props (t, ip);
    break;
  case ARG:
    typeset_argument (t, ip);
    break;
  case QUOTE_ARG:
    typeset_inactive (t, ip);
    break;
  case COMPOUND:
    typeset_compound (t, ip);
    break;
  case XMACRO:
    typeset_inactive (t, ip);
    break;
  case GET_LABEL:
    typeset_executable (t, ip);
    break;
  case GET_ARITY:
    typeset_executable (t, ip);
    break;
  case MAP_ARGS:
    typeset_rewrite (t, ip);
    break;
  case EVAL_ARGS:
    typeset_eval_args (t, ip);
    break;
  case MARK:
    typeset_mark (t, ip);
    break;
  case EXPAND_AS:
    typeset_expand_as (t, ip);
    break;
  case EVAL:
    typeset_eval (t, ip);
    break;
  case QUOTE:
    typeset_inactive (t, ip);
    break;
  case QUASI:
    typeset_eval (tree (EVAL, tree (QUASIQUOTE, t[0])), ip);
    break;
  case QUASIQUOTE:
  case UNQUOTE:
  case VAR_UNQUOTE:
  case COPY:
    typeset_executable (t, ip);
    break;
  case IF:
    typeset_if (t, ip);
    break;
  case VAR_IF:
    typeset_var_if (t, ip);
    break;
  case CASE:
    typeset_case (t, ip);
    break;
  case WHILE:
  case FOR_EACH:
    typeset_executable (t, ip);
    break;
  case EXTERN:
    typeset_rewrite (t, ip);
    break;
  case VAR_INCLUDE:
    typeset_include (t, ip);
    break;
  case INCLUDE:
    typeset_compound (t, ip);
    break;
  case USE_PACKAGE:
  case USE_MODULE:
    typeset_executable (t, ip);
    break;

  case OR:
  case XOR:
  case AND:
  case NOT:
  case PLUS:
  case MINUS:
  case TIMES:
  case OVER:
  case DIV:
  case MOD:
  case MINIMUM:
  case MAXIMUM:
  case MATH_SQRT:
  case EXP:
  case LOG:
  case POW:
  case COS:
  case SIN:
  case TAN:
  case MERGE:
  case LENGTH:
    typeset_executable (t, ip);
    break;
  case RANGE:
    typeset_range (t, ip);
    break;
  case NUMBER:
  case _DATE:
  case TRANSLATE:
  case CHANGE_CASE:
  case FIND_FILE:
  case FIND_FILE_UPWARDS:
  case IS_TUPLE:
  case LOOK_UP:
  case EQUAL:
  case UNEQUAL:
  case LESS:
  case LESSEQ:
  case GREATER:
  case GREATEREQ:
  case BLEND:
  case BOX_INFO:
  case FRAME_DIRECT:
  case FRAME_INVERSE:
    typeset_executable (t, ip);
    break;

  case CM_LENGTH:
  case MM_LENGTH:
  case IN_LENGTH:
  case PT_LENGTH:
  case BP_LENGTH:
  case DD_LENGTH:
  case PC_LENGTH:
  case CC_LENGTH:
  case FS_LENGTH:
  case FBS_LENGTH:
  case EM_LENGTH:
  case LN_LENGTH:
  case SEP_LENGTH:
  case YFRAC_LENGTH:
  case EX_LENGTH:
  case FN_LENGTH:
  case FNS_LENGTH:
  case BLS_LENGTH:
  case SPC_LENGTH:
  case XSPC_LENGTH:
  case PAR_LENGTH:
  case PAG_LENGTH:
  case GW_LENGTH:
  case GH_LENGTH:
  case GU_LENGTH:
  case TMPT_LENGTH:
  case PX_LENGTH:
    typeset_executable (t, ip);
    break;

  case STYLE_ONLY:
  case VAR_STYLE_ONLY:
  case ACTIVE:
  case VAR_ACTIVE:
  case INACTIVE:
  case VAR_INACTIVE:
    typeset_compound (t, ip);
    break;
  case REWRITE_INACTIVE:
    typeset_rewrite (t, ip);
    break;
  case INLINE_TAG:
  case OPEN_TAG:
  case MIDDLE_TAG:
  case CLOSE_TAG:
    typeset_src_tag (t, ip);
    break;
  case SYMBOL:
  case LATEX:
  case HYBRID:
    typeset_inactive (t, ip);
    break;

  case LOCUS:
    typeset_locus (t, ip);
    break;
  case ID:
    typeset_inactive (t, ip);
    break;
  case HARD_ID:
    typeset_executable (t, ip);
    break;
  case LINK:
  case URL:
  case SCRIPT:
  case OBSERVER:
  case FIND_ACCESSIBLE:
    typeset_inactive (t, ip);
    break;
  case HLINK:
  case ACTION:
    typeset_compound (t, ip);
    break;
  case SET_BINDING:
    typeset_set_binding (t, ip);
    break;
  case GET_BINDING:
    typeset_executable (t, ip);
    break;
  case LABEL:
  case REFERENCE:
  case PAGEREF:
    typeset_compound (t, ip);
    break;
  case GET_ATTACHMENT:
    typeset_executable (t, ip);
    break;
  case WRITE:
    typeset_write (t, ip);
    break;
  case TOC_NOTIFY:
    typeset_toc_notify (t, ip);
    break;

  case TUPLE:
  case ATTR:
  case TMLEN:
  case COLLECTION:
  case ASSOCIATE:
  case BACKUP:
    typeset_inactive (t, ip);
    break;
  case PATTERN:
  case GRADIENT:
    marker (descend (ip, 0));
    typeset_inactive (env->exec (t), decorate (ip));
    marker (descend (ip, 1));
    break;
  case SPECIFIC:
    typeset_specific (t, ip);
    break;
  case FLAG:
    typeset_flag (t, ip);
    break;
  case HYPHENATE_AS:
    typeset_hyphenate_as (t, ip);
    break;

  case ANIM_STATIC:
  case ANIM_DYNAMIC:
  case MORPH:
  case ANIM_TIME:
  case ANIM_PORTION:
    typeset_executable (t, ip);
    break;
  case ANIM_COMPOSE:
    typeset_anim_compose (t, ip);
    break;
  case ANIM_REPEAT:
    typeset_anim_repeat (t, ip);
    break;
  case ANIM_CONSTANT:
    typeset_anim_constant (t, ip);
    break;
  case ANIM_ACCELERATE:
    typeset_anim_accelerate (t, ip);
    break;
  case ANIM_TRANSLATE:
    typeset_anim_translate (t, ip);
    break;
  case ANIM_PROGRESSIVE:
    typeset_anim_progressive (t, ip);
    break;
  case VIDEO:
    typeset_video (t, ip);
    break;
  case SOUND:
    typeset_sound (t, ip);
    break;

  case GRAPHICS:
    typeset_graphics (t, ip);
    break;
  case SUPERPOSE:
    typeset_superpose (t, ip);
    break;
  case GR_GROUP:
    typeset_gr_group (t, ip);
    break;
  case GR_TRANSFORM:
    typeset_gr_transform (t, ip);
    break;
  case GR_EFFECT:
    typeset_gr_effect (t, ip);
    break;
  case TEXT_AT:
    typeset_text_at (t, ip);
    break;
  case MATH_AT:
    typeset_math_at (t, ip);
    break;
  case DOCUMENT_AT:
    typeset_document_at (t, ip);
    break;
  case _POINT:
    typeset_point (t, ip);
    break;
  case LINE:
    typeset_line (t, ip, false);
    break;
  case CLINE:
    typeset_line (t, ip, true);
    break;
  case ARC:
    typeset_arc (t, ip, false);
    break;
  case CARC:
    typeset_arc (t, ip, true);
    break;
  case SPLINE:
    typeset_spline (t, ip, false);
    break;
  case VAR_SPLINE:
    typeset_var_spline (t, ip);
    break;
  case CSPLINE:
    typeset_cspline (t, ip);
    break;
  case BEZIER:
  case CBEZIER:
  case SMOOTH:
  case CSMOOTH:
    typeset_bezier (t, ip);
    break;
  case FILL:
    typeset_fill (t, ip);
    break;
  case IMAGE:
    typeset_image (t, ip);
    break;
  case TRANSFORM_3D:
  case OBJECT_3D:
  case TRIANGLE_3D:
  case LIGHT_3D:
    typeset_graphics_3d (t, ip);
    break;
  case LIGHT_DIFFUSE:
  case LIGHT_SPECULAR:
    typeset_inactive (t, ip);
    break;

  case EFF_MOVE:
  case EFF_MAGNIFY:
  case EFF_BUBBLE:
  case EFF_TURBULENCE:
  case EFF_FRACTAL_NOISE:
  case EFF_GAUSSIAN:
  case EFF_OVAL:
  case EFF_RECTANGULAR:
  case EFF_MOTION:
  case EFF_BLUR:
  case EFF_OUTLINE:
  case EFF_THICKEN:
  case EFF_ERODE:
  case EFF_DEGRADE:
  case EFF_DISTORT:
  case EFF_GNAW:
  case EFF_SUPERPOSE:
  case EFF_ADD:
  case EFF_SUB:
  case EFF_MUL:
  case EFF_MIN:
  case EFF_MAX:
  case EFF_MIX:
  case EFF_NORMALIZE:
  case EFF_MONOCHROME:
  case EFF_COLOR_MATRIX:
  case EFF_MAKE_TRANSPARENT:
  case EFF_MAKE_OPAQUE:
    typeset_inactive (t, ip);
    break;

  case CANVAS:
    typeset_canvas (t, ip);
    break;
  case ORNAMENT:
    typeset_ornament (t, ip);
    break;

  default:
    if (L(t) < START_EXTENSIONS) print (test_box (ip));
    else typeset_compound (t, ip);
    break;
  }
}