src/liqapp.c File Reference

App level helper functions. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include "liqapp.h"
#include "liqcell.h"
#include "liqapp_prefs.h"
#include "liqapp_hildon.h"
#include <ctype.h>

Functions

void liqapp_initpwd ()
char * liqapp_gettitle ()
int liqapp_sleep (unsigned long millisec)
unsigned long liqapp_GetTicks ()
float liqapp_fps (unsigned long ts, unsigned long te, unsigned long framecount)
int liqapp_getopt_find (char *optname)
int liqapp_getopt_exist (char *optname)
int liqapp_getopt_hasarg (char *optname)
char * liqapp_getopt_str (char *optname, char *def)
int liqapp_getopt_int (char *optname, int def)
int liqapp_folderexists (char *pathname)
int liqapp_pathexists (char *pathname)
int liqapp_fileexists (char *filename)
int liqapp_filesize (char *filename)
char * liqapp_filename_walkoverpath (char *filename)
char * liqapp_filename_walktoextension (char *filename)
int liqapp_file_copy (char *from, char *to, int allowoverwrite)
int liqapp_init (int argc, char *argv[], char *title, char *version)
void liqapp_ensurecleanusername (char *usernamewhichismodifiable)
int liqapp_vdeeplog (char *logentry, va_list arg)
int liqapp_deeplog (char *logentry,...)
int liqapp_log (char *logentry,...)
int liqapp_errorandfail (int returnstatus, char *logentry)
int liqapp_warnandcontinue (int returnstatus, char *logentry)
int liqapp_close ()
int liqapp_formatnow (char *buffer, int buffersize, char *format)
char * liqapp_format_strftime (char *buffer, int buffersize, char *strftime_fmt)
char * stristr (const char *String, const char *Pattern)

Variables

liqcell * liqapp_logbase = NULL
liqapp app = {0}
char * liqapp_pwd = NULL
int liqapp_is_basefs = 0


Detailed Description

App level helper functions.

Author:
Gary Birkett Copyright (C) 2008 Gary Birkett

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Function Documentation

int liqapp_deeplog ( char *  logentry,
  ... 
)

internal console logging function, varargs version

Parameters:
log entry template, uses printf formatting
list of parameters for completing the formatting
Returns:
int 0 for success

References liqapp_vdeeplog().

Referenced by liqapp_errorandfail(), and liqapp_warnandcontinue().

int liqapp_errorandfail ( int  returnstatus,
char *  logentry 
)

Log a liqbase error, and exit the program

Parameters:
returnstatus Value to exit and return with
logentry The error message to log
Returns:
int returnstatus

References liqapp_deeplog().

Referenced by liqcanvas_init(), liqcanvas_init_inner(), and liqcell_setname().

int liqapp_fileexists ( char *  filename  ) 

check if a filename is valid and exists and can be 'stat'ed

Parameters:
char *filename including path
Returns:
int 1 if success, 0 otherwise

Referenced by liqcell_sketch_autoload().

char* liqapp_filename_walkoverpath ( char *  filename  ) 

walk over the filename to remove all path parts

Parameters:
char *filename including path
Returns:
char * to the first character of the filename itself, or to the start of the filename if no '/' detected

Referenced by liqapp_filename_walktoextension().

char* liqapp_filename_walktoextension ( char *  filename  ) 

find and return the extension part of a filename

Parameters:
char *filename to get the extension from
Returns:
char * to the first character of the extension, or to the start of the filename if no '.' detected

References liqapp_filename_walkoverpath().

int liqapp_filesize ( char *  filename  ) 

return the stat filesize (-1 if not found)

Parameters:
char *filename including path
Returns:
int size if success, -1 otherwise

int liqapp_folderexists ( char *  pathname  ) 

check if a folder is valid and exists and can be 'stat'ed

Parameters:
char *pathname including path
Returns:
int 1 if success, 0 otherwise

float liqapp_fps ( unsigned long  ts,
unsigned long  te,
unsigned long  framecount 
)

obtain an FPS value based on duration and frames completed in that period

Parameters:
starting time
ending time
number of frames completed in the period
Returns:
float number of frames per second

Referenced by liqcell_easyrun().

unsigned long liqapp_GetTicks (  ) 

return system tick count

Returns:
unsigned long for system tick count

Referenced by liqcanvas_firstrun_splash(), and liqcell_easyrun().

int liqapp_init ( int  argc,
char *  argv[],
char *  title,
char *  version 
)

Initiates the Liqbase Application to be ran, including the liqbase filesystem

Parameters:
argc Command line arguement count
argv Command line arguement strings
title The title of the application
version The version of the application
Returns:
int 0 for success

References liqapp_log(), and liqapp_pathexists().

int liqapp_log ( char *  logentry,
  ... 
)

console logging function

Parameters:
log entry template, uses printf formatting
list of parameters for completing the formatting
Returns:
int 0 for success

References liqapp_vdeeplog().

Referenced by dllcache_runconstructor(), liqapp_init(), liqcanvas_firstrun_splash(), liqcanvas_init(), liqcanvas_init_inner(), liqcell_child_arrange_easytile(), liqcell_child_arrange_makegrid_internal(), liqcell_easyrun(), liqcell_ensurevisible(), liqcell_ensurevisible_centred(), liqcell_free(), and liqcell_setcaption().

int liqapp_pathexists ( char *  pathname  ) 

check if a pathname is valid and exists and can be 'stat'ed

Parameters:
char *pathname including path
Returns:
int 1 if success, 0 otherwise

Referenced by liqapp_init().

int liqapp_sleep ( unsigned long  millisec  ) 

put the calling thread to sleep for a duration

Parameters:
duration in milliseconds
Returns:
1 always

Referenced by liqcell_easyrun().

int liqapp_vdeeplog ( char *  logentry,
va_list  arg 
)

internal console logging function, va_list version

Parameters:
log entry template, uses printf formatting
list of parameters for completing the formatting
Returns:
int 0 for success

Referenced by liqapp_deeplog(), and liqapp_log().

int liqapp_warnandcontinue ( int  returnstatus,
char *  logentry 
)

Log a liqbase warning, but continue running

Parameters:
returnstatus Value to exit and return with
logentry The warning message to log
Returns:
int returnstatus

References liqapp_deeplog().

Referenced by dllcache_init(), dllcache_runconstructor(), and dllcache_scan().


Generated on Wed Jul 22 13:20:11 2009 for libliqbase by  doxygen 1.5.9