DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦7037528f6⟧ TextFile

    Length: 3140 (0xc44)
    Types: TextFile
    Notes: R1k Text-file segment

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦6ced13f57⟧ 
            └─⟦this⟧ 

TextFile

with a_strings;
with unchecked_conversion;
with unchecked_deallocation;
with system;
package C_strings is

	max_file_name_size: constant := 1024;

	pragma warnings(OFF);
	subtype c_string_t is string (1 .. integer'last);

	type c_string is access c_string_t;  --WARNING
	pragma local_access(c_string);
	subtype c_string_buf is string(1..max_file_name_size);
	pragma warnings(ON);

	function address_to_c is new UNCHECKED_CONVERSION(
		SOURCE => system.ADDRESS,
		TARGET => c_string);
	function to_c is new UNCHECKED_CONVERSION(
		SOURCE => system.ADDRESS,
		TARGET => c_string);

	function c_to_address is new UNCHECKED_CONVERSION(
		SOURCE => c_string,
		TARGET => system.ADDRESS);
	
	pragma warnings(OFF);
	procedure free is new UNCHECKED_DEALLOCATION(
		OBJECT => c_string_t,
		NAME   => c_string);
	pragma warnings(ON);

	-- returns the number of characters before the first null character
	-- is encountered
	function c_length (s : c_string) return integer;

	-- converts the characters up to the first null into a string
	function convert_c_to_string(s : c_string) return string;
	function to_string(s : c_string) return string renames convert_c_to_string;

	-- converts the characters up to the first null symbol into a_string
	function convert_c_to_a(s : c_string) return A_strings.a_string;
	function to_a(s: c_string) return A_strings.a_string renames convert_c_to_a;

	-- converts the a_string to an array of characters (c_string)
	-- terminated by a null character.
	function convert_a_to_c(s : A_strings.a_string) return c_string;
	function to_c(s: A_strings.a_string) return c_string renames convert_a_to_c;
	-- same, but converts a_string into given buffer, returning pointer to buf
	function to_c(s: A_strings.a_string; buf: system.address) return c_string;
	
	-- converts the string to an array of characters (c_string)
	-- terminated by a null character.
	function convert_string_to_c(s : string) return c_string;
	function to_c(s : string) return c_string renames convert_string_to_c;
	-- same, but converts string into given buffer, returning pointer to buf
	function to_c(s: string; buf: system.address) return c_string;

	function strcmp(a, b: c_string) return boolean;
	function strcmp(a: c_string; b: A_strings.a_string) return boolean;
	function strcmp(a: A_strings.a_string; b: c_string) return boolean;
	function strcmp(a: c_string; b: string) return boolean;
	function strcmp(a: string; b: c_string) return boolean;

	-- the C-like strcmp:  -1 if x<y, 0 if x=y, +1 if x>y
	function  strcmp(x, y: c_string) return integer;

	-- Like C functions; returns first argument.
	function strcpy(to: c_string; from: string) return c_string;
	function strcpy(to: c_string; from: c_string) return c_string;
	function strcpy(to: c_string; from: a_strings.a_string) return c_string;
	function strcat(to: c_string; from: string) return c_string;
	function strcat(to: c_string; from: c_string) return c_string;
	function strcat(to: c_string; from: a_strings.a_string) return c_string;

	function rindex(str : c_strings.c_string; ch : character) return integer;

	function string_copy(a: c_string) return c_string;

end C_strings