1c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata/* 2c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * This file is part of ltrace. 3c442f697b8603104a1c9c0ec96e876ad08f58adePetr Machata * Copyright (C) 2011, 2012 Petr Machata, Red Hat Inc. 4c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * 5c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * This program is free software; you can redistribute it and/or 6c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * modify it under the terms of the GNU General Public License as 7c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * published by the Free Software Foundation; either version 2 of the 8c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * License, or (at your option) any later version. 9c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * 10c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * This program is distributed in the hope that it will be useful, but 11c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * WITHOUT ANY WARRANTY; without even the implied warranty of 12c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * General Public License for more details. 14c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * 15c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * You should have received a copy of the GNU General Public License 16c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * along with this program; if not, write to the Free Software 17c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * 02110-1301 USA 19c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata */ 20c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata 21c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata#ifndef LENS_ENUM_H 22c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata#define LENS_ENUM_H 23c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata 24c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata#include "lens.h" 25c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata#include "vect.h" 26c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata 27c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machatastruct enum_lens { 28c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata struct lens super; 29c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata struct vect entries; 30c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata}; 31c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata 32c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata/* Init enumeration LENS. */ 33c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machatavoid lens_init_enum(struct enum_lens *lens); 34c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata 35c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata/* Push another member of the enumeration, named KEY, with given 36c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * VALUE. If OWN_KEY, KEY is owned and released after the type is 37c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * destroyed. KEY is typed as const char *, but note that if OWN_KEY, 38c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * this value will be freed. If OWN_VALUE, then VALUE is owned and 39c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata * destroyed by LENS. */ 40c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machataint lens_enum_add(struct enum_lens *lens, 41c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata const char *key, int own_key, 42c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata struct value *value, int own_value); 43c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata 44c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata/* Return number of enum elements of type INFO. */ 45c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machatasize_t lens_enum_size(struct enum_lens *lens); 46c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata 47c07a26a8d0f86bc4137eb7b7fea8bbf9021275f1Petr Machata#endif /* LENS_ENUM_H */ 48