1 /*-------------------------------------------------------------------- 2 * 3 * Copyright (c) 1991-2021 by the GMT Team (https://www.generic-mapping-tools.org/team.html) 4 * See LICENSE.TXT file for copying and redistribution conditions. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU Lesser General Public License as published by 8 * the Free Software Foundation; version 3 or 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 * Contact info: www.generic-mapping-tools.org 16 *--------------------------------------------------------------------*/ 17 /* 18 * gmt_hash.h contains definition of the structure used for hashing. 19 * 20 * Author: Paul Wessel 21 * Date: 01-OCT-2009 22 * Version: 6 API 23 */ 24 25 /*! 26 * \file gmt_hash.h 27 * \brief Definition of the structure used for hashing 28 */ 29 30 #ifndef GMT_HASH_H 31 #define GMT_HASH_H 32 33 /*-------------------------------------------------------------------- 34 * GMT HASH STRUCTURE DEFINITION 35 *--------------------------------------------------------------------*/ 36 37 /* To avoid lots of dynamic memory allocation for the hash lookup tables we 38 * use a statically allocated structure. By determining that the max number 39 * of identical hash numbers across all the keywords is 16, we simply allocate 40 * space for 16 entries for each structure. Should later additions to GMT's 41 * default parameters, colornames, etc increase this value we will be warned 42 * and can change the entry GMT_HASH_MAXDEPTH below accordingly. 43 */ 44 #define GMT_HASH_MAXDEPTH 16 45 46 /*! Used to relate text keywords to array indices */ 47 struct GMT_HASH { 48 unsigned int id[GMT_HASH_MAXDEPTH]; /* Indices of corresponding keyword with identical hash value */ 49 unsigned int n_id; /* Number of hash entries for this item */ 50 char *key[GMT_HASH_MAXDEPTH]; /* Name of these entries */ 51 }; 52 53 #endif /* GMT_HASH_H */ 54