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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tix/] [docs/] [Files.txt] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
This document describes the operating system independent file handling
2
capability in Tix.
3
 
4
1. The problem:
5
 
6
   (A) Handling user inputs. In various Tix widgets, the user may enter
7
   a text string to refer to a file, a directory or a file pattern.
8
 
9
   File:
10
        tixFileEntry
11
        tixFileSelectBox, the Selection part
12
 
13
   Directory:
14
        tixDirBox
15
        tixExFileSelectBox, the "Directory" part
16
 
17
   Pattern:
18
        tixFileSelectBox, the "Pattern" part
19
        tixExFileSelectBox, the "File" part
20
 
21
   (B) Interfacing with application
22
 
23
   These widgets support a -directory option
24
 
25
        tixDirList
26
        tixDirTree
27
        tixFileSelectBox
28
        tixExFileSelectBox
29
 
30
   These widgets support a -pattern option
31
        tixFileSelectBox
32
        tixExFileSelectBox
33
 
34
   (C) Displaying the file system in a single hierarchy
35
 
36
        tixDirList
37
        tixDirTree
38
 
39
2. Issues:
40
 
41
   (A) Unix:
42
        Tilde expansion
43
 
44
   (B) Windows:
45
        No single file system  hierarchy.
46
 
47
   (C) Both:
48
        Need to translate relative pathnames, "." and ".."
49
 
50
3. Reusuability:
51
 
52
   Many widgets need to list directory, glob, display hierarchy. We
53
   don't want to rewrite the same code again and again.
54
 
55
 
56
4. API.
57
 
58
   (A) Types of API
59
 
60
   External interface: Takes an input from the user or from the
61
   application and translate it to a canonical form.
62
 
63
   Internal interface: operate on filenames that are in canonical
64
   forms. There are run-time checking whether the filenames arein
65
   canonical forms.
66
 
67
   We have the two types of interfaces so that we don't need to
68
   perform needless translations from "user form" to "canonical
69
   form".
70
 
71
 
72
   (B) API Consistency
73
 
74
   External API always takes a filename in the native format and
75
   return file names in the native format.
76
 
77
 
78
   (C) Errors
79
 
80
   User errors are reported in an error dialog. Application errors
81
   triggers a TCL error return code.
82
 
83
   There should be in-line comments stating whether an input is from
84
   user or application.
85
 
86
5. VPATH: virtual hierarchical path
87
 
88
   Unix:
89
 
90
     In Unix, a VPATH is the same as a file pathname.
91
 
92
   Windows:
93
 
94
     In Windows 3.1, a VPATH is "xx\" followed by a normalized DOS
95
     file pathname. "xx" by itself is "My computer" and refers to the
96
     root directory of the C: drive.
97
 
98
     In Windows 95, a VPATH is "xx\xx\" followed by a normalized DOS
99
     file pathname. "xx" by itself is "Desktop" and refers to
100
     "C:\Windows\Desktop". "xx\xx" by itself is "My computer" and
101
     refers to the root directory of the C: drive.
102
 
103
     Normalization do not go into the virtual prefix. E.g.: the VPATH for
104
     "C:\Windows\..\..\" is "xx\xx\C:", not "xx\xx".
105
 
106
 
107
6. Normalization:
108
 
109
   tixFSNorm context text defFile flagsVar errorMsgVar
110
 
111
        This is the main function that translate a user input to
112
        normalized (canonical) form.
113
 
114
   Parameters:
115
        context:VPATH
116
            The "current directory" under which the translation
117
            occurs. It is used only if text refers to a relative
118
            pathname.
119
 
120
            if context is the empty string, then text must refer to an
121
            absolute path.
122
 
123
        text:string
124
            The (user/application) input that needs to be
125
            normalized. The exact mode of translation depends on the
126
            flags
127
 
128
        defFile:string
129
            If the input is a directory, append this to the directory.
130
 
131
        flagsVar: ref to array
132
            flag(noPattern): we don't want patterns. Treat all wild
133
            card characters as normal file names
134
 
135
   Return value:
136
        No error occurs: errorMsg is not set and a list of three
137
        elements is returned:
138
 
139
        index 0: the normalized path of the input
140
        index 1: the VPATH of the directory.
141
        index 2: file(s) in the directory.
142
        index 3: pattern(s) in the directory.
143
 
144
        Either index 1 or 2, or both, are empty strings. They cannot
145
        be both non-empty.
146
 
147
   A Normalized path:
148
 
149
   1) is absolute
150
   2) has no double slashes
151
   3) has no trailing slashes
152
   4) has no relative pathnames
153
   5) has no tildes
154
 
155
 
156
   tixFSNormDir directory
157
 
158
        This is mainly used to check the validity of -directory option
159
        of the widgets.
160
 
161
   Parameter:
162
        directory:
163
            Must be an existing absolute path.
164
 
165
   Return value:
166
        Returns normalized path. Error given when directory is not an
167
        existing absolute path
168
 
169
 
170
7. VPATH translation:
171
 
172
   tixFSVPath pathname:         returns the VPATH of pathname
173
   tixFSPath VPATH:             returns the pathname of VPATH
174
 
175
 
176
8. Valid file names:
177
 
178
   Should prompt to user about invalid filenames (E.g. In Windows,
179
   names cannot contain "*")
180
 
181
9. Creation prompt:
182
 
183
   If user enters a file or directory that doesn't exist, promt to ask
184
   whether he wants to create it.
185
 
186
 
187
10.

powered by: WebSVN 2.1.0

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