package provide DS9 1.0

######
# Begin autogenerated taccle (version 1.3) routines.
# Although taccle itself is protected by the GNU Public License (GPL)
# all user-supplied functions are protected by their respective
# author's license.  See http://mini.net/tcl/taccle for other details.
######

namespace eval colorbar {
    variable yylval {}
    variable table
    variable rules
    variable token {}
    variable yycnt 0
    variable yyerr 0
    variable save_state 0

    namespace export yylex
}

proc colorbar::YYABORT {} {
    return -code return 1
}

proc colorbar::YYACCEPT {} {
    return -code return 0
}

proc colorbar::YYERROR {} {
    variable yyerr
    set yyerr 1
}

proc colorbar::yyclearin {} {
    variable token
    variable yycnt
    set token {}
    incr yycnt -1
}

proc colorbar::yyerror {s} {
    puts stderr $s
}

proc colorbar::setupvalues {stack pointer numsyms} {
    upvar 1 1 y
    set y {}
    for {set i 1} {$i <= $numsyms} {incr i} {
        upvar 1 $i y
        set y [lindex $stack $pointer]
        incr pointer
    }
}

proc colorbar::unsetupvalues {numsyms} {
    for {set i 1} {$i <= $numsyms} {incr i} {
        upvar 1 $i y
        unset y
    }
}

array set colorbar::table {
  48:276,target 49
  5:276,target 4
  27:0 reduce
  38:276 reduce
  37:276,target 11
  9:291 goto
  15:257,target 1
  6:0,target 7
  47:276 reduce
  26:276,target 9
  2:0 reduce
  17:275 shift
  24:0 reduce
  41:0,target 24
  15:276,target 1
  45:0 reduce
  33:0,target 15
  13:288,target 40
  25:0,target 8
  6:276 reduce
  26:276 reduce
  6:276,target 7
  16:278,target 12
  21:0 reduce
  38:276,target 12
  42:0 reduce
  35:276 reduce
  27:276,target 10
  16:297,target 42
  44:276 reduce
  38:0 reduce
  14:276 reduce
  3:0,target 3
  10:292,target 36
  3:276 reduce
  45:0,target 35
  23:276 reduce
  37:0,target 11
  14:0 reduce
  40:276,target 23
  39:276,target 28
  30:0,target 13
  29:0,target 27
  10:271,target 33
  22:0,target 0
  35:0 reduce
  14:0,target 22
  32:276 reduce
  28:276,target 26
  0:287,target 20
  0:257 shift
  0:258 shift
  0:260 shift
  0:259 shift
  13:261,target 5
  0:261 shift
  0:266,target 10
  0:262 shift
  0:263 shift
  15:288,target 41
  41:276 reduce
  0:264 shift
  11:271 shift
  23:294 goto
  32:0 reduce
  0:265 shift
  11:272 shift
  0:266 shift
  0:267 shift
  0:285,target 19
  6:0 reduce
  13:258,target 2
  41:276,target 24
  0:276 reduce
  0:264,target 8
  11:271,target 37
  23:294,target 48
  19:275 shift
  0:278 shift
  20:276 reduce
  28:0 reduce
  0:280 shift
  0:279 shift
  0:0,target 1
  0:281 shift
  0:282 shift
  49:0 reduce
  30:276,target 13
  29:276,target 27
  0:283 shift
  11:290 goto
  0:284 shift
  8:275 shift
  0:285 shift
  49:0,target 20
  0:283,target 17
  11:290,target 39
  42:0,target 32
  28:276 reduce
  0:287 shift
  34:0,target 16
  0:288 goto
  26:0,target 9
  3:0 reduce
  7:269,target 26
  7:270,target 27
  0:262,target 6
  0:293 goto
  25:0 reduce
  0:295 goto
  37:276 reduce
  46:0 reduce
  0:297 goto
  0:281,target 15
  42:276,target 32
  0:0 reduce
  46:276 reduce
  0:260,target 4
  0:259,target 3
  22:0 accept
  31:276,target 14
  43:0 reduce
  16:278 shift
  9:274,target 31
  15:261,target 5
  0:278,target 12
  5:276 reduce
  20:276,target 37
  25:276 reduce
  4:0,target 6
  16:287 shift
  0:257,target 1
  13:257 shift
  13:258 shift
  40:0 reduce
  39:0 reduce
  13:259 shift
  13:260 shift
  46:0,target 25
  0:297,target 24
  13:261 shift
  38:0,target 12
  34:276 reduce
  13:262 shift
  31:0,target 14
  15:258,target 2
  23:0,target 18
  43:276,target 33
  15:0,target 1
  16:297 goto
  0:276,target 1
  43:276 reduce
  15:0 reduce
  32:276,target 29
  9:291,target 32
  36:0 reduce
  0:295,target 23
  13:276 reduce
  21:276,target 21
  2:276 reduce
  12:0 reduce
  33:0 reduce
  13:288 goto
  0:293,target 22
  44:276,target 36
  31:276 reduce
  1:276,target 2
  1:0,target 2
  18:286,target 45
  33:276,target 15
  10:274,target 35
  43:0,target 33
  40:276 reduce
  39:276 reduce
  35:0,target 17
  30:0 reduce
  29:0 reduce
  10:271 shift
  27:0,target 10
  10:272 shift
  20:0,target 37
  10:274 shift
  12:0,target 38
  48:276 shift
  4:0 reduce
  7:268 shift
  10:272,target 34
  7:269 shift
  7:270 shift
  26:0 reduce
  18:277 shift
  47:0 reduce
  45:276,target 35
  2:276,target 5
  0:288,target 21
  10:292 goto
  27:276 reduce
  34:276,target 16
  1:0 reduce
  13:262,target 6
  18:286 shift
  0:267,target 11
  15:257 shift
  15:258 shift
  23:0 reduce
  15:259 shift
  15:260 shift
  15:261 shift
  23:276,target 19
  44:0 reduce
  36:276 reduce
  5:0,target 4
  15:262 shift
  7:289 goto
  18:296 goto
  12:276,target 38
  47:0,target 34
  40:0,target 23
  39:0,target 28
  13:259,target 3
  13:260,target 4
  45:276 reduce
  32:0,target 29
  0:265,target 9
  11:272,target 38
  17:275,target 43
  24:0,target 31
  20:0 reduce
  46:276,target 25
  41:0 reduce
  3:276,target 3
  15:276 reduce
  0:284,target 18
  8:275,target 29
  35:276,target 17
  4:276 reduce
  18:277,target 44
  13:257,target 1
  24:276 reduce
  0:263,target 7
  15:288 goto
  24:276,target 31
  37:0 reduce
  33:276 reduce
  7:289,target 28
  18:296,target 46
  13:276,target 1
  0:282,target 16
  7:268,target 25
  16:287,target 20
  0:261,target 5
  13:0 reduce
  47:276,target 34
  42:276 reduce
  2:0,target 5
  4:276,target 6
  34:0 reduce
  12:276 reduce
  44:0,target 36
  36:276,target 30
  15:262,target 6
  36:0,target 30
  28:0,target 26
  0:280,target 14
  0:279,target 13
  21:0,target 21
  13:0,target 1
  1:276 reduce
  25:276,target 8
  0:258,target 2
  21:276 reduce
  31:0 reduce
  9:273 shift
  9:274 shift
  14:276,target 22
  9:273,target 30
  15:259,target 3
  15:260,target 4
  30:276 reduce
  29:276 reduce
  19:275,target 47
  5:0 reduce
}

array set colorbar::rules {
  9,l 289
  11,l 290
  32,l 295
  6,l 288
  28,l 295
  3,l 288
  25,l 295
  0,l 298
  22,l 295
  18,l 293
  15,l 292
  36,l 296
  12,l 290
  33,l 295
  7,l 288
  29,l 295
  30,l 295
  4,l 288
  26,l 295
  1,l 288
  23,l 295
  19,l 294
  20,l 293
  16,l 292
  37,l 297
  13,l 291
  34,l 295
  8,l 289
  10,l 289
  31,l 295
  5,l 288
  27,l 295
  2,l 288
  24,l 295
  21,l 295
  17,l 292
  38,l 297
  14,l 291
  35,l 296
}

array set colorbar::rules {
  12,dc 1
  26,dc 2
  3,dc 1
  18,dc 1
  33,dc 2
  9,dc 1
  11,dc 1
  25,dc 2
  2,dc 1
  17,dc 1
  32,dc 2
  8,dc 1
  10,dc 1
  24,dc 2
  1,dc 0
  38,dc 1
  16,dc 1
  31,dc 1
  7,dc 1
  23,dc 2
  0,dc 1
  37,dc 1
  15,dc 1
  29,dc 2
  30,dc 2
  6,dc 1
  22,dc 1
  36,dc 1
  14,dc 1
  28,dc 2
  5,dc 1
  21,dc 1
  35,dc 1
  13,dc 1
  27,dc 2
  4,dc 1
  19,dc 0
  20,dc 3
  34,dc 2
}

array set colorbar::rules {
  7,line 80
  37,line 130
  4,line 77
  34,line 123
  1,line 74
  31,line 119
  27,line 112
  24,line 109
  21,line 105
  17,line 97
  14,line 92
  11,line 87
  9,line 83
  6,line 79
  36,line 127
  3,line 76
  33,line 122
  29,line 115
  30,line 117
  26,line 111
  23,line 108
  19,line 101
  20,line 102
  16,line 96
  13,line 91
  19,e 1
  10,line 84
  8,line 82
  38,line 131
  5,line 78
  35,line 126
  2,line 75
  32,line 121
  28,line 113
  25,line 110
  22,line 106
  18,line 101
  15,line 95
  12,line 88
}

array set colorbar::lr1_table {
  35 {{17 {0 276} 1}}
  14,trans {}
  36 {{30 {0 276} 2}}
  33,trans {}
  37 {{11 {0 276} 1}}
  38 {{12 {0 276} 1}}
  40 {{23 {0 276} 2}}
  39 {{28 {0 276} 2}}
  18,trans {{277 44} {286 45} {296 46}}
  41 {{24 {0 276} 2}}
  1,trans {}
  37,trans {}
  42 {{32 {0 276} 2}}
  43 {{33 {0 276} 2}}
  44 {{36 {0 276} 1}}
  23,trans {{294 48}}
  45 {{35 {0 276} 1}}
  5,trans {}
  42,trans {}
  46 {{25 {0 276} 2}}
  47 {{34 {0 276} 2}}
  48 {{20 0 2}}
  49 {{20 0 3}}
  27,trans {}
  9,trans {{273 30} {274 31} {291 32}}
  46,trans {}
  13,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {288 40}}
  32,trans {}
  17,trans {{275 43}}
  0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {278 12} {279 13} {280 14} {281 15} {282 16} {283 17} {284 18} {285 19} {287 20} {288 21} {293 22} {295 23} {297 24}}
  36,trans {}
  22,trans {}
  4,trans {}
  41,trans {}
  26,trans {}
  8,trans {{275 29}}
  45,trans {}
  12,trans {}
  31,trans {}
  49,trans {}
  16,trans {{278 12} {287 20} {297 42}}
  35,trans {}
  21,trans {}
  3,trans {}
  40,trans {}
  39,trans {}
  10 {{30 {0 276} 1} {15 {0 276} 0} {16 {0 276} 0} {17 {0 276} 0}}
  11 {{28 {0 276} 1} {11 {0 276} 0} {12 {0 276} 0}}
  25,trans {}
  12 {{38 {0 276} 1}}
  7,trans {{268 25} {269 26} {270 27} {289 28}}
  44,trans {}
  13 {{23 {0 276} 1} {1 {0 276} 0} {2 {0 276} 0} {3 {0 276} 0} {4 {0 276} 0} {5 {0 276} 0} {6 {0 276} 0} {7 {0 276} 0}}
  14 {{22 {0 276} 1}}
  11,trans {{271 37} {272 38} {290 39}}
  15 {{24 {0 276} 1} {1 {0 276} 0} {2 {0 276} 0} {3 {0 276} 0} {4 {0 276} 0} {5 {0 276} 0} {6 {0 276} 0} {7 {0 276} 0}}
  30,trans {}
  29,trans {}
  16 {{32 {0 276} 1} {37 {0 276} 0} {38 {0 276} 0}}
  48,trans {{276 49}}
  0 {{0 0 0} {18 0 0} {20 0 0} {21 {0 276} 0} {22 {0 276} 0} {23 {0 276} 0} {24 {0 276} 0} {25 {0 276} 0} {26 {0 276} 0} {27 {0 276} 0} {28 {0 276} 0} {29 {0 276} 0} {30 {0 276} 0} {31 {0 276} 0} {32 {0 276} 0} {33 {0 276} 0} {34 {0 276} 0} {1 {0 276} 0} {2 {0 276} 0} {3 {0 276} 0} {4 {0 276} 0} {5 {0 276} 0} {6 {0 276} 0} {7 {0 276} 0} {37 {0 276} 0} {38 {0 276} 0}}
  17 {{33 {0 276} 1}}
  1 {{2 {0 276} 1}}
  18 {{25 {0 276} 1} {35 {0 276} 0} {36 {0 276} 0}}
  15,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {288 41}}
  2 {{5 {0 276} 1}}
  19 {{34 {0 276} 1}}
  20 {{37 {0 276} 1}}
  34,trans {}
  3 {{3 {0 276} 1}}
  21 {{21 {0 276} 1}}
  4 {{6 {0 276} 1}}
  22 {{0 0 1}}
  5 {{4 {0 276} 1}}
  23 {{18 0 1} {20 0 1} {19 276 0}}
  20,trans {}
  19,trans {{275 47}}
  6 {{7 {0 276} 1}}
  24 {{31 {0 276} 1}}
  2,trans {}
  38,trans {}
  7 {{26 {0 276} 1} {8 {0 276} 0} {9 {0 276} 0} {10 {0 276} 0}}
  25 {{8 {0 276} 1}}
  8 {{27 {0 276} 1}}
  26 {{9 {0 276} 1}}
  9 {{29 {0 276} 1} {13 {0 276} 0} {14 {0 276} 0}}
  27 {{10 {0 276} 1}}
  24,trans {}
  6,trans {}
  28 {{26 {0 276} 2}}
  43,trans {}
  29 {{27 {0 276} 2}}
  30 {{13 {0 276} 1}}
  31 {{14 {0 276} 1}}
  32 {{29 {0 276} 2}}
  10,trans {{271 33} {272 34} {274 35} {292 36}}
  28,trans {}
  33 {{15 {0 276} 1}}
  47,trans {}
  34 {{16 {0 276} 1}}
}

array set colorbar::token_id_table {
  286,t 0
  286 VALUE_
  280,title MATCH
  279,title LOCK
  264,line 15
  298,title {}
  292,line 94
  287 VERTICAL_
  270,t 0
  269,t 0
  288 yesno
  290 fontWeight
  289 font
  276,line 29
  265,title FONTSLANT
  291,t 1
  291 fontSlant
  284,title SPACE
  292 fontStyle
  274,t 0
  261,line 11
  293 command
  288,line 73
  257,t 0
  294 @PSEUDO1
  270,title COURIER
  269,title HELVETICA
  295,t 1
  295 colorbar
  288,title {}
  273,line 24
  296 space
  278,t 0
  297 orientation
  257,line 7
  262,t 0
  298 start'
  285,line 41
  274,title ITALIC
  293,title {}
  283,t 0
  270,line 21
  269,line 20
  297,line 129
  259,title ON
  260,title OFF
  266,t 0
  278,title HORIZONTAL
  297,title {}
  282,line 38
  287,t 0
  error error
  271,t 0
  264,title FONTSIZE
  266,line 17
  294,line 101
  283,title SIZE
  292,t 1
  278,line 34
  error,line 72
  275,t 0
  268,title TIMES
  287,title VERTICAL
  258,t 0
  263,line 14
  291,line 90
  error,title {}
  296,t 1
  280,t 0
  279,t 0
  275,line 27
  273,title ROMAN
  292,title {}
  263,t 0
  259,line 9
  260,line 10
  287,line 43
  258,title NO
  284,t 0
  277,title DISTANCE
  296,title {}
  272,line 23
  267,t 0
  263,title FONT
  288,t 1
  284,line 40
  282,title ORIENTATION
  272,t 0
  268,line 19
  296,line 125
  267,title FONTWEIGHT
  293,t 1
  286,title VALUE
  257 YES_
  281,line 37
  276,t 0
  258 NO_
  259,t 0
  259 ON_
  260 OFF_
  260,t 0
  272,title BOLD
  261 TRUE_
  265,line 16
  297,t 1
  293,line 100
  291,title {}
  262 FALSE_
  281,t 0
  263 FONT_
  277,line 33
  257,title YES
  264 FONTSIZE_
  264,t 0
  276,title string
  265 FONTSLANT_
  295,title {}
  262,line 12
  266 FONTSTYLE_
  290,line 86
  289,line 81
  285,t 0
  267 FONTWEIGHT_
  0,t 0
  0 {$}
  262,title FALSE
  268 TIMES_
  268,t 0
  281,title NUMERICS
  274,line 25
  270 COURIER_
  269 HELVETICA_
  error,t 0
  271 NORMAL_
  290,t 1
  289,t 1
  272 BOLD_
  258,line 8
  286,line 42
  273,t 0
  273 ROMAN_
  266,title FONTSTYLE
  285,title TICKS
  274 ITALIC_
  275 INT_
  271,line 22
  298,line 132
  294,t 1
  276 STRING_
  277,t 0
  277 DISTANCE_
  271,title NORMAL
  290,title {}
  289,title {}
  283,line 39
  278 HORIZONTAL_
  261,t 0
  280 MATCH_
  279 LOCK_
  298,t 1
  281 NUMERICS_
  267,line 18
  295,line 104
  282,t 0
  282 ORIENTATION_
  275,title integer
  294,title {}
  283 SIZE_
  265,t 0
  284 SPACE_
  280,line 36
  279,line 35
  285 TICKS_
  261,title TRUE
}

proc colorbar::yyparse {} {
    variable yylval
    variable table
    variable rules
    variable token
    variable yycnt
    variable lr1_table
    variable token_id_table
    variable yyerr
    variable save_state

    set yycnt 0
    set state_stack {0}
    set value_stack {{}}
    set token ""
    set accepted 0
    set yyerr 0
    set save_state 0

    while {$accepted == 0} {
        set state [lindex $state_stack end]
        if {$token == ""} {
            set yylval ""
            set token [yylex]
            set buflval $yylval
	    if {$token>0} {
	        incr yycnt
            }
        }
        if {![info exists table($state:$token)] || $yyerr} {
	    if {!$yyerr} {
	        set save_state $state
	    }
            # pop off states until error token accepted
            while {[llength $state_stack] > 0 && \
                       ![info exists table($state:error)]} {
                set state_stack [lrange $state_stack 0 end-1]
                set value_stack [lrange $value_stack 0 \
                                       [expr {[llength $state_stack] - 1}]]
                set state [lindex $state_stack end]
            }
            if {[llength $state_stack] == 0} {
 
	        set rr { }
                if {[info exists lr1_table($save_state,trans)] && [llength $lr1_table($save_state,trans)] >= 1} {
                    foreach trans $lr1_table($save_state,trans) {
                        foreach {tok_id nextstate} $trans {
			    set ss $token_id_table($tok_id,title)
			    if {$ss != {}} {
			        append rr "$ss, "
                            }
                        }
                    }
                }
		set rr [string trimleft $rr { }]
		set rr [string trimright $rr {, }]
                yyerror "parse error, expecting: $rr"


                return 1
            }
            lappend state_stack [set state $table($state:error,target)]
            lappend value_stack {}
            # consume tokens until it finds an acceptable one
            while {![info exists table($state:$token)]} {
                if {$token == 0} {
                    yyerror "end of file while recovering from error"
                    return 1
                }
                set yylval {}
                set token [yylex]
                set buflval $yylval
            }
            continue
        }
        switch -- $table($state:$token) {
            shift {
                lappend state_stack $table($state:$token,target)
                lappend value_stack $buflval
                set token ""
            }
            reduce {
                set rule $table($state:$token,target)
                set ll $rules($rule,l)
                if {[info exists rules($rule,e)]} {
                    set dc $rules($rule,e)
                } else {
                    set dc $rules($rule,dc)
                }
                set stackpointer [expr {[llength $state_stack]-$dc}]
                setupvalues $value_stack $stackpointer $dc
                set _ $1
                set yylval [lindex $value_stack end]
                switch -- $rule {
                    1 { set _ 1 }
                    2 { set _ 1 }
                    3 { set _ 1 }
                    4 { set _ 1 }
                    5 { set _ 0 }
                    6 { set _ 0 }
                    7 { set _ 0 }
                    8 { set _ times }
                    9 { set _ helvetica }
                    10 { set _ courier }
                    11 { set _ normal }
                    12 { set _ bold }
                    13 { set _ roman }
                    14 { set _ italic }
                    15 { set _ normal }
                    16 { set _ bold }
                    17 { set _ italic }
                    19 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} }
                    21 { ProcessCmdSet view colorbar $1 UpdateView }
                    22 { MatchColorCurrent }
                    23 { ProcessCmdSet colorbar lock $2 LockColorCurrent }
                    24 { ProcessCmdSet colorbar numerics $2 UpdateView }
                    25 { ProcessCmdSet colorbar space $2 UpdateView }
                    26 { ProcessCmdSet colorbar font $2 UpdateView }
                    27 { ProcessCmdSet colorbar font,size $2 UpdateView }
                    28 { ProcessCmdSet colorbar font,weight $2 UpdateView }
                    29 { ProcessCmdSet colorbar font,slant $2 UpdateView }
                    30 { ProcessCmdFontStyle colorbar font $2 UpdateView }
                    31 { ProcessCmdSet colorbar orientation $1 UpdateView }
                    32 { ProcessCmdSet colorbar orientation $2 UpdateView }
                    33 { ProcessCmdSet colorbar size $2 UpdateView }
                    34 { ProcessCmdSet colorbar ticks $2 UpdateView }
                    35 { set _ 1 }
                    36 { set _ 0 }
                    37 { set _ vertical }
                    38 { set _ horizontal }
                }
                unsetupvalues $dc
                # pop off tokens from the stack if normal rule
                if {![info exists rules($rule,e)]} {
                    incr stackpointer -1
                    set state_stack [lrange $state_stack 0 $stackpointer]
                    set value_stack [lrange $value_stack 0 $stackpointer]
                }
                # now do the goto transition
                lappend state_stack $table([lindex $state_stack end]:$ll,target)
                lappend value_stack $_
            }
            accept {
                set accepted 1
            }
            goto -
            default {
                puts stderr "Internal parser error: illegal command $table($state:$token)"
                return 2
            }
        }
    }
    return 0
}

######
# end autogenerated taccle functions
######

proc colorbar::yyerror {msg} {
     variable yycnt
     variable yy_current_buffer
     variable index_

     ParserError $msg $yycnt $yy_current_buffer $index_
}
