dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU][pnet]/[pnet/C] Start of a Perl hack to clean the gcc specific c


From: James Michael DuPont
Subject: [DotGNU][pnet]/[pnet/C] Start of a Perl hack to clean the gcc specific code from -save-temps, call for testing of pnet/C
Date: Sat, 9 Aug 2003 21:26:20 -0700 (PDT)

#! perl -n -p clean.pl foo.i  > foo_clean.c 
#----------------------------------------------------------
#begin of hack : clean.pl
#----------------------------------------------------------
#Dear fellow hackers,
#please stop what you are doing and help test the pnet/C compiler.
#Just grab any c code that you have lying around and make sure that the
#pnetc can compiler it, please report any bugs found.
#
# here is a data type not handled by pnet 
#  long double 
#
#The way to do this easily is to use perl or sed to clean out the
#results of the gcc preprocessor, that allows you to quickly compile
the #code without worrying about nasty stuff like includes and
proprocessor #stuff.
#
#The only thing is that the gcc uses all types of specific flags as
#hints to the compiler. Here is a perl script to comment them out, at
#least a start of them.
#
#First compile your code with -save-temps
#this produces a preprocess file foo.i
#
#gcc foo.c -save-temps
# the best way to do this is to add the CFLAGS=-save-temps .... into
the #makefile
#
#then run it via perl in sed mode 
#
#happy hacking,
#mike
#
s;^#;//#;g;
s;__restrict;/*__restrict*/;g;
s;__const;/*__const*/;g;
s;__extension__;/*__extension__*/;g;
if (s;__inline__;/*__inline__*/;g)
{
  # avoid processing the #inline twice
}
else
{
    s;__inline;/*__inline*/;g;
}
s;__builtin_constant_p;/*__builtin_constant_p*/;g;
s;__attribute__ ([^\;]+);/*__attribute ()*/;g;
# no support for long doubles, just hack them
s;long double;/*TODO:long*/double;g;



=====
James Michael DuPont
http://introspector.sourceforge.net/

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]