;; Program to test for register copy bug on the Mac OS X Intel operating ;; system that may be encountered when running IDL and ENVI applications. ;; ;; RUNNING THE PROGRAM ;; To run the program, simply restore or compile the program and then ;; call the program name from an IDL command prompt. For example: ;; ;; IDL> restore, '/Users/home/jim/Desktop/test_macintel.sav' ;; IDL> test_macintel ;; -or- ;; IDL> .compile /Users/home/jim/Desktop/test_macintel.pro ;; IDL> test_macintel ;; ;; To run the program in IDL Virtual machine mode, start the IDL Virtual ;; Machine, then navigate to and select the test_macintel.sav file. ;; ;; OPTIONAL MODES ;; To show additional details about the manifestation of the problem or ;; to invoke the program with a built in workaround mode, the program ;; may be run in either of 2 optional modes by providing the appropriate ;; command line argument switch parameters: ;; ;; Option 1: verbose ;; Show how may element copy errors and in what test iteration the error ;; is encountered. To invoke ths mode when running the test program, your ;; IDL session launch command should include the switch -arg verbose. For ;; example to run the test program save file in verbose mode using IDL ;; Virtual Machine, your command might look something like this: ;; ;; idl -vm=/Users/home/jim/Desktop/test_macintel.sav -arg verbose ;; ;; Option 2: notimer ;; Invoke the DEVICE, /NOTIMER command to invoke the workaround state ;; for this problem. Note that any prior graphical commands for the ;; IDL session will override the workaround effect of this command. ;; For example, to launch the test program from command line IDL mode ;; using the -e switch to call the program with the idl command, your ;; command might look something like this: ;; ;; idl -e test_macintel -arg notimer ;; ;; This command assumes that the test_macintel.pro or test_macintel.sav ;; file exists in the current working directory or is in the IDL session ;; program search path. ;; PRO test_macintel PRINT, 'Running program to test for Mac Intel register copy error.' ; Check for IDL session command line argument (-arg) input. ; If -arg verbose switch/argument is used to launch IDL session ; then run this program in verbose mode. Else if -arg notimer ; is used then issue DEVICE, /NOTIMER workaround command as the ; first graphical command in this test application. Only one -arg ; parameter is accepted. verbose = STRUPCASE((COMMAND_LINE_ARGS())[0]) EQ 'VERBOSE' ? 1 : 0 notimer = STRUPCASE((COMMAND_LINE_ARGS())[0]) EQ 'NOTIMER' ? 1 : 0 ; If DEVICE, /NOTIMER is called as the first graphical command ; to the IDL session, then subsequent graphical commands will ; not cause IDL session to be susceptible to Intel Mac register ; copy bug. If an IDL graphical command was issued prior to this ; DEVICE call then this workaround will not be effective. IF notimer THEN BEGIN PRINT, '>>> Issuing command "DEVICE, /NOTIMER" <<<' DEVICE, /NOTIMER ENDIF ; Invoke graphics command to set up conditions for bug. WINDOW & WDELETE ; Create large array filled with 1's. IF verbose THEN PRINT, 'Testing with byte array containing 35,000,000 elements.' data = BYTARR(35000000L)+1B ; Flag for encounter with register copy error errflag = 0 ; ; Repeatedly copy test array to another variable then ; test array elements to verify correct copy. ; iterations = 500 siterations = STRCOMPRESS(iterations, /REMOVE_ALL) cols = 0 FOR i=0L, iterations - 1 DO BEGIN data2 = data w = WHERE(data NE data2, count) ; If copy error encountered, then report it. IF (count GT 0) THEN BEGIN errflag = 1 IF verbose THEN BEGIN si = STRCOMPRESS(i, /REMOVE_ALL) scount = STRCOMPRESS(count, /REMOVE_ALL) PRINT PRINT, '*** Iteration ' + si + ' (of ' + siterations + '): ' + scount + ' copy errors ***' cols = 0 ENDIF ELSE BREAK ; If not verbose mode then test is finished. ENDIF ELSE BEGIN cols += 1 ; Show program is running. Format for IDLDE output log window. IF cols EQ 50 THEN BEGIN PRINT, '.' cols = 0 ENDIF ELSE $ PRINT, '.', FORMAT = '($,a)' ENDELSE ENDFOR tturl = 'http://www.ittvis.com/services/techtip.asp?ttid=4081' msgnoerr = '%' + STRING(10B) + $ '% No copy errors encountered.'+ STRING(10B) + $ '%' msgerr = '%' + STRING(10B) + $ '% Copy errors encountered. Refer to the following ITT VIS' + STRING(10B) + $ '% Tech Tip article (4081) for a discussion about this problem:' + STRING(10B) + $ '%' + STRING(10B) + $ '% ' + tturl + STRING(10B) + $ '%' PRINT PRINT, errflag ? msgerr : msgnoerr PRINT, 'Program done.' END