Port sc4 to C++.
This commit is contained in:
		
							parent
							
								
									9c005d93ed
								
							
						
					
					
						commit
						234b4907ed
					
				@ -85,7 +85,7 @@ binary.sources += [
 | 
			
		||||
  'sc1.c',
 | 
			
		||||
  'sc2.c',
 | 
			
		||||
  'sc3.c',
 | 
			
		||||
  'sc4.c',
 | 
			
		||||
  'sc4.cpp',
 | 
			
		||||
  'sc5.cpp',
 | 
			
		||||
  'sc6.cpp',
 | 
			
		||||
  'sc7.cpp',
 | 
			
		||||
 | 
			
		||||
@ -315,56 +315,31 @@ int pc_eofsrc(void *handle)
 | 
			
		||||
 */
 | 
			
		||||
void *pc_openasm(char *filename)
 | 
			
		||||
{
 | 
			
		||||
	#if defined __MSDOS__ || defined SC_LIGHT
 | 
			
		||||
		return fopen(filename,"w+t");
 | 
			
		||||
	#else
 | 
			
		||||
  return mfcreate(filename);
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void pc_closeasm(void *handle, int deletefile)
 | 
			
		||||
{
 | 
			
		||||
	#if defined __MSDOS__ || defined SC_LIGHT
 | 
			
		||||
		if (handle!=NULL)
 | 
			
		||||
			fclose((FILE*)handle);
 | 
			
		||||
		if (deletefile)
 | 
			
		||||
			remove(outfname);
 | 
			
		||||
	#else
 | 
			
		||||
  if (handle!=NULL) {
 | 
			
		||||
    if (!deletefile)
 | 
			
		||||
      mfdump((MEMFILE*)handle);
 | 
			
		||||
    mfclose((MEMFILE*)handle);
 | 
			
		||||
  } /* if */
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void pc_resetasm(void *handle)
 | 
			
		||||
{
 | 
			
		||||
	assert(handle!=NULL);
 | 
			
		||||
	#if defined __MSDOS__ || defined SC_LIGHT
 | 
			
		||||
		fflush((FILE*)handle);
 | 
			
		||||
		fseek((FILE*)handle,0,SEEK_SET);
 | 
			
		||||
	#else
 | 
			
		||||
  mfseek((MEMFILE*)handle,0,SEEK_SET);
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pc_writeasm(void *handle,char *string)
 | 
			
		||||
int pc_writeasm(void *handle,const char *string)
 | 
			
		||||
{
 | 
			
		||||
	#if defined __MSDOS__ || defined SC_LIGHT
 | 
			
		||||
		return fputs(string,(FILE*)handle) >= 0;
 | 
			
		||||
	#else
 | 
			
		||||
  return mfputs((MEMFILE*)handle,string);
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char *pc_readasm(void *handle, char *string, int maxchars)
 | 
			
		||||
{
 | 
			
		||||
	#if defined __MSDOS__ || defined SC_LIGHT
 | 
			
		||||
		return fgets(string,maxchars,(FILE*)handle);
 | 
			
		||||
	#else
 | 
			
		||||
  return mfgets((MEMFILE*)handle,string,maxchars);
 | 
			
		||||
	#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern memfile_t *bin_file;
 | 
			
		||||
@ -379,8 +354,7 @@ void *pc_openbin(char *filename)
 | 
			
		||||
 | 
			
		||||
void pc_closebin(void *handle,int deletefile)
 | 
			
		||||
{
 | 
			
		||||
	if (deletefile)
 | 
			
		||||
	{
 | 
			
		||||
  if (deletefile) {
 | 
			
		||||
    memfile_destroy((memfile_t *)handle);
 | 
			
		||||
    bin_file = NULL;
 | 
			
		||||
  } else {
 | 
			
		||||
 | 
			
		||||
@ -580,7 +580,7 @@ int  pc_eofsrc(void *handle);
 | 
			
		||||
void *pc_openasm(char *filename); /* read/write */
 | 
			
		||||
void pc_closeasm(void *handle,int deletefile);
 | 
			
		||||
void pc_resetasm(void *handle);
 | 
			
		||||
int  pc_writeasm(void *handle,char *str);
 | 
			
		||||
int  pc_writeasm(void *handle,const char *str);
 | 
			
		||||
char *pc_readasm(void *handle,char *target,int maxchars);
 | 
			
		||||
 | 
			
		||||
/* output to binary (.AMX) file */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user