Program: PRINT Purpose: print part of a (sub)set on terminal/printer. Category: UTILITY File: print.c Author: M.G.R. Vogelaar Keywords: INSET= Give set, subsets: Maximum number of subsets is 4096. BOX= Give box in ..... [entire subset] ** ASCIIFILE= File name for ASCII data: [NONE] If a name is specified, an ASCII file is created to store data. If you press carriage return, there will be no output to an ASCII file. If a given name already exists, APPEND= must be specified. APPEND= File exists, ok to append? [Y]/N The file specified in FILENAME= already exists. You can append to this file with APPEND=Y. If APPEND=N you will be prompted for another filename. ** PRINTER= Give number of printer: [TO SCREEN] If an Ascii file name was given: Give number of printer: [ONLY TO ASCII FILE] A menu with printer numbers is presented if you give a non existing printer number like -1. You are re- prompted with the PRINTER= keyword then. ** TWIDTH= Give width of output (in chars.): [Calculated] If a printer was selected, the default is the number of columns for that printer. For the screen option the default is 80 characters. ** TLEN= Give page length (in lines): [Calculated] If a printer was selected, the default is the number of rows for that printer. TLEN= is the maximum number of lines without a header. For the screen option the default is 26 lines. FORMAT= Give format for output: [Calculated] Print numbers on screen in user given output format. See description for possible formats. ** EXPRESSION= F(X)= [No expression] Give an expression using the syntax in the description. Only one variable is allowed (X or x). This variable corresponds to an image value. Example: if you want to multiply your data by 1000 use: EXPRESSION=1000*x The default mode leaves the data in the original state. Description: Write data in set (subset(s)) to terminal, printer or Ascii file, using a specified format. The program will display as many columns as fit in TWIDTH= and as many rows as fit in TLEN= If there are more columns or rows to display, the left overs are displayed separately. The output is repeated for the given subsets ( or for the grids on the non-subset axes as specified in BOX= ). TLEN= and TWIDTH= have defaults depending on which printer is selected. For the screen a width of 80 characters and a length of 26 lines is selected. The sizes for the printers are listed in a menu with printer numbers and characteristics. You can select a printer with PRINTER= The default is writing to the screen only. The possible output formats are described below. The default format is determined with the DATAMIN, DATAMAX descriptors from the header. For all subsets the total minimum and maximum is determined. Field width and precision are calculated and you are prompted with a default format. If the items could not be found, a common format is default. The default format has no knowledge of any given expression which can change the values of the minimum and the maximum. The syntax of EXPRESSION= is described below. If you do not want to alter the original data, use the default. If you want f.i. to rescale the data, use something like EXPRESSION=1000*x+10 The variable 'x' corresponds to the image value. Note that the calculated numbers are printed in the format as given in FORMAT= so if you are using an expression, change the default format. If your output contains the '*' character, it means that the number could not fit into this format. Blank values are printed as 'b'. Data can be send to an Ascii file. To activate this, use the hidden keyword: ASCIIFILE= If your file already exists, you are prompted with APPEND= (which accepts Y or N etc.). If a file is sent to a printer, you get the message: '... Activating printer ...' Output is extended with the user name and a date at the start of all output. At the end of the output, the minimum and maximum value of the used data and the number of blanks in the data are printed. If an expression is used, also this expression is printed. FORMATS: ======= The specification in FORMAT= is called a 'format image'. A 'format image' is used to print numbers in a user given format consisting of characters representing the wanted output format. The syntax is: flag(s) Zero or more flags, in any order, which modify the meaning of the conversion specification. The flag characters and their meanings are: - The result of the conversion is left- justified within the field. + The result of a signed conversion always begins with a sign, "+" or "-". string Characters, some with special meaning. If the string (f.i. FFFFF.FF or gggg.gg or wwwww) contains no dot, the number of characters specify a minimum field width. For an output field, if the converted value has fewer characters than the field width, it is padded on the left (or right, if the left-adjustment flag, - has been given) to the field width. If the string contains a dot, the total number of characters including the dot is the minimum field width and the number of characters after the dot is the precision. The characters are used to determine the conversion type. If the string contains an: 'e' or 'E' The floating-point-number argument is printed in the style [-]drddde+dd, where there is one digit before the radix character, and the number of digits after it is equal to the precision. The E conversion character produces a number with E introducing the exponent instead of e. The exponent always contains at least two digits. However, if the value to be printed requires an exponent greater than two digits, additional exponent digits are printed as necessary. 'g' or 'G' The floating-point-number argument is printed in style f or e (or int style E n the case of a G conversion character), with the precision specifying the number of significant digits. The style used depends on the value converted; style e is used only if the exponent resulting from the conversion is less than -4 or greater than or equal to the precision. others Strings without 'e', 'E', 'g' and 'G' indicate a floating point conversion. The floating point number argument is printed in decimal notation in the style [-]dddrddd, where the number of digits after the radix character, r, is equal to the precision specification. If the result of a conversion is longer than the field width, an asterisk is returned. If the input number is a blank, a 'b' is returned. Examples: Format string: +eeeeee.eeee Number: 43345.5436 Result: +4.3346e+04 Remark: exponential format signed conversion field width: 12 precision: 4 Format string: gggg.ggggg Number: 34.43 Result: 34.430 Remark: Field width is 10 Number of significant digits is 5 Format string: +ffff.ff Number: 23.456 Result: +23.46 Remark: signed conversion Format string: -ffff Number: 345.87 Result: 346 Remark: left justified Format string: -+ffff.fff Number: 34.43 Result: +34.430 Remark: left justified signed conversion Format string: eee.eeee Number: 234.43 Result: * Remark: Field width too small for conversion Format string: ffff.ff Number: blank Result: b Remark: input was a blank EXPRESSIONS: =========== The values are calculated from a user given expression. Illegal operations, like dividing by zero or the logarithm of a negative value, will cause the result to be set to BLANK. For complicated functions the user is advised to make use of 'recall' files for easy input of the function definition. Available mathematics: 1) functions; syntax ff(..); where ff is one of the following available functions: abs(x) absolute value of x sqrt(x) square root of x sin(x) sine of x asin(x) inverse sine of x cos(x) cosine of x acos(x) inverse cosine of x tan(x) tangent of x atan(x) inverse tan of x atan2(x,y) inverse tan (mod 2pi) x = sin, y = cos exp(x) exponential of x ln(x) natural log of x log(x) log (base 10) of x sinh(x) hyperbolic sine of x cosh(x) hyperbolic cosine of x tanh(x) hyperbolic tangent of x rad(x) convert x to radians deg(x) convert x to degrees erf(x) error function of x erfc(x) 1-error function max(x,y) maximum of x and y min(x,y) minimum of x and y sinc(x) sin(x)/x (sinc function) sign(x) sign of x (-1,0,1) mod(x,y) gives remainder of x/y int(x) truncates to integer nint(x) nearest integer ranu(x,y) generates uniform noise between x and y rang(x,y) generates gaussian noise with mean x and dispersion y ranp(x) generates poisson noise with mean x ifeq(x,y,a,b) returns a if x == y, else b ifne(x,y,a,b) returns a if x != y, else b ifgt(x,y,a,b) returns a if x > y, else b ifge(x,y,a,b) returns a if x >= y, else b iflt(x,y,a,b) returns a if x < y, else b ifle(x,y,a,b) returns a if x <= y, else b ifblank(x,a,b) returns a if x == BLANK, else b 2) constants; syntax cc; where cc is one of the following available constants: PI 3.14159.... C speed of light (SI) H Planck (SI) K Boltzmann (SI) G gravitation (SI) S Stefan-Boltzman (SI) M mass of sun (SI) P parsec (SI) BLANK Universal undefined value Note: the Hubble constant is not included. 3) operators; syntax op; where op is one of the following available operators: + addition - subtraction * multiplication / division ** power 4) parameters; syntax; x Notes: ....... Example: ....... Updates: Nov 30, 1992: VOG, Document created. May 1, 2007: JPT, Renamed conflicting toascii declaration.