mirror of
https://github.com/vlang/v.git
synced 2025-08-03 09:47:15 -04:00
all: remove ancient deprecations (#23479)
This commit is contained in:
parent
40b574b409
commit
6b92f8fada
@ -789,12 +789,6 @@ fn (s string) index_last_(p string) int {
|
||||
return -1
|
||||
}
|
||||
|
||||
// index_last returns the position of the first character of the *last* occurrence of the `needle` string in `s`.
|
||||
@[deprecated: 'use `.last_index(needle string)` instead']
|
||||
pub fn (s string) index_last(needle string) ?int {
|
||||
return s.last_index(needle)
|
||||
}
|
||||
|
||||
// last_index returns the position of the first character of the *last* occurrence of the `needle` string in `s`.
|
||||
@[inline]
|
||||
pub fn (s string) last_index(needle string) ?int {
|
||||
@ -805,15 +799,6 @@ pub fn (s string) last_index(needle string) ?int {
|
||||
return idx
|
||||
}
|
||||
|
||||
// index_u8_last returns the index of the *last* occurrence of the byte `c` (if found) in the string.
|
||||
// It returns -1, if `c` is not found.
|
||||
@[deprecated: 'use `.last_index_u8(c u8)` instead']
|
||||
@[deprecated_after: '2024-06-30']
|
||||
@[inline]
|
||||
pub fn (s string) index_u8_last(c u8) int {
|
||||
return s.last_index_u8(c)
|
||||
}
|
||||
|
||||
// last_index_u8 returns the index of the last occurrence of byte `c` if it was found in the string.
|
||||
@[direct_array_access]
|
||||
pub fn (s string) last_index_u8(c u8) int {
|
||||
|
@ -1249,13 +1249,6 @@ pub fn (s string) index(p string) ?int {
|
||||
return idx
|
||||
}
|
||||
|
||||
// index_last returns the position of the first character of the *last* occurrence of the `needle` string in `s`.
|
||||
@[deprecated: 'use `.last_index(needle string)` instead']
|
||||
@[deprecated_after: '2024-03-27']
|
||||
pub fn (s string) index_last(needle string) ?int {
|
||||
return s.last_index(needle)
|
||||
}
|
||||
|
||||
// last_index returns the position of the first character of the *last* occurrence of the `needle` string in `s`.
|
||||
@[inline]
|
||||
pub fn (s string) last_index(needle string) ?int {
|
||||
@ -1386,15 +1379,6 @@ pub fn (s string) index_u8(c u8) int {
|
||||
return -1
|
||||
}
|
||||
|
||||
// index_u8_last returns the index of the *last* occurrence of the byte `c` (if found) in the string.
|
||||
// It returns -1, if `c` is not found.
|
||||
@[deprecated: 'use `.last_index_u8(c u8)` instead']
|
||||
@[deprecated_after: '2024-06-30']
|
||||
@[inline]
|
||||
pub fn (s string) index_u8_last(c u8) int {
|
||||
return s.last_index_u8(c)
|
||||
}
|
||||
|
||||
// last_index_u8 returns the index of the last occurrence of byte `c` if it was found in the string.
|
||||
@[direct_array_access; inline]
|
||||
pub fn (s string) last_index_u8(c u8) int {
|
||||
|
@ -108,7 +108,7 @@ pub fn (mut d Digest) write(p_ []u8) !int {
|
||||
pub fn (d &Digest) sum(b_in []u8) []u8 {
|
||||
// Make a copy of d so that caller can keep writing and summing.
|
||||
mut d0 := d.clone()
|
||||
hash := d0.checksum_internal()
|
||||
hash := d0.checksum()
|
||||
mut b_out := b_in.clone()
|
||||
for b in hash {
|
||||
b_out << b
|
||||
@ -116,9 +116,8 @@ pub fn (d &Digest) sum(b_in []u8) []u8 {
|
||||
return b_out
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// When the deprecated "checksum()" is finally removed, restore this function name as: "checksum()"
|
||||
fn (mut d Digest) checksum_internal() []u8 {
|
||||
// checksum returns the byte checksum of the `Digest`,
|
||||
fn (mut d Digest) checksum() []u8 {
|
||||
// Append 0x80 to the end of the message and then append zeros
|
||||
// until the length is a multiple of 56 bytes. Finally append
|
||||
// 8 bytes representing the message length in bits.
|
||||
@ -143,19 +142,11 @@ fn (mut d Digest) checksum_internal() []u8 {
|
||||
return digest
|
||||
}
|
||||
|
||||
// checksum returns the byte checksum of the `Digest`,
|
||||
// it is an internal method and is not recommended because its results are not idempotent.
|
||||
@[deprecated: 'checksum() will be changed to a private method, use sum() instead']
|
||||
@[deprecated_after: '2024-04-30']
|
||||
pub fn (mut d Digest) checksum() []u8 {
|
||||
return d.checksum_internal()
|
||||
}
|
||||
|
||||
// sum returns the MD5 checksum of the data.
|
||||
pub fn sum(data []u8) []u8 {
|
||||
mut d := new()
|
||||
d.write(data) or { panic(err) }
|
||||
return d.checksum_internal()
|
||||
return d.checksum()
|
||||
}
|
||||
|
||||
fn block(mut dig Digest, p []u8) {
|
||||
|
@ -7,13 +7,6 @@ const pem_end = '\n-----END '
|
||||
const pem_eol = '-----'
|
||||
const colon = ':'
|
||||
|
||||
// new returns a new `Block` with the specified block_type
|
||||
@[deprecated: 'use Block.new instead']
|
||||
@[inline]
|
||||
pub fn new(block_type string) Block {
|
||||
return Block.new(block_type)
|
||||
}
|
||||
|
||||
@[params]
|
||||
pub struct EncodeConfig {
|
||||
pub mut:
|
||||
|
@ -115,7 +115,7 @@ pub fn (mut d Digest) write(p_ []u8) !int {
|
||||
pub fn (d &Digest) sum(b_in []u8) []u8 {
|
||||
// Make a copy of d so that caller can keep writing and summing.
|
||||
mut d0 := d.clone()
|
||||
hash := d0.checksum_internal()
|
||||
hash := d0.checksum()
|
||||
mut b_out := b_in.clone()
|
||||
for b in hash {
|
||||
b_out << b
|
||||
@ -123,9 +123,8 @@ pub fn (d &Digest) sum(b_in []u8) []u8 {
|
||||
return b_out
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// When the deprecated "checksum()" is finally removed, restore this function name as: "checksum()"
|
||||
fn (mut d Digest) checksum_internal() []u8 {
|
||||
// checksum returns the current byte checksum of the `Digest`,
|
||||
fn (mut d Digest) checksum() []u8 {
|
||||
mut len := d.len
|
||||
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
|
||||
mut tmp := []u8{len: (64)}
|
||||
@ -148,19 +147,11 @@ fn (mut d Digest) checksum_internal() []u8 {
|
||||
return digest
|
||||
}
|
||||
|
||||
// checksum returns the current byte checksum of the `Digest`,
|
||||
// it is an internal method and is not recommended because its results are not idempotent.
|
||||
@[deprecated: 'checksum() will be changed to a private method, use sum() instead']
|
||||
@[deprecated_after: '2024-04-30']
|
||||
pub fn (mut d Digest) checksum() []u8 {
|
||||
return d.checksum_internal()
|
||||
}
|
||||
|
||||
// sum returns the SHA-1 checksum of the bytes passed in `data`.
|
||||
pub fn sum(data []u8) []u8 {
|
||||
mut d := new()
|
||||
d.write(data) or { panic(err) }
|
||||
return d.checksum_internal()
|
||||
return d.checksum()
|
||||
}
|
||||
|
||||
fn block(mut dig Digest, p []u8) {
|
||||
|
@ -149,7 +149,7 @@ pub fn (mut d Digest) write(p_ []u8) !int {
|
||||
pub fn (d &Digest) sum(b_in []u8) []u8 {
|
||||
// Make a copy of d so that caller can keep writing and summing.
|
||||
mut d0 := d.clone()
|
||||
hash := d0.checksum_internal()
|
||||
hash := d0.checksum()
|
||||
mut b_out := b_in.clone()
|
||||
if d0.is224 {
|
||||
for b in hash[..size224] {
|
||||
@ -163,9 +163,9 @@ pub fn (d &Digest) sum(b_in []u8) []u8 {
|
||||
return b_out
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// When the deprecated "checksum()" is finally removed, restore this function name as: "checksum()"
|
||||
fn (mut d Digest) checksum_internal() []u8 {
|
||||
// checksum returns the current byte checksum of the Digest,
|
||||
// it is an internal method and is not recommended because its results are not idempotent.
|
||||
fn (mut d Digest) checksum() []u8 {
|
||||
mut len := d.len
|
||||
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
|
||||
mut tmp := []u8{len: (64)}
|
||||
@ -196,20 +196,6 @@ fn (mut d Digest) checksum_internal() []u8 {
|
||||
return digest
|
||||
}
|
||||
|
||||
// checksum returns the current byte checksum of the Digest,
|
||||
// it is an internal method and is not recommended because its results are not idempotent.
|
||||
@[deprecated: 'checksum() will be changed to a private method, use sum() instead']
|
||||
@[deprecated_after: '2024-04-30']
|
||||
pub fn (mut d Digest) checksum() []u8 {
|
||||
out := d.checksum_internal()
|
||||
// if this digest has `size224` length, return the correct `size224` checksum
|
||||
if d.is224 {
|
||||
return out[0..size224]
|
||||
}
|
||||
// otherwise, returns a normal size
|
||||
return out
|
||||
}
|
||||
|
||||
// sum returns the SHA256 checksum of the bytes in `data`.
|
||||
// Example: assert sha256.sum('V'.bytes()).len > 0 == true
|
||||
pub fn sum(data []u8) []u8 {
|
||||
@ -220,14 +206,14 @@ pub fn sum(data []u8) []u8 {
|
||||
pub fn sum256(data []u8) []u8 {
|
||||
mut d := new()
|
||||
d.write(data) or { panic(err) }
|
||||
return d.checksum_internal()
|
||||
return d.checksum()
|
||||
}
|
||||
|
||||
// sum224 returns the SHA224 checksum of the data.
|
||||
pub fn sum224(data []u8) []u8 {
|
||||
mut d := new224()
|
||||
d.write(data) or { panic(err) }
|
||||
sum := d.checksum_internal()
|
||||
sum := d.checksum()
|
||||
mut sum224 := []u8{len: size224}
|
||||
copy(mut sum224, sum[..size224])
|
||||
return sum224
|
||||
|
@ -208,7 +208,7 @@ pub fn (mut d Digest) write(p_ []u8) !int {
|
||||
pub fn (d &Digest) sum(b_in []u8) []u8 {
|
||||
// Make a copy of d so that caller can keep writing and summing.
|
||||
mut d0 := d.clone()
|
||||
hash := d0.checksum_internal()
|
||||
hash := d0.checksum()
|
||||
mut b_out := b_in.clone()
|
||||
match d0.function {
|
||||
.sha384 {
|
||||
@ -235,9 +235,9 @@ pub fn (d &Digest) sum(b_in []u8) []u8 {
|
||||
return b_out
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// When the deprecated "checksum()" is finally removed, restore this function name as: "checksum()"
|
||||
fn (mut d Digest) checksum_internal() []u8 {
|
||||
// checksum returns the current byte checksum of the Digest,
|
||||
// it is an internal method and is not recommended because its results are not idempotent.
|
||||
fn (mut d Digest) checksum() []u8 {
|
||||
// Padding. Add a 1 bit and 0 bits until 112 bytes mod 128.
|
||||
mut len := d.len
|
||||
mut tmp := []u8{len: (128)}
|
||||
@ -269,40 +269,18 @@ fn (mut d Digest) checksum_internal() []u8 {
|
||||
return digest
|
||||
}
|
||||
|
||||
// checksum returns the current byte checksum of the Digest,
|
||||
// it is an internal method and is not recommended because its results are not idempotent.
|
||||
@[deprecated: 'checksum() will be changed to a private method, use sum() instead']
|
||||
@[deprecated_after: '2024-04-30']
|
||||
pub fn (mut d Digest) checksum() []u8 {
|
||||
out := d.checksum_internal()
|
||||
match d.function {
|
||||
.sha384 {
|
||||
return out[0..size384]
|
||||
}
|
||||
.sha512_224 {
|
||||
return out[0..size224]
|
||||
}
|
||||
.sha512_256 {
|
||||
return out[0..size256]
|
||||
}
|
||||
else {
|
||||
return out
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sum512 returns the SHA512 checksum of the data.
|
||||
pub fn sum512(data []u8) []u8 {
|
||||
mut d := new_digest(.sha512)
|
||||
d.write(data) or { panic(err) }
|
||||
return d.checksum_internal()
|
||||
return d.checksum()
|
||||
}
|
||||
|
||||
// sum384 returns the SHA384 checksum of the data.
|
||||
pub fn sum384(data []u8) []u8 {
|
||||
mut d := new_digest(.sha384)
|
||||
d.write(data) or { panic(err) }
|
||||
sum := d.checksum_internal()
|
||||
sum := d.checksum()
|
||||
mut sum384 := []u8{len: size384}
|
||||
copy(mut sum384, sum[..size384])
|
||||
return sum384
|
||||
@ -312,7 +290,7 @@ pub fn sum384(data []u8) []u8 {
|
||||
pub fn sum512_224(data []u8) []u8 {
|
||||
mut d := new_digest(.sha512_224)
|
||||
d.write(data) or { panic(err) }
|
||||
sum := d.checksum_internal()
|
||||
sum := d.checksum()
|
||||
mut sum224 := []u8{len: size224}
|
||||
copy(mut sum224, sum[..size224])
|
||||
return sum224
|
||||
@ -322,7 +300,7 @@ pub fn sum512_224(data []u8) []u8 {
|
||||
pub fn sum512_256(data []u8) []u8 {
|
||||
mut d := new_digest(.sha512_256)
|
||||
d.write(data) or { panic(err) }
|
||||
sum := d.checksum_internal()
|
||||
sum := d.checksum()
|
||||
mut sum256 := []u8{len: size256}
|
||||
copy(mut sum256, sum[..size256])
|
||||
return sum256
|
||||
|
@ -97,11 +97,6 @@ pub fn div_mod(a &Number, b &Number) (Number, Number) {
|
||||
return c, d
|
||||
}
|
||||
|
||||
@[deprecated: 'use div_mod(a, b) instead']
|
||||
pub fn divmod(a &Number, b &Number) (Number, Number) {
|
||||
return div_mod(a, b)
|
||||
}
|
||||
|
||||
pub fn cmp(a &Number, b &Number) int {
|
||||
res := 0
|
||||
|
||||
@ -142,21 +137,6 @@ pub fn (a &Number) isqrt() Number {
|
||||
return b
|
||||
}
|
||||
|
||||
@[deprecated: 'use bitwise_and(a, b) instead']
|
||||
pub fn b_and(a &Number, b &Number) Number {
|
||||
return bitwise_and(a, b)
|
||||
}
|
||||
|
||||
@[deprecated: 'use bitwise_or(a, b) instead']
|
||||
pub fn b_or(a &Number, b &Number) Number {
|
||||
return bitwise_or(a, b)
|
||||
}
|
||||
|
||||
@[deprecated: 'use bitwise_xor(a, b) instead']
|
||||
pub fn b_xor(a &Number, b &Number) Number {
|
||||
return bitwise_xor(a, b)
|
||||
}
|
||||
|
||||
pub fn bitwise_and(a &Number, b &Number) Number {
|
||||
c := Number{}
|
||||
#c.value = a.val.value & b.val.value
|
||||
@ -178,16 +158,6 @@ pub fn bitwise_xor(a &Number, b &Number) Number {
|
||||
return c
|
||||
}
|
||||
|
||||
@[deprecated: 'use a.left_shift(amount) instead']
|
||||
pub fn (a &Number) lshift(amount int) Number {
|
||||
return a.left_shift(amount)
|
||||
}
|
||||
|
||||
@[deprecated: 'use a.right_shift(amount) instead']
|
||||
pub fn (a &Number) rshift(amount int) Number {
|
||||
return a.right_shift(amount)
|
||||
}
|
||||
|
||||
pub fn (a &Number) left_shift(amount int) Number {
|
||||
c := Number{}
|
||||
#c.value = a.val.value << BigInt(+amount)
|
||||
@ -223,11 +193,6 @@ pub fn factorial(nn &Number) Number {
|
||||
return a
|
||||
}
|
||||
|
||||
@[deprecated: 'use factorial_int instead']
|
||||
pub fn fact(n int) Number {
|
||||
return factorial_int(n)
|
||||
}
|
||||
|
||||
pub fn factorial_int(n int) Number {
|
||||
return factorial(from_int(n))
|
||||
}
|
||||
|
@ -754,12 +754,6 @@ pub fn (a Integer) bitwise_xor(b Integer) Integer {
|
||||
}
|
||||
}
|
||||
|
||||
// lshift returns the integer `a` shifted left by `amount` bits.
|
||||
@[deprecated: 'use a.Integer.left_shift(amount) instead']
|
||||
pub fn (a Integer) lshift(amount u32) Integer {
|
||||
return a.left_shift(amount)
|
||||
}
|
||||
|
||||
// left_shift returns the integer `a` shifted left by `amount` bits.
|
||||
@[direct_array_access]
|
||||
pub fn (a Integer) left_shift(amount u32) Integer {
|
||||
@ -784,12 +778,6 @@ pub fn (a Integer) left_shift(amount u32) Integer {
|
||||
}
|
||||
}
|
||||
|
||||
// rshift returns the integer `a` shifted right by `amount` bits.
|
||||
@[deprecated: 'use a.Integer.right_shift(amount) instead']
|
||||
pub fn (a Integer) rshift(amount u32) Integer {
|
||||
return a.right_shift(amount)
|
||||
}
|
||||
|
||||
// right_shift returns the integer `a` shifted right by `amount` bits.
|
||||
@[direct_array_access]
|
||||
pub fn (a Integer) right_shift(amount u32) Integer {
|
||||
@ -817,12 +805,6 @@ pub fn (a Integer) right_shift(amount u32) Integer {
|
||||
}
|
||||
}
|
||||
|
||||
// binary_str returns the binary string representation of the integer `a`.
|
||||
@[deprecated: 'use integer.bin_str() instead']
|
||||
pub fn (integer Integer) binary_str() string {
|
||||
return integer.bin_str()
|
||||
}
|
||||
|
||||
// bin_str returns the binary string representation of the integer `a`.
|
||||
@[direct_array_access]
|
||||
pub fn (integer Integer) bin_str() string {
|
||||
|
@ -1,6 +1,5 @@
|
||||
module big
|
||||
|
||||
import math.bits
|
||||
import strings
|
||||
|
||||
@[direct_array_access; inline]
|
||||
@ -62,13 +61,6 @@ fn newton_divide_array_by_array(operand_a []u32, operand_b []u32, mut quotient [
|
||||
shrink_tail_zeros(mut remainder)
|
||||
}
|
||||
|
||||
// bit_length returns the number of bits needed to represent the absolute value of the integer a.
|
||||
@[deprecated: 'use a.bit_len() instead']
|
||||
@[inline]
|
||||
pub fn bit_length(a Integer) int {
|
||||
return a.digits.len * 32 - bits.leading_zeros_32(a.digits.last())
|
||||
}
|
||||
|
||||
@[direct_array_access; inline]
|
||||
fn debug_u32_str(a []u32) string {
|
||||
mut sb := strings.new_builder(30)
|
||||
|
@ -234,41 +234,11 @@ fn cmp(f1 Fraction, f2 Fraction) int {
|
||||
// | Public comparison functions |
|
||||
// +-----------------------------+
|
||||
|
||||
// equals returns true if both the Fractions are equal
|
||||
@[deprecated: 'use f1 == f2 instead']
|
||||
pub fn (f1 Fraction) equals(f2 Fraction) bool {
|
||||
return cmp(f1, f2) == 0
|
||||
}
|
||||
|
||||
// return true if f1 == f2
|
||||
pub fn (f1 Fraction) == (f2 Fraction) bool {
|
||||
return cmp(f1, f2) == 0
|
||||
}
|
||||
|
||||
// ge returns true if f1 >= f2
|
||||
@[deprecated: 'use f1 >= f2 instead']
|
||||
pub fn (f1 Fraction) ge(f2 Fraction) bool {
|
||||
return cmp(f1, f2) >= 0
|
||||
}
|
||||
|
||||
// gt returns true if f1 > f2
|
||||
@[deprecated: 'use f1 > f2 instead']
|
||||
pub fn (f1 Fraction) gt(f2 Fraction) bool {
|
||||
return cmp(f1, f2) > 0
|
||||
}
|
||||
|
||||
// le returns true if f1 <= f2
|
||||
@[deprecated: 'use f1 <= f2 instead']
|
||||
pub fn (f1 Fraction) le(f2 Fraction) bool {
|
||||
return cmp(f1, f2) <= 0
|
||||
}
|
||||
|
||||
// lt returns true if f1 < f2
|
||||
@[deprecated: 'use f1 < f2 instead']
|
||||
pub fn (f1 Fraction) lt(f2 Fraction) bool {
|
||||
return cmp(f1, f2) < 0
|
||||
}
|
||||
|
||||
// return true if f1 < f2
|
||||
pub fn (f1 Fraction) < (f2 Fraction) bool {
|
||||
return cmp(f1, f2) < 0
|
||||
|
@ -174,12 +174,6 @@ pub fn (dom &DocumentObjectModel) get_root() &Tag {
|
||||
return dom.root
|
||||
}
|
||||
|
||||
// get_tag retrieves all tags in the document that have the given tag name.
|
||||
@[deprecated: 'use get_tags instead']
|
||||
pub fn (dom &DocumentObjectModel) get_tag(name string) []&Tag {
|
||||
return dom.get_tags(name: name)
|
||||
}
|
||||
|
||||
// get_tags returns all tags stored in the document.
|
||||
pub fn (dom &DocumentObjectModel) get_tags(options GetTagsOptions) []&Tag {
|
||||
if options.name != '' {
|
||||
@ -197,12 +191,6 @@ pub fn (dom &DocumentObjectModel) get_tags_by_class_name(names ...string) []&Tag
|
||||
return dom.root.get_tags_by_class_name(...names)
|
||||
}
|
||||
|
||||
// get_tag_by_attribute retrieves all tags in the document that have the given attribute name.
|
||||
@[deprecated: 'use get_tags_by_attribute instead']
|
||||
pub fn (dom &DocumentObjectModel) get_tag_by_attribute(name string) []&Tag {
|
||||
return dom.get_tags_by_attribute(name)
|
||||
}
|
||||
|
||||
// get_tags_by_attribute retrieves all tags in the document that have the given attribute name.
|
||||
pub fn (dom &DocumentObjectModel) get_tags_by_attribute(name string) []&Tag {
|
||||
return if name in dom.all_attributes { unsafe { dom.all_attributes[name] } } else { []&Tag{} }
|
||||
@ -217,9 +205,3 @@ pub fn (mut dom DocumentObjectModel) get_tags_by_attribute_value(name string, va
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
// get_tag_by_attribute_value retrieves all tags in the document that have the given attribute name and value.
|
||||
@[deprecated: 'use get_tags_by_attribute_value instead']
|
||||
pub fn (mut dom DocumentObjectModel) get_tag_by_attribute_value(name string, value string) []&Tag {
|
||||
return dom.get_tags_by_attribute_value(name, value)
|
||||
}
|
||||
|
@ -21,12 +21,13 @@ pub type RequestFinishFn = fn (request &Request, final_size u64) !
|
||||
// Request holds information about an HTTP request (either received by
|
||||
// a server or to be sent by a client)
|
||||
pub struct Request {
|
||||
mut:
|
||||
cookies map[string]string
|
||||
pub mut:
|
||||
version Version = .v1_1
|
||||
method Method = .get
|
||||
header Header
|
||||
host string
|
||||
cookies map[string]string @[deprecated: 'use req.cookie(name) and req.add_cookie(name) instead']
|
||||
data string
|
||||
url string
|
||||
user_agent string = 'v.http'
|
||||
|
@ -438,13 +438,6 @@ pub fn (f &File) read_bytes_at(size int, pos u64) []u8 {
|
||||
return arr[0..nreadbytes]
|
||||
}
|
||||
|
||||
// read_bytes_into_newline reads from the current position of the file into the provided buffer.
|
||||
@[deprecated: 'use read_bytes_with_newline instead']
|
||||
@[deprecated_after: '2024-05-04']
|
||||
pub fn (f &File) read_bytes_into_newline(mut buf []u8) !int {
|
||||
return f.read_bytes_with_newline(mut buf)
|
||||
}
|
||||
|
||||
// read_bytes_with_newline reads from the current position of the file into the provided buffer.
|
||||
// Each consecutive call on the same file, continues reading, from where it previously ended.
|
||||
// A read call is either stopped, if the buffer is full, a newline was read or EOF.
|
||||
|
@ -272,16 +272,6 @@ pub fn loginname() !string {
|
||||
return error(posix_get_error_msg(C.errno))
|
||||
}
|
||||
|
||||
@[deprecated: 'os.args now uses arguments()']
|
||||
@[deprecated_after: '2024-07-30']
|
||||
fn init_os_args(argc int, argv &&u8) []string {
|
||||
mut args_ := []string{len: argc}
|
||||
for i in 0 .. argc {
|
||||
args_[i] = unsafe { tos_clone(argv[i]) }
|
||||
}
|
||||
return args_
|
||||
}
|
||||
|
||||
// ls returns ![]string of the files and dirs in the given `path` ( os.ls uses C.readdir ). Symbolic links are returned to be files. For recursive list see os.walk functions.
|
||||
// See also: `os.walk`, `os.walk_ext`, `os.is_dir`, `os.is_file`
|
||||
// Example: https://github.com/vlang/v/blob/master/examples/readdir.v
|
||||
|
@ -103,16 +103,6 @@ pub struct C._utimbuf {
|
||||
|
||||
fn C._utime(&char, voidptr) int
|
||||
|
||||
@[deprecated: 'os.args now uses arguments()']
|
||||
@[deprecated_after: '2024-07-30']
|
||||
fn init_os_args_wide(argc int, argv &&u8) []string {
|
||||
mut args_ := []string{len: argc}
|
||||
for i in 0 .. argc {
|
||||
args_[i] = unsafe { string_from_wide(&u16(argv[i])) }
|
||||
}
|
||||
return args_
|
||||
}
|
||||
|
||||
fn native_glob_pattern(pattern string, mut matches []string) ! {
|
||||
$if debug {
|
||||
// FindFirstFile() and FindNextFile() both have a globbing function.
|
||||
|
@ -68,9 +68,6 @@ pub struct Picoev {
|
||||
max_headers int = 100
|
||||
max_read int = 4096
|
||||
max_write int = 8192
|
||||
|
||||
err_cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response, IError) = default_error_callback @[deprecated: 'use `error_callback` instead']
|
||||
raw_cb fn (mut Picoev, int, int) = unsafe { nil } @[deprecated: 'use `raw_callback` instead']
|
||||
mut:
|
||||
loop &LoopType = unsafe { nil }
|
||||
file_descriptors [max_fds]&Target
|
||||
@ -116,13 +113,6 @@ pub fn (mut pv Picoev) add(fd int, events int, timeout int, callback voidptr) in
|
||||
return 0
|
||||
}
|
||||
|
||||
// del remove a file descriptor from the event loop
|
||||
@[deprecated: 'use delete() instead']
|
||||
@[direct_array_access]
|
||||
pub fn (mut pv Picoev) del(fd int) int {
|
||||
return pv.delete(fd)
|
||||
}
|
||||
|
||||
// remove a file descriptor from the event loop
|
||||
@[direct_array_access]
|
||||
pub fn (mut pv Picoev) delete(fd int) int {
|
||||
|
@ -16,8 +16,8 @@ fn main() {
|
||||
println('Invalid version')
|
||||
return
|
||||
}
|
||||
println(ver1.gt(ver2))
|
||||
println(ver2.gt(ver1))
|
||||
println(ver1 > ver2)
|
||||
println(ver2 > ver1)
|
||||
println(ver1.satisfies('>=1.1.0 <2.0.0'))
|
||||
println(ver2.satisfies('>=1.1.0 <2.0.0'))
|
||||
println(ver2.satisfies('>=1.1.0 <2.0.0 || >2.2.0'))
|
||||
|
@ -69,46 +69,16 @@ pub fn (ver Version) satisfies(input string) bool {
|
||||
return version_satisfies(ver, input)
|
||||
}
|
||||
|
||||
// eq returns `true` if `v1` is equal to `v2`.
|
||||
@[deprecated: 'use v1 == v2 instead']
|
||||
pub fn (v1 Version) eq(v2 Version) bool {
|
||||
return compare_eq(v1, v2)
|
||||
}
|
||||
|
||||
// == checks if `v1` is equal to `v2`
|
||||
pub fn (v1 Version) == (v2 Version) bool {
|
||||
return compare_eq(v1, v2)
|
||||
}
|
||||
|
||||
// gt returns `true` if `v1` is greater than `v2`.
|
||||
@[deprecated: 'use v1 > v2 instead']
|
||||
pub fn (v1 Version) gt(v2 Version) bool {
|
||||
return compare_gt(v1, v2)
|
||||
}
|
||||
|
||||
// < checks if `v1` is less than `v2`.
|
||||
pub fn (v1 Version) < (v2 Version) bool {
|
||||
return compare_lt(v1, v2)
|
||||
}
|
||||
|
||||
// lt returns `true` if `v1` is less than `v2`.
|
||||
@[deprecated: 'use v1 < v2 instead']
|
||||
pub fn (v1 Version) lt(v2 Version) bool {
|
||||
return compare_lt(v1, v2)
|
||||
}
|
||||
|
||||
// ge returns `true` if `v1` is greater than or equal to `v2`.
|
||||
@[deprecated: 'use v1 >= v2 instead']
|
||||
pub fn (v1 Version) ge(v2 Version) bool {
|
||||
return compare_ge(v1, v2)
|
||||
}
|
||||
|
||||
// le returns `true` if `v1` is less than or equal to `v2`
|
||||
@[deprecated: 'use v1 <= v2 instead']
|
||||
pub fn (v1 Version) le(v2 Version) bool {
|
||||
return compare_le(v1, v2)
|
||||
}
|
||||
|
||||
// str returns the `string` representation of the `Version`.
|
||||
pub fn (ver Version) str() string {
|
||||
common_string := '${ver.major}.${ver.minor}.${ver.patch}'
|
||||
|
@ -124,10 +124,6 @@ pub fn query_buffer_overflow(buf Buffer) bool {
|
||||
|
||||
// rendering functions
|
||||
|
||||
@[deprecated: 'use begin_pass instead, please see examples/sokol/* for how to utilize new unified begin_pass']
|
||||
@[inline]
|
||||
pub fn begin_default_pass(actions &PassAction, width int, height int) {}
|
||||
|
||||
// begin_pass begins a rendering pass.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
|
@ -1,11 +1,5 @@
|
||||
module gfx
|
||||
|
||||
@[deprecated: 'use create_clear_pass_action instead']
|
||||
@[deprecated_after: '2024-09-03']
|
||||
pub fn create_clear_pass(r f32, g f32, b f32, a f32) PassAction {
|
||||
return create_clear_pass_action(r, g, b, a)
|
||||
}
|
||||
|
||||
// create_clear_pass_action returns a *clearing* `PassAction` that clears the `Pass`
|
||||
// with the color defined by the color components `r`ed,`g`reen, `b`lue and `a`lpha.
|
||||
pub fn create_clear_pass_action(r f32, g f32, b f32, a f32) PassAction {
|
||||
|
@ -154,14 +154,6 @@ pub fn (mut b Builder) write_string2(s1 string, s2 string) {
|
||||
}
|
||||
}
|
||||
|
||||
// writeln_string appends the string `s`+`\n` to the buffer
|
||||
@[deprecated: 'use writeln() instead']
|
||||
@[deprecated_after: '2024-03-21']
|
||||
@[inline]
|
||||
pub fn (mut b Builder) writeln_string(s string) {
|
||||
b.writeln(s)
|
||||
}
|
||||
|
||||
// go_back discards the last `n` bytes from the buffer
|
||||
pub fn (mut b Builder) go_back(n int) {
|
||||
b.trim(b.len - n)
|
||||
|
@ -56,13 +56,6 @@ pub fn utc() Time {
|
||||
return linux_utc()
|
||||
}
|
||||
|
||||
// new_time returns a time struct with the calculated Unix time.
|
||||
@[deprecated: 'use `new()` instead']
|
||||
@[deprecated_after: '2024-05-31']
|
||||
pub fn new_time(t Time) Time {
|
||||
return time_with_unix(t)
|
||||
}
|
||||
|
||||
fn time_with_unix(t Time) Time {
|
||||
if t.unix != 0 {
|
||||
return t
|
||||
|
@ -44,13 +44,6 @@ pub fn sleep(dur Duration) {
|
||||
#while (new Date().getTime() < now + Number(toWait)) {}
|
||||
}
|
||||
|
||||
// new_time returns a time struct with the calculated Unix time.
|
||||
@[deprecated: 'use `new()` instead']
|
||||
@[deprecated_after: '2024-05-31']
|
||||
pub fn new_time(t Time) Time {
|
||||
return time_with_unix(t)
|
||||
}
|
||||
|
||||
fn time_with_unix(t Time) Time {
|
||||
if t.unix != 0 {
|
||||
return t
|
||||
|
@ -127,34 +127,6 @@ pub fn (t Time) unix_nano() i64 {
|
||||
return t.unix() * 1_000_000_000 + i64(t.nanosecond)
|
||||
}
|
||||
|
||||
// unix_time returns the UNIX time with second resolution.
|
||||
@[deprecated: 'use `t.unix()` instead']
|
||||
@[deprecated_after: '2024-05-31']
|
||||
pub fn (t Time) unix_time() i64 {
|
||||
return t.unix()
|
||||
}
|
||||
|
||||
// unix_time_milli returns the UNIX time with millisecond resolution.
|
||||
@[deprecated: 'use `t.unix_milli()` instead']
|
||||
@[deprecated_after: '2024-05-31']
|
||||
pub fn (t Time) unix_time_milli() i64 {
|
||||
return t.unix_milli()
|
||||
}
|
||||
|
||||
// unix_time_micro returns the UNIX time with microsecond resolution.
|
||||
@[deprecated: 'use `t.unix_micro()` instead']
|
||||
@[deprecated_after: '2024-05-31']
|
||||
pub fn (t Time) unix_time_micro() i64 {
|
||||
return t.unix_micro()
|
||||
}
|
||||
|
||||
// unix_time_nano returns the UNIX time with nanosecond resolution.
|
||||
@[deprecated: 'use `t.unix_nano()` instead']
|
||||
@[deprecated_after: '2024-05-31']
|
||||
pub fn (t Time) unix_time_nano() i64 {
|
||||
return t.unix_nano()
|
||||
}
|
||||
|
||||
// add returns a new time with the given duration added.
|
||||
pub fn (t Time) add(duration_in_nanosecond Duration) Time {
|
||||
// This expression overflows i64 for big years (and we do not have i128 yet):
|
||||
|
@ -174,12 +174,6 @@ fn win_utc() Time {
|
||||
return t
|
||||
}
|
||||
|
||||
// unix_time returns Unix time.
|
||||
@[deprecated: 'use `st.unix()` instead']
|
||||
fn (st SystemTime) unix_time() i64 {
|
||||
return st.unix()
|
||||
}
|
||||
|
||||
// unix returns Unix time.
|
||||
fn (st SystemTime) unix() i64 {
|
||||
tt := C.tm{
|
||||
|
@ -1,24 +0,0 @@
|
||||
module util
|
||||
|
||||
import v.util.diff
|
||||
|
||||
// find_working_diff_command returns the first available command from a list of known diff cli tools.
|
||||
@[deprecated_after: '2024-06-30']
|
||||
@[deprecated]
|
||||
pub fn find_working_diff_command() !string {
|
||||
return diff.find_working_diff_command()
|
||||
}
|
||||
|
||||
// color_compare_files returns a colored diff between two files.
|
||||
@[deprecated: 'use `diff.compare_files` instead']
|
||||
@[deprecated_after: '2024-06-30']
|
||||
pub fn color_compare_files(diff_cmd string, path1 string, path2 string) string {
|
||||
return diff.color_compare_files(diff_cmd, path1, path2)
|
||||
}
|
||||
|
||||
// color_compare_strings returns a colored diff between two strings.
|
||||
@[deprecated: 'use `diff.compare_text` instead']
|
||||
@[deprecated_after: '2024-06-30']
|
||||
pub fn color_compare_strings(diff_cmd string, unique_prefix string, expected string, found string) string {
|
||||
return diff.color_compare_strings(diff_cmd, unique_prefix, expected, found)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user