Path: blob/main/cddl/contrib/opensolaris/tools/ctf/cvt/strtab.h
39586 views
/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License, Version 1.0 only5* (the "License"). You may not use this file except in compliance6* with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or http://www.opensolaris.org/os/licensing.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/21/*22* Copyright (c) 2001 by Sun Microsystems, Inc.23* All rights reserved.24*/2526#ifndef _STRTAB_H27#define _STRTAB_H2829#pragma ident "%Z%%M% %I% %E% SMI"3031#include <sys/types.h>3233#ifdef __cplusplus34extern "C" {35#endif3637typedef struct strhash {38const char *str_data; /* pointer to actual string data */39ulong_t str_buf; /* index of string data buffer */40size_t str_off; /* offset in bytes of this string */41size_t str_len; /* length in bytes of this string */42struct strhash *str_next; /* next string in hash chain */43} strhash_t;4445typedef struct strtab {46strhash_t **str_hash; /* array of hash buckets */47ulong_t str_hashsz; /* size of hash bucket array */48char **str_bufs; /* array of buffer pointers */49char *str_ptr; /* pointer to current buffer location */50ulong_t str_nbufs; /* size of buffer pointer array */51size_t str_bufsz; /* size of individual buffer */52ulong_t str_nstrs; /* total number of strings in strtab */53size_t str_size; /* total size of strings in bytes */54} strtab_t;5556extern void strtab_create(strtab_t *);57extern void strtab_destroy(strtab_t *);58extern size_t strtab_insert(strtab_t *, const char *);59extern size_t strtab_size(const strtab_t *);60extern ssize_t strtab_write(const strtab_t *,61ssize_t (*)(void *, size_t, void *), void *);62extern void strtab_print(const strtab_t *);6364#ifdef __cplusplus65}66#endif6768#endif /* _STRTAB_H */697071