comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL V4 and Windows 95
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDL V4 and Windows 95 [message #6052] Thu, 04 April 1996 00:00
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Mirko Vukovic wrote:

> Yes, can you please post that (concat4dos) utility.

CONCAT4DOS is included below. It is a modification of the routine of the same name in
the CDS library (http://sohowww.nascom.nasa.gov/solarsoft/gen/idl/) and it calls
FDECOMP from the CDS library, plus OS_FAMILY, which is in the IDL Astronomy Library
(http://idlastro.gsfc.nasa.gov/homepage.html) but may also be in the CDS library.

> Can you please be more specific
> on adding a space to file names. Where? In the idl call or to the file name
> itself?

Either, eg, create a file called alongname.txt and try to open it:

IDL> name='c:\temp\alongname.txt'
IDL> openr,1,name
% OPENR: Error opening file: c:\temp\alongnam.txt.
No such file or directory
% Execution halted at: $MAIN$

That doesn't work but this does:

IDL> openr,1,name+' '
IDL> text='' & readf,1,text & print,text
some text
IDL> close,1

However use this workaround at your own risk. I've had strange results from FINDFILE
when used with long file names--seems to corrupt the file name.

> How do people like the imbedded editor? I usually kill those windows as they pop and
> do most of the editing via emacs. The idl editor, I use for debugging.

Me too. I stopped using the IDL editor when, in an earlier version, it used to erase
the files it was editing!

============================================================ ==
Mark Hadfield NIWA (Taihoro Nukurangi)
PO Box 14-901
m.hadfield@niwa.cri.nz Wellington, New Zealand

************************************************************ **

PRO CONCAT4DOS, SUBDIRECTORIES=SUBDIRECTORIES
;+
; Project : SOHO - CDS
;
; Name :
; CONCAT4DOS
; Purpose :
; Concatenates IDL procedure files for copying to DOS machine.
; Explanation :
; Concatenates IDL procedure files together into a form suitable for
; copying to a DOS machine.
;
; All the .PRO files in the current directory are copied into a special
; "dos" subdirectory, with the following changes made:
;
; 1. All filenames are truncated to eight characters.
; 2. All procedure files with names beginning with the same
; first eight characters are concatenated together into a
; single file.
;
; Use :
; CD, directory ;(go to desired directory)
; CONCAT4DOS ;or CONCAT4DOS, /SUBDIRECTORIES
; Inputs :
; None.
; Opt. Inputs :
; None.
; Outputs :
; None.
; Opt. Outputs:
; None.
; Keywords :
; SUBDIRECTORIES = If set, then subdirectories are also recursively
; processed. This does not work under Windows.
; Calls :
; FDECOMP
; Common :
; None.
; Restrictions:
; None.
; Side effects:
; A "dos" subdirectory is created. A temporary command file is created
; and then destroyed. On VMS machines, the file is called "CONCAT4DOS.COM",
; on UNIX machines it is called "concat4dos.sh" and on MS-Windows machines
; it is called "concat4.bat".
; Category :
; Utilities, Operating_system.
; Prev. Hist. :
; William Thompson, August 1992.
; Written :
; William Thompson, GSFC, August 1992.
; Modified :
; Version 1, William Thompson, GSFC, 9 July 1993.
; Incorporated into CDS library.
; Modified so that a temporary file is created on UNIX machines
; as well, to speed up.
; Version 2, William Thompson, GSFC, 18 April 1994.
; Added SUBDIRECTORIES switch, and copying of documentation (.txt
; or .tex) files.
; Mark Hadfield (m.hadfield@niwa.cri.nz), December 1995
; Added Windows code,.
;-
;
ON_ERROR,2
;
; If the SUBDIRECTORIES switch was set, then first process the current
; directory. Make sure that a "dos" subdirectory is created.
;
IF KEYWORD_SET(SUBDIRECTORIES) THEN BEGIN
CONCAT4DOS
IF os_family() EQ 'vms' THEN BEGIN
DOSDIRFILE = FINDFILE('DOS.DIR',COUNT=N_FOUND)
IF N_FOUND EQ 0 THEN SPAWN, $
'CREATE/DIRECTORY [.DOS]'
ENDIF ELSE IF os_family() EQ 'Windows' THEN BEGIN
message,'Sorry, CONCAT4DOS does not process subdirectories under
Windows.'
END ELSE BEGIN
DOSDIRFILE = FINDFILE('dos',COUNT=N_FOUND)
IF N_FOUND EQ 0 THEN SPAWN, 'mkdir dos'
ENDELSE
;
; Next find all the subdirectories under the current directory.
;
IF os_family() EQ 'vms' THEN BEGIN
DIR_FILES = FINDFILE('*.dir')
BREAK_FILE, DIR_FILES, D1, D2, DIRS, D3, D4, D5
ENDIF ELSE IF OS_FAMILY() eq 'Windows' THEN BEGIN & yield
DIR_FILES = FINDFILE('*')
ISDIR = WHERE(STRMID(DIR_FILES,0,1) NE '.' AND
STRPOS(DIR_FILES,'\') GT -1,COUNT)
IF COUNT GT 1 THEN DIRS = DIR_FILES(ISDIR) ELSE RETURN
ENDIF ELSE SPAWN, 'find * -type d -print -prune', DIRS
;
; Process each subdirectory, and move its "dos" file under the one for the
; current directory.
; I omitted this operation under MS-Windows because I am not sure what it's
; supposed to do.
;
FOR I_DIR = 0,N_ELEMENTS(DIRS)-1 DO BEGIN
DIR = DIRS(I_DIR)
DIR8 = STRMID(DIR,0,8)
IF (DIR NE '') AND (DIR NE 'dos') AND (DIR NE 'dos\') THEN
BEGIN
CD,DIR
CONCAT4DOS, /SUBDIRECTORIES
IF os_family() EQ 'vms' THEN BEGIN
SPAWN,'RENAME DOS.DIR [-.DOS]' + $
DIR8 + '.DIR'
ENDIF ELSE BEGIN
SPAWN,'mv dos ../dos/' + DIR8
ENDELSE
CD,'..'
ENDIF
ENDFOR
RETURN
ENDIF
;
; Start of the section that processes the current directory. First make sure
; there are procedure files in the current directory.
;
FILES = FINDFILE('*.pro',COUNT=N_FILES)
IF N_FILES EQ 0 THEN BEGIN
MESSAGE,'No procedure files found',/INFORM
RETURN
ENDIF
;
; Next, look for an existing "dos" directory. Depending on whether the OS is
; VMS or Unix, open up a command file to store all subsequent commands. All
; the commands will then be executed at the end with a single spawn.
;
IF os_family() EQ 'vms' THEN BEGIN
OPENW,UNIT,'CONCAT4DOS.COM',/GET_LUN
PRINTF,UNIT,'$ SET VERIFY'
DOSDIR = 'DOS.DIR'
ENDIF ELSE IF OS_FAMILY() eq 'Windows' THEN BEGIN
OPENW,UNIT,'concat4d.bat',/GET_LUN
PRINTF,UNIT,'echo on'
DOSDIR = 'dos'
ENDIF ELSE BEGIN
OPENW,UNIT,'concat4dos.sh',/GET_LUN
PRINTF,UNIT,'set echo'
DOSDIR = 'dos'
ENDELSE
DOSDIRFILE = FINDFILE(DOSDIR,COUNT=N_FOUND)
;
; If an existing directory was found, then warn the user that all the ".pro"
; files in that subdirectory will be deleted, and ask if the user wants to
; continue. If yes, then delete the files.
;
IF N_FOUND NE 0 THEN BEGIN
PRINT,'DOS directory already found'
PRINT,'All .PRO files in the DOS directory will be deleted.'
; ASK,'Continue? ',ANSWER,'YN'
ANSWER = 'Y'

IF ANSWER EQ 'Y' THEN BEGIN
IF os_family() EQ 'vms' THEN BEGIN
PRINTF,UNIT,'$ DELETE/NOLOG/NOCONFIRM ' + $
'[.DOS]*.PRO;*'
ENDIF ELSE IF OS_FAMILY() eq 'Windows' THEN BEGIN
PRINTF,UNIT,'del dos\*.pro'
END ELSE BEGIN
PRINTF,UNIT,'rm dos/*.pro'
ENDELSE
ENDIF ELSE GOTO, FINISH
;
; Otherwise, create the subdirectory.
;
END ELSE BEGIN
IF os_family() EQ 'vms' THEN BEGIN
PRINTF,UNIT,'$ CREATE/DIRECTORY [.DOS]'
END ELSE BEGIN
PRINTF,UNIT,'mkdir dos'
ENDELSE
ENDELSE
;
; For each file, determine the eight character equivalent, and copy all files
; beginning with those eight characters into a single file.
;
LAST = ''
FOR I=0,N_FILES-1 DO BEGIN
FDECOMP,FILES(I),DISK,DIR,NAME,EXT,VER
NAME8 = STRMID(NAME,0,8)
IF NAME8 NE LAST THEN BEGIN
IF STRLEN(NAME8) EQ 8 THEN NAME9 = NAME8 + '*' ELSE $
NAME9 = NAME8
IF os_family() EQ 'vms' THEN BEGIN
PRINTF,UNIT,'$ COPY ' + NAME9 + $
'.PRO [.DOS]' + NAME8 + '.PRO'
ENDIF ELSE IF OS_FAMILY() eq 'Windows' THEN BEGIN
PRINTF,UNIT,'type ' + NAME9 + '.pro > dos\' + $
NAME8 + '.pro'
END ELSE BEGIN
PRINTF,UNIT,'cat ' + NAME9 + '.pro > dos/' + $
NAME8 + '.pro'
ENDELSE
ENDIF
LAST = NAME8
ENDFOR
;
; If there are any documentation files (.txt or .tex), then copy them as well.
;
FILES = FINDFILE('*.t*', COUNT=N_FILES)
IF N_FILES NE 0 THEN FOR I=0,N_FILES-1 DO BEGIN
FDECOMP,FILES(I),DISK,DIR,NAME,EXT,VER
NAME8 = STRMID(NAME,0,8)
EXT3 = STRMID(EXT,0,3)
IF os_family() EQ 'vms' THEN BEGIN
PRINTF,UNIT,'$ COPY ' + FILES(I) + ' [.DOS]' + $
NAME8 + '.' + EXT3
ENDIF ELSE IF OS_FAMILY() eq 'Windows' THEN BEGIN
PRINTF,UNIT,'type ' + FILES(I) + ' > dos/' + $
NAME8 + '.' + EXT3
END ELSE BEGIN
PRINTF,UNIT,'cat ' + FILES(I) + ' > dos/' + $
NAME8 + '.' + EXT3
ENDELSE
ENDFOR
;
; Tell the command file to delete itself after processing, and execute it.
;
FINISH:
IF os_family() EQ 'vms' THEN BEGIN
PRINTF,UNIT,'$ DELETE/NOLOG/NOCONFIRM CONCAT4DOS.COM;*'
FREE_LUN,UNIT
SPAWN,'@CONCAT4DOS.COM'
ENDIF ELSE IF OS_FAMILY() eq 'Windows' THEN BEGIN
FREE_LUN,UNIT
SPAWN,'concat4d.bat'
SPAWN,'del concat4d.bat'
END ELSE BEGIN
PRINTF,UNIT,'rm concat4dos.sh'
FREE_LUN,UNIT
SPAWN,'source concat4dos.sh'
ENDELSE
;
RETURN
END
Re: IDL V4 and Windows 95 [message #6068 is a reply to message #6052] Mon, 01 April 1996 00:00 Go to previous message
Mirko Vukovic is currently offline  Mirko Vukovic
Messages: 124
Registered: January 1996
Senior Member
Mark Hadfield wrote:
>
> Joseph M Zawodny wrote:
>
>> I just upgraded from Windows 3.1 to Win 95 and I am having great
>> difficulty getting IDL to find some files/proceedures. It is pretty
>> apparent that IDL cannot handle long file names (at least on my system).
>> Has anyone else run into this and what can be done about it (short of
>> renaming all of programs to fit the 8.3 format). I notice that the DOS
>> names (8.3 names) now have the foobar~1.pro naming typical of long file
>> names under win 95.
> etc etc, I had to delete stuff ...

Yes, can you please post that (concat4dos) utility. Can you please be more specific
on adding a space to file names. Where? In the idl call or to the file name itself?

Also note that printing does not work under windows 95. This time it is a bug. The
way I deal with it as for dumping graphs on the printer is to copy the window to the
clipboard (alt-printscreen) then go into paintbrush, paste there and print from
there.

How do people like the imbedded editor? I usually kill those windows as they pop and
do most of the editing via emacs. The idl editor, I use for debugging.
--
Mirko Vukovic, Ph.D. mirko.vukovic@grc.varian.com
Varian Research Center Phone: (415) 424-4969
3075 Hansen Way, M/S K-109 Fax: (415) 424-6988
Palo Alto, CA 94304-1025
Re: IDL V4 and Windows 95 [message #6074 is a reply to message #6068] Mon, 01 April 1996 00:00 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Joseph M Zawodny wrote:

> I just upgraded from Windows 3.1 to Win 95 and I am having great
> difficulty getting IDL to find some files/proceedures. It is pretty
> apparent that IDL cannot handle long file names (at least on my system).
> Has anyone else run into this and what can be done about it (short of
> renaming all of programs to fit the 8.3 format). I notice that the DOS
> names (8.3 names) now have the foobar~1.pro naming typical of long file
> names under win 95.

You're right: IDL for Windows does not handle long file names. This is a
"feature" mentioned in the documentation, not a peculiarity of your system.
So all .pro file names still need to be truncated to 8.3 characters. (I
adapted Bill Thompson's CONCAT4DOS routine for Windows NT to do this--I can
send or post a copy if you want.)

On Windows NT I have found that files with names longer than 8.3 CAN be
opened provided a space is appended to the file name. Don't know why but it
seems to work. Unusual characters in the file names, including spaces, are
still verboten.

> A second question has to do with 16bit color. I seem to have no
> control whatsoever over the colors used in plotting. This problem
> remains when I switch back to 8 bit (265) colors. Again, am I missing
> something here.

Can't really help here. I tried 16-bit colour when I first got a 16-bit
capable video card and encountered strange behaviour. Can't remember
exactly what, because I reverted to 8-bit and everything works as it did
with Win 3.11.

Cheers

--
============================================================ ==
Mark Hadfield NIWA (Taihoro Nukurangi)
PO Box 14-901
m.hadfield@niwa.cri.nz Wellington, New Zealand
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: passing idl structures in call_external ?
Next Topic: Re: BUG in IDL 4.0a PowerMac

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:42:15 PDT 2025

Total time taken to generate the page: 0.00582 seconds