From ccc2feb67f5ee2432854edaa2d1cd22dcd04e26c Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Mon, 8 Sep 2025 14:00:29 -0500 Subject: [PATCH] Add references to runtime --- .onedev-buildspec.yml | 2 + .../src/runtime_methods/class.tcross | 84 +++++++++++++++++++ .../src/runtime_methods/console.tcross | 80 +++++++++++++++++- .../src/runtime_methods/crypto.tcross | 30 +++++++ .../src/runtime_methods/dictionary.tcross | 15 ++++ .../src/runtime_methods/env.tcross | 79 ++++++++++++++++- .../src/runtime_methods/fs.tcross | 52 +++++++++++- .../src/runtime_methods/net.tcross | 12 +++ 8 files changed, 351 insertions(+), 3 deletions(-) create mode 100644 Tesses.CrossLang.Reference/src/runtime_methods/class.tcross create mode 100644 Tesses.CrossLang.Reference/src/runtime_methods/crypto.tcross create mode 100644 Tesses.CrossLang.Reference/src/runtime_methods/dictionary.tcross create mode 100644 Tesses.CrossLang.Reference/src/runtime_methods/net.tcross diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml index 963746d..6839d10 100644 --- a/.onedev-buildspec.yml +++ b/.onedev-buildspec.yml @@ -66,6 +66,8 @@ jobs: crosslang upload-package --token="$CPKG_KEY" --host="https://cpkg.tesseslanguage.com/" cd ../Tesses.CrossLang.Std crosslang upload-package --token="$CPKG_KEY" --host="https://cpkg.tesseslanguage.com/" + cd ../Tesses.CrossLang.Reference + crosslang upload-package --token="$CPKG_KEY" --host="https://cpkg.tesseslanguage.com/" cd ../Templates/compiletool crosslang upload-package --token="$CPKG_KEY" --host="https://cpkg.tesseslanguage.com/" cd ../console diff --git a/Tesses.CrossLang.Reference/src/runtime_methods/class.tcross b/Tesses.CrossLang.Reference/src/runtime_methods/class.tcross new file mode 100644 index 0000000..0492f5f --- /dev/null +++ b/Tesses.CrossLang.Reference/src/runtime_methods/class.tcross @@ -0,0 +1,84 @@ +/^ Get the class info returns ClassInfo^/ +func Class.GetInfo(classInstanceOrClassName) +{ + +} +/^ Get the names of all the loaded classes on root environment ^/ +func Class.GetClassNames() +{ + +} +/^ Create instance of class (supports both name and list of name parts split on '.') ^/ +func Class.CreateInstance(name, args) +{ + +} +/^ Get the name of the class instance ^/ +func Class.Name(instance) +{ + +} +/^ Get the instance specific info, including current values, returns ClassInstanceInfo ^/ +func Class.GetInstanceInfo(instance) +{ + +} + +/^ Schema for what Class.GetInfo returns ^/ +class ClassInfo : Dictionary { + /^ The class name ^/ + public Name; + /^ The class name parts (List of strings split on '.') ^/ + public NameParts; + /^ The base class name ^/ + public Inherits; + + /^ The base class name parts (List of strings split on '.') ^/ + public InheritsParts; + /^ Documentation of class ^/ + public Documentation; + /^ List of methods and fields in class with (schema is ClassInfoEntry)^/ + public Entries; +} +/^ The schema of the items in the list Entries in the dictionary that Class.GetInfo returns ^/ +class ClassInfoEntry : Dictionary { + /^ Field or method name ^/ + public Name; + /^ Is the method abstract (or is the field unset) ^/ + public IsAbstract; + /^ Is the entry a method (true) or field (false) ^/ + public IsFunction; + /^ Documentation for entry ^/ + public Documentation; + /^ Chunk id for entry if any ^/ + public ChunkId; + /^ Arguments of entry if any (always a list)^/ + public Arguments; + /^ Modifier (can be public, protected, private or static ) ^/ + public Modifier; +} + +/^ Schema for what Class.GetInstanceInfo returns ^/ +class ClassInstanceInfo : Dictionary { + /^ The class name ^/ + public Name; + /^ The file that the class is from ^/ + public File; + /^ List of all classes this class inherits from (tree) ^/ + public InheritList; + + /^ List of methods and fields in class with (schema is ClassInstanceInfoEntry)^/ + public Entries; +} + +/^ The schema of the items in the list Entries in the dictionary that Class.GetInstanceInfo returns ^/ +class ClassInstanceInfoEntry : Dictionary { + /^ Field or method name ^/ + public Name; + /^ Is the entry a method (true) or field (false) ^/ + public IsFunction; + /^ Owner for entry (the class that owns it)^/ + public Owner; + /^ The current value of the entry ^/ + public Value; +} \ No newline at end of file diff --git a/Tesses.CrossLang.Reference/src/runtime_methods/console.tcross b/Tesses.CrossLang.Reference/src/runtime_methods/console.tcross index 9e0748b..e821f0e 100644 --- a/Tesses.CrossLang.Reference/src/runtime_methods/console.tcross +++ b/Tesses.CrossLang.Reference/src/runtime_methods/console.tcross @@ -1,5 +1,83 @@ +/^ Get whether terminal is echoing characters read ^/ +func Console.getEcho() +{ + +} +/^ Set whether terminal is echoing characters read ^/ +func Console.setEcho(flag) +{ + +} +/^ Get whether terminal is buffering line by line (true) or byte by byte (false) ^/ +func Console.getCanonical() +{ + +} +/^ Set whether terminal is buffering line by line (true) or byte by byte (false) ^/ +func Console.setCanonical(flag) +{ + +} +/^ Get whether terminal is sending signals for CTRL+C (true) or via read (false) ^/ +func Console.getSignals() +{ + +} +/^ Set whether terminal is sending signals for CTRL+C (true) or via read (false) ^/ +func Console.setSignals(flag) +{ + +} + + + /^ Write Text To Standard Output ^/ -func Console.WriteLine(text) +func Console.Write(text) +{ + +} +/^ Write Text To Standard Output with newline ^/ +func Console.WriteLine($text) +{ + +} +/^ Write Text To Standard Error ^/ +func Console.Error(text) +{ + +} +/^ Write Text To Standard Error with newline ^/ +func Console.ErrorLine($text) +{ + +} +/^ Read a byte from stdin ^/ +func Console.Read() +{ + +} +/^ Read a line from stdin ^/ +func Console.ReadLine() +{ + +} +/^ Fatally stop program (only allowed if you have full permissions) with optional message ^/ +func Console.Fatal($error_message) +{ + +} +/^ Get stdin Stream ^/ +func Console.getIn() +{ + +} +/^ Get stdout Stream ^/ +func Console.getOut() +{ + +} +/^ Get stderr Stream ^/ +func Console.getError() { } \ No newline at end of file diff --git a/Tesses.CrossLang.Reference/src/runtime_methods/crypto.tcross b/Tesses.CrossLang.Reference/src/runtime_methods/crypto.tcross new file mode 100644 index 0000000..0740d6b --- /dev/null +++ b/Tesses.CrossLang.Reference/src/runtime_methods/crypto.tcross @@ -0,0 +1,30 @@ +/^ Create bytearray but with secure random bytes in it instead of zeros ^/ +func Crypto.RandomBytes(byteCount, personalString) +{ + +} +/^ + Hash passwords with PBKDF2 + shanum: + 1: sha1 (please don't) + 224: sha224 (please use this) + 256: sha256 (vunerable to length extension attack) + 384: sha384 (perferably this) + 512: sha512 (vunerable to length extension attack) + +^/ +func Crypto.PBKDF2(pass,salt,itterations,keylen,shanum) +{ + +} +/^ Base64 Encode ^/ +func Crypto.Base64Encode(bytes) +{ + +} + +/^ Base64 Decode ^/ +func Crypto.Base64Decode(str) +{ + +} \ No newline at end of file diff --git a/Tesses.CrossLang.Reference/src/runtime_methods/dictionary.tcross b/Tesses.CrossLang.Reference/src/runtime_methods/dictionary.tcross new file mode 100644 index 0000000..e0b801e --- /dev/null +++ b/Tesses.CrossLang.Reference/src/runtime_methods/dictionary.tcross @@ -0,0 +1,15 @@ +/^ Returns DictionaryEnumerator ^/ +func Dictionary.Items(dictordyndict) +{ + +} +/^ Set field in dictionary ^/ +func Dictionary.SetField(dict, key, value) +{ + +} +/^ Get field in dictionary ^/ +func Dictionary.GetField(dict, key) +{ + +} \ No newline at end of file diff --git a/Tesses.CrossLang.Reference/src/runtime_methods/env.tcross b/Tesses.CrossLang.Reference/src/runtime_methods/env.tcross index 5bee100..67c482a 100644 --- a/Tesses.CrossLang.Reference/src/runtime_methods/env.tcross +++ b/Tesses.CrossLang.Reference/src/runtime_methods/env.tcross @@ -1,5 +1,82 @@ +/^ Get Environment variable ^/ +func Env.GetAt(key) +{ + +} +/^ Set Environment variable ^/ +func Env.SetAt(key,value) +{ + +} +/^ Get Desktop Folder ^/ +func Env.getDesktop() +{ + +} + +/^ Get Downloads Folder ^/ +func Env.getDownloads() +{ + +} + /^ Get Documents Folder ^/ func Env.getDocuments() { -} \ No newline at end of file +} +/^ Get Music Folder ^/ +func Env.getMusic() +{ + +} +/^ Get Picture Folder ^/ +func Env.getPictures() +{ + +} +/^ Get State Folder ^/ +func Env.getState() +{ + +} +/^ Get Cache Folder ^/ +func Env.getCache() +{ + +} +/^ Get Config Folder ^/ +func Env.getConfig() +{ + +} +/^ Get CrossLang Config Folder ^/ +func Env.getCrossLangConfig() +{ + +} +/^ Get Data Folder ^/ +func Env.getData() +{ + +} +/^ Get User Folder ^/ +func Env.getUser() +{ + +} +/^ Get Current Platform ^/ +func Env.getPlatform() +{ + +} +/^ Get the real path for executable ^/ +func Env.GetRealExecutablePath(path) +{ + +} +/^ Get the environment path seperator (its a field not a property so it is uncallable) ^/ +func Env.getEnvPathSeperator() +{ + +} diff --git a/Tesses.CrossLang.Reference/src/runtime_methods/fs.tcross b/Tesses.CrossLang.Reference/src/runtime_methods/fs.tcross index f89af94..e0aa1a0 100644 --- a/Tesses.CrossLang.Reference/src/runtime_methods/fs.tcross +++ b/Tesses.CrossLang.Reference/src/runtime_methods/fs.tcross @@ -7,4 +7,54 @@ func FS.ReadAllText(filesystem, path) func FS.WriteAllText(filesystem, path, contents) { -} \ No newline at end of file +} + +/^ Read bytes from file ^/ +func FS.ReadAllBytes(filesystem, path) +{ + +} +/^ Write bytes to file ^/ +func FS.WriteAllBytes(filesystem, path, bytes) +{ + +} + +/^ Create a crvm archive from fs to strm with name version and info^/ +func FS.CreateArchive(fs, strm, name, version, info) +{ + +} + +/^ Extract a crvm archive from strm to vfs ^/ +func FS.ExtractArchive(strm, vfs) +{ + +} + + +/^ Its a field FS.Local with type LocalFilesystem ^/ +func FS.getLocal() +{ + +} + +/^ returns the current working directory ^/ +func FS.getCurrentPath() +{ + +} + +/^ set the current working directory ^/ +func FS.setCurrentPath(path) +{ + +} +/^ Make absolute path from relative path ^/ +func FS.MakeFull(path) +{ + +} + + + diff --git a/Tesses.CrossLang.Reference/src/runtime_methods/net.tcross b/Tesses.CrossLang.Reference/src/runtime_methods/net.tcross new file mode 100644 index 0000000..ff93206 --- /dev/null +++ b/Tesses.CrossLang.Reference/src/runtime_methods/net.tcross @@ -0,0 +1,12 @@ +/^ Get the ip addresses of the machine, pass true if you want ipv6, returns List of schema Net.IPAddress^/ +func Net.getIPAddresses($ipv6) +{ + +} +/^ schema from list entries from return value of Net.getIPAddresses ^/ +class Net.IPAddress { + /^ The network interface ^/ + public Interface; + /^ The ip address string ^/ + public Address; +} \ No newline at end of file