For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2005 > How to compile code with reversed slash in include statements









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to compile code with reversed slash in include statements
clusardi2k@aol.com

2005-05-22, 3:57 pm

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

Gary L. Scott

2005-05-22, 3:57 pm

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
Walter Spector

2005-05-22, 3:57 pm

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)
breyfogle

2005-05-22, 3:57 pm

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 "/".
glen herrmannsfeldt

2005-05-22, 8:56 pm

Gary L. Scott wrote:

> clusardi2k@aol.com wrote:


[color=darkred]

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.
[color=darkred]
> 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

Arjen Markus

2005-05-23, 8:57 am

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com