File:  [ELWIX - Embedded LightWeight unIX -] / gpl / axl / knife / axl-knife.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 8 07:09:12 2011 UTC (14 years ago) by misho
Branches: axl, MAIN
CVS tags: HEAD, AXL0_6_7, AXL0_6_1
3th party - XML

    1: /*
    2:  *  Axl Knife: Console tool on top of Axl Library
    3:  *  Copyright (C) 2007 Advanced Software Production Line, S.L.
    4:  *
    5:  *  This program is free software; you can redistribute it and/or
    6:  *  modify it under the terms of the GNU General Public License as
    7:  *  published by the Free Software Foundation; either version 2.1 of
    8:  *  the License, or (at your option) any later version.
    9:  *
   10:  *  This program is distributed in the hope that it will be useful,
   11:  *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
   12:  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
   13:  *  GNU Lesser General Public License for more details.
   14:  *
   15:  *  You should have received a copy of the GNU General Public
   16:  *  License along with this program; if not, write to the Free
   17:  *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   18:  *  02111-1307 USA
   19:  *  
   20:  *  For commercial support on build XML enabled solutions contact us:
   21:  *          
   22:  *      Postal address:
   23:  *         Advanced Software Production Line, S.L.
   24:  *         Edificio Alius A, Oficina 102,
   25:  *         C/ Antonio Suarez Nº 10,
   26:  *         Alcalá de Henares 28802 Madrid
   27:  *         Spain
   28:  *
   29:  *      Email address:
   30:  *         info@aspl.es - http://www.aspl.es/xml
   31:  */
   32: #ifndef __AXL_KNIFE_H__
   33: #define __AXL_KNIFE_H__
   34: 
   35: /* local includes */
   36: #include <stdarg.h>
   37: 
   38: /* include axl main headers */
   39: #include <axl.h>
   40: 
   41: /* include axl namespace support */
   42: #include <axl_ns.h>
   43: 
   44: /* include exarg support */
   45: #include <exarg.h>
   46: 
   47: /** 
   48:  * Drop an error msg to the console stderr.
   49:  *
   50:  * To drop an error message use:
   51:  * \code
   52:  *   error ("unable to open file: %s", file);
   53:  * \endcode
   54:  * 
   55:  * @param m The error message to output.
   56:  */
   57: void  axl_knife_error (const char * file, int line, const char * format, ...);
   58: 
   59: /** 
   60:  * Drop a msg to the console stdout.
   61:  *
   62:  * To drop a message use:
   63:  * \code
   64:  *   msg ("module loaded: %s", module);
   65:  * \endcode
   66:  * 
   67:  * @param m The console message to output.
   68:  */
   69: void  axl_knife_msg   (const char * file, int line, const char * format, ...);
   70: 
   71: /** 
   72:  * Drop a second level msg to the console stdout.
   73:  *
   74:  * To drop a message use:
   75:  * \code
   76:  *   msg2 ("module loaded: %s", module);
   77:  * \endcode
   78:  * 
   79:  * @param m The console message to output.
   80:  */
   81: void  axl_knife_msg2   (const char * file, int line, const char * format, ...);
   82: 
   83: /** 
   84:  * Drop a warning msg to the console stdout.
   85:  *
   86:  * To drop a message use:
   87:  * \code
   88:  *   wrn ("module loaded: %s", module);
   89:  * \endcode
   90:  * 
   91:  * @param m The warning message to output.
   92:  */
   93: void  axl_knife_wrn   (const char * file, int line, const char * format, ...);
   94: 
   95: #if defined(__COMPILING_AXL_KNIFE__)
   96: #define error(m,...)  do{axl_knife_error (__AXL_FILE__, __AXL_LINE__, m, ##__VA_ARGS__);}while(0)
   97: #define msg(m,...)    do{axl_knife_msg (__AXL_FILE__, __AXL_LINE__, m, ##__VA_ARGS__);}while(0)
   98: #define msg2(m,...)   do{axl_knife_msg2 (__AXL_FILE__, __AXL_LINE__, m, ##__VA_ARGS__);}while(0)
   99: #define wrn(m,...)    do{axl_knife_wrn (__AXL_FILE__, __AXL_LINE__, m, ##__VA_ARGS__);}while(0)
  100: #endif
  101: 
  102: /* support funcions */
  103: char  * axl_knife_file_name           (const char * path);
  104: 
  105: /** 
  106:  * @brief Available tests to be performed while using \ref
  107:  * axl_knife_file_test
  108:  */
  109: typedef enum {
  110: 	/** 
  111: 	 * @brief Check if the path exist.
  112: 	 */
  113: 	FILE_EXISTS     = 1 << 0,
  114: 	/** 
  115: 	 * @brief Check if the path provided is a symlink.
  116: 	 */
  117: 	FILE_IS_LINK    = 1 << 1,
  118: 	/** 
  119: 	 * @brief Check if the path provided is a directory.
  120: 	 */
  121: 	FILE_IS_DIR     = 1 << 2,
  122: 	/** 
  123: 	 * @brief Check if the path provided is a regular file.
  124: 	 */
  125: 	FILE_IS_REGULAR = 1 << 3,
  126: } FileTest;
  127: 
  128: 
  129: axl_bool axl_knife_file_test   (const char * path,   FileTest test);
  130: 
  131: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>