Main Page   Data Structures   File List   Data Fields   Globals  

parsetime.c File Reference

#include <mad.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include "common.h"
#include "parsetime.h"
#include "report.h"
#include "snprintf/snprintf.h"

Go to the source code of this file.

Functions

bool isletter (char c)
void parse_timecount (int *h, int *min, int *s, int *ms, const char *expr)
void parse_partial_clock (int *h, int *min, int *s, int *ms, const char *expr)
void parse_full_clock (int *h, int *min, int *s, int *ms, const char *expr)
mad_timer_t convert_mad_timer_t (int *h, int *min, int *s, int *ms)
unsigned long int convert_milliseconds_from_time (int *h, int *min, int *s, int *ms)
enum pt_type type (const char *expr)
mad_timer_t parse_time_mad_time_t (const char *expr)
unsigned long int parse_time_milliseconds (const char *expr)
unsigned long int parse_time_get_dur (const char *start, const char *stop)


Function Documentation

mad_timer_t convert_mad_timer_t int *    h,
int *    min,
int *    s,
int *    ms
[static]
 

converts h, min, s, ms to a mad_timer_t type

Parameters:
int  *h - hours.
int  *min - minutes.
int  *s - seconds.
int  *ms - milliseconds.
Returns:
mad_timer_t - the time as a mad_timer_t.

Definition at line 280 of file parsetime.c.

References REP_DEBUG, report(), and STRLEN.

Referenced by parse_time_mad_time_t().

unsigned long int convert_milliseconds_from_time int *    h,
int *    min,
int *    s,
int *    ms
[static]
 

converts h, min, s, ms to a milliseconds

Parameters:
int  *h - hours.
int  *min - minutes.
int  *s - seconds.
int  *ms - milliseconds.
Returns:
unsigned long int - the time in milliseconds.

Definition at line 321 of file parsetime.c.

References REP_DEBUG, report(), and STRLEN.

Referenced by parse_time_milliseconds().

bool isletter char    c [static]
 

Checks is a char is a letter or not.

Parameters:
char  c - character to check.
Returns:
true if character is a letter, false otherwise.

Definition at line 89 of file parsetime.c.

Referenced by parse_timecount().

void parse_full_clock int *    h,
int *    min,
int *    s,
int *    ms,
const char *    expr
[static]
 

Parses a full_clock expression into h, min, s, ms

Parameters:
int  *h - hours.
int  *min - minutes.
int  *s - seconds.
int  *ms - milliseconds.
const  char *expr - time expression as a null-terminated string.

Definition at line 236 of file parsetime.c.

References REP_DEBUG, report(), and STRLEN.

Referenced by parse_time_mad_time_t(), and parse_time_milliseconds().

void parse_partial_clock int *    h,
int *    min,
int *    s,
int *    ms,
const char *    expr
[static]
 

Parses a partial_clock expression into h, min, s, ms

Parameters:
int  *h - hours.
int  *min - minutes.
int  *s - seconds.
int  *ms - milliseconds.
const  char *expr - time expression as a null-terminated string.

Definition at line 196 of file parsetime.c.

References REP_DEBUG, report(), and STRLEN.

Referenced by parse_time_mad_time_t(), and parse_time_milliseconds().

unsigned long int parse_time_get_dur const char *    start,
const char *    stop
 

Returns the duration in milliseconds from char start- and stop-arguments

Parameters:
const  char *start - start time as a null-terminated string.
const  char *stop - stop time as a null-terminated string.
Returns:
unsigned long int - duration (start to stop) as milliseconds.

Definition at line 472 of file parsetime.c.

References parse_time_milliseconds().

Referenced by audio_play().

mad_timer_t parse_time_mad_time_t const char *    expr
 

Translates valid DAISY time formats to seconds and fractions NOTE: sec. 7.7, (page 41) in ANSI/NISO Z39.86.2005

Parameters:
const  char *expr - time as a null-terminated string.
Returns:
mad_timer_t - returns the time as a mad_timer_t struct.

Definition at line 388 of file parsetime.c.

References convert_mad_timer_t(), parse_full_clock(), parse_partial_clock(), parse_timecount(), PT_FULL_CLOCK, PT_INVALID_FORMAT, PT_PARTIAL_CLOCK, PT_TIMECOUNT, REP_DEBUG, report(), STRLEN, and type().

Referenced by audio_play().

unsigned long int parse_time_milliseconds const char *    expr
 

Translates valid DAISY time formats to milliseconds Note: sec. 7.7, (page 41) in ANSI/NISO Z39.86.2005

Parameters:
const  char *expr - time as a null-terminated string.
Returns:
unsigned long int - time as milliseconds.

Definition at line 430 of file parsetime.c.

References convert_milliseconds_from_time(), parse_full_clock(), parse_partial_clock(), parse_timecount(), PT_FULL_CLOCK, PT_INVALID_FORMAT, PT_PARTIAL_CLOCK, PT_TIMECOUNT, REP_DEBUG, report(), STRLEN, and type().

Referenced by parse_time_get_dur().

void parse_timecount int *    h,
int *    min,
int *    s,
int *    ms,
const char *    expr
[static]
 

Parses a timecount expression into h, min, s, ms

Parameters:
int  *h - hours.
int  *min - minutes.
int  *s - seconds.
int  *ms - milliseconds.
const  char *expr - time expression as a null-terminated string.

Definition at line 107 of file parsetime.c.

References isletter(), PT_HOURS, PT_MILLISECONDS, PT_MINUTES, PT_SECONDS, REP_DEBUG, report(), and STRLEN.

Referenced by parse_time_mad_time_t(), and parse_time_milliseconds().

enum pt_type type const char *    expr [static]
 

Figures out what type of time-format we're dealing with.

Parameters:
const  char* expr - time as an null-terminated string.
Returns:
enum pt_type - returns the type of time format, PT_INVALID_FORMAT if unsuccessful.

Definition at line 350 of file parsetime.c.

References PT_FULL_CLOCK, PT_INVALID_FORMAT, PT_PARTIAL_CLOCK, PT_TIMECOUNT, pt_type, REP_ERROR, report(), and STRLEN.

Referenced by parse_time_mad_time_t(), and parse_time_milliseconds().


Generated on Tue Sep 5 12:14:08 2006 for libdaisy by doxygen1.2.15