<commit_before>/****************************************************************************
*   PROJECT: Changes for Squeak 
*   FILE:    changesForSqueak.c
*   CONTENT: 
*
*   AUTHOR:  <NAME>, and others.
*   ADDRESS: 
*   EMAIL:   <EMAIL>
*   RCSID:   $Id: changesForSqueak.c,v 1.3 2001/12/27 23:14:13 johnmci Exp $
*
*   NOTES: See change log below.
*	12/27/2001 JMM added support to build as a OS-X Bundle, a bit werid because its a mixture of unix and mac OS
*****************************************************************************/
/* Squeak on MPEG
   by <NAME> <EMAIL>  Sept 2000
   
   For the macintosh I've 
   1) coded up #ifdef for TARGET_OS_MAC
   2) Coded around the pthreads
   3) ignored most of mpeg3io_device
   4) some changes to make CodeWarrior 5 happy
   
   In General
   
   1) Added some casts
   2) had some problems with Mpeg3_stream_coeffs_t
   3) coded up memoryAllocate/memoryFree versus malloc/cmalloc/free
   4) created a mpeg3_generate_toc_for_Squeak
   5) Ignore perror
   
*/
// Nov 2nd, 2000  JMM changed memoryAllocate, use calloc
// Sept 7nd, 2001 JMM added carbon logic

#include <string.h>
#include "mpeg3private.h"
#include "changesForSqueak.h"

#if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
#include <Memory.h>
#include <QuickDraw.h>
#endif

#ifdef WIN32
#include <windows.h>
#endif

mpeg3_demuxer_t* mpeg3_new_demuxer(mpeg3_t *file, int do_audio, int do_video, int stream_id);
mpeg3_title_t* mpeg3_new_title(mpeg3_t *file, char *path);
mpeg3demux_timecode_t* mpeg3_append_timecode(mpeg3_demuxer_t *demuxer, 
		mpeg3_title_t *title, 
		long prev_byte, 
		double prev_time, 
		long next_byte, 
		double next_time,
		int dont_store);
void appendStringToBufferIfPossible(char *buffer,char *append,int bufferSize);
		

static long counter = 0;

void * memoryAllocate(int number,unsigned size) {
    void * stuff;
#if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
#if TARGET_API_MAC_CARBON
    stuff = (void *) NewPtrClear(size*number);
#else
    stuff = (void *) NewPtrSysClear(size*number);
#endif
//    if (stuff == nil) Debugger();
#else
    stuff = (void *) calloc(size,number);
#endif
    counter++;
    return stuff;
}

void memoryFree(void *stuff) {
    counter--;
#if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
    DisposePtr((char *)stuff);
#else
    free(stuff);
#endif
}



#if (defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )) || defined(WIN32)
#define NEEDSTRFUNCS
#endif

#ifdef NEEDSTRFUNCS
void perror(const char * string) {

}
int			strncasecmp(const char *str1, const char *str2, size_t nchars);
int			strcasecmp (const char *str1, const char *str2);

int			strncasecmp(const char *s1, const char *s2, size_t len)
{
  /* Return true if the two strings are the same, not considering case. */
	int i, c1, c2;

	for (i = 0; i < len; i++) {
		c1 = s1[i];
		c2 = s2[i];
		if ((c1 >= 'a') && (c1 <= 'z')) {
			c1 = c1 - ('a' - 'A');
		}
		if ((c2 >= 'a') && (c2 <= 'z')) {
			c2 = c2 - ('a' - 'A');
		}
		if (c1 != c2) return false;
	}
	return true;
}

int			strcasecmp (const char *str1, const char *str2) {
	if (strlen(str1) != strlen(str2)) return false;
    return strncasecmp(str1,str2,strlen(str1));
}


#endif

#ifdef WIN32
int bzero(char* block, long size) {
	ZeroMemory(block,size);
}
#endif


#if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
int bzero(char *block,long size) {
    BlockZero(block,size);
}

int main ()
{
} 
<commit_msg>changed true/false into 1/0 since C doesnt know true or false keywords<commit_after>/****************************************************************************
*   PROJECT: Changes for Squeak 
*   FILE:    changesForSqueak.c
*   CONTENT: 
*
*   AUTHOR:  <NAME>, and others.
*   ADDRESS: 
*   EMAIL:   <EMAIL>
*   RCSID:   $Id: changesForSqueak.c,v 1.4 2002/05/05 11:58:47 andreasraab Exp $
*
*   NOTES: See change log below.
*	12/27/2001 JMM added support to build as a OS-X Bundle, a bit werid because its a mixture of unix and mac OS
*****************************************************************************/
/* Squeak on MPEG
   by <NAME> <EMAIL>  Sept 2000
   
   For the macintosh I've 
   1) coded up #ifdef for TARGET_OS_MAC
   2) Coded around the pthreads
   3) ignored most of mpeg3io_device
   4) some changes to make CodeWarrior 5 happy
   
   In General
   
   1) Added some casts
   2) had some problems with Mpeg3_stream_coeffs_t
   3) coded up memoryAllocate/memoryFree versus malloc/cmalloc/free
   4) created a mpeg3_generate_toc_for_Squeak
   5) Ignore perror
   
*/
// Nov 2nd, 2000  JMM changed memoryAllocate, use calloc
// Sept 7nd, 2001 JMM added carbon logic

#include <string.h>
#include "mpeg3private.h"
#include "changesForSqueak.h"

#if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
#include <Memory.h>
#include <QuickDraw.h>
#endif

#ifdef WIN32
#include <windows.h>
#endif

mpeg3_demuxer_t* mpeg3_new_demuxer(mpeg3_t *file, int do_audio, int do_video, int stream_id);
mpeg3_title_t* mpeg3_new_title(mpeg3_t *file, char *path);
mpeg3demux_timecode_t* mpeg3_append_timecode(mpeg3_demuxer_t *demuxer, 
		mpeg3_title_t *title, 
		long prev_byte, 
		double prev_time, 
		long next_byte, 
		double next_time,
		int dont_store);
void appendStringToBufferIfPossible(char *buffer,char *append,int bufferSize);
		

static long counter = 0;

void * memoryAllocate(int number,unsigned size) {
    void * stuff;
#if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
#if TARGET_API_MAC_CARBON
    stuff = (void *) NewPtrClear(size*number);
#else
    stuff = (void *) NewPtrSysClear(size*number);
#endif
//    if (stuff == nil) Debugger();
#else
    stuff = (void *) calloc(size,number);
#endif
    counter++;
    return stuff;
}

void memoryFree(void *stuff) {
    counter--;
#if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
    DisposePtr((char *)stuff);
#else
    free(stuff);
#endif
}



#if (defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )) || defined(WIN32)
#define NEEDSTRFUNCS
#endif

#ifdef NEEDSTRFUNCS
void perror(const char * string) {

}
int			strncasecmp(const char *str1, const char *str2, size_t nchars);
int			strcasecmp (const char *str1, const char *str2);

int			strncasecmp(const char *s1, const char *s2, size_t len)
{
  /* Return true if the two strings are the same, not considering case. */
	int i, c1, c2;

	for (i = 0; i < len; i++) {
		c1 = s1[i];
		c2 = s2[i];
		if ((c1 >= 'a') && (c1 <= 'z')) {
			c1 = c1 - ('a' - 'A');
		}
		if ((c2 >= 'a') && (c2 <= 'z')) {
			c2 = c2 - ('a' - 'A');
		}
		if (c1 != c2) return 0;
	}
	return 1;
}

int			strcasecmp (const char *str1, const char *str2) {
	if (strlen(str1) != strlen(str2)) return 0;
    return strncasecmp(str1,str2,strlen(str1));
}


#endif

#ifdef WIN32
int bzero(char* block, long size) {
	ZeroMemory(block,size);
}
#endif


#if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
int bzero(char *block,long size) {
    BlockZero(block,size);
}

int main ()
{
} 

{'fraction_non_alphanumeric': 0.16787912702853947, 'fraction_numerical': 0.028399552322327923, 'mean_word_length': 3.9576976421636614, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2541407', 'n_tokens_mistral': 2864, 'n_tokens_neox': 2669, 'n_words': 743}