|
Blender
V2.59
|
00001 /* 00002 * $Id: BLI_args.h 34989 2011-02-19 12:05:20Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00030 #ifndef BLI_ARGS_H 00031 #define BLI_ARGS_H 00032 00038 struct bArgs; 00039 typedef struct bArgs bArgs; 00040 00041 /* returns the number of extra arguments consumed by the function. 0 is normal value, -1 stops parsing arguments, other negative indicates skip */ 00042 typedef int (*BA_ArgCallback)(int argc, const char **argv, void *data); 00043 00044 struct bArgs *BLI_argsInit(int argc, const char **argv); 00045 void BLI_argsFree(struct bArgs *ba); 00046 00047 /* pass starts at 1, -1 means valid all the time 00048 * short_arg or long_arg can be null to specify no short or long versions 00049 * */ 00050 void BLI_argsAdd(struct bArgs *ba, int pass, const char *short_arg, const char *long_arg, const char *doc, BA_ArgCallback cb, void *data); 00051 /* short_case and long_case specify if those arguments are case specific */ 00052 void BLI_argsAddCase(struct bArgs *ba, int pass, const char *short_arg, int short_case, const char *long_arg, int long_case, const char *doc, BA_ArgCallback cb, void *data); 00053 00054 void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *data); 00055 00056 void BLI_argsPrintArgDoc(struct bArgs *ba, const char *arg); 00057 void BLI_argsPrintOtherDoc(struct bArgs *ba); 00058 00059 void BLI_argsPrint(struct bArgs *ba); 00060 const char **BLI_argsArgv(struct bArgs *ba); 00061 00062 #endif