You are on page 1of 1

/**

* Testing internal macros for automatic detection of names, lines, regions and
* scopes for functions and classes.
*
* Date: Thu Jun 25 11:31:14 BRT 2015
* Authors: Michel Alves <malves@tecgraf.puc-rio.br>
*/
#include <iostream>
#include <cstdlib>
// Definition of a macro for calls without type
#define CALL( f, a ) f(a)
/**
* Definition of callback type: function with void return ...
*/
typedef void (*MyCallback)( int );
/**
* Definition of a function for calls with type
*/
void FUNCTION_CALL( MyCallback callback, int input )
{
callback( input );
}
/**
* Function for tests...
*/
static void TheCallback( int input )
{
std::cerr << "LINE: [" << input << "] for...: [" << __func__ << "]" << std::en
dl;
}
/**
* Function for tests...
*/
static void TheCallbackString( std::string str )
{
std::cerr << "FUNCTION: [" << str << "]" << std::endl;
}
/**
* Entry point. Main function.
*/
int main( int argc, char* argv[] )
{
std::cerr << "Executing entry point main function..." << std::endl;
CALL( TheCallback, __LINE__ );
FUNCTION_CALL( TheCallback, __LINE__ );
CALL( TheCallbackString, __func__ );
return EXIT_SUCCESS;
}

You might also like