DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T i

⟦7ef020755⟧ TextFile

    Length: 3706 (0xe7a)
    Types: TextFile
    Names: »interchange.c«

Derivation

└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦038380b96⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦038380b96⟧ 
            └─ ⟦this⟧ »interchange.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
            └─ ⟦this⟧ »../../dtia/release_apollo_2.1/interchange.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦25fab149a⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦25fab149a⟧ 
            └─ ⟦this⟧ »../../dtia/release_sun_2.1/interchange.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦be254d495⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦be254d495⟧ 
            └─ ⟦this⟧ »../../dtia/release_aix_2.1/interchange.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦c67979795⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦c67979795⟧ 
            └─ ⟦this⟧ »../../dtia/release_hp_2.1/interchange.c« 

TextFile

#ifndef	lint
#ifndef	DEBUG
static char SCCS_id[] = "@(#)interchange.c 2.1 90/08/02 19:04:12  Copyright(c) 1990 by Rational.";
#else
static char SCCS_id[] = "@(#)interchange.c DEBUG 2.1 90/08/02 19:04:12  Copyright(c) 1990 by Rational.";
#endif
#endif

#define	INTERCHANGE
#include	"talk.h"
#undef	INTERCHANGE

/* R1000 RPC interchange package for Unix C */

void Put_Short(Env, Stream, Value)
jmp_buf	Env;
int     Stream;
short   Value;
{       
	char    Buf[2];
	Buf[0] = (char) (Value >> 8) & 0377;
	Buf[1] = (char) Value & 0377;
	if (buff_write (Stream, Buf, 2)<0) longjmp(Env,1);
}

short   Get_Short (Env, Stream)
jmp_buf	Env;
int     Stream;
{       
	unsigned char    Buf[2];
	int     Read_Count;

	Read_Count = buff_read (Stream, (char *)Buf, 2);
	if (Read_Count != 2) longjmp(Env,1); /*EOF or error */
	return Buf[0]*256 + Buf[1];
}

void Put_Int (Env, Stream, Value)     /* 32 bit signed, 4 bytes */
jmp_buf	Env;
int     Stream;
int     Value;
{       
	unsigned char    Buf[4];

	Buf[0] = (char) (Value >> 24) & 0377;
	Buf[1] = (char) (Value >> 16) & 0377;
	Buf[2] = (char) (Value >> 8) & 0377;
	Buf[3] = (char) Value & 0377;
	if (buff_write (Stream, (char *)Buf, 4)<0) longjmp(Env,1);
}

int Get_Int (Env, Stream)
jmp_buf	Env;
int     Stream;
{       
	int     Result;
	unsigned char    Buf[4];
	int     Read_Count;

	Read_Count = buff_read (Stream, (char *)Buf, 4);
	if (Read_Count != 4) longjmp(Env,1); /* EOF or error */
	/* printf ("Get_Int: %d %d %d %d\n", Buf[0], Buf[1], Buf[2], Buf[3]); */
	Result = ((Buf[0]*256 + Buf[1]) * 256 + Buf[2]) * 256 + Buf[3];
	return Result;
}

void Put_Bool (Env, Stream, Value)
jmp_buf	Env;
int     Stream;
short   Value;
{       
	if (Value)
		Put_Short (Env, Stream, 1);
	else
		Put_Short (Env, Stream, 0);
}

short   Get_Bool (Env, Stream)
jmp_buf	Env;
int     Stream;
{       
	return Get_Short(Env,Stream);
}

void Put_String (Env,Stream, Value)  /* variable size string, zero terminated */
jmp_buf	Env;
int     Stream;
char    *Value;
{       
	int     Length;

	Length = strlen (Value);
	Put_Int (Env, Stream, Length);
	if (Length>0) {
		if (buff_write (Stream, Value, (Length + 1 ) & ~1)<0)
			longjmp(Env,1);
	}
}

void Get_String (Env, Stream, Result, Max_Length, Lg_Result)
/* Read string, truncate if too long. */
jmp_buf	Env;
int     Stream;
char    *Result;
int     Max_Length;
int	*Lg_Result;
{       
	int     Length;
	char    Odd_Byte[2];
	int     Read_Count;

	Length = Get_Int (Env, Stream);
	if (Length==0) {
		Result[0]='\0';
		*Lg_Result=0;
		return;
	}
	if (Length < Max_Length) {
		Read_Count = buff_read (Stream, Result, Length);
		if (Read_Count==Length) {
			Result[Read_Count] = 0;
			*Lg_Result=Read_Count;
		} else {
			Result[0] = 0;
			*Lg_Result=0;
			longjmp(Env,1);
		}
	} else {
		/* Must truncate string */
		char    Junk[256];
		int     Remaining;
		int     Load;

		Read_Count = buff_read (Stream, Result, Max_Length);
		if (Read_Count==Max_Length) {
			Result[Read_Count] = 0;
			*Lg_Result=Read_Count;
		} else {
			Result[0] = 0;
			*Lg_Result=0;
			longjmp(Env,1);     /* EOF or error condition */
		}

		Remaining = Length - Max_Length;
		while (Remaining > 0) {
			if (Remaining > 256)
				Load = 256;
			else
				Load = Remaining;
			Read_Count = buff_read (Stream, Junk, Load);
			if (Read_Count != Load) longjmp(Env,1);
			Remaining = Remaining - Read_Count;
		}
	}
	if (Length % 2) {
		buff_read (Stream, Odd_Byte, 1);  /* buff_read filler byte */
	}
}

Put_String_Bnd(Env,Stream,str,lg)
jmp_buf	Env;
int	Stream;
char	*str;
int	lg; 
{
	int	re_buff_w;
	Put_Int(Env,Stream,lg);
	re_buff_w=buff_write(Stream,str,lg);
	if (re_buff_w!=lg)	{
		longjmp(Env,1);
	}
	if (lg % 2) {
		buff_write(Stream,"\0",1);
	}
}