Bool32 rstr_open_cont(void) { #ifdef _USE_CTB_ uchar data[CTB_DATA_SIZE]= {0}; rstr_close_cont(); data[0]=38; if( !CTB_create(local_ctb_name,data) || !CTB_open(local_ctb_name,&this_ctb,"w") ) { mkdir("TMP", S_IRWXU); if( !CTB_create(local_ctb_name,data) || !CTB_open(local_ctb_name,&this_ctb,"w") ) return FALSE; } CTB_read_global_data(&this_ctb,data); datalen = data[0]; return TRUE; #else return FALSE; #endif }
// save base for spell learning Bool32 rstr_open_cont1(void) { #ifdef _USE_CTB_ uchar data[CTB_DATA_SIZE]= {0}; static int init=1; if( init ) { init=0; data[0]=38+12*3+1; if( !CTB_create("d:\\vers",data) || !CTB_open("d:\\vers",&this_ctb1,"w") ) return FALSE; CTB_read_global_data(&this_ctb1,data); datalen1 = data[0]; } return TRUE; #else return FALSE; #endif }
int32_t CTB_AddRecRaster(const char *fname, RecRaster *r, uchar let) { CTB_handle hnd; int32_t num; uchar raster[REC_MAX_RASTER_SIZE], data[CTB_DATA_SIZE] = { 0 }; int32_t wb; Bool32 ret; if (!CTB_open(fname, &hnd, "w")) { if (1) CTB_create(fname, NULL); else CTB_create_gray(fname, NULL); if (!CTB_open(fname, &hnd, "w")) { return FALSE; } } data[1] = (uchar) r->lnPixWidth; data[2] = (uchar) r->lnPixHeight; data[3] = let; if (hnd.signums & (CTB_GRAY_SCALE | CTB_PLANE)) { wb = r->lnPixWidth; memcpy(raster, r->Raster, wb * r->lnPixHeight); } else { wb = ((r->lnPixWidth + 63) / 64) * 8; memcpy(raster, r->Raster, wb * r->lnPixHeight); CTB_align1_lines(raster, r->lnPixWidth, r->lnPixHeight); } ret = CTB_write(&hnd, -1, raster, data); num = hnd.num; CTB_close(&hnd); return ret ? num : -1; }