Beispiel #1
0
void parse_region(FILE *fp, World *w)
{
    char texture_name[STRING_TOKEN_MAX_LENGTH];
    int texture_index;
    Region r;

    if (get_real_token(fp, &r.floor) != Token_real)
        parse_error("number expected");
    if (get_real_token(fp, &r.ceiling) != Token_real)
        parse_error("number expected");

    /* floor texture */
    if (get_string_token(fp, texture_name) != Token_string)
        parse_error("texture name expected");
    texture_index = get_texture_index(texture_name);
    if (texture_index < 0 || texture_index > TABLE_SIZE(w->textures))
        parse_error("non-existent texture");
    else
        r.floor_tex = WORLD_TEXTURE(w, texture_index);

    /* ceiling texture */
    if (get_string_token(fp, texture_name) != Token_string)
        parse_error("texture name expected");
    if (strcmp(texture_name, "sky") == 0)
        r.ceiling_tex = NULL;
    else {
        texture_index = get_texture_index(texture_name);
        if (texture_index < 0 || texture_index > TABLE_SIZE(w->textures))
            parse_error("non-existent texture");
        else
            r.ceiling_tex = WORLD_TEXTURE(w, texture_index);
    }

    add_region(w, &r);
}
Beispiel #2
0
void update_wall_scale(World *w, int wall_num, fixed xscale, fixed yscale)
{
    Wall *wall;
    Texture *texture;
    fixed wall_length;

    if (wall_num < 0 || wall_num > TABLE_SIZE(w->walls))
        fatal_error("invalid wall number");

    wall = (Wall *) w->walls->table + wall_num;
    texture = wall->surface_texture;

    wall_length =
        FLOAT_TO_FIXED(sqrt(FIXED_TO_FLOAT(wall->vertex2->x -
                                           wall->vertex1->x) *
                            FIXED_TO_FLOAT(wall->vertex2->x -
                                           wall->vertex1->x) +
                            FIXED_TO_FLOAT(wall->vertex2->y -
                                           wall->vertex1->y) *
                            FIXED_TO_FLOAT(wall->vertex2->y -
                                           wall->vertex1->y)));
    wall->yscale = fixmul(yscale, INT_TO_FIXED(texture->height));
    wall->xscale = fixmul(fixmul(xscale, INT_TO_FIXED(texture->width)),
                          wall_length);
}
Beispiel #3
0
void parse_texture(FILE *fp, World *w)
{
    char texture_name[STRING_TOKEN_MAX_LENGTH];
    char filename[STRING_TOKEN_MAX_LENGTH];
    char texture_path[PATH_MAX + STRING_TOKEN_MAX_LENGTH];
    Texture *t;
    Texture_node *tn;


    if (get_string_token(fp, texture_name) != Token_string)
        parse_error("texture name expected");
    if (strlen(texture_name) >= TEXTURE_NAME_MAX_LENGTH)
        parse_error("texture name too long");

    if (get_string_token(fp, filename) != Token_string)
        parse_error("texture file name expected");
#ifdef WIN32
    sprintf(texture_path, "%s%s/%s", szWTpath, TEXTURE_PATH, filename);
#else
    sprintf(texture_path, "%s/%s", TEXTURE_PATH, filename);
#endif
    t = read_texture_file(texture_path);

    tn = wtmalloc(sizeof(Texture_node));
    strcpy(tn->name, texture_name);
    tn->index = TABLE_SIZE(w->textures);

    add_node(texture_list, tn);
    add_texture(w, t);
}
Beispiel #4
0
/*
 * Wrapper functions for all standard and private IOCTL functions
 */
static int ath_iw_wrapper_handler(struct net_device *dev,
                                  struct iw_request_info *info,
                                  union iwreq_data *wrqu, char *extra)
{
    struct ath_softc_net80211 *scn = ath_netdev_priv(dev);
    int cmd_id;
    iw_handler handler;

    /* reject ioctls */
    if ((!scn) ||
        (scn && scn->sc_htc_delete_in_progress)){
        printk("%s : #### delete is in progress, scn %p \n", __func__, scn);
        return -EINVAL;
    }
    
    /* private ioctls */
    if (info->cmd >= SIOCIWFIRSTPRIV) {
        cmd_id = (info->cmd - SIOCIWFIRSTPRIV);
        if (cmd_id < 0 || cmd_id >= TABLE_SIZE(ath_iw_priv_handlers)) {
            printk("%s : #### wrong private ioctl 0x%x\n", __func__, info->cmd);
            return -EINVAL;
        }
        
        handler = ath_iw_priv_handlers[cmd_id];
        if (handler)
            return handler(dev, info, wrqu, extra);
        
        printk("%s : #### no registered private ioctl function for cmd 0x%x\n", __func__, info->cmd);
    }
   
    printk("%s : #### unknown command 0x%x\n", __func__, info->cmd);
    
    return -EINVAL;
}
Beispiel #5
0
int getFormatIdByString(char* str)
{
    int i;
    for(i = 0; i < TABLE_SIZE(g_format); i++)
    {
        if(strncmp(str, g_format[i], 4) == 0)
        {
            return i;
        }
    }
    return 0;
}
Beispiel #6
0
void
cmu_bdd_init_cache(cmu_bdd_manager bddm)
{
  long i;
  int j;

  bddm->op_cache.size_index=13;
  bddm->op_cache.size=TABLE_SIZE(bddm->op_cache.size_index);
  bddm->op_cache.table=(cache_bin *)mem_get_block((SIZE_T)(bddm->op_cache.size*sizeof(cache_bin)));
  for (i=0; i < bddm->op_cache.size; ++i)
    for (j=0; j < 2; ++j)
      bddm->op_cache.table[i].entry[j]=0;
  /* ITE cache control functions. */
  bddm->op_cache.rehash_fn[CACHE_TYPE_ITE]=bdd_rehash3;
  bddm->op_cache.gc_fn[CACHE_TYPE_ITE]=cmu_bdd_ite_gc_fn;
  bddm->op_cache.purge_fn[CACHE_TYPE_ITE]=0;
  bddm->op_cache.return_fn[CACHE_TYPE_ITE]=RETURN_BDD_FN;
  bddm->op_cache.flush_fn[CACHE_TYPE_ITE]=0;
  /* Two argument op cache control functions. */
  bddm->op_cache.rehash_fn[CACHE_TYPE_TWO]=bdd_rehash3;
  bddm->op_cache.gc_fn[CACHE_TYPE_TWO]=bdd_two_gc_fn;
  bddm->op_cache.purge_fn[CACHE_TYPE_TWO]=0;
  bddm->op_cache.return_fn[CACHE_TYPE_TWO]=RETURN_BDD_FN;
  bddm->op_cache.flush_fn[CACHE_TYPE_TWO]=bdd_two_flush_fn;
  /* One argument op w/ data result cache control functions. */
  bddm->op_cache.rehash_fn[CACHE_TYPE_ONEDATA]=bdd_rehash2;
  bddm->op_cache.gc_fn[CACHE_TYPE_ONEDATA]=cmu_bdd_one_data_gc_fn;
  bddm->op_cache.purge_fn[CACHE_TYPE_ONEDATA]=0;
  bddm->op_cache.return_fn[CACHE_TYPE_ONEDATA]=0;
  bddm->op_cache.flush_fn[CACHE_TYPE_ONEDATA]=0;
  /* Two argument op w/ data result cache control functions. */
  bddm->op_cache.rehash_fn[CACHE_TYPE_TWODATA]=bdd_rehash3;
  bddm->op_cache.gc_fn[CACHE_TYPE_TWODATA]=bdd_two_data_gc_fn;
  bddm->op_cache.purge_fn[CACHE_TYPE_TWODATA]=0;
  bddm->op_cache.return_fn[CACHE_TYPE_TWODATA]=0;
  bddm->op_cache.flush_fn[CACHE_TYPE_TWODATA]=0;
  /* User-defined cache control functions. */
  for (j=CACHE_TYPE_USER1; j < CACHE_TYPE_USER1+USER_ENTRY_TYPES; ++j)
    {
      bddm->op_cache.rehash_fn[j]=0;
      bddm->op_cache.gc_fn[j]=0;
      bddm->op_cache.purge_fn[j]=0;
      bddm->op_cache.return_fn[j]=0;
      bddm->op_cache.flush_fn[j]=0;
    }
  bddm->op_cache.cache_ratio=4;
  bddm->op_cache.cache_level=0;
  bddm->op_cache.entries=0;
  bddm->op_cache.lookups=0;
  bddm->op_cache.hits=0;
  bddm->op_cache.inserts=0;
  bddm->op_cache.collisions=0;
}
Beispiel #7
0
void update_wall_phase(World *w, int wall_num, fixed xphase, fixed yphase)
{
    Wall *wall;

    if (wall_num < 0 || wall_num > TABLE_SIZE(w->walls))
        fatal_error("invalid wall number");

    wall = (Wall *) w->walls->table + wall_num;

    wall->xphase = xphase;
    wall->yphase = yphase;
}
Beispiel #8
0
void ath_iw_attach(struct net_device *dev)
{
#ifdef ATH_SUPPORT_HTC
    int index;

    /* initialize handler array */
    for(index = 0; index < TABLE_SIZE(ath_iw_priv_wrapper_handlers); index++) {
    	if(ath_iw_priv_handlers[index])
       	    ath_iw_priv_wrapper_handlers[index] = ath_iw_wrapper_handler;
        else
    	    ath_iw_priv_wrapper_handlers[index] = NULL;		  	
    }
#endif

    dev->wireless_handlers = &ath_iw_handler_def;
}
Beispiel #9
0
void
bdd_rehash_cache(cmu_bdd_manager bddm, int grow)
{
  long i;
  long hash;
  int j;
  long oldsize;
  cache_bin *newtable;
  cache_entry *bin;
  cache_entry *newbin;
  cache_entry p;
  cache_entry q;

  oldsize=bddm->op_cache.size;
  if (grow)
    bddm->op_cache.size_index++;
  else
    bddm->op_cache.size_index--;
  bddm->op_cache.size=TABLE_SIZE(bddm->op_cache.size_index);
  newtable=(cache_bin *)mem_get_block((SIZE_T)(bddm->op_cache.size*sizeof(struct cache_bin_)));
  for (i=0; i < bddm->op_cache.size; ++i)
    for (j=0; j < 2; ++j)
      newtable[i].entry[j]=0;
  /* Rehash LRU first. */
  for (j=1; j >= 0; --j)
    for (i=0; i < oldsize; ++i)
      {
	bin=bddm->op_cache.table[i].entry;
	if ((p=bin[j]))
	  {
	    q=CACHE_POINTER(p);
	    hash=(*bddm->op_cache.rehash_fn[TAG(p)])(bddm, q);
	    BDD_REDUCE(hash, bddm->op_cache.size);
	    newbin=newtable[hash].entry;
	    bdd_purge_lru(bddm, newbin);
	    newbin[0]=p;
	  }
    }
  mem_free_block((pointer)(bddm->op_cache.table));
  bddm->op_cache.table=newtable;
}
Beispiel #10
0
	/* AUTELAN-Added-Begin : &tuqiang */
    (iw_handler) ath_openessid_setblacklist,       /* SIOCWFIRSTPRIV+6 */
    (iw_handler) ath_openessid_distroyblacklist,   /* SIOCWFIRSTPRIV+7 */
    (iw_handler) ath_openessid_setwhitelist,       /* SIOCWFIRSTPRIV+8 */
    (iw_handler) ath_openessid_distroywhitelist,   /* SIOCWFIRSTPRIV+9 */
	/* AUTELAN-Added-End : [email protected] */
};

/*
** Wireless Handler Structure
** This table provides the Wireless tools the interface required to access
** parameters in the HAL.  Each sub table contains the definition of various
** control tables that reference functions this module
*/
#ifdef ATH_SUPPORT_HTC
static iw_handler ath_iw_priv_wrapper_handlers[TABLE_SIZE(ath_iw_priv_handlers)];

static struct iw_handler_def ath_iw_handler_def = {
    .standard           = (iw_handler *) NULL,
    .num_standard       = 0,
    .private            = (iw_handler *) ath_iw_priv_wrapper_handlers,
    .num_private        = TABLE_SIZE(ath_iw_priv_wrapper_handlers),
    .private_args       = (struct iw_priv_args *) ath_iw_priv_args,
    .num_private_args   = TABLE_SIZE(ath_iw_priv_args),
    .get_wireless_stats = NULL,
};
#else
static struct iw_handler_def ath_iw_handler_def = {
    .standard           = (iw_handler *) NULL,
    .num_standard       = 0,
    .private            = (iw_handler *) ath_iw_priv_handlers,
Beispiel #11
0
    {   "stw",  OP_IDO5, "01011rrrrrriiiii", 2, 0x5800, 2, 2, CHG_NONE, ALL},
    {   "stw",   OP_IDR, "01111rrrrrrrrrrr", 2, 0x7800, 2, 2, CHG_NONE, ALL},
    {   "sub",   OP_TRI, "00011rrrrrrrrr00", 2, 0x1800, 1, 1, CHG_NZVC, ALL},
    {  "subh",  OP_IMM8, "11001rrriiiiiiii", 2, 0xC800, 1, 1, CHG_NZVC, ALL},
    {  "subl",  OP_IMM8, "11000rrriiiiiiii", 2, 0xC000, 1, 1, CHG_NZVC, ALL},
    {   "tfr",  OP_MON_R_C, "00000rrr11111000", 2, 0x00F8, 1, 1, CHG_NONE, ALL},
    {   "tfr",  OP_MON_C_R, "00000rrr11111001", 2, 0x00F9, 1, 1, CHG_NONE, ALL},
    {   "tfr",  OP_MON_R_P, "00000rrr11111010", 2, 0x00FA, 1, 1, CHG_NONE, ALL},
    {  "xnor",   OP_TRI, "00010rrrrrrrrr11", 2, 0x1003, 1, 1,  CHG_NZV, ALL},
    { "xnorh",  OP_IMM8, "10111rrriiiiiiii", 2, 0xB800, 1, 1,  CHG_NZV, ALL},
    { "xnorl",  OP_IMM8, "10110rrriiiiiiii", 2, 0xB000, 1, 1,  CHG_NZV, ALL},
    /*  macro and alias codes  */
    {   "add", OP_mADD,  "----------------", 4,      0, 0, 0, CHG_NONE, ALL},
    {   "and", OP_mAND,  "----------------", 4,      0, 0, 0, CHG_NONE, ALL},
    {   "bhs",  OP_REL9, "0010000iiiiiiiii", 2, 0x2000, 0, 0, CHG_NONE, ALL},
    {   "blo",  OP_REL9, "0010001iiiiiiiii", 2, 0x2200, 0, 0, CHG_NONE, ALL},
    {   "cmp",  OP_mCPC, "----------------", 4,      0, 0, 0, CHG_NONE, ALL},
    {   "cmp",   OP_DYA, "00011sssrrrrrr00", 2, 0x1800, 0, 0, CHG_NZVC, ALL},
    {   "com",   OP_DM,  "00010rrrsssrrr11", 2, 0x1003, 0, 0, CHG_NZVC, ALL},
    {   "com",   OP_DYA, "00010rrrsssrrr11", 2, 0x1003, 0, 0,  CHG_NZV, ALL},
    {   "cpc",   OP_DYA, "00011sssrrrrrr01", 2, 0x1801, 0, 0, CHG_NZVC, ALL},
    {   "ldd",  OP_mLDW, "----------------", 4,      0, 0, 0, CHG_NONE, ALL},
    {   "ldw",  OP_mLDW, "----------------", 4,      0, 0, 0, CHG_NONE, ALL},
    {   "mov",   OP_DYA, "00010rrrsssrrr10", 2, 0x1002, 0, 0, CHG_NZVC, ALL},
    {   "neg",   OP_DYA, "00011rrrsssrrr00", 2, 0x1800, 0, 0, CHG_NZVC, ALL},
    {   "sub",  OP_mSUB, "----------------", 4,      0, 0, 0, CHG_NONE, ALL},
    {   "tst",   OP_MON, "00011sssrrrsss00", 2, 0x1800, 0, 0,  CHG_NZV, ALL}
};

const int xgate_num_opcodes = TABLE_SIZE (xgate_opcodes);
Beispiel #12
0
  { "movwf",  0xfe0, 0x020,     INSN_CLASS_OPF5         },
  { "nop",    0xfff, 0x000,     INSN_CLASS_IMPLICIT     },
  { "option", 0xfff, 0x002,     INSN_CLASS_IMPLICIT     },
  { "retlw",  0xf00, 0x800,     INSN_CLASS_LIT8         },
  { "return", 0xfff, 0x800,     INSN_CLASS_IMPLICIT     }, /* FIXME: special mnemonic */
  { "rlf",    0xfc0, 0x340,     INSN_CLASS_OPWF5        },
  { "rrf",    0xfc0, 0x300,     INSN_CLASS_OPWF5        },
  { "sleep",  0xfff, 0x003,     INSN_CLASS_IMPLICIT     },
  { "subwf",  0xfc0, 0x080,     INSN_CLASS_OPWF5        },
  { "swapf",  0xfc0, 0x380,     INSN_CLASS_OPWF5        },
  { "tris",   0xff8, 0x000,     INSN_CLASS_OPF5         },
  { "xorlw",  0xf00, 0xf00,     INSN_CLASS_LIT8         },
  { "xorwf",  0xfc0, 0x180,     INSN_CLASS_OPWF5        }
};

const int num_op_12c5xx = TABLE_SIZE(op_12c5xx);

/* Scenix SX has a superset of the PIC 12-bit instruction set */
/*
 * It would be nice if there was a more elegant way to do this,
 * either by adding a flags field to struct insn, or by allowing a
 * processor to have more than one associated table.
 */
const struct insn op_sx[] = {
  { "addwf",  0xfc0, 0x1c0,     INSN_CLASS_OPWF5        },
  { "andlw",  0xf00, 0xe00,     INSN_CLASS_LIT8         },
  { "andwf",  0xfc0, 0x140,     INSN_CLASS_OPWF5        },
  { "bank",   0xff8, 0x018,     INSN_CLASS_LIT3_BANK    }, /* SX only */
  { "bcf",    0xf00, 0x400,     INSN_CLASS_B5           },
  { "bsf",    0xf00, 0x500,     INSN_CLASS_B5           },
  { "btfsc",  0xf00, 0x600,     INSN_CLASS_B5           },
Beispiel #13
0
  { "b",        0, (long int)do_b,      INSN_CLASS_FUNC,        0 },
  { "bc",       0, (long int)do_bc,     INSN_CLASS_FUNC,        0 },
  { "bdc",      0, (long int)do_bdc,    INSN_CLASS_FUNC,        0 },
  { "bz",       0, (long int)do_bz,     INSN_CLASS_FUNC,        0 },
  { "bnc",      0, (long int)do_bnc,    INSN_CLASS_FUNC,        0 },
  { "bndc",     0, (long int)do_bndc,   INSN_CLASS_FUNC,        0 },
  { "bnz",      0, (long int)do_bnz,    INSN_CLASS_FUNC,        0 },
  { "clrc",     0, (long int)do_clrc,   INSN_CLASS_FUNC,        0 },
  { "clrdc",    0, (long int)do_clrdc,  INSN_CLASS_FUNC,        0 },
  { "clrz",     0, (long int)do_clrz,   INSN_CLASS_FUNC,        0 },
  { "lcall",    0, (long int)do_lcall,  INSN_CLASS_FUNC,        0 },
  { "lgoto",    0, (long int)do_lgoto,  INSN_CLASS_FUNC,        0 },
  { "movfw",    0, (long int)do_movfw,  INSN_CLASS_FUNC,        0 },
  { "negf",     0, (long int)do_negf,   INSN_CLASS_FUNC,        0 },
  { "setc",     0, (long int)do_setc,   INSN_CLASS_FUNC,        0 },
  { "setdc",    0, (long int)do_setdc,  INSN_CLASS_FUNC,        0 },
  { "setz",     0, (long int)do_setz,   INSN_CLASS_FUNC,        0 }, 
  { "skpc",     0, (long int)do_skpc,   INSN_CLASS_FUNC,        0 },
  { "skpdc",    0, (long int)do_skpdc,  INSN_CLASS_FUNC,        0 },
  { "skpz",     0, (long int)do_skpz,   INSN_CLASS_FUNC,        0 },
  { "skpnc",    0, (long int)do_skpnc,  INSN_CLASS_FUNC,        0 },
  { "skpndc",   0, (long int)do_skpndc, INSN_CLASS_FUNC,        0 },
  { "skpnz",    0, (long int)do_skpnz,  INSN_CLASS_FUNC,        0 },
  { "subcf",    0, (long int)do_subcf,  INSN_CLASS_FUNC,        0 },
  { "subdcf",   0, (long int)do_subdcf, INSN_CLASS_FUNC,        0 },
  { "tstf",     0, (long int)do_tstf,   INSN_CLASS_FUNC,        0 }

};

const int num_op_special = TABLE_SIZE(special);
Beispiel #14
0
		// Req. scancode,	Capture scancode,	Req. keycode,	Capture keycode
#ifndef KEYROUTER_TEST
		// On devices with a combined Power and End key, that key produces a
		// PowerOff code. Map capture requests for the End key to PowerOff.
		// At routing time, an End key event will automatically be delivered
		// to the capturing application.
		{ EStdKeyPhoneEnd,	EStdKeyPowerOff,	EKeyPhoneEnd,	EKeyPowerOff }
#else
		// Entry for TEvent test case GRAPHICS-WSERV-0751.
		// Capture requests for psuedo key Device0 are mapped to capture
		// the real key Device1.
		{ EStdKeyDevice0,	EStdKeyDevice1,		EKeyDevice0,	EKeyDevice1 }
#endif
	};

const TInt KNumTranslations = TABLE_SIZE(KTranslations);
#endif // defined(KEYROUTER_TEST) || defined(COMBINED_POWER_END_KEY)

/**
Restricted Key Table

The following keys may be captured only by the specified applications.
More than one application may be listed for a given key-type combination.
*/
const TRestrictedKeyEntry KRestrictedKeys[] =
	{
#ifndef KEYROUTER_TEST
		// Short Apps key events may only be captured by HomeScreen, SysApp,
		// AutoLock, Phone and AknCapServer.
		{ EStdKeyApplication,	ECaptureTypeKeyUpDown,	KUidHomeScreen },
		{ EKeyApplication,		ECaptureTypeKey,		KUidHomeScreen },
Beispiel #15
0
void parse_wall(FILE *fp, World *w)
{
    Wall wall;
    char texture_name[STRING_TOKEN_MAX_LENGTH];
    int texture_index;
    int front_region, back_region;
    int vertex1, vertex2;
    fixed wall_length;


    /* vertices */
    if (get_integer_token(fp, &vertex1) != Token_integer)
        parse_error("integer expected");
    if (get_integer_token(fp, &vertex2) != Token_integer)
        parse_error("integer expected");
    if (vertex1 < 0 || vertex1 > TABLE_SIZE(w->vertices))
        parse_error("invalid vertex number");
    if (vertex2 < 0 || vertex2 > TABLE_SIZE(w->vertices))
        parse_error("invalid vertex number");
    wall.vertex1 = &WORLD_VERTEX(w, vertex1);
    wall.vertex2 = &WORLD_VERTEX(w, vertex2);

    /* texture */
    if (get_string_token(fp, texture_name) != Token_string)
        parse_error("texture name expected");
    texture_index = get_texture_index(texture_name);
    if (texture_index < 0 || texture_index > TABLE_SIZE(w->textures))
        parse_error("non-existent texture");
    else
        wall.surface_texture = WORLD_TEXTURE(w, texture_index);

    if (strcmp(texture_name, "sky") == 0)
        wall.sky = True;
    else
        wall.sky = False;

    /* front and back regions */
    if (get_integer_token(fp, &front_region) != Token_integer)
        fatal_error("non-existent region");
    if (get_integer_token(fp, &back_region) != Token_integer)
        fatal_error("non-existent region");
    if (front_region < 0 || front_region > TABLE_SIZE(w->regions))
        fatal_error("non-existent region");
    if (back_region < 0 || back_region > TABLE_SIZE(w->regions))
        fatal_error("non-existent region");
    wall.front = &WORLD_REGION(w, front_region);
    wall.back = &WORLD_REGION(w, back_region);

    /* Texture phase and scale.  This code is somewhat more complicated than
    **   you'd expect, since the texture scale must be normalized to the
    **   wall length.
    */
    if (get_real_token(fp, &wall.xscale) != Token_real)
        parse_error("number expected");
    if (get_real_token(fp, &wall.yscale) != Token_real)
        parse_error("number expected");
    if (get_real_token(fp, &wall.xphase) != Token_real)
        parse_error("number expected");
    if (get_real_token(fp, &wall.yphase) != Token_real)
        parse_error("number expected");
    wall_length =
        FLOAT_TO_FIXED(sqrt(FIXED_TO_FLOAT(wall.vertex2->x -
                                           wall.vertex1->x) *
                            FIXED_TO_FLOAT(wall.vertex2->x -
                                           wall.vertex1->x) +
                            FIXED_TO_FLOAT(wall.vertex2->y -
                                           wall.vertex1->y) *
                            FIXED_TO_FLOAT(wall.vertex2->y -
                                           wall.vertex1->y)));
    wall.yscale = fixmul(wall.yscale,
                         INT_TO_FIXED(wall.surface_texture->height));
    wall.xscale = fixmul(fixmul(wall.xscale,
                                INT_TO_FIXED(wall.surface_texture->width)),
                         wall_length);

    add_wall(w, &wall);
}
Beispiel #16
0
  { "movwf",  0xfe0, 0x020,     INSN_CLASS_OPF5 	},
  { "nop",    0xfff, 0x000,     INSN_CLASS_IMPLICIT 	},
  { "option", 0xfff, 0x002,     INSN_CLASS_IMPLICIT 	},
  { "retlw",  0xf00, 0x800,     INSN_CLASS_LIT8 	},
  { "return", 0xfff, 0x800,     INSN_CLASS_IMPLICIT 	}, /* FIXME: special mnemonic */
  { "rlf",    0xfc0, 0x340,     INSN_CLASS_OPWF5 	},
  { "rrf",    0xfc0, 0x300,     INSN_CLASS_OPWF5 	},
  { "sleep",  0xfff, 0x003,     INSN_CLASS_IMPLICIT 	},
  { "subwf",  0xfc0, 0x080,     INSN_CLASS_OPWF5 	},
  { "swapf",  0xfc0, 0x380,     INSN_CLASS_OPWF5 	},
  { "tris",   0xff8, 0x000,     INSN_CLASS_OPF5 	},
  { "xorlw",  0xf00, 0xf00,     INSN_CLASS_LIT8 	},
  { "xorwf",  0xfc0, 0x180,     INSN_CLASS_OPWF5 	}
};

const int num_op_12c5xx = TABLE_SIZE(op_12c5xx);

/* Scenix SX has a superset of the PIC 12-bit instruction set */
/*
 * It would be nice if there was a more elegant way to do this,
 * either by adding a flags field to struct insn, or by allowing a
 * processor to have more than one associated table.
 */
struct insn  op_sx[] = {
  { "addwf",  0xfc0, 0x1c0,     INSN_CLASS_OPWF5 	},
  { "andlw",  0xf00, 0xe00,     INSN_CLASS_LIT8 	},
  { "andwf",  0xfc0, 0x140,     INSN_CLASS_OPWF5 	},
  { "bank",   0xff8, 0x018,     INSN_CLASS_LIT3_BANK    }, /* SX only */
  { "bcf",    0xf00, 0x400,     INSN_CLASS_B5 		},
  { "bsf",    0xf00, 0x500,     INSN_CLASS_B5 		},
  { "btfsc",  0xf00, 0x600,     INSN_CLASS_B5 		},
Beispiel #17
0
      PE_UNINITIALIZED, "PE has not been initialized yet"
    },
    {
      PE_UNKNOWN, "I have no information about PE"
    },
    {
      PE_RUNNING, "PE is running"
    },
    {
      PE_SHUTDOWN, "PE has been cleanly shut down"
    },
    {
      PE_FAILED, "PE has failed"
    },
  };
static const int nd = TABLE_SIZE (d);

/**
 * translate PE status to human description
 */

const
char *
__shmem_state_as_string (pe_status_t s)
{
  struct state_desc *dp = d;
  int i;

  for (i = 0; i < nd; i += 1)
    {
      if (s == dp->s)
Beispiel #18
0
int
checkwalls( World *w, View *v  )
{
  extern fixed view_height;
  Wall   *wall = (Wall *) w->walls->table, *mem_wall;
  double  x1, y1, tmp, min = 512.0;
  int i;

  x1 = FIXED_TO_FLOAT(v->x);
  y1 = FIXED_TO_FLOAT(v->y);

  if ( x1 == x && y1 == y )
    return DONT_INTERSECT;

  for (i = 0; i < TABLE_SIZE(w->walls); i++, wall++ ) {

    /* Check Distance */
    tmp = LineDistance( x1, y1, 
	    FIXED_TO_FLOAT(wall->vertex1->x ), 
	    FIXED_TO_FLOAT(wall->vertex1->y ), 
	    FIXED_TO_FLOAT(wall->vertex2->x ), 
	    FIXED_TO_FLOAT(wall->vertex2->y ) );

    if ( fabs(tmp) < fabs( min ) )
      {
	min      = tmp;
	mem_wall = wall; 
      }

  }

  /* is there any point in checking further. */
  if ( fabs( min ) < VECTOR_LEN  )  
    {
      /* start examine the wall */
      fixed ceiling, floor;

      /* Check the outher side of the object */
      if ( min > 0.0 )
	{
	  floor      = mem_wall->front->floor;
	  ceiling    = mem_wall->front->ceiling;
	}
      else
	{
	  floor      = mem_wall->back->floor;
	  ceiling    = mem_wall->back->ceiling;
	}

      /* if the stair is less than FIXED_ONE_QUARTER and the
	 head has goes free and there are enought room. */
      if ( FIXED_ONE_QUARTER >= (floor-v->height) && ( ceiling > v->height ) &&
	  ( MAN_SIZE <= (ceiling-floor) ) ) {
	if ( s_wall != mem_wall || ( min > 0.0 && side <= 0.0 ) ||
	    (min <= 0.0 && side > 0.0 ) )
	  {
	    if ( min < 0.0 )
	      view_height = mem_wall->front->floor+MAN_SIZE;
	    else
	      view_height = mem_wall->back->floor+MAN_SIZE;

	    s_wall       = mem_wall;
	  }
        }
      else
	/* am i running towards the wall? */
	if ( fabs( min ) < fabs( side ) )
	  {

	     s_wall = mem_wall;
	     slide_wall( &x, &y, x1, y1, side, min );

	     v->x   = FLOAT_TO_FIXED( x );
	     v->y   = FLOAT_TO_FIXED( y );

	     return 0;
	  }  
    }

  side = min;
  x    = x1;
  y    = y1;

  return 0;
}