You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
833 B
36 lines
833 B
///strict_decompress(input)
|
|
|
|
/*
|
|
Description: Returns a decompressed version of the provided input string
|
|
Arguments: input (string)
|
|
Returns: String
|
|
*/
|
|
|
|
var input, input_size, output, index, ml, inv_dict;
|
|
|
|
input = argument0;
|
|
input_size = string_length(input);
|
|
output = "";
|
|
index = 1;
|
|
ml = _strict_data[? "max_length"];
|
|
inv_dict = _strict_data[? "inv_dictionary"];
|
|
|
|
while(index <= input_size) {
|
|
var char = string_ord_at(input,index);
|
|
if(char == 255) {
|
|
var n = string_ord_at(input,index+1);
|
|
output += string_copy(input,index+2,n);
|
|
index += n + 2;
|
|
}
|
|
else if(char == 254) {
|
|
output += string_char_at(input,index+1);
|
|
index += 2;
|
|
}
|
|
else {
|
|
output += inv_dict[| char];
|
|
index++;
|
|
}
|
|
}
|
|
|
|
return output;
|