tuple_t tupleTail(tuple_t src, col_t start_pos) { tuple_t t = tupleAlloc(); for(int i = start_pos; i < src.count; i++) { t = tupleCatCol(t, src, i); } return t; }
tuple_t tupleUnion_typ(union_typ * v) { assert(v->count == 1); tuple_t t = tupleAlloc(); typ_tuple * tt = v->ents[0]; for(int i = 0; i < tt->count; i++) { assert(tt->ents[i]->typ == typ_typ); t = tupleCatInt64(t, tt->ents[i]->u.type); } return t; }
tuple_t tupleVal_tuple(val_tuple * v) { tuple_t t = tupleAlloc(); for(int i = 0; i < v->count; i++) { if(v->ents[i]->typ == string_typ) { t = tupleCatString(t, v->ents[i]->u.str); } else if(v->ents[i]->typ == int64_typ) { t = tupleCatInt64(t, v->ents[i]->u.integ); } else if(v->ents[i]->typ == ident_typ) { abort(); } else { abort(); } } return t; }
LZ77Tuple_ST* getTuple ( char* sliding, char* buffer, int* current_position_p ) { int i, j, match_pos = -1, match_size = 0; int match_pos_aux = -1, match_size_aux = 0; int sliding_size = strlen(sliding), buffer_size = strlen(buffer); for (i = 0, j = 0; i < sliding_size && j < buffer_size; i ++) if (sliding[i] == buffer[j]) { match_pos_aux = i; match_size_aux = 1; while (sliding[i ++] == buffer[j ++] && j < buffer_size) match_size_aux ++; if (match_size_aux > match_pos) { match_pos = match_pos_aux; match_size = match_size_aux; } } * current_position_p += match_size; return tupleAlloc(sliding_size - match_pos, match_size, buffer[match_pos]); }