Commit d22870bc authored by Andy Polyakov's avatar Andy Polyakov
Browse files

Drain unused MacOS directory.

parent 4ff2999e
Loading
Loading
Loading
Loading

MacOS/GUSI_Init.cpp

deleted100644 → 0
+0 −62
Original line number Diff line number Diff line
/**************** BEGIN GUSI CONFIGURATION ****************************
 *
 * GUSI Configuration section generated by GUSI Configurator
 * last modified: Wed Jan  5 20:33:51 2000
 *
 * This section will be overwritten by the next run of Configurator.
 */

#define GUSI_SOURCE
#include <GUSIConfig.h>
#include <sys/cdefs.h>

/* Declarations of Socket Factories */

__BEGIN_DECLS
void GUSIwithInetSockets();
void GUSIwithLocalSockets();
void GUSIwithMTInetSockets();
void GUSIwithMTTcpSockets();
void GUSIwithMTUdpSockets();
void GUSIwithOTInetSockets();
void GUSIwithOTTcpSockets();
void GUSIwithOTUdpSockets();
void GUSIwithPPCSockets();
void GUSISetupFactories();
__END_DECLS

/* Configure Socket Factories */

void GUSISetupFactories()
{
#ifdef GUSISetupFactories_BeginHook
	GUSISetupFactories_BeginHook
#endif
	GUSIwithInetSockets();
#ifdef GUSISetupFactories_EndHook
	GUSISetupFactories_EndHook
#endif
}

/* Declarations of File Devices */

__BEGIN_DECLS
void GUSIwithDConSockets();
void GUSIwithNullSockets();
void GUSISetupDevices();
__END_DECLS

/* Configure File Devices */

void GUSISetupDevices()
{
#ifdef GUSISetupDevices_BeginHook
	GUSISetupDevices_BeginHook
#endif
	GUSIwithNullSockets();
#ifdef GUSISetupDevices_EndHook
	GUSISetupDevices_EndHook
#endif
}

/**************** END GUSI CONFIGURATION *************************/
+0 −2753

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −104
Original line number Diff line number Diff line
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

void CopyPStrToCStr(const unsigned char *thePStr,char *theCStr,const int maxCStrLength);
void CopyPStrToPStr(const unsigned char *theSrcPStr,unsigned char *theDstPStr,const int maxDstStrLength);
void CopyCStrToCStr(const char *theSrcCStr,char *theDstCStr,const int maxDstStrLength);
void CopyCStrToPStr(const char *theSrcCStr,unsigned char *theDstPStr,const int maxDstStrLength);
void ConcatPStrToCStr(const unsigned char *thePStr,char *theCStr,const int maxCStrLength);
void ConcatPStrToPStr(const unsigned char *theSrcPStr,unsigned char *theDstPStr,const int maxDstStrLength);
void ConcatCStrToPStr(const char *theSrcCStr,unsigned char *theDstPStr,const int maxDstStrLength);
void ConcatCStrToCStr(const char *theSrcCStr,char *theDstCStr,const int maxCStrLength);

void ConcatCharToCStr(const char theChar,char *theDstCStr,const int maxCStrLength);
void ConcatCharToPStr(const char theChar,unsigned char *theDstPStr,const int maxPStrLength);

int ComparePStrs(const unsigned char *theFirstPStr,const unsigned char *theSecondPStr,const Boolean ignoreCase = true);
int CompareCStrs(const char *theFirstCStr,const char *theSecondCStr,const Boolean ignoreCase = true);
int CompareCStrToPStr(const char *theCStr,const unsigned char *thePStr,const Boolean ignoreCase = true);

Boolean CStrsAreEqual(const char *theFirstCStr,const char *theSecondCStr,const Boolean ignoreCase = true);
Boolean PStrsAreEqual(const unsigned char *theFirstCStr,const unsigned char *theSecondCStr,const Boolean ignoreCase = true);

void CopyLongIntToCStr(const long theNum,char *theCStr,const int maxCStrLength,const int numDigits = -1);
void CopyUnsignedLongIntToCStr(const unsigned long theNum,char *theCStr,const int maxCStrLength);
void ConcatLongIntToCStr(const long theNum,char *theCStr,const int maxCStrLength,const int numDigits = -1);
void CopyCStrAndConcatLongIntToCStr(const char *theSrcCStr,const long theNum,char *theDstCStr,const int maxDstStrLength);

void CopyLongIntToPStr(const long theNum,unsigned char *thePStr,const int maxPStrLength,const int numDigits = -1);
void ConcatLongIntToPStr(const long theNum,unsigned char *thePStr,const int maxPStrLength,const int numDigits = -1);

long CStrLength(const char *theCString);
long PStrLength(const unsigned char *thePString);

OSErr CopyCStrToExistingHandle(const char *theCString,Handle theHandle);
OSErr CopyLongIntToExistingHandle(const long inTheLongInt,Handle theHandle);

OSErr CopyCStrToNewHandle(const char *theCString,Handle *theHandle);
OSErr CopyPStrToNewHandle(const unsigned char *thePString,Handle *theHandle);
OSErr CopyLongIntToNewHandle(const long inTheLongInt,Handle *theHandle);

OSErr AppendCStrToHandle(const char *theCString,Handle theHandle,long *currentLength = nil,long *maxLength = nil);
OSErr AppendCharsToHandle(const char *theChars,const int numChars,Handle theHandle,long *currentLength = nil,long *maxLength = nil);
OSErr AppendPStrToHandle(const unsigned char *thePString,Handle theHandle,long *currentLength = nil);
OSErr AppendLongIntToHandle(const long inTheLongInt,Handle theHandle,long *currentLength = nil);

void ZeroMem(void *theMemPtr,const unsigned long numBytes);

char *FindCharInCStr(const char theChar,const char *theCString);
long FindCharOffsetInCStr(const char theChar,const char *theCString,const Boolean inIgnoreCase = false);
long FindCStrOffsetInCStr(const char *theCSubstring,const char *theCString,const Boolean inIgnoreCase = false);

void CopyCSubstrToCStr(const char *theSrcCStr,const int maxCharsToCopy,char *theDstCStr,const int maxDstStrLength);
void CopyCSubstrToPStr(const char *theSrcCStr,const int maxCharsToCopy,unsigned char *theDstPStr,const int maxDstStrLength);

void InsertCStrIntoCStr(const char *theSrcCStr,const int theInsertionOffset,char *theDstCStr,const int maxDstStrLength);
void InsertPStrIntoCStr(const unsigned char *theSrcPStr,const int theInsertionOffset,char *theDstCStr,const int maxDstStrLength);
OSErr InsertCStrIntoHandle(const char *theCString,Handle theHandle,const long inInsertOffset);

void CopyCStrAndInsertCStrIntoCStr(const char *theSrcCStr,const char *theInsertCStr,char *theDstCStr,const int maxDstStrLength);

void CopyCStrAndInsertCStrsLongIntsIntoCStr(const char *theSrcCStr,const char **theInsertCStrs,const long *theLongInts,char *theDstCStr,const int maxDstStrLength);

void CopyCStrAndInsert1LongIntIntoCStr(const char *theSrcCStr,const long theNum,char *theDstCStr,const int maxDstStrLength);
void CopyCStrAndInsert2LongIntsIntoCStr(const char *theSrcCStr,const long long1,const long long2,char *theDstCStr,const int maxDstStrLength);
void CopyCStrAndInsert3LongIntsIntoCStr(const char *theSrcCStr,const long long1,const long long2,const long long3,char *theDstCStr,const int maxDstStrLength);

void CopyCStrAndInsertCStrLongIntIntoCStr(const char *theSrcCStr,const char *theInsertCStr,const long theNum,char *theDstCStr,const int maxDstStrLength);
OSErr CopyCStrAndInsertCStrLongIntIntoHandle(const char *theSrcCStr,const char *theInsertCStr,const long theNum,Handle *theHandle);


OSErr CopyIndexedWordToCStr(char *theSrcCStr,int whichWord,char *theDstCStr,int maxDstCStrLength);
OSErr CopyIndexedWordToNewHandle(char *theSrcCStr,int whichWord,Handle *outTheHandle);

OSErr CopyIndexedLineToCStr(const char *theSrcCStr,int inWhichLine,int *lineEndIndex,Boolean *gotLastLine,char *theDstCStr,const int maxDstCStrLength);
OSErr CopyIndexedLineToNewHandle(const char *theSrcCStr,int inWhichLine,Handle *outNewHandle);

OSErr ExtractIntFromCStr(const char *theSrcCStr,int *outInt,Boolean skipLeadingSpaces = true);
OSErr ExtractIntFromPStr(const unsigned char *theSrcPStr,int *outInt,Boolean skipLeadingSpaces = true);


void ConvertCStrToUpperCase(char *theSrcCStr);


int CountOccurencesOfCharInCStr(const char inChar,const char *inSrcCStr);
int CountWordsInCStr(const char *inSrcCStr);

OSErr CountDigits(const char *inCStr,int *outNumIntegerDigits,int *outNumFractDigits);

void ExtractCStrItemFromCStr(const char *inSrcCStr,const char inItemDelimiter,const int inItemNumber,Boolean *foundItem,char *outDstCharPtr,const int inDstCharPtrMaxLength,const Boolean inTreatMultipleDelimsAsSingleDelim = false);
OSErr ExtractCStrItemFromCStrIntoNewHandle(const char *inSrcCStr,const char inItemDelimiter,const int inItemNumber,Boolean *foundItem,Handle *outNewHandle,const Boolean inTreatMultipleDelimsAsSingleDelim = false);


OSErr ExtractFloatFromCStr(const char *inCString,extended80 *outFloat);
OSErr CopyFloatToCStr(const extended80 *theFloat,char *theCStr,const int maxCStrLength,const int inMaxNumIntDigits = -1,const int inMaxNumFractDigits = -1);

void SkipWhiteSpace(char **ioSrcCharPtr,const Boolean inStopAtEOL = false);


#ifdef __cplusplus
}
#endif
+0 −170
Original line number Diff line number Diff line
/* ====================================================================
 * Copyright (c) 1998-1999 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    openssl-core@openssl.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */
 
 
 
 #include "ErrorHandling.hpp"
#include "CPStringUtils.hpp"

#ifdef __EXCEPTIONS_ENABLED__
	#include "CMyException.hpp"
#endif


static char					gErrorMessageBuffer[512];

char 						*gErrorMessage = gErrorMessageBuffer;
int							gErrorMessageMaxLength = sizeof(gErrorMessageBuffer);



void SetErrorMessage(const char *theErrorMessage)
{
	if (theErrorMessage != nil)
	{
		CopyCStrToCStr(theErrorMessage,gErrorMessage,gErrorMessageMaxLength);
	}
}


void SetErrorMessageAndAppendLongInt(const char *theErrorMessage,const long theLongInt)
{
	if (theErrorMessage != nil)
	{
		CopyCStrAndConcatLongIntToCStr(theErrorMessage,theLongInt,gErrorMessage,gErrorMessageMaxLength);
	}
}

void SetErrorMessageAndCStrAndLongInt(const char *theErrorMessage,const char * theCStr,const long theLongInt)
{
	if (theErrorMessage != nil)
	{
		CopyCStrAndInsertCStrLongIntIntoCStr(theErrorMessage,theCStr,theLongInt,gErrorMessage,gErrorMessageMaxLength);
	}

}

void SetErrorMessageAndCStr(const char *theErrorMessage,const char * theCStr)
{
	if (theErrorMessage != nil)
	{
		CopyCStrAndInsertCStrLongIntIntoCStr(theErrorMessage,theCStr,-1,gErrorMessage,gErrorMessageMaxLength);
	}
}


void AppendCStrToErrorMessage(const char *theErrorMessage)
{
	if (theErrorMessage != nil)
	{
		ConcatCStrToCStr(theErrorMessage,gErrorMessage,gErrorMessageMaxLength);
	}
}


void AppendLongIntToErrorMessage(const long theLongInt)
{
	ConcatLongIntToCStr(theLongInt,gErrorMessage,gErrorMessageMaxLength);
}



char *GetErrorMessage(void)
{
	return gErrorMessage;
}


OSErr GetErrorMessageInNewHandle(Handle *inoutHandle)
{
OSErr		errCode;


	errCode = CopyCStrToNewHandle(gErrorMessage,inoutHandle);
	
	return(errCode);
}


OSErr GetErrorMessageInExistingHandle(Handle inoutHandle)
{
OSErr		errCode;


	errCode = CopyCStrToExistingHandle(gErrorMessage,inoutHandle);
	
	return(errCode);
}



OSErr AppendErrorMessageToHandle(Handle inoutHandle)
{
OSErr		errCode;


	errCode = AppendCStrToHandle(gErrorMessage,inoutHandle,nil);
	
	return(errCode);
}


#ifdef __EXCEPTIONS_ENABLED__

void ThrowErrorMessageException(void)
{
	ThrowDescriptiveException(gErrorMessage);
}

#endif
+0 −147
Original line number Diff line number Diff line
#ifdef __cplusplus
extern "C" {
#endif

#ifndef kGenericError
	#define kGenericError		-1
#endif

extern char	*gErrorMessage;


void SetErrorMessage(const char *theErrorMessage);
void SetErrorMessageAndAppendLongInt(const char *theErrorMessage,const long theLongInt);
void SetErrorMessageAndCStrAndLongInt(const char *theErrorMessage,const char * theCStr,const long theLongInt);
void SetErrorMessageAndCStr(const char *theErrorMessage,const char * theCStr);
void AppendCStrToErrorMessage(const char *theErrorMessage);
void AppendLongIntToErrorMessage(const long theLongInt);


char *GetErrorMessage(void);
OSErr GetErrorMessageInNewHandle(Handle *inoutHandle);
OSErr GetErrorMessageInExistingHandle(Handle inoutHandle);
OSErr AppendErrorMessageToHandle(Handle inoutHandle);


#ifdef __EXCEPTIONS_ENABLED__
	void ThrowErrorMessageException(void);
#endif



//	A bunch of evil macros that would be unnecessary if I were always using C++ !

#define SetErrorMessageAndBailIfNil(theArg,theMessage)								\
{																					\
	if (theArg == nil)																\
	{																				\
		SetErrorMessage(theMessage);												\
		errCode = kGenericError;													\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrorMessageAndBail(theMessage)											\
{																					\
		SetErrorMessage(theMessage);												\
		errCode = kGenericError;													\
		goto EXITPOINT;																\
}


#define SetErrorMessageAndLongIntAndBail(theMessage,theLongInt)						\
{																					\
		SetErrorMessageAndAppendLongInt(theMessage,theLongInt);						\
		errCode = kGenericError;													\
		goto EXITPOINT;																\
}


#define SetErrorMessageAndLongIntAndBailIfError(theErrCode,theMessage,theLongInt)	\
{																					\
	if (theErrCode != noErr)														\
	{																				\
		SetErrorMessageAndAppendLongInt(theMessage,theLongInt);						\
		errCode = theErrCode;														\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrorMessageCStrLongIntAndBailIfError(theErrCode,theMessage,theCStr,theLongInt)	\
{																					\
	if (theErrCode != noErr)														\
	{																				\
		SetErrorMessageAndCStrAndLongInt(theMessage,theCStr,theLongInt);			\
		errCode = theErrCode;														\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrorMessageAndCStrAndBail(theMessage,theCStr)							\
{																					\
	SetErrorMessageAndCStr(theMessage,theCStr);										\
	errCode = kGenericError;														\
	goto EXITPOINT;																	\
}


#define SetErrorMessageAndBailIfError(theErrCode,theMessage)						\
{																					\
	if (theErrCode != noErr)														\
	{																				\
		SetErrorMessage(theMessage);												\
		errCode = theErrCode;														\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrorMessageAndLongIntAndBailIfNil(theArg,theMessage,theLongInt)			\
{																					\
	if (theArg == nil)																\
	{																				\
		SetErrorMessageAndAppendLongInt(theMessage,theLongInt);						\
		errCode = kGenericError;													\
		goto EXITPOINT;																\
	}																				\
}


#define BailIfError(theErrCode)														\
{																					\
	if ((theErrCode) != noErr)														\
	{																				\
		goto EXITPOINT;																\
	}																				\
}


#define SetErrCodeAndBail(theErrCode)												\
{																					\
	errCode = theErrCode;															\
																					\
	goto EXITPOINT;																	\
}


#define SetErrorCodeAndMessageAndBail(theErrCode,theMessage)						\
{																					\
	SetErrorMessage(theMessage);													\
	errCode = theErrCode;															\
	goto EXITPOINT;																	\
}


#define BailNow()																	\
{																					\
	errCode = kGenericError;														\
	goto EXITPOINT;																	\
}


#ifdef __cplusplus
}
#endif
Loading