Exemplo n.º 1
0
BEGIN_NAMESPACE_QPOASES


/*
 *	p r i n t
 */
returnValue print( const real_t* const v, int_t n, const char* name )
{
	#ifndef __SUPPRESSANYOUTPUT__

	int_t i;
	char myPrintfString[MAX_STRING_LENGTH];

	/* Print vector name. */
	if ( name != 0 )
	{
		snprintf( myPrintfString,MAX_STRING_LENGTH,"%s = \n", name );
		myPrintf( myPrintfString );
	}

	/* Print vector data. */
	for( i=0; i<n; ++i )
	{
		snprintf( myPrintfString,MAX_STRING_LENGTH," %.16e\t", v[i] );
		myPrintf( myPrintfString );
	}
	myPrintf( "\n" );

	#endif /* __SUPPRESSANYOUTPUT__ */

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 2
0
static void dumpOneReloc( void (*output)( char ), jit_code_str *header, jit_reloc *reloc )
{
    assert( reloc->type < JIT_RELOC_LAST );
    myPrintf( output, "\ttype:   %d (%s)\n", reloc->type, relocTypes[ reloc->type ] );
    myPrintf( output, "\toffset: 0x%4.4x\n", reloc->location - header->code.offset );
    myPrintf( output, "\ttarget: " );
    switch( reloc->type ) {
    case JIT_RELOC_METHOD_OFFSET:
    case JIT_RELOC_FIELD_OFFSET:
    case JIT_RELOC_METHOD_ADDR:
    case JIT_RELOC_FIELD_ADDR:
        myPrintf( output, "cp_index=%d\n", reloc->u.cp_index );
        break;
    case JIT_RELOC_DATA_REF:
        myPrintf( output, "addend=%d\n", reloc->u.addend );
        break;
    case JIT_RELOC_HELPER_FUNC:
        myPrintf( output, "helper_func=%s\n",helperTypes[ reloc->u.helper_index] );
        break;
    case JIT_RELOC_RT_FUNC:
        myPrintf( output, "rt_func=%d\n", reloc->u.rt_index );
        break;
    case JIT_RELOC_METHOD_HANDLE:
        myPrintf( output, "method=%d\n", reloc->u.cp_index );
    case JIT_RELOC_CLASS_HANDLE:
    case JIT_RELOC_INTERFACE_HANDLE:
        myPrintf( output, "class=%d\n", reloc->u.cp_index );
        break;
    }
    myPrintf( output, "\t*******************************\n" );
}
Exemplo n.º 3
0
/*
 *	p r i n t
 */
returnValue print( const int_t* const index, int_t n, const char* name )
{
	#ifndef __SUPPRESSANYOUTPUT__

	int_t i;
	char myPrintfString[MAX_STRING_LENGTH];

	/* Print indexlist name. */
	if ( name != 0 )
	{
		snprintf( myPrintfString,MAX_STRING_LENGTH,"%s = \n", name );
		myPrintf( myPrintfString );
	}

	/* Print a indexlist data. */
	for( i=0; i<n; ++i )
	{
		snprintf( myPrintfString,MAX_STRING_LENGTH," %d\t", (int)(index[i]) );
		myPrintf( myPrintfString );
	}
	myPrintf( "\n" );

	#endif /* __SUPPRESSANYOUTPUT__ */

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 4
0
void cmdSnapshot(TSSAnalyzer &analyzer)
{
	myPrintf("Capture snapshot for now. Wait ...\n");
	int64_t nowTS = g_QPCHelper.GetQPCNow();
	while(nowTS > g_heapMonitor.LastTS())
	{
		Sleep(200);
	}
	analyzer.UpdateSnapshot();
	myPrintf("OK!\n");
}
Exemplo n.º 5
0
static void dumpOpcodes( void (*output)( char ), char const *what, unsigned size )
{
    unsigned            i;

    myPrintf( output, "\t" );
    for( i = 0; i < size; i++ ) {
        myPrintf( output, "%2.2x ", what[i] );
    }
    while( i < 10 ) {
        myPrintf( output, "   " );
        i++;
    }
}
Exemplo n.º 6
0
void cmdStatus()
{
	HeapMonitor::STATUS status;
	g_heapMonitor.Status(status);

	myPrintf("%llu : %llu : %llu : %llu\n",
		status.processTimes, status.processed, status.spendTime,
		status.processed / (status.spendTime ? status.spendTime : 1) );
	myPrintf("%llu : %llu : %llu : %llu : %llu\n",
		status.ks.total, status.ks.success, status.ks.parseFailed,
		status.ks.maxDur, status.ks.versionIgnore);
	myPrintf("%llu : %llu : %llu : %llu : %llu\n",
		status.hs.total, status.hs.success, status.hs.parseFailed,
		status.hs.maxDur, status.hs.versionIgnore);
}
Exemplo n.º 7
0
/*
 *  p r i n t
 */
returnValue Bounds::print( )
{
    if ( n == 0 )
        return SUCCESSFUL_RETURN;

    #ifndef __SUPPRESSANYOUTPUT__

    char myPrintfString[MAX_STRING_LENGTH];

    int_t nFR = getNFR( );
    int_t nFX = getNFX( );

    int_t* FR_idx;
    getFree( )->getNumberArray( &FR_idx );

    int_t* FX_idx;
    getFixed( )->getNumberArray( &FX_idx );

    snprintf( myPrintfString,MAX_STRING_LENGTH,"Bounds object comprising %d variables (%d free, %d fixed):\n",(int)n,(int)nFR,(int)nFX );
    myPrintf( myPrintfString );

    REFER_NAMESPACE_QPOASES print( FR_idx,nFR,"free " );
    REFER_NAMESPACE_QPOASES print( FX_idx,nFX,"fixed" );

    #endif /* __SUPPRESSANYOUTPUT__ */

    return SUCCESSFUL_RETURN;
}
Exemplo n.º 8
0
void cmdUse(TSSAnalyzer &analyzer, int argc, wchar_t** argv)
{
	if (argc > 1)
	{
		tst_pid pid = _wtoi(argv[1]);
		bool fSuccess = analyzer.SetTargetProcess(pid);
		if (fSuccess)
			myPrintf("Switch to process %u\n", pid);
		else
			myPrintf("Unknown process\n");
	}
	else
	{
		myPrintf("Current process is %u\n", analyzer.TargetProcess());
	}
}
Exemplo n.º 9
0
Arquivo: Utils.cpp Projeto: rtkg/acado
/*
 *	p r i n t C o p y r i g h t N o t i c e
 */
returnValue printCopyrightNotice( )
{
	#ifndef __NO_COPYRIGHT__
	myPrintf( "\nqpOASES -- An Implementation of the Online Active Set Strategy.\nCopyright (C) 2007-2009 by Hans Joachim Ferreau et al. All rights reserved.\n\nqpOASES is distributed under the terms of the \nGNU Lesser General Public License 2.1 in the hope that it will be \nuseful, but WITHOUT ANY WARRANTY; without even the implied warranty \nof MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \nSee the GNU Lesser General Public License for more details.\n\n" );
	#endif
	return SUCCESSFUL_RETURN;
}
Exemplo n.º 10
0
/*
 *	p r i n t
 */
returnValue Bounds::print( )
{
	if ( n == 0 )
		return SUCCESSFUL_RETURN;

	#ifndef __XPCTARGET__
	#ifndef __DSPACE__
	char myPrintfString[160];

	int nFR = getNFR( );
	int nFX = getNFX( );

	int* FR_idx;
	getFree( )->getNumberArray( &FR_idx );

	int* FX_idx;
	getFixed( )->getNumberArray( &FX_idx );

	snprintf( myPrintfString,160,"Bounds object comprising %d variables (%d free, %d fixed):\n",n,nFR,nFX );
	myPrintf( myPrintfString );

	REFER_NAMESPACE_QPOASES print( FR_idx,nFR,"free " );
	REFER_NAMESPACE_QPOASES print( FX_idx,nFX,"fixed" );

	#endif
	#endif

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 11
0
/*
 *	p r i n t
 */
returnValue Constraints::print( )
{
	if ( n == 0 )
		return SUCCESSFUL_RETURN;

	#ifndef __SUPPRESSANYOUTPUT__

	char myPrintfString[MAX_STRING_LENGTH];

	int_t nIAC = getNIAC( );
	int_t nAC  = getNAC( );

	int_t* IAC_idx;
	getInactive( )->getNumberArray( &IAC_idx );

	int_t* AC_idx;
	getActive( )->getNumberArray( &AC_idx );

	snprintf( myPrintfString,MAX_STRING_LENGTH,"Constraints object comprising %d constraints (%d inactive, %d active):\n",(int)n,(int)nIAC,(int)nAC );
	myPrintf( myPrintfString );

	REFER_NAMESPACE_QPOASES print( IAC_idx,nIAC,"inactive" );
	REFER_NAMESPACE_QPOASES print( AC_idx, nAC, "active  " );

	#endif /* __SUPPRESSANYOUTPUT__ */

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 12
0
static void dumpEhTable( void (*output)( char ), jit_code_str *header )
{
    int                 i;
    int                 count;
    jit_eh_table       *curr;
    int offset;

    curr = (jit_eh_table *)((char *)header + header->eh_table.offset);
    count = header->eh_table.size / sizeof( jit_eh_table );
    offset = 0;
    myPrintf( output, "\toffset:beg end handler class\n" );
    for( i = 0; i < count; i++, curr++ ) {
        myPrintf( output, "\t  %4.4x:%4.4x %4.4x %4.4x    %4.4x\n", offset,
            curr->beg,curr->end,curr->handler,curr->cp_index );
        offset += sizeof( jit_eh_table );
    }
}
Exemplo n.º 13
0
void DumpJitCodeStr( const char *buffer, unsigned len, void (*output)( char ) )
{
    jit_code_str        *header;

    header = (jit_code_str *)buffer;
    switch( header->arch ) {
    case JIT_ARCH_I86:
    case JIT_ARCH_SPARC:
        myPrintf( output, "arch: %d (%s)\n", header->arch, archTypes[ header->arch ] );
        dumpSection( output, "code", &header->code );
        dumpSection( output, "data", &header->data );
        dumpSection( output, "eh_table", &header->eh_table );
        dumpSection( output, "pdata", &header->pdata );
        dumpSection( output, "relocs", &header->relocs );
        myPrintf( output, "code:\n" );
        dumpCode( output, header );
        myPrintf( output, "data:\n" );
        dumpData( output, header );
        myPrintf( output, "eh_table:\n" );
        dumpEhTable( output, header );
        myPrintf( output, "pdata:\n" );
        dumpPData( output, header );
        myPrintf( output, "relocs:\n" );
        dumpRelocs( output, header );
        break;
    default:
        myPrintf( output, "not a valid code string: arch = %d\n", header->arch );
    }
}
Exemplo n.º 14
0
Arquivo: Utils.cpp Projeto: rtkg/acado
/*
 *	p r i n t
 */
returnValue print( const double* const v, int n )
{
	#ifndef __XPCTARGET__
	int i;
	char myPrintfString[160];

	/* Print a vector. */
	myPrintf( "[\t" );
	for( i=0; i<n; ++i )
	{
		snprintf( myPrintfString,160," %.16e\t", v[i] );
		myPrintf( myPrintfString );
	}
	myPrintf( "]\n" );
	#endif

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 15
0
Arquivo: Utils.cpp Projeto: rtkg/acado
/*
 *	p r i n t
 */
returnValue print( const int* const index, int n )
{
	#ifndef __XPCTARGET__
	int i;
	char myPrintfString[160];

	/* Print a indexlist. */
	myPrintf( "[\t" );
	for( i=0; i<n; ++i )
	{
		snprintf( myPrintfString,160," %d\t", index[i] );
		myPrintf( myPrintfString );
	}
	myPrintf( "]\n" );
	#endif

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 16
0
static void dumpData( void (*output)( char ), jit_code_str *header )
{
    int offset;
    char *curr;
    curr = (char *)header + header->data.offset;
    for( offset = 0; offset < header->data.size; offset += 4 ) {
        myPrintf( output, "\t%4.4x:%4.4x\n", offset, *(long*)curr );
        curr+= 4;
    }
}
Exemplo n.º 17
0
int main(void){
	
	char *nome = malloc(100);	
	char s;
	int i =67 ;
	
	myPrintf("Digite sua idade:\n");
	myScanf("%d",&i);
	myPrintf("Digite seu nome:\n");
	myScanf("%s",nome);
	myPrintf("Digite seu sexo (m/f):\n");
	myScanf("%c",&s);
	if(i > 18){
		myPrintf("Ola %s. Você é maior de idade. Você tem %d anos. E é do sexo: %c \n",nome,i,s);
	}else{	
		myPrintf("Ola %s. Você é menor de idade. Você tem %d anos. E é do sexo: %c \n",nome,i,s);	
	}
	return 0;
}
Exemplo n.º 18
0
static void testFormat(const char * fmt,...)
{
    char buf1[1024];
    char buf2[1024];

    va_list list;
#if  XCFG_FORMAT_VA_COPY
    va_list args;

    va_start(args,fmt);
#else
    va_start(list,fmt);
#endif

#if  XCFG_FORMAT_VA_COPY
    va_copy(list,args);
#endif

    myPrintf(buf1,fmt,list);

#if  XCFG_FORMAT_VA_COPY
    va_end(list);
#endif

#if  XCFG_FORMAT_VA_COPY
    va_copy(list,args);
#endif

    vsprintf(buf2,fmt,list);

#if  XCFG_FORMAT_VA_COPY
    va_end(list);
#endif


    if (*fmt != '*' && strcmp(buf1,buf2))
    {
        printf("XFormat : '%s'\nvsprintf: '%s'\nFormat  : '%s' failed\n",
               buf1,buf2,fmt);
        exit(1);
    }
    else
    {
        printf("'%s'\n'%s'\n",buf1,buf2);

    }

#if  XCFG_FORMAT_VA_COPY
    va_end(args);
    (void)args;
#else
    va_end(list);
#endif

}
Exemplo n.º 19
0
Arquivo: Utils.cpp Projeto: rtkg/acado
/*
 *	p r i n t
 */
returnValue print( const double* const M, int nrow, int ncol )
{
	#ifndef __XPCTARGET__
	int i;

	/* Print a matrix as a collection of row vectors. */
	for( i=0; i<nrow; ++i )
		print( &(M[i*ncol]), ncol );
	myPrintf( "\n" );
	#endif

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 20
0
inline obj eval_symbol(obj exp){	//assuming a symbol
	obj rr = find_var(exp);
	if(rr) return rr;
	rr = search_assoc(curr_interp->types, exp);	//type id
	if(rr) return rr;
	if(strcmp(ustr(exp), "glist")==0) return retain(curr_interp->gl_vars);
	obj (*func)(obj) = searchFunc(exp, specials);
	if(func) return tag(tSpecial, func);
	print(exp);
	myPrintf(" ");
	error(":undefined identifer");
	return nil;
}
Exemplo n.º 21
0
int _write(int file, char *ptr, int len) {

	//user code example

//	int i;
//	(void) file;
//	for (i = 0; i < len; i++) {
//		// UART_PutChar is user's basic output function
//		UART_PutChar(*ptr++);
//	}
//	return len;
	myPrintf(ptr, len);
	return len;
}
Exemplo n.º 22
0
/*
 *	p r i n t
 */
returnValue print(	const real_t* const M, int_t nrow, int_t ncol, const int_t* const ROW_idx, const int_t* const COL_idx, const char* name )
{
	#ifndef __SUPPRESSANYOUTPUT__

	int_t i;
	char myPrintfString[MAX_STRING_LENGTH];

	/* Print matrix name. */
	if ( name != 0 )
	{
		snprintf( myPrintfString,MAX_STRING_LENGTH,"%s = \n", name );
		myPrintf( myPrintfString );
	}

	/* Print a permuted matrix data as a collection of permuted row vectors. */
	for( i=0; i<nrow; ++i )
		print( &( M[ ROW_idx[i]*ncol ] ), ncol, COL_idx );
	myPrintf( "\n" );

	#endif /* __SUPPRESSANYOUTPUT__ */

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 23
0
static void dumpCodeBuff( void (*output)( char ),
                          code_buff *buff )
{
    dis_handle          handle;
    dis_dec_ins         ins;
    char                name[ MAX_INS_NAME ];
    char                ops[ MAX_OBJ_NAME + 24 ];

    DisInit( buff->cpu, &handle );
    while( buff->offset < buff->length ){
        DisDecodeInit( &handle, &ins );
        if( buff->cpu == DISCPU_x86 ) {
            ins.flags |= DIF_X86_USE32_FLAGS;
        }
        DisDecode( &handle, buff, &ins );
        DisFormat( &handle, buff, &ins, DFF_AXP_SYMBOLIC_REG|DFF_PSEUDO, &name, &ops );
        myPrintf( output, "\t%4.4x:", buff->offset );
        dumpOpcodes( output, buff->start+buff->offset, ins.size );
        myPrintf( output, "\t%s\t%s\n", name, ops );
        buff->offset += ins.size;
    }
    DisFini( &handle );
}
Exemplo n.º 24
0
List *listInit(pCompareFn compareFn)
{
	List *p = (List *)malloc(sizeof(List));
	if(!p)
	{
		myPrintf(("Can not malloc memory\n"));
		return NULL;
	}
	p->head = NULL;
	p->tail = NULL;
	p->size = 0 ;
	p->compareFn = compareFn;
	return p;
}
Exemplo n.º 25
0
static void doBanner( void )
{
    myPrintf( banner1w( "Win386 Bind Utility",_WBIND_VERSION_ ) "\n" );
    myPrintf( banner2 "\n" );
    myPrintf( banner2a( "1991" ) "\n" );
    myPrintf( banner3 "\n" );
    myPrintf( banner3a "\n" );
    myPrintf("\n");
}
Exemplo n.º 26
0
void interpret(Interpreter interp, char* line){

//	for(int i=0; i<1000000000; ){i=hoge(i,1);}
/*	for(int i=0; i<1000000*100; i++){
		if(!pool) fill_pool();
		obj rr=pool;
		pool = cdr(pool);
		rr->refcount = 1;
		rr->type = INT;
		if(rr->type == tNull) continue;
		rr->refcount--;
		cdr(rr) = pool;
		pool = rr;
	}//*/
/*	for(int i=0; i<1000000*100; i++){
		obj rr=alloc();
		rr->type = INT;
		release(rr);	
	}//*/

/*
obj u=Int(1);
obj e=Int(10000000);
obj x=Int(0);
//while(vrInt(compare('<', x, e))){
while(vrInt(LT(x, e))){
	obj r = add(x, u);
	release(x);
	x=r;
}
//*/
	curr_interp = interp;
	env = nil;
	obj stat = parseString(&line);

	obj rr = nil;
//	int t = TickCount();
	if(stat) {
		rr = eval(stat);
		release(stat);
	}
//	myPrintf(" %f sec.", (TickCount()-t)/60.);
	if(rr){
		myPrintf(">> ");
		print(rr);
		release(rr);
		scroll();
	}
}
Exemplo n.º 27
0
Arquivo: Utils.cpp Projeto: rtkg/acado
/*
 *	p r i n t
 */
returnValue print(	const int* const index, int n,
					const char* name
					)
{
	#ifndef __XPCTARGET__
	char myPrintfString[160];

	/* Print indexlist name ... */
	snprintf( myPrintfString,160,"%s = ", name );
	myPrintf( myPrintfString );
	#endif

	/* ... and the indexlist itself. */
	return print( index, n );
}
Exemplo n.º 28
0
Arquivo: Utils.cpp Projeto: rtkg/acado
/*
 *	p r i n t
 */
returnValue print(	const double* const M, int nrow, int ncol,
					const char* name
					)
{
	#ifndef __XPCTARGET__
	char myPrintfString[160];

	/* Print matrix name ... */
	snprintf( myPrintfString,160,"%s = ", name );
	myPrintf( myPrintfString );
	#endif

	/* ... and the matrix itself. */
	return print( M, nrow, ncol );
}
Exemplo n.º 29
0
Arquivo: Utils.cpp Projeto: rtkg/acado
/*
 *	p r i n t
 */
returnValue print(	const double* const M, int nrow, int ncol,
					const int* const ROW_idx, const int* const COL_idx
					)
{
	#ifndef __XPCTARGET__
	int i;

	/* Print a permuted matrix as a collection of permuted row vectors. */
	for( i=0; i<nrow; ++i )
		print( &( M[ ROW_idx[i]*ncol ] ), ncol, COL_idx );
	myPrintf( "\n" );
	#endif

	return SUCCESSFUL_RETURN;
}
Exemplo n.º 30
0
Arquivo: Utils.cpp Projeto: rtkg/acado
/*
 *	p r i n t
 */
returnValue print(	const double* const v, int n,
					const char* name
					)
{
	#ifndef __XPCTARGET__
	char myPrintfString[160];

	/* Print vector name ... */
	snprintf( myPrintfString,160,"%s = ", name );
	myPrintf( myPrintfString );
	#endif

	/* ... and the vector itself. */
	return print( v, n );
}