aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-18 23:16:41 +0100
committerKim Alvefur <zash@zash.se>2021-03-18 23:16:41 +0100
commitd18097fb6700ede8bdb47388e51e0850d0d828f6 (patch)
tree8f63224754b87b595412c35fd88013bc299ec11f /teal-src
parent576b43151c407e03525623a143024bda8926e640 (diff)
downloadprosody-d18097fb6700ede8bdb47388e51e0850d0d828f6.tar.gz
prosody-d18097fb6700ede8bdb47388e51e0850d0d828f6.zip
teal: Use new integer support in Teal 0.13.0
Diffstat (limited to 'teal-src')
-rw-r--r--teal-src/util/crand.d.tl2
-rw-r--r--teal-src/util/datamapper.tl7
-rw-r--r--teal-src/util/datetime.d.tl10
-rw-r--r--teal-src/util/encodings.d.tl2
-rw-r--r--teal-src/util/error.d.tl4
-rw-r--r--teal-src/util/hashes.d.tl2
-rw-r--r--teal-src/util/id.d.tl2
-rw-r--r--teal-src/util/jsonschema.tl16
-rw-r--r--teal-src/util/poll.d.tl24
-rw-r--r--teal-src/util/pposix.d.tl28
-rw-r--r--teal-src/util/random.d.tl2
-rw-r--r--teal-src/util/stanza.d.tl4
-rw-r--r--teal-src/util/table.d.tl2
-rw-r--r--teal-src/util/uuid.d.tl5
14 files changed, 57 insertions, 53 deletions
diff --git a/teal-src/util/crand.d.tl b/teal-src/util/crand.d.tl
index 80564025..b40cb67e 100644
--- a/teal-src/util/crand.d.tl
+++ b/teal-src/util/crand.d.tl
@@ -1,5 +1,5 @@
local record lib
- bytes : function (n : number) : string
+ bytes : function (n : integer) : string
enum sourceid "OpenSSL" "arc4random()" "Linux" end
_source : sourceid
end
diff --git a/teal-src/util/datamapper.tl b/teal-src/util/datamapper.tl
index 86b54fc2..94387733 100644
--- a/teal-src/util/datamapper.tl
+++ b/teal-src/util/datamapper.tl
@@ -17,6 +17,7 @@
-- TODO arrays
-- TODO pointers
-- TODO cleanup / refactor
+-- TODO s/number/integer/ once we have appropriate math.type() compat
--
local st = require "util.stanza";
@@ -246,7 +247,7 @@ local function unparse ( schema : js.schema_t, t : table, current_name : string,
out.attr[attr] = v
elseif proptype == "number" and v is number then
out.attr[attr] = string.format("%g", v)
- elseif proptype == "integer" and v is number then
+ elseif proptype == "integer" and v is number then -- TODO is integer
out.attr[attr] = string.format("%d", v)
elseif proptype == "boolean" then
out.attr[attr] = v and "1" or "0"
@@ -266,7 +267,7 @@ local function unparse ( schema : js.schema_t, t : table, current_name : string,
propattr[single_attribute] = v
elseif proptype == "number" and v is number then
propattr[single_attribute] = string.format("%g", v)
- elseif proptype == "integer" and v is number then
+ elseif proptype == "integer" and v is number then -- TODO is integer
propattr[single_attribute] = string.format("%d", v)
elseif proptype == "boolean" and v is boolean then
propattr[single_attribute] = v and "1" or "0"
@@ -288,7 +289,7 @@ local function unparse ( schema : js.schema_t, t : table, current_name : string,
out:text_tag(name, v, propattr)
elseif proptype == "number" and v is number then
out:text_tag(name, string.format("%g", v), propattr)
- elseif proptype == "integer" and v is number then
+ elseif proptype == "integer" and v is number then -- TODO is integer
out:text_tag(name, string.format("%d", v), propattr)
elseif proptype == "boolean" and v is boolean then
out:text_tag(name, v and "1" or "0", propattr)
diff --git a/teal-src/util/datetime.d.tl b/teal-src/util/datetime.d.tl
index 530b4eb7..971e8f9c 100644
--- a/teal-src/util/datetime.d.tl
+++ b/teal-src/util/datetime.d.tl
@@ -1,11 +1,11 @@
-- TODO s/number/integer/ once Teal gets support for that
local record lib
- date : function (t : number) : string
- datetime : function (t : number) : string
- time : function (t : number) : string
- legacy : function (t : number) : string
- parse : function (t : string) : number
+ date : function (t : integer) : string
+ datetime : function (t : integer) : string
+ time : function (t : integer) : string
+ legacy : function (t : integer) : string
+ parse : function (t : string) : integer
end
return lib
diff --git a/teal-src/util/encodings.d.tl b/teal-src/util/encodings.d.tl
index f029f9cf..f77039dd 100644
--- a/teal-src/util/encodings.d.tl
+++ b/teal-src/util/encodings.d.tl
@@ -16,7 +16,7 @@ local record lib
end
record utf8
valid : function (s : string) : boolean
- length : function (s : string) : number
+ length : function (s : string) : integer
end
record confusable
skeleteon : function (s : string) : string
diff --git a/teal-src/util/error.d.tl b/teal-src/util/error.d.tl
index 2dc72f0e..05f52405 100644
--- a/teal-src/util/error.d.tl
+++ b/teal-src/util/error.d.tl
@@ -35,14 +35,14 @@ local record protoerror
type : error_type
condition : error_condition
text : string
- code : number
+ code : integer
end
local record error
type : error_type
condition : error_condition
text : string
- code : number
+ code : integer
context : { any : any }
source : string
end
diff --git a/teal-src/util/hashes.d.tl b/teal-src/util/hashes.d.tl
index 70b1d91e..9cd06bc0 100644
--- a/teal-src/util/hashes.d.tl
+++ b/teal-src/util/hashes.d.tl
@@ -1,6 +1,6 @@
local type hash = function (msg : string, hex : boolean) : string
local type hmac = function (key : string, msg : string, hex : boolean) : string
-local type kdf = function (pass : string, salt : string, i : number) : string
+local type kdf = function (pass : string, salt : string, i : integer) : string
local record lib
sha1 : hash
diff --git a/teal-src/util/id.d.tl b/teal-src/util/id.d.tl
index 0f7aeafc..4b6c93b7 100644
--- a/teal-src/util/id.d.tl
+++ b/teal-src/util/id.d.tl
@@ -2,7 +2,7 @@ local record lib
short : function () : string
medium : function () : string
long : function () : string
- custom : function (number) : function () : string
+ custom : function (integer) : function () : string
end
return lib
diff --git a/teal-src/util/jsonschema.tl b/teal-src/util/jsonschema.tl
index 67e37329..3177c501 100644
--- a/teal-src/util/jsonschema.tl
+++ b/teal-src/util/jsonschema.tl
@@ -40,8 +40,8 @@ local record schema_t
exclusiveMinimum : number
-- strings
- maxLength : number
- minLength : number
+ maxLength : integer
+ minLength : integer
pattern : string
format : string
@@ -49,16 +49,16 @@ local record schema_t
prefixItems : { schema_t }
items : schema_t
contains : schema_t
- maxItems : number
- minItems : number
+ maxItems : integer
+ minItems : integer
uniqueItems : boolean
- maxContains : number
- minContains : number
+ maxContains : integer
+ minContains : integer
-- objects
properties : { string : schema_t | type_e }
- maxProperties : number
- minProperties : number
+ maxProperties : integer
+ minProperties : integer
required : { string }
dependentRequired : { string : { string } }
additionalProperties: schema_t
diff --git a/teal-src/util/poll.d.tl b/teal-src/util/poll.d.tl
index 6fce771e..7e346161 100644
--- a/teal-src/util/poll.d.tl
+++ b/teal-src/util/poll.d.tl
@@ -3,22 +3,22 @@ local record state
"timeout"
"signal"
end
- add : function (state, number, boolean, boolean) : boolean
- add : function (state, number, boolean, boolean) : nil, string, number
- set : function (state, number, boolean, boolean) : boolean
- set : function (state, number, boolean, boolean) : nil, string, number
- del : function (state, number) : boolean
- del : function (state, number) : nil, string, number
- wait : function (state, number) : number, boolean, boolean
- wait : function (state, number) : nil, string, number
- wait : function (state, number) : nil, waiterr
- getfd : function (state) : number
+ add : function (state, integer, boolean, boolean) : boolean
+ add : function (state, integer, boolean, boolean) : nil, string, integer
+ set : function (state, integer, boolean, boolean) : boolean
+ set : function (state, integer, boolean, boolean) : nil, string, integer
+ del : function (state, integer) : boolean
+ del : function (state, integer) : nil, string, integer
+ wait : function (state, integer) : integer, boolean, boolean
+ wait : function (state, integer) : nil, string, integer
+ wait : function (state, integer) : nil, waiterr
+ getfd : function (state) : integer
end
local record lib
new : function () : state
- ENOENT : number
- EEXIST : number
+ ENOENT : integer
+ EEXIST : integer
end
return lib
diff --git a/teal-src/util/pposix.d.tl b/teal-src/util/pposix.d.tl
index 12091aa6..7e5ce60e 100644
--- a/teal-src/util/pposix.d.tl
+++ b/teal-src/util/pposix.d.tl
@@ -46,7 +46,7 @@ local record pposix
"unlimited"
end
- type ulimit_limit = number | ulimit_unlimited
+ type ulimit_limit = integer | ulimit_unlimited
record utsname
sysname : string
@@ -58,11 +58,11 @@ local record pposix
end
record memoryinfo
- allocated : number
- allocated_mmap : number
- used : number
- unused : number
- returnable : number
+ allocated : integer
+ allocated_mmap : integer
+ used : integer
+ unused : integer
+ returnable : integer
end
abort : function ()
@@ -74,13 +74,13 @@ local record pposix
syslog_log : function (level : syslog_level, src : string, msg : string)
syslog_setminlevel : function (level : syslog_level)
- getpid : function () : number
- getuid : function () : number
- getgid : function () : number
+ getpid : function () : integer
+ getuid : function () : integer
+ getgid : function () : integer
- setuid : function (uid : string) : boolean, string -- string|number
- setgid : function (uid : string) : boolean, string
- initgroups : function (user : string, gid : number) : boolean, string
+ setuid : function (uid : integer | string) : boolean, string -- string|integer
+ setgid : function (uid : integer | string) : boolean, string
+ initgroups : function (user : string, gid : integer) : boolean, string
umask : function (umask : string) : string
@@ -96,9 +96,9 @@ local record pposix
meminfo : function () : memoryinfo
- atomic_append : function (f : FILE, s : string) : boolean, string, number
+ atomic_append : function (f : FILE, s : string) : boolean, string, integer
- ENOENT : number
+ ENOENT : integer
_NAME : string
_VESRION : string
end
diff --git a/teal-src/util/random.d.tl b/teal-src/util/random.d.tl
index 6f64f2e5..83ff2fcc 100644
--- a/teal-src/util/random.d.tl
+++ b/teal-src/util/random.d.tl
@@ -1,4 +1,4 @@
local record lib
- bytes : function (n:number):string
+ bytes : function (n:integer):string
end
return lib
diff --git a/teal-src/util/stanza.d.tl b/teal-src/util/stanza.d.tl
index 8a077087..b96f9ff3 100644
--- a/teal-src/util/stanza.d.tl
+++ b/teal-src/util/stanza.d.tl
@@ -26,7 +26,7 @@ local record lib
get_child_text : function ( stanza_t, string, string ) : string
child_with_name : function ( stanza_t, string, string ) : stanza_t
child_with_ns : function ( stanza_t, string, string ) : stanza_t
- children : function ( stanza_t ) : children_iter, stanza_t, number
+ children : function ( stanza_t ) : children_iter, stanza_t, integer
childtags : function ( stanza_t, string, string ) : childtags_iter
maptags : function ( stanza_t, maptags_cb ) : stanza_t
find : function ( stanza_t, string ) : stanza_t | string
@@ -36,7 +36,7 @@ local record lib
pretty_top_tag : function ( stanza_t ) : string
get_error : function ( stanza_t ) : string, string, string, stanza_t
- indent : function ( stanza_t, number, string ) : stanza_t
+ indent : function ( stanza_t, integer, string ) : stanza_t
end
record serialized_stanza_t
diff --git a/teal-src/util/table.d.tl b/teal-src/util/table.d.tl
index 6f8c7e4a..0ff5ed95 100644
--- a/teal-src/util/table.d.tl
+++ b/teal-src/util/table.d.tl
@@ -1,5 +1,5 @@
local record lib
- create : function (narr:number, nrec:number):table
+ create : function (narr:integer, nrec:integer):table
pack : function (...:any):{any}
end
return lib
diff --git a/teal-src/util/uuid.d.tl b/teal-src/util/uuid.d.tl
index 17bb0590..45fd4312 100644
--- a/teal-src/util/uuid.d.tl
+++ b/teal-src/util/uuid.d.tl
@@ -1,5 +1,8 @@
local record lib
- generate : function (number) : string
+ get_nibbles : (number) : string
+ generate : function () : string
+
+ seed : function (string)
end
return lib