Current Page:
NeXtMidas Training
Option Trees
Lab 2
Instructions
|
|
- Lab 2:
- For this lab you will create an option tree called TRAIN that you will use again for
the labs in subsequent modules.
- What you need to do:
- Decide where you want to put your option tree. (Hint: your
home directory is a good location. e.g. $HOME/nmopts/nxm/train)
- Create the option tree and add it to your path.
- You may use
OPTION to create the option tree or do it manually.
- If you do it manually you will need to make sure not to forget the
mcr and prim sub-directories. You will also need to
make sure to copy over the template commands.cnf file.
- Do not try the "symbolic link" approach, since it requires you to have
write access to the NeXtMidas installation (i.e. to put symbolic link under
$NMROOT/nxm/ that points to your option tree).
- Do not try the "back-link" approach, it will cause problems
for later labs.
- Add the following commands to your option tree (Be sure to use
the name provided below):
- counter.java (primitive)
- sayhello.mm (macro)
- Use
UPDATE to add each of the commands to the dictionary.
COUNTER takes in two numbers, START= and
END= which default to 1 and 10 respectively.
SAYHELLO takes in a single string NAME= which
defaults to "Anonymous" .
- Build your option tree.
- Try everything out.
nM> counter ,, 9
INFO: Counting from 1 to 9 [COUNTER]
INFO: Count is at 1 [COUNTER]
INFO: Count is at 2 [COUNTER]
INFO: Count is at 3 [COUNTER]
INFO: Count is at 4 [COUNTER]
INFO: Count is at 5 [COUNTER]
INFO: Count is at 6 [COUNTER]
INFO: Count is at 7 [COUNTER]
INFO: Count is at 8 [COUNTER]
INFO: Count is at 9 [COUNTER]
INFO: Done counting [COUNTER]
nM>
nM>
nM> sayhello Tony
INFO: Hello TONY! [SAYHELLO]
- Tailor your NeXtMidas environment by putting a
nmstartup.mm macro in
your $HOME directory (e.g. /home/student/nmstartup.mm) with the following contents:
! customize user's NeXtMidas environment (put this into $HOME/nmstartup.mm)
startmacro
say "Running my (^{env.user}'s) custom nmstartup.mm macro..."
! portable way to get path to TRAIN option tree under user's home dir ($HOME/nmopts/nxm/train/)
file name trainDir (^{env.home},nmopts,nxm,train)
! define train option tree and add it to the path
option train trainDir
path add train
endmacro
The next time you run nmstart , your $HOME/nmstartup.mm macro gets
automatically executed; which will define your TRAIN option and add it to the path.
|
|
|