Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xtoffsetof(3) [hpux man page]

XtOffsetOf()															      XtOffsetOf()

Name
  XtOffsetOf - determine the byte offset of a field within a structure type.

Synopsis
  Cardinal XtOffsetOf(structure_type, field_name)

Inputs
  structure_type
	    Specifies a type that is declared as a structure.

  field_name
	    Specifies the name of a field of the structure.

Returns
  The offset in bytes of the specified field from the beginning of the specified structure.

Availability
  Release 4 and later.

Description
  XtOffsetOf()	is  a  macro  that expands to a constant expression that gives the offset in bytes to the specified structure member from the
  beginning of the structure.

Usage
  XtOffset() is usually used to determine the location of an variable within a structure when initializing a resource list.  It  is  used  by
  widget writers, and anyone who needs to fetch application resources with XtGetApplicationResources().  Resource fields are defined in terms
  of offsets from a base address from the beginning of a widget.  Thus, a resource value can be kept up to date by the Resource Manager with-
  out any knowledge of the instance structure of the widget; it uses just a relative byte offset.

  XtOffsetOf()	is  slightly  more portable than XtOffset() which performs the same function but takes a pointer type rather than a structure
  type.

Example
  XtOffsetOf() is used to declare a resource list for the Athena Label widget:

     #define offset(field) XtOffsetOf(LabelRec, field)
     static XtResource resources[] = {
	 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
	     offset(label.foreground), XtRString, XtDefaultForeground},
	 {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
	     offset(label.font),XtRString, XtDefaultFont},
		 .
		 .

Background
  XtOffsetOf() is defined in terms of XtOffset() on many systems:

     #ifdef offsetof
     #define XtOffsetOf(s_type,field) offsetof(s_type,field)
     #else
     #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
     #endif

See Also
  XtOffset(1).

Xt - Utilities															      XtOffsetOf()

Check Out this Related Man Page

XtOffsetOf()															      XtOffsetOf()

Name
  XtOffsetOf - determine the byte offset of a field within a structure type.

Synopsis
  Cardinal XtOffsetOf(structure_type, field_name)

Inputs
  structure_type
	    Specifies a type that is declared as a structure.

  field_name
	    Specifies the name of a field of the structure.

Returns
  The offset in bytes of the specified field from the beginning of the specified structure.

Availability
  Release 4 and later.

Description
  XtOffsetOf()	is  a  macro  that expands to a constant expression that gives the offset in bytes to the specified structure member from the
  beginning of the structure.

Usage
  XtOffset() is usually used to determine the location of an variable within a structure when initializing a resource list.  It  is  used  by
  widget writers, and anyone who needs to fetch application resources with XtGetApplicationResources().  Resource fields are defined in terms
  of offsets from a base address from the beginning of a widget.  Thus, a resource value can be kept up to date by the Resource Manager with-
  out any knowledge of the instance structure of the widget; it uses just a relative byte offset.

  XtOffsetOf()	is  slightly  more portable than XtOffset() which performs the same function but takes a pointer type rather than a structure
  type.

Example
  XtOffsetOf() is used to declare a resource list for the Athena Label widget:

     #define offset(field) XtOffsetOf(LabelRec, field)
     static XtResource resources[] = {
	 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
	     offset(label.foreground), XtRString, XtDefaultForeground},
	 {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
	     offset(label.font),XtRString, XtDefaultFont},
		 .
		 .

Background
  XtOffsetOf() is defined in terms of XtOffset() on many systems:

     #ifdef offsetof
     #define XtOffsetOf(s_type,field) offsetof(s_type,field)
     #else
     #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
     #endif

See Also
  XtOffset(1).

Xt - Utilities															      XtOffsetOf()
Man Page