parse_tok.h

00001 
00002 
00003 /*---------------------------------------------------------------------------
00004                                     E.S.O.
00005  ----------------------------------------------------------------------------
00006    File name    :   parse_tok.h
00007    Author       :   N. Devillard
00008    Created on   :   February 2000
00009    Language     :   ANSI C
00010                     Part of ECLIPSE library for Adonis
00011    Description  :   Parsing helpers
00012  *--------------------------------------------------------------------------*/
00013 
00014 /*
00015 
00016     $Id: parse_tok.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $
00017     $Author: amodigli $
00018     $Date: 2003/09/03 12:50:47 $
00019     $Revision: 1.1 $
00020 
00021 */
00022 
00023 #ifndef _PARSE_TOK_H_
00024 #define _PARSE_TOK_H_
00025 
00026 /*---------------------------------------------------------------------------
00027                                 Includes
00028  ---------------------------------------------------------------------------*/
00029 
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032 #include <unistd.h>
00033 #include <string.h>
00034 
00035 
00036 /*---------------------------------------------------------------------------
00037                                 Defines
00038  ---------------------------------------------------------------------------*/
00039 
00040 /* Default field separator list */
00041 #define FS_BLANKS   " \t\n"
00042 
00043 
00044 /*---------------------------------------------------------------------------
00045                         Function ANSI C prototypes
00046  ---------------------------------------------------------------------------*/
00047 
00048 
00049 /*---------------------------------------------------------------------------
00050    Function :   tokenize_line()
00051    In       :   a line of ASCII characters, a field separator
00052    Out      :   number of tokens found, list of tokens a la argv
00053    Job      :   tokenize a list of ASCII characters by cutting it into
00054                 tokens separated by characters belonging to the field
00055                 separator string.
00056    Notice   :   returns NULL in case the line cannot be tokenized.
00057 
00058    Example  :
00059 
00060     char ** ltok ;
00061     int     ntok ;
00062 
00063     strcpy(line, "\tThis is a line to      tokenize\n");
00064     ltok = tokenize_line(line, FS_BLANKS, &ntok);
00065 
00066     ntok is 6
00067     ltok[0] is "This"
00068     ltok[0] is "is"
00069     ltok[0] is "a"
00070     ltok[0] is "line"
00071     ltok[0] is "to"
00072     ltok[0] is "tokenize"
00073 
00074     Notice that the returned list must be freed using free_tokens()
00075     (see below)
00076 
00077     free_tokens(ltok, ntok);
00078  ---------------------------------------------------------------------------*/
00079 
00080 
00081 char ** tokenize_line(char * line, char * fs, int * ntok);
00082 
00083 
00084 
00085 /*---------------------------------------------------------------------------
00086    Function :   free_tokens()
00087    In       :   token list
00088    Out      :   void
00089    Job      :   free a list of tokens a la argv
00090    Notice   :
00091  ---------------------------------------------------------------------------*/
00092 
00093 
00094 void free_tokens(char ** l_tok, int ntok);
00095 
00096 
00097 /*---------------------------------------------------------------------------
00098    Function :   strlwc()
00099    In       :   allocated character string
00100    Out      :   void
00101    Job      :   bring a character string to lowercase
00102    Notice   :
00103  ---------------------------------------------------------------------------*/
00104 
00105 void strlwc(char * s);
00106 
00107 #endif

Generated on Wed Oct 26 13:08:54 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001