void CondorFileTable::init()
{
	got_buffer_info = 0;
	buffer_size = 0;
	buffer_block_size = 0;
	info_count = 0;
	aggravate_mode = 0;

	int scm = SetSyscalls( SYS_UNMAPPED | SYS_LOCAL );
	length = sysconf(_SC_OPEN_MAX);
	SetSyscalls(scm);

	pointers = new CondorFilePointer *[length];
	if(!pointers) {
		_condor_error_retry("Out of memory!\n");
	}

	for( int i=0; i<length; i++ ) {
		pointers[i]=0;
	}

	info_head = 0;

	pointers[0] = new CondorFilePointer(0,make_info("default stdin"),O_RDONLY,"default stdin");
	pointers[1] = new CondorFilePointer(0,make_info("default stdout"),O_WRONLY,"default stdout");
	pointers[2] = new CondorFilePointer(0,make_info("default stderr"),O_WRONLY,"default stderr");

	working_dir = strdup(".");

	atexit( _condor_file_table_shutdown );
}
Example #2
0
unsigned
furo_select_action_all(Taku *taku, unsigned pai)
{
    unsigned eachinfo = 0;
    unsigned info[4] = {0};
    unsigned temp = 0;
    unsigned offset;
    unsigned player = taku->teban;
    unsigned testpattern[3] = {0x1110, 0x6660, 0x0020};
    unsigned i;
    while ((player = (player + 1) % N_PLAYER) != taku->teban)
        eachinfo |= furo_select_action(player, taku, pai)
            << 4 * ((player - taku->teban) % N_PLAYER);

    temp = eachinfo & 0x1110;
    if (temp == 0x1110)
        return make_info(ACTION_SANCHAHOH, taku->teban, pai);
    for (i = 0; i < 3; i++) {
        temp = eachinfo & testpattern[i];
        if (temp) {
            offset = __builtin_ctz(temp) / 4;
            temp >>= (offset * 4) & 0xf;
            return make_info(temp, ((taku->teban + offset) % N_PLAYER), pai);
        }
    }
    return make_info(ACTION_THROUGH, taku->teban, pai);
}
Example #3
0
int main(void) {
    struct name person;
    person = get_info();
    person = make_info(person);
    show_info(person);
    return EXIT_SUCCESS;
}
Example #4
0
unsigned
tsumo_select_action(Taku *taku, unsigned pai)
{
    unsigned shanten_after_tsumo;
    unsigned shanten_after_sute;
    unsigned idx = 0;
    unsigned pos = 0;
    unsigned sutehai;
    unsigned info;
    Te *te = &taku->te[taku->teban];
    te_add(te, pai);
    shanten_after_tsumo = te_shanten(te);
    if (shanten_after_tsumo == 0)
        return make_info(ACTION_TSUMO, taku->teban, pai);
    while (idx < 4) {
        unsigned v = te->tehai.octmap[idx];
        while (pos < 9 && (v &= ~0U << 3 * pos)) {
            pos = div3_restrict(__builtin_ctz(v));
            {
                sutehai = (idx << 4) + pos;
                te_del(te, sutehai);
                shanten_after_sute = te_shanten(te);
                if (shanten_after_sute == shanten_after_tsumo)
                    goto tegiri;
                te_add(te, sutehai);
            }
            ++pos;
        }
        ++idx;
        pos = 0;
    }
tsumogiri:
    te_del(te, pai);
    return make_info(ACTION_SUTE, taku->teban, pai);
tegiri:
    return make_info(ACTION_SUTE, taku->teban, sutehai);
}
Example #5
0
void write_bitmap(char const * path, SampleBuffer const & buffer) {
	FILE * fd = fopen(path, "wb");

	BitmapHeader header;
	BitmapInfo info = make_info(buffer.get_width(), buffer.get_height());

	header.size() = sizeof(header) + sizeof(info) + buffer.get_size() * sizeof(uint32);
	header.offset() = sizeof(header) + sizeof(info);

	fwrite(&header, sizeof(header), 1, fd);
	fwrite(&info, sizeof(info), 1, fd);
	buffer.write_bitmap(fd);

	fclose(fd);
}
int CondorFileTable::install_special( int real_fd, char *kind )
{
	int fd = find_empty();
	if(fd<0) return -1;

	CondorFileInfo *i= make_info(kind);
	i->already_warned = 1;
	i->open_count++;

	CondorFileSpecial *s = new CondorFileSpecial();
	s->attach( real_fd );

	pointers[fd] = new CondorFilePointer( s, i, O_RDWR, kind );

	return fd;
}
Example #7
0
bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkColorSpace* dstColorSpace, CachingHint chint) const {
    const auto desc = SkBitmapCacheDesc::Make(this);
    if (SkBitmapCache::Find(desc, dst)) {
        SkASSERT(dst->getGenerationID() == this->uniqueID());
        SkASSERT(dst->isImmutable());
        SkASSERT(dst->getPixels());
        return true;
    }

    SkImageInfo ii = make_info(this->width(), this->height(), this->alphaType(),
                               sk_ref_sp(dstColorSpace));
    SkBitmapCache::RecPtr rec = nullptr;
    SkPixmap pmap;
    if (kAllow_CachingHint == chint) {
        rec = SkBitmapCache::Alloc(desc, ii, &pmap);
        if (!rec) {
            return false;
        }
    } else {
        if (!dst->tryAllocPixels(ii)) {
            return false;
        }
    }

    sk_sp<GrSurfaceContext> sContext = fContext->contextPriv().makeWrappedSurfaceContext(
                                                                                    fProxy,
                                                                                    fColorSpace);
    if (!sContext) {
        return false;
    }

    if (!sContext->readPixels(pmap.info(), pmap.writable_addr(), pmap.rowBytes(), 0, 0)) {
        return false;
    }

    if (rec) {
        SkBitmapCache::Add(std::move(rec), dst);
        fAddedRasterVersionToCache.store(true);
    }
    return true;
}
int CondorFileTable::open( const char *logical_name, int flags, int mode )
{
	char *full_logical_name = NULL;

	CondorFile *file=0;
	CondorFileInfo *info=0;

	// Convert a relative path into a complete path

	complete_path( logical_name, &full_logical_name );

	// Find a fresh file descriptor

	int fd = find_empty();
	if(fd<0) {
		errno = EMFILE;
		free( full_logical_name );
		return -1;
	}

	file = open_file_unique( full_logical_name, flags, mode );
	if(!file) {
		free( full_logical_name );
		return -1;
	}

	info = make_info( full_logical_name );
	info->open_count++;

	// Flags that should be applied once only are now removed

	flags &= ~(O_TRUNC);
	flags &= ~(O_CREAT);
	
	// Install the pointer and return!

	pointers[fd] = new CondorFilePointer(file,info,flags,full_logical_name);
	free( full_logical_name );
	return fd;
}
Example #9
0
bool SkImage_Gpu::getROPixels(SkBitmap* dst, CachingHint chint) const {
    if (SkBitmapCache::Find(this->uniqueID(), dst)) {
        SkASSERT(dst->getGenerationID() == this->uniqueID());
        SkASSERT(dst->isImmutable());
        SkASSERT(dst->getPixels());
        return true;
    }

    if (!dst->tryAllocPixels(make_info(this->width(), this->height(), this->isOpaque()))) {
        return false;
    }
    if (!fTexture->readPixels(0, 0, dst->width(), dst->height(), kSkia8888_GrPixelConfig,
                              dst->getPixels(), dst->rowBytes())) {
        return false;
    }

    dst->pixelRef()->setImmutableWithID(this->uniqueID());
    if (kAllow_CachingHint == chint) {
        SkBitmapCache::Add(this->uniqueID(), *dst);
        fAddedRasterVersionToCache.store(true);
    }
    return true;
}
Example #10
0
bool SkImage_Gpu::asBitmapForImageFilters(SkBitmap* bitmap) const {
    bitmap->setInfo(make_info(this->width(), this->height(), this->isOpaque()));
    bitmap->setPixelRef(new SkGrPixelRef(bitmap->info(), fTexture))->unref();
    bitmap->pixelRef()->setImmutableWithID(this->uniqueID());
    return true;
}
Example #11
0
 Rel(addr_t offset, uint32_t type, uint32_t sym)
     : r_offset(offset), r_info(make_info(type, sym)) {}
Example #12
0
 void set_r_sym(uint32_t sym) {
     r_info = make_info(r_type(), sym);
 }
Example #13
0
 void set_r_type(uint32_t type) {
     r_info = make_info(type, r_sym());
 }
Example #14
0
unsigned
chankan_select_action_all(Taku *taku, unsigned pai)
{
    /* TODO */
    return make_info(ACTION_THROUGH, taku->teban, pai);
}