Special variables
Special variables have a predefined meaning within the programming language. The task is to list the special variables used within the language.
AWK
There are two types of special variables within AWK: Control variables and Informative variables.
- dollarint variables - The dollarint special variables represent fields within a record
- ARGC - An informative variable that provides command line parameter information
- ARGV - An informative array that provides command line parameter information
- CONVFMT - A control variable that specifies the conversion format of numerical strings
- ENVIRON - An informative array that contains the environment strings
- FILENAME - An informative variable that provides the current input [filename]
- FNR - An informative variable that provides the record number within the current file
- FS - A control variable that specifies the input field separator
- NF - An informative variable that provides the number of fields within the current record
- NR - An informative variable that provides the total number of records processed
- OFMT - A control variable that specifies the output format of numerical values
- OFS - A control variable that specifies the output field separator
- ORS - A control variable that specifies the output record separator
- RLENGTH - An informative variable that provides the length of the currently matched substring
- RS - A control variable that specifies the input record separator
- RSTART - An informative variable that provides the start index of the currently matched substring
- SUBSEP - A control variable that specifies the subscript separator for multidimensional arrays
Icon and Unicon
Icon and Unicon have special variables known as keywords which are syntactically are preceded by an &. <lang Unicon>
- &keyword # type returned(indicators) - brief description
- indicators:
- * - generates multiple values
- = - modifiable
- ? - may fail (e.g. status inquiry)
- U - Unicon
- G - Icon or Unicon with Graphics
&allocated # integer(*) - report memory use &ascii # cset - ASCII character set &clock # string - time of day &col # integer(=G) - column location of pointer &collections # integer(*) - garbage collection activity &column # integer(U) - source code column &control # null(?G) - control key state &cset # cset - universal character set ¤t # co-expression - current co-expression &date # string - today's date &dateline # string - time stamp &digits # cset - digit characters &dump # integer(=) - termination dump &e # real - natural log e &error # integer(=) - fail on error &errornumber # integer(?) - runtime error code &errortext # string(?) - runtime error message &errorvalue # any(?) - offending value &errout # file - standard error file &eventcode # integer(=U) - program execution event &eventsource # co-expression(=U) - source of program execution events &eventvalue # any(=U) - program execution value &fail # none - expression failure &features # string* - platform features &file # string - current source file &host # string - host machine name &input # file - standard input file &interval # integer(G) - time between input events &lcase # cset - lowercase letters &ldrag # integer(G) - left button drag &letters # cset - letters &level # integer - call depth &line # integer - current source line number &lpress # integer(G) - left button press &lrelease # integer(G) - left button release &main # co-expression - main task &mdrag # integer(G) - middle button drag &meta # null(?G) - meta key state &mpress # integer(G) - middle button press &mrelease # integer(G) - middle button release &now # integer(U) - current time &null # null - null value &output # file - standard output file &phi # real - golden ratio &pos # integer(=) - string scanning position &progname # string(=) - program name &random # integer(=) - random number seed &rdrag # integer(G) - right button drag ®ions # integer(*) - region sizes &resize # integer(G) - window resize &row # integer(=G) - row location of pointer &rpress # integer(G) - right button press &rrelease # integer(G) - right button release &shift # null(?G) - shift key state &source # co-expression - invoking co-expression &storage # integer(*) - memory in use &subject # string - string scanning subject &syserr # integer - halt on system error &time # integer(=) - elapsed time &trace # integer(=) - trace program &ucase # cset - upper case letters &version # string - version &window # window(=G) - standard window &x # integer(=G) - pointer horizontal position &y # integer(=G) - pointer vertical position</lang>
J
special local variables
The names x y u v m n
are used as parameters in explicit J definitions:
y: right argument x: (optional) left argument u: left argument to an adverb or conjunction v: right argument to a conjunction m: left noun argument to an adverb or conjunction (value error if verb provided) n: right noun argument to a conjunction (value error if verb provided)
Note that the result of an adverb or conjunction that uses either x or y and one of these other names is always a verb. In this case, x and/or y represent arguments passed to the derived verb.
These names may be used as regular names, but that is bad practice except in the context of debugging or illustration.
special global variables
In J 602: Names in locale z are in the path for all locales, including the default locale (base) -- these provide "language features":
names_z_'' ARGV BINPATH CR CRLF DEL Debug EAV EMPTY FF FIXFONT FIXFONTWH IF64 IFCONSOLE IFGTK IFJ6 IFJAVA IFJHS IFUNIX IFWIN IFWIN32 IFWINCE IFWINE IFWINNT JVERSION LF LF2 Note PROFONT SYSPPC TAB UNAME adverb apply assert bind boxopen boxxopen break bx clear coclass cocreate cocurrent codestroy coerase cofullname coinsert coname conames conew conjunction conl copath coreset cutopen datatype def define do drop dyad each edit empty erase every exit expand fetch inv inverse items jcwdpath jhostpath jpath jpathsep jsystemdefs leaf list load loadd loadp mbopen mbsave monad nameclass namelist names nc nl noun on open pick require rows script scriptd scripts setbreak sign sminfo smoutput sort split startupconsole startupide table take tmoutput toCRLF toHOST toJ tolower toupper type ucp ucpcount utf8 uucp verb wcsize wd wdbox wdcenter wdclipread wdclipwrite wde wdfit wdforms wdget wdhandler wdinfo wdishandle wdisparent wdmove wdpclose wdqshow wdquery wdreset wdselect wdstatus winpathsep
Names in the locales j and jijs are available by explicity referencing those locales and are used to provide "system features" and "ide features":
names_j_'' BOXES BROWSER CONFIRMCLOSE DIRTREEX DISPLAYLOAD EPSREADER FORMAT FORMSIZES GetSystemMetrics IFJIJX INPUTLOG INPUTLOGFILE LOADED P2UPFONT PATHJSEP PATHSEP PDFREADER PRINTERFONT PRINTOPT PUBLIC READONLY SCRIPTS SHOWSIP SMPRINT SM_CMONITORS SM_CXVIRTUALSCREEN SM_CYVIRTUALSCREEN SM_XVIRTUALSCREEN SM_YVIRTUALSCREEN STARTUP SYSTEMFOLDERS TARGET USERFOLDERS WINPOS XDIFF addfname boxdraw buildpublic classwizard cleantable config cutnames deb debug demos dirmatch dltb edit editfind editinputlog editinputprompt exist extijs fexist fif filenewform fileprint fileprintsetup filex fixWINPOS formedit formeditrun forms fullname getinputlog getpath getscripts gettarget gettargetlocale globaldefs gridwizard help htmlhelp jpath lab lastactive loadp open openfiles origin pacman printfiles prints projectmanager save saveuserfolders scriptmake scripts wpreset wpsave wpset names_jijs_'' EMPTY FIXFONTDEF FKEYS FTYPES IFIOX IFMAX IFREADONLY IFSAVED IFSHOW JIJS JIJSMAC JRECENT NEWUSER PPSCRIPT QFORMX RECENT RECENTFILE RECENTLOC RECENTMAX SCMP SMBLK SMDESK SMHWNDP SMINIT SMNAME SMPATH SMSEL SMSIZE SMSTYLE SMTEXT SMTORG aboutj boxfkeys boxskeys checkreadonly cleartemp close closeijs closeijx closewindows comparesvn create cutpara deb destroy exitijs filecase fkeycase fkeylist fkeyrun fkeyselect fkeyselect1 flerase flexist flopen flread flwrite foldpara foldtext getSMSEL getactsize getcascade getcascade1 getcascades getfile getformx getline getsaveas getscrollpos getselection getskey id2loc id2name id2names id2type ide_maximize ide_minimize ide_restore ifshiftkey iftempscript info intn jijs_aboutj_button jijs_actrl_fkey jijs_bctrl_fkey jijs_bctrlshift_fkey jijs_cancel jijs_close jijs_close_button jijs_dctrl_fkey jijs_default jijs_demos_button jijs_ectrl_fkey jijs_ectrlshift_fkey jijs_editconfigure_button jijs_editcopy_button jijs_editcut_button jijs_editdirmatch_button jijs_editexport_button jijs_editfif_button jijs_editfind_button jijs_editformedit_button jijs_editinputlog_button jijs_editlint_button jijs_editpaste_button jijs_editreadonly_button jijs_editredo_button jijs_editselectall_button jijs_editundo_button jijs_f1_fkey jijs_f1ctrl_fkey jijs_f1shift_fkey jijs_fctrl_fkey jijs_fctrlshift_fkey jijs_filecleartemp_button jijs_fileexit_button jijs_filenewclass_button jijs_filenewijs_button jijs_fileopen_button jijs_fileopensystem_button jijs_fileopenuser_button jijs_fileprint_button jijs_fileprintsetup_button jijs_filerecent_button jijs_fkeys_button jijs_forms_button jijs_gctrl_fkey jijs_hctrl_fkey jijs_helpconstants_button jijs_helpcontext_button jijs_helpcontrols_button jijs_helpdictionary_button jijs_helpforeigns_button jijs_helpgeneral_button jijs_helpgl2cmd_button jijs_helphelp_button jijs_helpindex_button jijs_helpphrases_button jijs_helpprimer_button jijs_helprelease_button jijs_helprelnotes_button jijs_helpuser_button jijs_helpvocab_button jijs_helpwdcmd_button jijs_helpwdover_button jijs_ictrl_fkey jijs_jctrl_fkey jijs_kctrl_fkey jijs_kctrlshift_fkey jijs_labadvance_button jijs_labauthor_button jijs_labchapters_button jijs_labs_button jijs_lctrl_fkey jijs_lctrlshift_fkey jijs_max_button jijs_mctrl_fkey jijs_nctrl_fkey jijs_nctrlshift_fkey jijs_octrl_fkey jijs_pctrl_fkey jijs_qctrl_fkey jijs_rctrl_fkey jijs_rctrlshift_fkey jijs_rundebug_button jijs_runfile_button jijs_runfiled_button jijs_runline_button jijs_runpacman_button jijs_runprojman_button jijs_runselection_button jijs_runwindow_button jijs_runwindowd_button jijs_save_button jijs_saveas_button jijs_sctrl_fkey jijs_sellower_button jijs_selminus_button jijs_selplus_button jijs_selplusline1_button jijs_selplusline2_button jijs_selsort_button jijs_seltoggle_button jijs_selupper_button jijs_selwrap_button jijs_tctrl_fkey jijs_tile_button jijs_tileacross_button jijs_tilecascade_button jijs_togglebox_button jijs_wctrl_fkey jijs_wctrlshift_fkey jrecent_cancel jrecent_close jrecent_enter jrecent_lb_button jrecent_open_button jrecent_run jrecent_run_button jrecent_rund_button jrecent_view_button lint marksavedid name2id new newijs newijx nounrep openijs parentname pathname pmovex qsmact qsmall qsmallforms qsmallijs qsmlastijs qsmlastxs qsmout qsmsize query quote rdist readid readid16 readonlydefault recent_open recent_put recent_read recent_run recent_save resizefont restorefont roundint runcompare runexport runfile runimmx0 runimmx1 runline runselection runwindow save saveas saveopenwindows scmp_cancel scmp_close scmp_close_button scmp_current_button scmp_original_button scmp_revert_button scmp_run scmp_show select_line select_text set_fkeys set_skey1 set_skeys setfontall setpnall setreadonly sh smappend smclose smfocus smfocusact smfocusout smgetsel smmove smopen smprompt smread smreplace smsave smscroll smsel smselact smselout smsetcmd smsetsaved smsetselect smwrite sysmodifiers tile tile2fit tile2fit1 tileacross tilecascade tileget todelim tofoldername togglebox togglereadonly togglexs tolist topara ucpboxdraw unboxfkeys unboxskeys winmax
PureBasic
PureBasic has no 'special variables'. It does define constants that reflect compiler settings that can be tested and used as a part of compiling. All other non-explicitly declared values that vary during runtime are returned by functions.
Tcl
There are three major categories of special variables in Tcl: global variables special to the Tcl language, global variables set by Tcl-based interpreters, and local variables with special interpretations.
Language Globals
These variables are defined by the standard implementation of Tcl, and are present in all Tcl interpreters by default.
- env
- This global array is Tcl's interface to the process's environment variables.
- errorCode
- This global scalar holds a machine-readable description of the last error to occur. (Note that prior to Tcl 8.6, internally-generated exceptions often used NONE for this value.)
- errorInfo
- This global scalar holds a stack trace from the last error to occur.
- tcl_library
- This global scalar holds the location of Tcl's own internal library.
- tcl_version, tcl_patchLevel
- This global scalar holds the version of Tcl in use. From Tcl 8.5 onwards, these hold the same (detailed) value.
- tcl_pkgPath
- This global scalar holds a Tcl list of directories where Tcl looks for packages by default. This is used to initialize the auto_path global variable.
- auto_path
- This global scalar holds a Tcl list of directories where Tcl looks for packages (and auto-loaded scripts, though this facility is deprecated).
- tcl_platform
- This global array holds a description of the platform on which Tcl is executing.
- tcl_precision
- This global scalar holds the number of significant figures to use when converting a floating-point value to a string by default. From Tcl 8.5 onwards it should not be changed. (If you are thinking of using this, consider using the
format
command instead.) - tcl_rcFileName
- This global scalar holds the name of a file to
source
when the interpreter starts in interactive mode. - tcl_rcRsrcName
- This global scalar is only used on classic Mac OS (now deprecated); consult the documentation for more information.
- tcl_traceCompile
- If enabled at library configuration time, this global scalar allows tracing of the compilation of bytecode in the interpreter.
- tcl_traceExec
- If enabled at library configuration time, this global scalar allows tracing of the execution of bytecode in the interpreter.
- tcl_wordchars, tcl_nonwordchars
- These global scalars hold regular expression fragments that describe the current platform's interpretation of what is and isn't a word.
Interpreter Globals
These global variables are only features of the most common Tcl-based shells, tclsh and wish.
- argc
- This global scalar holds the number of arguments (after the script) passed to the Tcl interpreter.
- argv
- This global scalar holds a Tcl list of the arguments (after the script) passed to the Tcl interpreter.
- argv0
- This global scalar holds the name of the main script to execute that was passed to the Tcl interpreter, or the name of the interpreter itself in interactive mode.
- tcl_interactive
- This global scalar holds whether this interpreter is working in interactive mode (i.e., needs to print command prompts, run a REPL, etc.)
- tcl_prompt1, tcl_prompt2
- These global scalars allow customization of the prompt strings in interactive mode.
- geometry
This global scalar holds the user-supplied preferred dimensions of the initial window. Only used by interpreters that load the Tk library.
Local Special Variables
This is a language feature of procedures.
- args
- This local variable holds the Tcl list of arguments supplied to the current procedure after all the other formal arguments have been satisfied. Note that it needs to be explicitly listed in the formal arguments and be last in the list of formal arguments to have this behavior.