27#include "rave_alloc.h"
29char *fmi_util_comment=NULL;
31char fmi_util_command_line[FMI_UTIL_COMMAND_LINE_LEN];
34char *argument(
int argc,
char **argv,
char *target){
37 if (!strcmp(argv[i],target)){
47int param(
int argc,
char **argv,
int index,
char *key){
53 if (strcmp(argv[index],key)==0)
59int paramn(
int argc,
char **argv,
int index,
char *key){
65 if (strncmp(key,argv[index],strlen(key))==0)
71int file_count(
int argc,
char **argv){
75 if (strcmp(argv[i],
"-")!=0)
80char *extract_command_line(
int argc,
char **argv){
83 if ((strlen(fmi_util_command_line)+strlen(argv[i]))<FMI_UTIL_COMMAND_LINE_LEN){
84 strcat(fmi_util_command_line,argv[i]);
85 strcat(fmi_util_command_line,
" ");}
86 return (fmi_util_command_line);
90void trchr(
char *
string,
char from,
char to){
94 for (c=
string;*c!=
'\0';c++)
101void fmi_error(
char *s){
102 fprintf(stderr,
"fmi_error: ");
103 fprintf(stderr,
"%s",s);
104 fprintf(stderr,
"\n");
108void fmi_debug(
int n,
char *s){
110 if (n<=fmi_debug_level){
113 fprintf(stderr,
" %s\n",s);
117char *file_extension(
char *filename){
118 return (strrchr(filename,
'.'));
121char *file_name(
char *filename){
123 s=strrchr(filename,
'/');
130char *file_path(
char *filename){
132 end=strrchr(filename,
'/');
138 path=(
char *)RAVE_MALLOC(strlen(filename)+1);
139 strcpy(path,filename);
144char *file_basename(
char *filename){
145 char *start,*end,c,*basename;
146 start=strrchr(filename,
'/');
147 end=strrchr(filename,
'.');
155 basename=(
char *)RAVE_MALLOC(strlen(start)+1);
156 strcpy(basename,start);
173float pseudo_gauss(
float a,
float x){
174 return (255.0*a*a/(a*a+x*x));
177int pseudo_gauss_int(
int a,
int x){
178 return (255*a*a/(a*a+x*x));
183float pseudo_sigmoid(
float a,
float x){
186 return ( 255.0*x/(a+x) );
188 return ( 255.0*x/(a-x) );
191int pseudo_sigmoid_int(
int a,
int x){
194 return ( (255*x)/(a+x) );
196 return ( (255*x)/(a-x) );