chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Sapphire / sh / msgs
1 ;
2 ; msgs.sh
3 ;
4 ; Message file handling
5 ;
6 ; © 1994-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's Sapphire library.
12 ;
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
16 ; any later version.
17 ;
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ; GNU General Public License for more details.
22 ;
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire.  If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
27 ;----- Overview -------------------------------------------------------------
28 ;
29 ; Functions provided:
30 ;
31 ;  msgs_load
32 ;  msgs_build
33 ;  msgs_error
34 ;  msgs_lookup
35 ;  msgs_init
36
37                 [       :LNOT::DEF:msgs__dfn
38                 GBLL    msgs__dfn
39
40 ; --- msgs_load ---
41 ;
42 ; On entry:     R0 == pointer to filename
43 ;
44 ; On exit:      May return an error
45 ;
46 ; Use:          Reads in the given messages file.
47
48                 IMPORT  msgs_load
49
50 ; --- msgs_build ---
51 ;
52 ; On entry:     R0 == pointer to a message string
53 ;               R1 == pointer to output buffer
54 ;
55 ; On exit:      R0 == pointer to buffer (R1 on entry)
56 ;               R1 == pointer to terminating null
57 ;
58 ; Use:          Builds a message string, by substituting message references
59 ;               by their values.  Each reference of the form `$tag' (or
60 ;               optionally `$(tag)', to avoid having to have a trailing)
61 ;               space is replaced by the actual message.  A literal `$' sign
62 ;               may be represented as `$$'.
63
64                 IMPORT  msgs_build
65
66 ; --- msgs_error ---
67 ;
68 ; On entry:     R0 == pointer to an error skeleton string:
69 ;                       R0+0 == error number
70 ;                       R0+4 == message tag-and-default (null-terminated)
71 ;               R2-R11 == filler strings (not message tags)
72 ;
73 ; On exit:      R0 == pointer to translated error message (in error buffer)
74 ;               R1 == pointer to null terminator of message
75 ;
76 ; Use:          Performs string sustitution on an error message (as done by
77 ;               str_subst), but translating the error string.
78
79                 IMPORT  msgs_error
80
81 ; --- msgs_lookup ---
82 ;
83 ; On entry:     R0 == message tag (and default message)
84 ;
85 ; On exit:      R0 == pointer to located message
86 ;
87 ; Use:          Returns the real message from its tag. If the tag does not
88 ;               exist, then the default message is used. If that is not
89 ;               supplied, then the tag name itself is returned (ie. R0
90 ;               is preserved).
91
92                 IMPORT  msgs_lookup
93
94 ; --- msgs_init ---
95 ;
96 ; On entry:     --
97 ;
98 ; On exit:      --
99 ;
100 ; Use:          Initialises the message system.
101
102                 IMPORT  msgs_init
103
104                 ]
105
106 ;----- That's all, folks ----------------------------------------------------
107
108                 END