int zro_gettok (char **lp, char *top, mstr *tok) { int toktyp; if (*lp >= top) toktyp = ZRO_EOL; else switch (**lp) { case ZRO_DEL: toktyp = ZRO_DEL; while (*lp < top && **lp == ZRO_DEL) (*lp)++; break; case ZRO_LBR: toktyp = ZRO_LBR; (*lp)++; break; case ZRO_RBR: toktyp = ZRO_RBR; (*lp)++; break; default: tok->addr = *lp; while (*lp < top && **lp != ZRO_DEL && **lp != ZRO_LBR && **lp != ZRO_RBR) (*lp)++; toktyp = ZRO_IDN; tok->len = INTCAST(*lp - tok->addr); break; } return toktyp; }
void murgetlst(void) { char *c1, *c2, buff[MAX_LINE]; unsigned short len; inc_list_struct *ptr; error_def(ERR_MUNODBNAME); len = SIZEOF(buff); if (!cli_get_str(name,buff,&len)) mupip_exit(ERR_MUNODBNAME); ptr = &in_files; for (c1 = c2 = buff; ; ) { for ( ; *c2 && (*c2 != ',') ; c2++) ; ptr->next = (inc_list_struct*)malloc(SIZEOF(inc_list_struct)); ptr = ptr->next; ptr->next = 0; ptr->input_file.len = INTCAST(c2 - c1); ptr->input_file.addr = (char *)malloc(c2 - c1 + 1); memcpy(ptr->input_file.addr, c1, c2 - c1); *(char*)(ptr->input_file.addr + (c2 - c1)) = '\0'; if (!*c2) break; else c1 = ++c2; } return; }
void mubexpfilnam(char *dirname, unsigned int dirlen, backup_reg_list *list) { char *c1; mstr file; char tmp_mstr_addr[MAX_FN_LEN]; file.len = MAX_FN_LEN; file.addr = tmp_mstr_addr; if (list != mu_repl_inst_reg_list) { /* Database region */ if (!mupfndfil(list->reg, &file, LOG_ERROR_TRUE)) { util_out_print("Backup not finished because of the above error.", TRUE); error_mupip = TRUE; return; } } else { /* Replication instance region */ if (!repl_inst_get_name(file.addr, (unsigned int *)&file.len, MAX_FN_LEN, issue_rts_error)) assertpro(FALSE); /* rts_error should have been issued by repl_inst_get_name */ } for (c1 = file.addr + file.len; (*c1 != '/') && (c1 != file.addr); c1--) ; list->backup_file.len = INTCAST(dirlen + (file.len - (c1 - file.addr))); list->backup_file.addr = (char *)malloc(list->backup_file.len + 1); memcpy(list->backup_file.addr, dirname, dirlen); memcpy(list->backup_file.addr + dirlen, c1, (file.len - (c1 - file.addr))); list->backup_file.addr[list->backup_file.len] = '\0'; return; }
int iomb_read(mval *v,int4 t) { io_desc *io_ptr; d_mb_struct *mb_ptr; int status; assert(stringpool.free >= stringpool.base); assert(stringpool.free <= stringpool.top); io_ptr = io_curr_device.in; mb_ptr = (d_mb_struct *) io_ptr->dev_sp; if (stringpool.free + mb_ptr->maxmsg > stringpool.top) stp_gcol (mb_ptr->maxmsg); v->str.addr = (char *)stringpool.free; status = TRUE; assert (io_ptr->state == dev_open); if (mb_ptr->in_top == mb_ptr->in_pos) status = iomb_dataread(t); memcpy(v->str.addr,mb_ptr->in_pos,(v->str.len = INTCAST(mb_ptr->in_top - mb_ptr->in_pos))); mb_ptr->in_pos = mb_ptr->in_top = mb_ptr->inbuf; io_ptr->dollar.x = 0; io_ptr->dollar.y++; return status; }
void list_head(bool newpage) { short col_2 = 70; static readonly unsigned char page_lit[] = "page "; unsigned char page_no_buf[10]; mval head; if (newpage) op_wtff(); head.mvtype = MV_STR; head.str.addr = (char *)>m_release_name[0]; head.str.len = gtm_release_name_len; op_write (&head); head.str.addr = (char *)>m_copy_right[0]; head.str.len = sizeof(gtm_copy_right) - 1; op_write (&head); op_wttab(col_2); head.str.addr = print_time_buf; head.str.len = 20; op_write(&head); op_wttab(100); lst_param.page++; head.str.addr = (char *)page_lit; head.str.len = sizeof(page_lit) - 1; op_write(&head); head.str.addr = (char *)page_no_buf; head.str.len = INTCAST(i2asc(page_no_buf, lst_param.page) - page_no_buf); op_write(&head); op_wteol(1); head.str.addr = source_file_name; head.str.len = source_name_len; op_write(&head); if (source_name_len >= col_2) op_wteol(1); op_wttab(col_2); head.str.addr = rev_time_buf; head.str.len = 20; op_write(&head); op_wteol(3); }
void ecode_get(int level, mval *val) { mstr tmpmstr; val->mvtype = MV_STR; assert(-1 == level); /* currently -1 is the only valid negative level argument to ecode_get() */ if (dollar_ecode.index) { assert(dollar_ecode.end > dollar_ecode.begin); val->str.addr = dollar_ecode.begin; val->str.len = INTCAST(dollar_ecode.end - dollar_ecode.begin + 1); /* to account for terminating ',' */ s2pool(&val->str); } else { assert(dollar_ecode.end == dollar_ecode.begin); val->str.len = 0; } }
void lvtree_newblock(symval *sym, int numElems) { register lv_blk *ptr; register int n; lvTree *lvt_base; n = numElems * SIZEOF(lvTree) + SIZEOF(lv_blk); n = INTCAST(gtm_bestfitsize(n)); /* Maximize use of storage block we are going to get */ assert(DIVIDE_ROUND_DOWN(n - SIZEOF(lv_blk), SIZEOF(lvTree)) >= numElems); numElems = DIVIDE_ROUND_DOWN(n - SIZEOF(lv_blk), SIZEOF(lvTree)); ptr = (lv_blk *)malloc(n); lvt_base = (lvTree *)LV_BLK_GET_BASE(ptr); ptr->next = sym->lvtree_first_block; sym->lvtree_first_block = ptr; ptr->numAlloc = numElems; ptr->numUsed = 0; DBGRFCT((stderr, "lvtree_newblock: New lv_blk allocated ******************\n")); }
/* parse an entry reference string into routine, label & offset */ void lref_parse(unsigned char *label_ref, mstr* routine, mstr* label, int* offset) { unsigned char ch, *c, *c1; int i, label_len; error_def (ERR_RUNPARAMERR); routine->addr = label->addr = (char *)label_ref; *offset = 0; label_len = STRLEN((const char *)label_ref); for (i = 0, c = label_ref; i < label_len; i++) { ch = *c++; if (ch == '^' || ch == '+') { label->len = i; if (ch == '+') { *offset = (int)STRTOL((const char *)c, (char**)&c1, 10); if (c == c1 ||*c1 != '^') rts_error(VARLSTCNT(1) ERR_RUNPARAMERR); c = c1 + 1; } routine->addr = (char *)c; routine->len = INTCAST(label_ref + label_len - c); break; } } if (routine->addr == (char *)label_ref) { routine->len = label_len; routine->addr = (char *)label_ref; label->len = 0; } if (!is_ident(routine)) rts_error(VARLSTCNT(1) ERR_RUNPARAMERR); if (label->len && !is_ident(label)) rts_error(VARLSTCNT(1) ERR_RUNPARAMERR); routine->len = routine->len > MAX_MIDENT_LEN ? MAX_MIDENT_LEN : routine->len; label->len = label->len > MAX_MIDENT_LEN ? MAX_MIDENT_LEN : label->len; }
void i2smval(mval *v, uint4 i) { char *c; int exp; int4 n; v->mvtype = MV_NM | MV_STR; v->m[1] = n = i; v->sgn = 0; c = v->str.addr; exp = 100000000; while (exp && !(n = i / exp)) exp /= 10; if (!exp) *c++ = 0; else for (;;) { *c++ = n + '0'; i -= n * exp; exp /= 10; if (!exp) break; n = i / exp; } if (v->m[1] < INT_HI) { v->mvtype |= MV_INT; v->m[1] = MV_BIAS * i; } else if (v->m[1] < MANT_HI) { v->m[1] *= ten_pwr[NUM_DEC_DG_1L - exp]; v->m[0] = 0; } else { v->m[0] = (v->m[1] % 10) * MANT_LO; v->m[1] /= 10; } v->str.len = INTCAST(c - v->str.addr); v->e = v->str.len + MV_XBIAS; assert(v->m[1] < MANT_HI); }
void get_reference(mval *var) { char *end, *start; char extnamdelim[] = "^|\"\"|"; char *extnamsrc, *extnamtop; int maxlen; /* you need to return a double-quote for every single-quote. assume worst case. */ maxlen = MAX_ZWR_KEY_SZ + (!extnam_str.len ? 0 : ((extnam_str.len * 2) + SIZEOF(extnamdelim))); ENSURE_STP_FREE_SPACE(maxlen); var->mvtype = MV_STR; start = var->str.addr = (char *)stringpool.free; var->str.len = 0; if (gv_currkey && gv_currkey->end) { if (extnam_str.len) { *start++ = extnamdelim[0]; *start++ = extnamdelim[1]; *start++ = extnamdelim[2]; extnamsrc = &extnam_str.addr[0]; extnamtop = extnamsrc + extnam_str.len; for ( ; extnamsrc < extnamtop; ) { *start++ = *extnamsrc; if ('"' == *extnamsrc++) /* caution : pointer increment side-effect */ *start++ = '"'; } *start++ = extnamdelim[3]; } end = (char *)format_targ_key((unsigned char *)start, MAX_ZWR_KEY_SZ, gv_currkey, TRUE); if (extnam_str.len) /* Note: the next vertical bar overwrites the caret that * was part of he original name of the global variable */ *start = extnamdelim[4]; var->str.len = INTCAST(end - var->str.addr); stringpool.free += var->str.len; } }
void __dsymm__(char* Side, char* Uplo, const int* M, const int* N, const double* alpha, const double* A, const int* lda, const double* B, const int* ldb, const double* beta, double* C, const int* ldc) { EigenFunc_dsymm(Side, Uplo, INTCAST(M), INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(A), INTCAST(lda), DOUBLECAST(B), INTCAST(ldb), DOUBLECAST(beta), DOUBLECAST(C), INTCAST(ldc)); }
void __dgemm__(char* TransA, char* TransB, const int* M, const int* N, const int* K, const double* alpha, const double* A, const int* lda, const double* B, const int* ldb, const double* beta, double* C, const int* ldc) { EigenFunc_dgemm(TransA, TransB, INTCAST(M), INTCAST(N), INTCAST(K), DOUBLECAST(alpha), DOUBLECAST(A), INTCAST(lda), DOUBLECAST(B), INTCAST(ldb), DOUBLECAST(beta), DOUBLECAST(C), INTCAST(ldc)); }
void __dgemv__(char* TransA, const int* M, const int* N, const double* alpha, const double* A, const int* lda, const double* X, const int* incX, const double* beta, double* Y, const int* incY) { EigenFunc_dgemv(TransA, INTCAST(M), INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(A), INTCAST(lda), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(beta), DOUBLECAST(Y), INTCAST(incY)); }
void __drot__(const int* N, double* X, const int* incX, double* Y, const int* incY, const double* c, const double* s) { EigenFunc_drot(INTCAST(N), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(Y), INTCAST(incY), DOUBLECAST(c), DOUBLECAST(s)); }
void __dswap__(const int* N, double* X, const int* incX, double* Y, const int* incY) { EigenFunc_dswap(INTCAST(N), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(Y), INTCAST(incY)); }
void __dasum_sub__(const int* N, const double* X, const int* incX, double* asum) { *asum = EigenFunc_dasum(INTCAST(N), DOUBLECAST(X), INTCAST(incX)); }
void __ddot_sub__(const int* N, double* X, const int* incX, double* Y, const int* incY, double* dot) { *dot = EigenFunc_ddot(INTCAST(N), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(Y), INTCAST(incY)); }
void __dsyr2k__(char* Uplo, char* Trans, const int* N, const int* K, const double* alpha, const double* A, const int* lda, const double* B, const int* ldb, const double* beta, double* C, const int* ldc) { EigenFunc_dsyr2k(Uplo, Trans, INTCAST(N), INTCAST(K), DOUBLECAST(alpha), DOUBLECAST(A), INTCAST(lda), DOUBLECAST(B), INTCAST(ldb), DOUBLECAST(beta), DOUBLECAST(C), INTCAST(ldc)); }
void __dtrsm__(char* Side, char* Uplo, char* TransA, char* Diag, const int* M, const int* N, const double* alpha, const double* A, const int* lda, double* B, const int* ldb) { EigenFunc_dtrsm(Side, Uplo, TransA, Diag, INTCAST(M), INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(A), INTCAST(lda), DOUBLECAST(B), INTCAST(ldb)); }
void __dtbsv__(char* Uplo, char* TransA, char* Diag, const int* N, const int* K, const double* A, const int* lda, double* X, const int* incX) { EigenFunc_dtbsv(Uplo, TransA, Diag, INTCAST(N), INTCAST(K), DOUBLECAST(A), INTCAST(lda), DOUBLECAST(X), INTCAST(incX)); }
void __idamax_sub__(const int* N, double* X, const int* incX, int* iamax) { *iamax = EigenFunc_idamax(INTCAST(N), DOUBLECAST(X), INTCAST(incX)); }
void __dtpsv__(char* Uplo, char* TransA, char* Diag, const int* N, const double* Ap, double* X, const int* incX) { EigenFunc_dtpsv(Uplo, TransA, Diag, INTCAST(N), DOUBLECAST(Ap), DOUBLECAST(X), INTCAST(incX)); }
void __dnrm2_sub__(const int* N, double* X, const int* incX, double* nrm2) { *nrm2 = EigenFunc_dnrm2(INTCAST(N), DOUBLECAST(X), INTCAST(incX)); }
void __dsymv__(char* Uplo, const int* N, const double* alpha, const double* A, const int* lda, const double* X, const int* incX, const double* beta, double* Y, const int* incY) { EigenFunc_dsymv(Uplo, INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(A), INTCAST(lda), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(beta), DOUBLECAST(Y), INTCAST(incY)); }
void __daxpy__(const int* N, const double* alpha, const double* X, const int* incX, double* Y, const int* incY) { EigenFunc_daxpy(INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(Y), INTCAST(incY)); }
void __dger__(const int* M, const int* N, const double* alpha, const double* X, const int* incX, const double* Y, const int* incY, double* A, const int* lda) { EigenFunc_dger(INTCAST(M), INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(Y), INTCAST(incY), DOUBLECAST(A), INTCAST(lda)); }
void __dscal__(const int* N, const double* alpha, double* X, const int* incX) { EigenFunc_dscal(INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(X), INTCAST(incX)); }
void __dspr__(char* Uplo, const int* N, const double* alpha, const double* X, const int* incX, double* Ap) { EigenFunc_dspr(Uplo, INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(Ap)); }
void bin_load(uint4 begin, uint4 end) { unsigned char *ptr, *cp1, *cp2, *btop, *gvkey_char_ptr, *tmp_ptr, *tmp_key_ptr, *c, *ctop; unsigned char hdr_lvl, src_buff[MAX_KEY_SZ + 1], dest_buff[MAX_ZWR_KEY_SZ], cmpc_str[MAX_KEY_SZ + 1], dup_key_str[MAX_KEY_SZ + 1]; unsigned char *end_buff; unsigned short rec_len, next_cmpc; int len; int current, last, length, max_blk_siz, max_key, status; uint4 iter, max_data_len, max_subsc_len, key_count; ssize_t rec_count, global_key_count, subsc_len,extr_std_null_coll; boolean_t need_xlation, new_gvn, utf8_extract; rec_hdr *rp, *next_rp; mval v, tmp_mval; mstr mstr_src, mstr_dest; collseq *extr_collseq, *db_collseq, *save_gv_target_collseq; coll_hdr extr_collhdr, db_collhdr; gv_key *tmp_gvkey = NULL; /* null-initialize at start, will be malloced later */ char std_null_coll[BIN_HEADER_NUMSZ + 1]; # ifdef GTM_CRYPT gtmcrypt_key_t *encr_key_handles; char *inbuf; int4 index; int req_dec_blk_size, init_status, crypt_status; muext_hash_hdr_ptr_t hash_array = NULL; # endif DCL_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS; assert(4 == SIZEOF(coll_hdr)); gvinit(); v.mvtype = MV_STR; len = file_input_bin_get((char **)&ptr); hdr_lvl = EXTR_HEADER_LEVEL(ptr); if (!(((('4' == hdr_lvl) || ('5' == hdr_lvl)) && (BIN_HEADER_SZ == len)) || (('4' > hdr_lvl) && (V3_BIN_HEADER_SZ == len)))) { rts_error(VARLSTCNT(1) ERR_LDBINFMT); mupip_exit(ERR_LDBINFMT); } /* expecting the level in a single character */ assert(' ' == *(ptr + SIZEOF(BIN_HEADER_LABEL) - 3)); if (0 != memcmp(ptr, BIN_HEADER_LABEL, SIZEOF(BIN_HEADER_LABEL) - 2) || ('2' > hdr_lvl) || *(BIN_HEADER_VERSION) < hdr_lvl) { /* ignore the level check */ rts_error(VARLSTCNT(1) ERR_LDBINFMT); mupip_exit(ERR_LDBINFMT); } /* check if extract was generated in UTF-8 mode */ utf8_extract = (0 == MEMCMP_LIT(&ptr[len - BIN_HEADER_LABELSZ], UTF8_NAME)) ? TRUE : FALSE; if ((utf8_extract && !gtm_utf8_mode) || (!utf8_extract && gtm_utf8_mode)) { /* extract CHSET doesn't match $ZCHSET */ if (utf8_extract) rts_error(VARLSTCNT(4) ERR_LOADINVCHSET, 2, LEN_AND_LIT("UTF-8")); else rts_error(VARLSTCNT(4) ERR_LOADINVCHSET, 2, LEN_AND_LIT("M")); mupip_exit(ERR_LDBINFMT); } if ('4' >= hdr_lvl) { /* Binary extracts in V50000-to-V52000 (label=4) and pre-V50000 (label=3) could have a '\0' byte (NULL byte) * in the middle of the string. Replace it with ' ' (space) like it would be in V52000 binary extracts and above. */ for (c = ptr, ctop = c + len; c < ctop; c++) { if ('\0' == *c) *c = ' '; } } util_out_print("Label = !AD\n", TRUE, len, ptr); new_gvn = FALSE; if (hdr_lvl > '3') { memcpy(std_null_coll, ptr + BIN_HEADER_NULLCOLLOFFSET, BIN_HEADER_NUMSZ); std_null_coll[BIN_HEADER_NUMSZ] = '\0'; extr_std_null_coll = STRTOUL(std_null_coll, NULL, 10); if (0 != extr_std_null_coll && 1!= extr_std_null_coll) { rts_error(VARLSTCNT(5) ERR_TEXT, 2, RTS_ERROR_TEXT("Corrupted null collation field in header"), ERR_LDBINFMT); mupip_exit(ERR_LDBINFMT); } } else extr_std_null_coll = 0; # ifdef GTM_CRYPT if ('5' <= hdr_lvl) { int i, num_indexes; len = file_input_bin_get((char **)&ptr); hash_array = (muext_hash_hdr *)malloc(len); /* store hashes of all the files used during extract into muext_hash_hdr structure */ memcpy((char *)hash_array, ptr, len); num_indexes = len / GTMCRYPT_HASH_LEN; encr_key_handles = (gtmcrypt_key_t *)malloc(SIZEOF(gtmcrypt_key_t) * num_indexes); INIT_PROC_ENCRYPTION(crypt_status); GC_BIN_LOAD_ERR(crypt_status); for (index = 0; index < num_indexes; index++) { if (0 == memcmp(hash_array[index].gtmcrypt_hash, EMPTY_GTMCRYPT_HASH, GTMCRYPT_HASH_LEN)) continue; GTMCRYPT_GETKEY(hash_array[index].gtmcrypt_hash, encr_key_handles[index], crypt_status); GC_BIN_LOAD_ERR(crypt_status); } } # endif if ('2' < hdr_lvl) { len = file_input_bin_get((char **)&ptr); if (SIZEOF(coll_hdr) != len) { rts_error(VARLSTCNT(5) ERR_TEXT, 2, RTS_ERROR_TEXT("Corrupt collation header"), ERR_LDBINFMT); mupip_exit(ERR_LDBINFMT); } extr_collhdr = *((coll_hdr *)(ptr)); new_gvn = TRUE; } else gtm_putmsg(VARLSTCNT(3) ERR_OLDBINEXTRACT, 1, hdr_lvl - '0'); if (begin < 2) begin = 2; for (iter = 2; iter < begin; iter++) { if (!(len = file_input_bin_get((char **)&ptr))) { gtm_putmsg(VARLSTCNT(3) ERR_LOADEOF, 1, begin); util_out_print("Error reading record number: !UL\n", TRUE, iter); mupip_error_occurred = TRUE; return; } else if (len == SIZEOF(coll_hdr)) { extr_collhdr = *((coll_hdr *)(ptr)); assert(hdr_lvl > '2'); iter--; } } assert(iter == begin); util_out_print("Beginning LOAD at record number: !UL\n", TRUE, begin); max_data_len = 0; max_subsc_len = 0; global_key_count = key_count = 0; rec_count = begin - 1; extr_collseq = db_collseq = NULL; need_xlation = FALSE; assert(NULL == tmp_gvkey); /* GVKEY_INIT macro relies on this */ GVKEY_INIT(tmp_gvkey, DBKEYSIZE(MAX_KEY_SZ)); /* tmp_gvkey will point to malloced memory after this */ for (; !mupip_DB_full ;) { if (++rec_count > end) break; next_cmpc = 0; mupip_error_occurred = FALSE; if (mu_ctrly_occurred) break; if (mu_ctrlc_occurred) { util_out_print("!AD:!_ Key cnt: !UL max subsc len: !UL max data len: !UL", TRUE, LEN_AND_LIT(gt_lit), key_count, max_subsc_len, max_data_len); util_out_print("Last LOAD record number: !UL", TRUE, key_count ? (rec_count - 1) : 0); mu_gvis(); util_out_print(0, TRUE); mu_ctrlc_occurred = FALSE; } /* reset the stringpool for every record in order to avoid garbage collection */ stringpool.free = stringpool.base; if (!(len = file_input_bin_get((char **)&ptr)) || mupip_error_occurred) break; else if (len == SIZEOF(coll_hdr)) { extr_collhdr = *((coll_hdr *)(ptr)); assert(hdr_lvl > '2'); new_gvn = TRUE; /* next record will contain a new gvn */ rec_count--; /* Decrement as this record does not count as a record for loading purposes */ continue; } rp = (rec_hdr*)(ptr); # ifdef GTM_CRYPT if ('5' <= hdr_lvl) { /* Getting index value from the extracted file. It indicates which database file this record belongs to */ GET_LONG(index, ptr); if (-1 != index) /* Indicates that the record is encrypted. */ { req_dec_blk_size = len - SIZEOF(int4); inbuf = (char *)(ptr + SIZEOF(int4)); GTMCRYPT_DECODE_FAST(encr_key_handles[index], inbuf, req_dec_blk_size, NULL, crypt_status); GC_BIN_LOAD_ERR(crypt_status); } rp = (rec_hdr*)(ptr + SIZEOF(int4)); } # endif btop = ptr + len; cp1 = (unsigned char*)(rp + 1); v.str.addr = (char*)cp1; while (*cp1++) ; v.str.len =INTCAST((char*)cp1 - v.str.addr - 1); if (('2' >= hdr_lvl) || new_gvn) { if ((HASHT_GBLNAME_LEN == v.str.len) && (0 == memcmp(v.str.addr, HASHT_GBLNAME, HASHT_GBLNAME_LEN))) continue; bin_call_db(BIN_BIND, (INTPTR_T)gd_header, (INTPTR_T)&v.str); max_key = gv_cur_region->max_key_size; db_collhdr.act = gv_target->act; db_collhdr.ver = gv_target->ver; db_collhdr.nct = gv_target->nct; } GET_USHORT(rec_len, &rp->rsiz); if (rp->cmpc != 0 || v.str.len > rec_len || mupip_error_occurred) { bin_call_db(ERR_COR, (INTPTR_T)rec_count, (INTPTR_T)global_key_count); mu_gvis(); util_out_print(0, TRUE); continue; } if (new_gvn) { global_key_count = 1; if ((db_collhdr.act != extr_collhdr.act || db_collhdr.ver != extr_collhdr.ver || db_collhdr.nct != extr_collhdr.nct || gv_cur_region->std_null_coll != extr_std_null_coll)) { if (extr_collhdr.act) { if (extr_collseq = ready_collseq((int)extr_collhdr.act)) { if (!do_verify(extr_collseq, extr_collhdr.act, extr_collhdr.ver)) { gtm_putmsg(VARLSTCNT(8) ERR_COLLTYPVERSION, 2, extr_collhdr.act, extr_collhdr.ver, ERR_GVIS, 2, gv_altkey->end - 1, gv_altkey->base); mupip_exit(ERR_COLLTYPVERSION); } } else { gtm_putmsg(VARLSTCNT(7) ERR_COLLATIONUNDEF, 1, extr_collhdr.act, ERR_GVIS, 2, gv_altkey->end - 1, gv_altkey->base); mupip_exit(ERR_COLLATIONUNDEF); } } if (db_collhdr.act) { if (db_collseq = ready_collseq((int)db_collhdr.act)) { if (!do_verify(db_collseq, db_collhdr.act, db_collhdr.ver)) { gtm_putmsg(VARLSTCNT(8) ERR_COLLTYPVERSION, 2, db_collhdr.act, db_collhdr.ver, ERR_GVIS, 2, gv_altkey->end - 1, gv_altkey->base); mupip_exit(ERR_COLLTYPVERSION); } } else { gtm_putmsg(VARLSTCNT(7) ERR_COLLATIONUNDEF, 1, db_collhdr.act, ERR_GVIS, 2, gv_altkey->end - 1, gv_altkey->base); mupip_exit(ERR_COLLATIONUNDEF); } } need_xlation = TRUE; } else need_xlation = FALSE; } new_gvn = FALSE; for (; rp < (rec_hdr*)btop; rp = (rec_hdr*)((unsigned char *)rp + rec_len)) { GET_USHORT(rec_len, &rp->rsiz); if (rec_len + (unsigned char *)rp > btop) { bin_call_db(ERR_COR, (INTPTR_T)rec_count, (INTPTR_T)global_key_count); mu_gvis(); util_out_print(0, TRUE); break; } cp1 = (unsigned char*)(rp + 1); cp2 = gv_currkey->base + rp->cmpc; current = 1; for (;;) { last = current; current = *cp2++ = *cp1++; if (0 == last && 0 == current) break; if (cp1 > (unsigned char *)rp + rec_len || cp2 > (unsigned char *)gv_currkey + gv_currkey->top) { bin_call_db(ERR_COR, (INTPTR_T)rec_count, (INTPTR_T)global_key_count); mu_gvis(); util_out_print(0, TRUE); break; } } if (mupip_error_occurred) break; gv_currkey->end = cp2 - gv_currkey->base - 1; if (need_xlation) { assert(hdr_lvl >= '3'); assert(extr_collhdr.act || db_collhdr.act || extr_collhdr.nct || db_collhdr.nct || extr_std_null_coll != gv_cur_region->std_null_coll); /* gv_currkey would have been modified/translated in the earlier put */ memcpy(gv_currkey->base, cmpc_str, next_cmpc); next_rp = (rec_hdr *)((unsigned char*)rp + rec_len); if ((unsigned char*)next_rp < btop) { next_cmpc = next_rp->cmpc; assert(next_cmpc <= gv_currkey->end); memcpy(cmpc_str, gv_currkey->base, next_cmpc); } else next_cmpc = 0; /* length of the key might change (due to nct variation), * so get a copy of the original key from the extract */ memcpy(dup_key_str, gv_currkey->base, gv_currkey->end + 1); gvkey_char_ptr = dup_key_str; while (*gvkey_char_ptr++) ; gv_currkey->prev = 0; gv_currkey->end = gvkey_char_ptr - dup_key_str; assert(gv_keysize <= tmp_gvkey->top); while (*gvkey_char_ptr) { /* get next subscript (in GT.M internal subsc format) */ subsc_len = 0; tmp_ptr = src_buff; while (*gvkey_char_ptr) *tmp_ptr++ = *gvkey_char_ptr++; subsc_len = tmp_ptr - src_buff; src_buff[subsc_len] = '\0'; if (extr_collseq) { /* undo the extract time collation */ TREF(transform) = TRUE; save_gv_target_collseq = gv_target->collseq; gv_target->collseq = extr_collseq; } else TREF(transform) = FALSE; /* convert the subscript to string format */ end_buff = gvsub2str(src_buff, dest_buff, FALSE); /* transform the string to the current subsc format */ TREF(transform) = TRUE; tmp_mval.mvtype = MV_STR; tmp_mval.str.addr = (char *)dest_buff; tmp_mval.str.len = INTCAST(end_buff - dest_buff); tmp_gvkey->prev = 0; tmp_gvkey->end = 0; if (extr_collseq) gv_target->collseq = save_gv_target_collseq; mval2subsc(&tmp_mval, tmp_gvkey); /* we now have the correctly transformed subscript */ tmp_key_ptr = gv_currkey->base + gv_currkey->end; memcpy(tmp_key_ptr, tmp_gvkey->base, tmp_gvkey->end + 1); gv_currkey->prev = gv_currkey->end; gv_currkey->end += tmp_gvkey->end; gvkey_char_ptr++; } if ( gv_cur_region->std_null_coll != extr_std_null_coll && gv_currkey->prev) { if (extr_std_null_coll == 0) { GTM2STDNULLCOLL(gv_currkey->base, gv_currkey->end); } else { STD2GTMNULLCOLL(gv_currkey->base, gv_currkey->end); } } } if (gv_currkey->end >= max_key) { bin_call_db(ERR_COR, (INTPTR_T)rec_count, (INTPTR_T)global_key_count); mu_gvis(); util_out_print(0, TRUE); continue; } if (max_subsc_len < (gv_currkey->end + 1)) max_subsc_len = gv_currkey->end + 1; v.str.addr = (char*)cp1; v.str.len =INTCAST(rec_len - (cp1 - (unsigned char *)rp)); if (max_data_len < v.str.len) max_data_len = v.str.len; bin_call_db(BIN_PUT, (INTPTR_T)&v, 0); if (mupip_error_occurred) { if (!mupip_DB_full) { bin_call_db(ERR_COR, (INTPTR_T)rec_count, (INTPTR_T)global_key_count); util_out_print(0, TRUE); } break; } key_count++; global_key_count++; } } GTMCRYPT_ONLY( if (NULL != hash_array) free(hash_array); )
void __dspr2__(char* Uplo, const int* N, const double* alpha, const double* X, const int* incX, const double* Y, const int* incY, double* A) { EigenFunc_dspr2(Uplo, INTCAST(N), DOUBLECAST(alpha), DOUBLECAST(X), INTCAST(incX), DOUBLECAST(Y), INTCAST(incY), DOUBLECAST(A)); }