From 1f35152ae6282cca0b40f433a9c667fdaa3cf201 Mon Sep 17 00:00:00 2001 From: V1K1NGbg Date: Sun, 9 Jun 2024 19:17:38 +0200 Subject: added records --- src/luarocks/core/dir.tl | 8 +++++++- src/luarocks/core/persist.tl | 5 ++++- src/luarocks/core/sysdetect.tl | 16 +++++++++++++++- src/luarocks/core/util.tl | 13 ++++++++++++- src/luarocks/core/vers.tl | 11 ++++++++--- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/luarocks/core/dir.tl b/src/luarocks/core/dir.tl index 55604e64..4786290e 100644 --- a/src/luarocks/core/dir.tl +++ b/src/luarocks/core/dir.tl @@ -1,5 +1,11 @@ +-- local dir = {} --! -local dir = {} --! +local record dir + unquote: function(c: string): string --! dir.unquote + path: function(...: string): string + split_url: function(url: string): string, string + normalize: function(name: string): string +end local require = nil --! -------------------------------------------------------------------------------- diff --git a/src/luarocks/core/persist.tl b/src/luarocks/core/persist.tl index 67b5c8dd..26eb5dff 100644 --- a/src/luarocks/core/persist.tl +++ b/src/luarocks/core/persist.tl @@ -1,5 +1,8 @@ -local persist = {} +local record persist + run_file: function(filename: string, env: {string:any}): boolean, any | nil, string, string + load_into_table: function(filename: string, tbl: {string:any}) : table, table | nil, string, string +end local require = nil --! -------------------------------------------------------------------------------- diff --git a/src/luarocks/core/sysdetect.tl b/src/luarocks/core/sysdetect.tl index ee2a5bf7..e783a012 100644 --- a/src/luarocks/core/sysdetect.tl +++ b/src/luarocks/core/sysdetect.tl @@ -46,12 +46,26 @@ local record sysdetect "cygwin" "macosx" end + + hex: function(s: string): string --? + read_int8: function(fd: FILE): integer + bytes2number: function(s: string, endian: Endian): integer + read: function(fd: FILE, bytes: integer, endian: Endian): integer + read_int32le: function(fd: FILE): integer + read_elf_section_headers: function(fd: FILE, hdr: ElfHeader): {string: ElfSection} + detect_elf_system: function(fd: FILE, hdr: ElfHeader, sections: {string:ElfSection}): System + read_elf_header: function(fd: FILE): ElfHeader, Processor + detect_elf: function(fd: FILE): System, Processor + detect_mach: function(magic: string, fd: FILE): System, Processor + detect_pe: function(fd: FILE): System, Processor + detect_file: function(file: string): System, Processor --? systemdetect.detect_file? + detect: function(input_file: string): System, Processor end local type System = sysdetect.System --? ? local type Processor = sysdetect.Processor --? ? -local enum Endian +local enum Endian --? in the registry and a line for type ? "little" "big" end diff --git a/src/luarocks/core/util.tl b/src/luarocks/core/util.tl index 5fd423a9..c7f02de2 100644 --- a/src/luarocks/core/util.tl +++ b/src/luarocks/core/util.tl @@ -1,5 +1,16 @@ -local util = {} +local record util + popen_read: function(cmd: string, spec: string): string --? util.popen_read + show_table: function(t: {any:any}, tname: string, top_indent: string): string + deep_merge: function(dst: {integer: any}, src: {integer: any}) + deep_merge_under: function(dst: {integer: any}, src: {integer: any}) + cleanup_path: function(list: string, sep: string, lua_version: string, keep_first: boolean): string + split_string: function(str: string, delim: string, maxNb: number): {string} + keys: function(tbl: {any:any}): {any} + printerr: function(...: string | number) + warning: function(msg: string) + sortedpairs: function(tbl: {any: any}, sort_function: function(any, any): boolean | {any:any} | nil): function +end local require = nil --! -------------------------------------------------------------------------------- diff --git a/src/luarocks/core/vers.tl b/src/luarocks/core/vers.tl index fd1e5acb..1940d7fb 100644 --- a/src/luarocks/core/vers.tl +++ b/src/luarocks/core/vers.tl @@ -1,7 +1,12 @@ -local vers = {} +local record vers + -- version_mt: {__eq: function, __lt: function, __le: function, __tostring: function} --! version_mt? + parse_version: function(vstring: string): Version | nil + compare_versions: function(a: string, b: string): boolean + match_constraints: function(version: Version, constraints: Version): boolean +end -local util = require("luarocks.core.util") --! +local util = require("luarocks.core.util") --! ?? local require = nil --! -------------------------------------------------------------------------------- @@ -21,7 +26,7 @@ local record Version --? number: {number} end -local version_mt = { +local version_mt = { --? version_mt? --- Equality comparison for versions. -- All version numbers must be equal. -- If both versions have revision numbers, they must be equal; -- cgit v1.2.3-55-g6feb