Subversion Repositories Kolibri OS

Rev

Rev 7597 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7597 Rev 7693
Line 1... Line 1...
1
(*
1
(*
2
    BSD 2-Clause License
2
    BSD 2-Clause License
Line 3... Line 3...
3
 
3
 
4
    Copyright (c) 2018, Anton Krotov
4
    Copyright (c) 2018, 2019, Anton Krotov
5
    All rights reserved.
5
    All rights reserved.
Line 6... Line 6...
6
*)
6
*)
Line 116... Line 116...
116
 
116
 
117
    INC(list.length)
117
    INC(list.length)
Line -... Line 118...
-
 
118
END PushByte;
-
 
119
 
-
 
120
 
-
 
121
PROCEDURE PushStr* (list: BYTELIST; str: ARRAY OF CHAR): INTEGER;
-
 
122
VAR
-
 
123
    i, res: INTEGER;
-
 
124
 
-
 
125
BEGIN
-
 
126
    res := list.length;
-
 
127
    i := 0;
-
 
128
    REPEAT
-
 
129
        PushByte(list, ORD(str[i]));
-
 
130
        INC(i)
-
 
131
    UNTIL str[i - 1] = 0X
-
 
132
 
-
 
133
    RETURN res
-
 
134
END PushStr;
-
 
135
 
-
 
136
 
-
 
137
PROCEDURE GetStr* (list: BYTELIST; pos: INTEGER; VAR str: ARRAY OF CHAR): BOOLEAN;
-
 
138
VAR
-
 
139
    i:   INTEGER;
-
 
140
    res: BOOLEAN;
-
 
141
 
-
 
142
BEGIN
-
 
143
    res := FALSE;
-
 
144
    i := 0;
-
 
145
    WHILE (pos < list.length) & (i < LEN(str)) & ~res DO
-
 
146
        str[i] := CHR(GetByte(list, pos));
-
 
147
        res := str[i] = 0X;
-
 
148
        INC(pos);
-
 
149
        INC(i)
-
 
150
    END
-
 
151
 
-
 
152
    RETURN res
118
END PushByte;
153
END GetStr;
119
 
154
 
120
 
155
 
Line 121... Line 156...
121
PROCEDURE WriteToFile* (file: WR.FILE; list: BYTELIST);
156
PROCEDURE WriteToFile* (file: WR.FILE; list: BYTELIST);