From e70016e79002b688f362c4099335e4d163d5e62d Mon Sep 17 00:00:00 2001 From: ellson Date: Sun, 5 Oct 2008 22:11:37 +0000 Subject: [PATCH] save work --- lib/inkpot/Makefile.am | 14 +++++----- lib/inkpot/inkpot_lib.tcl | 57 ++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/lib/inkpot/Makefile.am b/lib/inkpot/Makefile.am index e8ad937a3..4b2438565 100644 --- a/lib/inkpot/Makefile.am +++ b/lib/inkpot/Makefile.am @@ -16,15 +16,15 @@ noinst_LTLIBRARIES = libinkpot_C.la man_MANS = inkpot.3 inkpot.1 pdf_DATA = inkpot.3.pdf inkpot.1.pdf -#inkpot_SOURCES = inkpot.c -#inkpot_LDADD = $(builddir)/libinkpot.la +inkpot_SOURCES = inkpot.c +inkpot_LDADD = $(builddir)/libinkpot.la -#libinkpot_C_la_SOURCES = inkpot_scheme.c inkpot_value.c inkpot_xlate.c -#libinkpot_C_la_LIBADD = $(top_builddir)/lib/rbtree/librbtree_C.la +libinkpot_C_la_SOURCES = inkpot_scheme.c inkpot_value.c inkpot_xlate.c +libinkpot_C_la_LIBADD = $(top_builddir)/lib/rbtree/librbtree_C.la -#libinkpot_la_SOURCES = $(libinkpot_C_la_SOURCES) -#libinkpot_la_LIBADD = $(libinkpot_C_la_LIBADD) -#libinkpot_la_LDFLAGS = -version-info $(VERSION_INFO) -no-undefined +libinkpot_la_SOURCES = $(libinkpot_C_la_SOURCES) +libinkpot_la_LIBADD = $(libinkpot_C_la_LIBADD) +libinkpot_la_LDFLAGS = -version-info $(VERSION_INFO) -no-undefined inkpot_value_table.h: $(builddir)/inkpot_define.h diff --git a/lib/inkpot/inkpot_lib.tcl b/lib/inkpot/inkpot_lib.tcl index 87eeb8cec..7bb8855e1 100755 --- a/lib/inkpot/inkpot_lib.tcl +++ b/lib/inkpot/inkpot_lib.tcl @@ -1,3 +1,4 @@ +#!/usr/bin/tclsh set comments 1 set target_line_length 60 @@ -147,7 +148,7 @@ foreach {m2} [lsort -dictionary [mapm2 ICRIV]] { foreach {range index value} $RIV {break} foreach {m1} [map2m1 ICRIV $RIV] { foreach {icolor schemes} $m1 {break} - lappend ALL_RANGES([list $schemes $icolor $range]) $m2 + lappend ALL_RANGES([list $icolor $range $schemes]) $m2 } } @@ -155,52 +156,63 @@ foreach {m2} [lsort -dictionary [mapm2 ICRIV]] { set SZT_INDEXES 0 set index -1 tab_begin $f "IDX_VALUES TAB_INDEXES\[SZT_INDEXES\] = {" -foreach {schemes_icolor_range} [lsort -ascii [array names ALL_RANGES]] { +foreach {icolor_range_schemes} [lsort -ascii [array names ALL_RANGES]] { tab_begin_block $f $SZT_INDEXES - set ALL_RANGES_coded($schemes_icolor_range) $SZT_INDEXES - foreach {m2} $ALL_RANGES($schemes_icolor_range) { + foreach {m2} $ALL_RANGES($icolor_range_schemes) { foreach {RIV schemes} $m2 {break} foreach {range index value} $RIV {break} tab_elem $f $ALL_VALUES_coded($value), incr SZT_INDEXES } - tab_end_block $f [map2m1 ICRIV $RIV] + set size [llength $ALL_RANGES($icolor_range_schemes)] + set ALL_RANGES_coded($icolor_range_schemes) [list $SZT_INDEXES $size] + tab_end_block $f "[map2m1 ICRIV $RIV] $size" } tab_end $f "};\n" # generate TAB_RANGES set SZT_RANGES 0 +set last_icolor "" tab_begin $f "inkpot_range_t TAB_RANGES\[SZT_RANGES\] = {" -foreach {schemes_icolor_range} [lsort -dictionary [array names ALL_INDEX_RANGES_coded]] { - tab_begin_block $f $SZT_RANGES - set first_idx $ALL_INDEX_RANGES_coded($schemes_icolor_range) - set size [llength $ALL_INDEX_RANGES($schemes_icolor_range)] +foreach {icolor_range_schemes} [lsort -dictionary [array names ALL_RANGES_coded]] { + foreach {icolor range schemes} $icolor_range_schemes {break} + foreach {first_idx size} $ALL_RANGES_coded($icolor_range_schemes) {break} + if {! [string equal $last_icolor $icolor]} { + if {! [string equal $last_icolor ""]} { + tab_end_block $f [list $icolor $schemes $cnt] + } + tab_begin_block $f $SZT_RANGES + set cnt 0 + set last_icolor $icolor + } + set size [llength $ALL_RANGES($icolor_range_schemes)] tab_elem $f "{$size,$first_idx}," - set ALL_RANGES_coded($schemes_icolor_range) $SZT_RANGES incr SZT_RANGES - tab_end_block $f $m1 + incr cnt +} +if {! [string equal $last_icolor $icolor]} { + tab_end_block $f [list $icolor $schemes $cnt] } tab_end $f "};\n" # generate TAB_ICOLORS set SZT_ICOLORS 0 +set last_icolor "" tab_begin $f "inkpot_scheme_index_t TAB_ICOLORS\[SZT_ICOLORS\] = {" -foreach {m2} [lsort -dictionary [array names ALL_RANGES_coded]] { -if {0} { - tab_begin_block $f $SZT_ICOLORS - - set icolor_set [mapm21 ICRIV $m2] - foreach {icolor} $icolor_set { - tab_elem $f "{$ALL_ICOLOR_STRINGS_coded($icolor),$ALL_RANGES_coded($m2)}," +foreach {icolor_range_schemes} [lsort -dictionary [array names ALL_RANGES_coded]] { + foreach {icolor range schemes} $icolor_range_schemes {break} + foreach {first_idx size} $ALL_RANGES_coded($icolor_range_schemes) {break} + if {! [string equal $last_icolor $icolor]} { + if {! [string equal $last_icolor ""]} {tab_end_block $f [list $icolor $schemes]} + tab_begin_block $f $SZT_ICOLORS + tab_elem $f "{$ALL_ICOLOR_STRINGS_coded($icolor),$first_idx}," + set last_icolor $icolor } - - tab_end_block $f $icolor_set - set ALL_ICOLORS_coded($color) $SZT_ICOLORS incr SZT_ICOLORS } -} +if {! [string equal $last_icolor $icolor]} {tab_end_block $f [list $icolor $schemes]} tab_end $f "};\n" @@ -243,6 +255,7 @@ foreach {scheme} [lsort -ascii [array names ALL_SCHEMES]] { } tab_end $f "};\n" + # generate TAB_ALTS set SZT_ALTS 0 tab_begin $f "inkpot_name_t TAB_ALTS\[SZT_ALTS\] = {" -- 2.40.0