Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Infinity source release
Browse files Browse the repository at this point in the history
  • Loading branch information
Hopper262 committed May 27, 2024
1 parent e46d0ed commit ce4fdc6
Show file tree
Hide file tree
Showing 150 changed files with 9,895 additions and 1,437 deletions.
5 changes: 5 additions & 0 deletions cseries.lib/beta.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#define DEBUG

//#define ALPHA
#define BETA
//#define FINAL
113 changes: 113 additions & 0 deletions cseries.lib/buildprogram
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# BuildProgram - build the specified program
#
# Usage:
# BuildProgram program [options…] > log
#
# The BuildProgram script builds the specified program (or target).
# A simple transcript of the build is written to standard output.
#
# Make is used to generate the build commands. If file <program>.make
# exists it is used as the makefile. If not, file MakeFile is used.
#
# The options specified are passed directly to Make, and control the
# generation of the build commands.
#
#
# Copyright Apple Computer, Inc. 1987 - 1992
# All rights reserved.

Set Exit 1

# Find the program parameter.

Unset program
For i In {"Parameters"}
If "{i}" !~ /-≈/
Set program "{i}"
Break
End
End

if "{program}"=="cseries"||"{program}"=="cseries.lib"||"{program}"=="cseries.xcoff"
# final build for PPC
Set PPCCOptions "-i ∂"{CSeriesInterfaces}∂" -typecheck relaxed -opt speed"
Set ObjPPC :objects:ppc:
Set TargPPC cseries.xcoff
Set OptimizationsPPC "-opt size"
Set SymbolsPPC "-sym off"

# final build for 68k
Set COptions "-opt full -b2 -r -mbg off -k ∂"{CSeriesLibraries}∂""
Set Obj68k :Objects:68k:
Set Targ68k cseries.lib

else if "{program}"=="cseries.debug"||"{program}"=="cseries.debug.lib"||"{program}"=="cseries.debug.xcoff"
# debug build for PPC
Set PPCCOptions "-i ∂"{CSeriesInterfaces}∂" -typecheck relaxed -sym on -d DEBUG"
Set ObjPPC :Objects:ppc.debug:
Set TargPPC cseries.debug.xcoff
Set OptimizationsPPC "-opt size"
Set SymbolsPPC "-sym off"

# debug build for 68k
Set COptions "-opt full -b2 -r -mbg on -d DEBUG -k ∂"{CSeriesLibraries}∂""
Set Obj68k :Objects:68k.debug:
Set Targ68k cseries.debug.lib

else if "{program}"=="cseries.sym"||"{program}"=="cseries.sym.xcoff"
# debug build with symbols for PPC
Set PPCCOptions "-i {CSeriesInterfaces} -typecheck relaxed -sym on -d DEBUG"
Set ObjPPC :Objects:ppc.sym:
Set TargPPC cseries.sym.xcoff
Set OptimizationsPPC "-opt off"
Set SymbolsPPC "-sym on"

# debug build for 68k
Set COptions "-opt full -b2 -r -mbg on -d DEBUG -k ∂"{CSeriesLibraries}∂""
Set Obj68k :Objects:68k.debug:
Set Targ68k cseries.debug.lib
#else
# echo bad target
# exit 1
end

if ({MakeVulcan} == 1) && ({MakeModelFar} == 1)
set COptions "{COptions}"" -model far"
end

#for PPC
Export PPCCOptions
Export ObjPPC
Export TargPPC
Export OptimizationsPPC
Export SymbolsPPC

#for 68k
Export COptions
Export Obj68k
Export Targ68k

Set makefile `(Files -t TEXT "{program}".make || ∂
Files -t TEXT MakeFile || Echo '""') ≥ Dev:Null`
If "{makefile}" == ""
Echo "### {0} - No makefile exists for {program}." > Dev:StdErr
Exit 1
End

# Run Make, then execute its output.

Echo "# `Date -t` ----- Build of {program}."
Echo "# `Date -t` ----- Analyzing dependencies."
Begin
Echo "Set Echo 1"
Make {"Parameters"} -f "{makefile}"
End > "{program}".makeout
Echo "# `Date -t` ----- Executing build commands."
"{program}".makeout
Delete "{program}".makeout
Echo "# `Date -t` ----- Done."
Set type "`files -i -n -x t "{program}" ≥ Dev:Null || Set Status 0`"
Set CaseSensitive True #filetype check for DA must be case sensitive
If "{type}" =~ /≈ APPL/ OR "{type}" =~ /≈ MPST/ # application or tool
Echo -n ∂t; Quote -n "{program}"; Echo -n " "
End
104 changes: 104 additions & 0 deletions cseries.lib/byte_swapping.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
BYTE_SWAPPING.C
Tuesday, August 22, 1995 8:58:12 AM (Jason)
*/

#include "cseries.h"

#include "byte_swapping.h"

/* ---------- code */

void byte_swap_memory(
void *data,
_bs_field type,
long nmemb)
{
switch (type)
{
case _2byte:
{
word *ptr= data;

for (; nmemb>0; --nmemb)
{
word q= *ptr;
*ptr++= SWAP2(q);
}

break;
}
case _4byte:
{
unsigned long *ptr= data;

for (; nmemb>0; --nmemb)
{
unsigned long q= *ptr;
*ptr++= SWAP4(q);
}

break;
}

default:
halt();
}

return;
}

void byte_swap_data(
byte *data,
long size,
long nmemb,
_bs_field *fields)
{
long i;

for (i= 0; i<nmemb; ++i)
{
_bs_field *current_field= fields;
int count;

for (count= 0; count<size; )
{
_bs_field field= *fields++;

if (field<0)
{
switch (field)
{
case _2byte:
{
word q= *((word *)data);
*((word *)data)= SWAP2(q);
data+= sizeof(word), count+= sizeof(word);

break;
}

case _4byte:
{
unsigned long q= *((unsigned long *)data);
*((unsigned long *)data)= SWAP4(q);
data+= sizeof(long), count+= sizeof(long);

break;
}

default:
halt();
}
}
else
{
count+= field, data+= field;
}
}

assert(count==size);
}

return;
}
36 changes: 36 additions & 0 deletions cseries.lib/byte_swapping.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
BYTE_SWAPPING.H
Tuesday, August 22, 1995 9:20:34 AM (Jason)
*/

/* ---------- constants */

enum // _bs_field constants
{
// positive numbers are runs (of bytes) to leave untouched

_byte= 1,
_2byte= -2,
_4byte= -4
};

/* ---------- macros */

#define SWAP2(q) (((q)>>8) | (((q)<<8)&0xff00))
#define SWAP4(q) (((q)>>24) | (((q)>>8)&0xff00) | (((q)<<8)&0x00ff00) | (((q)<<24)&0xff000000))

/* ---------- types */

typedef short _bs_field;

/* ---------- prototypes/BYTE_SWAPPING.H */

#ifdef mac
#define byte_swap_data(data, size, nmemb, fields)
#define byte_swap_memory(data, type, nmemb)
#endif

#ifdef win
void byte_swap_data(void *data, long size, long nmemb, _bs_field *fields);
void byte_swap_memory(void *data, _bs_field type, long nmemb);
#endif
112 changes: 112 additions & 0 deletions cseries.lib/checksum.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
checksum.c
Thursday, March 10, 1994 8:21:23 PM
written by ajr
*/

#include <stdlib.h> /* for srand() and rand() */
#include <time.h> /* for clock() */

#include "cseries.h"

#include "checksum.h"

// private prototypes
void update_add_checksum(Checksum *check, word *src, long length);

/**********************************************************************************
*
* Function: new_checksum
* Purpose: initialize the checksum data structure.
*
**********************************************************************************/
void new_checksum(Checksum *check, word type)
{
// set up bogus stuff in the checksum, so when it's saved, it's a
// bit obfuscated.
srand(clock());
check->bogus1 = rand();
check->bogus2 = rand();

assert(type == ADD_CHECKSUM);

check->checksum_type = type;

switch (check->checksum_type)
{
case ADD_CHECKSUM:
check->value.add_checksum = 0;
break;
case FLETCHER_CHECKSUM:
case CRC32_CHECKSUM:
default:
halt();
break;
}
}

/**********************************************************************************
*
* Function: update_checksum
* Purpose: takes the given checksum and updates it for the extra stuff.
*
**********************************************************************************/
void update_checksum(Checksum *check, word *src, long length)
{
switch (check->checksum_type)
{
case ADD_CHECKSUM:
update_add_checksum(check, src, length);
break;
case FLETCHER_CHECKSUM:
case CRC32_CHECKSUM:
default:
halt();
break;
}
}

/**********************************************************************************
*
* Function: update_add_checksum
* Purpose: called by update_checksum to take the given checksum and add all
* the stuff in src to it.
*
**********************************************************************************/
void update_add_checksum(Checksum *check, word *src, long length)
{
long i;
long real_length;

if (length % 2) // is it odd?
length--; // make it even. ignore last byte.

real_length = length / sizeof(word); // duh

for (i = 0; i < real_length; i++)
{
check->value.add_checksum += *(src+i);
}
}

/**********************************************************************************
*
* Function: equal_checksums
* Purpose: decide if 2 checksums are the same. wow.
*
**********************************************************************************/
boolean equal_checksums(Checksum *check1, Checksum *check2)
{
assert(check1->checksum_type == check2->checksum_type);
switch(check1->checksum_type)
{
case ADD_CHECKSUM:
return (check1->value.add_checksum == check2->value.add_checksum);
break;
case FLETCHER_CHECKSUM:
case CRC32_CHECKSUM:
default:
halt(); // not implemented yet.
break;
}
}
Loading

0 comments on commit ce4fdc6

Please sign in to comment.