// Please do not edit this file. It has been generated automatically // from `src/module/uuid.wren` using `util/wren_to_c_string.py` static const char* uuidModuleSource = "// retoor \n" "\n" "import \"crypto\" for Crypto\n" "import \"strutil\" for Str\n" "import \"bytes\" for Bytes\n" "\n" "class Uuid {\n" " static toHex_(bytes) { Str.hexEncode(Bytes.fromList(bytes)) }\n" "\n" " static v4() {\n" " var bytes = Crypto.randomBytes(16)\n" " bytes[6] = (bytes[6] & 0x0F) | 0x40\n" " bytes[8] = (bytes[8] & 0x3F) | 0x80\n" " var hex = toHex_(bytes)\n" " return hex[0..7] + \"-\" + hex[8..11] + \"-\" + hex[12..15] + \"-\" + hex[16..19] + \"-\" + hex[20..31]\n" " }\n" "\n" " static isValid(string) {\n" " if (!(string is String)) return false\n" " if (string.count != 36) return false\n" " if (string[8] != \"-\" || string[13] != \"-\" || string[18] != \"-\" || string[23] != \"-\") return false\n" " var hexChars = \"0123456789abcdefABCDEF\"\n" " var positions = [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]\n" " for (pos in positions) {\n" " if (!hexChars.contains(string[pos])) return false\n" " }\n" " return true\n" " }\n" "\n" " static isV4(string) {\n" " if (!isValid(string)) return false\n" " var version = string[14]\n" " if (version != \"4\") return false\n" " var variant = string[19]\n" " if (variant != \"8\" && variant != \"9\" && variant != \"a\" && variant != \"b\" && variant != \"A\" && variant != \"B\") return false\n" " return true\n" " }\n" "}\n";