| 1 | # /=====================================================================\ # | ||||||||||||||||||||||||||||||||||
| 2 | # | LaTeXML::Core::Definition::Register | # | ||||||||||||||||||||||||||||||||||
| 3 | # | Representation of definitions of Control Sequences | # | ||||||||||||||||||||||||||||||||||
| 4 | # |=====================================================================| # | ||||||||||||||||||||||||||||||||||
| 5 | # | Part of LaTeXML: | # | ||||||||||||||||||||||||||||||||||
| 6 | # | Public domain software, produced as part of work done by the | # | ||||||||||||||||||||||||||||||||||
| 7 | # | United States Government & not subject to copyright in the US. | # | ||||||||||||||||||||||||||||||||||
| 8 | # |---------------------------------------------------------------------| # | ||||||||||||||||||||||||||||||||||
| 9 | # | Bruce Miller <bruce.miller@nist.gov> #_# | # | ||||||||||||||||||||||||||||||||||
| 10 | # | http://dlmf.nist.gov/LaTeXML/ (o o) | # | ||||||||||||||||||||||||||||||||||
| 11 | # \=========================================================ooo==U==ooo=/ # | ||||||||||||||||||||||||||||||||||
| 12 | package LaTeXML::Core::Definition::Register; | ||||||||||||||||||||||||||||||||||
| 13 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 14 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | use LaTeXML::Global; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 16 | 4 | ▶ | use base qw(LaTeXML::Core::Definition::Primitive); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||
| 18 | # Known Traits: | ||||||||||||||||||||||||||||||||||
| 19 | # registerType : the type of register (a LaTeXML class) | ||||||||||||||||||||||||||||||||||
| 20 | # getter : a sub to get the value (essentially required) | ||||||||||||||||||||||||||||||||||
| 21 | # setter : a sub to set the value (estentially required) | ||||||||||||||||||||||||||||||||||
| 22 | # beforeDigest, afterDigest : code for before/after digestion daemons | ||||||||||||||||||||||||||||||||||
| 23 | # readonly : whether this register can only be read | ||||||||||||||||||||||||||||||||||
| 24 | sub new { | ||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my ($class, $cs, $parameters, %traits) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 26 | 0 | return bless { cs => $cs, parameters => $parameters, | |||||||||||||||||||||||||||||||||
| 27 | locator => $STATE->getStomach->getGullet->getLocator, | ||||||||||||||||||||||||||||||||||
| 28 | %traits }, $class; } | ||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||
| 30 | sub isPrefix { | ||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | return 0; } | ||||||||||||||||||||||||||||||||
|
Subroutine
isPrefix: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||
| 33 | sub isRegister { | ||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
isRegister: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 35 | 0 | return $$self{registerType}; } | |||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | sub isReadonly { | ||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
isReadonly: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 39 | 0 | return $$self{readonly}; } | |||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||
| 41 | sub valueOf { | ||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
valueOf: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 43 | 0 | return &{ $$self{getter} }(@args); } | |||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||
| 45 | sub setValue { | ||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | my ($self, $value, @args) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
setValue: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 47 | 0 | &{ $$self{setter} }($value, @args); | |||||||||||||||||||||||||||||||||
| 48 | 0 | return; } | |||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||
| 50 | sub addValue { | ||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my ($self, $value, @args) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
addValue: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 52 | 0 | my $oldvalue = &{ $$self{getter} }(@args); | |||||||||||||||||||||||||||||||||
| 53 | 0 | &{ $$self{setter} }($oldvalue->add($value), @args); | |||||||||||||||||||||||||||||||||
| 54 | 0 | return; } | |||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||
| 56 | # No before/after daemons ??? | ||||||||||||||||||||||||||||||||||
| 57 | # (other than afterassign) | ||||||||||||||||||||||||||||||||||
| 58 | sub invoke { | ||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my ($self, $stomach) = @_; | ||||||||||||||||||||||||||||||||
|
Subroutine
invoke: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | my $profiled = $STATE->lookupValue('PROFILING') && ($LaTeXML::CURRENT_TOKEN || $$self{cs}); | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
$LaTeXML::Core::Definition::Register::STATE->lookupValue('PROFILING') && ($LaTeXML::CURRENT_TOKEN || $self->{'cs'})
$LaTeXML::CURRENT_TOKEN or $self->{"cs"}
MC/DC0%0/3
$LaTeXML::Core::Definition::Register::STATE->lookupValue('PROFILING') && ($LaTeXML::CURRENT_TOKEN || $self->{'cs'})
$LaTeXML::Core::Definition::Register::STATE->lookupValue('PROFILING')
$LaTeXML::CURRENT_TOKEN
$self->{"cs"}
Truth table0%0/4
A && B or C
A= $LaTeXML::Core::Definition::Register::STATE->lookupValue('PROFILING')B= $LaTeXML::CURRENT_TOKENC= $self->{"cs"}
| |||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | LaTeXML::Core::Definition::startProfiling($profiled, 'digest') if $profiled; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||
| 63 | 0 | my $gullet = $stomach->getGullet; | |||||||||||||||||||||||||||||||||
| 64 | 0 | my @args = $self->readArguments($gullet); | |||||||||||||||||||||||||||||||||
| 65 | 0 | $gullet->readKeyword('='); # Ignore | |||||||||||||||||||||||||||||||||
| 66 | 0 | my $value = $gullet->readValue($self->isRegister); | |||||||||||||||||||||||||||||||||
| 67 | 0 | $self->setValue($value, @args); | |||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||
| 69 | # Tracing ? | ||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if (my $after = $STATE->lookupValue('afterAssignment')) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 71 | 0 | $STATE->assignValue(afterAssignment => undef, 'global'); | |||||||||||||||||||||||||||||||||
| 72 | 0 | $gullet->unread($after); } # primitive returns boxes, so these need to be digested! | |||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | LaTeXML::Core::Definition::stopProfiling($profiled, 'digest') if $profiled; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 74 | 0 | return; } | |||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||
| 76 | #=============================================================================== | ||||||||||||||||||||||||||||||||||
| 77 | 4 | 1; | |||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||
| 79 | __END__ | ||||||||||||||||||||||||||||||||||