helper.cpp File Reference

Implementation of helper.h. More...

#include "helper.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

Include dependency graph for helper.cpp:


Defines

#define ISALPHA(x)   (isalpha(x)||(!isascii(x)))
 Is char from alphabet? It could be alpha or nonascii.
#define ISBLANK(x)   (isblank(x))
 Is it blank?
#define ISDIGIT(x)   (isdigit(x))
 Is it digit?
#define MAXWORD   255
 Initial length of word buffer.

Functions

char * getword (FILE *input, unsigned int *occurrences)
 Function that reads one word from input file.
int sgetch (CHAR *where, const char *from)
int ustrlen (const char *arg)
 Gets one character from string.

Variables

bool numbered
 Are occurrences included in input file?
unsigned int maxlen
 Maximal length of prefix.

Detailed Description

Implementation of helper.h.


Function Documentation

char* getword ( FILE *  input,
unsigned int *  occurrences = NULL 
)

Function that reads one word from input file.

It returns pointer to that word. Be aware! This pointer points to static buffer inside the function, so you shouldn't care about it's deallocation. It's little bit weird, but I never need two words in memory, so why to bother with some allocation and deallocation ;-)

References CHECK_PTR, ISALPHA, ISBLANK, ISDIGIT, MAXWORD, numbered, and VWPRINTF.

Referenced by compute_stats(), and find_it_thread().

int ustrlen ( const char *  arg  ) 

Gets one character from string.

Reason why is this function important is utf-8. Because in case of utf-8 one character does not necessary means one byte.


Generated on Sat Dec 20 11:32:18 2008 for Affisix by  doxygen 1.5.7.1