all functions - s
save
save, file, var1, var2, ... restore, file, var1, var2, ... saves the variables VAR1, VAR2, etc. in the binary file FILE, or restores them from that file. The VARi may be either non-record or record data in the case that FILE contains records. If one of the VARi does not already exist in FILE, it is created by the save command; after add_record, save adds or stores VARi to the current record. See add_record for more. The VARi may be structure definitions (for the save command) to declare data structures for the file. This is necessary only in the case that a record variable is a pointer -- all of the potential data types of pointees must be known. No data structures may be declared using the save command after the first record has been added. If no VARi are present, save saves all array variables, and restore restores every non-record variable in the file if there is no current record, and every variable in the current record if there is one. Builtin function, documented at i0/std.i line 3080SEE ALSO: openb, createb, updateb, get_vars, add_record, get_addrs, jt, jc,
_read, _write, data_align
save3
view= save3() Save the current 3D viewing transformation and lighting. Interpreted function, defined at i/pl3d.i line 233SEE ALSO: restore3, rot3, mov3, aim3, light3
scalar
scalar -- get optional scalar parameter PROTOTYPE x = scalar(xarg, xdef, lt=, le=, gt=, ge=, type=, arg=, fn=); ARGUMENTS XARG argument passed to the function. XDEF default value for the scalar argument (optional, if not specified, then it is guessed that the caller must supply the argument). KEYWORDS GE= to be valid, XARG must be >= GE (optional, only one of GT or GE can be used). GT= to be valid, XARG must be > GT (optional, only one of GT or GE can be used). LE= to be valid, XARG must be <= LE (optional, only one of LT or LE can be used). LT= to be valid, XARG must be < LT (optional, only one of LT or LE can be used). TYPE= data type of the scalar (optional). FN= function name for error messages (optional string). ARG= argument name for error messages (optional string). DESCRIPTION Check XARG and return a scalar value (i.e., either XARG converted to TYPE if it is not void or XDEF otherwise). If XARG is not within any specified bound or if it is not a scalar or if it is void (e.g., not specified) and there is no default value XDEF, an error message is written out. EXAMPLE The following function has 2 scalar arguments X and Y, the 1st one is an integer (of type long) which must be specified and be strictly greater than 22 while the 2nd default to .5 and must be in [0., 1.]: func foo(x,y) { x= scalar(x, gt=22, type=long, fn="foo", arg="X"); y= scalar(y, .5, ge=0., le=1., type=double, fn="foo", arg="Y"); ... } WARNING There is no checking of consistency of options. HISTORY: 29 Sept. 1995 by Eric THIEBAUT. (Modified slightly by DHM) Interpreted function, defined at i/string.i line 154
sech
sech(x) csch(x) returns the hyperbolic secant (1/cosh) or cosecant (1/sinh) of its argument, without overflowing for large x. Interpreted function, defined at i0/std.i line 614SEE ALSO: sinh, cosh, tanh, asinh, acosh, atanh
series_n
series_n(r, s) returns the minimum number n of terms required for the geometric series 1 + r + r^2 + r^3 + ... + r^n = s to reach at least the given value s. An alternate viewpoint is that n is the minimum number of terms required to achieve the sum s, with a ratio no larger than r. Returns 0 if r<1 and s>1/(1-r), or if s<1. The routine makes the most sense for r>1 and s substantially greater than 1. The intended use is to determine the minimum number of zones required to span a given thickness t with a given minimum zone size z, and maximum taper ratio r (assumed >1 here): n= series_n(r, t/z); With this n, you have the option of adjusting r or z downwards (using series_r or series_s, respectively) to achieve the final desired zoning. R or S or both may be arrays, as long as they are conformable. Interpreted function, defined at i/series.i line 127SEE ALSO: series_s, series_r
series_r
series_r(s, n) returns the ratio r of the finite geometric series, given the sum s: 1 + r + r^2 + r^3 + ... + r^n = s Using n<0 will return the the reciprocal of n>0 result, that is, series_r(s, -n) == 1.0/series_r(s, n) If n==0, returns s-1 (the n==1 result). S or N or both may be arrays, as long as they are conformable. Interpreted function, defined at i/series.i line 51SEE ALSO: series_s, series_n
series_s
series_s(r, n) returns the sum s of the finite geometric series 1 + r + r^2 + r^3 + ... + r^n Using n<0 is equivalent to using the reciprocal of r, that is, series_s(r, -n) == series_s(1./r, n) R or N or both may be arrays, as long as they are conformable. Interpreted function, defined at i/series.i line 10SEE ALSO: series_r, series_n
set3_object
set3_object, drawing_function, _lst(arg1,arg2,...) set up to trigger a call to draw3, adding a call to the 3D display list of the form: DRAWING_FUNCTION, _lst(ARG1, ARG2, ...) When draw3 calls DRAWING_FUNCTION, the external variable _draw3 will be non-zero, so DRAWING_FUNCTION can be written like this: func drawing_function(arg1,arg2,...) { require, "pl3d.i"; if (_draw3) { list= arg1; arg1= _nxt(list); arg2= _nxt(list); ... ...SEE ALSO: get3_xy, get3_light, sort3d... ... ... return; } ... ... ... ... set3_object, drawing_function, _lst(arg1,arg2,...); } Interpreted function, defined at i/pl3d.i line 630
set_blocksize
set_blocksize, file, blocksize sets smallest cache block size for FILE to BLOCKSIZE. BLOCKSIZE is rounded to the next larger number of the form 4096*2^n if necessary; cache blocks for this file will be multiples of BLOCKSIZE bytes long. The default BLOCKSIZE is 0x4000 (16 KB). Builtin function, documented at i0/std.i line 3230SEE ALSO: openb, updateb, createb, save, restore, _read, _write
set_filesize
set_filesize, file, filesize sets the new family member threshhold for FILE to FILESIZE. Whenever a new record is added (see add_record), if the current file in the FILE family has at least one record and the new record would cause the current file to exceed FILESIZE bytes, a new family member will be created to hold the new record. Note that set_filesize must be called after the first call to add_record. The default FILESIZE is 0x800000 (8 MB). Builtin function, documented at i0/std.i line 3239SEE ALSO: openb, updateb, createb, add_record
set_idler
set_idler, idler_function sets the idler function to IDLER_FUNCTION. Instead of waiting for keyboard input when all its tasks are finished, the interpreter will invoke IDLER_FUNCTION with no arguments. The idler function is normally invoked only once, so input from the keyboard resumes after one call to the idler. Of course, an idler is free to call set_idler again before it returns, which will have the effect of calling that function in a loop. Builtin function, documented at i0/std.i line 3534SEE ALSO: batch
set_path
set_path, "dir1:dir2:dir3:..." or set_path sets the include file search path to the specified list of directories. The specified directories are searched left to right for include files specified as relative file names in #include directives, or to the include or require functions. If the argument is omitted, restores the default search path, ".:~/yorick:~/Yorick:Y_SITE/i:Y_SITE/contrib:Y_SITE/i0:Y_HOME/lib", where y_site is the main Yorick directory for this site. The Y_LAUNCH directory is the directory which contains the executable; this directory is omitted if it is the same as Y_SITE. Only the "end user" should ever call set_path, and then only in his or her custom.i file, for the purpose of placing a more elaborate set of personal directories containing Yorick procedures. For example, if someone else maintains Yorick code you use, you might put their ~/yorick on your include path. Builtin function, documented at i0/std.i line 219SEE ALSO: Y_LAUNCH, Y_SITE, include, require, get_path
set_primitives
set_primitives, file, prims Return the primitive data types for FILE as an array of 32 integers. Versions for particular machines are defined in prmtyp.i, and can be accessed using functions like sun_primitives or i86_primitives. See __xdr for a complete list. The format is: [size, align, order] repeated 6 times for char, short, int, long, float, and double, except that char align is always 1, so result(2) is the structure alignment (see struct_align). [sign_address, exponent_address, exponent_bits, mantissa_address, mantissa_bits, mantissa_normalization, exponent_bias] repeated twice for float and double. See the comment at the top of prmtyp.i for an explanation of these fields. the total number of items is thus 3*6+7*2=32. Interpreted function, defined at i0/std.i line 2976SEE ALSO: get_primitives, createb, __xdr, __i86
set_site
set_site Builtin function, documented at i0/std.i line 256
set_style
set_style, landscape, systems, legends, clegends set the detailed style of the current drawing. The arguments are all inputs, having the same meanings as for get_style (which see). All arguments are required, so you may need to call get_style as a starting point, if you only want to make a few changes. See the Y_SITE/g/work.gs and the other .gs files for examples of reasonable values to choose. Calling set_style destroys anything that was plotted in the window, like the style= keyword of the window command. Interpreted function, defined at i/style.i line 70SEE ALSO: get_style, read_style, write_style
set_tolerances
set_tolerances() or old_tols= set_tolerances([tol1, tol2, lost_tol]) returns the current tolerances for the ray tracking. Initially, these are [1.e-3, 1.e-6, 0.0]. In the second form, sets new tolerances. If any of TOL1, TOL2, or LOST_TOL is zero, that tolerance is restored to its default value. If TOL1 is less than zero, the root polishing operation which requires TOL1 and TOL2 is not done at all. Builtin function, documented at i0/drat.i line 1276SEE ALSO: track_rays, integ_flat, integ_linear, streak, snap
set_vars
set_vars, file, names or set_vars, file, nonrec_names, rec_names Change the names of the variables in FILE to NAMES. If the file has record variables, you can use the second form to change the record variable names. Either of the two lists may be nil to leave those names unchanged, but if either is not nil, it must be a 1D array of strings whose length exactly matches the number of that type of variable actually present in the file. Builtin function, documented at i0/std.i line 3267SEE ALSO: openb, updateb, has_records, get_vars
setz3
setz3, zc Set the camera position to z=ZC (x=y=0) in the viewer's coordinate system. If ZC is nil, set the camera to infinity (default). Interpreted function, defined at i/pl3d.i line 113SEE ALSO: rot3, orient3, undo3, save3, restore3, light3
sgi64_primitives
sgi64_primitives, file sets FILE primitive data types to be native to 64-bit SGI workstations. Interpreted function, defined at i0/std.i line 2897
shock
sound Set up the initial conditions for evolve to launch a strong wave, which steepens into a shock as it propagates. Interpreted function, defined at i/demo1.i line 76SEE ALSO: sound, evolve
sign
sign(x) returns algebraic sign of it argument, or closest point on the unit circle for complex x. Guaranteed that x==sign(x)*abs(x). sign(0)==+1. Builtin function, documented at i0/std.i line 729SEE ALSO: abs
silo_cd
silo_cd, dirname change current silo directory to DIRNAME, which may contain .. or . constructs as a UNIX pathname accepts silo= keyword to operate on a silo file other than the current silo file Interpreted function, defined at i/silo.i line 69SEE ALSO: silo_ls, silo_var, silo_open, silo_close
silo_close
silo_close close current silo file Interpreted function, defined at i/silo.i line 55SEE ALSO: silo_cd, silo_ls, silo_var, silo_open
silo_ls
silo_ls or silo_ls, dirname or itemlist= silo_ls(dirname) or itemlist= silo_ls(dirname, fulldirname) list current silo directory or DIRNAME if called as a function, returns a 1D array of strings beginning with ".", and optionally returns FULLDIRNAME, which is the full path name of the directory listed - the individual items in the list do not include the directory path - subdirectory names end with "/", so you can find them using strpart(itemlist,0:0)=="/" accepts silo= keyword to operate on a silo file other than the current silo file Interpreted function, defined at i/silo.i line 105SEE ALSO: silo_ls, silo_cd, silo_open, silo_close
silo_open
silo_open, filename or silo= silo_open(filename) open FILENAME for later use with silo_... functions There is a single current silo file, which is opened and set by the first form. The other silo_... functions normally operate on this current file, but also accept a silo= keyword, which is a list returned by the second calling sequence for silo_open. Interpreted function, defined at i/silo.i line 6SEE ALSO: silo_cd, silo_ls, silo_var, silo_close
silo_simplify
silo_simplify Interpreted function, defined at i/silo.i line 156
silo_var
var= silo_var(varname) return silo variable VARNAME accepts silo= keyword to operate on a silo file other than the current silo file Interpreted function, defined at i/silo.i line 92SEE ALSO: silo_ls, silo_cd, silo_open, silo_close
simpson
integral= simpson(function, a, b) or integral= simpson(function, a, b, epsilon) returns the integral of FUNCTION(x) from A to B. If EPSILON is given, Simpson's rule is refined until that fractional accuracy is obtained. EPSILON defaults to 1.e-6. If the notvector= keyword is supplied and non-zero, then FUNCTION may not be called with a list of x values to return a list of results. By default, FUNCTION is assumed to be a vector function. If the function is very smooth, romberg may work better. Interpreted function, defined at i/romberg.i line 58SEE ALSO: romberg, max_doublings
sin
sin(x) cos(x) tan(x) returns the sine, cosine, or tangent of its argument, which is in radians. Builtin function, documented at i0/std.i line 565SEE ALSO: asin, acos, atan
sinh
sinh(x) cosh(x) tanh(x) returns the hyperbolic sine, cosine, or tangent of its argument. Builtin function, documented at i0/std.i line 604SEE ALSO: sech, csch, asinh, acosh, atanh
sizeof
sizeof(object) returns the size of the object in bytes, or 0 for non-array objects. sizeof(structure_definition) returns the number of bytes per instance. sizeof(binary_file) returns the file size in bytes. Builtin function, documented at i0/std.i line 431SEE ALSO: dimsof, typeof, structof, numberof
slice2
slice2, plane, nverts, xyzverts or slice2, plane, nverts, xyzverts, values Slice a polygon list, retaining only those polygons or parts of polygons on the positive side of PLANE, that is, the side where xyz(+)*PLANE(+:1:3)-PLANE(4) > 0.0. The NVERTS, XYZVERTS, and VALUES arrays serve as both input and output, and have the meanings of the return values from the slice3 function. It is legal to omit the VALUES argument (e.g.- if there is no fcolor function). In order to plot two intersecting slices, one could slice (for example) the horizontal plane twice (slice2x) - first with the plane of the vertical slice, then with minus that same plane. Then, plot first the back part of the slice, then the vertical slice, then the front part of the horizontal slice. Of course, the vertical plane could be the one to be sliced, and "back" and "front" vary depending on the view point, but the general idea always works. Interpreted function, defined at i/slice3.i line 880SEE ALSO: slice3, plane3, slice2x, slice2_precision
slice2x
slice2, plane, nverts, values, xyzverts Slice a polygon list, retaining only those polygons or parts of polygons on the positive side of PLANE, that is, the side where xyz(+)*PLANE(+:1:3)-PLANE(4) > 0.0. The NVERTS, VALUES, and XYZVERTS arrays serve as both input and output, and have the meanings of the return values from the slice3 function. Interpreted function, defined at i/slice3.i line 863SEE ALSO: slice2, slice2_precision
slice3
slice3, m3, fslice, nverts, xyzverts or color_values= slice3(m3, fslice, nverts, xyzverts, fcolor) or color_values= slice3(m3, fslice, nverts, xyzverts, fcolor, 1) slice the 3D mesh M3 using the slicing function FSLICE, returning the lists NVERTS and XYZVERTS. NVERTS is the number of vertices in each polygon of the slice, and XYZVERTS is the 3-by-sum(NVERTS) list of polygon vertices. If the FCOLOR argument is present, the values of that coloring function on the polygons are returned as the value of the slice3 function (numberof(color_values) == numberof(NVERTS) == number of polygons). If the slice function FSLICE is a function, it should be of the form: func fslice(m3, chunk) returning a list of function values on the specified chunk of the mesh m3. The format of chunk depends on the type of m3 mesh, so you should use only the other mesh functions xyz3 and getv3 which take m3 and chunk as arguments. The return value of fslice should have the same dimensions as the return value of getv3; the return value of xyz3 has an additional first dimension of length 3. If FSLICE is a list of 4 numbers, it is taken as a slicing plane with the equation FSLICE(+:1:3)*xyz(+)-FSLICE(4), as returned by plane3. If FSLICE is a single integer, the slice will be an isosurface for the FSLICEth variable associated with the mesh M3. In this case, the keyword value= must also be present, representing the value of that variable on the isosurface. If FCOLOR is nil, slice3 returns nil. If you want to color the polygons in a manner that depends only on their vertex coordinates (e.g.- by a 3D shading calculation), use this mode. If FCOLOR is a function, it should be of the form: func fcolor(m3, cells, l, u, fsl, fsu, ihist) returning a list of function values on the specified cells of the mesh m3. The cells argument will be the list of cell indices in m3 at which values are to be returned. l, u, fsl, fsu, and ihist are interpolation coefficients which can be used to interpolate from vertex centered values to the required cell centered values, ignoring the cells argument. See getc3 source code. The return values should always have dimsof(cells). If FCOLOR is a single integer, the slice will be an isosurface for the FCOLORth variable associated with the mesh M3. If the optional argument after FCOLOR is non-nil and non-zero, then the FCOLOR function is called with only two arguments: func fcolor(m3, cells) Interpreted function, defined at i/slice3.i line 203SEE ALSO: mesh3, plane3, xyz3, getv3, getc3, slice2, plfp
snap
snap(f, rays) or snap(f, rays, slimits) returns the time-integrated specific intensity for the rad-hydro problem dumped in file F, on the specified RAYS, with the specified limits SLIMITS on the transport integrals. The first dimension of RAYS may be length 3, 5, or 6 to represent the ray(s) in TDG/DIRT coordinates (x,y,theta), "best" coordinates (x,y,z,theta,phi), or internal coordinates (cos,sin,y,z,x,r), respectively. The remaining dimensions of RAYS, if any, will be called "nrays" below. The SLIMITS parameter, if present, is the value of the s-coordinate -- position along the ray -- at which to start and stop the integration of the transport equation. SLIMITS may be nil, a 1-D array of length 2, or a 2-by-nrays array. Each component of SLIMITS is [s_start, s_stop]; if s_stopSEE ALSO: reset_options, streak, streak_save, integ_flat, integ_linear,line 195
streak_times, form_rays, best_rays, dirt_rays, internal_rays
snap_worker
snap_worker(transp, selfem, time) The snap function actually works by replacing the drat_compress with snap_worker. See the source for snap in drat.i for details. Interpreted function, defined at i0/drat.i line 274
softbc
softbc Interpreted function, defined at i/demo1.i line 104
solar_system
xyz = moon(time) return position XYZ of the moon relative to center of earth at TIME; the XYZ has leading dimension 3; x is along the vernal equinox, z is ecliptic north. Corrections due to Schlyter (see sch_planets) are applied. Claimed accurate to under 1 arc minute over some reasonable time. TIME is in days since 0/Jan/00 (that is, 0000 UT 31/Dec/99). This is 1.5 days earlier than the J2000 epoch. Interpreted function, defined at i/kepler.i line 342SEE ALSO: solar_system, sch_moon, kepler
solve
solve Interpreted function, defined at i/demo4.i line 45
sort
sort(x) or sort(x, which) returns an array of longs with dimsof(X) containing index values such that X(sort(X)) is a monotonically increasing array. X can contain integer, real, or string values. If X has more than one dimension, WHICH determines the dimension to be sorted. The default WHICH is 1, corresponding to the first dimension of X. WHICH can be non-positive to count dimensions from the end of X; in particular a WHICH of 0 will sort the final dimension of X. WARNING: The sort function is non-deterministic if some of the values of X are equal, because the Quick Sort algorithm involves a random selection of a partition element. For information on sorting with multiple keys (and on making sort deterministic), type the following: #include "msort.i" help, msort Builtin function, documented at i0/std.i line 1208SEE ALSO: median, digitize, interp, integ, histogram
sort3d
sort3d(z, npolys, &list, &vlist) given Z and NPOLYS, with numberof(Z)==sum(npolys), return LIST and VLIST such that Z(VLIST) and NPOLYS(LIST) are sorted from smallest average Z to largest average Z, where the averages are taken over the clusters of length NPOLYS. Within each cluster (polygon), the cyclic order of Z(VLIST) remains unchanged, but the absolute order may change. This sorting order produces correct or nearly correct order for a plfp command to make a plot involving hidden or partially hidden surfaces in three dimensions. It works best when the polys form a set of disjoint closed, convex surfaces, and when the surface normal changes only very little between neighboring polys. (If the latter condition holds, then even if sort3d mis-orders two neighboring polys, their colors will be very nearly the same, and the mistake won't be noticeable.) A truly correct 3D sorting routine is impossible, since there may be no rendering order which produces correct surface hiding (some polys may need to be split into pieces in order to do that). There are more nearly correct algorithms than this, but they are much slower. Interpreted function, defined at i/pl3d.i line 880SEE ALSO: get3_xy
sound
sound Set up the initial conditions for evolve to launch a weak sound wave. Interpreted function, defined at i/demo1.i line 62SEE ALSO: shock, evolve
span
span(start, stop, n) or span(start, stop, n, which) returns array of N doubles equally spaced from START to STOP. The START and STOP arguments may themselves be arrays, as long as they are conformable. In this case, the result will have one dimension of length N in addition to dimsof(START, STOP). By default, the result will be N-by-dimsof(START, STOP), but if WHICH is specified, the new one of length N will be the WHICHth. WHICH may be non-positive to position the new dimension relative to the end of dimsof(START, STOP); in particular WHICH of 0 produces a result with dimensions dimsof(START, STOP)-by-N. Builtin function, documented at i0/std.i line 1094SEE ALSO: spanl, indgen, array
spanl
spanl(start, stop, n) or spanl(start, stop, n, which) similar to the span function, but the result array have N points spaced at equal ratios from START to STOP (that is, equally spaced logarithmically). See span for discussion of WHICH argument. START and STOP must have the same algebraic sign for this to make any sense. Interpreted function, defined at i0/std.i line 1110SEE ALSO: span, indgen, array
spann
spann(zmin, zmax, n) return no more than N equally spaced "nice" numbers between ZMIN and ZMAX. Interpreted function, defined at i0/graph.i line 1744SEE ALSO: span, spanl, plc, plfc
spin3
spin3 or spin3, nframes or spin3, nframes, axis Spin the current 3D display list about AXIS over NFRAMES. Keywords tlimit= the total time allowed for the movie in seconds (default 60), dtmin= the minimum allowed interframe time in seconds (default 0.0), bracket_time= (as for movie function in movie.i) The default AXIS is [-1,1,0] and the default NFRAMES is 30. Interpreted function, defined at i/pl3d.i line 945SEE ALSO: rot3
spline
dydx= spline(y, x) -or- yp= spline(dydx, y, x, xp) -or- yp= spline(y, x, xp) computes the cubic spline curve passing through the points (X, Y). With two arguments, Y and X, spline returns the derivatives DYDX at the points, an array of the same length as X and Y. The DYDX values are chosen so that the piecewise cubic function returned by the four argument call will have a continuous second derivative. The X array must be strictly monotonic; it may either increase or decrease. The values Y and the derivatives DYDX uniquely determine a piecewise cubic function, whose value is returned in the four argument form. In this form, spline is analogous to the piecewise linear interpolator interp; usually you will regard it as a continuous function of its fourth argument, XP. The first argument, DYDX, will normally have been computed by a previous call to the two argument spline function. However, this need not be the case; another DYDX will generate a piecewise cubic function with continuous first derivative, but a discontinuous second derivative. For XP outside the extreme values of X, spline is linear (if DYDX1 or DYDX0 keywords were specified, the function will NOT have continuous second derivative at the endpoint). The XP array may have any dimensionality; the result YP will have the same dimensions as XP. If you only want the spline evaluated at a single set of XP, use the three argument form. This is equivalent to: yp= spline(spline(y,x), y, x, xp) The keywords DYDX1 and DYDX0 can be used to set the values of the returned DYDX(1) and DYDX(0) -- the first and last values of the slope, respectively. If either is not specified or nil, the slope at that end will be chosen so that the second derivative is zero there. The function tspline (tensioned spline) gives an interpolation function which lies between spline and interp, at the cost of requiring you to specify another parameter (the tension). Interpreted function, defined at i/spline.i line 10SEE ALSO: interp, tspline
split_bytscl
split_bytscl(x, 0) or split_bytscl(x, 1) as bytscl function, but scale to the lower half of a split palette (0-99, normally the color scale) if the second parameter is zero or nil, or the upper half (100-199, normally the gray scale) if the second parameter is non-zero. Interpreted function, defined at i/slice3.i line 1253SEE ALSO: split_palette
split_palette
split_palette or split_palette, "palette_name.gp" split the current palette or the specified palette into two parts; colors 0 to 99 will be a compressed version of the original, while colors 100 to 199 will be a gray scale. Interpreted function, defined at i/slice3.i line 1226SEE ALSO: pl3tree, split_bytscl
sprime
ypprime= sprime(dydx, y, x, xp) computes the derivative of the cubic spline curve passing through the points (X, Y) at the points XP. The DYDX values will have been computed by a previous call to SPLINE, and are chosen so that the piecewise cubic function returned by the four argument call will have a continuous second derivative. The X array must be strictly monotonic; it may either increase or decrease. Interpreted function, defined at i/spline.i line 309
sqrt
sqrt(x) returns the square root of its argument. Builtin function, documented at i0/std.i line 696SEE ALSO: abs
sread
sread Builtin function, documented at i0/std.i line 1994SEE read
strcase
strcase(upper, string_array) or strcase, upper, string_array returns STRING_ARRAY with all strings converted to upper case if UPPER is non-zero. If UPPER is zero, result is lower case. (For characters >=0x80, the case conversion assumes the ISO8859-1 character set.) Called as a subroutine, strcase converts STRING_ARRAY in place. Builtin function, documented at i0/std.i line 1463SEE ALSO: string, strlen, strpart, strglob, strfind, strgrep, strword
strchar
strchar(string_array) or strchar(char_array) converts STRING_ARRAY to an array of characters, or CHAR_ARRAY to an array of strings. The return value is always a 1D array, except in the second form if CHAR_ARRAY contains only a single string, the result will be a scalar string. Each string is stored in sequence including its trailing '\0' character, with any string(0) elements treated as if they were "". Going in the opposite direction, a '\0' before any non-'\0' characters produces string(0), so that "" can never be an element of the result, and if the final char (of the leading dimension) is not '\0', an implicit '\0' is assumed beyond the end of the input char array. For example, strchar(["a","b","c"]) --> ['a','\0','b','\0','c','\0'] strchar([['a','\0','b'],['c','\0','\0']]) --> ["a","b","c",string(0)] The string and pointer data types themselves also convert between string and char data, avoiding the quirks of strchar. Builtin function, documented at i0/std.i line 1385SEE ALSO: string, strpart, strword, strfind
strchr
strchr -- get first/last index of a character in a string SYNOPSIS: i = strchr(s, c) i = strchr(s, c, last=1) DIAGNOSTIC: returns 0 if character C is not found in string S. HISTORY: October 27, 1995 by Eric THIEBAUT. DHM modified for yorick-1.6 23/Jan/05 ********** DEPRECATED ************** new code should use strfind directly Interpreted function, defined at i/string.i line 114SEE ALSO: strmatch
streak
streak(f, rays) or streak(f, rays, slimits) returns the transparency and self-emission as functions of time for the rad-hydro problem dumped in file F, on the specified RAYS, with the specified limits SLIMITS on the transport integrals. The first dimension of RAYS may be length 3, 5, or 6 to represent the ray(s) in TDG/DIRT coordinates (x,y,theta), "best" coordinates (x,y,z,theta,phi), or internal coordinates (cos,sin,y,z,x,r), respectively. The remaining dimensions of RAYS, if any, will be called "nrays" below. The SLIMITS parameter, if present, is the value of the s-coordinate -- position along the ray -- at which to start and stop the integration of the transport equation. SLIMITS may be nil, a 1-D array of length 2, or a 2-by-nrays array. Each component of SLIMITS is [s_start, s_stop]; if s_stopSEE ALSO: reset_options, snap, streak_save, integ_flat, integ_linear,line 40
streak_times, form_rays, best_rays, dirt_rays, internal_rays,
apply_funcs
streak_save
streak_save, outname, f, rays or streak_save, outname, f, rays, slimits or streak_save, outfile, f, rays, slimits is the same as the streak function, except that the results of the transport calculation are placed into a PDB file called OUTNAME, instead of being accumulated in memory. All of the options for the streak function are available, except for drat_compress (which is set to streak_saver). If the first argument is OUTFILE, a file variable instead of a file name, then that file is used for output. You can create OUTFILE and add static variables to it with save (but do NOT call add_record) which streak_save otherwise wouldn't know about. The output file has history records at the same times as the input file. Each record contains "time" (a double scalar), and the two arrays "transp", the transparency (between 0 and 1), and "selfem", the self emission (which has the same units as ekap in the file F). The dimensions of transp and selfem are ngroup-by-2-by-nrays (where nrays represents zero or more dimensions, copied from the RAYS input array). The RAYS and SLIMITS inputs are placed into the output file as non-record variables, and any variables in the drat_static option are copied form F to the output file. The gb and gav variables are copied from F into the output file as well. If the drat_glist option is present, that is stored in the output file also. OPTIONS: all options available for streak except drat_compress, drat_gb, drat_gav, drat_static Interpreted function, defined at i0/drat.i line 297SEE ALSO: streak, snap
streak_saver
streak_saver(transp, selfem, time) The streak_save function actually works by replacing the drat_compress with streak_saver. See the source for streak_saver in drat.i for details. Interpreted function, defined at i0/drat.i line 368
streak_times
streak_times(f) returns the times from file F whic lie between the optional drat_start and drat_stop. Interpreted function, defined at i0/drat.i line 899SEE ALSO: drat_start, drat_stop
streplace
streplace(string_array, start_end, to_string) replaces the part(s) START_END of STRING_ARRAY by TO_STRING. The leading dimension of START_END must be a multiple of 2, while any trailing dimensions must be conformable with the dimensions of STRING_ARRAY. The TO_STRING must be conformable with STRING_ARRAY if the leading dimension of START_END is 2. An element of START_END may represent "no match" (for example, when endSEE ALSO: string, strfind, strgrep, strword, strpart2, then TO_STRING must have a leading dimension conformable with n (that is, of length either 1 or n). In this case, streplace performs multiple replacements within each string. In order for multiple replacements to be meaningful, the START_END must be disjoint and sorted, as returned by strfind or strgrep with a repeat count, or by strword. In other words, the first dimension of START_END should be non-decreasing, except where end "Goodbye, world!" streplace(s,[0,5,7,7], ["Goodbye","cruel "]) --> "Goodbye, cruel world!" streplace(s,[0,5,7,7,12,13], ["Goodbye","cruel ","?"]) --> "Goodbye, cruel world?" streplace(s,[0,5,0,-1,12,13], ["Goodbye","cruel ","?"]) --> "Goodbye, world?" streplace([s,s],[0,5], ["Goodbye", "Good bye"]) --> ["Goodbye, world!", "Good bye, world!"] streplace([s,s],[0,5,7,7], [["Goodbye","cruel "], ["Good bye",""]]) --> ["Goodbye, cruel world!", "Good bye, world!"] Builtin function, documented at i0/std.i line 1858
strfind
strfind(pat, string_array) or strfind(pat, string_array, off) finds pattern PAT in STRING_ARRAY. Optional OFF is an integer array conformable with STRING_ARRAY or 0-origin offset(s) within the string(s) at which to begin the search(es). The return value is a [start,end] offset pair specifying the beginning and end of the first match, or [0,-1] if none, with trailing dimensions the same as the dimensions of STRING_ARRAY. This return value is suitable as an input to the strpart or streplace functions. The strfind function is the simpler string pattern matcher: strfind - just finds a literal pattern (possibly case insensitive) strgrep - matches a pattern containing complex regular expressions Additionally, the strglob function does filename wildcard matching. Keywords: n= (default 1) returns list of first n matches, so leading dimension of result will be 2*n case= (default 1) zero for case-insensitive search back= (default 0) non-zero for backwards search If back!=0 and n>1, the last match is listed as the last start-end pair, so the output pairs still appear in increasing order, and the first few may be 0,-1 to indicate no match. Examples: s = ["one two three", "four five six"] strfind("o",s) --> [[0,1], [1,2]] strfind(" t",s) --> [[3,5], [13,-1]] strfind(" t",s,n=2) --> [[3,5,7,9], [13,-1,13,-1]] strfind("e",s,n=2,back=1) --> [[11,12,12,13], [0,-1,8,9]] Builtin function, documented at i0/std.i line 1662SEE ALSO: string, strglob, strgrep, strword, strpart, streplace
strglob
strglob(pat, string_array) or strglob(pat, string_array, off) test if pattern PAT matches STRING_ARRAY. Optional OFF is an integer array conformable with STRING_ARRAY or 0-origin offset(s) within the string(s) at which to begin the search(es). The return value is an int with the same dimensions as STRING_ARRAY, 1 for a match, and 0 for no match. PAT can contain UNIX shell wildcard or "globbing" characters: matches any number of characters ? matches any single character [abcd] matches any single character in the list, which may contain ranges such as [a-z0-9A-Z] \c matches the character c (useful for c= a special character) (note that this is "\\c" in a yorick string) The strglob function is mostly intended for matching lists of file names. Note, in particular, that unlike strfind or strgrep, the entire string must match PAT. Keywords: case= (default 1) zero for case-insensitive search path= (default 0) 1 bit set means / must be matched by / 2 bit set means leading . must be matched by . esc= (default 1) zero means \ is not treated as an escape The underlying compiled routine is based on the BSD fnmatch function, contributed by Guido van Rossum. Examples: return all files in current directory with .pdb extension: d=lsdir("."); d(where(strglob("*.pdb", d))); return all subdirectories of the form "hackNN", case insensitive: d=lsdir(".",1); d(where(strglob("hack[0-9][0-9]", d, case=0))); Builtin function, documented at i0/std.i line 1622SEE ALSO: string, strfind, strgrep, strword, strpart, streplace
strgrep
strgrep(pat, string_array) or strgrep(pat, string_array, off) finds pattern PAT in STRING_ARRAY. Optional OFF is an integer array conformable with STRING_ARRAY or 0-origin offset(s) within the string(s) at which to begin the search(es). The return value is a [start,end] offset pair specifying the beginning and end of the first match, or [0,-1] if none, with trailing dimensions the same as the dimensions of STRING_ARRAY. This return value is suitable as an input to the strpart or streplace functions. The underlying compiled routine is based on the regexp package written by Henry Spencer (copyright University of Toronto 1986), slightly modified for yorick. PAT is a regular expression, simliar to the UNIX grep utility. Every "regular expression" syntax is slightly different; here is the syntax supported by strgrep: The following characters in PAT have special meanings: '[' followed by any sequence of characters followed by ']' is a "range", which matches any single one of those characters '^' first means to match any character NOT one in the sequence '-' in such a sequence indicates a range of characters (e.g.- "[A-Za-z0-9_]" matches any alphanumeric character or underscore, while "[^A-Za-z0-9_]" matches anything else) to include ']' in the sequence, place it first, to include '-' in the sequence, place it first or last (or first after a leading '^' in either case) Note that the following special characters lose their special meanings inside a range. '.' matches any single character '^' matches the beginning of the string (but no characters) '$' matches the end of the string (but no characters) (that is, ^ and $ serve to anchor a search so that it will only find a match at the beginning or end of the string) '\' (that is, a single backslash, which can only be entered into a yorick string by a double backslash "\\") followed by any single character eliminates any special meaning for that character, for example "\\." matches period, rather than any single character (its special meaning) '(' followed by a regular expression followed by ')' matches the regular expression, creating a sub-pattern, which is a type of atom (see below) '|' means "or"; it separates branches in a regular expression '*' after an atom matches 0 or more matches of the atom '+' after an atom matches 1 or more matches of the atom '?' after an atom matches 0 or 1 matches of the atom The definitions of "atom", "branch", and "regular expression" are: A "regular expression" (which is what PAT is) consists of zero or more "branches" separated by '|'; it matches anything that matches one of the branches. A "branch" consists of zero or more "pieces", concatenated; it matches a match for the first followed by a match for the second, etc. A "piece" is an "atom", optionally followed by '*', '+', or '?'; it matches the atom, or zero or more repetitions of the atom, as specified by the optional suffix. Finally, an "atom" is an ordinary single character, or a '\'-escaped single character (matching that character), or one of the special characters '.', '^', or '$', or a []-delimited range (matching any single character in the range), or a sub-pattern enclosed in () (matching the sub-pattern). A maximum of nine sub-patterns is allowed in PAT; these are numbered 1 through 9, in order of their opening '(' in PAT. This recursive definition of regular expressions often leads to ambiguities, both subtle and glaring. Here is Henry Spencer's synopsis of how his routines behave: ------------------------------------------------------------------- If a regular expression could match two different parts of the input string, it will match the one which begins earliest. If both begin in the same place but match different lengths, or match the same length in different ways, life gets messier, as follows. In general, the possibilities in a list of branches are considered in left-to-right order, the possibilities for `*', `+', and `?' are considered longest-first, nested constructs are considered from the outermost in, and concatenated constructs are considered leftmost- first. The match that will be chosen is the one that uses the earliest possibility in the first choice that has to be made. If there is more than one choice, the next will be made in the same manner (earliest possibility) subject to the decision on the first choice. And so forth. For example, `(ab|a)b*c' could match `abc' in one of two ways. The first choice is between `ab' and `a'; since `ab' is earlier, and does lead to a successful overall match, it is chosen. Since the `b' is already spoken for, the `b*' must match its last possibility -the empty string- since it must respect the earlier choice. In the particular case where no `|'s are present and there is only one `*', `+', or `?', the net effect is that the longest possible match will be chosen. So `ab*', presented with `xabbbby', will match `abbbb'. Note that if `ab*' is tried against `xabyabbbz', it will match `ab' just after `x', due to the begins-earliest rule. (In effect, the decision on where to start the match is the first choice to be made, hence subsequent choices must respect it even if this leads them to less-preferred alternatives.) ------------------------------------------------------------------- When PAT contains parenthesized sub-patterns, strgrep returns the [start,end] of the entire match by default, but you can also get the [start,end] of any or all of the sub-patterns using the sub= keyword (see below). If PAT does not contain any regular expression constructs, you should use the strfind function instead of strgrep. The strglob function, if appropriate, will also be faster than strgrep. Keywords: n= (default 1) returns list of first n matches, so leading dimension of result will be 2*n sub=[n1,n2,...] is a list of the sub-pattern [start,end] pairs to be returned. Thus 0 is the whole PAT, 1 is the first parenthesized sub-pattern, and so on. The leading dimension of the result will be 2*numberof(sub)*n. The sequence n1,n2,... must strictly increase: n1SEE ALSO: string, strglob, strfind, strword, strpart, streplace[0,13] strgrep("(Hello|Goodbye), *([a-z]*|[A-Z]*)!", s, sub=[1,2]) --> [0,5,7,12] strgrep("(Hello|Goodbye), *([a-z]*|[A-Z]*)!", s, sub=[0,2]) --> [0,13,7,12] strgrep("(Hello|Goodbye), *(([A-Z]*)|([a-z]*))!", s, sub=[0,2,3,4]) --> [0,13,7,12,13,-1,7,12] Builtin function, documented at i0/std.i line 1698
strlen
strlen(string_array) returns an long array with dimsof(STRING_ARRAY) containing the lengths of the strings. Both string(0) and "" have length 0. Builtin function, documented at i0/std.i line 1378SEE ALSO: string, strchar, strcase, strpart, strfind, strword
strmatch
strmatch(string_array, pattern) or strmatch(string_array, pattern, case_fold) or strmatch(string_array, pattern, case_fold) returns an int array with dimsof(STRING_ARRAY) with 0 where PATTERN was not found in STRING_ARRAY and 1 where it was found. If CASE_FOLD is specified and non-0, the pattern match is insensitive to case, that is, an upper case letter will match the same lower case letter and vice-versa. (Consider using strfind directly.) Interpreted function, defined at i0/std.i line 1840SEE ALSO: string, strfind, strpart, strlen
strpart
strpart(string_array, m:n) or strpart(string_array, start_end) or strpart, string_array, start_end returns another string array with the same dimensions as STRING_ARRAY which consists of characters M through N of the original strings. M and N are 1-origin indices; if M is omitted, the default is 1; if N is omitted, the default is the end of the string. If M or N is non-positive, it is interpreted as an index relative to the end of the string, with 0 being the last character, -1 next to last, etc. Finally, the returned string will be shorter than N-M+1 characters if the original doesn't have an Mth or Nth character, with "" (note that this is otherwise impossible) if neither an Mth nor an Nth character exists. A 0 is returned for any string which was 0 on input. In the second form, START_END is an array of [start,end] indices. A single pair [start,end] is equivalent to the range start+1:end, that is, start is the index of the character immediately before the substring (which is to say start is the number of characters skipped at the beginning of the string). If endSEE ALSO: string, strcase, strlen, strfind, strwordlength, or if the original string is string(0), strpart returns string(0); otherwise, if end==start, strpart returns "". However, the START_END array may have any additional dimensions (beyond the leading dimension of length 2) which are conformable with the dimensions of the STRING_ARRAY. The result will be a string array with dimensions dimsof(STRING_ARRAY,START_END(1,..)). Furthermore, the leading dimension of START_END may have any even length, say 2*n, in which case the leading dimension of the result will be n. For example, strpart(a, [s1,e1,s2,e2,s3,e3,s4,e4]) is equivalent to (or shorthand for) strpart(a(-,..), [[s1,e1],[s2,e2],[s3,e3],[s4,e4]])(1,..) In the third form, called a subroutine, strpart operates on STRING_ARRAY in place. In this case START_END must have leading dimension of length 2, although it may have trailing dimensions as usual. Examples: strpart("Hello, world!", 4:6) --> "lo," strpart("Hello, world!", [3,6]) --> "lo," -it may help to think of [start,end] as the 0-origin offset of a "cursor" between the characters of the string strpart("Hello, world!", [3,3]) --> "" strpart("Hello, world!", [3,2]) --> string(0) strpart("Hello, world!", [3,20]) --> string(0) strpart("Hello, world!", [3,6,7,9]) --> ["lo,","wo"] strpart(["one","two"], [[1,2],[0,1]]) --> ["n","t"] strpart(["one","two"], [1,2,0,1]) --> [["n","o"],["w","t"]] Builtin function, documented at i0/std.i line 1406
strtok
strtok(string_array, delim) or strtok(string_array) or strtok(string_array, delim, n) strips the first token off of each string in STRING_ARRAY. A token is delimited by any of the characters in the string DELIM. If DELIM is blank, nil, or not given, the default DELIM is " \t\n" (blanks, tabs, or newlines). The result is a string array ts with dimensions 2-by-dimsof(STRING_ARRAY); ts(1,) is the first token, and ts(2,) is the remainder of the string (the character which terminated the first token will be in neither of these parts). The ts(2,) part will be 0 (i.e.- the null string) if no more characters remain after ts(1,); the ts(1,) part will be 0 if no token was present. A STRING_ARRAY element may be 0, in which case (0, 0) is returned for that element. With yorick-1.6, strtok has been extended to accept multiple delimiter sets DELIM for successive words, and a repeat count N for the final DELIM set. The operation is the same as for strword, except that the N<=0 special cases are illegal, and if DELIM consists of only a single set, N=2 is the default rather than N=1. The dimensions of the return value are thus min(2,numberof(DELIM)+N-1)-by-dimsof(STRING_ARRAY). Interpreted function, defined at i0/std.i line 1589SEE ALSO: string, strword, strmatch, strpart, strlen
strtolower
strtolower -- convert a string to lower case letters SYNOPSIS: s2 = strtolower(s) HISTORY: October 10, 1995 by Eric THIEBAUT. DHM modified for yorick-1.6 23/Jan/05 ********** DEPRECATED ************** new code should use strcase directly Interpreted function, defined at i/string.i line 95SEE ALSO: strtoupper
strtoupper
strtoupper -- convert a string to upper case letters SYNOPSIS: s2 = strtoupper(s) HISTORY: October 10, 1995 by Eric THIEBAUT. DHM modified for yorick-1.6 23/Jan/05 ********** DEPRECATED ************** new code should use strcase directly Interpreted function, defined at i/string.i line 78SEE ALSO: strtolower
strtrim
strtrim(string_array) or strtrim(string_array, which) or strtrim, string_array, which returns STRING without leading and/or trailing blanks. WHICH=1 means to trim leading blanks only, WHICH=2 trims trailing blanks only, while WHICH=3 (the default) trims both leading and trailing blanks. Called as a subroutine, strtrim performs this operation in place. The blank= keyword, if present, is a list of characters to be considered "blanks". Use blank=[lead_delim,trail_delim] to get different leading and trailing "blanks" definitions. By default, blank=" \t\n". (See strword for more about delim syntax.) Interpreted function, defined at i0/std.i line 1554SEE ALSO: string, strpart, strword
struct_align
struct_align, file, alignment in binary file FILE, align new struct members which are themselves struct instances to begin at a byte address which is a multiple of ALIGNMENT. (This affects members declared explicitly by add_member, as well as implicitly by save or add_variable.) If ALIGNMENT is <=0, returns to the default for this machine. The struct alignment is in addition to the alignment implied by the most restrictively aligned member of the struct. Most machines want ALIGNMENT of 1. Builtin function, documented at i0/std.i line 3413SEE ALSO: add_member
structof
structof(object) returns the data type of OBJECT, or nil for non-array OBJECTs. Use typeof(object) to get the ASCII name of a the data type. Builtin function, documented at i0/std.i line 368SEE ALSO: typeof, dimsof, numberof, sizeof, nameof
strword
strword(string_array) or strword(string_array, delim) or strword(string_array, delim, n) or strword(string_array, off, delim, n) scans to the first character in STRING_ARRAY which is not in the DELIM list. DELIM defaults to " \t\n", that is, whitespace. The return value is a [start,end] offset pair, with trailing dimensions matching the dimensions of the given STRING_ARRAY. Note that this return value is suitable for use in the strpart or streplace functions. If the first character of DELIM is "^", the sense is reversed; strword scans to the first character in DELIM. (Except that if DELIM is the single character "^", it has its usual meaning.) Also, a "-" which is not the first (or second after "^") or last character of DELIM indicates a range of characters. Finally, if DELIM is "" or string(0), the scan stops immediately, since the first character (no matter what it is) is not in DELIM. Furthermore, DELIM can be a list of delimiter sets, where each element of the list delimits a new word, so the return value will be [start1,end1, ..., startN,endN], where N=numberof(DELIM), and start1 is the offset of the first character not in DELIM(1), characters with offset between end1 and start2 are in DELIM(2), characters with offset between end2 and start3 are in DELIM(3), and so on. If endM is the length of the string for some MSEE ALSO: string, strlen, strpart, strfind, strtok, strtrim[2,15] strword("Hello, world!") --> [0,13] strword("Hello, world!", , 2) --> [0,6,7,13] strword("Hello, world!", , -2) --> [0,6] strword("Hello, world!", ".!, \t\n", -2) --> [0,5] strword("Hello, world!", [string(0), ".!, \t\n"], 0) --> [0,12] strword("Hello, world!", "A-Za-z", 2) --> [5,7,12,13] strword("Hello, world!", "^A-Za-z", 2) --> [0,5,7,13] strword("Hello, world!", "^A-Za-z", 3) --> [0,5,7,12,13,-1] strword(" Hello, world!", [" \t\n",".!, \t\n"]) --> [2,7,9,15] strword(" Hello, world!", [" \t\n",".!, \t\n"], 2) --> [2,7,9,14,15,-1] Builtin function, documented at i0/std.i line 1474
sum
sum(x) returns the scalar sum of all elements of its array argument. If X is a string, concatenates all elements. Builtin function, documented at i0/std.i line 821SEE ALSO: avg, min, max
sun3_primitives
sun3_primitives, file sets FILE primitive data types to be native to Sun-2 or Sun-3. Interpreted function, defined at i0/std.i line 2873
sun_primitives
sun_primitives, file sets FILE primitive data types to be native to Sun, HP, IBM, etc. Interpreted function, defined at i0/std.i line 2865
swrite
swrite Builtin function, documented at i0/std.i line 2144SEE write
symbol_def
symbol_def(func_name)(arglist) or symbol_def(var_name) invokes the function FUNC_NAME with the specified ARGLIST, returning the return value. ARGLIST may be zero or more arguments. In fact, symbol_def("fname")(arg1, arg2, arg3) is equivalent to fname(arg1, arg2, arg3), so that "fname" can be the name of any variable for which the latter syntax is meaningful -- interpreted function, built-in function, or array. Without an argument list, symbol_def("varname") is equivalent to varname, which allows you to get the value of a variable whose name you must compute. DO NOT OVERUSE THIS FUNCTION. It works around a specific deficiency of the Yorick language -- the lack of pointers to functions -- and should be used for such purposes as hook lists (see openb). Builtin function, documented at i0/std.i line 3724SEE ALSO: symbol_set
symbol_set
symbol_set, var_name, value is equivalent to the redefinition varname= value except that var_name="varname" is a string which must be computed. DO NOT OVERUSE THIS FUNCTION. It works around a specific deficiency of the Yorick language -- the lack of pointers to functions, streams, bookmarks, and other special non-array data types. Builtin function, documented at i0/std.i line 3745SEE ALSO: symbol_def
sysafe
sysafe, "command line" or system, "command line" pass the command line to a UNIX sh (Bourne) shell for execution. This requires a fork() system call, which in turn makes a copy of the yorick executable in virtual memory before replacing that copy with the sh shell. If yorick has grown to enormous size, the copy can bring your machine to its knees or kill it. If you include sysafe.i before yorick grows (before you start the calculation that requires the large data arrays), a pipe is opened to an sh which remains running, and the original system command is replaced by sysafe. Future system commands will be piped to the already running sh, so no dangerous copy operation is required. There are four problems with this approach: (1) You can't run interactive programs with sysafe, because the stdin is from the pipe (sysafe_pipe) instead of the keyboard. Attempting to do so may lock up yorick. (2) Since the command runs asynchronously now, yorick can't wait until it completes, and yorick's prompt will often precede the output from the command, unlike using the default system function. (3) Some typographical errors in commands may kill the sh; since you don't start a new one each time, the system command will stop working. (4) The shorthand $ syntax still uses the dangerous system call; you need to call system as an ordinary function for sysafe to protect you. Interpreted function, defined at i/sysafe.i line 10SEE ALSO: system_orig
system
system, "shell command line" Passes the command line string to a shell for execution. If the string is constant, you may use the special syntax: $shell command line (A long command line may be continued by ending the line with \ as usual.) The system function syntax allows Yorick to compute parts of the command line string, while the simple $ escape syntax does not. In either case, the only way to get output back from such a command is to redirect it to a file, then read the file. Note that Yorick does not regain control until the subordinate shell finishes. (Yorick will get control back if the command line backgrounds the job.) WARNING: If Yorick has grown to a large size, this may crash your operating system, since the underlying POSIX fork function first copies all of the running Yorick process before the exec function can start the shell. See Y_SITE/sysafe.i for a fix. Builtin function, documented at i0/std.i line 191SEE ALSO: popen