Exemple #1
0
int get_bit(int b, int mode) {
	if (mode == BITMAP) {
		return bitmap->data[bindex(b)] & (1 << (boffset(b)));
	} else {
		return inodemap->data[bindex(b)] & (1 << (boffset(b)));
	}
}
Exemple #2
0
void clear_bit(int b, int mode) {
	if (mode == BITMAP) {
		bitmap->data[bindex(b)] &= ~(1 << (boffset(b)));
	} else {
		inodemap->data[bindex(b)] &= ~(1 << (boffset(b)));
	}
}
Exemple #3
0
void set_bit(int b, int mode) {
	if (mode == BITMAP)
	{
		bitmap->data[bindex(b)] |= 1 << (boffset(b));
	} else {
		inodemap->data[bindex(b)] |= 1 << (boffset(b));
	}
}
/**
  @brief Charge un schema depuis un fichier RIFF
  @param mem Tampon mémoire
  @return Résultat de procèdure
*/
bool QEquipmentView::fromRIFF(PTR* mem){
    RIFF riff;

    //supprime le contenu de la scene
    this->reset();

    //lit l'entete
    if(!riff_read(mem,&riff))
        return false;

    //Vérifie l'en-tete
    if(!(riff.id[0] == 'R' && riff.id[1] == 'I' && riff.id[2] == 'F' && riff.id[3] == 'F'))
        return QRESULT_DESC(Result::Failed, Result::RiffInvalidHeader);
    if(mem->ptr+riff.size > mem->down)
        return QRESULT_DESC(Result::Failed, Result::RiffInvalidTagSize);

    //lit les chunk
    char tag[4];
    unsigned int tag_size;
    while(mem->ptr<mem->down && riff_read_tag(mem,tag,&tag_size)){
        qDebug() << "tag=" << tag[0] << tag[1] << tag[2] << tag[3];
        qDebug() << "tag_size=" << tag_size;
        if(mem->ptr+tag_size > mem->down)
            return QRESULT_DESC(Result::Failed, Result::RiffInvalidTagSize);
        if(memcmp("EQUIP",tag,sizeof(tag)) == 0 ){
            qDebug() << "EQUIP tag...";
            //Charge l'équipement
            RIFF_EQUIP equip;
            equip.id = btoi(mem);
            bread(mem,equip.name,sizeof(equip.name));
            bread(mem,equip.type,sizeof(equip.type));
            //Ajoute l'équipement à la scene
            Equipment qequip;
            qequip.equipmentId = equip.id;
            qequip.name = QString(equip.name);
            qequip.type = QString(equip.type);
            QPRINT(qequip.type);
            qequip.posX = qequip.posY = qequip.posZ = 0;
            this->addEquipment(qequip);
        }
        else{
            qDebug() << "IGNORE tag";
            mem->ptr += tag_size;
        }
        qDebug() << "offset=" << boffset(mem);
    }

    return QRESULT_OK();
}
Exemple #5
0
void Zrevert_file(void)
{
	unsigned long offset;

	if (!Curbuff->fname) {
		tbell();
		return;
	}

	if (Bbuff->bmodf && ask("File modifed. Ok to loose changes?") != YES)
		return;

	/* Lose the undo history */
	undo_clear(Curbuff->buff);

	offset = blocation(Bbuff);
	zreadfile(Curbuff->fname);
	boffset(Bbuff, offset);
	uncomment(Curbuff);
}
Exemple #6
0
void wbf(Tchar i)	/* store i into offset, get ready for next one */
{
	int j, off;

	if (!offset)
		return;
	j = bindex(offset);
	if (i == 0)
		contabp[savslot].emx = offset;
	off = boffset(offset);
	blist[j].bp[off++] = i;
	offset++;
	if (pastend(offset)) {	/* off the end of this block */
		if (blist[j].nextoff == -1) {
			if ((nextb = alloc()) == -1) {
				ERROR "Out of temp file space" WARN;
				done2(01);
			}
			blist[j].nextoff = nextb;
		}
		offset = blist[j].nextoff;
	}
}
Exemple #7
0
# define NUM_DM_RESOURCES	(sizeof DmResources / sizeof DmResources[0])

# define boffset(f)	XtOffsetOf(struct display, f)

struct displayResource {
	char	*name, *class;
	int	type;
	int	offset;
	char	*default_value;
};

/* resources for managing the server */

struct displayResource serverResources[] = {
{"serverAttempts","ServerAttempts",DM_INT,	boffset(serverAttempts),
				"1"},
{"openDelay",	"OpenDelay",	DM_INT,		boffset(openDelay),
				"15"},
{"openRepeat",	"OpenRepeat",	DM_INT,		boffset(openRepeat),
				"5"},
{"openTimeout",	"OpenTimeout",	DM_INT,		boffset(openTimeout),
				"120"},
{"startAttempts","StartAttempts",DM_INT,       	boffset(startAttempts),
				"4"},
{"pingInterval",	"PingInterval",	DM_INT,	boffset(pingInterval),
				"5"},
{"pingTimeout",	"PingTimeout",	DM_INT,		boffset(pingTimeout),
				"5"},
{"terminateServer","TerminateServer",DM_BOOL,	boffset(terminateServer),
				"false"},
Exemple #8
0
int get_bit(word_t *data, int b)
{ 
    return data[bindex(b)] & (1 << (boffset(b)));
}
Exemple #9
0
void clear_bit(word_t *data, int b)
{ 
    data[bindex(b)] &= ~(1 << (boffset(b)));
}
Exemple #10
0
void set_bit(word_t *data, int b)
{ 
    data[bindex(b)] |= 1 << (boffset(b)); 
}
Exemple #11
0
int bitset_get(struct _bitset * bitset, int b) { 
    return bitset->words[bindex(b)] & (1 << (boffset(b))) ? 1 : 0;
}
Exemple #12
0
void bitset_clear(struct _bitset * bitset, int b) { 
    bitset->words[bindex(b)] &= ~(1 << (boffset(b)));
}
Exemple #13
0
void bitset_set(struct _bitset * bitset, int b) { 
    bitset->words[bindex(b)] |= 1 << (boffset(b)); 
}