OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tix/] [tools/] [makebitmap.tcl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/bin/sh
2
# the next line restarts using tclsh \
3
exec tclsh "$0" "$@"
4
 
5
# makebitmap.tcl --
6
#
7
#       Generates a ET file that Includes all built-in bitmaps and 
8
#       bitmaps.
9
#
10
# Copyright (c) 1996, Expert Interface Technologies
11
#
12
# See the file "license.terms" for information on usage and redistribution
13
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14
 
15
 
16
set PWD [pwd]
17
 
18
foreach dir $argv {
19
    cd $dir
20
 
21
    foreach filename [glob -nocomplain *] {
22
        case [file ext $filename] {
23
            {.xbm} {
24
                set root [file root $filename]
25
                if {$root == ""} {
26
                    continue
27
                }
28
 
29
                set bitsName {}
30
                set widthName {}
31
                set heightName {}
32
                set data [exec cat $filename]
33
                regexp {[A-z_0-9]*_bits} $data bitsName
34
                regexp {[A-z_0-9]*_width} $data widthName
35
                regexp {[A-z_0-9]*_height} $data heightName
36
                if ![regexp unsigned $data] {
37
                    regsub char $data "unsigned char" data
38
                }
39
 
40
                if {$bitsName == {} ||
41
                    $widthName == {} ||
42
                    $heightName == {}} {
43
 
44
                    puts stderr \
45
                "Warning: bad XBM format in file $dir/$filename, file excluded"
46
                } else {
47
                    puts "\{"
48
                    puts [exec cat $filename]
49
                    puts -nonewline "Tk_DefineBitmap(Et_Interp, "
50
                    puts -nonewline "Tk_GetUid(\"$root\"), "
51
                    puts -nonewline "$bitsName, "
52
                    puts -nonewline "$widthName, "
53
                    puts -nonewline "$heightName);"
54
                    puts ""
55
                    puts "\}"
56
                }
57
 
58
            }
59
            {.xpm} {
60
                set name [file root $filename]
61
                set data [exec cat $filename]
62
                if [regexp char\[^\\\[\]* $data root] {
63
                    regsub char   $root "" root
64
                    regsub \[\*\] $root "" root
65
                    set root [string trim $root]
66
                } else {
67
                    set root [file root $filename]\_xpm
68
                }
69
                puts "\{"
70
                puts [exec cat $filename]
71
                puts -nonewline "Tix_DefinePixmap(Et_Interp, "
72
                puts -nonewline "Tk_GetUid(\"$name\"), "
73
                puts -nonewline "$root);"
74
                puts ""
75
                puts "\}"
76
            }
77
        }
78
    }
79
    cd $PWD
80
}
81
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.