src/java.desktop/unix/native/libawt_xawt/awt/list.h
author avu
Sun, 07 Jul 2019 10:52:30 -0700
changeset 55614 040cb8bf265e
parent 52542 8c7638601045
permissions -rw-r--r--
8226654: Some swing gtk regression tests fail with "java.lang.InternalError: Unable to load native GTK librarie Reviewed-by: prr, psadhukhan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
     2
 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
/** ------------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
        This file contains routines for manipulating generic lists.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
        Lists are implemented with a "harness".  In other words, each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
        node in the list consists of two pointers, one to the data item
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
        and one to the next node in the list.  The head of the list is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
        the same struct as each node, but the "item" ptr is used to point
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
        to the current member of the list (used by the first_in_list and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
        next_in_list functions).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 This file is available under and governed by the GNU General Public
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 License version 2 only, as published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 However, the following notice accompanied the original version of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 file:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    39
Copyright 1994 Hewlett-Packard Co.
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    40
Copyright 1996, 1998  The Open Group
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    42
Permission to use, copy, modify, distribute, and sell this software and its
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    43
documentation for any purpose is hereby granted without fee, provided that
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    44
the above copyright notice appear in all copies and that both that
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    45
copyright notice and this permission notice appear in supporting
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    46
documentation.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
The above copyright notice and this permission notice shall be included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
in all copies or substantial portions of the Software.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    54
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
OTHER DEALINGS IN THE SOFTWARE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    59
Except as contained in this notice, the name of The Open Group shall
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
not be used in advertising or otherwise to promote the sale, use or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
other dealings in this Software without prior written authorization
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    62
from The Open Group.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    -------------------------------------------------------------------- **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#ifndef LIST_DEF
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define LIST_DEF
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    69
#include <X11/Xfuncproto.h>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#define LESS    -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
#define EQUAL   0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define GREATER 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define DUP_WHOLE_LIST  0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#define START_AT_CURR   1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
typedef struct _list_item {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    struct _list_item *next;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    union {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        void *item;              /* in normal list node, pts to data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        struct _list_item *curr; /* in list head, pts to curr for 1st, next */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    } ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
} list, list_item, *list_ptr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
typedef void (*DESTRUCT_FUNC_PTR)(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
void *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
void zero_list(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
          list_ptr
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    );
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    91
int add_to_list (
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
          list_ptr , void *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    );
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
list_ptr new_list (
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
          void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    );
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
list_ptr dup_list_head (
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
    98
          list_ptr , int
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    );
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
   100
unsigned int list_length(
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
          list_ptr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
void *delete_from_list (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
          list_ptr , void *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
void delete_list(
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
   107
          list_ptr , int
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
void delete_list_destroying (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
          list_ptr , DESTRUCT_FUNC_PTR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
void *first_in_list (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
          list_ptr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
void *next_in_list (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
          list_ptr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    );
52542
8c7638601045 8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7
prr
parents: 47216
diff changeset
   118
int list_is_empty (
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
          list_ptr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
#endif