| 1 | # Copyright 2011, 2012, 2013, 2014, 2016, 2017, 2019 Kevin Ryde | ||
| 2 | |||
| 3 | # This file is part of X11-Protocol-Other. | ||
| 4 | # | ||
| 5 | # X11-Protocol-Other is free software; you can redistribute it and/or | ||
| 6 | # modify it under the terms of the GNU General Public License as published | ||
| 7 | # by the Free Software Foundation; either version 3, or (at your option) any | ||
| 8 | # later version. | ||
| 9 | # | ||
| 10 | # X11-Protocol-Other is distributed in the hope that it will be useful, | ||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
| 13 | # Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License along | ||
| 16 | # with X11-Protocol-Other. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | |||
| 18 | BEGIN { require 5 } | ||
| 19 | package X11::Protocol::Ext::XFIXES; | ||
| 20 | use X11::Protocol 'padded'; | ||
| 21 | use strict; | ||
| 22 | use Carp; | ||
| 23 | |||
| 24 | use vars '$VERSION', '@CARP_NOT'; | ||
| 25 | $VERSION = 31; | ||
| 26 | @CARP_NOT = ('X11::Protocol'); | ||
| 27 | |||
| 28 | # uncomment this to run the ### lines | ||
| 29 | # use Smart::Comments; | ||
| 30 | |||
| 31 | # /usr/share/doc/x11proto-dev/fixesproto.txt.gz | ||
| 32 | # /usr/share/doc/x11proto-fixes-dev/fixesproto.txt.gz | ||
| 33 | # http://cgit.freedesktop.org/xorg/proto/fixesproto/tree/fixesproto.txt | ||
| 34 | # /usr/include/X11/extensions/xfixesproto.h | ||
| 35 | # /usr/include/X11/extensions/xfixeswire.h | ||
| 36 | # | ||
| 37 | # /usr/share/doc/x11proto-xext-dev/shape.txt.gz | ||
| 38 | # | ||
| 39 | # /usr/include/X11/extensions/Xfixes.h | ||
| 40 | # Xlib. | ||
| 41 | # | ||
| 42 | # /usr/share/doc/x11proto-core-dev/x11protocol.txt.gz | ||
| 43 | |||
| 44 | |||
| 45 | # these not documented yet ... | ||
| 46 | use constant CLIENT_MAJOR_VERSION => 5; | ||
| 47 | use constant CLIENT_MINOR_VERSION => 0; | ||
| 48 | |||
| 49 | |||
| 50 | #------------------------------------------------------------------------------ | ||
| 51 | # symbolic constants | ||
| 52 | |||
| 53 | use constant constants_list => | ||
| 54 | (XFixesWindowRegionKind => ['Bounding', 'Clip'], | ||
| 55 | XFixesSaveSetMode => ['Insert', 'Delete'], | ||
| 56 | XFixesSaveSetTarget => ['Nearest', 'Root'], | ||
| 57 | XFixesSaveSetMap => ['Map', 'Unmap'], | ||
| 58 | |||
| 59 | XFixesSelectionNotifySubtype => [ 'SetSelectionOwner', | ||
| 60 | 'SelectionWindowDestroy', | ||
| 61 | 'SelectionClientClose' ], | ||
| 62 | XFixesCursorNotifySubtype => [ 'DisplayCursor' ], | ||
| 63 | |||
| 64 | # Not sure about these two ... | ||
| 65 | # XFixesSelectionEventMask => [ 'SetSelectionOwner', | ||
| 66 | # 'SelectionWindowDestroy', | ||
| 67 | # 'SelectionClientClose' ], | ||
| 68 | # XFixesCursorEventMask => [ 'DisplayCursor' ], | ||
| 69 | ); | ||
| 70 | |||
| 71 | sub _ext_constants_install { | ||
| 72 | my ($X, $constants_arrayref) = @_; | ||
| 73 | foreach (my $i = 0; $i <= $#$constants_arrayref; $i+=2) { | ||
| 74 | my $name = $constants_arrayref->[$i]; | ||
| 75 | my $aref = $constants_arrayref->[$i+1]; | ||
| 76 | $X->{'ext_const'}->{$name} = $aref; | ||
| 77 | $X->{'ext_const_num'}->{$name} = { X11::Protocol::make_num_hash($aref) }; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | #------------------------------------------------------------------------------ | ||
| 82 | # events | ||
| 83 | |||
| 84 | my $events_arrayref | ||
| 85 | = [ XFixesSelectionNotify => | ||
| 86 | [ 'xCxxL5', | ||
| 87 | ['subtype','XFixesSelectionNotifySubtype'], | ||
| 88 | 'window', | ||
| 89 | ['owner',['None']], # window | ||
| 90 | 'selection', # atom | ||
| 91 | 'time', | ||
| 92 | 'selection_time', | ||
| 93 | ], | ||
| 94 | |||
| 95 | XFixesCursorNotify => | ||
| 96 | [ sub { | ||
| 97 | my $X = shift; | ||
| 98 | my $data = shift; | ||
| 99 | ### XFixesCursorNotify unpack: @_ | ||
| 100 | my ($subtype, $window, $cursor_serial, $time, $cursor_name) | ||
| 101 | = unpack 'xCxxL4', $data; | ||
| 102 | return (@_, # base fields | ||
| 103 | subtype => $X->interp('XFixesCursorNotifySubtype',$subtype), | ||
| 104 | window => _interp_none($X,$window), # probably not None though | ||
| 105 | cursor_serial => $cursor_serial, | ||
| 106 | time => _interp_time($time), | ||
| 107 | # "name" field only in XFIXES 2.0 up, probably pad garbage | ||
| 108 | # in 1.0, so omit there. Give it as "cursor_name" since | ||
| 109 | # plain "name" is the event name. | ||
| 110 | ($X->{'ext'}->{'XFIXES'}->[3]->{'major'} >= 2 | ||
| 111 | ? (cursor_name => $cursor_name) | ||
| 112 | : ())); | ||
| 113 | }, | ||
| 114 | sub { | ||
| 115 | my ($X, %h) = @_; | ||
| 116 | # "cursor_name" can be omitted as for a 1.0 event | ||
| 117 | return (pack('xCxxL4x12', | ||
| 118 | $X->num('XFixesCursorNotifySubtype',$h{'subtype'}), | ||
| 119 | _num_none($h{'window'}), | ||
| 120 | $h{'cursor_serial'}, | ||
| 121 | _num_time($h{'time'}), | ||
| 122 | _num_none($h{'cursor_name'} || 0)), | ||
| 123 | 1); # "do_seq" put in sequence number | ||
| 124 | } ], | ||
| 125 | ]; | ||
| 126 | |||
| 127 | sub _ext_events_install { | ||
| 128 | my ($X, $event_num, $events_arrayref) = @_; | ||
| 129 | foreach (my $i = 0; $i <= $#$events_arrayref; $i+=2) { | ||
| 130 | my $name = $events_arrayref->[$i]; | ||
| 131 | if (defined (my $already = $X->{'ext_const'}->{'Events'}->[$event_num])) { | ||
| 132 | carp "Event $event_num $already overwritten with $name"; | ||
| 133 | } | ||
| 134 | $X->{'ext_const'}->{'Events'}->[$event_num] = $name; | ||
| 135 | $X->{'ext_events'}->[$event_num] = $events_arrayref->[$i+1]; # pack/unpack | ||
| 136 | $event_num++; | ||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | #------------------------------------------------------------------------------ | ||
| 141 | # requests | ||
| 142 | |||
| 143 | my $requests_arrayref = | ||
| 144 | [ | ||
| 145 | [ 'XFixesQueryVersion', # 0 | ||
| 146 | sub { | ||
| 147 | my ($X, $major, $minor) = @_; | ||
| 148 | ### XFixesQueryVersion request | ||
| 149 | return pack 'LL', $major, $minor; | ||
| 150 | }, | ||
| 151 | sub { | ||
| 152 | my ($X, $data) = @_; | ||
| 153 | ### XFixesQueryVersion reply: "$X" | ||
| 154 | my @ret = unpack 'x8SS', $data; | ||
| 155 | my $self; | ||
| 156 | if ($self = $X->{'ext'}->{'XFIXES'}->[3]) { | ||
| 157 | ($self->{'major'},$self->{'minor'}) = @ret; | ||
| 158 | } | ||
| 159 | return @ret; | ||
| 160 | }], | ||
| 161 | |||
| 162 | [ 'XFixesChangeSaveSet', # 1 | ||
| 163 | sub { | ||
| 164 | my ($X, $window, $mode, $target, $map) = @_; | ||
| 165 | return pack ('CCCxL', | ||
| 166 | $X->num('XFixesSaveSetMode',$mode), | ||
| 167 | $X->num('XFixesSaveSetTarget',$target), | ||
| 168 | $X->num('XFixesSaveSetMap',$map), | ||
| 169 | $window); | ||
| 170 | }], | ||
| 171 | |||
| 172 | [ 'XFixesSelectSelectionInput', # 2 | ||
| 173 | # ($X, $window, $selection, $event_mask) | ||
| 174 | # nothing special for $event_mask yet | ||
| 175 | \&_request_card32s ], | ||
| 176 | |||
| 177 | [ 'XFixesSelectCursorInput', # 3 | ||
| 178 | # ($X, $window, $event_mask) nothing special for $event_mask yet | ||
| 179 | \&_request_card32s ], | ||
| 180 | |||
| 181 | [ 'XFixesGetCursorImage', # 4 | ||
| 182 | \&_request_empty, | ||
| 183 | sub { | ||
| 184 | my ($X, $data) = @_; | ||
| 185 | # (rootx,rooty, width,height, xhot,yhot, serial, ... then pixels) | ||
| 186 | my @ret = unpack 'x8ssSSSSL', $data; | ||
| 187 | return (@ret, | ||
| 188 | substr ($data, 32, 4*$ret[2]*$ret[3])); # width*height | ||
| 189 | }], | ||
| 190 | |||
| 191 | #--------------------------------------------------------------------------- | ||
| 192 | # version 2.0 | ||
| 193 | |||
| 194 | [ 'XFixesCreateRegion', # 5 | ||
| 195 | \&_request_region_and_rectangles ], | ||
| 196 | |||
| 197 | [ 'XFixesCreateRegionFromBitmap', # 6 | ||
| 198 | \&_request_xids ], | ||
| 199 | |||
| 200 | [ 'XFixesCreateRegionFromWindow', # 7 | ||
| 201 | sub { | ||
| 202 | my ($X, $region, $window, $kind) = @_; | ||
| 203 | ### XFixesCreateRegionFromWindow: $region, $window, $kind | ||
| 204 | return pack ('LLCxxx', | ||
| 205 | $region, | ||
| 206 | $window, | ||
| 207 | $X->num('XFixesWindowRegionKind',$kind)); | ||
| 208 | }], | ||
| 209 | |||
| 210 | [ 'XFixesCreateRegionFromGC', # 8 | ||
| 211 | \&_request_xids ], | ||
| 212 | |||
| 213 | [ 'XFixesCreateRegionFromPicture', # 9 | ||
| 214 | \&_request_xids ], | ||
| 215 | |||
| 216 | [ 'XFixesDestroyRegion', # 10 | ||
| 217 | \&_request_xids ], | ||
| 218 | |||
| 219 | [ 'XFixesSetRegion', # 11 | ||
| 220 | \&_request_region_and_rectangles ], | ||
| 221 | |||
| 222 | [ 'XFixesCopyRegion', # 12 | ||
| 223 | \&_request_xids ], | ||
| 224 | |||
| 225 | [ 'XFixesUnionRegion', # 13 | ||
| 226 | \&_request_xids ], | ||
| 227 | [ 'XFixesIntersectRegion', # 14 | ||
| 228 | \&_request_xids ], | ||
| 229 | [ 'XFixesSubtractRegion', # 15 | ||
| 230 | \&_request_xids ], | ||
| 231 | |||
| 232 | [ 'XFixesInvertRegion', # 16 | ||
| 233 | sub { | ||
| 234 | my ($X, $src, $rect, $dst) = @_; | ||
| 235 | return pack 'LssSSL', $src, @$rect, $dst; | ||
| 236 | }], | ||
| 237 | |||
| 238 | [ 'XFixesTranslateRegion', # 17 | ||
| 239 | sub { | ||
| 240 | shift; # ($X, $region, $dx, $dy) | ||
| 241 | return pack 'Lss', @_; | ||
| 242 | }], | ||
| 243 | |||
| 244 | [ 'XFixesRegionExtents', # 18 | ||
| 245 | \&_request_card32s ], # ($X, $src, $dst) | ||
| 246 | |||
| 247 | [ 'XFixesFetchRegion', # 19 | ||
| 248 | \&_request_card32s, # ($X, $region) | ||
| 249 | sub { | ||
| 250 | my ($X, $data) = @_; | ||
| 251 | ### XFixesFetchRegion reply: length($data) | ||
| 252 | my @ret = ([ unpack 'x8ssSS', $data ]); # bounding | ||
| 253 | for (my $pos = 32; $pos < length($data); $pos+=8) { | ||
| 254 | push @ret, [ unpack 'ssSS', substr($data,$pos,8) ]; | ||
| 255 | } | ||
| 256 | return @ret; | ||
| 257 | }], | ||
| 258 | |||
| 259 | [ 'XFixesSetGCClipRegion', # 20 | ||
| 260 | \&_request_xid_xy_region], # ($gc, $x, $y, $region) | ||
| 261 | |||
| 262 | [ 'XFixesSetWindowShapeRegion', # 21 | ||
| 263 | sub { | ||
| 264 | my ($X, $window, $shape_kind, $x, $y, $region) = @_; | ||
| 265 | # use ShapeKind if SHAPE initialized, otherwise same Bounding and | ||
| 266 | # Clip from XFixesWindowRegionKind | ||
| 267 | my $kind_type = ($X->{'ext_const'}->{'ShapeKind'} | ||
| 268 | ? 'ShapeKind' : 'XFixesWindowRegionKind'); | ||
| 269 | return pack ('LCxxxssL', | ||
| 270 | $window, | ||
| 271 | $X->num($kind_type,$shape_kind), | ||
| 272 | $x,$y, | ||
| 273 | _num_none ($region)); | ||
| 274 | }], | ||
| 275 | |||
| 276 | [ 'XFixesSetPictureClipRegion', # 22 | ||
| 277 | \&_request_xid_xy_region ], # ($pict, $x, $y, $region) | ||
| 278 | |||
| 279 | [ 'XFixesSetCursorName', # 23 | ||
| 280 | sub { | ||
| 281 | my ($X, $cursor, $str) = @_; | ||
| 282 | ### XFixesSetCursorName request | ||
| 283 | ### $cursor | ||
| 284 | ### $str | ||
| 285 | return pack('LSxx'.padded($str), | ||
| 286 | $cursor, length($str), $str); | ||
| 287 | }], | ||
| 288 | |||
| 289 | [ 'XFixesGetCursorName', # 24 | ||
| 290 | \&_request_xids, | ||
| 291 | sub { | ||
| 292 | my ($X, $data) = @_; | ||
| 293 | ### XFixesGetCursorName reply | ||
| 294 | my ($atom, $len) = unpack 'x8LS', $data; | ||
| 295 | return (_interp_none($X,$atom), substr($data,32,$len)); | ||
| 296 | }], | ||
| 297 | |||
| 298 | [ 'XFixesGetCursorImageAndName', # 25 | ||
| 299 | \&_request_empty, | ||
| 300 | sub { | ||
| 301 | my ($X, $data) = @_; | ||
| 302 | # (x,y, w,h, xhot,yhot, serial, atom, $namelen, ... then pixels+name) | ||
| 303 | my @ret = unpack 'x8ssSSSSLLSxx', $data; | ||
| 304 | my $namelen = pop @ret; | ||
| 305 | my $atom = pop @ret; | ||
| 306 | my $pixelsize = 4 * $ret[2] * $ret[3]; | ||
| 307 | return (@ret, | ||
| 308 | substr ($data, 32, $pixelsize), # pixels | ||
| 309 | _interp_none($X,$atom), | ||
| 310 | substr ($data, 32 + $pixelsize, $namelen)); # name | ||
| 311 | }], | ||
| 312 | |||
| 313 | [ 'XFixesChangeCursor', # 26 | ||
| 314 | sub { | ||
| 315 | my ($X, $src, $dst) = @_; | ||
| 316 | return pack 'LL', $src, $dst; | ||
| 317 | }], | ||
| 318 | |||
| 319 | [ 'XFixesChangeCursorByName', # 27 | ||
| 320 | sub { | ||
| 321 | my ($X, $src, $str) = @_; | ||
| 322 | return pack ('LSxx'.padded($str), | ||
| 323 | $src, length($str), $str); | ||
| 324 | }], | ||
| 325 | |||
| 326 | |||
| 327 | #--------------------------------------------------------------------------- | ||
| 328 | # version 3.0 | ||
| 329 | |||
| 330 | [ 'XFixesExpandRegion', # 28 | ||
| 331 | sub { | ||
| 332 | shift; # $X | ||
| 333 | return pack 'LLSSSS', @_; # $src, $dst, $left,$right, $top,$bottom | ||
| 334 | }], | ||
| 335 | |||
| 336 | |||
| 337 | #--------------------------------------------------------------------------- | ||
| 338 | # version 4.0 | ||
| 339 | |||
| 340 | ['XFixesHideCursor', # 29 | ||
| 341 | \&_request_xids ], | ||
| 342 | ['XFixesShowCursor', # 30 | ||
| 343 | \&_request_xids ], | ||
| 344 | |||
| 345 | #--------------------------------------------------------------------------- | ||
| 346 | # version 5.0 | ||
| 347 | |||
| 348 | ['XFixesCreatePointerBarrier', # 31 | ||
| 349 | sub { | ||
| 350 | my ($X, $barrier, $drawable, $x1,$y1, $x2,$y2, $directions, | ||
| 351 | @devices) = @_; | ||
| 352 | my $devices = pack 'S*', map{_num_xinputdevice($_)} @devices; | ||
| 353 | ### @devices | ||
| 354 | ### $devices | ||
| 355 | ### format: 'LLssssLxxS'.padded($devices) | ||
| 356 | return pack ('LLssssLxxS'.padded($devices), | ||
| 357 | $barrier, # CARD32 | ||
| 358 | $drawable, # CARD32 | ||
| 359 | $x1,$y1, $x2,$y2, # INT16 x 4 | ||
| 360 | $directions, # CARD32 | ||
| 361 | scalar(@devices), # CARD16 num_devices | ||
| 362 | $devices); # packed CARD16s | ||
| 363 | }], | ||
| 364 | |||
| 365 | ['XFixesDestroyPointerBarrier', # 32 | ||
| 366 | \&_request_xids ], # ($X, $barrier) single barrier to destroy | ||
| 367 | ]; | ||
| 368 | |||
| 369 | sub _ext_requests_install { | ||
| 370 | my ($X, $request_num, $requests_arrayref) = @_; | ||
| 371 | |||
| 372 | $X->{'ext_request'}->{$request_num} = $requests_arrayref; | ||
| 373 | my $href = $X->{'ext_request_num'}; | ||
| 374 | my $i; | ||
| 375 | foreach $i (0 .. $#$requests_arrayref) { | ||
| 376 | $href->{$requests_arrayref->[$i]->[0]} = [$request_num, $i]; | ||
| 377 | } | ||
| 378 | } | ||
| 379 | |||
| 380 | #------------------------------------------------------------------------------ | ||
| 381 | |||
| 382 | sub new { | ||
| 383 | my ($class, $X, $request_num, $event_num, $error_num) = @_; | ||
| 384 | ### XFIXES new() | ||
| 385 | |||
| 386 | my $self = bless { }, $class; | ||
| 387 | _ext_constants_install ($X, [ $self->constants_list ]); | ||
| 388 | _ext_requests_install ($X, $request_num, $requests_arrayref); | ||
| 389 | _ext_events_install ($X, $event_num, $events_arrayref); | ||
| 390 | |||
| 391 | # the protocol spec says must query version with what we support | ||
| 392 | # need it to know which error types are defined too, as otherwise oughtn't | ||
| 393 | # touch anything at $event_num | ||
| 394 | my ($server_major, $server_minor) | ||
| 395 | = $X->req ('XFixesQueryVersion', | ||
| 396 | CLIENT_MAJOR_VERSION, CLIENT_MINOR_VERSION); | ||
| 397 | $self->{'major'} = $server_major; | ||
| 398 | $self->{'minor'} = $server_minor; | ||
| 399 | |||
| 400 | # Errors | ||
| 401 | _ext_error_install ($X, $error_num, | ||
| 402 | # version 2.0 | ||
| 403 | ($server_major >= 2 ? ('Region') : ()), | ||
| 404 | # version 5.0 | ||
| 405 | ($server_major >= 5 ? ('Barrier') : ())); | ||
| 406 | |||
| 407 | return $self; | ||
| 408 | } | ||
| 409 | |||
| 410 | sub _request_empty { | ||
| 411 | if (@_ > 1) { | ||
| 412 | croak "No parameters in this request"; | ||
| 413 | } | ||
| 414 | return ''; | ||
| 415 | } | ||
| 416 | |||
| 417 | sub _request_xids { | ||
| 418 | my $X = shift; | ||
| 419 | ### _request_xids(): @_ | ||
| 420 | return _request_card32s ($X, map {_num_none($_)} @_); | ||
| 421 | } | ||
| 422 | sub _request_card32s { | ||
| 423 | shift; | ||
| 424 | ### _request_card32s(): @_ | ||
| 425 | return pack 'L*', @_; | ||
| 426 | } | ||
| 427 | |||
| 428 | sub _request_xid_xy_region { | ||
| 429 | my ($X, $xid, $x, $y, $region) = @_; | ||
| 430 | return pack ('LLss', $xid, _num_none($region), $x,$y); | ||
| 431 | } | ||
| 432 | |||
| 433 | sub _request_region_and_rectangles { | ||
| 434 | shift; # $X | ||
| 435 | ### _request_region_and_rectangles: @_ | ||
| 436 | my $region = shift; | ||
| 437 | ### ret: pack('L',$region) . _pack_rectangles(@_) | ||
| 438 | return pack('L',$region) . _pack_rectangles(@_); | ||
| 439 | } | ||
| 440 | sub _pack_rectangles { | ||
| 441 | return join ('', map {pack 'ssSS', @$_} @_); | ||
| 442 | } | ||
| 443 | |||
| 444 | sub _num_none { | ||
| 445 | my ($xid) = @_; | ||
| 446 | if (defined $xid && $xid eq 'None') { | ||
| 447 | return 0; | ||
| 448 | } else { | ||
| 449 | return $xid; | ||
| 450 | } | ||
| 451 | } | ||
| 452 | sub _interp_none { | ||
| 453 | my ($X, $xid) = @_; | ||
| 454 | if ($X->{'do_interp'} && $xid == 0) { | ||
| 455 | return 'None'; | ||
| 456 | } else { | ||
| 457 | return $xid; | ||
| 458 | } | ||
| 459 | } | ||
| 460 | |||
| 461 | sub _interp_time { | ||
| 462 | my ($time) = @_; | ||
| 463 | if ($time == 0) { | ||
| 464 | return 'CurrentTime'; | ||
| 465 | } else { | ||
| 466 | return $time; | ||
| 467 | } | ||
| 468 | } | ||
| 469 | sub _num_time { | ||
| 470 | my ($time) = @_; | ||
| 471 | if ($time eq 'CurrentTime') { | ||
| 472 | return 0; | ||
| 473 | } else { | ||
| 474 | return $time; | ||
| 475 | } | ||
| 476 | } | ||
| 477 | |||
| 478 | |||
| 479 | sub _num_xinputdevice { | ||
| 480 | my ($device) = @_; | ||
| 481 | if ($device eq 'AllDevices') { return 0; } | ||
| 482 | if ($device eq 'AllMasterDevices') { return 1; } | ||
| 483 | return $device; | ||
| 484 | } | ||
| 485 | |||
| 486 | sub _ext_error_install { | ||
| 487 | my $X = shift; # ($X, $errname1,$errname2,...) | ||
| 488 | ### _ext_error_install: @_ | ||
| 489 | my $error_num = shift; | ||
| 490 | my $aref = $X->{'ext_const'}{'Error'} # copy | ||
| 491 | = [ @{$X->{'ext_const'}{'Error'} || []} ]; | ||
| 492 | my $href = $X->{'ext_const_num'}{'Error'} # copy | ||
| 493 | = { %{$X->{'ext_const_num'}{'Error'} || {}} }; | ||
| 494 | my $i; | ||
| 495 | foreach $i (0 .. $#_) { | ||
| 496 | $aref->[$error_num + $i] = $_[$i]; | ||
| 497 | $href->{$_[$i]} = $error_num + $i; | ||
| 498 | } | ||
| 499 | } | ||
| 500 | |||
| 501 | 1; | ||
| 502 | __END__ |