home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast2.iso
/
sprint
/
indepen.zip
/
INDEPEN.SPM
Wrap
Text File
|
1993-08-31
|
5KB
|
134 lines
Make Your .spms be Machine Independent
Problem:
Do you run Sprint on more than one machine, or get a new machine
and want to move Sprint over? Meanwhile, you are going crazy
getting the hardcoded directories lined up properly. Or you are
forever going crazy trying to keep the PC at home and the PC at
work more or less talking the same interface. Well after years
of suffering, I believe I have figured out a way to make a
system-independent Sprint.
General Solution:
Following the idea of multi-platform packages, make a
"config.spm" for each machine that has all the hardcoded files
and/or machine-specific macros. Now you can move your basic
package, from machine to machine without problem.
The details goes like this:
Step #1: In your "main" .spm file (the one that you start your interface
compile with)-- Add this line (like this):
: if (ask "Toshiba? ") home "C:\\bin\\sprint\\" else home "R:\\sprint\\"
;; You can generalize to have as many tests as needed to specify the
;; home directory for a given machine. You could also set
;; variables/flags at this point (e.g., to leave out mouse.spm).
Step #2: For each machine you will compile Sprint on, make a file
called config.spm that has the "hardcoded" files (i.e.,
special directories, ramdisks, etc.)
[Here is part of mine, where G: is a ramdisk]
MacroDir : ->x (set qnumber x "S:\\sprint\\bas")
MacroFiles : ->x (set qnumber x "S:\\sprint\\bas\\*.spm")
RefFiles : ->x (set qnumber x "S:\\l\\*.lst")
PipeFile : ->x (set qnumber x "G:\\xxxxzzzz.")
TempSPM : ->x (set qnumber x "G:\\123456.spm")
ScratchFile : ->x (set qnumber x "G:\\xxxxzzzz.$$$")
Step #3: Put #include "config" near the beginning of your main.spm
(at least before you read in include other .spms that might need
these config files.) For example:
#include "config" ;; machine specific definitions - usually files/directories
#include "sethcore" ;; basic definitions -- movement, search
#include "column" ;; column commands --menu included.
#include "spell" ;;
etc.
Step #4 In those places in your macros where you have referred to
hard-coded file names, use the macros found in
config.spm For example, instead of using
set QD "G:\\xxxxzzzz.$$$"
you would use:
13 ScratchFile
(where ScratchFile is defined in config.spm).
That's it. It works really well for me. I can move my entire
collection of macros from machine to machine, and provided there
is a config.spm defined on that machine, can recompile without
problem. And if a new machine is being set up, it is easy enough
to hack an existing config.spm to taste.
-----------------------------------------------------------------------
Added Bonus
Recompile your interface while remaining in your current directory.
Normally, to recompile your interface, you have to set your
directory to be where your .spms are. Well that can be a pain in
the neck if you are working in other directory, and making
occasional changes to a single .spm. So...here is a way
to recompile your entire interface without having to switch
directories and without having to lose your current directory.
It goes like this:
1. Include the following macro into your current interface
(and you probably will want to add it to your user interface menu).
N.B.! You must change "seth.spm" to be the name of your main .spm
(sp.spm, fwii.spm, etc.)
(You have already learned to use MacroDir (see Step #2 above).
RecompileInterface :
set QD cd ; hold current directory
mark {to QD insert "■"} ; set flag for automatic macro
0 MacroDir ; get macro directory
set cd Q0 ; change to macro directory
2 mread "seth.spm" ; compile interface
2. After you have recompiled the preceding macro into your
interface, then add the following automatic macro to the end
of your main .spm file (or at least after you have read in
all the "include"'ed .spm files).
; reset current directory after a recompile--must be after all .spms
; see RecompileInterface in macro.spm
: if ((0 subchar QD) = '■') { mark {to QD del } set cd QD }
Although all macros and variables are wiped out by the #clear,
the Q-registers remain unchanged. So this macro
automatic macro to your main.spm. It simply checks the QD
register to see if the first character is ASCII 254.
If it is, then delete it, and set the directory to QD,
otherwise do nothing.
-----------------------------------------------------------------------
Conditions of Use
Use the code as you want, don't sell it, and give credit where
due. Let me know if you try it out, find problems, make
improvements, etc. If get some programming ideas/code
from all this, then I would be grateful if you would share some
of your own interesting macros or formatter hacking with me. If
you don't have any code to share, a postcard or email will be
just fine. Enjoy.
Seth Chaiklin
Institute of Psychology
University of Aarhus
8240 Risskov
DENMARK
email: psykseth@aau.dk
fax: +45 (86) 17 59 73
30 August 1993