pike.git / lib / modules / ADT.pmod / module.pmod

version» Context lines:

pike.git/lib/modules/ADT.pmod/module.pmod:69:    //! string @[s] should be 8 bits wide.    void put_var_string(string s, int(0..) len_width)    {    if ( (len_width <= 3) &&    (sizeof(s) >= ({ -1, 0x100, 0x10000, 0x1000000 })[len_width] ))    error("Field overflow.\n");    put_uint(sizeof(s), len_width);    add_data(s);    }    - #if constant(Gmp.mpz) +     //! Appends a bignum @[i] as a variable string preceded with an    //! unsigned integer of the size @[len_width] declaring the length    //! of the string. @[len_width] defaults to 2.    void put_bignum(Gmp.mpz i, int(0..)|void len_width)    {    if (i<0)    error("Negative argument.\n");    put_var_string(i->digits(256), len_width || 2);    } - #endif +        //! Appends the fix sized string @[s] to the buffer.    void put_fix_string(string s)    {    add_data(s);    }       //! Appends an array of unsigned integers of width @[item_size]    //! to the buffer.    void put_fix_uint_array(array(int) data, int(0..) item_size)
pike.git/lib/modules/ADT.pmod/module.pmod:132:    index += len;    return res;    }       //! Reads a string written by @[put_var_string] from the buffer.    string get_var_string(int len)    {    return get_fix_string(get_uint(len));    }    - #if constant(Gmp.mpz) +     //! Reads a bignum written by @[put_bignum] from the buffer.    Gmp.mpz get_bignum(int|void len)    {    return Gmp.mpz(get_var_string(len || 2), 256);    } - #endif +        //! Get the remaining data from the buffer and clears the buffer.    string get_rest()    {    string s = buffer[index..];    create();    return s;    }       //! Reads an array of integers as written by @[put_fix_uint_array]