[ nedit-Bugs-1574071 ] build-in macro doesn't work properly

SourceForge.net noreply at sourceforge.net
Fri Mar 2 01:01:17 CET 2007


Bugs item #1574071, was opened at 2006-10-09 23:48
Message generated for change (Comment added) made by ajbj
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=111005&aid=1574071&group_id=11005

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: release
Status: Open
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Thorsten Haude (yooden)
Summary: build-in macro doesn't work properly

Initial Comment:
NEdit release of Aug 20, 2004

     Built on: Linux, 386, Intel C++
     Built at: Oct  3 2006, 09:38:44
   With Motif: 2.2.3 [@(#)Motif Version 2.2.4]
Running Motif: 2.2 [unknown]
       Server: The X.Org Foundation 60802000
       Visual: 24-bit TrueColor (ID 0x21, Default)
       Locale: en_US.UTF-8

------------------------------

The build-in macro "Make C prototypes" doesn't work in
the following example due to the three lines of comments.


------------------------------


#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    print_int(1, 2);

    return(0);
}


void print_int(int a, int b)
/************************
print two integers
*************************/
{
    printf("%d, %d\n", a, b);
}

-------------------------------

with these comments, the result of this macro are:

int main(int argc, char **argv);



After removing these comments, the result are correct
and as expected:

int main(int argc, char **argv);
void print_int(int a, int b);





----------------------------------------------------------------------

Comment By: Tony Balinski (ajbj)
Date: 2007-03-02 01:01

Message:
Logged In: YES 
user_id=618141
Originator: NO

Checked in suggested fix.

----------------------------------------------------------------------

Comment By: Thorsten Haude (yooden)
Date: 2006-10-10 17:52

Message:
Logged In: YES 
user_id=119143

Oops, true.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2006-10-10 17:49

Message:
Logged In: NO 

The document isn't altered. The suggested change alters the
content of a variable.

----------------------------------------------------------------------

Comment By: Thorsten Haude (yooden)
Date: 2006-10-10 17:27

Message:
Logged In: YES 
user_id=119143

I think some users my consider it a bit harsh that the
source file is changed only to create some prototype (never
mind read-only documents).

Yes, you can re-insert them afterwards, but that would muck
up the undo stack.

I think the big regex needs to be changed.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2006-10-10 17:04

Message:
Logged In: NO 

This can be fixed by adding the following to the macro after the
  string = get_range(start, end)
line, to remove all C++ and C comments, then all blank lines:
  string = replace_in_string(string, \
    "//.*$", "", "regex", "copy")
  string = replace_in_string(string, \
    "(?n/\\*.*?\\*/)", "", "regex", "copy")
  string = replace_in_string(string, \
    "^\\s*\n", "", "regex", "copy")

Of course, this does not cure problems you may get if you
have // or /* in strings, etc, but that is probably pushing
things a bit for a "simple" macro.

----------------------------------------------------------------------

Comment By: Thorsten Haude (yooden)
Date: 2006-10-10 00:33

Message:
Logged In: YES 
user_id=119143

(Yes, I also confirmed it with a post-5.5 Enhanced NEdit.)

----------------------------------------------------------------------

Comment By: Thorsten Haude (yooden)
Date: 2006-10-10 00:32

Message:
Logged In: YES 
user_id=119143

Confirmed:

NEdit Version 5.1.1
March 17, 2000


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=111005&aid=1574071&group_id=11005


More information about the Develop mailing list