GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  STRUCTS_TYPE_ID (3)

NAME

structs_type_id - structs types for identifiers

CONTENTS

Library
Synopsis
Description
See Also
Examples
History
Authors

LIBRARY

PDEL Library (libpdel, -lpdel)

SYNOPSIS


.In sys/types.h
.In pdel/structs/structs.h
.In pdel/structs/type/id.h STRUCTS_ID_TYPE idlist vsize

DESCRIPTION

The STRUCTS_ID_TYPE macro defines a structs(3) type (i.e., a struct structs_type) for describing an enumeration or identifier list.

The data structure represented is an integral value that may take one of a fixed set of values. The possible values are defined by the idlist argument, which is a pointer to an array of struct structs_id:

struct structs_id {
    const char  *id;        /* string representation */
    u_int32_t   value;      /* integer representation */
    u_int       imatch;     /* case-insensitive matching allowed */
};

The id points to a unique string representing the value; imatch, determines whether the parsing of the ASCII representation is case-insensitive. value is the actual integer value. The first element in the array used as the default value. The array is terminated with an entry having id equal to NULL.

vsize is the size of the integral type used to store the value, which must be 1, 2, or 4.

SEE ALSO

libpdel(3), structs(3), structs_type(3)

EXAMPLES

/* Set of possible colors */ enum color {         RED,         GREEN,         BLUE, };

/* The current color */ static enum color current_color;

/* Structs type describing something of type "enum color" */ static const struct structs_id color_list[] = {         { "red", RED },         { "green", GREEN },         { "blue", BLUE },         { NULL, 0 } }; static const struct structs_type color_type         = STRUCTS_ID_TYPE(color_list, sizeof(enum color));

HISTORY

The PDEL library was developed at Packet Design, LLC. http://www.packetdesign.com/

AUTHORS


.An Archie Cobbs Aq archie@freebsd.org
Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.