[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: CLIP's test of virtue -- and memory immunization ?



** Reply to message from Harry Binswanger  on Fri, 10 Dec 2004
22:38:54 -0500

> I saved a ton of memory by not using LDSGT XY4.SGT in
> STARTUP.INT (or anywhere else). Anyone who is using LDSGT
> should cease and desist.

> I'm not sure what an XPL library is (unless you mean
> incorporating into U2). I just put into STARTUP.INT as
> separate lines things like:

> BX ldpm c:\xy\macro.pgm,&m

> I have 8 such LPDM lines, but my starting memory usage is
> now only 3. With LDSGT it was 7.

Wanna reduce that from 3 to Zero? You are correct that you
will reduce the total memory consumed by about half if you
establish the macros individually in STARTUP.INT, rather
than loading them as a chunk in STARTUP.INT with the LDSGT
command. And if people can't manage the following
procedures, then they should do precisely what you've done.

But look, you're still shlepping a lot of memory around with
you all the time with your procedure. Consider: Save/Get
&M is actually a piece of Xyarcana called "special" Save/Get
*0115. Command LISTSAVS and you'll find it listed.
You can see the first 77 bytes of S/G *0115 by commanding
"VA/NV @*277"
You can get the total size of S/G *0115 with
"VA/NV |*277"
Sum the total sizes of all your "&"-type Save/Gets, and
that's the amount of dead weight memory you're consuming in
this department alone. There's absolutely no need for it.

FYI: The ONLY loadable Save/Gets that do NOT consume any
memory are Save/Gets $0-$9, $A-$Z. And what they do is
essentially what I propose below, although I do it slightly
differently (pick your flavor).

Let's start at the beginning. In lieu of that tutorial I
keep talking about but never write, this is addressed to
"everybody", not just Harry (who, I'm sure, knows about a
lot of what follows), and represents a first stab at
addressing the issue.

There are a number of easy things that can be done to reduce
memory consumption.

STARTUP.INT:
-----------
In general, LOAD commands consume less memory than the old,
deprecated, file-specific commands like LDKBD, LDPRN, LP.
The major exception is any command that loads a PRiNter file
directly, because each time you execute one of those (LDPRN,
LP, LOAD) commands, you add a new iteration of the PRN to
memory -- and eventually, if you do it often enough, or
change PRNs frequently, you crash. With PRiNter files
*only*, you should use the "SETP #" command, which of course
requires that you have a properly written PP: table in
(usually) DFL. So:

Replace LDKBD commands with LOAD
Replace LP, LDPRN, or LOAD {PRNfile} command with SETP #
Replace LP or LDPRN command for *DFL* (which is actually
 a PRiNter file, believe it or not) with LOAD {DFLfile}

As mentioned above by Harry, you can replace LDSGT of the
*binary* STSGT file with individual assignments in
STARTUP.INT (the logical place for them), e.g.
etc. And that is much more conservative
of memory than using LDSGT. Harry is very conservative.

However, his "8" [Kb] is a little bit high for S/G Memory.
I am never more than 4 Kb. The smart way to manage these
"personal" macros is to move them into U2 or DLG. This is
real easy. We'll consider putting them in U2 first, then
describe an "Alternate Procedure" for DLG. There are two
steps:

1) Shut XyWrite down, and start it up again "clean". Don't
do any editing. Presumably all "ordinary" @0-@9,@A-@Z
macros (from LDSGT or whatever source) will have been loaded
into memory via STARTUP.INT. RUN (on the CMline) the
program attached to this msg (also encoded below): "RUN
SVMACROS.PM". When the program is finished, you'll have
in front of you a file of all your macros, preformatted for
inclusion in U2. But that file will not be SAved yet -- it
will be in an [UNTITLED] window. So give it a file name,
e.g. command:
 SAVE MYMACROS.U2
That converts the [UNTITLED] screen into a disk file. Then
CAll U2, e.g.
 CA$ U2
MErge or CoPy the MYMACROS.U2 file into U2 at the very top.
Then command:
 LOADHELP
So now you've moved all your macros into an "XPL library".
Note that all your personal macros are now in a single,
easily edited file. You can tinker with them anytime.
Whenever a new U2 is published, you simply want to MErge
this file into the top of U2, as above. It's a pie-simple
procedure. End of Step 1.

2) CAll your KBD file, e.g.:
 CA$ KB
Find the TABLE that has ordinary Save/Gets loaded on it --
or, if your trigger keys are all over the place, you'll need
to find them ("IDKEY" makes that incredibly easy).
The default TABLE for ordinary Save/Gets in the factory-
vanilla XY4-3.KBD file (for old users migrating from Xy3 to
Xy4) was TABLE=ALT (there weren't any ordinary macro calls
in the CUA KBDfile, XY4.KBD).

This is what you want to do. Keep your copy of MYMACROS.U2
in the window adjacent to KBD. Note that every frame in
MYMACROS bears a framename that corresponds to the old macro
letter|number, e.g. {{5SGA}} or {{5SG0}} or {{5SGZ}}, which
correspond to Save/Gets A, 0, and Z (function calls @A, @0,
@Z). Suppose you formerly had a macro on Alt-A. You want to
change the KBD assignment from:

30=@A (or perhaps 30=NI,@A or 30=NI@A)
 to
30=NIJM2,.,S,G,A,Q2 <== where the "A" corresponds to the
 old macro number or letter assignment. **No need for func
 NI if it isn't an ALT table!** (Maybe no need for NI,
 period -- but that's a different subject.)

Make a similar change for each macro frame and each
corresponding keystroke in MYMACROS.U2. If no macro is
assigned to a particular key, then there's no need to change
the old assignment in KBD -- you want to keep a few of those
"@-keys" around so that you can still record keystrokes on
the fly, and then LDRK them for easy execution (or use one
of the vastly superior auto-debugging U2 facilities for
managing on-the-fly macro recording, such as RK or RKOK).
Be sure to re-LOAD the KBD file when done.

Now you want to do some cleanup. Go into STARTUP.INT, and
kill any LDSGT command. Kill any ordinary macros assigned
there -- you've already captured them and handled them via
SVMACROS.PM.

You want to manually take the files called by LDPM commands
in STARTUP.INT and put them in U2 also. Get them off those
"&-type" macro keys -- they're memory killers.

Alternate Procedure:
--------- ---------
Here's a different approach. Run SVMACROS.PM, and then SAve
the file e.g. as MYMACROS.DLG, as above. Execute this CIA
command against MYMACROS.DLG:

 cia |{{5SG|{{5$|

SAve file MYMACROS.DLG again. Now, instead of integrating
this file into U2, MErge it at the top of *DLG*, and then
"LOADHELP".

CAll KBD file. Again, find each old assignment, and change
it from e.g.:

30=@A (or perhaps 30=NI,@A or 30=NI@A)
 to
30=$A (or 30=NI$A if TABLE=ALT)

In other words, change the "@" to "$" -- which is a
different function call. When done, re-LOAD the KBD file.

No more memory consumed by macros. Your VA/NV $M+6 should
be consistently low now...

-------------------

Another thing you can do, if you run Stack, is reduce your
maximum Stack size to 150 commands (use the Truncate command
of STACKAUX first -- if you are presently using the default
of 200 commands, issue STACKAUX T55 (kills the 55
oldest commands), then CA$ DG, set  in
frame "stack.int", and LOADHELP.

Also: you might consider using v3.3 of Stack, which runs
from U2 instead of DLG. It's a smarter program, and if I
need to change any of Stack's programming, I can do so
within an updated U2 instead of having to post elaborate
instructions for changing DLG (where Stack formerly resided).

Keep checking the amount of XPL memory consumed with
"VA/NV $M+6". If you really want to keep an eye on it
during these procedures, open an [UNTITLED] window, and embed
 at the top (command "VA $M+6"), then make sure
the window is in Draft mode or higher. It will always
display current XPL memory consumption (in Kb).

Sometimes memory gets out of hand ( >14Kb or so). There is
a relatively new frame in U2 that removes *some* of this
consumption harmlessly: command KILLMEM. That may
-- or may not -- make a difference, it "depends" (on this
and that).

Here's SVMACROS.PM. Hope this all helps somebody. And good
luck.

XPLeNCODE v2.0
b-gin SVMACROS.PM
;*; Create a single plain-text XPL file, ready for direct inc
lusion in U2,[cr|lf];*; from all @0-@9,@A-@Z ("ordinary Save
/Get") Macros in memory[cr|lf];*; R.J.Holmgren 12/11/04[cr|l
f];*;[cr|lf]{<}IF{<}VA$WA{>}>0{>}{<}SV01,[255+129+002]{>}{<}S
V02,{129}{>}{<}XS01,02,,02,03{>}[JM_]2.tmpfile/nv[Q2_]{<}SX01
,{<}IS50{>}{>}{<}SX50,{<}VA$ED{>}{>}[JM_]2.GetPath[Q2_]{<}SX5
0,{<}IS50{>}+"\"+{<}IS01{>}{>}[BX_]ne[Q2_][BX_]wait[Q2_][XP_]
[BF_];U2;; Personal Routines (formerly in LDSGT file)[cr|lf]Y
ou MUST command "SAve filename" to retain this file for f
uture use![cr|lf]*Each time* a new XyWWWeb.U2 is published, M
Erge this file at the top[cr|lf] of U2, then command "LOADHE
LP"[cr|lf][cr|lf]{<}LBB{>}{<}SV01,0123456789ABCDEFGH
IJKLMNOPQRSTUVWXYZ{>}{<}SV02,{027}X{>}{<}LBA{>}{<}SV04,{>}{<}
SV05,{>}{<}SV06,{>}{<}XS01,02,,04,05{>}{<}SX06,"{<}IF{<}VA|"+
{<}IS04{>}+"{>}>0{>}[BX_]sa %"+{<}IS04{>}+",{<}PV50{>}[Q2_][B
X_]wait[Q2_][BF_]{"+"{;5SG"+{<}IS04{>}+"}"+"}[cr|lf]"+{<}IS03
{>}+"[BX_]me {<}PV50{>}[Q2_]"+{<}IS03{>}+"[cr|lf][cr|lf][BX_]
ernv {<}PV50{>}[Q2_][BX_]wait[Q2_]{<}EI{>}"{>}{<}PV06{>}{<}IF
{<}VA|05{>}>0{>}{<}SX01,{<}IS05{>}{>}{<}GLA{>}{<}EI{>}[TF_]{<
}PR"SAve filename" to retain this file - Done{>}{<}EX{>}{
<}EI{>}{<}PRNo window{>}{<}EX{>}[cr|lf]
-nd
XPLeNCODE

-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------