Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
rename routines
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
rudra  
View profile   Translate to Translated (View Original)
 More options 7 Nov, 13:32
Newsgroups: comp.unix.programmer
From: rudra <bnrj.ru...@gmail.com>
Date: Sat, 7 Nov 2009 05:32:24 -0800 (PST)
Local: Sat 7 Nov 2009 13:32
Subject: rename routines
Dear friends,
I am facing a herculian job of renaming 506 fortran routine and 4000
'call' made by them.
what i have to do is to change

subroutine some_name(lots of arguments)

to

subroutine b_some_name(lots of arguments)

and
call some_routine(arguments)

to

call b_some_routine(argument)

i.e. add a prefix in front of every call/subroutine!
they are not in any specific position. Can i do it using bashscript?
I have an idea that sed/awk may be able to do that. but how? any help?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Edwin van den Oetelaar  
View profile   Translate to Translated (View Original)
 More options 7 Nov, 15:27
Newsgroups: comp.unix.programmer
From: Edwin van den Oetelaar <newsgro...@oetelaar.com>
Date: Sat, 07 Nov 2009 16:27:16 +0100
Local: Sat 7 Nov 2009 15:27
Subject: Re: rename routines

Find an editor that handles refactoring for you.
Use a perl script :
something like this onliner :

perl -p -i -e 's/oldstring/newstring/g' `grep -ril oldstring *`

Make sure to backup your files before trying something like this!


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jens Thoms Toerring  
View profile   Translate to Translated (View Original)
 More options 7 Nov, 15:32
Newsgroups: comp.unix.programmer
From: j...@toerring.de (Jens Thoms Toerring)
Date: 7 Nov 2009 15:32:21 GMT
Local: Sat 7 Nov 2009 15:32
Subject: Re: rename routines

rudra <bnrj.ru...@gmail.com> wrote:
> Dear friends,
> I am facing a herculian job of renaming 506 fortran routine and 4000
> 'call' made by them.
> what i have to do is to change
> subroutine some_name(lots of arguments)
> to
> subroutine b_some_name(lots of arguments)
> and
> call some_routine(arguments)
> to
> call b_some_routine(argument)
> i.e. add a prefix in front of every call/subroutine!
> they are not in any specific position. Can i do it using bashscript?
> I have an idea that sed/awk may be able to do that. but how? any help?

Here's something I cobbled together quickly (so no guarantees that
it works correctly;-) for Perl

------------8<-----------------
#!/usr/bin/perl

use strict;
use warnings;

my $suffix = "b_";

my $buf;
$buf .= $_ while <>;

$buf =~ s/\b(subroutine|call)(\s+)(\w+)(?=\s*\()/$1$2$suffix$3/gi;
print $buf;
------------8<-----------------

Replace the "b_" behind "my $suffix =" with what you really want
to prepend to the function names, store it in a file, e.g. named
'fortconv' and then do

perl fortconv < old_file.f > new_file.f

and you're hopefully done.
                               Regards, Jens
--
  \   Jens Thoms Toerring  ___      j...@toerring.de
   \__________________________      http://toerring.de


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rudra  
View profile   Translate to Translated (View Original)
 More options 7 Nov, 16:00
Newsgroups: comp.unix.programmer
From: rudra <bnrj.ru...@gmail.com>
Date: Sat, 7 Nov 2009 08:00:44 -0800 (PST)
Local: Sat 7 Nov 2009 16:00
Subject: Re: rename routines
On Nov 7, 4:32 pm, j...@toerring.de (Jens Thoms Toerring) wrote:

Dear Jens,
thanks  a lot! Though it was something without any gurantee, it worked
like marvel.
thanks to Edwin too.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google