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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [tools/] [hanno.tcl] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/bin/sh
2
# the next line restarts using tixwish \
3
exec tclsh7.6 "$0" "$@"
4
 
5
# Options
6
#
7
#       -v : Verbose mode. Print out what hanno is doing.
8
#
9
set verbose 0
10
 
11
if {[info exists env(TIX_VERBOSE)] && $env(TIX_VERBOSE) == 1} {
12
    set verbose 1
13
}
14
 
15
if {[lsearch -glob $argv -v*] != -1} {
16
    set verbose 1
17
}
18
 
19
set files [exec find . -name *.html -print]
20
 
21
foreach file $files {
22
    if {$verbose} {
23
        puts "\[html anno]: checking $file"
24
    }
25
    set output {}
26
    set src [open $file RDONLY]
27
 
28
    set changed 1
29
 
30
    while {![eof $src]} {
31
        set line [gets $src]
32
 
33
        if {[regexp -nocase {[ \t]*\<hr>\<i>Last modified.*} $line]} {
34
            # Do nothing
35
        } elseif {[regexp -nocase {[ \t]*\<i>Serial.*\</i>} $line]} {
36
            if {[scan $line "<i>Serial %d</i>" lastmtime] == 1} {
37
                if {[expr [file mtime $file] - $lastmtime] >= 10} {
38
                    set changed 1
39
                } else {
40
                    set changed 0
41
                }
42
            }
43
        } else {
44
            append output $line\n
45
        }
46
    }
47
    close $src
48
 
49
    if {$changed == 1} {
50
        if {$verbose} {
51
            puts "\[html anno]: modifying tag of $file"
52
        }
53
 
54
        set date [clock format [file mtime $file]]
55
 
56
        set des [open $file {WRONLY TRUNC}]
57
        puts -nonewline $des $output
58
 
59
        # Somehow the "seek" is necessary
60
        #
61
        seek $des -1 current
62
        puts $des "<hr><i>Last modified $date </i> --- "
63
        puts $des "<i>Serial [file mtime $file]</i>"
64
        close $des
65
    }
66
}

powered by: WebSVN 2.1.0

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