functions_overview
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | functions_overview [2008/10/22 14:40] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ======Functions====== | ||
| + | EPIC functions are very similar to those of common procedural languages | ||
| + | - they have arguments and they return a value. There are many different | ||
| + | kinds of functions - ones that manipulate strings, ones that retrieve | ||
| + | information from the client, ones that perform math operations et | ||
| + | cetera. | ||
| + | |||
| + | This page groups all functions present in the EPIC client based on their domain. | ||
| + | For a more general guide to programming EPIC, see the [[programming|programming | ||
| + | in EPIC]] guide. | ||
| + | |||
| + | =====Extracting substrings from strings===== | ||
| + | ^function^description^ | ||
| + | |[[after]] |get the part after a certain character | | ||
| + | |[[before]] |get the part before a certain characters | | ||
| + | |[[chop]] |remove final character(s)| | ||
| + | |[[left]] |get the first few characters| | ||
| + | |[[leftpc]] |get the first few characters, but only count printable characters | | ||
| + | |[[mid]] |get characters from the middle | | ||
| + | |[[rest]] |remove leading character(s)| | ||
| + | |[[right]] |get the final few characters| | ||
| + | |||
| + | =====String operations===== | ||
| + | ^function^description^ | ||
| + | |[[ascii]] |convert a string into a word list of ascii numbers| | ||
| + | |[[b64decode]] |recover string encoded in base64| | ||
| + | |[[b64encode]] |convert string into base64| | ||
| + | |[[center]] |center a string in given width | | ||
| + | |[[chr]] |convert a word list of ascii numbers into a string| | ||
| + | |[[count]] |count how many times a substring appears in a string | | ||
| + | |[[cparse]] |add colors without using %%^%%C | | ||
| + | |[[decode]] |recover string encoded in [[encode]]| | ||
| + | |[[deuhc]] |remove leading ' | ||
| + | |[[encode]] |make a string suitable for being used as a variable name | | ||
| + | |[[getopt]] |parse a command line for an alias requiring command-line switches | | ||
| + | |[[index]] |locate a character in a string | | ||
| + | |[[insert]] |inject a substring into a string | | ||
| + | |[[isalpha]] |is the character a letter? | | ||
| + | |[[isdigit]] |is the character a digit?| | ||
| + | |[[isnumber]] |is the string a number? | | ||
| + | |[[msar]] |replace multiple patterns in a string | | ||
| + | |[[nohighlight]] |strip control-codes from a string | | ||
| + | |[[numlines]] |calculate how many lines a string would occupy on the screen | | ||
| + | |[[pad]] |fill a string with a character until it reaches certain length | | ||
| + | |[[pass]] |leave only specified characters in a string | | ||
| + | |[[printlen]] |length of a string without formatting characters | | ||
| + | |[[repeat_function|repeat]] |repeat a string a number of times | | ||
| + | |[[reverse]] |print a string backwards | | ||
| + | |[[rindex]] |locate a character in a string starting from the right | | ||
| + | |[[rsubstr]] |search for a substring beginning from the end of a string | | ||
| + | |[[sar]] |replace a pattern in a string | | ||
| + | |[[shiftbrace]] |remove the braced expression from the beginning of a string | | ||
| + | |[[split]] |split a string into multiple words | | ||
| + | |[[stripansicodes]] |strip ANSI codes (DUH!) | | ||
| + | |[[stripansi]] |convert non-printable characters to printable ones | | ||
| + | |[[stripcrap]] |remove various types of unwanted characters | | ||
| + | |[[stripc]] |strip %%^%%C' | ||
| + | |[[strip]] |strip given characters from a string | | ||
| + | |[[strlen]] |length of a string | | ||
| + | |[[strtol]] |convert a number to given base| | ||
| + | |[[substr]] |search for a substring in a string | | ||
| + | |[[tolower]] |convert a string to lowercase | | ||
| + | |[[toupper]] |convert a string to uppercase | | ||
| + | |[[tr]] |transpose characters | | ||
| + | |[[uhc]] |finish an incomplete // | ||
| + | |[[urldecode]] |de-mangle $[[urlencode]]()d text | | ||
| + | |[[urlencode]] |mangle a string to the form usual of URLs| | ||
| + | |||
| + | =====Word operations===== | ||
| + | ^function^description^ | ||
| + | |[[afterw]] |words after a matching pattern | | ||
| + | |[[beforew]] |words before a matching pattern | | ||
| + | |[[chngw]] |change a word| | ||
| + | |[[common]] |logical AND on words in two lists | | ||
| + | |[[diff]] |logical XOR on words in two lists | | ||
| + | |[[findw]] |find word's index in a word list | | ||
| + | |[[fromw]] |rest of a word list beginning with some word| | ||
| + | |[[indextoword]] |word basing on string index | | ||
| + | |[[insertw]] |insert a word at given index | | ||
| + | |[[leftw]] |amount of words starting at the beginning | | ||
| + | |[[maxlen]] |length of a longest word in a word list | | ||
| + | |[[midw]] |extract a range of words in a word list | | ||
| + | |[[notw]] |exclude a word index from a word list | | ||
| + | |[[numsort]] |sort a word list using a numerical compare function | | ||
| + | |[[numwords]] |show an amount of words in a word list | | ||
| + | |[[pop_function|pop]] |cut the last word off of a variable and return it | | ||
| + | |[[prefix]] |common initial substring of given words | | ||
| + | |[[push_function|push]] |append a word to a variable | | ||
| + | |[[remws]] |remove words from a word list | | ||
| + | |[[remw]] |remove a word from a word list | | ||
| + | |[[restw]] |print the rest of a word list beginning at a word index | | ||
| + | |[[revw]] |word list in reverse order | | ||
| + | |[[rightw]] |amount of last words in a word list | | ||
| + | |[[shift function|shift]] |trim the last word of a variable and return it | | ||
| + | |[[sort]] |sort a word list | | ||
| + | |[[splice]] |return a range of words from a word list| | ||
| + | |[[tow]] |return words up to given word | | ||
| + | |[[uniq]] |remove duplicates from a word list | | ||
| + | |[[unshift_function|unshift]] |prepend a word to a variable | | ||
| + | |[[unsplit]] |undo a $[[split]]() | | ||
| + | |[[wordtoindex]] |return a word position of given index | | ||
| + | |[[word]] |return a word from a word list based on its index| | ||
| + | |||
| + | =====Math functions===== | ||
| + | ^function^description^ | ||
| + | |[[abs]] |absolute value of a number | | ||
| + | |[[acosh]] |hyperbolic cosine of a number | | ||
| + | |[[acos]] |arc cosine of a number | | ||
| + | |[[asinh]] |inverse hyperbolic sine of a number | | ||
| + | |[[asin]] |principal value in radians of the arc sine of a number | | ||
| + | |[[atanh]] |inverse hyperbolic tangent of a number | | ||
| + | |[[atan]] |principal value in radians of the arc tangent of a number | | ||
| + | |[[ceil]] |smallest integer that is greater than or equal to a number | | ||
| + | |[[cosh]] |hyperbolic cosine of a number | | ||
| + | |[[cos]] |cosine of the angle of a number | | ||
| + | |[[exp]] |value of //e// raised to a value of a number | | ||
| + | |[[floor]] |largest integer that is less than or equal to a number | | ||
| + | |[[jn]] |bessel function of the first kind | | ||
| + | |[[log10]] |base-10 logarithm of a number | | ||
| + | |[[log_function|log]] |natural logarithm of a number | | ||
| + | |[[sinh]] |hyperbolic sine of a number | | ||
| + | |[[sin]] |sine of the angle of given number' | ||
| + | |[[tanh]] |hyperbolic tangent of a number | | ||
| + | |[[tan]] |tangent of the angle of given number' | ||
| + | |[[tobase]] |convert a number to given base | | ||
| + | |[[yn]] |linearly independant bessel function of the second kind| | ||
| + | |||
| + | =====Time info===== | ||
| + | ^function^description^ | ||
| + | |[[stime]] |human readable form of unix time | | ||
| + | |[[strftime]] |format date and time | | ||
| + | |[[tdiff]] |how much time has elapsed? | | ||
| + | |[[tdiff2]] |shorter version of the above | | ||
| + | |[[time_function|time]] |unix timestamp | | ||
| + | |[[utime_function|utime]] |unix timestamp with microseconds| | ||
| + | |||
| + | =====Pattern matching===== | ||
| + | ^function^description^ | ||
| + | |[[copattern]] |words in a var2 corresponding to matched words in var1 | | ||
| + | |[[filter]] |remove words matching a pattern | | ||
| + | |[[globi]] |case-insensitive filename globbing| | ||
| + | |[[glob]] |filename globbing | | ||
| + | |[[mask]] |bantype pattern for a mask | | ||
| + | |[[match]] |match words with multiple patterns | | ||
| + | |[[pattern]] |return words matched by a pattern | | ||
| + | |[[regex]] |description of regexp functions | | ||
| + | |[[rfilter]] |return patterns not matching a word | | ||
| + | |[[rmatch]] |match a word against many patterns | | ||
| + | |[[rpattern]] |patterns that match a word| | ||
| + | |||
| + | =====Server operations===== | ||
| + | ^function^description^ | ||
| + | |[[cipher]] |retrieve the ssl cipher name from a SSL-enabled server| | ||
| + | |[[isaway]] |check whether you're away| | ||
| + | |[[isconnected]] |check whether a server is fully connected | | ||
| + | |[[isencrypted]] |check whether a server is SSL-enabled| | ||
| + | |[[myservers]] |list open server connections | | ||
| + | |[[notify_function|notify]] |toggle the notify feature for a server | | ||
| + | |[[serverctl]] |generic interface to serverlist | | ||
| + | |[[serverwin]] |current window for a server | | ||
| + | |[[servports]] |local and remote ports for a server connection | | ||
| + | |[[usermode]] |your umode on a server | | ||
| + | |[[version_function|version]] |server' | ||
| + | |||
| + | =====Channel info===== | ||
| + | ^function^description^ | ||
| + | |[[chanmode]] |channel mode for given channel | | ||
| + | |[[channel_function|channel]] |list of users on channels with their chanmodes | | ||
| + | |[[chanusers]] |synonym for $[[onchannel]]() | | ||
| + | |[[chops]] |list of channel operators| | ||
| + | |[[ischannel]] |is the string a valid channel name? | | ||
| + | |[[ischanop]] |is the user a chanop? | | ||
| + | |[[ischanvoice]] |is the user a voice?| | ||
| + | |[[iscurchan]] |is the channel current in its window? | | ||
| + | |[[ishalfop]] |is the user a halfop? | | ||
| + | |[[key]] |fetch a key for a channel | | ||
| + | |[[mychannels]] |channels you're on | | ||
| + | |[[nochops]] |list of users without any chanmodes on a channel | | ||
| + | |[[numonchannel]] |number of users on a channel | | ||
| + | |[[onchannel]] |check whether a user is on a channel or print a list of all users on a channel | | ||
| + | |[[userhost_function|userhost]] |retrieve user's host from inside an /[[on]] hook or from client' | ||
| + | |||
| + | =====Display operations===== | ||
| + | ^function^description^ | ||
| + | |[[chanwin]] |return the window a channel belongs to or window' | ||
| + | |[[curpos]] |position of the cursol on the input line | | ||
| + | |[[currchans]] |current channels for refnums | | ||
| + | |[[geom]] |return dimensions of the terminal | | ||
| + | |[[getcap]] |return data from terminfo or termcap database| | ||
| + | |[[lastlog_function|lastlog]] |list of scrollback lines matching a pattern | | ||
| + | |[[levelwindow]] |return a window having given level for a server | | ||
| + | |[[line]] |retrieve the actual line from a scrollback buffer | | ||
| + | |[[notifywindows]] |list of hidden windows with background activity | | ||
| + | |[[outputinfo]] |return a level and target for given message | | ||
| + | |[[querywin]] |active query in given window| | ||
| + | |[[status_function|status]] |return a status bar for a window | | ||
| + | |[[winchan]] |alias for $[[chanwin]]() | | ||
| + | |[[windowctl]] |generic interface to window list | | ||
| + | |[[winquery]] |return the window for given query| | ||
| + | |||
| + | =====Array operations===== | ||
| + | ^function^description^ | ||
| + | |[[delarray]] |delete an array completely | | ||
| + | |[[delitem]] |delete an item from an array | | ||
| + | |[[finditem]] |find an item in an array | | ||
| + | |[[getarrays]] |display names of all arrays| | ||
| + | |[[getitem]] |retrieve an item from an array | | ||
| + | |[[getmatches]] |return items in an array matching a pattern | | ||
| + | |[[gettmatch]] |returns an array item best matching the pattern | | ||
| + | |[[igetmatches]] |retrieve all items of an array matching given pattern | | ||
| + | |[[indextoitem]] |sorted array index basing on array index | | ||
| + | |[[itemtoindex]] | array index basing on a sorted array index | | ||
| + | |[[matchitem]] |match all array against a pattern | | ||
| + | |[[numarrays]] |total number of created arrays | | ||
| + | |[[numitems]] |number of items in given array | | ||
| + | |[[rmatchitem]] |match an array item against multiple patterns | | ||
| + | |[[setitem]] |add or modify an item in an array| | ||
| + | |||
| + | =====File I/O===== | ||
| + | ^function^description^ | ||
| + | |[[close]] |close a file descriptor | | ||
| + | |[[eof]] |check whether if we're at the end of a file | | ||
| + | |[[fsize]] |return the size of a file | | ||
| + | |[[ftime]] |return the time when a file was last modified | | ||
| + | |[[open]] |open a file for reading or writing | | ||
| + | |[[read]] |read a line or an arbitrary amount of data from a file | | ||
| + | |[[writeb]] |write an amount of bytes into a file | | ||
| + | |[[write]] |write a line to a file| | ||
| + | |||
| + | =====Client operations===== | ||
| + | ^function^description^ | ||
| + | |[[aliasctl]] |generic interface to [[alias command|aliases]] | | ||
| + | |[[bindctl]] |generic interface to [[bind|keybindings]] | | ||
| + | |[[builtin_expando]] |return a value of a builtin expando | | ||
| + | |[[cexist]] |check whether a builtin command exists | | ||
| + | |[[dccctl]] |generic interface to [[DCC]] | | ||
| + | |[[epic]] |check whether the client is a Genuine EPIC (tm) | | ||
| + | |[[fnexist]] |check whether a builtin function exists | | ||
| + | |[[getcommands]] |get a list of all commands | | ||
| + | |[[getfunctions]] |get a list of all functions | | ||
| + | |[[getsets]] |get a list of all /[[set]]s | | ||
| + | |[[getset]] |get a value of a /[[set]] | | ||
| + | |[[hookctl]] |generic interface to [[hook|hooks]]| | ||
| + | |[[idle]] |returns how long ago you pressed a key | | ||
| + | |[[ignorectl]] |generic interface to ignores | | ||
| + | |[[info_function|info]] |information about how the client was compiled | | ||
| + | |[[irclib]] |returns a path to the irc library the client is using | | ||
| + | |[[isdisplaying]] |checks whether /[[echo]] will actually output a string | | ||
| + | |[[logctl]] |generic interface to logs | | ||
| + | |[[ssl]] |check whether the client was compiled with SSL support | | ||
| + | |[[timerctl]] |generic interface to [[timer|timers]]| | ||
| + | |||
| + | =====Network operations===== | ||
| + | ^function^description^ | ||
| + | |[[connect_function|connect]] |open a TCP connection to a remote host| | ||
| + | |[[convert]] |convert a hostname to an IP address and vice versa | | ||
| + | |[[iptolong]] |convert an IP address to a long | | ||
| + | |[[iptoname]] |convert an IP address to its reverse DNS | | ||
| + | |[[listen]] |listen on a local port | | ||
| + | |[[longtoip]] |convert a long to an IP | | ||
| + | |[[nametoip]] |convert a hostname to an IP address| | ||
| + | |||
| + | =====System operations===== | ||
| + | ^function^description^ | ||
| + | |[[chmod]] |change file's permissions | | ||
| + | |[[crypt]] |hash a password | | ||
| + | |[[exec_function|exec]] |spawn a new process and read its output | | ||
| + | |[[fexist]] |check whether a file exists | | ||
| + | |[[getenv]] |return an environment variable of EPIC's process | | ||
| + | |[[getgid]] |return EPIC's group ID | | ||
| + | |[[getlogin]] |return the username of a user running EPIC | | ||
| + | |[[getpgrp]] |return the process group ID of EPIC | | ||
| + | |[[getuid]] |return the uid of a user running EPIC | | ||
| + | |[[killpid]] |kill a process ID | | ||
| + | |[[mkdir]] |create a new directory | | ||
| + | |[[pid]] |return EPIC's pid | | ||
| + | |[[ppid]] |return EPIC's parent process' | ||
| + | |[[realpath]] |return a real path (with relative paths, ' | ||
| + | |[[rename]] |rename a file | | ||
| + | |[[rmdir]] |remove a directory | | ||
| + | |[[srand]] |seed the random number generator | | ||
| + | |[[stat]] |get information about a file | | ||
| + | |[[ttyname]] |get the terminal device currently used by EPIC | | ||
| + | |[[twiddle]] |return a home directory for a user | | ||
| + | |[[umask]] |set the umask | | ||
| + | |[[uname]] |return various informations from system' | ||
| + | |[[unlink]] |remove a file| | ||
| + | |||
| + | =====External scripting languages===== | ||
| + | ^function^description^ | ||
| + | |[[perlcall]] | | ||
| + | |[[perl_function]] | | ||
| + | |[[perlxcall]] | | ||
| + | |[[ruby function]] | | ||
| + | |[[tcl function]] | | ||
| + | |||
| + | =====Miscellanea===== | ||
| + | ^function^description^ | ||
| + | |[[functioncall]] |check whether your alias is running as a command or as a function | | ||
| + | |[[hash_32bit]] |hash a string into a 32bit integer | | ||
| + | |[[jot]] |return an integer range | | ||
| + | |[[loadinfo]] |return information from inside a / | ||
| + | |[[metric_time]] |current time in the metric system | | ||
| + | |[[pipe_function|pipe]] |execute a function and read its output | | ||
| + | |[[randread]] |return a random line from a file | | ||
| + | |[[rand]] |return a random integer | | ||
| + | |[[sedcrypt]] |encrypt a string using SED | | ||
| + | |[[sha256]] |hash a string using SHA256 | | ||
| + | |[[startupfile]] |name of the file loaded as a startup script | | ||
| + | |[[trunc]] |truncate a floating-point number to given degree of decimal precision | | ||
| + | |[[which_function|which]] |full path to a script located in [[set load path|LOAD_PATH]] | | ||
| + | |[[xdebug_function|xdebug]] |debugging function| | ||
| + | |||
| + | =====Unknown===== | ||
| + | ^function^description^ | ||
| + | |[[asciiq]] | | ||
| + | |[[chrq]] | | ||
| + | |[[encryptparm]] | | ||
| + | |[[findws]] | ||
| + | |[[fix_arglist]] | | ||
| + | |[[floodinfo]] | | ||
| + | |[[getserial]] | | ||
| + | |[[isfilevalid]] | | ||
| + | |[[joinstr]] | | ||
| + | |[[nopaste]] | | ||
| + | |[[scan]] | | ||
| + | |[[shiftbrace]] | | ||
| + | |[[symbolctl]] | | ||
| + | |[[usetitem]] | | ||
| + | |[[xform]] | | ||
| + | |[[mktime]] | | ||
| + | |[[corfilter]] | | ||
| + | |[[cofilter]] | | ||
| + | |[[corpattern]] | | ||
| + | |[[delitems]] | | ||
| + | |[[finditems]] | | ||
| + | |[[getrmatches]] | | ||
| + | |[[ifindfirst]] | | ||
| + | |[[ifinditems]] | | ||
| + | |[[ifinditem]] | | ||
| + | |[[igetitem]] | | ||
| + | |[[igetrmatches]] | | ||
| + | |[[listarray]] | | ||
| + | |[[ferror]] | | ||
| + | |[[frewind]] | | ||
| + | |[[fseek]] | | ||
| + | |[[fskip]] | | ||
| + | |[[ftell]]| | ||
| + | |[[ftruncate]] | | ||
| + | |[[dbmctl]] | | ||
functions_overview.txt · Last modified: 2008/10/22 14:40 by 127.0.0.1
