MsgTrans 2.9 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; > s.MsgTrans

;---------------------------------------------------------------------------
; MsgTrans_OpenFile
;
;       Out:    r0 -> message file block
;
;       Open our messages file.
;
MsgTrans_OpenFile
25
        Entry   "r1-r2"
Neil Turton's avatar
Neil Turton committed
26 27 28 29 30 31

        ADR     r0, message_block
        LDR     lr, flags
        TST     lr, #f_messagesopen
        EXIT    NE

Kevin Bracey's avatar
Kevin Bracey committed
32
        ADR     r1, message_file_name2
Neil Turton's avatar
Neil Turton committed
33 34
        MOV     r2, #0
        SWI     XMessageTrans_OpenFile
Kevin Bracey's avatar
Kevin Bracey committed
35

36 37 38
        ADRVS   r0, message_block
        ADRVS   r1, message_file_name
        MOVVS   r2, #0
Kevin Bracey's avatar
Kevin Bracey committed
39 40
        SWIVS   XMessageTrans_OpenFile

Neil Turton's avatar
Neil Turton committed
41 42 43 44 45 46 47 48 49 50 51 52 53
        LDRVC   lr, flags
        ORRVC   lr, lr, #f_messagesopen
        STRVC   lr, flags

        EXIT


;---------------------------------------------------------------------------
; MsgTrans_CloseFile
;
;       Close our messages file.
;
MsgTrans_CloseFile
54
        Entry   "r0,r1"
Neil Turton's avatar
Neil Turton committed
55 56 57 58 59 60 61 62

        ADR     r0, message_block
        LDR     r1, flags
        TST     r1, #f_messagesopen
        BICNE   r1, r1, #f_messagesopen
        STRNE   r1, flags
        SWINE   XMessageTrans_CloseFile

Stewart Brodie's avatar
Stewart Brodie committed
63
        EXIT
Neil Turton's avatar
Neil Turton committed
64 65 66 67 68 69 70 71 72 73 74


;---------------------------------------------------------------------------
; MsgTrans_ErrorLookup
;       In:     r0 -> token error block
;               r4-r7 -> optional parameters
;       Out:    r0 -> translated error block
;
;       Lookup an error in our messages file.
;
MsgTrans_ErrorLookup
75
        Entry   "r0-r2"
Neil Turton's avatar
Neil Turton committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

        CLRV
        BL      MsgTrans_OpenFile
        MOVVC   r1, r0
        LDRVC   r0, [sp]
        MOVVC   r2, #0
        SWIVC   XMessageTrans_ErrorLookup
        STR     r0, [sp]

        EXIT


;---------------------------------------------------------------------------
; MsgTrans_Lookup
;
;       In:     r1 -> token
;               r2 -> buffer (or 0)
;               r3 = size of buffer (if r2 non-zero)
;               r4-r7 = parameters
;       Out:    r2 -> translated string
;               r3 = size of result before terminator
;
;       Look up the given token in our messages file.
;
MsgTrans_Lookup
101
        Entry   "r0"
Neil Turton's avatar
Neil Turton committed
102 103 104 105 106 107 108 109

        CLRV
        BL      MsgTrans_OpenFile
        SWIVC   XMessageTrans_Lookup
        STRVS   r0, [sp]

        EXIT

Kevin Bracey's avatar
Kevin Bracey committed
110
message_file_name2
111 112
        DCB     "FilterManager:Messages",0
        ALIGN
Neil Turton's avatar
Neil Turton committed
113 114 115 116 117 118

message_file_name
        DCB     "Resources:$.Resources.FilterMgr.Messages",0
        ALIGN


Robert Sprowson's avatar
Robert Sprowson committed
119
        LNK     PreFilter.s