… | |
… | |
406 | |
406 | |
407 | BEGIN { *async = \&Coro::async_pool } |
407 | BEGIN { *async = \&Coro::async_pool } |
408 | |
408 | |
409 | =item cf::sync_job { BLOCK } |
409 | =item cf::sync_job { BLOCK } |
410 | |
410 | |
411 | The design of Crossfire TRT requires that the main coroutine ($Coro::main) |
411 | The design of Deliantra requires that the main coroutine ($Coro::main) |
412 | is always able to handle events or runnable, as Crossfire TRT is only |
412 | is always able to handle events or runnable, as Deliantra is only |
413 | partly reentrant. Thus "blocking" it by e.g. waiting for I/O is not |
413 | partly reentrant. Thus "blocking" it by e.g. waiting for I/O is not |
414 | acceptable. |
414 | acceptable. |
415 | |
415 | |
416 | If it must be done, put the blocking parts into C<sync_job>. This will run |
416 | If it must be done, put the blocking parts into C<sync_job>. This will run |
417 | the given BLOCK in another coroutine while waiting for the result. The |
417 | the given BLOCK in another coroutine while waiting for the result. The |
… | |
… | |
662 | attach callbacks/event handlers (a collection of which is called an "attachment") |
662 | attach callbacks/event handlers (a collection of which is called an "attachment") |
663 | to it. All such attachable objects support the following methods. |
663 | to it. All such attachable objects support the following methods. |
664 | |
664 | |
665 | In the following description, CLASS can be any of C<global>, C<object> |
665 | In the following description, CLASS can be any of C<global>, C<object> |
666 | C<player>, C<client> or C<map> (i.e. the attachable objects in |
666 | C<player>, C<client> or C<map> (i.e. the attachable objects in |
667 | Crossfire TRT). |
667 | Deliantra). |
668 | |
668 | |
669 | =over 4 |
669 | =over 4 |
670 | |
670 | |
671 | =item $attachable->attach ($attachment, key => $value...) |
671 | =item $attachable->attach ($attachment, key => $value...) |
672 | |
672 | |
… | |
… | |
1548 | |
1548 | |
1549 | Expand crossfire pod fragments into protocol xml. |
1549 | Expand crossfire pod fragments into protocol xml. |
1550 | |
1550 | |
1551 | =cut |
1551 | =cut |
1552 | |
1552 | |
1553 | use re 'eval'; |
1553 | use re 'eval'; |
1554 | |
1554 | |
1555 | my $group; |
1555 | my $group; |
1556 | my $interior; $interior = qr{ |
1556 | my $interior; $interior = qr{ |
|
|
1557 | # match a pod interior sequence sans C<< >> |
1557 | (?: |
1558 | (?: |
1558 | \ (.*?)\ (?{ $group = $^N }) |
1559 | \ (.*?)\ (?{ $group = $^N }) |
1559 | | < (??{$interior}) > |
1560 | | < (??{$interior}) > |
1560 | ) |
1561 | ) |
1561 | }x; |
1562 | }x; |
… | |
… | |
1564 | my ($self, $pod) = @_; |
1565 | my ($self, $pod) = @_; |
1565 | |
1566 | |
1566 | my $xml; |
1567 | my $xml; |
1567 | |
1568 | |
1568 | while () { |
1569 | while () { |
1569 | if ($pod =~ /\G( (?: [^BCGHITU]+ | .(?=[^<]) )+ )/xgcs) { |
1570 | if ($pod =~ /\G( (?: [^BCGHITU]+ | .(?!<) )+ )/xgcs) { |
1570 | $group = $1; |
1571 | $group = $1; |
1571 | |
1572 | |
1572 | $group =~ s/&/&/g; |
1573 | $group =~ s/&/&/g; |
1573 | $group =~ s/</</g; |
1574 | $group =~ s/</</g; |
1574 | |
1575 | |
… | |
… | |
1626 | s/\n+$//; # ending lines |
1627 | s/\n+$//; # ending lines |
1627 | } |
1628 | } |
1628 | |
1629 | |
1629 | $xml |
1630 | $xml |
1630 | } |
1631 | } |
|
|
1632 | |
|
|
1633 | no re 'eval'; |
1631 | |
1634 | |
1632 | sub hintmode { |
1635 | sub hintmode { |
1633 | $_[0]{hintmode} = $_[1] if @_ > 1; |
1636 | $_[0]{hintmode} = $_[1] if @_ > 1; |
1634 | $_[0]{hintmode} |
1637 | $_[0]{hintmode} |
1635 | } |
1638 | } |