Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /***********************************************************************
  2.  *
  3.  *  avra - Assembler for the Atmel AVR microcontroller series
  4.  *
  5.  *  Copyright (C) 1998-2006 Jon Anders Haugum, Tobias Weber
  6.  *
  7.  *  This program is free software; you can redistribute it and/or modify
  8.  *  it under the terms of the GNU General Public License as published by
  9.  *  the Free Software Foundation; either version 2 of the License, or
  10.  *  (at your option) any later version.
  11.  *
  12.  *  This program is distributed in the hope that it will be useful,
  13.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  *  GNU General Public License for more details.
  16.  *
  17.  *  You should have received a copy of the GNU General Public License
  18.  *  along with this program; see the file COPYING.  If not, write to
  19.  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  *  Boston, MA 02111-1307, USA.
  21.  *
  22.  *
  23.  *  Authors of avra can be reached at:
  24.  *     email: jonah@omegav.ntnu.no, tobiw@suprafluid.com
  25.  *     www: http://sourceforge.net/projects/avra
  26.  */
  27.  
  28. #ifndef _args_h_
  29. #define _args_h_
  30.  
  31. enum {
  32.         ARGTYPE_BOOLEAN = 0,       /* boolean Value (0 = False) */
  33.         ARGTYPE_STRING,            /* Stringpointer in Data     */
  34.         ARGTYPE_STRING_MULTI,      /* List of strings in Data   */
  35.         ARGTYPE_STRING_MULTISINGLE, /* List of strings in Data. requires an option for each element */
  36.         ARGTYPE_CHAR_ATTACHED
  37. };
  38.  
  39. #define GET_ARG(args, argnum) (args->arg[argnum].data)
  40. #define SET_ARG(args, argnum, value) (args->arg[argnum].data = (void *)value)
  41.  
  42. struct args {
  43.         struct arg *arg;
  44.         int    count;
  45.         struct data_list *first_data;
  46. };
  47.  
  48. struct arg {
  49.         int   type;
  50.         char  letter;
  51.         char *longarg;
  52.         void *data;
  53. };
  54.  
  55. struct data_list {
  56.         struct data_list *next;
  57.         void *data;
  58. };
  59.  
  60. struct args *alloc_args(int arg_count);
  61. int read_args(struct args *args, int argc, char *argv[]);
  62. int add_arg(struct data_list **last_data, char *argv);
  63. void free_args(struct args *args);
  64. void define_arg(struct args *args, int index, int type, char letter, char *longarg, void *def_value);
  65.  
  66. #endif /* end of args.h */
  67.  
  68.