Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

How to compile code with reversed slash in include statements
Hello,

I am porting code to SGI Unix which I believe was written on a
Vax machine. The code has many inclusions such as :

INCLUDE '\..\path\file.cb'

f77 doesn't like the reverse slash. How can I compile it?

Am I stuck with going into every file and reversing the
direction of the slash.

Thank you,
Christopher Lusardi


Report this thread to moderator Post Follow-up to this message
Old Post
clusardi2k@aol.com
05-22-05 08:57 PM


Re: How to compile code with reversed slash in include statements
clusardi2k@aol.com wrote:
> Hello,
>
>  I am porting code to SGI Unix which I believe was written on a
> Vax machine. The code has many inclusions such as :
>
>       INCLUDE '\..\path\file.cb'

I assume that since unix wants forward slashes, and assuming that you
have the same directory structure, just change them to forward slashes.
However, it seems unlikely that you have the same directory structure
so you need to replace the quoted section with whatever the filename
(and path) equivalent is on your SGI system.  The slashes just delineate
the components of the directory structure.  If all the files are under
the "default" include directory, you may be able to just remove
everything but the filename (file.cb).

>
>  f77 doesn't like the reverse slash. How can I compile it?
>
>  Am I stuck with going into every file and reversing the
> direction of the slash.
>
>     Thank you,
>     Christopher Lusardi
>


--

Gary Scott
mailto:garyscott@ev1.net

Fortran Library:  http://www.fortranlib.com

Support the Original G95 Project:  http://www.g95.org
-OR-
Support the GNU GFortran Project:  http://gcc.gnu.org/fortran/index.html

Why are there two?  God only knows.


If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford

Report this thread to moderator Post Follow-up to this message
Old Post
Gary L. Scott
05-22-05 08:57 PM


Re: How to compile code with reversed slash in include statements
clusardi2k@aol.com wrote:
> ...
>  Am I stuck with going into every file and reversing the
> direction of the slash.

You could try automating the editing.  Try something like:

ls -1 *.f | xargs -i -t  \
ex -c "1,\$s?..\path\\\?../path/" +wq {}

The above works for sh/ksh.  For csh/tcsh you may need to protect
the braces from the shell with backslashes too.

ls -1 *.f | xargs -i -t  \
ex -c "1,\$s?..\path\\\?../path/" +wq \{\}

Walt
-...-
Walt Spector
(w6ws at earthlink dot net)

Report this thread to moderator Post Follow-up to this message
Old Post
Walter Spector
05-22-05 08:57 PM


Re: How to compile code with reversed slash in include statements
In article <1116761953.108061.155700@g49g2000cwa.googlegroups.com>,
clusardi2k@aol.com wrote:

> Hello,
>
>  I am porting code to SGI Unix which I believe was written on a
> Vax machine. The code has many inclusions such as :
>
>       INCLUDE '\..\path\file.cb'
>
>  f77 doesn't like the reverse slash. How can I compile it?
>
>  Am I stuck with going into every file and reversing the
> direction of the slash.
>
>     Thank you,
>     Christopher Lusardi

On SGI/IRIX, paths use forward slashes not backslashes.  Change all the
"\" to "/".

Report this thread to moderator Post Follow-up to this message
Old Post
breyfogle
05-22-05 08:57 PM


Re: How to compile code with reversed slash in include statements
Gary L. Scott wrote:

> clusardi2k@aol.com wrote:
 
 

This seems strange.  It is usual to use forward slash in C #include
statements, as the DOS/Windows file system will accept them.  (It is
only the command line interpreter that doesn't.)   VMS has a different
way of indicating paths using [] and other characters.

> I assume that since unix wants forward slashes, and assuming that you
> have the same directory structure, just change them to forward slashes.
>  However, it seems unlikely that you have the same directory structure
> so you need to replace the quoted section with whatever the filename
> (and path) equivalent is on your SGI system.

A relative path could easily be the same, an absolute path likely
would be different.  I can't say this look like either.

There are automated ways to make the change, under unix the sed command
would often be used to do this.

-- glen


Report this thread to moderator Post Follow-up to this message
Old Post
glen herrmannsfeldt
05-23-05 01:56 AM


Re: How to compile code with reversed slash in include statements
glen herrmannsfeldt wrote:
>
> Gary L. Scott wrote:
> 
> 
> 
>
> This seems strange.  It is usual to use forward slash in C #include
> statements, as the DOS/Windows file system will accept them.  (It is
> only the command line interpreter that doesn't.)   VMS has a different
> way of indicating paths using [] and other characters.
> 
>
> A relative path could easily be the same, an absolute path likely
> would be different.  I can't say this look like either.
>

Another way:
Most Fortran compilers seem to allow you to specify the path to
include files via a command-line option (like -I). If you can use
that there is no need to put in relative paths ...

Regards,

Arjen

Report this thread to moderator Post Follow-up to this message
Old Post
Arjen Markus
05-23-05 01:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Fortran archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:30 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.