/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.9
 *
 * This file is not intended to be easily readable and contains a number of
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
 * ----------------------------------------------------------------------------- */
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <math.h> /* required for special case floating point output */

// Do not edit below this line
// end-of-default-includes


#include <libv4lconvert.h>
#ifdef __gnu_linux__
#undef stderr
extern struct _IO_FILE *stderr;
#endif

typedef enum{ NONE = -1, GFORTH = 0, SWIFTFORTH, VFX } SwigTargetSystem;
SwigTargetSystem swigTargetSystem = NONE;

unsigned char swigPrintStackComments = 1;

/* comments */
void swigNewline()
{
	printf( "\n" );
}

void swigComment( char *comment )
{
	printf( "\\ %s", comment );
}

/* generic print */
void swigPrint( char* gforth, char *swiftForth, char *vfx )
{
	if( swigTargetSystem == GFORTH )
		printf( "%s", gforth );
	else if( swigTargetSystem == SWIFTFORTH )
		printf( "%s", swiftForth );
	else if( swigTargetSystem == VFX )
		printf( "%s", vfx );
	printf( "\n" );
}
void swigPrintSystem( SwigTargetSystem targetSystem, char *text )
{
	if( targetSystem == swigTargetSystem )
	    printf( "%s\n", text );
}

/* constants */
void swigIntConstant( long constant, char *name )
{
	printf( "#%ld\tconstant %s\n", constant, name );
}

void swigUnsignedIntConstant( unsigned long constant, char *name )
{
	printf( "#%lu\tconstant %s\n", constant, name );
}

void swigLongConstant( long long constant, char *name )
{
	printf( "#%lld.\t2constant %s\n", constant, name );
}

void swigUnsignedLongConstant( unsigned long long constant, char *name )
{
	printf( "#%llu.\t2constant %s\n", constant, name );
}

void swigFloatConstant( double constant, char *name )
{
	char buffer[128];
	sprintf( buffer, "%f", constant );

	/* if the constant contains no exponent, add one */
	char *s;
	for( s = buffer; *s != 0; s++ )
		if( *s == 'e' || *s == 'E' )
			break;

	/* exponent found */
	if( *s != 0 )
		printf( "%s\tfconstant %s\n", buffer, name );
	/* no exponent */
	else {
		/* special class? */
		int class = fpclassify( constant );
		if( class == FP_INFINITE )
			printf( "%sInf\tfconstant %s\n", constant < 0.0f ? "-" : "+", name );
		else if( class == FP_NAN )
			printf( "NaN\tfconstant %s\n", name );
		else
			/* treat as generic float */
			printf( "%se0\tfconstant %s\n", buffer, name );
        }
}

void swigStringConstant( char* constant, char *name )
{
	char c;
	printf( ": %s s\\\" ", name );
	while(( c = *constant++ ))
	{
		switch(c)
		{
			case '\b': printf( "\\b" ); break;
			case '\n': printf( "\\n" ); break;
			case '\f': printf( "\\f" ); break;
			case '\r': printf( "\\r" ); break;
			case '\t': printf( "\\t" ); break;
			case '"' : printf( "\\q" ); break;
			default:
				if(c < 0x20)
					printf("\\x%02x", c);
				else
					printf("%c", c); break;
		}
	}
	printf(	"\" ;\n" );
}

/* structs */
void swigStructField( char *name, size_t offset, size_t size )
{
	printf( "\tdrop %zu %zu +field %s\n", offset, size, name );
}

/* functions */
void swigFunction( char* gforth, char *swiftForth, char *vfx, char *stackComment )
{
	if( swigTargetSystem == GFORTH )
		printf( "%s", gforth );
	else if( swigTargetSystem == SWIFTFORTH )
		printf( "%s", swiftForth );
	else if( swigTargetSystem == VFX )
		printf( "%s", vfx );

	if( swigPrintStackComments )
		printf( "%s", stackComment );

	printf( "\n" );
}

/* function pointers */
void swigFunctionPointer( char* gforth, char *swiftForth, char *vfx, char *stackComment )
{
	swigFunction( gforth, swiftForth, vfx, stackComment );
}

/* callbacks */
void swigCallback( char* gforth, char *swiftForth, char *vfx, char *stackComment )
{
	swigFunction( gforth, swiftForth, vfx, stackComment );
}

void swigUsage( char **argv )
{
	fprintf( stderr, "Usage: %s [-gforth|-swiftforth|-vfx]\n", argv[0] );
}

int main( int argc, char **argv )
{
	int i;

	/* check arguments */
	for( i = 1; i < argc; i++ )
		if( strcmp( argv[i], "-gforth" ) == 0 )
			swigTargetSystem = GFORTH;
		else if( strcmp( argv[i], "-swiftforth" ) == 0 )
			swigTargetSystem = SWIFTFORTH;
		else if( strcmp( argv[i], "-vfx" ) == 0 )
			swigTargetSystem = VFX;

	if( swigTargetSystem == NONE )
	{
		fprintf( stderr, "Error: no target system specified\n" );
		swigUsage( argv );
		return 1;
	}

	/* primer */
	printf( "\\ This file has been generated using SWIG and fsi,\n"
		"\\ and is already platform dependent, search for the corresponding\n"
		"\\ fsi-file to compile it where no one has compiled it before ;)\n"
		"\\ Forth systems have their own own dynamic loader and don't need addional C-Code.\n"
		"\\ That's why this file will just print normal forth-code once compiled\n"
		"\\ and can be used directly with include or require.\n"
		"\\ As all comments are stripped during the compilation, please\n"
		"\\ insert the copyright notice of the original file here.\n"
	);



	swigNewline();

	swigComment("----===< prefix >===-----\n");

	swigPrint( "c-library v4lconvert\ns\" v4lconvert\" add-lib\n\\c #include <libv4lconvert.h>\n\\c #ifdef __gnu_linux__\n\\c #undef stderr\n\\c extern struct _IO_FILE *stderr;\n\\c #endif", "( none )", "( none )" );

	swigNewline();

	swigComment("------===< functions >===-------\n");
	swigFunction( "c-function v4lconvert_get_default_dev_ops v4lconvert_get_default_dev_ops  -- a", "FUNCTION: v4lconvert_get_default_dev_ops (  -- a )", "EXTERN: \"C\" void * v4lconvert_get_default_dev_ops(  );", "	( -- )" );
	swigFunction( "c-function v4lconvert_create v4lconvert_create n -- a", "FUNCTION: v4lconvert_create ( fd -- a )", "EXTERN: \"C\" void * v4lconvert_create( int fd );", "	( fd -- )" );
	swigFunction( "c-function v4lconvert_create_with_dev_ops v4lconvert_create_with_dev_ops n a a -- a", "FUNCTION: v4lconvert_create_with_dev_ops ( fd dev_ops_priv dev_ops -- a )", "EXTERN: \"C\" void * v4lconvert_create_with_dev_ops( int fd, void * dev_ops_priv, void * dev_ops );", "	( fd dev_ops_priv dev_ops -- )" );
	swigFunction( "c-function v4lconvert_destroy v4lconvert_destroy a -- void", "FUNCTION: v4lconvert_destroy ( data -- void )", "EXTERN: \"C\" void v4lconvert_destroy( void * data );", "	( data -- )" );
	swigFunction( "c-function v4lconvert_supported_dst_fmt_only v4lconvert_supported_dst_fmt_only a -- n", "FUNCTION: v4lconvert_supported_dst_fmt_only ( data -- n )", "EXTERN: \"C\" int v4lconvert_supported_dst_fmt_only( void * data );", "	( data -- )" );
	swigFunction( "c-function v4lconvert_try_format v4lconvert_try_format a a a -- n", "FUNCTION: v4lconvert_try_format ( data dest_fmt src_fmt -- n )", "EXTERN: \"C\" int v4lconvert_try_format( void * data, void * dest_fmt, void * src_fmt );", "	( data dest_fmt src_fmt -- )" );
	swigFunction( "c-function v4lconvert_enum_fmt v4lconvert_enum_fmt a a -- n", "FUNCTION: v4lconvert_enum_fmt ( data fmt -- n )", "EXTERN: \"C\" int v4lconvert_enum_fmt( void * data, void * fmt );", "	( data fmt -- )" );
	swigFunction( "c-function v4lconvert_needs_conversion v4lconvert_needs_conversion a a a -- n", "FUNCTION: v4lconvert_needs_conversion ( data src_fmt dest_fmt -- n )", "EXTERN: \"C\" int v4lconvert_needs_conversion( void * data, void * src_fmt, void * dest_fmt );", "	( data src_fmt dest_fmt -- )" );
	swigFunction( "c-function v4lconvert_convert v4lconvert_convert a a a a n a n -- n", "FUNCTION: v4lconvert_convert ( data src_fmt dest_fmt src src_size dest dest_size -- n )", "EXTERN: \"C\" int v4lconvert_convert( void * data, void * src_fmt, void * dest_fmt, void * src, int src_size, void * dest, int dest_size );", "	( data src_fmt dest_fmt src src_size dest dest_size -- )" );
	swigFunction( "c-function v4lconvert_get_error_message v4lconvert_get_error_message a -- s", "FUNCTION: v4lconvert_get_error_message ( data -- s )", "EXTERN: \"C\" char * v4lconvert_get_error_message( void * data );", "	( data -- )" );
	swigFunction( "c-function v4lconvert_enum_framesizes v4lconvert_enum_framesizes a a -- n", "FUNCTION: v4lconvert_enum_framesizes ( data frmsize -- n )", "EXTERN: \"C\" int v4lconvert_enum_framesizes( void * data, void * frmsize );", "	( data frmsize -- )" );
	swigFunction( "c-function v4lconvert_enum_frameintervals v4lconvert_enum_frameintervals a a -- n", "FUNCTION: v4lconvert_enum_frameintervals ( data frmival -- n )", "EXTERN: \"C\" int v4lconvert_enum_frameintervals( void * data, void * frmival );", "	( data frmival -- )" );
	swigFunction( "c-function v4lconvert_vidioc_queryctrl v4lconvert_vidioc_queryctrl a a -- n", "FUNCTION: v4lconvert_vidioc_queryctrl ( data arg -- n )", "EXTERN: \"C\" int v4lconvert_vidioc_queryctrl( void * data, void * arg );", "	( data arg -- )" );
	swigFunction( "c-function v4lconvert_vidioc_g_ctrl v4lconvert_vidioc_g_ctrl a a -- n", "FUNCTION: v4lconvert_vidioc_g_ctrl ( data arg -- n )", "EXTERN: \"C\" int v4lconvert_vidioc_g_ctrl( void * data, void * arg );", "	( data arg -- )" );
	swigFunction( "c-function v4lconvert_vidioc_s_ctrl v4lconvert_vidioc_s_ctrl a a -- n", "FUNCTION: v4lconvert_vidioc_s_ctrl ( data arg -- n )", "EXTERN: \"C\" int v4lconvert_vidioc_s_ctrl( void * data, void * arg );", "	( data arg -- )" );
	swigFunction( "c-function v4lconvert_vidioc_g_ext_ctrls v4lconvert_vidioc_g_ext_ctrls a a -- n", "FUNCTION: v4lconvert_vidioc_g_ext_ctrls ( data arg -- n )", "EXTERN: \"C\" int v4lconvert_vidioc_g_ext_ctrls( void * data, void * arg );", "	( data arg -- )" );
	swigFunction( "c-function v4lconvert_vidioc_try_ext_ctrls v4lconvert_vidioc_try_ext_ctrls a a -- n", "FUNCTION: v4lconvert_vidioc_try_ext_ctrls ( data arg -- n )", "EXTERN: \"C\" int v4lconvert_vidioc_try_ext_ctrls( void * data, void * arg );", "	( data arg -- )" );
	swigFunction( "c-function v4lconvert_vidioc_s_ext_ctrls v4lconvert_vidioc_s_ext_ctrls a a -- n", "FUNCTION: v4lconvert_vidioc_s_ext_ctrls ( data arg -- n )", "EXTERN: \"C\" int v4lconvert_vidioc_s_ext_ctrls( void * data, void * arg );", "	( data arg -- )" );
	swigFunction( "c-function v4lconvert_supported_dst_format v4lconvert_supported_dst_format u -- n", "FUNCTION: v4lconvert_supported_dst_format ( pixelformat -- n )", "EXTERN: \"C\" int v4lconvert_supported_dst_format( int pixelformat );", "	( pixelformat -- )" );
	swigFunction( "c-function v4lconvert_get_fps v4lconvert_get_fps a -- n", "FUNCTION: v4lconvert_get_fps ( data -- n )", "EXTERN: \"C\" int v4lconvert_get_fps( void * data );", "	( data -- )" );
	swigFunction( "c-function v4lconvert_set_fps v4lconvert_set_fps a n -- void", "FUNCTION: v4lconvert_set_fps ( data fps -- void )", "EXTERN: \"C\" void v4lconvert_set_fps( void * data, int fps );", "	( data fps -- )" );
	swigFunction( "c-function v4lconvert_fixup_fmt v4lconvert_fixup_fmt a -- void", "FUNCTION: v4lconvert_fixup_fmt ( fmt -- void )", "EXTERN: \"C\" void v4lconvert_fixup_fmt( void * fmt );", "	( fmt -- )" );

	swigNewline();

	swigComment("----===< postfix >===-----\n");

	swigPrint( "end-c-library", "( none )", "( none )" );
	
	return 0;
} /* end of main */



