#include "muse_builtins.h"#include <string.h>#include <stdlib.h>#include "muse_port.h"#include "muse_utils.h"#include <sys/time.h>
Functions | |
| muse_cell | fn_list_files (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_list_folders (muse_env *env, void *context, muse_cell args) |
| (list-folders [pattern]). | |
| muse_cell | fn_split (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_alert (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_urlencode (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_urldecode (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_launch (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_whatis (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_windows_registry_entry (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_temp_folder (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_temp_file (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_to_lower (muse_env *env, void *context, muse_cell args) |
| muse_cell | fn_to_upper (muse_env *env, void *context, muse_cell args) |
Copyright (c) 2006 Jointly owned by Srikumar K. S. and muvee Technologies Pte. Ltd.
All rights reserved. See LICENSE.txt distributed with this source code or http://muvee-symbolic-expressions.googlecode.com/svn/trunk/LICENSE.txt for terms and conditions under which this software is provided to you.
A collection of OS-specific functions exposed in the language.
(list-files [pattern])
Returns a list of files that patch the given pattern. For example:
(list-files "*.jpg")
will list the JPG files in the current folder. Note that the returned list only has the file names and not the full paths to the files.
Another use for list-files is to check whether a particular file exists. If p is the full path to the file, say, then
(list-files p)
will be () if the file doesn't exist and will be a single-entry list of the file's name (stripped of path) if the file exists.
References muse_add_recent_item(), muse_generate_list(), and MUSE_NIL.
(list-folders [pattern]).
Returns a list of folder names for all the folders that satisfy the given pattern. For example:
(list-folders "../*")
will list the folders above the current folder. Note that the returned list only has the folder names and not the full paths to the folders. Also, the folder names don't end with '/' or any such path separator character.
Another use for list-folders is to check whether a particular folder exists. If p is the full path to the folder without any trailing slashes/backslashes, then
(list-folders p)
will be () if the folder doesn't exist and will be a single-entry list of the folder's name (stripped of path) if the folder exists.
References muse_add_recent_item(), muse_generate_list(), and MUSE_NIL.
(split "one;two;;three;" ";") -> ("one" "two" "" "three" "")
(split "one=1;two=2;three=3" "=;") -> ("one" "1" "two" "2" "three" "3")
The first argument is the string to split and the second argument is a character separator.
You can define a recursive splitter like this -
(define (split-rec str (sep . seps))
(if seps
(map (fn (s) (split-rec s seps)) (split str sep))
(split str sep)))
so that
(split-rec "a=1&b=2&c=3" '("&" "="))
will give you
(("a" "1") ("b" "2") ("c" "3"))
.
References fn_split(), muse_add_recent_item(), and muse_generate_list().
Referenced by fn_split().
(alert arg1 arg2 ...)
Puts up an "abort-retry-ignore" message box with the given text. The arguments are "format"ed into a single string and presented in the dialog box.
References fn_format(), muse_message(), and MUSE_NIL.
(urlencode "string")
Takes an arbitrary string and returns a version that can be used as a part of a URL. The string is not expected to contain unicode characters.
References muse_mk_text(), MUSE_NIL, muse_raise_error(), and muse_text_contents().
(urldecode "encoded%20string")
Takes a url-encoded string and returns the regular string form.
References muse_mk_text(), MUSE_NIL, muse_raise_error(), and muse_text_contents().
(launch "file.ext")
Opens the given filesystem object or URL in the default application.
References fn_system(), muse_list(), MUSE_NIL, and muse_text_contents().
(windows-registry-entry section entry)
Looks up the given entry path in the given section. The entry's components are to be separated by backslashes. Integers become muSE integers, strings become muSE strings, a multi-string becomes a list of strings and a binary blob becomes a byte array.
| section | Can be one of "HKEY_CLASSES_ROOT", "HKEY_CURRENT_CONFIG", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE", "HKEY_PERFORMANCE_DATA", "HKEY_PERFORMANCE_NLSTEXT", "HKEY_PERFORMANCE_TEXT" or "HKEY_USERS" | |
| entry | A backslash separated sequence of subkeys. |
(windows-registry-entry
"HKEY_LOCAL_MACHINE"
"SOFTWARE\\Classes\\CLSID\\{30A8E5D8-A4BD-4038-981E-AD2B7AD781EA}\\InprocServer32\\")
References fn_windows_registry_entry(), muse_add_recent_item(), muse_generate_list(), muse_mk_ctext(), muse_mk_int(), MUSE_NIL, muse_raise_error(), and muse_text_contents().
Referenced by fn_windows_registry_entry().
(temp-folder)
Returns a path into which you can store temporary files. The path has a trailing path separator so you can append a file name to it directly. You're also assured that the folder exists and can be written to. If not, the return value is ().
References fn_temp_folder(), muse_add_recent_item(), muse_mk_ctext(), muse_mk_text(), and MUSE_NIL.
Referenced by fn_temp_folder().
(temp-file folder [prefix])
Returns the full path to a unique temporary file in the given folder. If no folder is given, then temp-folder is used to get a folder for storing temporary files.
References fn_temp_file(), muse_add_recent_item(), muse_mk_ctext(), muse_mk_ctext_utf8(), MUSE_NIL, and muse_text_contents().
Referenced by fn_temp_file().
(to-lower string)
Converts the given string to lower case.
References muse_mk_text(), and muse_text_contents().
(to-upper string)
Converts the given string to upper case.
References muse_mk_text(), and muse_text_contents().
1.6.3