Exemplo n.º 1
0
// 関数の引数を出力フォーマットに変換
//////////////////////////////////////////////////////////////////////////////
void InnerPrint
	( EStreamBuffer & bufOut,
		ECSContext & context, EObjArray<ECSObject> & lstArg )
{
	for ( int i = 0; i < (int) lstArg.GetSize(); i ++ )
	{
		ECSObject *	pObj = lstArg.GetAt(i)->GetObjectEntity( ) ;
		if ( pObj == NULL )
		{
			continue ;
		}
		EString	strFormat ;
		switch ( pObj->m_vtType )
		{
		case	csvtString:
			strFormat = ((ECSString*)pObj)->m_varStr ;
			bufOut.Write( strFormat.CharPtr(), strFormat.GetLength() ) ;
			break ;
		case	csvtInteger:
			strFormat = EString( (int) ((ECSInteger*)pObj)->m_varInt ) ;
			bufOut.Write( strFormat.CharPtr(), strFormat.GetLength() ) ;
			break ;
		case	csvtReal:
			strFormat = EString( ((ECSInteger*)pObj)->m_varInt ) ;
			bufOut.Write( strFormat.CharPtr(), strFormat.GetLength() ) ;
			break ;
		default:
			pObj->DumpObject( bufOut, 0, context ) ;
			break ;
		}
	}
}
Exemplo n.º 2
0
/*!
 *
 */
void TEDisplayEpson::showText(const QString & text, const QString & category, 
		const QString & mode)
{
	SEffect eff;
	if (mode=="scroll-left" || mode.left(2)=="sl")
		eff=se_scrollleft;
	else if (mode=="scroll-right" || mode.left(2)=="sr")
		eff=se_scrollright;
	else if (mode.left(1)=="w")
		eff=se_wobble;
	else
		eff=se_scrollleft;
	if (category=="line2")
	{
		l2=EString(text,displayWidth());
		l2.setEffect(eff);
	}
	else if (category=="full")
	{
		l1=EString(text,displayWidth()*2);
		l1.setEffect(eff);
	}
	else
	{
		l1=EString(text,displayWidth());
		l1.setEffect(eff);
	}
};
Exemplo n.º 3
0
void IMAP::setClientBug( ClientBug bug )
{
    d->clientBugs[bug] = true;
    (void)new ImapResponse( this,
                            EString( "OK Activating workaround for: " ) +
                                     clientBugMessages[bug] );
}
Exemplo n.º 4
0
void Configuration::setup( const EString & global, bool allowFailure )
{
    d = new ConfigurationData;
    Allocator::addEternal( d, "configuration data" );

    if ( global.isEmpty() )
        return;
    else if ( global[0] == '/' )
        read( global, allowFailure );
    else
        read( EString( compiledIn( ConfigDir ) ) + "/" + global,
              allowFailure );

    EString hn = text( Hostname );
    if ( hn.find( '.' ) < 0 )
        log( "Hostname does not contain a dot: " + hn, Log::Error );
    if ( hn.lower() == "localhost" || hn.lower().startsWith( "localhost." ) )
        log( "Using localhost as hostname", Log::Error );

    if ( !present( UseIPv6 ) && toggle( UseIPv6 ) ) {
        int s = ::socket( PF_INET6, SOCK_STREAM, IPPROTO_TCP );
        bool bad = false;
        bool good = false;
        if ( s < 0 ) {
            bad = true;
        }
        if ( !bad ) {
            struct sockaddr_in6 in6;
            in6.sin6_family = AF_INET6;
            in6.sin6_port = ntohs( 17 ); // stomping on fortune is okay
            in6.sin6_flowinfo = 0;
            int i = 0;
            while ( i < 15 ) {
                in6.sin6_addr.s6_addr[i] = 0;
                ++i;
            }
            in6.sin6_addr.s6_addr[15] = ntohs( 1 );
            in6.sin6_scope_id = 0;
            if ( ::bind( s, (struct sockaddr *)&in6, sizeof( in6 ) ) < 0 ) {
                if ( errno == EADDRINUSE )
                    good = true; // someone is using that: fine
                else
                    bad = true; // some other error: IPv6 presumably broken
            }
        }
        if ( !good && !bad && s >= 0 ) {
            if ( ::listen( s, 1 ) < 0 )
                bad = true;
            else
                good = true;
        }
        if ( s >= 0 )
            ::close( s );
        if ( bad ) {
            log( "Setting default use-ipv6=off", Log::Info );
            add( "use-ipv6 = false" );
        }
    }
}
Exemplo n.º 5
0
EString ParametersReal::getString( const wchar_t* name, Monitor& monitor )
{
	if (!monitor) return EString();
	//TODO:
	throw std::runtime_error("Not Implemented");
}
Exemplo n.º 6
0
EString ParametersReal::itemAsString( Index i, Monitor& monitor )
{
	if (i>maxindex) return EString();
	//TODO:
	throw std::runtime_error("Not Implemented");
}
Exemplo n.º 7
0
EString ParametersReal::itemName( Index i )
{
	if (i>maxindex) return EString();
	//TODO:
	throw std::runtime_error("Not Implemented");
}
Exemplo n.º 8
0
Arquivo: recorder.cpp Projeto: aox/aox
int main( int argc, char ** argv )
{
    Scope global;
    EventLoop::setup();

    const char * error = 0;
    bool ok = true;
    if ( argc != 5 ) {
        error = "Wrong number of arguments";
        ok = false;
    }

    uint port = 0;
    if ( ok ) {
        port = EString( argv[1] ).number( &ok );
        if ( !ok )
            error = "Could not parse own port number";
    }
    if ( ok ) {
        Listener<RecorderServer> * l4
            = new Listener<RecorderServer>( Endpoint( "0.0.0.0", port ),
                                            "recording relay/4" );
        Allocator::addEternal( l4, "recording listener" );
        Listener<RecorderServer> * l6
            = new Listener<RecorderServer>( Endpoint( "::", port ),
                                            "recording relay/6" );
        Allocator::addEternal( l6, "recording listener" );

        if ( l4->state() != Connection::Listening &&
             l6->state() != Connection::Listening )
            error = "Could not listen for connections";
    }

    if ( ok ) {
        port = EString( argv[3] ).number( &ok );
        if ( !ok )
            error = "Could not parse server's port number";
    }

    if ( ok ) {
        EStringList l = Resolver::resolve( argv[2] );
        if ( l.isEmpty() ) {
            ok = false;
            error = (EString("Cannot resolve ") + argv[2] +
                     ": " + Resolver::errors().join( ", " ) ).cstr();
        }
        else {
            ep = new Endpoint( *l.first(), port );
            Allocator::addEternal( ep, "target server endpoint" );
        }
        if ( ep && !ep->valid() ) {
            ok = false;
            error = "Invalid server address";
        }
    }

    if ( !ok ) {
        fprintf( stderr,
                 "Error: %s\n"
                 "Usage: recorder port address port filebase\n"
                 "       First port: The recorder's own port.\n"
                 "       Address: The IP address of the server to forward to.\n"
                 "       Second port: The server port to forward to.\n"
                 "       Filebase: The filename base (.<blah> is added).\n",
                 error );
        exit( 1 );
    }

    ::base = new EString( argv[4] );
    Allocator::addEternal( ::base, "base of recorded file names" );

    global.setLog( new Log );
    EventLoop::global()->start();
}
Exemplo n.º 9
0
EString NumberReal::asHexString( bool reversed /*= false*/ )
{
	//TODO:
	throw std::runtime_error("Not Implemented");
	return EString();
}