/[eiffelstudio]/FreeELKS/trunk/library/kernel/string_8.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/string_8.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91639 - (show annotations)
Thu Nov 6 13:22:41 2008 UTC (11 years, 2 months ago) by kwaxer
File size: 42864 byte(s)
Added new features to separate creation of an object and its modification that allows to avoid errors related to initialization of attributes in void-safe mode.
1 indexing
2 description: "[
3 Sequences of 8-bit characters, accessible through integer indices
4 in a contiguous range.
5 ]"
6 library: "Free implementation of ELKS library"
7 copyright: "Copyright (c) 1986-2008, Eiffel Software and others"
8 license: "Eiffel Forum License v2 (see forum.txt)"
9 date: "$Date$"
10 revision: "$Revision$"
11
12 class
13 STRING_8
14
15 inherit
16 READABLE_STRING_8
17 export
18 {ANY} make, make_empty, make_filled, make_from_c, make_from_string, fill_character
19 redefine
20 item, infix "@", area
21 end
22
23 STRING_GENERAL
24 rename
25 append as append_string_general,
26 same_string as same_string_general
27 undefine
28 copy, is_equal, out
29 redefine
30 append_string_general
31 end
32
33 INDEXABLE [CHARACTER_8, INTEGER]
34 rename
35 item as item
36 undefine
37 copy, is_equal, out
38 redefine
39 prune_all,
40 changeable_comparison_criterion
41 end
42
43 RESIZABLE [CHARACTER_8]
44 undefine
45 copy, is_equal, out
46 redefine
47 changeable_comparison_criterion
48 end
49
50 TO_SPECIAL [CHARACTER_8]
51 rename
52 item as item
53 undefine
54 copy, is_equal, out, item, infix "@", put, valid_index
55 redefine
56 area
57 end
58
59 MISMATCH_CORRECTOR
60 undefine
61 copy, is_equal, out
62 redefine
63 correct_mismatch
64 end
65
66 create
67 make,
68 make_empty,
69 make_filled,
70 make_from_string,
71 make_from_other_string,
72 make_from_c,
73 make_from_c_pointer,
74 make_from_cil
75
76 convert
77 to_cil: {SYSTEM_STRING},
78 make_from_cil ({SYSTEM_STRING}),
79 as_string_32: {READABLE_STRING_32, STRING_32, ?STRING_32}
80
81 feature -- Initialization
82
83 make_from_cil (a_system_string: SYSTEM_STRING)
84 -- Initialize Current with `a_system_string'.
85 local
86 l_count: INTEGER
87 do
88 if a_system_string /= Void then
89 l_count := a_system_string.length
90 end
91 make (l_count)
92 if l_count > 0 then
93 set_count (l_count)
94 dotnet_convertor.read_system_string_into (a_system_string, Current)
95 end
96 end
97
98 from_c (c_string: POINTER)
99 -- Reset contents of string from contents of `c_string',
100 -- a string created by some C function.
101 require
102 c_string_exists: c_string /= default_pointer
103 local
104 l_count: INTEGER
105 do
106 c_string_provider.share_from_pointer (c_string)
107 -- Resize string in case it is not big enough
108 l_count := c_string_provider.count
109 resize (l_count + 1)
110 count := l_count
111 internal_hash_code := 0
112 c_string_provider.read_string_into (Current)
113 ensure
114 no_zero_byte: not has ('%/0/')
115 -- characters: for all i in 1..count, item (i) equals
116 -- ASCII character at address c_string + (i - 1)
117 -- correct_count: the ASCII character at address c_string + count
118 -- is NULL
119 end
120
121 from_c_substring (c_string: POINTER; start_pos, end_pos: INTEGER)
122 -- Reset contents of string from substring of `c_string',
123 -- a string created by some C function.
124 require
125 c_string_exists: c_string /= default_pointer
126 start_position_big_enough: start_pos >= 1
127 end_position_big_enough: start_pos <= end_pos + 1
128 local
129 l_count: INTEGER
130 do
131 l_count := end_pos - start_pos + 1
132 c_string_provider.share_from_pointer_and_count (c_string + (start_pos - 1), l_count)
133 -- Resize string in case it is not big enough
134 resize (l_count + 1)
135 count := l_count
136 internal_hash_code := 0
137 c_string_provider.read_substring_into (Current, 1, l_count)
138 ensure
139 valid_count: count = end_pos - start_pos + 1
140 -- characters: for all i in 1..count, item (i) equals
141 -- ASCII character at address c_string + (i - 1)
142 end
143
144 adapt (s: STRING_8): like Current
145 -- Object of a type conforming to the type of `s',
146 -- initialized with attributes from `s'
147 do
148 Result := new_string (0)
149 Result.share (s)
150 ensure
151 adapt_not_void: Result /= Void
152 shared_implementation: Result.shared_with (s)
153 end
154
155 remake (n: INTEGER)
156 -- Allocate space for at least `n' characters.
157 obsolete
158 "Use `make' instead"
159 require
160 non_negative_size: n >= 0
161 do
162 make (n)
163 ensure
164 empty_string: count = 0
165 area_allocated: capacity >= n
166 end
167
168 feature -- Access
169
170 item, infix "@" (i: INTEGER): CHARACTER_8 assign put
171 -- Character at position `i'
172 do
173 Result := area.item (i - 1)
174 end
175
176 area: SPECIAL [CHARACTER_8]
177 -- Storage for characters
178
179 feature -- Status report
180
181 extendible: BOOLEAN = True
182 -- May new items be added? (Answer: yes.)
183
184 prunable: BOOLEAN
185 -- May items be removed? (Answer: yes.)
186 do
187 Result := True
188 end
189
190 changeable_comparison_criterion: BOOLEAN = False
191
192 feature -- Element change
193
194 set (t: like Current; n1, n2: INTEGER)
195 -- Set current string to substring of `t' from indices `n1'
196 -- to `n2', or to empty string if no such substring.
197 require
198 argument_not_void: t /= Void
199 local
200 s: STRING
201 do
202 s := t.substring (n1, n2)
203 area := s.area
204 count := s.count
205 internal_hash_code := 0
206 ensure
207 is_substring: is_equal (t.substring (n1, n2))
208 end
209
210 subcopy (other: like Current; start_pos, end_pos, index_pos: INTEGER)
211 -- Copy characters of `other' within bounds `start_pos' and
212 -- `end_pos' to current string starting at index `index_pos'.
213 require
214 other_not_void: other /= Void
215 valid_start_pos: other.valid_index (start_pos)
216 valid_end_pos: other.valid_index (end_pos)
217 valid_bounds: (start_pos <= end_pos) or (start_pos = end_pos + 1)
218 valid_index_pos: valid_index (index_pos)
219 enough_space: (count - index_pos) >= (end_pos - start_pos)
220 local
221 l_other_area, l_area: like area
222 do
223 l_other_area := other.area
224 l_area := area
225 if end_pos >= start_pos then
226 if l_area /= l_other_area then
227 l_area.copy_data (l_other_area, start_pos - 1, index_pos - 1,
228 end_pos - start_pos + 1)
229 else
230 l_area.overlapping_move (start_pos - 1, index_pos - 1,
231 end_pos - start_pos + 1)
232 end
233 internal_hash_code := 0
234 end
235 ensure
236 same_count: count = old count
237 copied: elks_checking implies
238 (is_equal (old substring (1, index_pos - 1) +
239 old other.substring (start_pos, end_pos) +
240 old substring (index_pos + (end_pos - start_pos + 1), count)))
241 end
242
243 replace_substring (s: READABLE_STRING_8; start_index, end_index: INTEGER)
244 -- Replace characters from `start_index' to `end_index' with `s'.
245 require
246 string_not_void: s /= Void
247 valid_start_index: 1 <= start_index
248 valid_end_index: end_index <= count
249 meaningfull_interval: start_index <= end_index + 1
250 local
251 new_size: INTEGER
252 diff: INTEGER
253 l_area: like area
254 s_count: INTEGER
255 old_count: INTEGER
256 do
257 s_count := s.count
258 old_count := count
259 diff := s_count - (end_index - start_index + 1)
260 new_size := diff + old_count
261 if diff > 0 then
262 -- We need to resize the string.
263 grow (new_size)
264 end
265
266 l_area := area
267 --| We move the end of the string forward (if diff is > 0), backward (if diff < 0),
268 --| and nothing otherwise.
269 if diff /= 0 then
270 l_area.overlapping_move (end_index, end_index + diff, old_count - end_index)
271 end
272 --| Set new count
273 set_count (new_size)
274 --| We copy the substring.
275 l_area.copy_data (s.area, 0, start_index - 1, s_count)
276 ensure
277 new_count: count = old count + old s.count - end_index + start_index - 1
278 replaced: elks_checking implies
279 (is_equal (old (substring (1, start_index - 1) +
280 s + substring (end_index + 1, count))))
281 end
282
283 replace_substring_all (original, new: like Current)
284 -- Replace every occurrence of `original' with `new'.
285 require
286 original_exists: original /= Void
287 new_exists: new /= Void
288 original_not_empty: not original.is_empty
289 local
290 l_first_pos, l_next_pos: INTEGER
291 l_orig_count, l_new_count, l_count: INTEGER
292 l_area, l_new_area: like area
293 l_offset: INTEGER
294 l_string_searcher: like string_searcher
295 do
296 if not is_empty then
297 l_count := count
298 l_string_searcher := string_searcher
299 l_string_searcher.initialize_deltas (original)
300 l_first_pos := l_string_searcher.substring_index_with_deltas (Current, original, 1, l_count)
301 if l_first_pos > 0 then
302 l_orig_count := original.count
303 l_new_count := new.count
304 if l_orig_count = l_new_count then
305 -- String will not be resized, simply perform character substitution
306 from
307 l_area := area
308 l_new_area := new.area
309 until
310 l_first_pos = 0
311 loop
312 l_area.copy_data (l_new_area, 0, l_first_pos - 1, l_new_count)
313 if l_first_pos + l_new_count <= l_count then
314 l_first_pos := l_string_searcher.substring_index_with_deltas (Current, original, l_first_pos + l_new_count, l_count)
315 else
316 l_first_pos := 0
317 end
318 end
319 elseif l_orig_count > l_new_count then
320 -- New string is smaller than previous string, we can optimize
321 -- substitution by only moving block between two occurrences of `orginal'.
322 from
323 l_next_pos := l_string_searcher.substring_index_with_deltas (Current, original, l_first_pos + l_orig_count, l_count)
324 l_area := area
325 l_new_area := new.area
326 until
327 l_next_pos = 0
328 loop
329 -- Copy new string into Current
330 l_area.copy_data (l_new_area, 0, l_first_pos - 1 - l_offset, l_new_count)
331 -- Shift characters between `l_first_pos' and `l_next_pos'
332 l_area.overlapping_move (l_first_pos + l_orig_count - 1,
333 l_first_pos + l_new_count - 1 - l_offset, l_next_pos - l_first_pos - l_orig_count)
334 l_first_pos := l_next_pos
335 l_offset := l_offset + (l_orig_count - l_new_count)
336 if l_first_pos + l_new_count <= l_count then
337 l_next_pos := l_string_searcher.substring_index_with_deltas (Current, original, l_first_pos + l_orig_count, l_count)
338 else
339 l_next_pos := 0
340 end
341 end
342 -- Perform final substitution:
343 -- Copy new string into Current
344 l_area.copy_data (l_new_area, 0, l_first_pos - 1 - l_offset, l_new_count)
345 -- Shift characters between `l_first_pos' and the end of the string
346 l_area.overlapping_move (l_first_pos + l_orig_count - 1,
347 l_first_pos + l_new_count - 1 - l_offset, l_count + 1 - l_first_pos - l_orig_count)
348 -- Perform last substitution
349 l_offset := l_offset + (l_orig_count - l_new_count)
350
351 -- Update `count'
352 set_count (l_count - l_offset)
353 else
354 -- Optimization is harder as we don't know how many times we need to resize
355 -- the string. For now, we do like we did in our previous implementation
356 from
357 until
358 l_first_pos = 0
359 loop
360 replace_substring (new, l_first_pos, l_first_pos + l_orig_count - 1)
361 l_count := count
362 if l_first_pos + l_new_count <= l_count then
363 l_first_pos := l_string_searcher.substring_index_with_deltas (Current, original, l_first_pos + l_new_count, l_count)
364 else
365 l_first_pos := 0
366 end
367 end
368 end
369 internal_hash_code := 0
370 end
371 end
372 end
373
374 replace_blank
375 -- Replace all current characters with blanks.
376 do
377 fill_with (' ')
378 ensure
379 same_size: (count = old count) and (capacity >= old capacity)
380 all_blank: elks_checking implies occurrences (' ') = count
381 end
382
383 fill_blank
384 -- Fill with `capacity' blank characters.
385 do
386 fill_character (' ')
387 ensure
388 filled: full
389 same_size: (count = capacity) and (capacity = old capacity)
390 -- all_blank: For every `i' in `count'..`capacity', `item' (`i') = `Blank'
391 end
392
393 fill_with (c: CHARACTER_8)
394 -- Replace every character with `c'.
395 local
396 l_count: INTEGER
397 do
398 l_count := count
399 if l_count /= 0 then
400 area.fill_with (c, 0, count - 1)
401 internal_hash_code := 0
402 end
403 ensure
404 same_count: (count = old count) and (capacity >= old capacity)
405 filled: elks_checking implies occurrences (c) = count
406 end
407
408 replace_character (c: CHARACTER_8)
409 -- Replace every character with `c'.
410 obsolete
411 "ELKS 2001: use `fill_with' instead'"
412 do
413 fill_with (c)
414 ensure
415 same_count: (count = old count) and (capacity >= old capacity)
416 filled: elks_checking implies occurrences (c) = count
417 end
418
419 head (n: INTEGER)
420 -- Remove all characters except for the first `n';
421 -- do nothing if `n' >= `count'.
422 obsolete
423 "ELKS 2001: use `keep_head' instead'"
424 require
425 non_negative_argument: n >= 0
426 do
427 keep_head (n)
428 ensure
429 new_count: count = n.min (old count)
430 kept: elks_checking implies is_equal (old substring (1, n.min (count)))
431 end
432
433 keep_head (n: INTEGER)
434 -- Remove all characters except for the first `n';
435 -- do nothing if `n' >= `count'.
436 require
437 non_negative_argument: n >= 0
438 do
439 if n < count then
440 count := n
441 internal_hash_code := 0
442 end
443 ensure
444 new_count: count = n.min (old count)
445 kept: elks_checking implies is_equal (old substring (1, n.min (count)))
446 end
447
448 tail (n: INTEGER)
449 -- Remove all characters except for the last `n';
450 -- do nothing if `n' >= `count'.
451 obsolete
452 "ELKS 2001: use `keep_tail' instead'"
453 require
454 non_negative_argument: n >= 0
455 do
456 keep_tail (n)
457 ensure
458 new_count: count = n.min (old count)
459 kept: elks_checking implies is_equal (old substring (count - n.min(count) + 1, count))
460 end
461
462 keep_tail (n: INTEGER)
463 -- Remove all characters except for the last `n';
464 -- do nothing if `n' >= `count'.
465 require
466 non_negative_argument: n >= 0
467 local
468 nb: like count
469 do
470 nb := count
471 if n < nb then
472 area.overlapping_move (nb - n, 0, n)
473 count := n
474 internal_hash_code := 0
475 end
476 ensure
477 new_count: count = n.min (old count)
478 kept: elks_checking implies is_equal (old substring (count - n.min(count) + 1, count))
479 end
480
481 left_adjust
482 -- Remove leading whitespace.
483 local
484 nb, nb_space: INTEGER
485 l_area: like area
486 do
487 -- Compute number of spaces at the left of current string.
488 from
489 nb := count - 1
490 l_area := area
491 until
492 nb_space > nb or else not l_area.item (nb_space).is_space
493 loop
494 nb_space := nb_space + 1
495 end
496
497 if nb_space > 0 then
498 -- Set new count value.
499 nb := nb + 1 - nb_space
500 -- Shift characters to the left.
501 l_area.overlapping_move (nb_space, 0, nb)
502 -- Set new count.
503 count := nb
504 internal_hash_code := 0
505 end
506 ensure
507 valid_count: count <= old count
508 new_count: not is_empty implies not item (1).is_space
509 kept: elks_checking implies is_equal ((old twin).substring (old count - count + 1, old count))
510 end
511
512 right_adjust
513 -- Remove trailing whitespace.
514 local
515 i, nb: INTEGER
516 nb_space: INTEGER
517 l_area: like area
518 do
519 -- Compute number of spaces at the right of current string.
520 from
521 nb := count - 1
522 i := nb
523 l_area := area
524 until
525 i < 0 or else not l_area.item (i).is_space
526 loop
527 nb_space := nb_space + 1
528 i := i - 1
529 end
530
531 if nb_space > 0 then
532 -- Set new count.
533 count := nb + 1 - nb_space
534 internal_hash_code := 0
535 end
536 ensure
537 valid_count: count <= old count
538 new_count: (count /= 0) implies
539 ((item (count) /= ' ') and
540 (item (count) /= '%T') and
541 (item (count) /= '%R') and
542 (item (count) /= '%N'))
543 kept: elks_checking implies is_equal ((old twin).substring (1, count))
544 end
545
546 share (other: STRING_8)
547 -- Make current string share the text of `other'.
548 -- Subsequent changes to the characters of current string
549 -- will also affect `other', and conversely.
550 require
551 argument_not_void: other /= Void
552 do
553 area := other.area
554 count := other.count
555 internal_hash_code := 0
556 ensure
557 shared_count: other.count = count
558 shared_area: other.area = area
559 end
560
561 put (c: CHARACTER_8; i: INTEGER)
562 -- Replace character at position `i' by `c'.
563 do
564 area.put (c, i - 1)
565 internal_hash_code := 0
566 ensure then
567 stable_count: count = old count
568 stable_before_i: elks_checking implies substring (1, i - 1).is_equal (old substring (1, i - 1))
569 stable_after_i: elks_checking implies substring (i + 1, count).is_equal (old substring (i + 1, count))
570 end
571
572 put_code (v: NATURAL_32; i: INTEGER)
573 -- Replace character at position `i' by character of code `v'.
574 do
575 area.put (v.to_character_8, i - 1)
576 internal_hash_code := 0
577 end
578
579 precede, prepend_character (c: CHARACTER_8)
580 -- Add `c' at front.
581 local
582 l_area: like area
583 do
584 if count = capacity then
585 resize (count + additional_space)
586 end
587 l_area := area
588 l_area.overlapping_move (0, 1, count)
589 l_area.put (c, 0)
590 count := count + 1
591 internal_hash_code := 0
592 ensure
593 new_count: count = old count + 1
594 end
595
596 prepend (s: READABLE_STRING_8)
597 -- Prepend a copy of `s' at front.
598 require
599 argument_not_void: s /= Void
600 do
601 insert_string (s, 1)
602 ensure
603 new_count: count = old (count + s.count)
604 inserted: elks_checking implies string.is_equal (old (s.twin.as_string_8) + old substring (1, count))
605 end
606
607 prepend_boolean (b: BOOLEAN)
608 -- Prepend the string representation of `b' at front.
609 do
610 prepend (b.out)
611 end
612
613 prepend_double (d: DOUBLE)
614 -- Prepend the string representation of `d' at front.
615 do
616 prepend (d.out)
617 end
618
619 prepend_integer (i: INTEGER)
620 -- Prepend the string representation of `i' at front.
621 do
622 prepend (i.out)
623 end
624
625 prepend_real (r: REAL)
626 -- Prepend the string representation of `r' at front.
627 do
628 prepend (r.out)
629 end
630
631 prepend_string (s: READABLE_STRING_8)
632 -- Prepend a copy of `s', if not void, at front.
633 do
634 if s /= Void then
635 prepend (s)
636 end
637 end
638
639 append_string_general (s: READABLE_STRING_GENERAL)
640 -- Append a copy of `s' at end.
641 do
642 if {l_s8: READABLE_STRING_8} s then
643 append (l_s8)
644 else
645 Precursor {STRING_GENERAL} (s)
646 end
647 end
648
649 append (s: READABLE_STRING_8)
650 -- Append a copy of `s' at end.
651 require
652 argument_not_void: s /= Void
653 local
654 l_count, l_s_count, l_new_size: INTEGER
655 do
656 l_s_count := s.count
657 if l_s_count > 0 then
658 l_count := count
659 l_new_size := l_s_count + l_count
660 if l_new_size > capacity then
661 resize (l_new_size + additional_space)
662 end
663 area.copy_data (s.area, 0, l_count, l_s_count)
664 count := l_new_size
665 internal_hash_code := 0
666 end
667 ensure
668 new_count: count = old count + old s.count
669 appended: elks_checking implies is_equal (old twin + old s.twin)
670 end
671
672 infix "+" (s: READABLE_STRING_8): like Current
673 -- Append a copy of 's' at the end of a copy of Current,
674 -- Then return the Result.
675 do
676 Result := new_string (count + s.count)
677 Result.append (Current)
678 Result.append (s)
679 end
680
681 append_string (s: READABLE_STRING_8)
682 -- Append a copy of `s', if not void, at end.
683 do
684 if s /= Void then
685 append (s)
686 end
687 ensure
688 appended: s /= Void implies
689 (elks_checking implies is_equal (old twin + old s.twin))
690 end
691
692 append_integer (i: INTEGER)
693 -- Append the string representation of `i' at end.
694 local
695 l_value: INTEGER
696 l_starting_index, l_ending_index: INTEGER
697 l_temp: CHARACTER_8
698 l_area: like area
699 do
700 if i = 0 then
701 append_character ('0')
702 else
703 -- Extract integer value digit by digit from right to left.
704 from
705 l_starting_index := count
706 if i < 0 then
707 append_character ('-')
708 l_starting_index := l_starting_index + 1
709 -- Special case for minimum integer value as negating it
710 -- as no effect.
711 if i = {INTEGER}.Min_value then
712 append_character ('8')
713 l_value := -(i // 10)
714 else
715 l_value := -i
716 end
717 else
718 l_value := i
719 end
720 until
721 l_value = 0
722 loop
723 append_character (((l_value \\ 10)+ 48).to_character_8)
724 l_value := l_value // 10
725 end
726
727 -- Now put digits in correct order from left to right.
728 from
729 l_ending_index := count - 1
730 l_area := area
731 until
732 l_starting_index >= l_ending_index
733 loop
734 l_temp := l_area.item (l_starting_index)
735 l_area.put (l_area.item (l_ending_index), l_starting_index)
736 l_area.put (l_temp, l_ending_index)
737 l_ending_index := l_ending_index - 1
738 l_starting_index := l_starting_index + 1
739 end
740 end
741 end
742
743 append_integer_8 (i: INTEGER_8)
744 -- Append the string representation of `i' at end.
745 local
746 l_value: INTEGER_8
747 l_starting_index, l_ending_index: INTEGER
748 l_temp: CHARACTER_8
749 l_area: like area
750 do
751 if i = 0 then
752 append_character ('0')
753 else
754 -- Extract integer value digit by digit from right to left.
755 from
756 l_starting_index := count
757 if i < 0 then
758 append_character ('-')
759 l_starting_index := l_starting_index + 1
760 -- Special case for minimum integer value as negating it
761 -- as no effect.
762 if i = {INTEGER_8}.Min_value then
763 append_character ('8')
764 l_value := -(i // 10)
765 else
766 l_value := -i
767 end
768 else
769 l_value := i
770 end
771 until
772 l_value = 0
773 loop
774 append_character (((l_value \\ 10)+ 48).to_character_8)
775 l_value := l_value // 10
776 end
777
778 -- Now put digits in correct order from left to right.
779 from
780 l_ending_index := count - 1
781 l_area := area
782 until
783 l_starting_index >= l_ending_index
784 loop
785 l_temp := l_area.item (l_starting_index)
786 l_area.put (l_area.item (l_ending_index), l_starting_index)
787 l_area.put (l_temp, l_ending_index)
788 l_ending_index := l_ending_index - 1
789 l_starting_index := l_starting_index + 1
790 end
791 end
792 end
793
794 append_integer_16 (i: INTEGER_16)
795 -- Append the string representation of `i' at end.
796 local
797 l_value: INTEGER_16
798 l_starting_index, l_ending_index: INTEGER
799 l_temp: CHARACTER_8
800 l_area: like area
801 do
802 if i = 0 then
803 append_character ('0')
804 else
805 -- Extract integer value digit by digit from right to left.
806 from
807 l_starting_index := count
808 if i < 0 then
809 append_character ('-')
810 l_starting_index := l_starting_index + 1
811 -- Special case for minimum integer value as negating it
812 -- as no effect.
813 if i = {INTEGER_16}.Min_value then
814 append_character ('8')
815 l_value := -(i // 10)
816 else
817 l_value := -i
818 end
819 else
820 l_value := i
821 end
822 until
823 l_value = 0
824 loop
825 append_character (((l_value \\ 10)+ 48).to_character_8)
826 l_value := l_value // 10
827 end
828
829 -- Now put digits in correct order from left to right.
830 from
831 l_ending_index := count - 1
832 l_area := area
833 until
834 l_starting_index >= l_ending_index
835 loop
836 l_temp := l_area.item (l_starting_index)
837 l_area.put (l_area.item (l_ending_index), l_starting_index)
838 l_area.put (l_temp, l_ending_index)
839 l_ending_index := l_ending_index - 1
840 l_starting_index := l_starting_index + 1
841 end
842 end
843 end
844
845 append_integer_64 (i: INTEGER_64)
846 -- Append the string representation of `i' at end.
847 local
848 l_value: INTEGER_64
849 l_starting_index, l_ending_index: INTEGER
850 l_temp: CHARACTER_8
851 l_area: like area
852 do
853 if i = 0 then
854 append_character ('0')
855 else
856 -- Extract integer value digit by digit from right to left.
857 from
858 l_starting_index := count
859 if i < 0 then
860 append_character ('-')
861 l_starting_index := l_starting_index + 1
862 -- Special case for minimum integer value as negating it
863 -- as no effect.
864 if i = {INTEGER_64}.Min_value then
865 append_character ('8')
866 l_value := -(i // 10)
867 else
868 l_value := -i
869 end
870 else
871 l_value := i
872 end
873 until
874 l_value = 0
875 loop
876 append_character (((l_value \\ 10)+ 48).to_character_8)
877 l_value := l_value // 10
878 end
879
880 -- Now put digits in correct order from left to right.
881 from
882 l_ending_index := count - 1
883 l_area := area
884 until
885 l_starting_index >= l_ending_index
886 loop
887 l_temp := l_area.item (l_starting_index)
888 l_area.put (l_area.item (l_ending_index), l_starting_index)
889 l_area.put (l_temp, l_ending_index)
890 l_ending_index := l_ending_index - 1
891 l_starting_index := l_starting_index + 1
892 end
893 end
894 end
895
896 append_natural_8 (i: NATURAL_8)
897 -- Append the string representation of `i' at end.
898 local
899 l_value: NATURAL_8
900 l_starting_index, l_ending_index: INTEGER
901 l_temp: CHARACTER_8
902 l_area: like area
903 do
904 if i = 0 then
905 append_character ('0')
906 else
907 -- Extract integer value digit by digit from right to left.
908 from
909 l_starting_index := count
910 l_value := i
911 until
912 l_value = 0
913 loop
914 append_character (((l_value \\ 10)+ 48).to_character_8)
915 l_value := l_value // 10
916 end
917
918 -- Now put digits in correct order from left to right.
919 from
920 l_ending_index := count - 1
921 l_area := area
922 until
923 l_starting_index >= l_ending_index
924 loop
925 l_temp := l_area.item (l_starting_index)
926 l_area.put (l_area.item (l_ending_index), l_starting_index)
927 l_area.put (l_temp, l_ending_index)
928 l_ending_index := l_ending_index - 1
929 l_starting_index := l_starting_index + 1
930 end
931 end
932 end
933
934 append_natural_16 (i: NATURAL_16)
935 -- Append the string representation of `i' at end.
936 local
937 l_value: NATURAL_16
938 l_starting_index, l_ending_index: INTEGER
939 l_temp: CHARACTER_8
940 l_area: like area
941 do
942 if i = 0 then
943 append_character ('0')
944 else
945 -- Extract integer value digit by digit from right to left.
946 from
947 l_starting_index := count
948 l_value := i
949 until
950 l_value = 0
951 loop
952 append_character (((l_value \\ 10)+ 48).to_character_8)
953 l_value := l_value // 10
954 end
955
956 -- Now put digits in correct order from left to right.
957 from
958 l_ending_index := count - 1
959 l_area := area
960 until
961 l_starting_index >= l_ending_index
962 loop
963 l_temp := l_area.item (l_starting_index)
964 l_area.put (l_area.item (l_ending_index), l_starting_index)
965 l_area.put (l_temp, l_ending_index)
966 l_ending_index := l_ending_index - 1
967 l_starting_index := l_starting_index + 1
968 end
969 end
970 end
971
972 append_natural_32 (i: NATURAL_32)
973 -- Append the string representation of `i' at end.
974 local
975 l_value: NATURAL_32
976 l_starting_index, l_ending_index: INTEGER
977 l_temp: CHARACTER_8
978 l_area: like area
979 do
980 if i = 0 then
981 append_character ('0')
982 else
983 -- Extract integer value digit by digit from right to left.
984 from
985 l_starting_index := count
986 l_value := i
987 until
988 l_value = 0
989 loop
990 append_character (((l_value \\ 10)+ 48).to_character_8)
991 l_value := l_value // 10
992 end
993
994 -- Now put digits in correct order from left to right.
995 from
996 l_ending_index := count - 1
997 l_area := area
998 until
999 l_starting_index >= l_ending_index
1000 loop
1001 l_temp := l_area.item (l_starting_index)
1002 l_area.put (l_area.item (l_ending_index), l_starting_index)
1003 l_area.put (l_temp, l_ending_index)
1004 l_ending_index := l_ending_index - 1
1005 l_starting_index := l_starting_index + 1
1006 end
1007 end
1008 end
1009
1010 append_natural_64 (i: NATURAL_64)
1011 -- Append the string representation of `i' at end.
1012 local
1013 l_value: NATURAL_64
1014 l_starting_index, l_ending_index: INTEGER
1015 l_temp: CHARACTER_8
1016 l_area: like area
1017 do
1018 if i = 0 then
1019 append_character ('0')
1020 else
1021 -- Extract integer value digit by digit from right to left.
1022 from
1023 l_starting_index := count
1024 l_value := i
1025 until
1026 l_value = 0
1027 loop
1028 append_character (((l_value \\ 10)+ 48).to_character_8)
1029 l_value := l_value // 10
1030 end
1031
1032 -- Now put digits in correct order from left to right.
1033 from
1034 l_ending_index := count - 1
1035 l_area := area
1036 until
1037 l_starting_index >= l_ending_index
1038 loop
1039 l_temp := l_area.item (l_starting_index)
1040 l_area.put (l_area.item (l_ending_index), l_starting_index)
1041 l_area.put (l_temp, l_ending_index)
1042 l_ending_index := l_ending_index - 1
1043 l_starting_index := l_starting_index + 1
1044 end
1045 end
1046 end
1047
1048 append_real (r: REAL)
1049 -- Append the string representation of `r' at end.
1050 do
1051 append (r.out)
1052 end
1053
1054 append_double (d: DOUBLE)
1055 -- Append the string representation of `d' at end.
1056 do
1057 append (d.out)
1058 end
1059
1060 append_character, extend (c: CHARACTER_8)
1061 -- Append `c' at end.
1062 local
1063 current_count: INTEGER
1064 do
1065 current_count := count
1066 if current_count = capacity then
1067 resize (current_count + additional_space)
1068 end
1069 area.put (c, current_count)
1070 count := current_count + 1
1071 internal_hash_code := 0
1072 ensure then
1073 item_inserted: item (count) = c
1074 new_count: count = old count + 1
1075 stable_before: elks_checking implies substring (1, count - 1).is_equal (old twin)
1076 end
1077
1078 append_boolean (b: BOOLEAN)
1079 -- Append the string representation of `b' at end.
1080 do
1081 append (b.out)
1082 end
1083
1084 insert (s: READABLE_STRING_8; i: INTEGER)
1085 -- Add `s' to left of position `i' in current string.
1086 obsolete
1087 "ELKS 2001: use `insert_string' instead"
1088 require
1089 string_exists: s /= Void
1090 index_small_enough: i <= count + 1
1091 index_large_enough: i > 0
1092 do
1093 insert_string (s, i)
1094 ensure
1095 inserted: elks_checking implies
1096 (is_equal (old substring (1, i - 1) + old (s.twin) + old substring (i, count)))
1097 end
1098
1099 insert_string (s: READABLE_STRING_8; i: INTEGER)
1100 -- Insert `s' at index `i', shifting characters between ranks
1101 -- `i' and `count' rightwards.
1102 require
1103 string_exists: s /= Void
1104 valid_insertion_index: 1 <= i and i <= count + 1
1105 local
1106 pos, new_size: INTEGER
1107 l_s_count: INTEGER
1108 l_area: like area
1109 do
1110 -- Insert `s' if `s' is not empty, otherwise is useless.
1111 l_s_count := s.count
1112 if l_s_count /= 0 then
1113 -- Resize Current if necessary.
1114 new_size := l_s_count + count
1115 if new_size > capacity then
1116 resize (new_size + additional_space)
1117 end
1118
1119 -- Perform all operations using a zero based arrays.
1120 l_area := area
1121 pos := i - 1
1122
1123 -- First shift from `s.count' position all characters starting at index `pos'.
1124 l_area.overlapping_move (pos, pos + l_s_count, count - pos)
1125
1126 -- Copy string `s' at index `pos'.
1127 l_area.copy_data (s.area, 0, pos, l_s_count)
1128
1129 count := new_size
1130 internal_hash_code := 0
1131 end
1132 ensure
1133 inserted: elks_checking implies
1134 (is_equal (old substring (1, i - 1) + old (s.twin) + old substring (i, count)))
1135 end
1136
1137 insert_character (c: CHARACTER_8; i: INTEGER)
1138 -- Insert `c' at index `i', shifting characters between ranks
1139 -- `i' and `count' rightwards.
1140 require
1141 valid_insertion_index: 1 <= i and i <= count + 1
1142 local
1143 pos, new_size: INTEGER
1144 l_area: like area
1145 do
1146 -- Resize Current if necessary.
1147 new_size := 1 + count
1148 if new_size > capacity then
1149 resize (new_size + additional_space)
1150 end
1151
1152 -- Perform all operations using a zero based arrays.
1153 pos := i - 1
1154 l_area := area
1155
1156 -- First shift from `s.count' position all characters starting at index `pos'.
1157 l_area.overlapping_move (pos, pos + 1, count - pos)
1158
1159 -- Insert new character
1160 l_area.put (c, pos)
1161
1162 count := new_size
1163 internal_hash_code := 0
1164 ensure
1165 one_more_character: count = old count + 1
1166 inserted: item (i) = c
1167 stable_before_i: elks_checking implies substring (1, i - 1).is_equal (old substring (1, i - 1))
1168 stable_after_i: elks_checking implies substring (i + 1, count).is_equal (old substring (i, count))
1169 end
1170
1171 feature -- Removal
1172
1173 remove (i: INTEGER)
1174 -- Remove `i'-th character.
1175 local
1176 l_count: INTEGER
1177 do
1178 l_count := count
1179 -- Shift characters to the left.
1180 area.overlapping_move (i, i - 1, l_count - i)
1181 -- Update content.
1182 count := l_count - 1
1183 internal_hash_code := 0
1184 end
1185
1186 remove_head (n: INTEGER)
1187 -- Remove first `n' characters;
1188 -- if `n' > `count', remove all.
1189 require
1190 n_non_negative: n >= 0
1191 do
1192 if n > count then
1193 count := 0
1194 internal_hash_code := 0
1195 else
1196 keep_tail (count - n)
1197 end
1198 ensure
1199 removed: elks_checking implies is_equal (old substring (n.min (count) + 1, count))
1200 end
1201
1202 remove_substring (start_index, end_index: INTEGER)
1203 -- Remove all characters from `start_index'
1204 -- to `end_index' inclusive.
1205 require
1206 valid_start_index: 1 <= start_index
1207 valid_end_index: end_index <= count
1208 meaningful_interval: start_index <= end_index + 1
1209 local
1210 l_count, nb_removed: INTEGER
1211 do
1212 nb_removed := end_index - start_index + 1
1213 if nb_removed > 0 then
1214 l_count := count
1215 area.overlapping_move (start_index + nb_removed - 1, start_index - 1, l_count - end_index)
1216 count := l_count - nb_removed
1217 end
1218 ensure
1219 removed: elks_checking implies
1220 is_equal (old substring (1, start_index - 1) + old substring (end_index + 1, count))
1221 end
1222
1223 remove_tail (n: INTEGER)
1224 -- Remove last `n' characters;
1225 -- if `n' > `count', remove all.
1226 require
1227 n_non_negative: n >= 0
1228 local
1229 l_count: INTEGER
1230 do
1231 l_count := count
1232 if n > l_count then
1233 count := 0
1234 internal_hash_code := 0
1235 else
1236 keep_head (l_count - n)
1237 end
1238 ensure
1239 removed: elks_checking implies is_equal (old substring (1, count - n.min (count)))
1240 end
1241
1242 prune (c: CHARACTER_8)
1243 -- Remove first occurrence of `c', if any.
1244 require else
1245 True
1246 local
1247 counter: INTEGER
1248 do
1249 from
1250 counter := 1
1251 until
1252 counter > count or else (item (counter) = c)
1253 loop
1254 counter := counter + 1
1255 end
1256 if counter <= count then
1257 remove (counter)
1258 end
1259 end
1260
1261 prune_all (c: CHARACTER_8)
1262 -- Remove all occurrences of `c'.
1263 require else
1264 True
1265 local
1266 i, j, nb: INTEGER
1267 l_area: like area
1268 l_char: CHARACTER_8
1269 do
1270 -- Traverse string and shift characters to the left
1271 -- each time we find an occurrence of `c'.
1272 from
1273 l_area := area
1274 nb := count
1275 until
1276 i = nb
1277 loop
1278 l_char := l_area.item (i)
1279 if l_char /= c then
1280 l_area.put (l_char, j)
1281 j := j + 1
1282 end
1283 i := i + 1
1284 end
1285 count := j
1286 internal_hash_code := 0
1287 ensure then
1288 changed_count: count = (old count) - (old occurrences (c))
1289 -- removed: For every `i' in 1..`count', `item' (`i') /= `c'
1290 end
1291
1292 prune_all_leading (c: CHARACTER_8)
1293 -- Remove all leading occurrences of `c'.
1294 do
1295 from
1296 until
1297 is_empty or else item (1) /= c
1298 loop
1299 remove (1)
1300 end
1301 end
1302
1303 prune_all_trailing (c: CHARACTER_8)
1304 -- Remove all trailing occurrences of `c'.
1305 do
1306 from
1307 until
1308 is_empty or else item (count) /= c
1309 loop
1310 remove (count)
1311 end
1312 end
1313
1314 wipe_out
1315 -- Remove all characters.
1316 do
1317 create area.make (1)
1318 count := 0
1319 internal_hash_code := 0
1320 ensure then
1321 is_empty: count = 0
1322 empty_capacity: capacity = 0
1323 end
1324
1325 clear_all
1326 -- Reset all characters.
1327 do
1328 count := 0
1329 internal_hash_code := 0
1330 ensure
1331 is_empty: count = 0
1332 same_capacity: capacity = old capacity
1333 end
1334
1335 feature -- Resizing
1336
1337 adapt_size
1338 -- Adapt the size to accommodate `count' characters.
1339 do
1340 resize (count)
1341 end
1342
1343 resize (newsize: INTEGER)
1344 -- Rearrange string so that it can accommodate
1345 -- at least `newsize' characters.
1346 -- Do not lose any previously entered character.
1347 local
1348 area_count: INTEGER
1349 do
1350 area_count := area.count
1351 if newsize >= area_count then
1352 area := area.aliased_resized_area (newsize + 1)
1353 end
1354 end
1355
1356 grow (newsize: INTEGER)
1357 -- Ensure that the capacity is at least `newsize'.
1358 do
1359 if newsize > capacity then
1360 resize (newsize)
1361 end
1362 end
1363
1364 feature -- Conversion
1365
1366 as_lower: like Current
1367 -- New object with all letters in lower case.
1368 do
1369 Result := twin
1370 Result.to_lower
1371 end
1372
1373 as_upper: like Current
1374 -- New object with all letters in upper case
1375 do
1376 Result := twin
1377 Result.to_upper
1378 end
1379
1380 left_justify
1381 -- Left justify Current using `count' as witdth.
1382 local
1383 i, nb: INTEGER
1384 l_area: like area
1385 do
1386 -- Remove leading white spaces.
1387 nb := count
1388 left_adjust
1389
1390 -- Get new count
1391 i := count
1392 if i < nb then
1393 -- `left_adjust' did remove some characters, so we need to add
1394 -- some white spaces at the end of the string.
1395 from
1396 l_area := area
1397 until
1398 i = nb
1399 loop
1400 l_area.put (' ', i)
1401 i := i + 1
1402 end
1403 -- Restore `count'
1404 count := nb
1405 internal_hash_code := 0
1406 end
1407 end
1408
1409 center_justify
1410 -- Center justify Current using `count' as width.
1411 local
1412 i, nb, l_offset: INTEGER
1413 left_nb_space, right_nb_space: INTEGER
1414 l_area: like area
1415 do
1416 -- Compute number of spaces at the left of current string.
1417 from
1418 nb := count
1419 l_area := area
1420 until
1421 left_nb_space = nb or else not l_area.item (left_nb_space).is_space
1422 loop
1423 left_nb_space := left_nb_space + 1
1424 end
1425
1426 -- Compute number of spaces at the right of current string.
1427 from
1428 i := nb - 1
1429 l_area := area
1430 until
1431 i = -1 or else not l_area.item (i).is_space
1432 loop
1433 right_nb_space := right_nb_space + 1
1434 i := i - 1
1435 end
1436
1437 -- We encourage that more spaces will be put to the left, when
1438 -- number of spaces is not even.
1439 l_offset := left_nb_space + right_nb_space
1440 if l_offset \\ 2 = 0 then
1441 l_offset := left_nb_space - l_offset // 2
1442 else
1443 l_offset := left_nb_space - l_offset // 2 - 1
1444 end
1445 if l_offset = 0 then
1446 -- Nothing to be done.
1447 else
1448 -- Shift characters to the right or left (depending on sign of
1449 -- `l_offset' by `l_offset' position.
1450 l_area.move_data (left_nb_space, left_nb_space - l_offset,
1451 nb - left_nb_space - right_nb_space)
1452
1453 if l_offset < 0 then
1454 -- Fill left part with spaces.
1455 l_area.fill_with (' ', left_nb_space, left_nb_space - l_offset - 1)
1456 else
1457 -- Fill right part with spaces.
1458 l_area.fill_with (' ', nb - right_nb_space - l_offset, nb - 1)
1459 end
1460 internal_hash_code := 0
1461 end
1462 end
1463
1464 right_justify
1465 -- Right justify Current using `count' as width.
1466 local
1467 i, nb: INTEGER
1468 nb_space: INTEGER
1469 l_area: like area
1470 do
1471 nb := count
1472 right_adjust
1473 i := count
1474 nb_space := nb - i
1475 if nb_space > 0 then
1476 -- Shift characters to the right.
1477 from
1478 l_area := area
1479 until
1480 i = 0
1481 loop
1482 i := i - 1
1483 l_area.put (l_area.item (i), i + nb_space)
1484 variant
1485 i + 1
1486 end
1487
1488 -- Fill left part with spaces.
1489 from
1490 until
1491 nb_space = 0
1492 loop
1493 nb_space := nb_space - 1
1494 l_area.put (' ', nb_space)
1495 variant
1496 nb_space + 1
1497 end
1498 -- Restore `count'
1499 count := nb
1500 internal_hash_code := 0
1501 end
1502 ensure
1503 same_count: count = old count
1504 end
1505
1506 character_justify (pivot: CHARACTER_8; position: INTEGER)
1507 -- Justify a string based on a `pivot'
1508 -- and the `position' it needs to be in
1509 -- the final string.
1510 -- This will grow the string if necessary
1511 -- to get the pivot in the correct place.
1512 require
1513 valid_position: position <= capacity
1514 positive_position: position >= 1
1515 pivot_not_space: pivot /= ' '
1516 not_empty: not is_empty
1517 local
1518 l_index_of_pivot, l_new_size: INTEGER
1519 l_area: like area
1520 do
1521 l_index_of_pivot := index_of (pivot, 1)
1522 if l_index_of_pivot /= 0 then
1523 if l_index_of_pivot < position then
1524 -- We need to resize Current so that we can shift Current by
1525 -- `l_index_of_pivot - position'.
1526 l_new_size := count + position - l_index_of_pivot
1527 grow (l_new_size)
1528 l_area := area
1529 l_area.move_data (0, position - l_index_of_pivot, count)
1530 l_area.fill_with (' ', 0, position - l_index_of_pivot - 1)
1531 count := l_new_size
1532 else
1533 -- Simply shift content to the left and reset trailing with spaces.
1534 l_area := area
1535 l_area.move_data (l_index_of_pivot - position, 0, count - l_index_of_pivot + position)
1536 l_area.fill_with (' ', count - l_index_of_pivot + position, count - 1)
1537 end
1538 internal_hash_code := 0
1539 end
1540 end
1541
1542 to_lower
1543 -- Convert to lower case.
1544 do
1545 to_lower_area (area, 0, count - 1)
1546 internal_hash_code := 0
1547 ensure
1548 length_and_content: elks_checking implies is_equal (old as_lower)
1549 end
1550
1551 to_upper
1552 -- Convert to upper case.
1553 do
1554 to_upper_area (area, 0, count - 1)
1555 internal_hash_code := 0
1556 ensure
1557 length_and_content: elks_checking implies is_equal (old as_upper)
1558 end
1559
1560 linear_representation: LINEAR [CHARACTER_8]
1561 -- Representation as a linear structure
1562 local
1563 temp: ARRAYED_LIST [CHARACTER_8]
1564 i: INTEGER
1565 do
1566 create temp.make (capacity)
1567 from
1568 i := 1
1569 until
1570 i > count
1571 loop
1572 temp.extend (item (i))
1573 i := i + 1
1574 end
1575 Result := temp
1576 end
1577
1578 frozen to_c: ANY
1579 -- A reference to a C form of current string.
1580 -- Useful only for interfacing with C software.
1581 require
1582 not_is_dotnet: not {PLATFORM}.is_dotnet
1583 local
1584 l_area: like area
1585 do
1586 l_area := area
1587 l_area.put ('%U', count)
1588 Result := l_area
1589 end
1590
1591 mirrored: like Current
1592 -- Mirror image of string;
1593 -- Result for "Hello world" is "dlrow olleH".
1594 do
1595 Result := twin
1596 if count > 0 then
1597 Result.mirror
1598 end
1599 end
1600
1601 mirror
1602 -- Reverse the order of characters.
1603 -- "Hello world" -> "dlrow olleH".
1604 local
1605 a: like area
1606 c: CHARACTER_8
1607 i, j: INTEGER
1608 do
1609 if count > 0 then
1610 from
1611 i := count - 1
1612 a := area
1613 until
1614 i <= j
1615 loop
1616 c := a.item (i)
1617 a.put (a.item (j), i)
1618 a.put (c, j)
1619 i := i - 1
1620 j := j + 1
1621 end
1622 internal_hash_code := 0
1623 end
1624 ensure
1625 same_count: count = old count
1626 -- reversed: For every `i' in 1..`count', `item' (`i') = old `item' (`count'+1-`i')
1627 end
1628
1629 feature -- Duplication
1630
1631 substring (start_index, end_index: INTEGER): like Current
1632 -- Copy of substring containing all characters at indices
1633 -- between `start_index' and `end_index'
1634 do
1635 if (1 <= start_index) and (start_index <= end_index) and (end_index <= count) then
1636 Result := new_string (end_index - start_index + 1)
1637 Result.area.copy_data (area, start_index - 1, 0, end_index - start_index + 1)
1638 Result.set_count (end_index - start_index + 1)
1639 else
1640 Result := new_string (0)
1641 end
1642 end
1643
1644 multiply (n: INTEGER)
1645 -- Duplicate a string within itself
1646 -- ("hello").multiply(3) => "hellohellohello"
1647 require
1648 meaningful_multiplier: n >= 1
1649 local
1650 s: like Current
1651 i: INTEGER
1652 do
1653 s := twin
1654 grow (n * count)
1655 from
1656 i := n
1657 until
1658 i = 1
1659 loop
1660 append (s)
1661 i := i - 1
1662 end
1663 end
1664
1665 feature {STRING_HANDLER} -- Implementation
1666
1667 frozen set_count (number: INTEGER)
1668 -- Set `count' to `number' of characters.
1669 do
1670 count := number
1671 internal_hash_code := 0
1672 end
1673
1674 feature {NONE} -- Implementation
1675
1676 new_string (n: INTEGER): like Current
1677 -- New instance of current with space for at least `n' characters.
1678 do
1679 create Result.make (n)
1680 end
1681
1682 feature -- Transformation
1683
1684 correct_mismatch
1685 -- Attempt to correct object mismatch during retrieve using `mismatch_information'.
1686 do
1687 -- Nothing to be done because we only added `internal_hash_code' that will
1688 -- be recomputed next time we query `hash_code'.
1689 end
1690
1691 feature {NONE} -- Implementation
1692
1693 empty_area: SPECIAL [CHARACTER_8]
1694 -- Empty `area' to avoid useless creation of empty areas when wiping out a STRING.
1695 obsolete
1696 "Simply create `area' directly."
1697 do
1698 create Result.make (1)
1699 ensure
1700 empty_area_not_void: Result /= Void
1701 end
1702
1703 invariant
1704 extendible: extendible
1705 compare_character: not object_comparison
1706
1707 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23