diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2019-07-07 19:58:04 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2019-07-07 19:58:04 -0400 |
commit | 2b4b0b5104b9f39769f8cd500c57c0bf17994825 (patch) | |
tree | 57fca04a70da31941a7c0d820269298f38a800b2 /src | |
parent | 818711dd5ac1add5a67064cb6b0683c19055961e (diff) |
indent'd like "x-indent.sh", but with a more complete set of typedefs - see
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/Composite.c | 259 |
1 files changed, 136 insertions, 123 deletions
diff --git a/src/Composite.c b/src/Composite.c index 6efe9c7..5f4274a 100644 --- a/src/Composite.c +++ b/src/Composite.c @@ -76,11 +76,14 @@ in this Software without prior written authorization from The Open Group. static XtResource resources[] = { {XtNchildren, XtCReadOnly, XtRWidgetList, sizeof(WidgetList), - XtOffsetOf(CompositeRec, composite.children), XtRImmediate, NULL}, + XtOffsetOf(CompositeRec, composite.children), XtRImmediate, NULL} + , {XtNnumChildren, XtCReadOnly, XtRCardinal, sizeof(Cardinal), - XtOffsetOf(CompositeRec, composite.num_children), XtRImmediate, NULL}, + XtOffsetOf(CompositeRec, composite.num_children), XtRImmediate, NULL} + , {XtNinsertPosition, XtCInsertPosition, XtRFunction, sizeof(XtOrderProc), - XtOffsetOf(CompositeRec, composite.insert_position), XtRImmediate, NULL}, + XtOffsetOf(CompositeRec, composite.insert_position), XtRImmediate, NULL} + , }; static void CompositeClassPartInitialize(WidgetClass); @@ -89,197 +92,207 @@ static void CompositeInsertChild(Widget); static void CompositeDeleteChild(Widget); static void CompositeDestroy(Widget); -externaldef(compositeclassrec) CompositeClassRec compositeClassRec = { - { /******* CorePart *******/ - /* superclass */ &widgetClassRec, - /* class_name */ "Composite", - /* widget_size */ sizeof(CompositeRec), - /* class_initialize */ NULL, - /* class_part_initialize*/ CompositeClassPartInitialize, - /* class_inited */ FALSE, - /* initialize */ CompositeInitialize, - /* initialize_hook */ NULL, - /* realize */ XtInheritRealize, - /* actions */ NULL, - /* num_actions */ 0, - /* resources */ resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ FALSE, - /* compress_exposure */ TRUE, - /* compress_enterleave */ FALSE, - /* visible_interest */ FALSE, - /* destroy */ CompositeDestroy, - /* resize */ NULL, - /* expose */ NULL, - /* set_values */ NULL, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_offsets */ NULL, - /* tm_table */ NULL, - /* query_geometry */ NULL, - /* display_accelerator */ NULL, - /* extension */ NULL - }, - { /**** CompositePart *****/ - /* geometry_handler */ NULL, - /* change_managed */ NULL, - /* insert_child */ CompositeInsertChild, - /* delete_child */ CompositeDeleteChild, - /* extension */ NULL - } +externaldef(compositeclassrec) +CompositeClassRec compositeClassRec = { + { + /******* CorePart *******/ + /* superclass */ &widgetClassRec, + /* class_name */ "Composite", + /* widget_size */ sizeof(CompositeRec), + /* class_initialize */ NULL, + /* class_part_initialize */ CompositeClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ CompositeInitialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ FALSE, + /* visible_interest */ FALSE, + /* destroy */ CompositeDestroy, + /* resize */ NULL, + /* expose */ NULL, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_offsets */ NULL, + /* tm_table */ NULL, + /* query_geometry */ NULL, + /* display_accelerator */ NULL, + /* extension */ NULL + } + , + { + /**** CompositePart *****/ + /* geometry_handler */ NULL, + /* change_managed */ NULL, + /* insert_child */ CompositeInsertChild, + /* delete_child */ CompositeDeleteChild, + /* extension */ NULL + } }; -externaldef(compositewidgetclass) WidgetClass compositeWidgetClass = (WidgetClass) &compositeClassRec; +externaldef(compositewidgetclass) +WidgetClass compositeWidgetClass = (WidgetClass) & compositeClassRec; -static void InheritAllowsChangeManagedSet( - WidgetClass widget_class) +static void +InheritAllowsChangeManagedSet(WidgetClass widget_class) { CompositeWidgetClass cc = (CompositeWidgetClass) widget_class; CompositeClassExtension ext, super_ext; ext = (CompositeClassExtension) - XtGetClassExtension(widget_class, - XtOffsetOf(CompositeClassRec, composite_class.extension), - NULLQUARK, 1L, 0); + XtGetClassExtension(widget_class, + XtOffsetOf(CompositeClassRec, + composite_class.extension), NULLQUARK, + 1L, 0); if (ext && ext->version == XtCompositeExtensionVersion) - return; + return; super_ext = (CompositeClassExtension) - XtGetClassExtension(cc->core_class.superclass, - XtOffsetOf(CompositeClassRec, composite_class.extension), - NULLQUARK, 1L, 0); + XtGetClassExtension(cc->core_class.superclass, + XtOffsetOf(CompositeClassRec, + composite_class.extension), NULLQUARK, + 1L, 0); LOCK_PROCESS; if (super_ext && super_ext->version == XtCompositeExtensionVersion && - super_ext->record_size == sizeof(CompositeClassExtensionRec) && - super_ext->allows_change_managed_set) { + super_ext->record_size == sizeof(CompositeClassExtensionRec) && + super_ext->allows_change_managed_set) { CompositeClassExtension new_ext; - new_ext = (CompositeClassExtension) - __XtCalloc(1, sizeof(CompositeClassExtensionRec)); - - /* Be careful to inherit only what is appropriate */ - new_ext->next_extension = cc->composite_class.extension; - new_ext->record_type = NULLQUARK; - new_ext->version = XtCompositeExtensionVersion; - new_ext->record_size = sizeof(CompositeClassExtensionRec); - new_ext->accepts_objects = (ext ? ext->accepts_objects : False); - new_ext->allows_change_managed_set = True; - cc->composite_class.extension = (XtPointer) new_ext; + new_ext = (CompositeClassExtension) + __XtCalloc(1, sizeof(CompositeClassExtensionRec)); + + /* Be careful to inherit only what is appropriate */ + new_ext->next_extension = cc->composite_class.extension; + new_ext->record_type = NULLQUARK; + new_ext->version = XtCompositeExtensionVersion; + new_ext->record_size = sizeof(CompositeClassExtensionRec); + new_ext->accepts_objects = (ext ? ext->accepts_objects : False); + new_ext->allows_change_managed_set = True; + cc->composite_class.extension = (XtPointer) new_ext; } UNLOCK_PROCESS; } -static void CompositeClassPartInitialize( - WidgetClass myWidgetClass) +static void +CompositeClassPartInitialize(WidgetClass myWidgetClass) { register CompositePartPtr wcPtr; register CompositePartPtr superPtr = NULL; wcPtr = (CompositePartPtr) - &(((CompositeWidgetClass)myWidgetClass)->composite_class); + & (((CompositeWidgetClass) myWidgetClass)->composite_class); if (myWidgetClass != compositeWidgetClass) { - /* don't compute possible bogus pointer */ - superPtr = (CompositePartPtr)&(((CompositeWidgetClass)myWidgetClass - ->core_class.superclass)->composite_class); - - LOCK_PROCESS; - if (wcPtr->geometry_manager == XtInheritGeometryManager) { - wcPtr->geometry_manager = - superPtr->geometry_manager; - } - - if (wcPtr->change_managed == XtInheritChangeManaged) { - wcPtr->change_managed = - superPtr->change_managed; - InheritAllowsChangeManagedSet(myWidgetClass); - } - - if (wcPtr->insert_child == XtInheritInsertChild) { - wcPtr->insert_child = superPtr->insert_child; - } - - if (wcPtr->delete_child == XtInheritDeleteChild) { - wcPtr->delete_child = superPtr->delete_child; - } - UNLOCK_PROCESS; + /* don't compute possible bogus pointer */ + superPtr = + (CompositePartPtr) & + (((CompositeWidgetClass) myWidgetClass->core_class.superclass)-> + composite_class); + + LOCK_PROCESS; + if (wcPtr->geometry_manager == XtInheritGeometryManager) { + wcPtr->geometry_manager = superPtr->geometry_manager; + } + + if (wcPtr->change_managed == XtInheritChangeManaged) { + wcPtr->change_managed = superPtr->change_managed; + InheritAllowsChangeManagedSet(myWidgetClass); + } + + if (wcPtr->insert_child == XtInheritInsertChild) { + wcPtr->insert_child = superPtr->insert_child; + } + + if (wcPtr->delete_child == XtInheritDeleteChild) { + wcPtr->delete_child = superPtr->delete_child; + } + UNLOCK_PROCESS; } } -static void CompositeDestroy( - Widget w) +static void +CompositeDestroy(Widget w) { register CompositeWidget cw = (CompositeWidget) w; XtFree((char *) cw->composite.children); } -static void CompositeInsertChild( - Widget w) +static void +CompositeInsertChild(Widget w) { - register Cardinal position; - register Cardinal i; + register Cardinal position; + register Cardinal i; register CompositeWidget cw; - register WidgetList children; + register WidgetList children; cw = (CompositeWidget) w->core.parent; children = cw->composite.children; if (cw->composite.insert_position != NULL) - position = (*(cw->composite.insert_position))(w); + position = (*(cw->composite.insert_position)) (w); else - position = cw->composite.num_children; + position = cw->composite.num_children; if (cw->composite.num_children == cw->composite.num_slots) { - /* Allocate more space */ - cw->composite.num_slots += (cw->composite.num_slots / 2) + 2; - cw->composite.children = children = - (WidgetList) XtRealloc((XtPointer) children, - (Cardinal)((unsigned) (cw->composite.num_slots) * sizeof(Widget))); + /* Allocate more space */ + cw->composite.num_slots += (cw->composite.num_slots / 2) + 2; + cw->composite.children = children = + (WidgetList) XtRealloc((XtPointer) children, + (Cardinal) ((unsigned) + (cw->composite.num_slots) * + sizeof(Widget))); } /* Ripple children up one space from "position" */ for (i = cw->composite.num_children; i > position; i--) { - children[i] = children[i-1]; + children[i] = children[i - 1]; } children[position] = w; cw->composite.num_children++; } -static void CompositeDeleteChild( - Widget w) +static void +CompositeDeleteChild(Widget w) { - register Cardinal position; - register Cardinal i; + register Cardinal position; + register Cardinal i; register CompositeWidget cw; cw = (CompositeWidget) w->core.parent; for (position = 0; position < cw->composite.num_children; position++) { if (cw->composite.children[position] == w) { - break; - } + break; + } } - if (position == cw->composite.num_children) return; + if (position == cw->composite.num_children) + return; /* Ripple children down one space from "position" */ cw->composite.num_children--; for (i = position; i < cw->composite.num_children; i++) { - cw->composite.children[i] = cw->composite.children[i+1]; + cw->composite.children[i] = cw->composite.children[i + 1]; } } /* ARGSUSED */ -static void CompositeInitialize( - Widget requested_widget _X_UNUSED, - Widget new_widget, - ArgList args _X_UNUSED, - Cardinal *num_args _X_UNUSED) +static void +CompositeInitialize(Widget requested_widget _X_UNUSED, + Widget new_widget, + ArgList args _X_UNUSED, + Cardinal * num_args _X_UNUSED) { register CompositeWidget cw; |