Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

string.c File Reference

#include <stdio.h>
#include <sys/param.h>
#include <string.h>
#include <tina/sys.h>
#include <tina/sysfuncs.h>

Include dependency graph for string.c:

Include dependency graph

Go to the source code of this file.

Functions

char * string_append (char *string, va_alist)
char * string_alloc_append (va_alist)
char * string_copy (char *string)
int isspace (int c)
int freadline (FILE *fp, char *string)
int read_into_int (int *x, char *string, char *msg)
int read_into_short (short int *x, char *string, char *msg)
int read_into_float (float *x, char *string, char *msg)
int read_into_double (double *x, char *string, char *msg)
int read_into_string (char *x, char *string, char *msg)


Function Documentation

int freadline FILE fp,
char *  string
 

Definition at line 117 of file string.c.

References c, FILE, and isspace().

Referenced by cal_geom3_list_read(), formskeleton(), next_macro_line(), rdist_read_fp(), restore_proc(), scan_files(), and tw_read_call_file().

00118 {
00119     int     c;
00120     int     i = 0;
00121 
00122     while (isspace(c = getc(fp)));
00123 
00124     if (c == EOF)
00125         return (EOF);
00126     do
00127     {
00128         string[i++] = c;
00129     } while ((c = getc(fp)) != '\n' && c != EOF && i<MAXPATHLEN-1);
00130     string[i++] = '\0';
00131     return (i);
00132 }

Here is the call graph for this function:

int isspace int  c  )  [static]
 

Definition at line 112 of file string.c.

References c.

Referenced by freadline().

00113 {
00114     return (c == ' ' || c == '\n');
00115 }

int read_into_double double *  x,
char *  string,
char *  msg
 

Definition at line 179 of file string.c.

References message(), and string_append().

00180 {
00181     double  y;
00182     char    temps[256];
00183 
00184     if (sscanf(string, "%lf", &y) == 1)
00185     {
00186         *x = y;
00187         message(string_append(temps, msg, string, "\n", 0));
00188         return (1);
00189     }
00190     message("read_into_double: string not a float\n");
00191     return (0);
00192 }

Here is the call graph for this function:

int read_into_float float *  x,
char *  string,
char *  msg
 

Definition at line 164 of file string.c.

References message(), and string_append().

00165 {
00166     float   y;
00167     char    temps[256];
00168 
00169     if (sscanf(string, "%f", &y) == 1)
00170     {
00171         *x = y;
00172         message(string_append(temps, msg, string, "\n", 0));
00173         return (1);
00174     }
00175     message("read_into_float: string not a float\n");
00176     return (0);
00177 }

Here is the call graph for this function:

int read_into_int int *  x,
char *  string,
char *  msg
 

Definition at line 134 of file string.c.

References message(), and string_append().

00135 {
00136     int     y;
00137     char    temps[256];
00138 
00139     if (sscanf(string, "%d", &y) == 1)
00140     {
00141         *x = y;
00142         message(string_append(temps, msg, string, "\n", 0));
00143         return (1);
00144     }
00145     message("read_into_int: string not an int\n");
00146     return (0);
00147 }

Here is the call graph for this function:

int read_into_short short int *  x,
char *  string,
char *  msg
 

Definition at line 149 of file string.c.

References message(), and string_append().

00150 {
00151     short   y;
00152     char    temps[256];
00153 
00154     if (sscanf(string, "%hd", &y) == 1)
00155     {
00156         *x = y;
00157         message(string_append(temps, msg, string, "\n", 0));
00158         return (1);
00159     }
00160     message("read_into_short: string not a short\n");
00161     return (0);
00162 }

Here is the call graph for this function:

int read_into_string char *  x,
char *  string,
char *  msg
 

Definition at line 194 of file string.c.

References message(), and string_append().

00195 {
00196     char    temps[256];
00197 
00198     (void) strcpy(x, string);
00199     message(string_append(temps, msg, string, "\n", 0));
00200     return (1);
00201 }

Here is the call graph for this function:

char* string_alloc_append va_alist   ) 
 

Definition at line 78 of file string.c.

References ralloc(), and va_list.

Referenced by ttcl_mkshellname(), ttcl_writetrace_choice(), tw_check(), tw_choice(), and tw_extend_fullname().

00079 {
00080     int     n;
00081     va_list ap;
00082     char   *str, *substr;
00083 
00084     n = 0;
00085     va_start(ap);
00086     for (n = 0; (substr = va_arg(ap, char *)) != NULL; n += strlen(substr));
00087     va_end(ap);
00088 
00089     str = (char *) ralloc((unsigned) (n + 1) * sizeof(char));
00090 
00091     va_start(ap);
00092     (void) strcpy(str, "");
00093     while ((substr = va_arg(ap, char *)) != (char *) 0)
00094         (void) strcat(str, substr);
00095     va_end(ap);
00096 
00097     return (str);
00098 }

Here is the call graph for this function:

char* string_append char *  string,
va_alist 
 

@(#)String (eg ``Hello world'') handling.

Definition at line 61 of file string.c.

References va_list.

Referenced by add_model_poly_set(), ascii_input_proc(), camera_filename_get(), covar_read(), covar_write(), csf_count12_proc(), epsf_dump_proc(), error(), errorf(), ffg_write_file(), filename_make(), fname_resolve(), geom2_read(), geom2_write(), geom3_read(), geom3_write(), input_model(), input_pca(), load_block_file_proc(), load_dicom_files_proc(), load_nema_files_proc(), make_calibname(), make_filename(), mono_input(), mono_output(), output_model(), output_proc(), pairs_cross_match(), pairs_load_model_poly(), pca_model(), print_help(), print_surf_proc(), print_voi_proc(), ras_read_image(), raw_input_proc(), read_into_double(), read_into_float(), read_into_int(), read_into_short(), read_into_string(), read_surf_proc(), read_voi_proc(), start_macro_line(), stereo_input(), stereo_output(), tiff_dump_proc(), tv_clone(), tv_screen_dump(), tv_set_activity_message(), tw_open_call_file(), and tw_read_call_file().

00065 {
00066     va_list ap;
00067     char   *substring;
00068 
00069     va_start(ap);
00070     (void) strcpy(string, "");
00071     while ((substring = va_arg(ap, char *)) != (char *) 0)
00072         (void) strcat(string, substring);
00073     va_end(ap);
00074 
00075     return (string);
00076 }

char* string_copy char *  string  ) 
 

Definition at line 103 of file string.c.

References ralloc().

Referenced by font_find(), ttcl_mkshellname(), tw_check(), tw_choice(), tw_extend_fullname(), and tw_help_button().

00104 {
00105     char   *copy;
00106 
00107     copy = (char *) ralloc((unsigned) strlen(string) + 1);
00108     (void) strcpy(copy, string);
00109     return (copy);
00110 }

Here is the call graph for this function:


Generated on Thu Dec 16 12:43:26 2004 for Tina4 by doxygen 1.3.6