EditresP.h File Reference

#include <X11/Intrinsic.h>
#include <X11/Xfuncproto.h>

Include dependency graph for EditresP.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _WidgetInfo
struct  _ProtocolStream

Defines

#define XER_NBBY   8
#define BYTE_MASK   255
#define HEADER_SIZE   6
#define EDITRES_IS_OBJECT   2
#define EDITRES_IS_UNREALIZED   0
#define EDITRES_FORMAT   8
#define EDITRES_SEND_EVENT_FORMAT   32
#define EDITRES_NAME   "Editres"
#define EDITRES_COMMAND_ATOM   "EditresCommand"
#define EDITRES_COMM_ATOM   "EditresComm"
#define EDITRES_CLIENT_VALUE   "EditresClientVal"
#define EDITRES_PROTOCOL_ATOM   "EditresProtocol"

Typedefs

typedef unsigned char ResIdent
typedef _WidgetInfo WidgetInfo
typedef _ProtocolStream ProtocolStream

Enumerations

enum  EditresCommand {
  SendWidgetTree = 0, SetValues = 1, GetResources = 2, GetGeometry = 3,
  FindChild = 4, GetValues = 5
}
enum  ResourceType { NormalResource = 0, ConstraintResource = 1 }
enum  EditResError { PartialSuccess = 0, Failure = 1, ProtocolMismatch = 2 }

Functions

_XFUNCPROTOBEGIN void _XEditResPutString8 (ProtocolStream *stream, char *str)
void _XEditResPut8 (ProtocolStream *stream, unsigned int value)
void _XEditResPut16 (ProtocolStream *stream, unsigned int value)
void _XEditResPut32 (ProtocolStream *stream, unsigned long value)
void _XEditResPutWidgetInfo (ProtocolStream *stream, WidgetInfo *info)
void _XEditResResetStream (ProtocolStream *stream)
Bool _XEditResGet8 (ProtocolStream *stream, unsigned char *value)
Bool _XEditResGet16 (ProtocolStream *stream, unsigned short *value)
Bool _XEditResGetSigned16 (ProtocolStream *stream, short *value)
Bool _XEditResGet32 (ProtocolStream *stream, unsigned long *value)
Bool _XEditResGetString8 (ProtocolStream *stream, char **str)
Bool _XEditResGetWidgetInfo (ProtocolStream *stream, WidgetInfo *info)


Define Documentation

#define BYTE_MASK   255

Definition at line 275 of file EditresP.h.

Referenced by _XEditResPut16(), _XEditResPut32(), and _XEditResPut8().

#define EDITRES_CLIENT_VALUE   "EditresClientVal"

Definition at line 294 of file EditresP.h.

Referenced by _XEditResCheckMessages().

#define EDITRES_COMM_ATOM   "EditresComm"

Definition at line 293 of file EditresP.h.

#define EDITRES_COMMAND_ATOM   "EditresCommand"

Definition at line 292 of file EditresP.h.

Referenced by _XEditResCheckMessages().

#define EDITRES_FORMAT   8

Definition at line 285 of file EditresP.h.

Referenced by ConvertReturnCommand(), and GetCommand().

#define EDITRES_IS_OBJECT   2

Definition at line 279 of file EditresP.h.

Referenced by DumpChildren().

#define EDITRES_IS_UNREALIZED   0

Definition at line 280 of file EditresP.h.

Referenced by DumpChildren().

#define EDITRES_NAME   "Editres"

Definition at line 291 of file EditresP.h.

Referenced by _XEditResCheckMessages().

#define EDITRES_PROTOCOL_ATOM   "EditresProtocol"

Definition at line 295 of file EditresP.h.

Referenced by _XEditResCheckMessages().

#define EDITRES_SEND_EVENT_FORMAT   32

Definition at line 286 of file EditresP.h.

Referenced by _XEditResCheckMessages().

#define HEADER_SIZE   6

Definition at line 277 of file EditresP.h.

Referenced by _XEditResPut8(), _XEditResResetStream(), BuildEvent(), BuildReturnPacket(), and ConvertReturnCommand().

#define XER_NBBY   8

Definition at line 274 of file EditresP.h.

Referenced by _XEditResGet16(), _XEditResGet32(), _XEditResGetSigned16(), _XEditResPut16(), _XEditResPut32(), and DumpWidgets().


Typedef Documentation

typedef struct _ProtocolStream ProtocolStream

typedef unsigned char ResIdent

Definition at line 314 of file EditresP.h.

typedef struct _WidgetInfo WidgetInfo


Enumeration Type Documentation

enum EditresCommand

Enumerator:
SendWidgetTree 
SetValues 
GetResources 
GetGeometry 
FindChild 
GetValues 

Definition at line 297 of file EditresP.h.

00297              {
00298   SendWidgetTree = 0,
00299                SetValues      = 1,
00300                GetResources   = 2,
00301                GetGeometry    = 3, 
00302                FindChild      = 4,
00303                GetValues      = 5
00304 } EditresCommand;

enum EditResError

Enumerator:
PartialSuccess 
Failure 
ProtocolMismatch 

Definition at line 316 of file EditresP.h.

00316              {
00317   PartialSuccess   = 0,
00318   Failure          = 1,
00319   ProtocolMismatch = 2
00320 } EditResError;

enum ResourceType

Enumerator:
NormalResource 
ConstraintResource 

Definition at line 306 of file EditresP.h.

00306              {
00307   NormalResource     = 0,
00308   ConstraintResource = 1
00309 } ResourceType;


Function Documentation

Bool _XEditResGet16 ( ProtocolStream stream,
unsigned short *  value 
)

Definition at line 1818 of file EditresCom.c.

References _XEditResGet8(), and XER_NBBY.

Referenced by _XEditResGet32(), _XEditResGetString8(), _XEditResGetWidgetInfo(), and BuildEvent().

01819 {
01820     unsigned char temp1, temp2;
01821 
01822   if (!(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)))
01823     return (False);
01824     
01825   *value = ((unsigned short)temp1 << XER_NBBY) + (unsigned short)temp2;
01826   return (True);
01827 }

Here is the call graph for this function:

Here is the caller graph for this function:

Bool _XEditResGet32 ( ProtocolStream stream,
unsigned long value 
)

Definition at line 1878 of file EditresCom.c.

References _XEditResGet16(), and XER_NBBY.

Referenced by _XEditResGetWidgetInfo(), and BuildEvent().

01879 {
01880     unsigned short temp1, temp2;
01881 
01882   if (!(_XEditResGet16(stream, &temp1) && _XEditResGet16(stream, &temp2)))
01883     return (False);
01884     
01885   *value = ((unsigned short)temp1 << (XER_NBBY * 2)) + (unsigned short)temp2;
01886   return (True);
01887 }

Here is the call graph for this function:

Here is the caller graph for this function:

Bool _XEditResGet8 ( ProtocolStream stream,
unsigned char *  value 
)

Definition at line 1794 of file EditresCom.c.

References _ProtocolStream::current, _ProtocolStream::size, and _ProtocolStream::top.

Referenced by _XEditResGet16(), _XEditResGetSigned16(), _XEditResGetString8(), and BuildEvent().

01795 {
01796   if (stream->size < (unsigned long)(stream->current - stream->top))
01797     return (False);
01798 
01799   *value = *((stream->current)++);
01800   return (True);
01801 }

Here is the caller graph for this function:

Bool _XEditResGetSigned16 ( ProtocolStream stream,
short *  value 
)

Definition at line 1844 of file EditresCom.c.

References _XEditResGet8(), and XER_NBBY.

Referenced by BuildEvent().

01845 {
01846     unsigned char temp1, temp2;
01847 
01848   if (!(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)))
01849     return (False);
01850     
01851   if (temp1 & (1 << (XER_NBBY - 1)))    /* If the sign bit is active */
01852     {
01853       *value = -1;                      /* store all 1's */
01854       *value &= (temp1 << XER_NBBY);    /* Now and in the MSB */
01855       *value &= temp2;                   /* and LSB */
01856     }
01857     else 
01858     *value = ((unsigned short)temp1 << XER_NBBY) + (unsigned short)temp2;
01859 
01860   return (True);
01861 }

Here is the call graph for this function:

Here is the caller graph for this function:

Bool _XEditResGetString8 ( ProtocolStream stream,
char **  str 
)

Definition at line 1903 of file EditresCom.c.

References _XEditResGet16(), _XEditResGet8(), i, len, and NULL.

Referenced by BuildEvent().

01904 {
01905     unsigned short len;
01906     register unsigned i;
01907 
01908   if (!_XEditResGet16(stream, &len))
01909     return (False);
01910 
01911     *str = XtMalloc(sizeof(char) * (len + 1));
01912 
01913   for (i = 0; i < len; i++)
01914     {
01915       if (!_XEditResGet8(stream, (unsigned char *)*str + i))
01916         {
01917             XtFree(*str);
01918             *str = NULL;
01919           return (False);
01920         }
01921     }
01922   (*str)[i] = '\0';
01923 
01924   return (True);
01925 }

Here is the call graph for this function:

Here is the caller graph for this function:

Bool _XEditResGetWidgetInfo ( ProtocolStream stream,
WidgetInfo info 
)

Definition at line 1943 of file EditresCom.c.

References _XEditResGet16(), _XEditResGet32(), globals, i, info, and NULL.

Referenced by BuildEvent().

01944 {
01945     unsigned int i;
01946 
01947   if (!_XEditResGet16(stream, &info->num_widgets))
01948     return (False);
01949 
01950   info->ids = (unsigned long *)XtMalloc(sizeof(long) * info->num_widgets);
01951 
01952   for (i = 0; i < info->num_widgets; i++)
01953     {
01954       if (!_XEditResGet32(stream, info->ids + i))
01955         {
01956             XtFree((char *)info->ids);
01957             info->ids = NULL;
01958           return (False);
01959         }
01960 #if defined(LONG64) || defined(WORD64)
01961         info->ids[i] |= globals.base_address;
01962 #endif
01963     }
01964   return (True);
01965 }

Here is the call graph for this function:

Here is the caller graph for this function:

void _XEditResPut16 ( ProtocolStream stream,
unsigned int  value 
)

Definition at line 1697 of file EditresCom.c.

References _XEditResPut8(), BYTE_MASK, and XER_NBBY.

Referenced by _XEditResPutString8(), _XEditResPutWidgetInfo(), DoGetGeometry(), DoGetResources(), DoSetValues(), DumpValues(), DumpWidgets(), ExecuteGetGeometry(), ExecuteGetResources(), and InsertWidget().

01698 {
01699     _XEditResPut8(stream, (value >> XER_NBBY) & BYTE_MASK);
01700     _XEditResPut8(stream, value & BYTE_MASK);
01701 }

Here is the call graph for this function:

Here is the caller graph for this function:

void _XEditResPut32 ( ProtocolStream stream,
unsigned long  value 
)

Definition at line 1715 of file EditresCom.c.

References _XEditResPut8(), BYTE_MASK, i, and XER_NBBY.

Referenced by _XEditResPutWidgetInfo(), BuildReturnPacket(), DumpChildren(), and InsertWidget().

01716 {
01717     int i;
01718 
01719     for (i = 3; i >= 0; i--) 
01720     _XEditResPut8(stream, (value >> (XER_NBBY * i)) & BYTE_MASK);
01721 }

Here is the call graph for this function:

Here is the caller graph for this function:

void _XEditResPut8 ( ProtocolStream stream,
unsigned int  value 
)

Definition at line 1667 of file EditresCom.c.

References _ProtocolStream::alloc, BYTE_MASK, _ProtocolStream::current, HEADER_SIZE, _ProtocolStream::real_top, _ProtocolStream::size, and _ProtocolStream::top.

Referenced by _XEditResCheckMessages(), _XEditResPut16(), _XEditResPut32(), _XEditResPutString8(), BuildReturnPacket(), and ExecuteGetGeometry().

01668 {
01669     unsigned char temp;
01670 
01671   if (stream->size >= stream->alloc)
01672     {
01673         stream->alloc += 100;
01674       stream->real_top = (unsigned char *)
01675         XtRealloc((char *)stream->real_top, stream->alloc + HEADER_SIZE);
01676         stream->top = stream->real_top + HEADER_SIZE;
01677         stream->current = stream->top + stream->size;
01678     }
01679 
01680     temp = (unsigned char) (value & BYTE_MASK);
01681     *((stream->current)++) = temp;
01682     (stream->size)++;
01683 }

Here is the caller graph for this function:

_XFUNCPROTOBEGIN void _XEditResPutString8 ( ProtocolStream stream,
char *  str 
)

Definition at line 1646 of file EditresCom.c.

References _XEditResPut16(), _XEditResPut8(), i, and len.

Referenced by DoGetGeometry(), DoGetResources(), DoSetValues(), DumpChildren(), DumpValues(), DumpWidgets(), ExecuteGetGeometry(), ExecuteGetResources(), HandleToolkitErrors(), and SendFailure().

01647 {
01648     int i, len = strlen(str);
01649 
01650     _XEditResPut16(stream, len);
01651   for (i = 0; i < len; i++, str++)
01652         _XEditResPut8(stream, *str);
01653 }

Here is the call graph for this function:

Here is the caller graph for this function:

void _XEditResPutWidgetInfo ( ProtocolStream stream,
WidgetInfo info 
)

Definition at line 1735 of file EditresCom.c.

References _XEditResPut16(), _XEditResPut32(), i, and info.

Referenced by DoGetGeometry(), DoGetResources(), DoSetValues(), and HandleToolkitErrors().

01736 {
01737     unsigned int i;
01738 
01739     _XEditResPut16(stream, info->num_widgets);
01740     for (i = 0; i < info->num_widgets; i++) 
01741         _XEditResPut32(stream, info->ids[i]);
01742 }

Here is the call graph for this function:

Here is the caller graph for this function:

void _XEditResResetStream ( ProtocolStream stream  ) 

Definition at line 1758 of file EditresCom.c.

References _ProtocolStream::alloc, _ProtocolStream::current, HEADER_SIZE, NULL, _ProtocolStream::real_top, _ProtocolStream::size, and _ProtocolStream::top.

Referenced by _XEditResCheckMessages(), ExecuteCommand(), and SendFailure().

01759 {
01760     stream->current = stream->top;
01761     stream->size = 0;
01762   if (stream->real_top == NULL)
01763     {
01764       stream->real_top = (unsigned char *)
01765         XtRealloc((char *)stream->real_top, stream->alloc + HEADER_SIZE);
01766         stream->top = stream->real_top + HEADER_SIZE;
01767         stream->current = stream->top + stream->size;
01768     }
01769 }

Here is the caller graph for this function:


Generated on Sun Mar 4 16:04:06 2007 for Scilab [trunk] by  doxygen 1.5.1