Perl:: mass replacement of converting C code formats to tgmath.h
hello,
i have a lot of C old code I'm updating to C11 with tgmath.h for generic math. the old code has very specific types, real and complex, like cabsl, csinhl, etc
usually for simple bulk replacements i would do something simple like this
I want to replace a string within a file using perl.
We have a line that gets commented out, and I want to replace that line now matter how it was commented out.
for example, I'd want to replace
###ES=PR1A with ES=PR1A
or
##LJW(9/16/26)ES=PR1A with ES=PR1A
I tried: perl... (4 Replies)
Is it possible in VI to do a global change but take the search patterns and the replacement patterns from an external file ?
I have cases where I can have 100,200 or 300+ global changes to do. All the new records are inside a file and I must VI a work file to change all of them.
Also, can... (1 Reply)
Hi using the below cmd i am identifying wheether last character in each line in thousands of files as semicolon or not.If last character is semicolon i am removing semicolon .If last character is not semicolon then i am appending next line to present line .
For example my input file consists of... (4 Replies)
I used the eval command in shell programming for assigning a value to a stored value of a variable.
Example:
VAR="Unix_Id"
eval $VAR="101"
eval echo $"$VAR"
How can i assign a value to a stored value of a variable in perl OR how i can write above code in Perl?
I need your help... (4 Replies)
I have a perl code that runs like
Code I
sub p
{
if ($d >= $D) {return}
printf "%3s"x$d++," ";
printf "%s%s\n",$_,$h{$_}?" ** ":"";
if (!$h{$_})
{
$h{$_}=1;
map {p($_)} @{$s{$_}}
}
$d--
}
($Set,$Job,$Num,$D) = (@ARGV);
map {shift} 0..3; (8 Replies)
Hi ,
This script working for fine if pass script-name.sh Jul/10/2007 ,I want to pass 20070710(yyyymmdd) .Please any help it should be appereciated.
use Time::Local;
my $d = $ARGV;
my $t = $ARGV;
my $m = "";
@d = split /\//, $d;
@t = split /:/, $t;
if ( $d eq "Jan" ) { $m = 0 }... (7 Replies)
Sucks to be a noob :o
See my last post for solution
I have 3 different log formats and the filenames contain a date. I am trying to write a script to grep these files between two date ranges.
I am now stuck at the date conversion bit. I let the user entered a date string in the format... (6 Replies)
Hi,
I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory.
finally {
if (null != hibernateSession && hibernateSession.isOpen()) {
//hibernateSession.close();
}
}
It would be great if the script has... (2 Replies)
I have the following string :
Cat dog fox catepillar bear foxy
I need to replace "cat" and "fox" words from this sentence to word "animal"
I do the following:
$Str1="cat";
$Str2="fox";
$NewStr="animal";
open(F1, "<$inputFile") or die "Error: $!";
open(F2, ">$outputFile") or... (1 Reply)
The below perl script parses a variety of formats. If I use the numeric text file as input the script works correctly. However using the alpha text file as input there is a black output file. The portion in bold splits the field to parse f or NC_000023.10:g.153297761C>A into a variable $common but... (3 Replies)
Discussion started by: cmccabe
3 Replies
LEARN ABOUT FREEBSD
tgmath
TGMATH(3) BSD Library Functions Manual TGMATH(3)NAME
tgmath -- type-generic macros
SYNOPSIS
#include <tgmath.h>
DESCRIPTION
The header <tgmath.h> provides type-generic macros for <math.h> and <complex.h> functions that have float (suffixed with f), double and long
double (suffixed with l) versions. The arguments that vary across the three functions and have type float, double and long double, respec-
tively, are called generic arguments.
The following rules describe which function is actually called if a type-generic macro is invoked. If any generic argument has type long
double or long double complex, the long double function is called. Else, if any generic argument has type double, double complex or an inte-
ger type, the double version is invoked. Otherwise, the macro expands to the float implementation.
For the macros in the following table, both real and complex functions exist. The real functions are prototyped in <math.h> and the complex
equivalents in <complex.h>. The complex function is called if any of the generic arguments is a complex value. Otherwise, the real equiva-
lent is called.
Macro real function complex function
acos() acos() cacos()
asin() asin() casin()
atan() atan() catan()
acosh() acosh() cacosh()
asinh() asinh() casinh()
atanh() atanh() catanh()
cos() cos() ccos()
sin() sin() csin()
tan() tan() ctan()
cosh() cosh() ccosh()
sinh() sinh() csinh()
tanh() tanh() ctanh()
exp() exp() cexp()
log() log() clog()
pow() pow() cpow()
sqrt() sqrt() csqrt()
fabs() fabs() cabs()
No complex functions exist for the following macros, so passing a complex value to a generic argument invokes undefined behaviour:
atan2() fma() llround() remainder()
cbrt() fmax() log10() remquo()
ceil() fmin() log1p() rint()
copysign() fmod() log2() round()
erf() frexp() logb() scalbn()
erfc() hypot() lrint() scalbln()
exp2() ilogb() lround() tgamma()
expm1() ldexp() nearbyint() trunc()
fdim() lgamma() nextafter()
floor() llrint() nexttoward()
The following macros always expand to a complex function:
carg() cimag() conj() cproj() creal()
This header includes <complex.h> and <math.h>.
STANDARDS
The header <tgmath.h> conforms to ISO/IEC 9899:1999 (``ISO C99'').
HISTORY
The header <tgmath.h> first appeared in FreeBSD 5.3.
COMPILER SUPPORT
Before ISO/IEC 9899:2011 (``ISO C11''), the header <tgmath.h> could not be implemented with strictly conforming C code and needed special
compiler support. As of ISO/IEC 9899:2011 (``ISO C11''), this header file can be implemented using the _Generic() language keyword. In
addition to compilers that support this keyword, this header file works with GCC.
BUGS
Many of the functions mentioned here are not prototyped in <math.h> or <complex.h> as they are not yet implemented. This prevents the corre-
sponding type-generic macro from working at all.
BSD January 4, 2012 BSD