home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
BEGINCPP.ZIP
/
#1.C
next >
Wrap
C/C++ Source or Header
|
1990-07-29
|
6KB
|
189 lines
#line 1 "#1.cxx"
void *_new(long);
void _delete(void*);
void *_vec_new(void*,int,int,void*(*)(void*));
void _vec_delete(void*,int,int,void(*)(void*,int),...);
void exit(int);
static void cdecl _STI();
static void cdecl _STD();
typedef unsigned int size_t ;
typedef char *va_list ;
struct _iobuf {
char *__iobuf__ptr ;
int __iobuf__cnt ;
char *__iobuf__base ;
char __iobuf__flag ;
char __iobuf__file ;} ;
extern struct _iobuf _iob [];
int _filbuf (struct _iobuf *);
int _flsbuf (int , struct _iobuf *);
void clearerr (struct _iobuf *);
int fclose (struct _iobuf *);
int fcloseall (void );
struct _iobuf *fdopen (int , char *);
int fflush (struct _iobuf *);
int fgetc (struct _iobuf *);
int fgetchar (void );
int fgetpos (struct _iobuf *, long *);
char *fgets (char *, int , struct _iobuf *);
int flushall (void );
struct _iobuf *fopen (char *, char *);
int fprintf (struct _iobuf *, char *, ... );
int fputc (int , struct _iobuf *);
int fputchar (int );
int fputs (char *, struct _iobuf *);
size_t fread (void *, size_t , size_t , struct _iobuf *);
struct _iobuf *freopen (char *, char *, struct _iobuf *);
int fscanf (struct _iobuf *, char *, ... );
int fsetpos (struct _iobuf *, long *);
int fseek (struct _iobuf *, long , int );
long ftell (struct _iobuf *);
size_t fwrite (void *, size_t , size_t , struct _iobuf *);
char *gets (char *);
int getw (struct _iobuf *);
void perror (char *);
int printf (char *, ... );
int puts (char *);
int putw (int , struct _iobuf *);
int remove (char *);
int rename (char *, char *);
void rewind (struct _iobuf *);
int rmtmp (void );
int scanf (char *, ... );
void setbuf (struct _iobuf *, char *);
int setvbuf (struct _iobuf *, char *, int , size_t );
int sprintf (char *, char *, ... );
int sscanf (char *, char *, ... );
char *tempnam (char *, char *);
struct _iobuf *tmpfile (void );
char *tmpnam (char *);
int ungetc (int , struct _iobuf *);
int unlink (char *);
int vfprintf (struct _iobuf *, char *, va_list );
int vprintf (char *, va_list );
int vsprintf (char *, char *, va_list );
void *memccpy (void *, void *, int , unsigned int );
void *memchr (void *, int , size_t );
int memcmp (void *, void *, size_t );
int memicmp (void *, void *, unsigned int );
void *memcpy (void *, void *, size_t );
void *memmove (void *, void *, size_t );
void *memset (void *, int , size_t );
void movedata (unsigned int , unsigned int , unsigned int , unsigned int , unsigned int );
char *strcat (char *, char *);
char *strchr (char *, int );
int strcmp (char *, char *);
int strcmpi (char *, char *);
int stricmp (char *, char *);
char *strcpy (char *, char *);
size_t strcspn (char *, char *);
char *strdup (char *);
char *_strerror (char *);
char *strerror (int );
size_t strlen (char *);
char *strlwr (char *);
char *strncat (char *, char *, size_t );
int strncmp (char *, char *, size_t );
int strnicmp (char *, char *, size_t );
char *strncpy (char *, char *, size_t );
char *strnset (char *, int , size_t );
char *strpbrk (char *, char *);
char *strrchr (char *, int );
char *strrev (char *);
char *strset (char *, int );
size_t strspn (char *, char *);
char *strstr (char *, char *);
char *strtok (char *, char *);
char *strupr (char *);
struct String {
char *_String_str ;
} ;
int _String_count ;
struct String *_String__ctorNFNPC__ (struct String* , char *);
char *_String__ONPC (struct String* );
extern void report (void );
extern int _ltNFCString__CString___ (struct String , struct String );
//This is constructor String::String(char *)
struct String *_String__ctorNFNPC__ (register struct String *this , char *_au0_s )
{
if (this == 0 )
this = (struct String *)_new ( (long )(sizeof (struct String))) ;
_String_count ++ ;
this -> _String_str = (((char *)_new (
(long )((sizeof (char ))* (strlen ( (char *)_au0_s ) + 1 ))) ));
strcpy ( this -> _String_str , (char *)_au0_s ) ;
return this ;
}
//This is String::operator char*()
char *_String__ONPC (register struct String *this ) {
char *_au1_p = 0 ;
_au1_p = (((char *)_new ( (long )
((sizeof (char ))*(strlen ( (char *)this -> _String_str ) + 1 ))) ));
strcpy ( _au1_p , (char *)this -> _String_str ) ;
return _au1_p ;
}
extern int _ltNFCString__CString___ (struct String _au0_s1 , struct String _au0_s2 )
{
return strcmp ( (char *)_au0_s1 . _String_str , (char *)_au0_s2 . _String_str ) ;
}
extern void report ()
{
printf ( (char *)"Report on String usage: ") ;
printf ( (char *)" %d Strings created\n", _String_count ) ;
}
int main ()
{
{
struct String _au1_s0 ;
struct String _au1_s1 ;
struct String _au1_s2 ;
struct String *_au1_sp = 0 ;
char *_au1_cp = 0 ;
( ( (_String_count ++ ), ( ((& _au1_s0 )-> _String_str =
(((char *)_new ( (long )(sizeof (char ))) ))),
( ((*(& _au1_s0 )-> _String_str )= 0 ), (((& _au1_s0 )))) ) ) ) ;
_String__ctorNFNPC__ ( & _au1_s1 , "s1 == \"Hello C\"\n") ;
_String__ctorNFNPC__ ( & _au1_s2 , "s2 == \"Hello C++\"\n") ;
_au1_sp = (struct String *)_String__ctorNFNPC__ (
(struct String *)0 , "Hello world!") ;
_au1_cp = _String__ONPC ( _au1_sp ) ;
if (! strcmp ( (char *)_au1_cp , (char *)_String__ONPC ( _au1_sp ) ) )
printf ( (char *)"char *cp == (char *) *sp == \"%s\"\n", _au1_cp ) ;
( printf ( (char *)"%s", (& _au1_s1 )-> _String_str ) ) ;
( printf ( (char *)"%s", (& _au1_s2 )-> _String_str ) ) ;
if (( (strcmp ( (char *)(& _au1_s1 )-> _String_str ,
(char *)_au1_s2 . _String_str ) < 0 )) )
printf ( (char *)"s1.operator < (s2)\n") ;
if (_ltNFCString__CString___ ( _au1_s1 , _au1_s2 ) )
printf ( (char *)"operator < (s1, s2)\n") ;
report ( ) ;
( (( ( ( _delete ( (void *)(& _au1_s2 )-> _String_str ) , 0 ) ,
(( (0 ), 0 ) )) , 0 ) ), 0 ) ;
( (( ( ( _delete ( (void *)(& _au1_s1 )-> _String_str ) , 0 ) ,
(( (0 ), 0 ) )) , 0 ) ), 0 ) ;
( (( ( ( _delete ( (void *)(& _au1_s0 )-> _String_str ) , 0 ) ,
(( (0 ), 0 ) )) , 0 ) ), 0 ) ;
} exit ( 0 );
}