## org.extex.unit.tex.register.box Class Setbox

java.lang.Object
org.extex.interpreter.type.AbstractCode
org.extex.interpreter.type.AbstractAssignment
org.extex.unit.tex.register.box.Setbox

All Implemented Interfaces:
java.io.Serializable, Code

public class Setboxextends AbstractAssignment

This class provides an implementation for the primitive \setbox.

### The Primitive \setbox

The primitive \setbox takes a key for a box register and assigns the following box to this register.

TODO missing documentation

The primitive is an assignment. This means that it respects \globaldefs. The treatment of \afterassignment is special The token stored for after assignment are inserted just after the box as been opened.

#### Syntax

The formal description of this primitive is the following:
    ⟨setbox⟩
→ ⟨optional prefix⟩ \setbox ⟨box register name⟩ ⟨box⟩

⟨optional prefix⟩
→
|  \global ⟨optional prefix⟩  

#### Examples

    \setbox0\hbox{abc}

Version:
$Revision:4431$
Author:
Gerd Neugebauer
Serialized Form

Field Summary
protected static long serialVersionUID
The constant serialVersionUID contains the id for serialization.

Constructor Summary
Setbox(CodeToken token)
Creates a new object.

Method Summary
 void assign(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
The method assign is the core of the functionality of execute().
static java.lang.String getKey(Context context, TokenSource source, Typesetter typesetter, CodeToken primitive)
Return the key (the number) for the box register.

Methods inherited from class org.extex.interpreter.type.AbstractAssignment
execute

Methods inherited from class org.extex.interpreter.type.AbstractCode
getLocalizer, getName, getToken, isIf, isOuter, readResolve, toString, toText, toText

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

### serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

Constant Field Values
Constructor Detail

### Setbox

public Setbox(CodeToken token)
Creates a new object.

Parameters:
token - the initial token for the primitive
Method Detail

### getKey

public static java.lang.String getKey(Context context,
TokenSource source,
Typesetter typesetter,
CodeToken primitive)
throws HelpingException,
TypesetterException
Return the key (the number) for the box register.

### A Box Register Name

A box register name determines under which key a box register can be addressed. In TeX this used to be a positive number only. This has been extended to allow also a token list in braces.

The alternative is controlled by the count register \register.max. The following interpretation of the value of this count is used:

• If the value of this count register is negative then a arbitrary non-negative number is allowed as register name as well as any list of tokens enclosed in braces.
• If the value of this count register is not-negative then a only a non-negative number is allowed as register name which does not exceed the value of the count register.

The value of the count register \register.max is set differently for various configurations of ExTeX:

• TeX uses the value 255.
• eTeX uses the value 32767.
• Omega uses the value 65536.
• ExTeX uses the value -1.

Note that the register name \register.max contains a period. Thus it can normally not be entered easily since the catcode of the period is OTHER but needs to be LETTER. Thus you have to use a temporarily reassigned category code (see \catcode) or use \csname.

#### Syntax

   ⟨box register name⟩
→ ⟨tokens⟩
| ⟨number⟩  

#### Examples

  123
{abc}


Parameters:
context - the interpreter context to use
source - the source for new tokens
typesetter - the typesetter
primitive - the name of the primitive for error messages
Returns:
the key for the box register
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter

### assign

public void assign(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
throws HelpingException,
TypesetterException
The method assign is the core of the functionality of execute(). This method is preferable to execute() since the execute() method provided in this class takes care of \afterassignment and \globaldefs as well.

Specified by:
assign in class AbstractAssignment
Parameters:
prefix - the prefix controlling the execution
context - the interpreter context
source - the token source
typesetter - the typesetter
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
AbstractAssignment.assign( org.extex.interpreter.Flags, org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)