LIST OF ENHANCEMENTS IN ANSI-C DEVELOPMENT
===========================================================================
Prty 0: Nice upgrade feature
1: Minor bug but not severe, or high priority feature upgrade
2: Major annoying bug but not computationally wrong
3: Error in results -- must be fixed now
===========================================================================
MOT - 2/20/02
Modified the handling of the history retrieval commands. If you use
!, this is the UNIX command completion command. The previous stack
of commands is scanned for one beginning with the specified text. If you
press , the command is simply executed. This has always been the
case. But now, if you press , the matching command line will be
put on the line for editing. Only the last matching line is given.
! - find the last line with as starting
! - retrieve the command line.
history - shows the history of command lines (to determine nn)
TAB on the first two will complete the command line without executing.
In addition, if the command processor interprets the ! command,
it will print out the actual command line pulled from the history.
MOT - 2/12/02
Fixed the dev -t (alias t) and dev -g (alias g) commands so they work
with the newest changes forced by Microshaft in XP.
MOT - 2/11/02
XGENPLOT and XRUMP now respond to key presses ^L and ^Z as follows:
^L - redraw both the text and graph screens if visible
^Z - minimize (iconize) both the text and graph screens
MOT - 2/7/02
Added \Ohm, \ohm, \Mho and \mho as aliases to \Omega and 'S' respectively.
MOT - 2/4/02
Added link to internal variable for the search path for macros. Like
the command, it is $BaseMacro. You can set or modify it as you please.
Basemacro c:\user\macros;c:\progra~\cgs\genplot\nt\local;
let $basemacro = "c:\user\macros;c:\progra~\cgs\genplot\nt\local;"
let $basemacro = "c:\user\macros;%$basemacro%"a
As per Kevin request.
MOT - 2/4/02
After much prodding, have changed keyboard control so the TAB works
for filename completion as in Windows XP. On the first press, it scans
backwards for the start of a filename and then searches for all files
that match the given text. If there are no wildcards in the string, an
implicit * is appended. TAB then cycles through each of the files in
turn until you press some other key. TAB walks backwards through
the same files. To see every file in the current directory, just type
* and then TAB.
This code should work in UNIX as well - though it has not been tested.
The TAB works only in the XGenplot/XRump versions in windows
and almost certainly not at all in UNIX.
MOT - 9/30/01
Pat's been at it again. fgets now permits up to 4096 characters.
MOT - 7/17/01
Kludged the ability to get time/size info on files when specified as
a UNC with //name/share instead of \\name\share. (forward/back slash
problem in windows). Handles only filesize, filedate, isfile and isdir.
MOT - 7/17/01
Pat's been at it again. The sprintf (and hence printf and fprintf)
functions were limited to 256 character output strings. This has now
been increased to arbitrary, subject to the limitation that printf
specifiers other than %s (ie. %f, %d, %p, etc.) are only GUARANTEED
to have 2048 bytes available to them. %s specifiers are guarenteed to
have the larger of 2048 bytes or the length of the string to be printed.
Also fixed EVAL to be able to print arbitrary long strongs. THIS HAS
ONLY BEEN TESTED TO 120,000 CHARACTERS :-)
MOT - 6/23/01
Added DEV -REPAINT or DEV -REDRAW to force redraw of the graph screen
MOT - 5/8/01 - still long time
Added reset option
genplot reset -silent
This just doesn't spit out the version info - nice for macros
MOT - 3/11/01 - been a long time since adding anything :-)
New plot options
PLot -SCOPE - erases the existing screen and draws a "scope" face
with the data. Cute, but not terribly functional.
PLot -NPOint - single use varient of the NPOINT command. Causes
only every nth point to be used for drawing. This
applies to both lines and symbols, but obviously
is useful primarily for symbols.
New command
SCOPE - draws a scope face. You must use REGION commands to set the
range, or use the PLOT -SCOPE option.
MOT - 9/26/00
Added the functions:
sech(x) csch(x) coth(x)
asech(x) acsch(x) acoth(x)
Surprised that they were not already there.
MOT - 9/3/00
Minor change in how dots in dash-dot line types are drawn in the
Word Perfect driver. Primarily to enable publication quality plots.
MOT - 6/26/00
Changed "menu" read/save/save as routines so that they use the current
working directory when first opened.
Speed-up: Windows 95/98 are absolutely abysmal with respect to the standard
memory management functions malloc(), calloc(0, free(), etc. These
are supposed to be "free" functions in a modern operating system,
but obviously no has bothered to tell the Microshaft engineers
that fact of life. NT has very good algorithms, but 95/98 are
an abomination before the Lord. This severely impacts the
performance, especially on computation extensive operations like
NLSFIT (lots of allocations in the thousands of dynamic evaluations
required). Since I am forced by the Microshit engineers to live
with 98 on my laptop, the code has been kludged to bypass this
restriction. I manage the memory myself now for a factor of 4-6
improvement (yes, not a percentage but huge factors). The change
under NT is negligible (but not any worse). Please write and
support the breakup of Microslave to multiple companies,
especially operating system companies that will truly compete.
Added: forlists command. This is similar to foreach but the variables in the
list are taken to be string arguments and expanded before the wildcard
processing and list processing.
declare alist = "a b c"
declare blist = "c d e"
forlist (alist blist) echo %f
Modified: The SOLVE now has an -noerrors options which prevents aborting when
the root does not exist in the specified interval. Useful mainly
for macros that can deal with that condition otherwise. Will return
the limit with the smallest absolute error.
Added: Function @index(,value)
Returns index of first point in the array equal to or greater than
the specified value. If no values are above the given constant,
-1 is returned.
Modified: The @min type functions now have an optional two arguments giving
a beginning and ending index point for the scans. The defaults
are 0 to len-1, and given values will be limited within this
range.
@min(y)
@min(y,npt/2,npt-1) = @min(y,npt/2,10000)
The arguments are sorted so order does not matter. Also, limited
in range to [0,len-1] so can specify well beyond expected maximum
for unknown length arrays.
Affected functions:
@min @max @sum @ave @avg @mean
@median @variance @var @std @rms @skew
@kurt @range @span @absmin @absmax @abssum
@absavg
Added: Write -? is now implemented. Also changed -NOTEXT option so it
also turns off writing of the default curve identifier.
Added: Multiple symbols on same line now enabled on IDENTIFY command
identify "text" -MSYMbol 3 4 5 /
Added: 48 bit versions of random number generators.
drand48() -> returns uniform [0,1] with 48 bit cycle
lrand48() -> returns uniform [0,2^31-1] with 48 bit cycle
mrand48() -> returns uniform [-2^31-1,+2^31-1]
srand48(int seed) -> changes initial seed for all 48() routines
The routines
drand(), lrand() and mrand() are aliased to the above.
In addition, the gnoise() function now uses this random number seed
instead of the default rand() earlier provided.
These routines will eventually replace rand() and rnd() [ie. they will
become aliased to drand48()].
Added: Alias in expression evaluator
isvar("var") <==> exists("var")
return 1 (TRUE) if the variable has been defined in the function
evaluator.
Modified: The PM device driver now looks to see if you are running
Windows NT or Windows 95. If not NT, then it automatically
does the bug fix kludge on printing and copying to the
clipboard. So the titles on the toolbar buttons are now
correct for both NT and 95. Don't know if Microsoft has
fixed the bug in 98 yet.
Modified: The file opening functions in the function evaluator now
trap and allow opening of the standard file handles. This
allows use of novel screen controls. Use of stdin is
considered *VERY* dangerous and I don't warrent any use.
It is okay under NT, but has not been tested otherwise.
fopen(filename [, mode])
filename == stdout : Open standard output (screen)
stdin : Open standard input (keyboard)
stderr : Open standard error (normally screen)
con : Open stdin or stdout depending on
if mode contains 'r' or 'R'
/dev/tty : Identical to con
Example: Outputting a countdown timer. Reading in a character.
setv stdout = fopen("stdout")
setv stdin = fopen("stdin")
loop %j=100,0,-1 { qev fprintf(stdout, "`%j\r") sleep .1 }
setv one_char = fgetc(stdin) eval one_char
declare a_string = fgets(stdin)
Caveat -- it isn't possible to close any of the standard handles.
fclose() always returns 0 but the handle remains valid. This is
only true for the standard in/out/error.
Change: Precision of the error functions has been dramatically
improved. erf(x), erfc(x), ndtri(x) are now valid to
an fractional error on the order of 7E-10 over almost the
full range. These include the functions:
erf, erfi
erfc, erfci
ndtr, ndtri
Added: Function for inverse error functions. Similar to ndtri(x)
erfi(x) - inverse error function
erfci(x) - inverse complementary error function
Extended range for ndtri and validity to better match the
new ERFC range/precision. ndtri(x) now valid
[1E-307,1.0] < 1E-8 absolute error
[1E-307,1.0] < 1E-8 relative error
Addition: FIT SPLINE has changed with addition of the -LINEAR option.
Also, it is no longer necessary to do a sort before the spline
fit call. The data will be sorted if necessary by the spline
routine. However, the STRICT requirement remains (ie. the data
cannot contain two points with the same X value). Use
SORT -STRICT to eliminate duplicate points.
[ FIT ] SPLINE {-options}
Options:
-SMooth - minimizes curvature by allowing
finite variation from the given knots
-SIlent - Don't print smoothing info during processing
-LINear - Piecewise linear, rather than cubic, spline
but otherwise using spline formalism. Makes
it easy to use spline functions (dspln, etc.)
Ignored with -SMOOTH option
Addition: File control in function evaluator now includes pipe capability.
setvar funit = popen("unzip -lqq zipfile", "r")
qev pclose(funit)
Usage: FileHandle = popen("command string" [, "mode"])
int = pclose(FileHandle)
popen() opens an external pipe using the specified command and
directs the input/output from/to the file handle. Normal fgets()
and similar commands can be used to read/write to the pipe.
Example:
setv funit = popen("unzip -lqq aziz")
while (feof(funit) == 0) fgets(funit)
qev pclose(funit)
A somewhat complex way to print out the contents of a zip file.
Clarification: Handling of escape sequences in character strings.
There are several complications arising from the use of the
backslash character in strings - which unfortunately will not
generally go away. The C language escape characters are very
useful, and indeed necessary, for the printf functions. But
they make use of special strings and paths very difficult.
(how to specify Microsoft paths, how to get \beta chars).
So, there are now two types of string constants.
Regular string constants - no escape constants
C string constants - full escape constant processing
A string is taken to be a C string constant if it is enclosed
in "" and the first character is a ` (the character may change
if someone has a better idea - but the behavior described below
will stay). In C string mode, the \ character identifies an
escape character to follow -- with the following recognized.
\a -> alert (bell sounds)
\b -> backspace
\f -> formfeed
\n -> newline
\r -> carriage return
\t -> horizontal tab
\v -> vertical tab
\\ -> backslash
\xbb -> hexadecimal constant where b is [0-f]
\ooo -> octal constant where o is [0-7]
Any other character returns just the character, so \w is
identical to w.
To force a regular string beginning with the ` character,
use it twice. This will disable the C string processing.
"``0.834\beta" gives the string `0.834\beta
"`\`0.834\beta" gives the string `0.345eta
Eventually all strings will run through this processing. At
the moment, it is still a bit mixed.
For example:
strlen("`\n") = 1
now returns 1 instead of 2 (or 3). This is necessary to implement
the fputs() function with line feeds etc. I have resolved much of
the trouble this may present elsewhere, but probably not all. Let
me know.
Addition: lnerfc(x) - returns ln(erfc(x)) valid over entire domain. Uses
alternate expansions near 0 and for large arguments. This should
provide uniform validity to 1E-7 fractional accuracy over full
range. Extended validity range is limited to real numbers.
Complex is implemented as log(erfc(z)) directly.
WARNING: With the addition of the file handling capabilities, there was a
major amount of change in the function evaluator. Let me know if
there are any unusual behaviors cropping up.
Addition: New silent-evaluation command
qev -> qevaluate Quiet Evaluation
Usage:
qev fclose(funit)
qev fputs(funit,"This is a line\n")
Allows expression evaluation where the side-effect is desired
without actually printing a value. Identical to EVALUATE but
will not print anything.
Change: Variable/Function defining routines now explicitly check to see that
the name specified is indeed valid. Used to be able to do things like
setvar 17 = pi
although the variable "17" could never actually be accessed. Now
this will print an error.
MAJOR Addition: Significant file handling added via the expression evaluator.
These will enable Pat to make much more complex macros to handle
massive data manipulation. The system provides the only limit on
the number of files which may be simultaneously open.
(1) New variable type: FILEPTR ==> a file handle. Listed in LISTVAR
and handled automatically by implicit setvar or SETVAR.
(2) File read/write operations. These are actually part of the math
expression evaluator, but with implicit operations can be done at
command level.
stream = fopen("pathname" [, "mode"]) {implicit setvar}
Opens the specified path. The mode specifier is optional
and defaults to "r" if not given. Other values are
"r" -> open for reading
"w" -> create/truncate for writing
"a" -> open for append write
"rb" -> read binary [probably not useful in GENPLOT]
"wb" -> write binary [probably not useful in GENPLOT]
"ab" -> append binary [probably not useful in GENPLOT]
"r+" -> open for read and write
"w+" -> create/truncate for read and write
"a+" -> create/append for read and write
"r+b" -> well you get the idea
"w+b" -> yep
"a+b" -> the same again
The returned handle must be passed to all other file control
functions.
fclose(stream) {implicit int eval}
Closes specified file handle, flushing all buffers.
a_char = fgetc(stream) {implicit setvar}
Returns next character from the stream. Returns -1 if past
the end of the file.
a_line = fgets(stream) {implicit define}
Returns next line from the stream. The terminating newline
character is removed from the string. An empty line is
returned if past the end of the file (use feof(stream) to
detect the end).
fputc(stream, char) {implicit int eval}
Writes a single character to the file (must be opened for
writing). Returns the character if successful, or -1 if
unsuccessful.
fputs(stream, string) {implicit int eval}
Writes the string to the file (must be opened for writing).
You must explicitly include the trailing "\n" if you want
a line terminator. Returns non-negative (usually 0) when
successful and supposedly -1 if unsuccessful.
fprintf(stream, format, arg1, arg2, ...) {implicit int eval}
Writes the formated string to the file (must be opened for
writing). You must explicitly include the trailing "\n" if
you want a line terminator. Returns the number of characters
actually written to the file, or negative on fatal file
errors. The routine is tolerant, but abusive.
a_line = sprintf(format, arg1, arg2, ...) {implicit define}
Returns the formated string as in fprintf. Generally used
with "define" command. This following commands are
effectively synonymous:
s1 = sprintf("var %s = %g", "x", x)
sprintf s1 "var %s = %g" "x" x
One uses the function evaluator, the other a GENPLOT
level command.
feof(stream) {implicit int eval}
Returns non-zero if end-of-file flag set on stream.
Warning: A closed file handle will also return 0.
ferror(stream) {implicit int eval}
Returns non-zero if error indicator is set on stream
fflush(stream) {implicit int eval}
Flushes all buffers associated with stream and returns zero
if everything is okay
ftell(stream) {implicit int eval}
Returns an encoded form of the file position. System
dependent value. May or may not be useful.
fseek(stream, offset, mode} {implicit int eval}
Sets file position indicator based on offset and mode. Mode
is one of the constants SEEK_END, SEEK_SET, or SEEK_CUR which
may vary between operating systems. For NT, the values are:
SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2
Offset is based on the starting position above. Returns zero
if successful. This is potentially very non-portable.
Change: The implicit EVAL on expressions now has a brief format look - just
the result. This may become the default for eval as well if I
like it (and don't get too many complaints).
SCREWBALL: For UNC paths, apparently you cannot use // in place of \\
in fopen. Don't ask me why. But
x //lal/f/dieck/entr2.mac
fails while any of
x \\lal\f\dieck\entr2.mac
x \\lal/f/dieck/entr2.mac
x \/lal/f/dieck/entr2.mac
succeed. You figure it out. I say crazy Microshaft.
Change: The REPEAT command has now been shown to fail with the advances in
loop control offered by "loop" and "foreach". So, until I hear of
enormous complaints, the following command changes are implementd.
REPEAT -> LOOP now are synonymous
OLDREPEAT gets old version (if really needed)
FOR -> FOREACH now are synonymous
OLDFOR gets old version.
This was predicated when block control was created and has now
happened. The following gives very strange behavior.
oldrepeat 20 times if (%c<5) echo %c
Try it for curious results :-)
Add: Aliases UNSETVar and UNSETLocal for dealloc and endlocal.
Add: To accomodate the new RUMP spline fit feature, the function ispln(x1,x2)
has been created. This gives the integral of a spline fit (using
SPL$DATA) over the specified range.
ISPLN(xlow, xhigh)
Change: The unzip read option (using ::) now includes the -C option to match
file names case insensitively. Don't care if UNIX is case sensitive,
GENPLOT will choose to be case rententative, but case insensitive.
Change: FFT routines are designed to work within powers of 2. When the data
set is other than a power of 2, there are two options for handling
the problem. One is to truncate to the next lower power of 2 -- the
other is to somehow pad out to the next higher power of 2. Truncating
loses data -- padding artificially adds non-real values. Neither is
good.
So -- give the user the option. Three new FFT options.
-TRUNCATE - truncate data to nearest 2^m below npt
-PAD - expand data to nearest 2^m above npt, filling in
with the data set (copy from beginning)
-ZEROPAD - expand data to nearest 2^m above npt, filling in
new data points as zero
The default is -PAD which is a strange compromise. Versions prior
to 12/98 essentially mixed -TRUNCATE and -PAD depending on NPTMAX.
But now the curve will be expanded as necessary to allow either
-PAD or -ZEROPAD in all circumstances (up to 2^20 points/curve).
AUTOCORRELATE is always ZEROPAD'd. This makes sense.
FILTER is constant extension padding (last value just used).
This eliminates a discontinuity in the data, but leaves the
discontinuity in the derivative. Oh well ...
Fix: With expansion of loops, etc., problems have arisen in variables becoming
inaccessible in nested loops. The new code will allow up to 24 %x type
variables properly nested and used -- handling reuse as required.
Loop control statements (foreach, loop, while) always set the substitution
variables %i (index) and %c (count). This remains. The foreach() and
loop() may also set an additional variable of arbitrary letter. These
letter'd variables are now maintained as substitutions deep into loop
blocks (but not across macro calls). %%x as usual is converted into
%x.
Examples are the only way to properly demonstrate:
Simple nested loop. Notice innermost with replacement of %c.
loop %a=1,2 {
loop %b=3,4 {
loop %%c=5,6 {
echo %%a=%a %%b=%b %%c=%c %%i=%i
} } }
%a=001 %b=003 %c=005 %i=000
%a=001 %b=003 %c=006 %i=001
%a=001 %b=004 %c=005 %i=000
%a=001 %b=004 %c=006 %i=001
%a=002 %b=003 %c=005 %i=000
%a=002 %b=003 %c=006 %i=001
%a=002 %b=004 %c=005 %i=000
%a=002 %b=004 %c=006 %i=001
Over-riding outer loop entries
loop %a=1,2 {
loop %b=3,4 {
echo %%a=%a %%b=%b
loop %%a=5,6 {
echo %%a=%a %%b=%b %%c=%c %%i=%i
} } }
%a=001 %b=003
%a=005 %b=003 %c=001 %i=000
%a=006 %b=003 %c=002 %i=001
%a=001 %b=004
%a=005 %b=004 %c=001 %i=000
%a=006 %b=004 %c=002 %i=001
%a=002 %b=003
%a=005 %b=003 %c=001 %i=000
%a=006 %b=003 %c=002 %i=001
%a=002 %b=004
%a=005 %b=004 %c=001 %i=000
%a=006 %b=004 %c=002 %i=001
Combination of loops and foreach block, with a while. Again
note use of %%c so it isn't replaced by %c from the %k loop.
loop %k=1,2 {
while (%k+%%c<4) {
foreach %d in (mm, nn, zz) {
echo %%k=%k %%d=%d %%i=%i
} } }
%k=001 %d=mm %i=000
%k=001 %d=nn %i=001
%k=001 %d=zz %i=002
%k=001 %d=mm %i=000
%k=001 %d=nn %i=001
%k=001 %d=zz %i=002
%k=002 %d=mm %i=000
%k=002 %d=nn %i=001
%k=002 %d=zz %i=002
Add: SETPRIORITY command (in system). This command under NT modifies the
priority level of the main computation thread from -2 to +2. Default
is +2 at the moment. 0 indicates default thread priority from the
operating system. Other values are relative with +2 locking the
system for compute bound tasks, and -2 becoming essentially idle.
Requesting SETPRIORITY with an out-of-range value will print the
current priority level.
The default priority of the XGENPLOT/XRUMP process is set by the
value of PROGRAM_PRIORITY=2 in the genplot_.ini file (normally found
in "Program Files\cgs\genplot\nt". This ASCII file can be edited to
set the default priority to desired value. Or SETPRIORITY can be
added to the genplot.ini initialization file.
Add: Since NT allows the format "cd /d f:\cgs" changing disk and path, this
is also now allowed for GENPLOT (NT and OS/2 only)
Add: Another string function
fullpath( )
Example: eval fullpath("./test")
The actual file or path need not really exist -- it will be returned
as closely as possible.
Minor: Allow || and && as logical or and and respectively.
Minor: colormap define now allows to abort out of entries.
WARNING: There are two known instabilities at the moment. With no activity,
GENPLOT may simply hang. Selecting it in the task bar and
executing CLOSE from the menu will properly terminate it. There
is a more serious hang that occurs with extensive usage -- seems
to be related to font corrpution in the GENPLOT window. This is
being searched for now -- you may see occasional debug files show
up on your hard disk from this testing.
New feature: Under HELP menu items, there is now a "Modify Serial Number"
option that allows the serial number to be set from within GENPLOT.
This can be used to register a valid number without reloading the
program. Also, once a valid serial number is entered, the program
remembers the true serial number. On updates, you can enter anything
as the serial number -- the program will automatically correct it
when first run.
New functions: The value of atoi("junk") is 0 -- hard to identify an error.
Added new functions isatoi(str) and isatof(str) which return TRUE if
the ENTIRE string can be properly interpreted as a integer or floating
point value, and FALSE if any character is invalid. Also added function
to do arbitrary base conversion - strtol. This acts like the C function
except it does not save the location of the first invalid character.
isatof(string)
isatoi(string)
strtol(string, base)
Problems: Chebyshev polynomials do not work (in real mode) for OS/2 due to
a compiler bug. Since OS/2 is no longer long term viable, it is
not a big enough deal to try to fix.
Modify: Override of the search path - variable is now system dependent
GenplotSearchPath_OS2
GenplotSearchPath_NT
GenplotSearchPath_UNIX
This environment variable will override the search path for
system files.
Add: New function dpoly() to calculate derivatives and integrals of
polynomials.
dpoly(x,iorder,array)
iorder => 0 is evaluate function
1 is first derivative
2 is second derivative
-1 is first integral (all constants of integration = 0)
-2 is second integral
Derivatives of all order are allowed; integrals are only accepted
to tenth order (makes no sense anyway).
Fix/Add: Modified the CCIRCLE command in ANNOTE to accept the radius as
a cursor entry (any radius point). There is some subtlety to
use of user mode coordinates. In either USER or INCH mode, the
radius is still in terms of inches. It will be properly handled
and reported if entered by cursor.
Added: PCIRCLE command
PCIRCLE [x y radius | /]
Draws partial arc specified by the start and ending angles.
Angles are measured counterclockwise from the positive X axis.
Fix: The options to annote commands now default back to expecting a number
if there was any problem in interpreting as an option token. This
allows negative values in expressions.
Minor change: The command GENPLOT, ANNOTATE, RUMP now have an trailing
color (:) in their definitions. Thus you can paste the output of
a GENPLOT session directly back in without stripping the prompt.
For RUMP, RUMP: will not print the definition.
Size change: The MATRIX read code no longer places any limits on the length
of an ASCII line. Paul Carey and Pat Smith are free to write 50,000
character length lines as desired. If this works, will be moved to
be more generally implemented on all reads.
Document: Internal documentation of the PLOT and OVERLAY commands. Added
the PL -? and OV -? commands to give brief description of the myriad
of options. Should be done for many more commands.
Modify: Modified the edge (first/last point) handling of the histogram and
bar graph modes. Now tries to make last bins symmetric with respect
to the data points.
Enhance: Added options to many of the annote commands. The following will
work with circle/arc/ etc. commands.
-pen
-lw | -linewidth
-ltype | -linetype
Unlike many options, these immediately follow the command since the
number and types of arguments may vary for many of the commands (for
example the DRAW CONNECTED command)
Modify: The printf "%s" string operations will now permit full string
expressions rather than just string variables. Works with &encode
and printf sequences.
printf "%s" strcat("The time is now", ctime(-1))
Modification: Substition of control sequences. Advanced operation only.
The substition for control sequences like %i, %c and %f in foreach,
loop, while, etc. was previously done at "line read" time. It has now
been moved later to "token parse" time -- ie. just when the object is
needed. This may make a few complex macros malfunction, but makes it
much more consistent in behavior. Under the old sequence, the following
two constructs behaved differently. Under the new, they are equivalent.
loop 5 { loop 5 { echo %c } }
versus
loop 5 {
loop 5 {
echo %c
}
}
In the first case, it used to print out 1,1,1,1,1, ... 5,5,5,5,5,
while the second when properly 1,2,3,4,5,1,2,3,4,5,... Both now
give the correct sequence.
Because this change required low level modification of the parsing
algorithm, there is a high potential for unanticipated side-effects.
Please let me know of any unusual behavior that may be related to
this change (should only happen with %f, %i, %c and %var% type
substutions.
Added command processor:
pwd() - returns current working directory
getenv("var") - returns value of the environment variable
Note the "declare name = $USER" works, but only for uppercase
environment variable names. "declare name = getenv("user") will
work for any names.
Debug feature: The command "echo" is now expanded to include simplification
for debug modes. The command syntax is:
Usage: echo [-? | ON | OFF | DEBUG | NORMAL |
ON and OFF set global echoing of command file lines. DEBUG overrides
echo and turns it on for all subsequent macro levels, independent of
any other echo commands, until a ECHO NORMAL is executed. Echo can
also be used to print a single line of text.
Minor change: Removed the "sh", "os2" and "os/2" as commands for starting
an external shell. There still remain the equivalent commands
"!", "dos", "ok;", "csh", and "shell". sh was conflicting with
show inside RUMP.
Minor change: Back by popular demand -- the ability to reverse the on-screen
pm behavior from black lines on white to white lines on black. An
option in the SETUP dialog box of the PM screen allows you to choose
whether pens 0 and 1 are reversed on the display screen. Remember to
"SAVE OPTIONS" after changing any settings.
Note that running with reversed pen 0 and 1 violates the WYSIWYG mode
of screen printing. You cannot reverse the function of the pens for
hard copy except by using PALETTE MAP commands.
Minor change: The file/directory test functions have been added to the
standard string operations. This means that their actual use has
changed.
isfile(pathname) returns 1 if path is an existing file
isdir(pathname) returns 1 if path is an existing directory
filedate(pathname) both return seconds since epoch, or -1 if
filetime(pathname) the file does not exist.
filesize(pathname) size of file in bytes, or -1 if doesn't exist
The pathnames are now generalized string expressions or variables. If
a simple filename is given, it must be enclosed in quotes.
eval filesize("test.dat")
declare basename "test"
eval filesize(strcat(basename, ".dat"))
Minor Change: The handling of loop/list substitution has been changed with
regard to inner block structures. Conditional execution blocks now
will have variable substitution from the controlling foreach, loop,
or while block. The behavior of conditional blocks within for
and repeat control loop has not changed.
loop 20 {
if (%c < 5) {
printf "%d" %c
if (%c < 4) printf "Inner loop too: %d" 100*%c
} else {
printf "%d" 2*%c
}
}
Prior to this change, the inside printf would fail since %c was not
substituted with the loop count. Now, they behave as expected.
WARNING: FOR %f and REPEAT n commands are maintained currently for
backward compatibility and in case foreach, loop fail. They will
ultimately be eliminated and directed to the corresponding FOREACH
and LOOP commands (expanded versions of the same). DO NOT DEPEND ON
THE ABSENCE OF VARIABLE SUBSTITUTION IN THESE COMMANDS! IT WILL
CHANGE SOMEDAY.
Document: The area,page,axes fill are now implemented for the DVIPM and
Postscript drivers. Others will never see the light of day. In
encapsulated postscript mode, the page fill attempts to only go
just beyond the actual drawn area. This is a very kludgy and
difficult mode to support -- recommend not using AREAFILL in
encapsulated postscript unless you find that it really does work
as you need.
Change: To properly handle (ie make it look good by default) the new
area fill command, the margin on Y had to be increased. For this,
the new default SIZE is changed to 7.45x9.00 (from 7.30 by 9.00),
the margin on the left is increased from 0.85 to 1.00 and the offset
along X is decreased to 0.35 (from 0.50). The net effect is that
default graphs are exactly the same size in the same place.
Add: Added new commands
PAGEFILLCOLOR
AREAFILLCOLOR
AXESFILLCOLOR
These are decreasing area fills. Page covers entire page (a rectangle
sufficiently large to cover all of the page -- but boundaries of the
page are not included in the size for encapsulated postscript. Area
includes axes and the margins around axes. And axes is internal area
only. Page flood is done on each erase. Area and axes flood fills
are done on each axis.
Fix: Tried to modify code so "anno label 1 1 'text'" works without giving
extra single quote marks. In future, all strings should be enclosed
in double quotes only -- but cannot enforce and may not be good to
enforce. In "", is evaluated as a string expression. in '', simply
taken as given.
Add: ^L (Control L) will now do a force redraw of the graph screen (if
typed while the graph screen has focus). This is a full redraw --
also passes the ^L to the text window which will also do a full redraw.
Obsolete: The command COLORMAP has been superceded by the PALETTE MAP
command.
Clarification: The number of pens used for autochange mode depends on several
parameters. The palette command specifies that a number of the
entries are available as pen colors. But the DEVICES.DAT has a
similar parameter. The smaller of the two will be used. So if a
pen plotter has only 8 pens, then even if the palette is said to
have 20, only 8 will be used before recycling back.
New Command: PALETTE - in general graphics support.
See example file \Program Files\cgs\genplot\NT\default.pal
PALETTE DEFINE -- defines the palette
o num_entries is the number of entries in the palette.
o num_pens is the number of entries used as pens (not including
pen 0) for the autochange function. Normally, it is one
less than num_entries. However, additional palette entries
may be defined for use as structural colors (axesfill,
etc.)
PALETTE SHOW | LIST -- shows current palette information. Includes
the status of the axes and page fill colors.
PALETTE MAP [ ...] /
Identical to the old COLORMAP commmand. Sets the individual
entries in the current palette to the given values.
PALETTE COLORLIST -- prints a full list of all known colors
PALETTE SAVE -- writes commands to recreate the palette
to a .pal file. Always written as a local file unless path
given. Sets the AXES and PAGE fill colors, as well as the
palette.
PALETTE LOAD -- loads a palette file
PALETTE READ -- loads a palette file
These are synonymous commands. File is searched for in the
current directory and along the system search path. This
command causes the contents of the file to be executed (as if
typing "XEQ ") with echo off.
/* ===========================================================================
/* This file is a palette definition file.
/*
/* Blank lines or lines beginning with /* will be ignored.
/*
/* The following keywords are recognized:
/* PAPERCOLOR
/* AXESFILLCOLOR
/* PALETTE DEFINE
/*
/* PALETTE DEFINE: Followed by two integers specifying the number of
/* entries in the colormap and how many (not including 0) will
/* be used as normal pens for autocolor changes. The default
/* palette is 16 colors (pen 0 through 15), although any size
/* palette is supported (device drivers may have problems however).
/*
/* PAGEFILLCOLOR: RGB specification for the flood fill over entire paper.
/* Default value is "none". Can be name, expression, or an
/* integer refering to the palette. Page fill is only done
/* after an erase (autoerase or otherwise)
/*
/* AREAFILLCOLOR: RGB specification for the area fill color. The area is
/* defined as the region including the internal axes area
/* and the margins defined for labels. Will be drawn for
/* each axis generated. Default value is "none". Can be
/* name, or an integer refering to the palette.
/*
/* AXESFILLCOLOR: RGB specification for inside of axes. Default value is
/* "none". Can be name or integer refering to the palette.
/* ===========================================================================
PAGEFILLCOLOR none
AREAFILLCOLOR none
AXESFILLCOLOR none
PALETTE DEFINE 16 3
white
black
grey50
grey100
grey20
grey30
grey40
rgb(50, 50, 50)
grey60
grey70
gray80
gray90
darkcyan
darkyellow
tan
blue
Color Handling: Color inside GENPLOT/RUMP is now internally full RGB
capable (but some commands still accept only pen numbers). There
is a new database file providing mapping of color names to RGB
values called "colormap.dat" which resides in the usual place
(Program Files\CGS\Genplot\NT\colormap.dat). The file is self
documenting. The commands COLORMAP, PEN, AXESFILL, PAGECOLOR
are certainly known to work with it. As others are identified,
they will be updated as well.
The color database currently has 700+ colors. The names are
case insensitive but must be matched fully. GRAYxx where xx
is a two digit % are included (Grey7, Grey70, etc.)
Only the PMDRIV for NT and the Postscript driver can actually
make use of the full RGB capability. Other drivers use the
closest pen number to a specified color (pen numbers based on
the current color map palette). The number of colors is
unlimited in the code, but may be limited by the actual
rendering of the device. NT running in 24-bit color mode
handles all of the colors well.
axesfill CarnationPink axis
axesfill RGB(28,448,330) axis
New colors can be defined as a normal Genplot variable and
used as in any expression. Color matching first checks the
color database and then interprets values as an integer expression
becoming either a pen number or a color specification. However,
RGB colors should be saved as INTEGERS to utilize the full color
space. If not, the red component will be truncated to even values.
alloc MyYellow INT let MyYellow = RGB(220,190,60)
axesfill MyYellow axis
colormap 3 MyYellow /
axesfill 3 axis
Setting some colors cannot be done by name (such as internal
variable $axcolr[]). For these, a new function is implemented
which converts a string to the RGB equivalent from the database.
eval rgb_color("Yellow")
16842751 = rgb_color("Yellow")
printf "%8.8x" rgb_color("Yellow")
0100ffff
let $axcolr[1] = rgb_color("gray80")
(RGB specifications are 0x01000000 or'd with the 3 byte RGB)
If you really want to get a full listing of the available colors,
use the command "PALETTE COLORLIST"
The palette may also be queried by directly examining the RGB
entries in $PALETTE array.
COLORMAP: The colormap command changes the color mapping in the currently
loaded colormap. The version of the palette on disk is never
changed. For most devices, changing the colormap is not effective
until the device is re-initialized. But for the NT PM-driver,
the changes are immediate on screen (existing plot is changed
for all object drawn with pen specifications -- as opposed to
specific RGB specifications).
Change: RGB(x,y,z) returns a value which you are not to understand. But
can be passed to PEN to set specific colors. Documentation below
changed.
Added: Color commands can now be specified as full RGB values. A longer
list of colors will be added soon. Because of the change to a
display map of colors, the
Added: AxesFillColor (or AxisFillColor) - 8 character minimum
Sets color for fill of axes in graph. For subplots, might want to
use 0 to block out other components. Can also be various colors
to standout on graphs.
Added: functions
atof("string")
atoi("string")
atol("strong")
ascii to float, integer and long. The second two are identical.
The string is interpreted as a number as far as is consistent with
the type of variable. No error checking or return.
Added: Recognition of hexadecimal constants. 0x123 is properly interpreted
as the integer 256+32+3 = 291. Also the function RGB(r,g,b) which
just packs the three values into a single 32 bit integer. Fortunately
a float has 24 bits of precision so can be represented exactly.
NOTE: RGB is no longer specified. The specific value is lost, but
still represents a color. Bottom three bytes are rgb with R in
the lowest order position.
RGB(r,g,b) -- packs three integers r,g,b into a 24 bit
integer representing colors (RGB model). The values should be
between 0<=r<=255 -- actual operation truncates values to integer,
and then just uses the values modulo-256. So RGB(257,3,-1) is
equivalent to RGB(1,3,255) -- or essentially blue.
Added: With the string expression evaluation, it is time to start migrating
some of the commands to expect such expressions. First two are
TITLE and ANNOTE LABEL. These are generally the most complex used.
As I see fit, others will migrate as well.
anno label / strcat("sample ",ids)
Identification will probably move also, but need to think about
at what level -- ie. can the IDS be an expression which is expanded
just before being drawing?
Clarification: There are some real subleties added with string evaluation now.
Consider:
create y = sin(x) archive c1
decl m = c1
What should m be? "c1", or the value of the IDS on curve c1 which
should be "New Curve". This is a problem! I've solved it by
scanning a string expression first to determine if it is simple or
complex. A complex one is any involving characers ({[+/#. These
signify that some sort of operation may occur.
CASE: COMPLEX EXPRESSION
interpret as possible string variables. Variables will resolve
to their ID if 2D/3D curve or to their definition if a function.
If the string c1 is required, enter as true string constant "c1".
CASE: SIMPLE EXPRESSION
Even if name is a function or 2D/3D curve, treat is as simple
text and return only the text. To get the value of a simple
string, use either #c1 (forcing complex) or %c1% (expression
expansion in the parser.
Note that this DOES NOT apply to string variables which will always
resolve to their definitions. Use quoted strings to avoid this
behavior in a DECLARE operation.
declare m1 = "c1" /* Always safe
declare m2 = "m1" /* Always safe
declare m3 = m1 /* Will set to value of m1, not "m1"
Addition: Added ability to specify string arguments in defined functions, as
well as string returning functions. The prepend character '#' acts
as a prototype indicating that the variable (or function) name is
to be considered a string type variable (or return value). Different
symbols may later be added for other type arguments.
define f(#var,n) = strlen(copies(var,3))
define #g(#var,i,j) = subword(var,i,j)
Note that the # sign does not appear in the expansion, only in the
function name.
GENPLOT: define #g(#var,i,j) = subword(var,i,j)
GENPLOT: define f(#var,n) = strlen(copies(var,n))
GENPLOT: eval g("this is a long line", 1,3)
Value: "is a long" = g("this is a long line", 1,3)
GENPLOT: eval f(g("this is a long line", 1,3) , 3)
Value: 27 = f(g("this is a long line", 1,3) , 3)
GENPLOT:
Now to see how much broke in adding this feature.
If a string argument is encountered where a numeric value is expected,
the string is interpreted as a simple number (no math operations). In
complex mode, it can be of the form A+Bj.
define f(#a) = 2*a
eval f("34") = 68
eval f("34+8") = warning messages and 68 as the value
Addition: Enabled "Filled Rectangle" drawing in the postscript driver. The
ANNOTE FILLED_R command will now properly output to postscript
drivers.
Slight fix: There has been an annoyance that you had to re-enter the serial
number everytime an update was loaded from the WEB. The serial
number handling code has now been revised to keep track of valid
serial numbers that have been entered, and replace the "serial"
entry if necessary.
Functional: For updates, if you have once entered a fully valid
serial number (WGEN-97-xxx-xxx), you don't have to enter it
again. You can enter anything for the serial number during the
install process. The correct value will be inserted first time
the program is run.
Document: Use of the external macro facility in GENPLOT: - an Example
go.mac
---------------
/* ===========================================================================
/* This is a dummy demonstration of the macro calling ability of
/* the nlsfit function. The macro feature is included to allow fitting
/* functions which cannot be defined as a simple f(x) type expression,
/* for example those involving integral expressions. Any necessary
/* work can be done in the macro, including calling an external program
/* and reading in the result from a temporary data file.
/*
/* In this one, we are just fitting a gaussian peak with a very complicated
/* mechanism.
/* ===========================================================================
/* Create the test data with some noise
create y = 1.3*gauss(x,2.0,0.5)+0.2*ndtri(rnd(x)) -range -2 +5 -points 50
/* Set nominal coefficients (see test_fnc.mac for use of these)
setv a,x0,dx = 1.2 1.8 0.3 /* Modify so not exactly the same
/* Allocate an array for test_fnc.mac to save its estimates to
alloc results array npt /* Array holding results from test.mac
/* Enter NLSFIT and go - only addition is the genplot_macro feature
nlsfit
reset
equ results /* Will pick up the array created above
vary x0 /
vary dx /
vary a /
genplot_macro test_fnc.mac
fit
return
/* Plot the data and overlay the points estimated as the best fit
plot
let y = results ov -pen 2 -lt 1
test_fnc.mac
---------------
/* ===========================================================================
/* This macro must evaluate the fitting function at each of the points
/* in the data set. It should assign to results[%i] the estimate of the
/* function at the each of the coordiates x[%i]
/*
/* Requirements:
/* (1) results[] must be filled with the estimated Y at each X
/* (2) the original data passed must not be changed (use archive/retrieve
/* bracketing around the macro to ensure this)
/* (3) the final line should be a "return" to exit the sub-process
/*
/* This test version does very little - any real use would have a much
/* more extensive calculation for each of the elements.
/* ===========================================================================
archive hold_data
loop %k=0,npt-1 {
let results[%k] = a*gauss(x[%k],x0,dx)
}
retrieve hold_data
return
Modify: The is once again symmetry in the function evaluator between the
string and numeric expressions. 'a' and "a" are equivalent when
expecting a numeric argument. 'this' and "this" are equivalent when
expecting a string argument. Only "this" fails to parse when looking
for a numeric argument. This should make life easier on users of
the extensive string functions.
Modify/Fix: The strip() function now has two optional arguments rather than
one. The format is:
strip("string" [, "mode" [, char]] )
mode - "Leading" | "Trailing" | "Both". Default = BOTH
char - must a single character to strip. Defaults ' '.
ADD: More string functions - time related
time() - returns number of seconds since the Epoch
clock() - returns number of clock ticks program or OS start
ctime(time) - converts a time (in seconds since epoch) to an
ASCII string with the default format
Sun Dec 02 06:55:15 1979\0 (trailing \n stripped)
If time is specified as -1, then current time is
used - equivalent to ctime(time())
strftime(format, time) - encodes time into a string based on the
C equivalent function strftime. See any C
reference text for the parameters in the format.
If time is specified as -1, then current time is
used - equivalent to strftime(format,time())
In the conversion to C, these are implemented as:
ctime(time) -> ctime(time)
strftime(format, time) -> strftime(buf,256, format, localtime(time));
GENPLOT: eval strftime("%X %a %b %d", -1)
Value: "08:19:20 Fri Feb 20" = strftime("%X %a %b %d", -1)
GENPLOT: eval ctime(-1)
Value: "Fri Feb 20 08:19:28 1998" = ctime(-1)
GENPLOT: eval ctime(time()-8*24*3600)
Value: "Thu Feb 12 08:19:47 1998" = ctime(time()-8*24*3600)
GENPLOT:
MODIFY: Handling of comments in 3D Matrix read:
Within the header section (before the data), the following are
allowed:
C <== comment which, if first, becomes IDS
# <== comment which, if first, becomes IDS
/* <== comment which, if first, becomes IDS
@end <== end of header (jump to Zdata read immediately)
@skip n <== skip next N lines of file
@ <== stack commands on process stack in LIFO order
ZDATA <== end header and start read of Zdata immediately
COLS: | NCOL: <== set number of columns
ROWS: | NROW: <== set number of rows
COMMENT <== becomes IDS of the surface
XSCALE <== X = xorigin + i*xscale (if XDATA not specified)
YSCALE <== Y = yorigin + i*yscale (if YDATA not specified)
XORIGIN
YORIGIN
XDATA <== Load NCOL values of X (column) header values
YDATA <== Load NROW values of Y (rows) header values
Commands @end and @skip are case sensitive.
MODIFY: Minor modification to handling of calls to an externally linked
function from the expression evaluator when in complex mode. See
new documentation in "SimpleFnc" of the USER code directory.
MODIFY: DEFINE of a name already existing as a DECLARE will now print an
error message and change the class of the variable to FUNCTION
(from STRING).
ENHANCE: Really a fix, but some may view as an enhancement. Added translation
of %var% to expression in &encode usage. Following works as expected
(after you think about it a bit).
declare var = "ids"
echo &encode "The value of %s is: %s" var %var%
ENHANCE: String manipulations are now fairly strongly supported in the
expression evaluator. It has not permeated all elements of the
code, but such things as:
abbrev center char concat copies
d2x ichar index left length
LexEqual lowcase lowercase pos reverse
right strcat strcmp strcspn stricmp
strip strlen strncmp strnicmp strnlen
strspn substr subword translate upcase
uppercase verify word wordpos words
x2d
At least, now you get:
GENPLOT: eval reverse(subword("This is a long line", 1, 3))
Value: "gnol a si" = reverse(subword("This is a long line", 1, 3))
Eval tries to ascertain the nature of the expression before printing.
If the first reference is to a string variable, function returning
string, or a string constant (any expression in double "), then it
will evaluate it as a string. If the first item appears to be numeric,
then it will invoke the numerical interpreter mode.
Note that sloppy use of DEFINE and DECLARE will not cause problems.
DECLARE always creates a STRING variable and DEFINE always creates
a FUNCTION variable. STRING variables are interpreted as functions
if they are encountered in the middle of an expression. But they
are intrinsically strings and may switch modes on you when not
expected.
GENPLOT: declare value 7+8
GENPLOT: eval value
Value: "7+8" = value
GENPLOT: eval 0+value
Value: 15 = 0+value
GENPLOT:
GENPLOT: define total 7+8
GENPLOT: eval total
Value: 15 = total
GENPLOT:
GENPLOT: declare str = copies("hi", 4) eval str
Value: "hihihihi" = str
GENPLOT: declare str = "copies(""hi"", 4)" eval str
Value: "copies("hi", 4)" = str
GENPLOT:
ENHANCE: At behest of Mr. Smith, added some of the REXX string functions
as well, along with their UGLY optional argument formats. He has
promised to document them properly. Currently present functions
return only numeric values, but the string returns are coming.
abbrev(str1, str2, minlen)
string(length)
x2d(string)
words(string)
index(str, char [,start] )
pos(str, char [,start] )
wordpos(word, str [,start] )
verify(str, valid_list [,start [,reverse] ] )
ENHANCE: Added some string comparison functions to the expression evaluator.
Strings are still limited, but provides at least compare capability.
strcmp(str1, str2) /* String compare
stricmp(str1, str2) /* String compare (case insensitive)
strncmp(str1, str2, n) /* Compare only first n chars
strnicmp(str1, str2, n) /* Compare only first n chars
strlen(str) /* Length of the string
strnlen(str) /* Length ignoring trailing blanks
strcspn(str1, str2) /* first element in str1 that matches
any character in str2
strspn(str1, str2) /* first element in str1 that matches
none of the chacters in str2
These are identical to their C function calls. Note that is means
THEY RETURN 0 WHEN TRUE, and NON-ZERO when FALSE. Direct tests
will not work!
BOOL LexEqual(char *string, char match, int minlen)
Also defined lexical equality for more common use. This is the
same as the primary matching function in Genplot. String is the
input string, match is the expected pattern, and minlen is the
minimum acceptable abbreviation length. The strings must match
for all given characters, although either string may have additional
chars beyond the other. This function is extremely useful for
writing command case expressions.
The string arguments may be either string variables, or quoted
strings.
eval strnlen("Who said ""Where no man has gone before""? ")
eval strlen("Who said ""Where no man has gone before""? ")
echo off
while (1) {
declare cmd = &getarg -prompt "What's up boss? " -default quit
if LexEqual(cmd, "quit", 1) {
printf "You are not allowed to quit at this time"
} elseif LexEqual(cmd, "help", 1) {
printf "No help is available"
} elseif (strcmp(cmd, "really really quit") == 0) {
printf "Well if you really really insist ..."
break
} else {
printf "No commands are implemented"
}
}
ENHANCE: Added linkage to the normalized error correlation matrix in nlsfit
(using curfit method only). This is linked as a simple array that
must be interpreted manually as an NxN matrix.
Added command "NLSFIT ERROR_matrix" which will print the error
correlation matrix to the screen (formatted reasonably).
The error matrix is the inverse of the estimated curvature matrix
for the X^2 hypersurface, considered as a function of the N varying
parameters. The square root of the diagonal elements of this
matrix give the estimated sigma's for the fit parameters.
GENPLOT reports not the error matrix itself, but the normalized
error matrix; specifically each element (i,j) is normalized by
the product of sigma_i and sigma_j. The elements the represent
error correlation as relative in the reported sigmas. All
elements of the normalized error matrix must have absolute value
less than 1.0, and the diagonal terms will be exactly 1.0.
The values of the matrix may be accessed internally via the
linked array CORRELATE$ which is a linear N^2 array. Or the
command NLSFIT ERROR will print out the matrix as in the
example below:
NLSFIT: error_matrix
Error correlation matrix (CORRELATE$)
1.000 -0.001 -0.495 0.057 -0.100 0.106
-0.001 1.000 -0.036 0.026 -0.003 -0.008
-0.495 -0.036 1.000 0.165 -0.305 0.320
0.057 0.026 0.165 1.000 -0.883 0.789
-0.100 -0.003 -0.305 -0.883 1.000 -0.980
0.106 -0.008 0.320 0.789 -0.980 1.000
NLSFIT:
Precise interpretion of the error matrix can be difficult.
However, qualitative interpretation is fairly simple. If
an off-diagonal element is large, then errors in the two
parameters are strongly correlated; changes in one parameter
may be "compensated" for by changes in the second.
The above results are from the fit of a peak using a gaussion
with a quadratic background. The parameters were the amplitude,
center, FWHM of the peak and the offset, slope and quadratic
components of the background. From the values in the first
column, we see that the amplitude and the FWHM errors are
negatively correlated to a significant degree -- an increase
in the amplitude can be compensated by a decrease in FWHM.
Quantitatively, increasing the amplitude by sigma and
decreasing the FWHM by 0.495*sigma will result in a curve
only slightly modified from the best fit.
Looking at other terms, the center is essentially
uncorrelated with any of the other parameter. The offset
of the background, on the other hand, is correlated
significantly with both the slope and quadratic terms in
the parabolic fit.
In brief, the matrix allows one to construct the hypersurfaces
of constant increase in X^2 from the minimum fit value, and
thus the directions of the hyper-ellipsiods. For more detailed
interpretation of the inverse curvature matrix as an error
correlation estimator, consult a serious data analysis textbook.
ENHANCE: Added ability to set the angle in annotate via coordinates (for
macros or to follow a given line. If a "/" is given to the angle
command, the cursor or entry option is given.
annote angle / / -> brings up cursor for 2 points
annote angle / 1.0 1.0 2.5 3.7 -> sets angle for start to end
ENHANCE: CCIRCLE command in ANNOTE to draw a simple circle based on X,Y
center position and a radius (in inches).
annotate ccircle
MODIFY: CREATE now permits npt to be 1. The range is ignored and the single
point will be created at the minimum value of any specified range.
(Previously, "create -points 1" failed with an error message).
MODIFY: The postscript driver now supports filling the color of the internal
axes area, and page color filling. Set pen color 0 (via COLORMAP)
to the color desired inside the axes area (default is white). Use
PAGECOLOR to set the color of the page. With PageColor, the bounding
box is set to 0.2" beyond the drawing (a border of the page color).
When directly outputting the page, the page fill is set to 26 inches
wide and high to try to get the entire page.
This is a tentative implementation -- let me know if there are
problems with conversion in word processing documents, etc.
ADD: Color names now include page and background to represent these colors.
Background -> 0 -- color of the inside of axes region, used to
erase curves
Page -> 0 or value set by "pagecolor" command.
These values are not terribly useful except on PM and postscript
drivers which properly interpret the page and axes filling commands.
ADD: Function depth is now limited to 200. This should not affect
real expressions but will avoid crashes due to circular mistakes.
eval f(sin(x*2))
has a recursion depth of 3 (x*2, sin, f). Getting 200 deep ought to
be very difficult unless you make a mistake.
define f(x) = f(x)+1
eval f(x)
or
define ival = 1
let ival = ival+1
eval ival
In the latter case, because ival is DEFINED and becomes a string, the let
is also a string define. When eval comes along, it substitutes for ival
-- but the substitution has ival in it, so it continues to expand
indefinitely.
eval ival --> ival+1 --> (ival+1)+1 --> ((ival+1)+1)+1 ....
The function depth will avoid a stack overflow. If this number turns
out to be too low for anyone's work, easy to increase the threshold.
ADD: After multiple requests by RdR, now have ability to change the file
used to define devices (devices.dat). The syntax is:
DEVice -Filename
This replaces the internal "devices.dat" name with the given name or
path. The file will be searched for in the current directory and along
the normal Genplot system file search path (dynamic load path).
Usage: DEVice [ dev_name | -option ]
Options are identified by a leading hyphen and may or may not accept arguments
-? - quick help
-OPTION - token passed to driver as driver specific command
-TEXT - request driver to display text window
-GRAPH - request driver to display graph window
-NOGRAPH - request driver to turn off graph window
-NOTEXT - request driver to turn off text window
-CHECK - if a device has been initialized, do nothing.
Otherwise do a "device auto"
-FILENAME - change the internal name of devices.dat
-QUERY - prints out current device and device.dat filename
For the device name, the name "auto" causes the GTERM variable to be
scanned and used -- or uses a system default device.
The modification to the devices.dat filename is sticky -- ie. it will
not be undone by a GENPLOT RESET command.
MODIFY: The ASCII file read now automatically expands the line buffer as
needed to accomodate arbitrary long lines (and arbitrary numbers of
columns per line). This DOES NOT apply to reads within macros (using
the << structure), but only when reading a real file. It has been
tested to lines of 750,000 characters with 60,000 columns of data but
should have no intrinsic limits beyond memory constraints. Say thanks
to Pat for writing such incredibly long data files ...
A nessage us printed for each 1024 character expansion of the line
length just so you know it is happening.
Technical: Applies to ASCII XY, XYZ, or list directed reads scanning
directly opened file. All other modes remain limited to
1024.
MODIFY: The following keys are trapped by XGENPLOT and XRUMP to scroll the
text window:
- scroll by one window size
- scroll by one window size
- scroll to top of display buffer
- return to bottom of display buffer
V - scroll down one page (emacs)
- scroll by one line
- scroll by one line
These changes apply only to the WinNT version. For OS/2, only the
and are implemented. Also, while would
be nice, all characters are trapped by the window interface as
menu commands. V is there for those of us used to emacs.
ADD: Filename operations INTERNAL to GENPLOT (most) will now ignore either
single or double quoted filenames. In addition, the UNIX form of
"~/filename" will be translated to %HOMEDRIVE%%HOMEPATH%/filename"
automatically. Can't look up user information, so any form of
"~user/filename" is similarly translated (ie. all usernames resolve
to the current user). Someday this may change.
MODIFY: Changed the filename completion algorithm to better handle filenames
with embedded blanks (can Microsoft do anything more annoying now?
First we have the / versus \ fiasco, and now allowing spaces in
filenames -- talk about complicating a parsing algorithm!).
CHANGE QUICKLY: The " is now only added only for filenames containing
blanks. Otherwise, just normal processing.
SLIGHT: Both "foreach" and "loop" now support the -? or -help options to
get quick help.
MODIFY: The loop command now takes optional ranges ....
loop %z=start,end[,increment]
Usage: loop [do | times]
loop %x=,[,]
In the second form, the start, end and increment values must all be
together in a single extended token -- ie. no spaces are allowed.
Expresssions are allowed, but will be converted to nearest integer
values. %x will be substituted with a file extension format (ie.
normally 007) where x may be any character.
%c and %i are always substituted with the count and index starting
from 001 and 000 respectively.
Example: loop %a=91,113 { read basefile.%a plot hcopy dev pogo }
MODIFY: The IDENTIFY commands now have numerous additional options to
override almost everything. Because of the way that parsing is
handled, these options are only available to the IDS and IDENTIFY
commands and not as part of the -IDENTIFY option to PLOT and OVERLAY
(would conflict with the options to those commands anyway).
IDENTIFY [text] [options]
-PLACE { / | } - Starting legend position in inches (cursor)
-SKIP - Skip one space before the legend entry
-CLOSE - Close the legend box after this entry
-L&S - Do both lines and symbols on legend
-SYMbol - Override and use this symbol type
-LType - Override and use this linetype
-PEN - Override and use this color
-LWidth - Override and use this linewidth
-NOMARK -NOSYM -NOLINE - Draw text only, or turn off each
-RESET - Reset to top of legend on new plot (internal)
In addition, if doing -L&S, the line segment example is drawn from
the symbol out in the two directions so as to not go through the
symbol. It is likely that $IDLSIZ or $IDVSIZ should be changed if
doing extensive lines and symbol markers (increase $IDLSIZ or
decrease $IDVSIZ).
Note that -NOMARK disables both lines and symbols, while -NOSYM
and -NOLINE only disable that specific marker. If you draw with
symbols and indicate -NOLINE, it will have no effect.
Finally, multiple line LEGEND entries are now permitted with the
\n separater in the text.
MODIFY: The foreach (and the for) commands will now accept alternates to the
%f variable.
foreach [%x [in]] (list,...) [do]
The x in %x can be any character, defaulting to f if not specified.
foreach %a (a b c d e) { foreach %b (f g h) echo %a%b } (minimal)
foreach %a (a b c d e) do { foreach %b in (f g h) do echo %a%b }
foreach %a in (a b c d e) do { foreach %b in (f g h) do echo %a%b }
The "for" command continues to be non-rentrant, though I've seen no
problem with foreach and thus soon expect to have it translate to
foreach.
CHANGE: The "default" device when none has been selected in OS/2 and NT is
now "pm". I'm getting tired of typing that. GTERM will still
override if it is set as an environment variable.
COMMENT: OS/2 is slowly leaking out of the code in name. Made a check on
the trade rags to see how often it has been mentioned in the last
8 months and came up with only 5 valid comments on OS/2 WARP! When
will IBM ever learn?
NEW!!!: Added serial number verification -- had to at sometime since
some users actually get charged for the program :-(. This is how
it will work --
(1) Purchased licenses will get a serial number that permanently
enables any update revision of the code. This serial number
is printed in the "About ..." help button and the "VERSION"
command. Genplot only serial numbers will not run RUMP,
although RUMP serial numbers can also run Genplot.
(2) Beta test, or test and evaluation users, can download or
install the code, and with the right password, run until
some expiration date (60-90 days if I stay on top of it).
A quick message giving the expiration date flashes by during
bootup (2 second).
After the expiration date, you must return and get a new
copy and possibly evaluation serial number. The old version
will continue to work, but it will put up a message and
force you to endure a 60 second timeout.
(3) All users may regularly update their code by downloading the
latest installation program from the WEB. These updates will
normally include the entire package. (The documentation may be
split into a separate file if it gets too big.) Unfortunately,
licensed users will have to re-enter the serial number during
each upgrade install.
(4) This license verification currently only applies to Windows
NT/95 versions. UNIX users have the source code and can
bypass any software check anyway. OS/2 users will ultimately
be forced to NT and, until that time, will be granted a free
license.
This mechanism seems to ensure that everyone can continue to get
immediate updates and fixes, while providing some mechanism to
control the distribution of the program.
MODIFY: Added in NTDRIV (PM for NT only!!!) the ability to request metafile
or clipboard output from a macro using the IOCTL capability. Format
is
dev -option print
dev -option -print w/ Powerpoint kludge
dev -option clipboard"
dev -option -clipboard w/ Powerpoint kludge
dev -option "metafile "
dev -option "-metafile " w/ Powerpoint kludge
Notes:
(1) The form "metafile " must be enclosed in quotes
since it must be sent as a single string. The filename is
optional, but if not given, will bring up the dialog box.
The filename must be fully formed -- no extension will be
added to the specified string.
(2) The text for all of the forms CANNOT be abbreviated -- ie.
it must be all 8 characters of the word metafile.
(3) Errors are silently ignored -- the "dev -option" mechanism
is specifically device dependent and option strings on
one device may have no meaning on another.
(4) For metafile with no specified filename, focus is shifted to
the graph screen so the dialog box is visible.
(5) Print always go to the default printer.
Examples:
dev -option "metafile e:\thesis\figs\chap1.fig.1.emf"
GRPRINT command now behaves the same way -- essentially
"dev -option print" is synonymous with the "grprint" command.
Someday there may be a "EMF" device specifically as a subset of
the PM screen driver (bastardize the final PMDRIV code). However,
at the moment, things change too quickly to try to keep two copies
of very complex code maintained.
MODIFY: Added ability to write metafile from PMSCREEN with the embedded
Powerpoint bug workaround. Exists as another icon on the toolbar
and as a menu item.
ENHANCE: Modified the handling of the ok; (system) commands for OS/2 and
NT. If the command line is now terminated with an & character,
it is interpreted as a request for a detached session (independent
of the running GENPLOT session. This is equivalent to prefixing
the command with "start". So "ok; start eps" is identical to
"ok; eps &". Also, a blank request to ok to start a shell is
interpreted as starting a new window if running in GUI mode
(XGenplot or XRUMP). In window mode (Genplot or RUMP), this is
is still a inferior command process running in the current window.
Finally, the EDITOR command (using the environment variable EDITOR)
is started as a detached process in both windowed and GUI modes
under NT and OS/2. Editing within the GENPLOT text window is no
longer really productive.
For NT, the editor now also defaults to NOTEPAD which is usually
on the path. WORDPAD would be a better alternative, but Microsoft
chose not to put it in a location on the path so I cannot be
guarenteed to find it. To use WORDPAD, you must set the EDITOR
environment variable to the ENTIRE path to the executable.
ENHANCE: Added "SETLOCAL/ENDLOCAL" local variable control. The command
setlocal increments an internal variable and all new variables
added at this level are deallocated automatically when the
corresponding "ENDLOCAL" is executed. These may be nested. The
command "GLOBALize" takes a list of variables and converts them,
if necessary, from local to global. The "LISTV" command lists
the level of each variable just before the name; 0 is global.
This feature must be used with care. It is primarily meant for
very complex macros which are well debugged. Existing variables
level will not be modified. But archiving to an existing curve
name will delete the underlying curve and replace it with one
at the local level -- which will be released on ENDLOCAL.
Future features: (1) SETV will selectively create a new variable of
the same name if one already exists at a more
global level.
(2) GLOBALIZE at this point will
ENHANCE: Added ability to independently set the 4 margins around the page,
letting the top and bottom differ, as with left and right. The
values are set by modification of the "MARGINS" command to correspond
with the RANGE commands.
MARGINS { [BOTTOM LEFT TOP RIGHT } or
MARGINS
In the latter case, the X and Y values set the left and right equal
and the top and bottom equal. This retains compatibility with the
previous usage of the MARGIN command.
The PAGE LAYOUT dialog box in NT/95 has the additions. It is not
present in OS/2 -- the current dialog box value modifies the margins
in the compatability mode.
DOCUMENT: The TRANSFORM DY/DX is a 3 point curvature determining derivative.
If the data is not strictly sorted, there is a potential for
impossible calculations (3 local points with the same X value).
Not wanting to prejudice the results, the DY/DX routine simply
returns 0 for these invalid conditions. To avoid this with good
experimental data, SORT -STRICT or addition of random noise into
X is highly recommended.
FIX/MODIFY: Behavior of the SORT command is fixe and options documented:
SORT [options]
-normal Not reversed order
-reverse Reverse whatever else is said
-nosort Don't actually do any sorting
-random Randomize instead of sort
-strict Delete adjacent identical points - keep first
-delete Default behavior (synonymous with -strict alone)
-average Strict sort with neighboring points averaged
-avg Synonymous with -average
-xonly Modify the X array only (implicit sort on X)
-yonly Modify the Y array only (implicit sort on Y)
-zonly Modify the Z array only (implicit sort on Z)
-x Sort using the X array
-y Sort using the Y array
-z Sort using the Z array
These should behave closer to expected for multiple options.
There is some interaction between the options. In particular, the
array used for testing will be sorted (if SORT requested). Setting
-X implicitly sets request to modify the X array. A subsequent
-yonly will change to sort to based on Y only. On a 2D array,
sort -yonly -x
is synonymous with simple sort since -yonly forces the Y array to
be modifiable, and the -X forces the X array modifiable with sort
testing on X.
The one ambiguous mode is "sort -z -strict". In this case, the Z
and X arrays are taken as the "test" values, with Y the dependent
variable. Thus -average will average the Y values if both X and
Z are equal. The testing assumes the Z array is in order.
CHANGE: Modified the behavior of $csmin (minimum size of tick mark labels on
the axes). Behavior now dependent on the sign of $csmin:
If positive: True minimum size. If the "determined" size is less
than this value, it is automatically bumped up in size
regardless of the physical validity.
If negative: Minimum cutoff size. If determined size is less than
the absolute value, labeling is disabled.
Note that the old behavior is as if negative - and the new default
value is -0.07 inches.
SCREWED!! Due to critical bugs in the 5.0 compiler, all optimization has
been disabled in both GENPLOT and RUMP. I don't know which
routines are subject to error, but it is pervasive enought that
prudence dictates disabling the speed optimization. This may be
as much as a 50% speed penalty in worse case (ie. FFT -POWER).
If/when there is a patch released, I may try optimization again.
Reminded yet again why I preferred IBM to Microsoft. What a pain
in the proverbial posterior tissue.
---------------------------------------------------------------------------
Now using MSC version 5.0 (really 11.00 on itself). Minor changes required
to system.c for environment support. Little else. Should be okay.
---------------------------------------------------------------------------
Added: Added -SILENT option to the cursor command. Mostly for macros that
give their own prompts and handle results through the set variables.
Modify: Added ability to change the repeat (vecsize) for the ID via the
SGRAPH command on $IDVSIZ. Default is 0.003. But did increase the
default line-length to 0.65 (from 0.40) to get most of the repeat
cycle on screen.
Unmodify: The pattern size (repeat loop for - - - types) is not 0.001 instead
of 0.003 in the IDS. Makes it easier to see the line type.
Modify: New color on the PMSCREEN Color Map (OS/2) called NONE. This is
primarily for disabling the AXES background fill.
Modify: Potentially changes in the handling of options to plot. They are
now nominally coherent for all 2D operations (not 3D yet).
Plot and Overlay modes:
The overlay command is one of the most complex with various modes. It is
easiest to think about the options in two terms -- first options that
specify the plot type (types) and second options that modify the character
of the plot (modifiers). Not all modifiers apply to all types, but in
general most do.
===================
Types:
-AZIZ draws connected lines between adjacent points (in
honor of Mike Aziz at Harvard University. Ancient
way to get error bars. This mode ignores all lines
and error bars.
-PT_LABEL draws the ordinal number of each point -- useful
when you are trying to follow trends in sequences. This
mode ignores all lines and error bars. Obviously the
IDS will have a problem -- choose to show as lines.
-HISTOGRAM lines connect points as constant Y segments, beginning
halfway between adjacent X values. By default, the
histogram is line only (current linetype). Symbols and
error bars may be specified. There is no exclusion of
histogram line around points.
-BARGRAPH Histogram as above plus lines extending to the X axis.
By default, the bargraph is line only (current linetype).
Symbols and error bars may be specified. There is no
exclusion of histogram line around points.
-STICK Vertical line segments from X-axis to the points. By
default, this is a line only (current linetype). Symbols
and error bars may be specified. There is no exclusion of
histogram line around points.
Line or symbol plot
==================
Modifiers:
-SYMBOL Override the symbol type. Either an ordinal or
name (ie. FilledCircle) can be specified
-LTYPE Override the linetype number.
-LINETYPE
-PEN Override the pen color. Either an ordinal or
-COLOR name (Red) may be specified.
-SYMSIZE Override the symbol size.
-SYMBOLSIZE
-LW Override the linewidth
-LINEWIDTH
-L&S Where relevent, do both lines and symbols
-IDS Show IDS for this curve
-NOIDS Don't show IDS for this curve (even in AUTOIDS on)
-IDENTIFY Draw IDS for this curve with alternate text
-ERRX Error bar extent (symetric)
-ERRXMinus Error bar in X on minus side
-ERRXLow
-ERRXPlus Error bar in X on plus side
-ERRXHigh
-ERRY Error bar extent (symetric)
-ERRYMinus Error bar in Y on minus side
-ERRYLow
-ERRYPlus Error bar in Y on plus side
-ERRYHigh
-XSCALE Draw as if the X axis had been drawn with autoscale
-YSCALE Draw as if the X axis had been drawn with autoscale
-XYSCALE Draw as if the X/Y axes had been drawn with autoscale
-RESCALE Synonymous with -XYSCALE
-XRANGE Plot as if the X scales are as specified
-YRANGE Plot as if the Y scales are as specified
-ZRANGE Plot as if the Z scales are as specified
-XYRANGE ... Plot as if the X & Y scales are as specified
-XYZRANGE ... Plot as if the X, Y & Z scales are as specified
-PLX [Bottom|Top] Override so plotted against specified scale
-PLY [Left|Right] Override so plotted against specified scale
-BOTTOM equivalent to -PLX BOTTOM
-TOP equivalent to -PLX TOP
-LEFT equivalent to -PLX LEFT
-RIGHT equivalent to -PLX RIGHT
-SLOW Try to slow down the drawing speed
-SLOWER Give 30 ms between each drawing point
-SLOWN Give specified # of ms between drawing points
-EXCLUDE [-SELF | ]
Exclude line drawing over specified curve points
Notes: (1) Specifying both -SYM and -LT will cause plot to do both lines
and symbols (equivalent to -L&S). -SYM or -LT alone will
override to give the desired effect.
(2) Errorbars and symbols can be drawn with any plot type except
AZIZ and PT_LABEL.
(3) Exclude is primarily for normal lines or symbol plots. Usage
in other Plot Types has not been extensively tested.
(4) HISTOGRAM, STICK and BARGRAPH implicitely select lines only
(default = 1) unless -SYM is explicitely given.
Modify: The pattern size (repeat loop for - - - types) is not 0.001 instead
of 0.003 in the IDS. Makes it easier to see the line type.
Fix: XEQ -RETURN from within a memory block now returns out of the last
macro call rather than just the block level. Following used to fail:
if (1) xeq -return
Enhance: Added EXEcute as alias for XEQ
Fix: I've given up and taken the route of fully deleting and recreating
the device context on an erase in NT. This should eliminate the
ghosting characters remaining after erase on the screen.
Enhance: Added RANGE commands to NLSFIT so comparable to other fitting
routines. However, since NLSFIT is command driven, they are just
a tad different.
XRANGE | RANGE - limit on X range values
YRANGE - or/also on Y range values
ZRANGE - or/also on Z range values (obviously 3D only)
XYRANGE - obvious I hope
XYZRANGE - and given above, even more obvious
CURSOR_RANGE - show a box cursor and select valid region
Note that the range can also be specified giving an error bar
expression which has 0 entries for undesired points.
Fix: LSQFIT now uses same definition for option [-RANGE -XRANGE -YRANGE
-XYRANGE] as other FIT commands.
Enhance: Added -XYRANGE to all FIT commands. Now have
-XRANGE (or -RANGE synonymously)
-YRANGE NOT NEW
-XYRANGE (equivalent to -XRANGE -YRANGE) NEW
-CURSOR (puts up box cursor and selects allowed window) NOT NEW
-WEIGHT (may be ignored by some fit routines)
-SIGMA (may be ignored by some fit routines)
-SILENT (may be ignored by some fit routines)
fit [-XRANGE ] [-YRANGE <> <>]
[-CURSOR] [-WEIGHT] [-SIGMA] [-SILENT]
on some.
Add: New options to PLOT:
-NOIDS (Both RUMP and GENPLOT)
-XRANGE
-YRANGE
-ZRANGE
-XYRANGE
-XYZRANGE
The -RANGE force the appropriate range to be as specified on the
given axis without making any permanent or otherwise change.
Affects ONLY the plotting of the data but not the AXES etc.
Add: Added code for proper handling of DOUBLE and INT arrays from
within the expression evaluator. No way to create them from
inside GENPLOT, but they can be linked from external user routines.
BOOL GVLinkArray (char *name, int flags, REAL x[], INT maxsize, INT *size);
BOOL GVLinkIntArray (char *name, int flags, INT i[], INT maxsize, INT *size);
BOOL GVLinkDoubleArray (char *name, int flags, DOUBLE x[], INT maxsize, INT *size);
BOOL GVLinkComplexArray(char *name, int flags, COMPLEX z[], INT maxsize, INT *size);
In user usage, the simplest form is to set "flags=0" and "size=NULL".
Setting size to NULL causes the size to always be maxsize. Setting
it to a static variable address would allow you to have the dimension
of the array change dynamically.
Document: sprintf
Creates (if necessary) or sets a string variable to a formatted
string from internal variables. Similar to
declare &encode
Add: For binary writes, now can embed commands also via write. Format
write -binary -commands
@end
-command can be replaced with -text or -comments (plural only) to
embed only comments, not commands. The -COMMENT option gives
the identifier line on the string.
New: -IDS is synonymous with -COMMENT in a WRITE statement (preferable!)
Add: In binary data format (GENPLOT), comments in the header beginning
"@ " are considered to be command requests and will be queued for
executation in an RPN order following the read (ie. last read will
be executed first). This is now consistent with the ASCII read
which has the same construct.
Add: Because NT is so brain dead, had to modify the I/O channel to
support LPR output to TCP/IP connected hosts. New channel:
LPR*"printer"
LPR*"-Sserver -Pprinter"
This I/O channel creates a temporary file for the plot and then
spools it via the LPR command. Unfortunately, the NT version of lpr
cannot take the file from standard input (no piping) so this is the
only way. Under UNIX and OS/2, this is mapped to be equivalent to
PIPE*"lpr -...."
Modify: NT Genplot windows size can now be specified -- ie. a buffer space
for scroll back information. This information is in a new .INI
file Genplot\NT\genplot_.ini under the section [CONSOLE] with the
keys ROWS and COLUMNS. If you choose to modify these sections,
(1) copy genplot_.ini to the Local subdirectory and modify it
there, recognizing that new sections will be added in the
near future and you will have to manually add these sections
to your new copy
(2) modify the original genplot_.ini, recognizing that at each
new update, you will have to remake these changes.
Sorry for the pain - part of the curse of development testing.
Modify: To be consistent, FIT and TRANSFORM now default to ABORT instead of
LIST. Also, ? is synonymous for LIST, and FIT/TRANSFORM return to
GENPLOT prompt after printing the list (used to recycle asking for
the fit/transform type).
Modify: The internal MORE routine (used by TYPE) now accepts , ^Z, ^G
as synonyms for Q (quit).
Enhance: Because of the popularity of "implicit" let commands, the X command
now checks for an = sign. If present, it is an implicit set of
the X variable. Otherwise it is a call to XEQ as before.
CREATE Y = SIN(X) -range -pi pi
X = COS(X)
PLOT
Enhance: In GENPLOT, a filename of the form "zipfile::file" will be properly
read from the zipfile. The file must be fully specified (ie. with
any trailing .dat) and the zip file must exist. Few if any errors
are reported. Internally, it is expanded as:
read archive::file1.dat
read "| unzip -p archive file1.dat"
The IDS will be archive::file1.dat unless reset by the read. Like
other PIPE reads, the input is assumed to be ASCII unless the read
specifically specifies binary.
read archive::file1.dat -binary
The same file specification applies to XEQ macros and RUMP
files (I hope). The full macro name (including the .mac
extension) must be specified.
However, for RUMP, a .RBS extension will be appended if none exists
on the given name. This means files without an extension will be
difficult to read from an archive. Depending on the implementation
of unzip, "read archive::file." may work to get "file" without an
extension. But it doesn't under OS/2. Simple solution -- if you
want to use the archive, accept the default extensions! Direct read
specified by pipe does still work 'read "| unzip -p archive file".
Enhance: Show command has been expanded as per request by WLB
show [-xrange | -yrange | -zrange | -irange]
show -for
-xrange assumed if no option specified
Document: Identify has the following options:
-place --> sets location
-skip --> leaves a blank position in the legend
-l&s --> show both lines and symbols
-nomark --> don't draw a marker on the legend
-nosymbol --> same as -nomark
-noline --> same as -nomark
-close --> draw a box around the legend
-reset --> reset for drawing from the beginning of the legend
Enhancement: Added a -SINGLE option to cursor commands. This causes the
cursor to return immediately on the next key press (left or
right mouse, or any key -- including space). Useful when you
want to get a point in a macro from users who don't read
the screen prompts. (Press RIGHT MOUSE BUTTON??)
Enhancement: Added a "DOUBLE" type variable in addition to "REAL". It is
really double precision, but its use is slightly restricted. For example,
it cannot be used as a variable in "NLSFIT". But it can be used in
any normal expressions or functions. Primarily added to allow constants
and temporary expressions which lie outside the 1E37 range of normal
floats.
alloc double
setvar double
There may ultimately be a "PRECISION DOUBLE" capability for curves as
well as variables, but at the moment that is painfully difficult and
has not been done.
Range is 1E+/-308, about 15 decimal digits
Modification: FIX_GRID majorly rewritten:
Fix_Grid is used to impose a specified X grid on a given curve,
interpolating as necessary. Either linear or spline interpolation can
be used. The X-grid can be specified as an equally spaced grid of a
specified number of points between two limits, or can be specified as
the abscissa of another curve (or an array). Finally, outside the range
of the data, either CONSTANT or ZERO extension may be specified.
Usage: FIX_GRID <-options>
Options: -RANGE Specify the range of the new abscissa
-FROM grid. FROM and TO overwrite the values
-TO of RANGE. Initial are min/max of curve.
-POINTS Number of points in the grid. Initially
set to number in the curve.
-MATCH Causes the X-grid to match the specified
curve.x or array values. This option
takes precedence over -RANGE and -POINTS
-SPLINE Cubic spline interpolation used between
given points of the curve. Default is
linear interpolation.
-ZERO | -CONSTANT Either constant extend the function, or
set to zero outside valid range.
Notes: An implicit SORT -STRICT -AVERAGE is done prior to grid fix.
The original curve is replaced by the new gridded version.
Modification: Added ! as unary NOT operator. !1?7:2 returns 2
Modification: OS/2 XGenplot and XRump now interpret a Button 3 click as
as "Paste" command. Same as Button 2 double click.
Modification: CLIPSYMBOL NO
Previously, clipsymbol applied only to the symbol. It would not be
clipped even if it extended outside the plot box (but any symbol whose
value was outside the box would be eliminated). This did not apply to
the error bars on symbols. Now, it applies both to the symbol and
to the error bars. With CLIPSYMBOL NO, any point whose value is within
the plot ranges will be drawn fully, as will its error bars.
Enhance: Need to document PageSplit command.
PageSplit Set <# rows> <# cols>
Initializes multiplot page with given # down page and across
Orientation set by current LANDSCAPE or PORTRAIT orientation.
"Orient Portrait PageSplit Set 5 3" Nice 15 plot page
"Orient Landscape PageSplit Set 3 4" Other nice way
PageSplit Select
Make next plot start at specified position. Both are taken
mod the actual number of rows and columns
PageSplit Cancel
Returns to single plot per page format
Erase (implicit or explicit)
Advance to next plot position, going left to right and then
top to bottom (row major format). [Western Culture dictates].
NewPage
In multipage mode, starts a new page. In single page mode,
is equivalent to the old erase.
Enhance: If a command is not recognized, the default is to attempt the
operation as a "let", "setv", "define", "declare" or "eval"
depending on the nature of the command line before returning an
unrecognized command error.
Subsequent token exists and is an "=" sign (space separated):
Variable exists:
Set value of variable as per the expression following
Variable does not exist:
Variable contains an parenthesis, treat as "define"
Expression quoted (explicit or implicit), treat as "declare"
Otherwise "setv" as REAL or COMPLEX based on MATHMODE
Token contains a mathematical operator (+-*/ etc.)
Treat as "eval"
In all cases where the variable is implicitely allocated, a message
identifying the variable and the type that was assumed is printed.
All of the &getarg processor commands return implicitely quoted
strings and hence will "declare" a string variable. This can be
a problem if you need the value to be "REAL" for use in operations
like NLSFIT. The following demonstrates the problem.
f(x) = a*x
a = &getarg -prompt "Initial guess of slope" -default 1
nlsfit
equ f
vary a / <==== FAILSE since a is a string, not a variable
Math expressions are often okay either way since strings are
evaluated as if they were functions of no arguments. But it is
safer to set variable explicitely with "setvar" -- for the
following eventual reason:
declare a = 7+8 /* A string declaration
declare b = 8+9
eval a+b /* Resolved to be a string expression
result: 7+8+8+9
eval 0+a+b /* Resolved to be a numeric expressoin
result: 32
Enhance: New file tests (function evaluator):
isfile(pathname) returns 1 if path is an existing file
isdir(pathname) returns 1 if path is an existing directory
filedate(pathname) both return seconds since epoch, or -1 if
filetime(pathname) the file does not exist.
filesize(pathname) size of file in bytes, or -1 if doesn't exist
Document: GENPLOT Configure
? | help - obvious
status | parms | parameters - prints current settings
value - binary flag set (debug only)
confirmoverwrite | noconfirmoverwrite - check before writing file
binarywrite | nobinarywrite - default to binary files
asciiwrite | noasciiwrite - default to ascii files
datapath | dpath - set data file search path
dataexts - set data file extensions
Enhance: Added two new key commands
- backward word
- forward word
There are currently no equivalent UNIX key strokes, but they can be
defined via the termkey file -- see "termkey" in bin distribution.
The definition of a word is my choice -- any other logical one will
be happily considered (ie. does an _ define a word ending or just
a normal character).
Enhance: New loop control commands
break - breaks out of currently active loop, foreach or while
continue - skips to next element of active loop, foreach or while
These control signals will only operate on foreach/while/loop blocks.
GENPLOT: loop 200 setv i1=%c if (%c>=20) { continue } setv i2=%c
GENPLOT: printf "i1=%d i2=%d" i1,i2
i1=200 i2=19
GENPLOT:
GENPLOT: loop 200 setv i1=%c if (%c>=20) { break } setv i2=%c
GENPLOT: printf "i1=%d i2=%d" i1,i2
i1=20 i2=19
GENPLOT:
Change: The "block" statements within a "loop", "while", or "foreach" command
are now by default made non-echo. If you need echoing to debug, add
explicit "@echo on" to the block. This change also apply to all
"xeqs" inside the block. "if" blocks inherit the echo-characteristic
of the calling program. Change necessary because of the large amount
of screen output that may occur from even a simple loop command.
Enhance: Genplot will now automatically write .gz files if the extension is
detected. write "test.dat.gz" becomes "| gzip -9 > test.dat.gz"
Clarify: Label statements cannot be dynamic. :xxx must be a static name.
This is required since a GOTO within a block "loop" or "foreach"
will only scan the block once before rewinding to the beginning
of the file. GOTO's within a block will be properly handled,
but only when the name is static. :count%c is invalid
Segment below is an example of valid internal and external goto.
loop 10 {
setv icnt = 0
:start
echo %c
let icnt = icnt+1
if (icnt==1) goto start
if (%c > 8) goto end
}
bad_statement_1
bad_statement_2
:end
echo We are finished.
Also, on console input, multiple blank lines (about 5 or 6 of them)
will terminate a GOTO$ search (just so you don't get too frustrated)
Enhance: Added block execution blocks plus "loop", "while" and if/elseif/else
constructs. These are alpha test and hopefully haven't destroyed
any other components.
if (expr) {
list of commands
} elseif (expr) {
list of commands
} else {
list of commands
}
while (condition) {
expressions
}
loop (count) {
epxressions
}
Expressions not using { } delineation will assume the remainder
of the current command line. As usual, line boundaries are not
relevent and everything can be on a single line.
if (8<9) { if (4<3) { echo y^2 } else { echo y/n } } else echo no
If blocks may be nested to a maximum depth of 64 -- but this includes
all types of nesting including macros calling macros and for %f loops.
Still, it is big enough that I don't think it should be exceeded too
soon.
WARNING: Syntax is not checked -- and certain structures are allowed
syntactically though they make little sense.
if (x < 8) echo hi
let x = x-1
elseif (x<8) echo another hi
elseif do not have to immediately follow an if, and multiple else/
elseif's may follow a single if. Only one block will ever be
executed and the flag indicating that one has been done is not
cleared except on an if. I don't want to know what craziness
someone is going to do with this "feature" behavior.
WARNING: At the moment, behavior of block statements with the
"for %f" processing will not work. See below for improvement.
WARNING: while (condition) is tested BEFORE executation of the block.
If the condition is false to begin, then the block will never be
executed. If there is interest, I can make an until (condition)
command.
Enhance: for %f and repeat commands have been replaced. The old will remain
until I can ascertain that the new ones work, but then will be
obsoleted. New are flexible enough to work as old.
foreach (a b c ...) { expressions }
loop times { expressions}
Also works
foreach %f in (a b c) do { expressions }
Enhance: xeq and read can now fully utilize pipes. Both will now check if
there is a file with .gz extension and use "gzip -dc" to unpack
the file during execution.
Enhance: Added pipe cabability to LEX file execution (xeq "| rr") which reads
input from a pipe started with the given command. Also added pipe to
multi-line read in ANNOTE. multiline x,y "| test" as well as
multi-line x,y "< test.fil".
Enhance: 3D plots to the POSTSCRIPT driver now uses true fonts instead of
the hershey fonts. This only applies to the postscript driver --
even the PM driver does not have general transformation
capability as far as I can determine.
Enhance: ASCII data file reads have been sped up by a factor of 3-4 at the
cost of a slight slowdown (5%) for data files with expressions
rather than simple numbers. Most of the data reads are of pure
numbers which can be interpreted very fast.
Added: New functions
exists(var_name)
limit(value, low_limit, upper_limit)
and modified function
typeof(var_name).
exists() returns 1 if the variable exists and 0 otherwise. typeof
used to give an error if the variable did not exist -- it now returns
-1 to indicate no variable type.
limit(x,xmin,xmax) = max(xmin,min(x,xmax))
which I always end up coding wrong.
Modified: Increased size of almost all strings. There are now four general
lengths. 80 characters if nothing but simple text. 256 for most
general work. 1024 for anything that might need to be long (text
output, equations). There are some still 32 characters but only
where the input is expected to be a variable name.
Modified: let command now aborts on errors rather than trying to complete
a list expression. Necessary because now accepts the form
"let p() = 1,7,3,5" to fill an array. If () is specified, it
is recognized as a request to enter all of the elements.
Added: More explicit directions and include files for compiling extensions
with Visual C from IBM. Set genplot/os2/user directory for
information.
Modified: Causes L&S to give proper legend in GENPLOT.
Modified: Added -RESET to the IDENTIFY options. This resets the next
position for a IDS to the "starting" point for next object.
Useful for moving the starting point and then beginning a new
set of idents on the page.
Modified: On cursor -track, HOME and END now move to beginning and end of
the data set. Also modified so it will not go off screen.
Document: Make sure to add ncol and nrow as reserved names for GENPLOT.
Added: New command "MATRIX" similar to TRANSFORM with multiple subcommands
TRANSPOSE
Transposes the matrix (x<->y)
DUPLICATE
Duplicates a surface
ROW_EXTRACT
X_SCAN
COLUMN_EXTRACT
Y_SCAN
The specified row/cols are extracted and averaged. Either
a single column can be specified (ordinal 1-ncol), or
multiple columns in a parenthentical list (1,7) meaning
average the first 7 columns. NOTE: First row is row 1, and
averaging first seven rows is done by
matrix row_extract 1,7
Result is always left in the main curve (default)
TO_CURVE
The SURFACE is expanded into the default curve
TO_SURFACE
The current 3D curve is converted into a SURFACE assuming
that it is really on a mesh. X,Y points must make sense as
either a column or row major matrix orientation (ie. X same
for nrow Y values, or Y same for ncol X values). Will fail
if no underlying matrix is found.
All MATRIX commands requests will use as the , if expected,
a currently active surface requested after the MATRIX command. So,
the following commands are synonymous:
MATRIX S1 TRANSPOSE
MATRIX TRANSPOSE S1
MATRIX -SURFACE S1 TRANSPOSE
assuming S1 is a valid matrix.
Additional commands such as SQUISH, CULL, SMOOTH, etc. can be
implemented as necessary in this formalism, upon request.
Added: Can do a "status" on a matrix, getting something useful back.
Added: Also, now can do an "eval" on surface or curves, with expected
results. The printout can be aborted with ^C.
Modified: Options to READ can be given before or after (or both) the
filename. Getting used to doing
read -surface s1 test.mat
Added: WRITE -SURFACE [-BINARY | -ASCII] ...
Similar options to normal function write.
-SURFACE is synonymous with -CURVE and either may be used.
write
[-CURVE | -SURFACE ] - change from default curve
[-LIST ... /] - use a variable list instead
[-ASCII | -BINARY] - default depends on setting
[-NOTEXT]
[-TEXT | -COMMENTS] - prompted at write
[-COMMANDS]
[-COMment ] - in-line quick comment
[-APPEND]
[-SILENT]
[-FORCE] - don't check on overwrite
[-USER] - use user writeen routine
Added: Read ASCII 3D surfaces in matrix format.
WARNING: This is substantial new code and likely still has some
errors. Let me know of any problems.
FORMAT is difficult, but try to be flexible:
1. Blank lines, lines beginning with # of /* are ignored.
2. Header section consists of all lines beginning with the
following keywords (case insensitive):
keyword description default
-----------------------------------------------------------
COLS: # of columns (x values)
ROWS: # of rows (y values)
COMMENT: description of file filename
XSCALE: spacing on x points 1.0
XORIGIN: x value of first column 0.0
YSCALE: spacing on y points 1.0
YORIGIN: y value of first row 0.0
XDATA: collection of X points (COLS)
YDATA: collection of Y points (ROWS)
ZDATA: z data begins immediately
If ZDATA is not specified, it is assumed to begin with the first
line of data following the headers. Data will be read one value
at a time in row major format. Specificially,
X[0]Y[0], X[1]Y[0], X[2]Y[0] ... X[COLS]Y[0]
X[0]Y[1], X[1]Y[1], X[2]Y[1] ... X[COLS]Y[1]
....
X[0]Y[ROWS], ... ... X[COLS]Y[ROWS]
Lines must be less than 1024 characters. All punctuation is
converted to whitespace, and values are interpreted sequencially
independent of lines. All values may be on a single line, or data
may be organized one entry per line, as long as it is in the order
specified.
If the COLS header item is not specified, the first non-header
line will be scanned for the number of tokens, and this will
become COLS. If ROWS is not specified, then file will be read
until there is no more data and the number of completed rows will
become the value of ROWS. Specifying XDATA and YDATA is only
valid after the corresponding ROWS or COLS is specified.
If the file read options -COLS or -ROWS are specified, they are
handled only AFTER read and interpreting, so no time is save. All
of the surface will be read and then will be truncated as necessary.
This is required since the lines and rows do not necessarily align.
Added: DIGITIZE as an internal aliased command to "READ %DIGITIZE"
Added: "READ %CURSOR" as simple way to enter points off the screen.
Modify: Added -NORMALIZE option (to -weighted) in the TRANSFORM Y
histogram or cbin transformations. Avoids the need to normalize
to a sum of zero afterward. If the -normalize option is given,
the sum of all the intervals will be unity. The command
transf y hist 0.02 -normalize
is equivalent to
transf y hist 0.02
let y = y/@sum(y)
Also added -DENSITY to give a probability density value. Using
-DENSITY causes the value in each bin to be divided by the bin
width so an integral over the curve yields the total rather than
a sum.
Modify: Clarified "user coordinate" setting on entrance to annote from
RUMP. Will now be in units of channels (NOT ENERGY) and in the
y axis range.
Enhance: Enabled printing of full color graphs from the PM screen. There
are now separate palettes for printing and display (totally
distinct). The default page color may be specified, which will be
used if a negative (or default) page color is specified on
erase. (See PageColor command.)
Enhance: Enable setting of page color with the command "PageColor ".
For suitable devices, this will set the background page color as
desired. The default (or any negative value) is to disable the
page color (unless the driver establishes some other default).
Pagecolor
color may be specified by name or as a numerical pen value.
Enhance: Annote has a new function: FILLED_RECT .
However, only limited number of drivers support, currently only
the PM driver.
Enhance: SUB_PLOT has new options.
-erase
-fill
On devices supporting filled rectangle draw, will fill the region
of the new plot with the specified color. -erase fills with color
0 which should be the background color.
Enhance: Several of the annote functions now use the rectangle box cursor
instead of having to enter two points. Makes life somewhat easier.
Enhance: The create functions in