From 9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22 Mon Sep 17 00:00:00 2001 From: Richard Date: Sun, 13 Apr 2025 18:48:02 +0100 Subject: initial --- site/udo/host_platform.udo | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 site/udo/host_platform.udo (limited to 'site/udo/host_platform.udo') diff --git a/site/udo/host_platform.udo b/site/udo/host_platform.udo new file mode 100755 index 0000000..2b82eb7 --- /dev/null +++ b/site/udo/host_platform.udo @@ -0,0 +1,45 @@ +#ifndef UDO_HOSTPLATFORM +#define UDO_HOSTPLATFORM ## + +/* + Host platform detection + + This file is part of the SONICS UDO collection by Richard Knight 2024 + License: GPL-2.0-or-later + http://1bpm.net +*/ + +; gihost_type: 0 = windows , 1 = linux, 2 = WASM + + +#ifndef WEB +gihost_type filevalid "/bin/ls" +#end + +#ifdef WEB +gihost_type = 2 +#end + +gihost_max32bitftlen = 16777216 + +/* + Get temp dir as string +*/ +opcode host_tempdir, S, 0 + Spath = "" ; default to root assuming slash is appended to output + if (gihost_type == 0) then + Spath = "%TEMP%" + elseif (gihost_type == 1) then + Spath = "/tmp" + endif + xout Spath +endop + +/* + Get whether the current Csound instance is 32 or 64 bit +*/ +opcode is64bit, i, 0 + xout (1 & 1e9+9) +endop + +#end -- cgit v1.2.3