Previous Next         Current Page: NeXtMidas Training / Macros - Part 1 (Basics) / Lab 4* / Instructions
Start Here   
Background   
Common Midas Concepts   
Getting Started   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
   + Macro Basics   
   + Lab 1   
   + Lab 2   
   + Loops and Control Structures   
   + Lab 3   
   - Lab 4*   
      - Instructions   
      - Solution   
   + Procedures and Subroutines   
   + Lab 5   
   + Lab 6*   
   + Pipes in a Macro   
   + Lab 7   
   + Lab 8   
   + Messages in a Macro   
   + Lab 9   
   + Lab 10   
Macros - Part 2 (Graphics)   
Primitives   
Installing NeXtMidas   
Applets & WebStart   
Mapping (NeXtEarth)   
Remote Midas InterFace (RMIF)   
Using NetBeans   
X-Midas Interoperability   
Remoting an X-Midas App.   


  • Lab 4:
    • Create a new macro named mcrlab4 in the TRAIN option tree.
    • The macro should take in two parameters: a table (TAB=) and a string (PREFIX=).
    • Your macro should print out all of the values in a table. If one of the values is a table (i.e. a nested table), you will need to recursively call your macro (i.e. call your macro from inside your macro) and print out the values in that table.
    • In the end your macro should work like this:
      nM> mcrlab4 reg reg
      REG.MCRLAB4=M: MCRLAB4,TAB=reg,PREFIX=reg
      REG.SHELL=nxm.sys.lib.Shell@fd66a5
      REG.HANDLERS.FILE.TMP=nxm.sys.lib.DataFile
      REG.HANDLERS.FILE.RAW=nxm.sys.lib.BaseFile
      REG.HANDLERS.FILE.PRM=nxm.sys.lib.DataFile
      ...
      REG.HANDLERS.FILE.TOC=nxm.map.lib.TocFile
      REG.HANDLERS.FILE.SID=nxm.map.lib.MrSidFile
      REG.HANDLERS.PACKET.SDDS=nxm.sys.lib.SDDSPacket
      REG.HANDLERS.PACKET.ICE=nxm.ice.lib.ICEPacket
      REG.HANDLERS.RESOURCE.RAMD=nxm.ice.lib.RamDiskResource
      REG.HANDLERS.RESOURCE.XMPIPE=nxm.sys.libxm.XmPipeResource
    • Hint: You can find out if a value is a Table by seeing if it is of type nxm.sys.lib.Table.
    • Hint: If on the STARTMACRO line you use u:prefix, you will get the "untranslated" value (i.e. it won't try to resolve any of the results).
    • Hint: If your macro is much longer than 15 lines, you are on the wrong track.