明辉手游网中心:是一个免费提供流行视频软件教程、在线学习分享的学习平台!

CGI图文说明教程(6)调用CGI脚本文件的例子之3

[摘要]调用CGI脚本文件的例子上面的程序当然还需要两个文件,即t99_type.h和mas_cvo.cpp。具体代码请看下一页。如下://以下是t99_type.h文件#ifndef MAS_TYPE#define MAS_TYPE#ifndef __TURBOC__# define __TURBOC_...
调用CGI脚本文件的例子

上面的程序当然还需要两个文件,即t99_type.h和mas_cvo.cpp。具体代码请看下一页。如下:

//以下是t99_type.h文件

#ifndef MAS_TYPE

#define MAS_TYPE

#ifndef __TURBOC__

# define __TURBOC__ 0x0000

#endif

#define V5 (__TURBOC__ >= 0x0500 )

#define V4 (__TURBOC__ >= 0x0400 && __TURBOC__ <= 0x0499 )

#define V3 (__TURBOC__ >= 0x0300 && __TURBOC__ <= 0x0399 )

#if V3

#define DOES_NOT_HAVE_BOOL

#define DOES_NOT_HAVE_STRING

#define DOES_NOT_HAVE_EXCEPTION

#define DOES_NOT_HAVE_EXCEPTION_CLASSES

#define DOES_NOT_HAVE_MUTABLE

#define DOES_NOT_HAVE_EXPLICIT

#define DOES_NOT_HAVE_NAMESPACE_STD

#endif

#if V4

#define DOES_NOT_HAVE_BOOL

#define DOES_NOT_HAVE_EXCEPTION_CLASSES

#define DOES_NOT_HAVE_MUTABLE

#define DOES_NOT_HAVE_EXPLICIT

#define DOES_NOT_HAVE_NAMESPACE_STD

#endif

#if V5

#define DOES_NOT_HAVE_EXCEPTION_CLASSES

//#define HAS_NAMESPACE_STD

#endif

#ifdef __GNUC__

//#define NEED_TO_INCLUDE_libioP

//#define DOES_NOT_HAVE_EXCEPTION -fhandle-execeptions

#define DOES_NOT_HAVE_EXCEPTION_CLASSES

//#include (Broken)

#define DOES_NOT_HAVE_MUTABLE

#define DOES_NOT_HAVE_EXPLICIT

#define DOES_NOT_HAVE_NAMESPACE_STD

#endif

#ifdef DOES_NOT_HAVE_NAMESPACE_STD

#define std

#endif

#ifdef NEED_TO_INCLUDE_libioP

#include

#endif

#ifdef DOES_NOT_HAVE_BOOL

# define bool int

# define true 1

# define false 0

#endif

#ifdef DOES_NOT_HAVE_MUTABLE

# define mutable

#endif

#ifdef DOES_NOT_HAVE_EXPLICIT

# define explicit

#endif

#ifdef DOES_NOT_HAVE_EXCEPTION

# define throw

# define try

# define catch( parameter ) exception err; if ( false )

#endif

#undef DOES_NOT_HAVE_EXCEPTION_CLASSES

#ifdef DOES_NOT_HAVE_EXCEPTION_CLASSES

# ifdef DOES_NOT_HAVE_STRING

# include "t99_str.h"

# else

# ifdef __GNUC__

# include

# //include

# //include "t99_str.h"

# //include

# else

# include

# endif

# endif

class exception

{

public:

exception( const string& arg="" )

{

the_message = arg;

}

virtual ~exception(){};

virtual const char* what()

{

return the_message.c_str();

}

private:

string the_message;

};

class logic_error: public exception

{

public:

logic_error( const string& arg ) : exception( arg ) {};

};

class runtime_error: public exception

{

public:

runtime_error( const string& arg ) : exception( arg ) {};

};

class range_error: public runtime_error

{

public:

range_error( const string& arg ) : runtime_error( arg ) {};

};

class overflow_error: public runtime_error

{

public:

overflow_error( const string& arg ) : runtime_error( arg ) {};

};

class domain_error: public logic_error

{

public:

domain_error( const string& arg ) : logic_error( arg ) {};

};

class out_of_range: public logic_error

{

public:

out_of_range( const string& arg ) : logic_error( arg ) {};

};

class invalid_argument: public logic_error

{

public:

invalid_argument( const string& arg ) : logic_error( arg ) {};

};

class length_error: public logic_error

{

public:

length_error( const string& arg ) : logic_error( arg ) {};

};

#endif

#endif

下一页是mas_cvo.cpp文件