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
STRUCTS_TYPE_ID(3) FreeBSD Library Functions Manual STRUCTS_TYPE_ID(3)

structs_type_id
structs types for identifiers

PDEL Library (libpdel, -lpdel)

#include <sys/types.h>
#include <pdel/structs/structs.h>
#include <pdel/structs/type/id.h>

STRUCTS_ID_TYPE(idlist, vsize);

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.

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


/* 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));

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

Archie Cobbs ⟨archie@freebsd.org⟩
April 22, 2002 FreeBSD 13.1-RELEASE

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 ManDoc.