"Fossies" - the Fresh Open Source Software Archive

Member "FreeBASIC-1.05.0-linux-x86_64/include/freebasic/X11/TranslateI.bi" (31 Jan 2016, 14867 Bytes) of package /linux/privat/FreeBASIC-1.05.0-linux-x86_64.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Visual Basic source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 '' FreeBASIC binding for libXt-1.1.4
    2 ''
    3 '' based on the C header files:
    4 ''   *********************************************************
    5 ''
    6 ''   Copyright 1987, 1988, 1998  The Open Group
    7 ''
    8 ''   Permission to use, copy, modify, distribute, and sell this software and its
    9 ''   documentation for any purpose is hereby granted without fee, provided that
   10 ''   the above copyright notice appear in all copies and that both that
   11 ''   copyright notice and this permission notice appear in supporting
   12 ''   documentation.
   13 ''
   14 ''   The above copyright notice and this permission notice shall be included in
   15 ''   all copies or substantial portions of the Software.
   16 ''
   17 ''   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   18 ''   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   19 ''   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
   20 ''   OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
   21 ''   AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   22 ''   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   23 ''
   24 ''   Except as contained in this notice, the name of The Open Group shall not be
   25 ''   used in advertising or otherwise to promote the sale, use or other dealings
   26 ''   in this Software without prior written authorization from The Open Group.
   27 ''
   28 ''
   29 ''   Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
   30 ''
   31 ''                           All Rights Reserved
   32 ''
   33 ''   Permission to use, copy, modify, and distribute this software and its
   34 ''   documentation for any purpose and without fee is hereby granted,
   35 ''   provided that the above copyright notice appear in all copies and that
   36 ''   both that copyright notice and this permission notice appear in
   37 ''   supporting documentation, and that the name of Digital not be
   38 ''   used in advertising or publicity pertaining to distribution of the
   39 ''   software without specific, written prior permission.
   40 ''
   41 ''   DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   42 ''   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
   43 ''   DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
   44 ''   ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   45 ''   WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   46 ''   ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   47 ''   SOFTWARE.
   48 ''
   49 ''   *****************************************************************
   50 ''
   51 '' translated to FreeBASIC by:
   52 ''   Copyright © 2015 FreeBASIC development team
   53 
   54 #pragma once
   55 
   56 #include once "crt/long.bi"
   57 #include once "CallbackI.bi"
   58 #include once "EventI.bi"
   59 #include once "HookObjI.bi"
   60 #include once "PassivGraI.bi"
   61 #include once "ThreadsI.bi"
   62 #include once "InitialI.bi"
   63 #include once "ResourceI.bi"
   64 #include once "StringDefs.bi"
   65 
   66 extern "C"
   67 
   68 #define CACHE_TRANSLATIONS
   69 const TM_NO_MATCH = -2
   70 #define _XtRStateTablePair "_XtStateTablePair"
   71 
   72 type TMByteCard as ubyte
   73 type TMShortCard as ushort
   74 type TMLongCard as culong
   75 type TMShortInt as short
   76 type TMTypeMatch as _TMTypeMatchRec ptr
   77 type TMModifierMatch as _TMModifierMatchRec ptr
   78 type TMEventPtr as _TMEventRec ptr
   79 type MatchProc as function(byval typeMatch as TMTypeMatch, byval modMatch as TMModifierMatch, byval eventSeq as TMEventPtr) as XBoolean
   80 
   81 type _ModToKeysymTable
   82     mask as Modifiers
   83     count as long
   84     idx as long
   85 end type
   86 
   87 type ModToKeysymTable as _ModToKeysymTable
   88 
   89 type _LateBindings
   90     knot : 1 as ulong
   91     pair : 1 as ulong
   92     ref_count as ushort
   93     keysym as KeySym
   94 end type
   95 
   96 type LateBindings as _LateBindings
   97 type LateBindingsPtr as _LateBindings ptr
   98 type ModifierMask as short
   99 type ActionPtr as _ActionsRec ptr
  100 
  101 type _ActionsRec
  102     idx as long
  103     params as String_ ptr
  104     num_params as Cardinal
  105     next as ActionPtr
  106 end type
  107 
  108 type ActionRec as _ActionsRec
  109 type StatePtr as _XtStateRec ptr
  110 
  111 type _XtStateRec_
  112     isCycleStart : 1 as ulong
  113     isCycleEnd : 1 as ulong
  114     typeIndex as TMShortCard
  115     modIndex as TMShortCard
  116     actions as ActionPtr
  117     nextLevel as StatePtr
  118 end type
  119 
  120 type StateRec as _XtStateRec
  121 const XtTableReplace = 0
  122 const XtTableAugment = 1
  123 const XtTableOverride = 2
  124 const XtTableUnmerge = 3
  125 type _XtTranslateOp as ulong
  126 
  127 type _TMModifierMatchRec
  128     modifiers as TMLongCard
  129     modifierMask as TMLongCard
  130     lateModifiers as LateBindingsPtr
  131     standard as XBoolean
  132 end type
  133 
  134 type TMModifierMatchRec as _TMModifierMatchRec
  135 
  136 type _TMTypeMatchRec
  137     eventType as TMLongCard
  138     eventCode as TMLongCard
  139     eventCodeMask as TMLongCard
  140     matchEvent as MatchProc
  141 end type
  142 
  143 type TMTypeMatchRec as _TMTypeMatchRec
  144 
  145 type _TMBranchHeadRec
  146     isSimple : 1 as ulong
  147     hasActions : 1 as ulong
  148     hasCycles : 1 as ulong
  149     more : 13 as ulong
  150     typeIndex as TMShortCard
  151     modIndex as TMShortCard
  152 end type
  153 
  154 type TMBranchHeadRec as _TMBranchHeadRec
  155 type TMBranchHead as _TMBranchHeadRec ptr
  156 
  157 type _TMSimpleStateTreeRec
  158     isSimple : 1 as ulong
  159     isAccelerator : 1 as ulong
  160     mappingNotifyInterest : 1 as ulong
  161     refCount : 13 as ulong
  162     numBranchHeads as TMShortCard
  163     numQuarks as TMShortCard
  164     unused as TMShortCard
  165     branchHeadTbl as TMBranchHeadRec ptr
  166     quarkTbl as XrmQuark ptr
  167 end type
  168 
  169 type TMSimpleStateTreeRec as _TMSimpleStateTreeRec
  170 type TMSimpleStateTree as _TMSimpleStateTreeRec ptr
  171 
  172 type _TMComplexStateTreeRec
  173     isSimple : 1 as ulong
  174     isAccelerator : 1 as ulong
  175     mappingNotifyInterest : 1 as ulong
  176     refCount : 13 as ulong
  177     numBranchHeads as TMShortCard
  178     numQuarks as TMShortCard
  179     numComplexBranchHeads as TMShortCard
  180     branchHeadTbl as TMBranchHeadRec ptr
  181     quarkTbl as XrmQuark ptr
  182     complexBranchHeadTbl as StatePtr ptr
  183 end type
  184 
  185 type TMComplexStateTreeRec as _TMComplexStateTreeRec
  186 type TMComplexStateTree as _TMComplexStateTreeRec ptr
  187 
  188 type _TMParseStateTreeRec
  189     isSimple : 1 as ulong
  190     isAccelerator : 1 as ulong
  191     mappingNotifyInterest : 1 as ulong
  192     isStackQuarks : 1 as ulong
  193     isStackBranchHeads : 1 as ulong
  194     isStackComplexBranchHeads : 1 as ulong
  195     unused : 10 as ulong
  196     numBranchHeads as TMShortCard
  197     numQuarks as TMShortCard
  198     numComplexBranchHeads as TMShortCard
  199     branchHeadTbl as TMBranchHeadRec ptr
  200     quarkTbl as XrmQuark ptr
  201     complexBranchHeadTbl as StatePtr ptr
  202     branchHeadTblSize as TMShortCard
  203     quarkTblSize as TMShortCard
  204     complexBranchHeadTblSize as TMShortCard
  205     head as StatePtr
  206 end type
  207 
  208 type TMParseStateTreeRec as _TMParseStateTreeRec
  209 type TMParseStateTree as _TMParseStateTreeRec ptr
  210 
  211 union _TMStateTreeRec
  212     simple as TMSimpleStateTreeRec
  213     parse as TMParseStateTreeRec
  214     complex as TMComplexStateTreeRec
  215 end union
  216 
  217 type TMStateTree as _TMStateTreeRec ptr
  218 type TMStateTreePtr as _TMStateTreeRec ptr ptr
  219 type TMStateTreeList as _TMStateTreeRec ptr ptr
  220 
  221 type _TMSimpleBindProcsRec
  222     procs as XtActionProc ptr
  223 end type
  224 
  225 type TMSimpleBindProcsRec as _TMSimpleBindProcsRec
  226 type TMSimpleBindProcs as _TMSimpleBindProcsRec ptr
  227 
  228 type _TMComplexBindProcsRec
  229     widget as Widget
  230     aXlations as XtTranslations
  231     procs as XtActionProc ptr
  232 end type
  233 
  234 type TMComplexBindProcsRec as _TMComplexBindProcsRec
  235 type TMComplexBindProcs as _TMComplexBindProcsRec ptr
  236 
  237 type _TMSimpleBindDataRec
  238     isComplex : 1 as ulong
  239     bindTbl(0 to 0) as TMSimpleBindProcsRec
  240 end type
  241 
  242 type TMSimpleBindDataRec as _TMSimpleBindDataRec
  243 type TMSimpleBindData as _TMSimpleBindDataRec ptr
  244 type _ATranslationData as _ATranslationData_
  245 
  246 type _TMComplexBindDataRec
  247     isComplex : 1 as ulong
  248     accel_context as _ATranslationData ptr
  249     bindTbl(0 to 0) as TMComplexBindProcsRec
  250 end type
  251 
  252 type TMComplexBindDataRec as _TMComplexBindDataRec
  253 type TMComplexBindData as _TMComplexBindDataRec ptr
  254 
  255 union _TMBindDataRec
  256     simple as TMSimpleBindDataRec
  257     complex as TMComplexBindDataRec
  258 end union
  259 
  260 type TMBindData as _TMBindDataRec ptr
  261 
  262 type _TranslationData
  263     hasBindings as ubyte
  264     operation as ubyte
  265     numStateTrees as TMShortCard
  266     composers(0 to 1) as _TranslationData ptr
  267     eventMask as EventMask
  268     stateTreeTbl(0 to 0) as TMStateTree
  269 end type
  270 
  271 type TranslationData as _TranslationData
  272 
  273 type _ATranslationData_
  274     hasBindings as ubyte
  275     operation as ubyte
  276     xlations as _TranslationData ptr
  277     next as _ATranslationData ptr
  278     bindTbl(0 to 0) as TMComplexBindProcsRec
  279 end type
  280 
  281 type ATranslationData as _ATranslationData
  282 type ATranslations as _ATranslationData ptr
  283 
  284 type _TMConvertRec
  285     old as XtTranslations
  286     new_ as XtTranslations
  287 end type
  288 
  289 type TMConvertRec as _TMConvertRec
  290 const _XtEventTimerEventType = cast(TMLongCard, not cast(clong, 0))
  291 const KeysymModMask = cast(clong, 1) shl 27
  292 const AnyButtonMask = cast(clong, 1) shl 28
  293 
  294 type _EventRec
  295     modifiers as TMLongCard
  296     modifierMask as TMLongCard
  297     lateModifiers as LateBindingsPtr
  298     eventType as TMLongCard
  299     eventCode as TMLongCard
  300     eventCodeMask as TMLongCard
  301     matchEvent as MatchProc
  302     standard as XBoolean
  303 end type
  304 
  305 type Event as _EventRec
  306 type EventSeqPtr as _EventSeqRec ptr
  307 
  308 type _EventSeqRec
  309     event as Event
  310     state as StatePtr
  311     next as EventSeqPtr
  312     actions as ActionPtr
  313 end type
  314 
  315 type EventSeqRec as _EventSeqRec
  316 type EventRec as EventSeqRec
  317 type EventPtr as EventSeqPtr
  318 
  319 type _TMEventRec
  320     xev as XEvent ptr
  321     event as Event
  322 end type
  323 
  324 type TMEventRec as _TMEventRec
  325 
  326 type _ActionHookRec
  327     next as _ActionHookRec ptr
  328     app as XtAppContext
  329     proc as XtActionHookProc
  330     closure as XtPointer
  331 end type
  332 
  333 type ActionHookRec as _ActionHookRec
  334 type ActionHook as _ActionHookRec ptr
  335 const TMKEYCACHELOG2 = 6
  336 const TMKEYCACHESIZE = 1 shl TMKEYCACHELOG2
  337 
  338 type _KeyCacheRec
  339     modifiers_return(0 to 255) as ubyte
  340     keycode(0 to (1 shl 6) - 1) as KeyCode
  341     modifiers(0 to (1 shl 6) - 1) as ubyte
  342     keysym(0 to (1 shl 6) - 1) as KeySym
  343 end type
  344 
  345 type TMKeyCache as _KeyCacheRec
  346 
  347 type _TMKeyContextRec
  348     event as XEvent ptr
  349     serial as culong
  350     keysym as KeySym
  351     modifiers as Modifiers
  352     keycache as TMKeyCache
  353 end type
  354 
  355 type TMKeyContextRec as _TMKeyContextRec
  356 type TMKeyContext as _TMKeyContextRec ptr
  357 
  358 type _TMGlobalRec
  359     typeMatchSegmentTbl as TMTypeMatchRec ptr ptr
  360     numTypeMatches as TMShortCard
  361     numTypeMatchSegments as TMShortCard
  362     typeMatchSegmentTblSize as TMShortCard
  363     modMatchSegmentTbl as TMModifierMatchRec ptr ptr
  364     numModMatches as TMShortCard
  365     numModMatchSegments as TMShortCard
  366     modMatchSegmentTblSize as TMShortCard
  367     newMatchSemantics as XBoolean
  368 end type
  369 
  370 type TMGlobalRec as _TMGlobalRec
  371 extern _XtGlobalTM as TMGlobalRec
  372 const TM_MOD_SEGMENT_SIZE = 16
  373 const TM_TYPE_SEGMENT_SIZE = 16
  374 #define TMGetTypeMatch(idx) cast(TMTypeMatch, @_XtGlobalTM.typeMatchSegmentTbl[((idx) shr 4)][((idx) and 15)])
  375 #define TMGetModifierMatch(idx) cast(TMModifierMatch, @_XtGlobalTM.modMatchSegmentTbl[((idx) shr 4)][((idx) and 15)])
  376 #define TMNewMatchSemantics() _XtGlobalTM.newMatchSemantics
  377 #define TMBranchMore(branch) branch->more
  378 #define TMComplexBranchHead(tree, br) cast(TMComplexStateTree, tree)->complexBranchHeadTbl[TMBranchMore(br)]
  379 #define TMGetComplexBindEntry(bindData, idx) cast(TMComplexBindProcs, @cast(TMComplexBindData, bindData)->bindTbl[idx])
  380 #define TMGetSimpleBindEntry(bindData, idx) cast(TMSimpleBindProcs, @cast(TMSimpleBindData, bindData)->bindTbl[idx])
  381 #macro _InitializeKeysymTables(dpy, pd)
  382     if pd->keysyms = NULL then
  383         _XtBuildKeysymTables(dpy, pd)
  384     end if
  385 #endmacro
  386 
  387 declare sub _XtPopup(byval as Widget, byval as XtGrabKind, byval as XBoolean)
  388 declare function _XtPrintXlations(byval as Widget, byval as XtTranslations, byval as Widget, byval as XBoolean) as String_
  389 declare sub _XtRegisterGrabs(byval as Widget)
  390 declare function _XtInitializeActionData(byval as _XtActionsRec ptr, byval as Cardinal, byval as XBoolean) as XtPointer
  391 declare sub _XtAddEventSeqToStateTree(byval as EventSeqPtr, byval as TMParseStateTree)
  392 declare function _XtMatchUsingStandardMods(byval as TMTypeMatch, byval as TMModifierMatch, byval as TMEventPtr) as XBoolean
  393 declare function _XtMatchUsingDontCareMods(byval as TMTypeMatch, byval as TMModifierMatch, byval as TMEventPtr) as XBoolean
  394 declare function _XtRegularMatch(byval as TMTypeMatch, byval as TMModifierMatch, byval as TMEventPtr) as XBoolean
  395 declare function _XtMatchAtom(byval as TMTypeMatch, byval as TMModifierMatch, byval as TMEventPtr) as XBoolean
  396 declare sub _XtTranslateEvent(byval as Widget, byval as XEvent ptr)
  397 declare sub _XtBuildKeysymTables(byval dpy as Display ptr, byval pd as XtPerDisplay)
  398 declare sub _XtDisplayTranslations(byval as Widget, byval as XEvent ptr, byval as String_ ptr, byval as Cardinal ptr)
  399 declare sub _XtDisplayAccelerators(byval as Widget, byval as XEvent ptr, byval as String_ ptr, byval as Cardinal ptr)
  400 declare sub _XtDisplayInstalledAccelerators(byval as Widget, byval as XEvent ptr, byval as String_ ptr, byval as Cardinal ptr)
  401 declare sub _XtPopupInitialize(byval as XtAppContext)
  402 declare sub _XtBindActions(byval as Widget, byval as XtTM)
  403 declare function _XtComputeLateBindings(byval as Display ptr, byval as LateBindingsPtr, byval as Modifiers ptr, byval as Modifiers ptr) as XBoolean
  404 declare function _XtCreateXlations(byval as TMStateTree ptr, byval as TMShortCard, byval as XtTranslations, byval as XtTranslations) as XtTranslations
  405 declare function _XtCvtMergeTranslations(byval as Display ptr, byval as XrmValuePtr, byval as Cardinal ptr, byval as XrmValuePtr, byval as XrmValuePtr, byval as XtPointer ptr) as XBoolean
  406 declare sub _XtRemoveStateTreeByIndex(byval as XtTranslations, byval as TMShortCard)
  407 declare sub _XtFreeTranslations(byval as XtAppContext, byval as XrmValuePtr, byval as XtPointer, byval as XrmValuePtr, byval as Cardinal ptr)
  408 declare function _XtGetModifierIndex(byval as Event ptr) as TMShortCard
  409 declare function _XtGetQuarkIndex(byval as TMParseStateTree, byval as XrmQuark) as TMShortCard
  410 declare function _XtGetTranslationValue(byval as Widget) as XtTranslations
  411 declare function _XtGetTypeIndex(byval as Event ptr) as TMShortCard
  412 declare sub _XtGrabInitialize(byval as XtAppContext)
  413 declare sub _XtInstallTranslations(byval as Widget)
  414 declare sub _XtRemoveTranslations(byval as Widget)
  415 declare sub _XtDestroyTMData(byval as Widget)
  416 declare sub _XtMergeTranslations(byval as Widget, byval as XtTranslations, byval as _XtTranslateOp)
  417 declare sub _XtActionInitialize(byval as XtAppContext)
  418 declare function _XtParseTreeToStateTree(byval as TMParseStateTree) as TMStateTree
  419 declare function _XtPrintActions(byval as ActionRec ptr, byval as XrmQuark ptr) as String_
  420 declare function _XtPrintState(byval as TMStateTree, byval as TMBranchHead) as String_
  421 declare function _XtPrintEventSeq(byval as EventSeqPtr, byval as Display ptr) as String_
  422 type _XtTraversalProc as function(byval as StatePtr, byval as XtPointer) as XBoolean
  423 declare sub _XtTraverseStateTree(byval as TMStateTree, byval as _XtTraversalProc, byval as XtPointer)
  424 declare sub _XtTranslateInitialize()
  425 declare sub _XtAddTMConverters(byval as ConverterTable)
  426 declare sub _XtUnbindActions(byval as Widget, byval as XtTranslations, byval as TMBindData)
  427 declare sub _XtUnmergeTranslations(byval as Widget, byval as XtTranslations)
  428 declare sub _XtAllocTMContext(byval pd as XtPerDisplay)
  429 
  430 end extern