Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: __LINE__ in proc

Re: __LINE__ in proc

From: <prochak_at_my-dejanews.com>
Date: Fri, 09 Oct 1998 19:21:28 GMT
Message-ID: <6vlnno$9n9$1@nnrp1.dejanews.com>


In article <6vir15$5uh$1_at_nnrp1.dejanews.com>,   pradeepj_at_delhi.tcs.co.in wrote:
> Hi !
> But the line directives included in generated .c file will not help me.
> Actually I am writing some statement like.
>
> printf("Error at line %d in file %s\n", __LINE__ , __FILE__) ;
>
> in my .pc file.
> Now I want the output should gine line position of this
> statement in proc file not the generated 'c' file.
> Same is the case with filename, it should give
> proc file instead of 'c' file.
>
> thanks,
> Pradeep
>

You will have to preprocess the __LINE__ entries before running Pro*C. Here is a quick little perl script that can do this. It is invoked as:

 preline <your_file_name.x >your_file_name.pc

where your_file_name.x has the __LINE__ tokens. This should be easy to put into a make script.

oops, the previous replaced "__LINE__" with "line: ##" If you got the last message please use this script instead.

--
Ed Prochak
Magic Interface, Ltd.
440-498-3702

Here's the code to preline:

--------------------------cut here-------------------
#!/usr/bin/perl
##################
#
# preline
# ed prochak Oct. 1998
#
# This perl script replaces __LINE__

# with source file line number.
#

while ( $line = <> )
{
  $n++;
  $line =~ s/__LINE__/$n/g ;
  print $line
}

--
Ed Prochak
Magic Interface, Ltd.
440-498-3702

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Oct 09 1998 - 14:21:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US