libsent/src/util/readfile.c File Reference

Read strings per line from various input source. More...

#include <sent/stddefs.h>
#include <sent/tcpip.h>
#include <zlib.h>

Include dependency graph for readfile.c:

Go to the source code of this file.

Functions

char * getl (char *buf, int maxlen, FILE *fp)
char * getl_fp (char *buf, int maxlen, FILE *fp)
char * getl_fd (char *buf, int maxlen, int fd)
char * getl_sd (char *buf, int maxlen, int sd)
char * first_token (char *buf)
char * next_token ()
char * next_token_if_any ()
char * rest_token ()


Detailed Description

Read strings per line from various input source.

Author:
Akinobu LEE
Date:
Thu Feb 17 16:41:58 2005
This file provides functions to read text inputs from various input source such as file pointer, file descpritor, socket descriptor. The input will be read per line, and the newline characters are removed. Also, blank lines will be ignored.

Revision
1.3

Definition in file readfile.c.


Function Documentation

char* getl ( char *  buf,
int  maxlen,
FILE *  fp 
)

Read one line from file that has been opened by fopen_readfile(). Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fp [in] file pointer or gzFile pointer
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 52 of file readfile.c.

Referenced by add_bigram_rl(), add_unigram(), ngram_read_arpa(), rddfa(), rdhmmlist(), read_token(), set_and_check_total_info(), set_bigram(), set_total_info(), set_unigram(), and voca_load_htkdict().

char* getl_fp ( char *  buf,
int  maxlen,
FILE *  fp 
)

Read one line from file pointer. Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fp [in] file pointer
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 86 of file readfile.c.

Referenced by adin_file_begin(), adin_sndfile_begin(), htk_config_file_parse(), and mfcfilelist_nextfile().

char* getl_fd ( char *  buf,
int  maxlen,
int  fd 
)

Read one line from a file descriptor. Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fd [in] file descriptor
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 114 of file readfile.c.

Referenced by msock_check_and_process_command(), msock_exec_command(), msock_process_command(), rddfa_fd(), and voca_load_htkdict_fd().

char* getl_sd ( char *  buf,
int  maxlen,
int  sd 
)

Read one line from a socket descriptor. Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
sd [in] socket descpritor
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 151 of file readfile.c.

Referenced by msock_check_and_process_command(), msock_exec_command(), msock_process_command(), rddfa_sd(), and voca_load_htkdict_sd().

char* first_token ( char *  buf  ) 

Return first token of a buffer, delimited by DELM. Program will terminate if any token does not found.

Parameters:
buf [i/o] string buffer
Returns:
pointer to the extracted token.

Definition at line 186 of file readfile.c.

Referenced by add_bigram_rl(), add_unigram(), new_str2phseq(), rddfa_line(), rdhmmlist(), set_bigram(), and set_unigram().

char* next_token ( void   ) 

Return next token of a buffer, delimited by DELM. Should be called after first_token(). Program will terminate if any token does not found.

Returns:
pointer to the extracted token.

Definition at line 202 of file readfile.c.

Referenced by add_bigram_rl(), add_unigram(), rddfa_line(), set_bigram(), and set_unigram().

char* next_token_if_any ( void   ) 

Return next token of a buffer, delimited by DELM. Should be called after first_token().

Returns:
pointer to the extracted token, or NULL if not found.

Definition at line 216 of file readfile.c.

Referenced by new_str2phseq(), and rdhmmlist().

char* rest_token ( void   ) 

Return the rest tokens till newline. Program will terminate if any token does not found.

Returns:
pointer to the extracted token.

Definition at line 230 of file readfile.c.


Generated on Tue Dec 26 16:18:22 2006 for Julius by  doxygen 1.5.0