boxworks_texlang/
knuthplass.rs1use boxworks_knuthplass as bwk;
2use texlang as txl;
3
4pub struct Component {
5 params: bwk::Params,
6 _tracing_paragraphs: i32,
7}
8
9impl Component {
10 pub fn invoke_line_breaker(&mut self) {
11 }
13}
14
15macro_rules! params_variables {
16 (
17 $( (
18 $tex_name: ident,
19 $getter_name: ident,
20 $field: ident,
21 $kind: ty,
22 ), )+
23 ) => {
24 $(
25 #[doc=concat!(
26 "Get the `\\", stringify!($tex_name), "` command.\n\n",
27 "This is a command for a singleton variable of type [`",
28 stringify!($kind),"`]. ",
29 "It requires that the state contain the component [`Component`].",
30 )]
31 pub fn $getter_name<S: txl::vm::HasComponent<Component>>() -> txl::command::BuiltIn<S> {
32 txl::variable::Command::new_singleton(
33 |state: &S, _: txl::variable::Index| -> & $kind { &state.component().params.$field },
34 |state: &mut S, _: txl::variable::Index| -> &mut $kind {
35 &mut state.component_mut().params.$field
36 },
37 )
38 .into()
39 }
40 )+
41 };
42}
43
44params_variables!(
45 (adjdemerits, get_adjdemerits, adj_demerits, i32,),
46 (
47 doublehyphendemerits,
48 get_doublehyphendemerits,
49 double_hyphen_demerits,
50 i32,
51 ),
52 (exhyphenpenalty, get_exhyphenpenalty, ex_hyphen_penalty, i32,),
53 (
54 finalhyphendemerits,
55 get_finalhyphendemerits,
56 final_hyphen_demerits,
57 i32,
58 ),
59 (hyphenpenalty, get_hyphenpenalty, hyphen_penalty, i32,),
60 (leftskip, get_leftskip, left_skip, common::Glue,),
61 (linepenalty, get_linepenalty, line_penalty, i32,),
62 (looseness, get_looseness, looseness, i32,),
63 (parfillskip, get_parfillskip, par_fill_skip, common::Glue,),
64 (pretolerance, get_pretolerance, pre_tolerance, i32,),
65 (rightskip, get_rightskip, right_skip, common::Glue,),
66 (tolerance, get_tolerance, tolerance, i32,),
67);