예제 #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)));
	}
}
예제 #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)));
	}
}
예제 #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));
	}
}
예제 #4
0
/**
  @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();
}
예제 #5
0
파일: file.c 프로젝트: smaclennan/zedit
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);
}
예제 #6
0
파일: n3.c 프로젝트: AustenConrad/plan-9
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;
	}
}
예제 #7
0
파일: resource.c 프로젝트: xwizard/kde1
# 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"},
예제 #8
0
파일: util.c 프로젝트: psclib/pscgen
int get_bit(word_t *data, int b)
{ 
    return data[bindex(b)] & (1 << (boffset(b)));
}
예제 #9
0
파일: util.c 프로젝트: psclib/pscgen
void clear_bit(word_t *data, int b)
{ 
    data[bindex(b)] &= ~(1 << (boffset(b)));
}
예제 #10
0
파일: util.c 프로젝트: psclib/pscgen
void set_bit(word_t *data, int b)
{ 
    data[bindex(b)] |= 1 << (boffset(b)); 
}
예제 #11
0
파일: bitset.c 프로젝트: etosha/fslib
int bitset_get(struct _bitset * bitset, int b) { 
    return bitset->words[bindex(b)] & (1 << (boffset(b))) ? 1 : 0;
}
예제 #12
0
파일: bitset.c 프로젝트: etosha/fslib
void bitset_clear(struct _bitset * bitset, int b) { 
    bitset->words[bindex(b)] &= ~(1 << (boffset(b)));
}
예제 #13
0
파일: bitset.c 프로젝트: etosha/fslib
void bitset_set(struct _bitset * bitset, int b) { 
    bitset->words[bindex(b)] |= 1 << (boffset(b)); 
}