
% signal=squid

%D \module
%D   [       file=s-squid.mkxl,
%D        version2025.05.20,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Squid Colors and Graphics,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\startmodule[squid]

\pushoverloadmode

\logo [PHILIPS]       {Philips}
\logo [PHOSCOM]       {Phoscom}
\logo [HUE]           {hue}
\logo [DECONZ]        {deconz}
\logo [CONBEE]        {ConBee}
\logo [EVOHOME]       {EvoHome}
\logo [WIFI]          {WiFi}
\logo [SQUID]         {Squid}
\logo [QRCODE]        {QR\nbsp code}
\logo [RASPBERRYPICO] {RPI Pico}
\logo [ARDUINO]       {Arduino}

\popoverloadmode

\definepalet
  [squid]
  [reset=black,
   busy=blue,
   done=yellow,
   finished=green,
%  problem=magenta,
   problem=orange,
   error=red,
   red=red,
   green=green,
   blue=blue,
   cyan=cyan,
   magenta=magenta,
   yellow=yellow,
   white=white]

\startMPdefinitions

vardef signal_led(expr n) =
    (0,100) rotated - ((n - 1) * (360/24))
enddef ;

vardef signal_inner_led(expr n) =
    (0,75) rotated - ((n - 1) * (360/8))
enddef ;

vardef signal_segment(expr n) =
    for i = (n - 1) * 3 + 1 upto n * 3 :
        signal_led(i) &&
    endfor nocycle
enddef ;

vardef signal_segments(expr n) =
    for i = 1 upto (n - 1) * 3 + 3 :
        signal_led(i) &&
    endfor nocycle
enddef ;

vardef signal_quadrant(expr n) =
    for i = (n - 1) * 6 + 1 upto n  * 6 :
        signal_led(i) &&
    endfor nocycle
enddef ;

vardef signal_quadrants(expr n) =
    for i = 1 upto n  * 6 :
        signal_led(i) &&
    endfor nocycle
enddef ;

vardef signal_leds =
    for i = 1 upto 24 :
        signal_led(i) &&
    endfor nocycle
enddef ;

vardef signal_inner_leds =
    for i = 1 upto 8 :
        signal_inner_led(i) &&
    endfor nocycle
enddef ;


vardef signal_range(expr n) =
    for i = 1 upto n :
        signal_led(i) &&
    endfor nocycle
enddef ;

def signal_all_leds =
    drawdot signal_leds withpen pencircle scaled 20 withcolor .5white ;
enddef ;

def signal_all_inner_leds =
    drawdot signal_inner_leds withpen pencircle scaled 20 withcolor .5white ;
enddef ;


def signal_more_leds(expr n, c) =
    drawdot signal_range(n) withpen pencircle scaled 20 withcolor c ;
enddef ;

def signal_one_segment(expr n, c) =
    drawdot signal_segment(n) withpen pencircle scaled 20 withcolor c ;
enddef ;

def signal_more_segments(expr n, c) =
    drawdot signal_segments(n) withpen pencircle scaled 20 withcolor c ;
enddef ;

def signal_one_quadrant(expr n, c) =
    drawdot signal_quadrant(n) withpen pencircle scaled 20 withcolor c ;
enddef ;

def signal_more_quadrants(expr n, c) =
    drawdot signal_quadrants(n) withpen pencircle scaled 20 withcolor c ;
enddef ;

def signal_one_led(expr n, c) =
    drawdot signal_led(n) withpen pencircle scaled 20 withcolor c ;
enddef ;

def signal_one_thread(expr n, m, c) =
    drawdot signal_led((n-1)*3+m) withpen pencircle scaled 20 withcolor c ;
enddef ;

def signal_set_bounds =
    setbounds currentpicture to fullsquare scaled 200;
enddef ;
\stopMPdefinitions

\startuniqueMPgraphic{signalled}{color}
    draw image (
        drawdot signal_led(1)
    )
        ysized (.6LineHeight)
        withcolor \MPvar{color}
    ;
\stopuniqueMPgraphic

\protected\def\SignalLed#1%
 {\hpack ymove -.3sd {\uniqueMPgraphic{signalled}{color=#1}}}

\protected\def\SignalBusy    {\SignalLed{squid:busy}}
\protected\def\SignalDone    {\SignalLed{squid:done}}
\protected\def\SignalFinished{\SignalLed{squid:finished}}
\protected\def\SignalProblem {\SignalLed{squid:problem}}
\protected\def\SignalError   {\SignalLed{squid:error}}

\startbuffer[squid-001]
\startcombination [nx=4,ny=1]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(1, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 1
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(1, "squid:done");
                signal_one_segment(2, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 2
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(2, "squid:done");
                signal_one_segment(3, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 3
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(3, "squid:finished");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        okay
    \stopcaption
\stopcombination
\stopbuffer

\startbuffer[squid-002]
\startcombination [nx=1,ny=1]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(1, "squid:error");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        error
    \stopcaption
\stopcombination
\stopbuffer

\startbuffer[squid-003]
\startcombination [nx=5,ny=2]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(1, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 1
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(1, "squid:done");
                signal_one_segment(2, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 2
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(2, "squid:done");
                signal_one_segment(3, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 3
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(3, "squid:done");
                signal_one_segment(4, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 4
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(4, "squid:done");
                signal_one_segment(5, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 5
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(5, "squid:done");
                signal_one_segment(6, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 6
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(6, "squid:done");
                signal_one_segment(7, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 7
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
              % signal_all_leds;
                signal_more_segments(7, "squid:done");
                signal_one_segment(8, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 8
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
              % signal_all_leds;
                signal_more_segments(7, "squid:done");
                signal_one_segment(8, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 9
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
              % signal_all_leds;
                signal_more_segments(8, "squid:problem");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        problem
    \stopcaption
\stopcombination
\stopbuffer

\startbuffer[squid-004]
\startcombination [nx=5,ny=1]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(1, "squid:done");
                signal_one_thread(1, 1, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        thread 1
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(2, "squid:done");
                signal_one_thread(2, 2, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        thread 2
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(3, "squid:done");
                signal_one_thread(3, 1, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        thread 3
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(4, "squid:done");
                signal_one_thread(4, 3, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        thread 4
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_segment(5, "squid:done");
                signal_one_thread(5, 3, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        thread 5
    \stopcaption
\stopcombination
\stopbuffer

\startbuffer[squid-005]
\startcombination [nx=5,ny=1]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_segments(5, "squid:done");
                signal_one_thread(1, 1, "squid:busy");
                signal_one_thread(2, 2, "squid:busy");
                signal_one_thread(3, 1, "squid:busy");
                signal_one_thread(4, 3, "squid:busy");
                signal_one_thread(5, 3, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        5 threads
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
%                 signal_all_leds;
                signal_more_segments(8, "squid:done");
                signal_one_thread(1, 1, "squid:busy");
                signal_one_thread(2, 2, "squid:busy");
                signal_one_thread(3, 1, "squid:busy");
                signal_one_thread(4, 3, "squid:busy");
                signal_one_thread(5, 3, "squid:busy");
                signal_one_thread(6, 1, "squid:busy");
                signal_one_thread(7, 2, "squid:busy");
                signal_one_thread(8, 2, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        8 threads
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
%                 signal_all_leds;
                signal_more_segments(8, red);
                signal_one_thread(1, 1, "squid:busy");
                signal_one_thread(2, 2, "squid:busy");
                signal_one_thread(3, 1, "squid:busy");
                signal_one_thread(4, 3, "squid:busy");
                signal_one_thread(5, 3, "squid:busy");
                signal_one_thread(6, 1, "squid:busy");
                signal_one_thread(7, 2, "squid:busy");
                signal_one_thread(8, 2, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        issues
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
%                 signal_all_leds;
                signal_more_segments(8, "squid:finished");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        okay
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
%                 signal_all_leds;
                signal_more_segments(8, "squid:error");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        errors
    \stopcaption
\stopcombination
\stopbuffer

\startbuffer[squid-006]
\startcombination [nx=5,ny=1]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_leds(6, "squid:done");
                signal_one_led(7, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        page 7
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_leds(16, "squid:done");
                signal_one_led(17, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        page 17
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
%                 signal_all_leds;
                signal_more_leds(24, "squid:done");
                signal_one_led(13, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        page 37
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
%                 signal_all_leds;
                signal_more_leds(24, "squid:finished");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        okay
    \stopcaption
\stopcombination
\stopbuffer

\startbuffer[squid-007]
\startcombination [nx=5,ny=1]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_quadrant(1, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 1
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_quadrant(1, "squid:done");
                signal_one_quadrant(2, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 2
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_quadrants(2, "squid:done");
                signal_one_quadrant(3, "squid:busy");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        run 3
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_quadrants(3, "squid:finished");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        okay
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_more_quadrants(3, "squid:error");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        error
    \stopcaption
\stopcombination
\stopbuffer

\startbuffer[squid-008]
\startcombination [nx=1,ny=1]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        leds
    \stopcaption
\stopcombination
\stopbuffer

\startbuffer[squid-013]
\startcombination [nx=5,ny=2,style=\ttxx]
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(1, "squid:green");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        palette
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(3, "squid:green");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        preroll
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(5, "squid:green");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        dimming
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(7, "squid:green");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        defaults
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(9, "squid:green");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        logo
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(11, "squid:magenta");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        accesspoint
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(13, "squid:magenta");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        address
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(15, "squid:blue");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        save
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(17, "squid:green");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        restart
    \stopcaption
    \startcontent
        \startMPcode
            draw image (
                signal_all_leds;
                signal_one_led(19, "squid:red");
            ) ysized 20mm ;
        \stopMPcode
    \stopcontent
    \startcaption
        exit
    \stopcaption
\stopcombination
\stopbuffer

\startMPdefinitions
    def signal_just_text(expr s) =
        for i=1 upto 24 :
            if (substring(i-1,i) of s) == "+" :
                signal_one_led(i,"squid:busy");
            elseif (substring(i-1,i) of s) == "!" :
                signal_one_led(i,"squid:problem");
            fi ;
        endfor ;
    enddef ;

    def signal_text(expr s) =
        signal_all_leds ;
        signal_just_text(s) ;
    enddef ;

    string signal_characters[];

    signal_characters[ASCII "A"] := "++++++!!++-----++!!+++++" ;
    signal_characters[ASCII "B"] := "+-----!!+++++++++!!+++++" ;
    signal_characters[ASCII "C"] := "+++------+++++++++++++++" ;
    signal_characters[ASCII "D"] := "++++++!!+++++++++!!-----" ;
    signal_characters[ASCII "E"] := "++++++!!---++++++!!+++++" ;
    signal_characters[ASCII "F"] := "++++--!!---++++++!!+++++" ;
    signal_characters[ASCII "G"] := "+++---!!+++++++++!!+++++" ;
    signal_characters[ASCII "H"] := "--++++!!+++---+++!!++++-" ;
    signal_characters[ASCII "I"] := "++--+++++++++++---------" ;
    signal_characters[ASCII "J"] := "+++++++++++++++---------" ;
    signal_characters[ASCII "K"] := "--!!-----!!--++++!!+++++" ;
    signal_characters[ASCII "L"] := "+--------+++++++++++++++" ;
%   signal_characters[ASCII "L"] := "--------++++++++++++++++" ;
    signal_characters[ASCII "M"] := "-!!+++++++-!!!-+++++++!!" ;
    signal_characters[ASCII "N"] := "++++++++++-----+++++++++" ;
    signal_characters[ASCII "O"] := "++++++++++++++++++++++++" ;
    signal_characters[ASCII "P"] := "++++++!!----+++++!!+++++" ;
    signal_characters[ASCII "Q"] := "++++++++!!++++++++++++++" ;
    signal_characters[ASCII "R"] := "++++++!!--!!+++++!!+++++" ;
    signal_characters[ASCII "S"] := "++++--!!+++++++--!!+++++" ;
    signal_characters[ASCII "T"] := "!!+++------!!!------+++!" ;
    signal_characters[ASCII "U"] := "---+++++++++++++++++++--" ;
    signal_characters[ASCII "V"] := "---!!+++++++++++++++!!--" ;
    signal_characters[ASCII "W"] := "---!!++++++!!!++++++!!--" ;
    signal_characters[ASCII "X"] := "-+++-----+++--+++----+++" ;
    signal_characters[ASCII "Y"] := "---+++-----+++-----+++--" ;
    signal_characters[ASCII "Z"] := "++++++!!--+++++++!!--+++" ;

    signal_characters[ASCII "0"] := "------------------------" ;
    signal_characters[ASCII "1"] := "+-----------+-----------" ;
    signal_characters[ASCII "2"] := "-+---------+-+---------+" ;
    signal_characters[ASCII "3"] := "++---------+++---------+" ;
    signal_characters[ASCII "4"] := "-++-------++-++-------++" ;
    signal_characters[ASCII "5"] := "+++-------+++++-------++" ;
    signal_characters[ASCII "6"] := "-+++-----+++-+++-----+++" ;
    signal_characters[ASCII "7"] := "++++-----+++++++-----+++" ;
    signal_characters[ASCII "8"] := "-++++---++++-++++---++++" ;
    signal_characters[ASCII "9"] := "+++++---+++++++++---++++" ;

    vardef signal_character(expr c) =
        image ( signal_text(signal_characters[if string c : ASCII c else : c fi]) )
    enddef ;

    string signal_digits_one[];
    string signal_digits_two[];

    signal_digits_one[0] := "------------------------" ;
    signal_digits_one[1] := "+-----------------------" ;
    signal_digits_one[2] := "-+---------------------+" ;
    signal_digits_one[3] := "++---------------------+" ;
    signal_digits_one[4] := "-++-------------------++" ;
    signal_digits_one[5] := "+++-------------------++" ;
    signal_digits_one[6] := "-+++-----------------+++" ;
    signal_digits_one[7] := "++++-----------------+++" ;
    signal_digits_one[8] := "-++++---------------++++" ;
    signal_digits_one[9] := "+++++---------------++++" ;

    signal_digits_two[0] := "------------------------" ;
    signal_digits_two[1] := "------------+-----------" ;
    signal_digits_two[2] := "-----------+-+----------" ;
    signal_digits_two[3] := "-----------+++----------" ;
    signal_digits_two[4] := "----------++-++---------" ;
    signal_digits_two[5] := "----------+++++---------" ;
    signal_digits_two[6] := "---------+++-+++--------" ;
    signal_digits_two[7] := "---------+++++++--------" ;
    signal_digits_two[8] := "--------++++-++++-------" ;
    signal_digits_two[9] := "--------+++++++++-------" ;

    vardef signal_counter(expr n) =
        image (
            if (n >= 0) and (n <= 99) :
            message(n mod 10) ;
                signal_all_leds ;
                signal_just_text(signal_digits_one[n mod 10]) ;
                signal_just_text(signal_digits_two[n div 10]) ;
            fi
        )
    enddef ;

\stopMPdefinitions

\startbuffer[squid-009]
    \startMPcode
        numeric n ; n := 0;
        def TempLoop(expr f, t) =
            pair a ;
            for i = (ASCII f) upto (ASCII t) :
                a := ((n mod 6) * 25mm, -(n div 6) * 25mm) ;
                n := n + 1 ;
                draw signal_character(i) ysized 20mm shifted a ;
                draw textext (char i) shifted a ;
            endfor ;
        enddef ;
        TempLoop("A","Z");
        TempLoop("0","9");
    \stopMPcode
\stopbuffer

\startbuffer[squid-010]
    \startMPcode
        draw signal_character("C") xsized 15mm shifted (0 * 17.5mm,0) ;
        draw signal_character("O") xsized 15mm shifted (1 * 17.5mm,0) ;
        draw signal_character("N") xsized 15mm shifted (2 * 17.5mm,0) ;
        draw signal_character("T") xsized 15mm shifted (3 * 17.5mm,0) ;
        draw signal_character("E") xsized 15mm shifted (4 * 17.5mm,0) ;
        draw signal_character("X") xsized 15mm shifted (5 * 17.5mm,0) ;
        draw signal_character("T") xsized 15mm shifted (6 * 17.5mm,0) ;
    \stopMPcode
\stopbuffer

\startbuffer[squid-011]
    \startMPcode
        numeric n ; n := 0 ;
        pair a ;
        for i=0 upto 9 :
            for j=0 upto 9 :
                a := (j*17.5mm,-i*17.5mm) ;
                draw signal_counter(n) ysized 15mm shifted a ;
                draw textext (decimal n) shifted a ;
                n := n + 1 ;
            endfor ;
        endfor ;
    \stopMPcode
\stopbuffer

\startbuffer[squid-012]
    \startMPcode
        numeric n ; n := 0 ;
        pair a ;
        for i=0 upto 5 :
            for j=0 upto 8 :
                a := (j*17.5mm,-i*17.5mm) ;
                draw signal_counter(round(0 randomized 99)) ysized 15mm shifted a ;
                n := n + 1 ;
            endfor ;
        endfor ;
    \stopMPcode
\stopbuffer

\continueifinputfile{s-squid.mkxl}

\starttext
    \startTEXpage\getbuffer[squid-001]\stopTEXpage
    \startTEXpage\getbuffer[squid-002]\stopTEXpage
    \startTEXpage\getbuffer[squid-003]\stopTEXpage
    \startTEXpage\getbuffer[squid-004]\stopTEXpage
    \startTEXpage\getbuffer[squid-005]\stopTEXpage
    \startTEXpage\getbuffer[squid-006]\stopTEXpage
    \startTEXpage\getbuffer[squid-007]\stopTEXpage
    \startTEXpage\getbuffer[squid-008]\stopTEXpage
    \startTEXpage\getbuffer[squid-009]\stopTEXpage
    \startTEXpage\getbuffer[squid-010]\stopTEXpage
    \startTEXpage\getbuffer[squid-011]\stopTEXpage
    \startTEXpage\getbuffer[squid-012]\stopTEXpage
    \startTEXpage\getbuffer[squid-013]\stopTEXpage
\stoptext

\stopmodule
