/* REXX ---------------------------------------------------------------+ | Copyright (c) 1996, SAS Institute Inc. | | Unpublished - All Rights Reserved | | S A S / C S A M P L E | | | | NAME: LL | | PURPOSE: This DEBUGGER example EXEC is used in Debug Session | | 11 in the SAS/C DEBUGGER USER'S GUIDE, pg. 163, which | | illustrates the transfer, dbinput, and dblog commands. | | These commands enhance communication between the | | SAS/C Debugger and the EXEC, and are issued to the | | Debugger by the EXEC rather than directly. | | | | INPUT/OUTPUT: termin window/log window | | USAGE: exec ll | +---------------------------------------------------------------------*/ more = 'y' flink = 'flink' blink = 'blink' head = 'head' tag = '' window clear log do while more = 'y' if tag = '' then do 'dbinput tag "Linked list traversing EXEC. Enter name of structure:"' end else do 'dbinput temp "Name of next structure (def 'tag'):"' if temp ^= '' then tag = temp end 'dbinput map "Is a mapping of struct 'tag' desired? (y for yes):"' if map = 'y' then 'whatis (struct 'tag')' 'dblog' 'dbinput temp "Enter pointer to the start of the list (def 'head'):"' if temp ^= '' then head = temp 'dbinput temp "Enter name of link to the next element (def 'flink'):" ' if temp ^= '' then flink = temp 'transfer this value' head 'dblog You are are now at 'this'. Your options are:' 'dblog' 'dblog d: display this node' 'dblog f: move forward' 'dblog q: quit' 'dblog' 'dbinput dir "Enter option:"' do while dir ^= 'q' select when dir = 'd' then do 'print *(struct 'tag' *)'this 'dblog' 'dbinput response "Print any character strings in this structure?"' upper response if response = 'Y' then do 'dbinput charval "Which one?"' 'print ((struct 'tag'*)'this')->'charval' %s' 'dblog' end end when dir = 'f' then do 'transfer next value ((struct 'tag' *)'this')->'flink if next = '0p00000000' then 'dblog End of list - cannot move forward.' else this = next end otherwise nop end 'dblog You''re now at 'this'. Your options are:"' 'dblog' 'dblog d: display this node' 'dblog f: move forward' 'dblog q: quit' 'dblog' 'dbinput dir "Enter option:"' end 'dblog You may next dump a structure with a different (or the same)' 'dblog mapping. Your options are:' 'dblog' 'dblog y - yes, dump another structure' 'dblog n - no, I''d rather quit' 'dblog' 'dbinput more "Enter option:"' end exit