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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [tests/] [autoMkindex.tcl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Test file for:
2
#   auto_mkindex
3
#
4
# This file provides example cases for testing the Tcl autoloading
5
# facility.  Things are much more complicated with namespaces and classes.
6
# The "auto_mkindex" facility can no longer be built on top of a simple
7
# regular expression parser.  It must recognize constructs like this:
8
#
9
#   namespace eval foo {
10
#       proc test {x y} { ... }
11
#       namespace eval bar {
12
#           proc another {args} { ... }
13
#       }
14
#   }
15
#
16
# Note that procedures and itcl class definitions can be nested inside
17
# of namespaces.
18
#
19
# Copyright (c) 1993-1998  Lucent Technologies, Inc.
20
 
21
# This shouldn't cause any problems
22
namespace import -force blt::*
23
 
24
# Should be able to handle "proc" definitions, even if they are
25
# preceded by white space.
26
 
27
proc normal {x y} {return [expr $x+$y]}
28
  proc indented {x y} {return [expr $x+$y]}
29
 
30
#
31
# Should be able to handle proc declarations within namespaces,
32
# even if they have explicit namespace paths.
33
#
34
namespace eval buried {
35
    proc inside {args} {return "inside: $args"}
36
 
37
    namespace export pub_*
38
    proc pub_one {args} {return "one: $args"}
39
    proc pub_two {args} {return "two: $args"}
40
}
41
proc buried::within {args} {return "within: $args"}
42
 
43
namespace eval buried {
44
    namespace eval under {
45
        proc neath {args} {return "neath: $args"}
46
    }
47
    namespace eval ::buried {
48
        proc relative {args} {return "relative: $args"}
49
        proc ::top {args} {return "top: $args"}
50
        proc ::buried::explicit {args} {return "explicit: $args"}
51
    }
52
}

powered by: WebSVN 2.1.0

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