/*===========================================================================*/
/*   (Llib/foreign.scm)                                                      */
/*   Bigloo (4.7a)                                                           */
/*   Inria -- Sophia Antipolis (c)       Thu Feb 19 09:11:58 AM CET 2026     */
/*===========================================================================*/
/* COMPILATION: (/home/serrano/prgm/project/bigloo/4.7a/bin/bigloo -srfi bigloo-unsafe -O3 -fcfa-arithmetic -q -lib-dir /home/serrano/prgm/project/bigloo/4.7a/lib/bigloo/4.7a +rm -mklib -cc gcc -fsharing -q -no-hello -unsafe -safee -O4 -stdc -c Llib/foreign.scm -indent -o objs/obj_u/Llib/foreign.c) */
/* GC selection */
#define THE_GC BOEHM_GC

/* unsafe mode */
#define BIGLOO_UNSAFE 1

/* traces mode */
#define BIGLOO_TRACE 0

/* standard Bigloo include */
#include <bigloo.h>

#ifdef __cplusplus
extern "C"
{
#endif
#ifndef BGL_MODULE_TYPE_DEFINITIONS
#define BGL_MODULE_TYPE_DEFINITIONS
#ifndef BGL___FOREIGN_TYPE_DEFINITIONS
#define BGL___FOREIGN_TYPE_DEFINITIONS
#endif													// BGL___FOREIGN_TYPE_DEFINITIONS
#endif													// BGL_MODULE_TYPE_DEFINITIONS

	static obj_t BGl_requirezd2initializa7ationz75zz__foreignz00 = BUNSPEC;
	static obj_t BGl_z62foreignzd2eqzf3z43zz__foreignz00(obj_t, obj_t, obj_t);
	static obj_t BGl_z62makezd2stringzd2ptrzd2nullzb0zz__foreignz00(obj_t);
	BGL_EXPORTED_DECL bool_t BGl_foreignzf3zf3zz__foreignz00(obj_t);
	extern obj_t BGl_typezd2errorzd2zz__errorz00(obj_t, obj_t, obj_t, obj_t,
		obj_t);
	BGL_EXPORTED_DECL obj_t BGl_modulezd2initializa7ationz75zz__foreignz00(long,
		char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__errorz00(long, char *);
	BGL_EXPORTED_DECL long BGl_objzd2ze3cobjz31zz__foreignz00(obj_t);
	BGL_EXPORTED_DECL char *BGl_makezd2stringzd2ptrzd2nullzd2zz__foreignz00(void);
	static obj_t BGl_z62stringzd2ptrzd2nullzf3z91zz__foreignz00(obj_t, obj_t);
	static obj_t BGl_z62voidza2zd2nullzf3ze1zz__foreignz00(obj_t, obj_t);
	static obj_t BGl_importedzd2moduleszd2initz00zz__foreignz00(void);
	static obj_t BGl_gczd2rootszd2initz00zz__foreignz00(void);
	static obj_t BGl_z62foreignzf3z91zz__foreignz00(obj_t, obj_t);
	BGL_EXPORTED_DECL bool_t BGl_foreignzd2nullzf3z21zz__foreignz00(obj_t);
	extern obj_t void_star_to_obj(void *);
	BGL_EXPORTED_DECL bool_t BGl_foreignzd2eqzf3z21zz__foreignz00(obj_t, obj_t);
	BGL_EXPORTED_DECL void *BGl_makezd2voidza2zd2nullza2zz__foreignz00(void);
	static obj_t BGl_z62makezd2voidza2zd2nullzc0zz__foreignz00(obj_t);
	static obj_t BGl_z62foreignzd2nullzf3z43zz__foreignz00(obj_t, obj_t);
	extern long obj_to_cobj(obj_t);
	BGL_EXPORTED_DECL bool_t BGl_stringzd2ptrzd2nullzf3zf3zz__foreignz00(char *);
	BGL_EXPORTED_DECL bool_t BGl_voidza2zd2nullzf3z83zz__foreignz00(void *);
	static obj_t BGl_z62objzd2ze3cobjz53zz__foreignz00(obj_t, obj_t);
	extern obj_t BGl_errorz00zz__errorz00(obj_t, obj_t, obj_t);
	static obj_t *__cnst;


	   
		 
		DEFINE_EXPORT_BGL_PROCEDURE
		(BGl_stringzd2ptrzd2nullzf3zd2envz21zz__foreignz00,
		BgL_bgl_za762stringza7d2ptrza71421za7,
		BGl_z62stringzd2ptrzd2nullzf3z91zz__foreignz00, 0L, BUNSPEC, 1);
	      DEFINE_EXPORT_BGL_PROCEDURE(BGl_objzd2ze3cobjzd2envze3zz__foreignz00,
		BgL_bgl_za762objza7d2za7e3cobj1422za7,
		BGl_z62objzd2ze3cobjz53zz__foreignz00, 0L, BUNSPEC, 1);
	      BGL_DEFINE_STRING(BGl_string1413z00zz__foreignz00,
		BgL_bgl_string1413za700za7za7_1423za7, "foreign-null?", 13);
	      BGL_DEFINE_STRING(BGl_string1414z00zz__foreignz00,
		BgL_bgl_string1414za700za7za7_1424za7, "not a foreign object", 20);
	      BGL_DEFINE_STRING(BGl_string1415z00zz__foreignz00,
		BgL_bgl_string1415za700za7za7_1425za7,
		"/tmp/bigloo/runtime/Llib/foreign.scm", 36);
	      BGL_DEFINE_STRING(BGl_string1416z00zz__foreignz00,
		BgL_bgl_string1416za700za7za7_1426za7, "&string-ptr-null?", 17);
	      BGL_DEFINE_STRING(BGl_string1417z00zz__foreignz00,
		BgL_bgl_string1417za700za7za7_1427za7, "bstring", 7);
	      BGL_DEFINE_STRING(BGl_string1418z00zz__foreignz00,
		BgL_bgl_string1418za700za7za7_1428za7, "&void*-null?", 12);
	      BGL_DEFINE_STRING(BGl_string1419z00zz__foreignz00,
		BgL_bgl_string1419za700za7za7_1429za7, "void*", 5);
	      BGL_DEFINE_STRING(BGl_string1420z00zz__foreignz00,
		BgL_bgl_string1420za700za7za7_1430za7, "__foreign", 9);
	      DEFINE_EXPORT_BGL_PROCEDURE(BGl_foreignzf3zd2envz21zz__foreignz00,
		BgL_bgl_za762foreignza7f3za7911431za7, BGl_z62foreignzf3z91zz__foreignz00,
		0L, BUNSPEC, 1);
	     
		DEFINE_EXPORT_BGL_PROCEDURE
		(BGl_makezd2voidza2zd2nullzd2envz70zz__foreignz00,
		BgL_bgl_za762makeza7d2voidza7a1432za7,
		BGl_z62makezd2voidza2zd2nullzc0zz__foreignz00, 0L, BUNSPEC, 0);
	     
		DEFINE_EXPORT_BGL_PROCEDURE
		(BGl_makezd2stringzd2ptrzd2nullzd2envz00zz__foreignz00,
		BgL_bgl_za762makeza7d2string1433z00,
		BGl_z62makezd2stringzd2ptrzd2nullzb0zz__foreignz00, 0L, BUNSPEC, 0);
	      DEFINE_EXPORT_BGL_PROCEDURE(BGl_foreignzd2eqzf3zd2envzf3zz__foreignz00,
		BgL_bgl_za762foreignza7d2eqza71434za7,
		BGl_z62foreignzd2eqzf3z43zz__foreignz00, 0L, BUNSPEC, 2);
	     
		DEFINE_EXPORT_BGL_PROCEDURE(BGl_voidza2zd2nullzf3zd2envz51zz__foreignz00,
		BgL_bgl_za762voidza7a2za7d2nul1435za7,
		BGl_z62voidza2zd2nullzf3ze1zz__foreignz00, 0L, BUNSPEC, 1);
	     
		DEFINE_EXPORT_BGL_PROCEDURE(BGl_foreignzd2nullzf3zd2envzf3zz__foreignz00,
		BgL_bgl_za762foreignza7d2nul1436z00,
		BGl_z62foreignzd2nullzf3z43zz__foreignz00, 0L, BUNSPEC, 1);

/* contant bindings */
	static void bgl_constant_bindings()
	{
		BGL_BIND_PROCEDURE(BGl_foreignzd2nullzf3zd2envzf3zz__foreignz00,
			BgL_bgl_za762foreignza7d2nul1436z00);
		BGL_BIND_PROCEDURE(BGl_voidza2zd2nullzf3zd2envz51zz__foreignz00,
			BgL_bgl_za762voidza7a2za7d2nul1435za7);
		BGL_BIND_PROCEDURE(BGl_foreignzd2eqzf3zd2envzf3zz__foreignz00,
			BgL_bgl_za762foreignza7d2eqza71434za7);
		BGL_BIND_PROCEDURE(BGl_makezd2stringzd2ptrzd2nullzd2envz00zz__foreignz00,
			BgL_bgl_za762makeza7d2string1433z00);
		BGL_BIND_PROCEDURE(BGl_makezd2voidza2zd2nullzd2envz70zz__foreignz00,
			BgL_bgl_za762makeza7d2voidza7a1432za7);
		BGL_BIND_PROCEDURE(BGl_foreignzf3zd2envz21zz__foreignz00,
			BgL_bgl_za762foreignza7f3za7911431za7);
		BGL_BIND_STRING(BGl_string1420z00zz__foreignz00,
			BgL_bgl_string1420za700za7za7_1430za7);
		BGL_BIND_STRING(BGl_string1419z00zz__foreignz00,
			BgL_bgl_string1419za700za7za7_1429za7);
		BGL_BIND_STRING(BGl_string1418z00zz__foreignz00,
			BgL_bgl_string1418za700za7za7_1428za7);
		BGL_BIND_STRING(BGl_string1417z00zz__foreignz00,
			BgL_bgl_string1417za700za7za7_1427za7);
		BGL_BIND_STRING(BGl_string1416z00zz__foreignz00,
			BgL_bgl_string1416za700za7za7_1426za7);
		BGL_BIND_STRING(BGl_string1415z00zz__foreignz00,
			BgL_bgl_string1415za700za7za7_1425za7);
		BGL_BIND_STRING(BGl_string1414z00zz__foreignz00,
			BgL_bgl_string1414za700za7za7_1424za7);
		BGL_BIND_STRING(BGl_string1413z00zz__foreignz00,
			BgL_bgl_string1413za700za7za7_1423za7);
		BGL_BIND_PROCEDURE(BGl_objzd2ze3cobjzd2envze3zz__foreignz00,
			BgL_bgl_za762objza7d2za7e3cobj1422za7);
		BGL_BIND_PROCEDURE(BGl_stringzd2ptrzd2nullzf3zd2envz21zz__foreignz00,
			BgL_bgl_za762stringza7d2ptrza71421za7);
	}

/* GC roots registration */
	static obj_t bgl_gc_roots_register()
	{
#if defined( BGL_GC_ROOTS )
#define ADD_ROOT( addr ) (addr > roots_max ? roots_max = addr : (addr < roots_min ? roots_min = addr : 0))
		void *roots_min = (void *) ULONG_MAX, *roots_max = 0;

		ADD_ROOT((void *) (&BGl_requirezd2initializa7ationz75zz__foreignz00));
#undef ADD_ROOT
		if (roots_max > 0)
			GC_add_roots(roots_min, ((void **) roots_max) + 1);
#endif
		return BUNSPEC;
	}



/* module-initialization */
	BGL_EXPORTED_DEF obj_t BGl_modulezd2initializa7ationz75zz__foreignz00(long
		BgL_checksumz00_1054, char *BgL_fromz00_1055)
	{
		{
			if (CBOOL(BGl_requirezd2initializa7ationz75zz__foreignz00))
				{
					BGl_requirezd2initializa7ationz75zz__foreignz00 = BBOOL(((bool_t) 0));
					bgl_constant_bindings();
					BGl_gczd2rootszd2initz00zz__foreignz00();
					return BGl_importedzd2moduleszd2initz00zz__foreignz00();
				}
			else
				{
					return BUNSPEC;
				}
		}

	}



/* gc-roots-init */
	obj_t BGl_gczd2rootszd2initz00zz__foreignz00(void)
	{
		{	/* Llib/foreign.scm 18 */
			return bgl_gc_roots_register();
		}

	}



/* foreign? */
	BGL_EXPORTED_DEF bool_t BGl_foreignzf3zf3zz__foreignz00(obj_t BgL_objz00_3)
	{
		{	/* Llib/foreign.scm 91 */
			return FOREIGNP(BgL_objz00_3);
		}

	}



/* &foreign? */
	obj_t BGl_z62foreignzf3z91zz__foreignz00(obj_t BgL_envz00_1035,
		obj_t BgL_objz00_1036)
	{
		{	/* Llib/foreign.scm 91 */
			return BBOOL(BGl_foreignzf3zf3zz__foreignz00(BgL_objz00_1036));
		}

	}



/* foreign-eq? */
	BGL_EXPORTED_DEF bool_t BGl_foreignzd2eqzf3z21zz__foreignz00(obj_t
		BgL_o1z00_4, obj_t BgL_o2z00_5)
	{
		{	/* Llib/foreign.scm 97 */
			return FOREIGN_EQP(BgL_o1z00_4, BgL_o2z00_5);
		}

	}



/* &foreign-eq? */
	obj_t BGl_z62foreignzd2eqzf3z43zz__foreignz00(obj_t BgL_envz00_1037,
		obj_t BgL_o1z00_1038, obj_t BgL_o2z00_1039)
	{
		{	/* Llib/foreign.scm 97 */
			return
				BBOOL(BGl_foreignzd2eqzf3z21zz__foreignz00(BgL_o1z00_1038,
					BgL_o2z00_1039));
		}

	}



/* foreign-null? */
	BGL_EXPORTED_DEF bool_t BGl_foreignzd2nullzf3z21zz__foreignz00(obj_t
		BgL_objz00_6)
	{
		{	/* Llib/foreign.scm 103 */
			if (FOREIGNP(BgL_objz00_6))
				{	/* Llib/foreign.scm 104 */
					return FOREIGN_NULLP(BgL_objz00_6);
				}
			else
				{	/* Llib/foreign.scm 104 */
					return
						CBOOL(BGl_errorz00zz__errorz00(BGl_string1413z00zz__foreignz00,
							BGl_string1414z00zz__foreignz00, BgL_objz00_6));
				}
		}

	}



/* &foreign-null? */
	obj_t BGl_z62foreignzd2nullzf3z43zz__foreignz00(obj_t BgL_envz00_1040,
		obj_t BgL_objz00_1041)
	{
		{	/* Llib/foreign.scm 103 */
			return BBOOL(BGl_foreignzd2nullzf3z21zz__foreignz00(BgL_objz00_1041));
		}

	}



/* string-ptr-null? */
	BGL_EXPORTED_DEF bool_t BGl_stringzd2ptrzd2nullzf3zf3zz__foreignz00(char
		*BgL_objz00_7)
	{
		{	/* Llib/foreign.scm 111 */
			return STRING_PTR_NULL(BgL_objz00_7);
		}

	}



/* &string-ptr-null? */
	obj_t BGl_z62stringzd2ptrzd2nullzf3z91zz__foreignz00(obj_t BgL_envz00_1042,
		obj_t BgL_objz00_1043)
	{
		{	/* Llib/foreign.scm 111 */
			{	/* Llib/foreign.scm 112 */
				bool_t BgL_tmpz00_1077;

				{	/* Llib/foreign.scm 112 */
					char *BgL_auxz00_1078;

					{	/* Llib/foreign.scm 112 */
						obj_t BgL_tmpz00_1079;

						if (STRINGP(BgL_objz00_1043))
							{	/* Llib/foreign.scm 112 */
								BgL_tmpz00_1079 = BgL_objz00_1043;
							}
						else
							{
								obj_t BgL_auxz00_1082;

								BgL_auxz00_1082 =
									BGl_typezd2errorzd2zz__errorz00
									(BGl_string1415z00zz__foreignz00, BINT(4854L),
									BGl_string1416z00zz__foreignz00,
									BGl_string1417z00zz__foreignz00, BgL_objz00_1043);
								FAILURE(BgL_auxz00_1082, BFALSE, BFALSE);
							}
						BgL_auxz00_1078 = BSTRING_TO_STRING(BgL_tmpz00_1079);
					}
					BgL_tmpz00_1077 =
						BGl_stringzd2ptrzd2nullzf3zf3zz__foreignz00(BgL_auxz00_1078);
				}
				return BBOOL(BgL_tmpz00_1077);
			}
		}

	}



/* obj->cobj */
	BGL_EXPORTED_DEF long BGl_objzd2ze3cobjz31zz__foreignz00(obj_t BgL_objz00_8)
	{
		{	/* Llib/foreign.scm 117 */
			BGL_TAIL return obj_to_cobj(BgL_objz00_8);
		}

	}



/* &obj->cobj */
	obj_t BGl_z62objzd2ze3cobjz53zz__foreignz00(obj_t BgL_envz00_1044,
		obj_t BgL_objz00_1045)
	{
		{	/* Llib/foreign.scm 117 */
			return (obj_t) (BGl_objzd2ze3cobjz31zz__foreignz00(BgL_objz00_1045));
		}

	}



/* void*-null? */
	BGL_EXPORTED_DEF bool_t BGl_voidza2zd2nullzf3z83zz__foreignz00(void
		*BgL_objz00_9)
	{
		{	/* Llib/foreign.scm 123 */
			return FOREIGN_PTR_NULL(BgL_objz00_9);
		}

	}



/* &void*-null? */
	obj_t BGl_z62voidza2zd2nullzf3ze1zz__foreignz00(obj_t BgL_envz00_1046,
		obj_t BgL_objz00_1047)
	{
		{	/* Llib/foreign.scm 123 */
			{	/* Llib/foreign.scm 124 */
				bool_t BgL_tmpz00_1093;

				{	/* Llib/foreign.scm 124 */
					void *BgL_auxz00_1094;

					if (FOREIGNP(BgL_objz00_1047))
						{	/* Llib/foreign.scm 124 */
							BgL_auxz00_1094 = FOREIGN_TO_COBJ(BgL_objz00_1047);
						}
					else
						{
							obj_t BgL_auxz00_1098;

							BgL_auxz00_1098 =
								BGl_typezd2errorzd2zz__errorz00(BGl_string1415z00zz__foreignz00,
								BINT(5421L), BGl_string1418z00zz__foreignz00,
								BGl_string1419z00zz__foreignz00, BgL_objz00_1047);
							FAILURE(BgL_auxz00_1098, BFALSE, BFALSE);
						}
					BgL_tmpz00_1093 =
						BGl_voidza2zd2nullzf3z83zz__foreignz00(BgL_auxz00_1094);
				}
				return BBOOL(BgL_tmpz00_1093);
			}
		}

	}



/* make-string-ptr-null */
	BGL_EXPORTED_DEF char *BGl_makezd2stringzd2ptrzd2nullzd2zz__foreignz00(void)
	{
		{	/* Llib/foreign.scm 129 */
			return (0L);
		}

	}



/* &make-string-ptr-null */
	obj_t BGl_z62makezd2stringzd2ptrzd2nullzb0zz__foreignz00(obj_t
		BgL_envz00_1048)
	{
		{	/* Llib/foreign.scm 129 */
			return
				string_to_bstring(BGl_makezd2stringzd2ptrzd2nullzd2zz__foreignz00());
		}

	}



/* make-void*-null */
	BGL_EXPORTED_DEF void *BGl_makezd2voidza2zd2nullza2zz__foreignz00(void)
	{
		{	/* Llib/foreign.scm 135 */
			return (0L);
		}

	}



/* &make-void*-null */
	obj_t BGl_z62makezd2voidza2zd2nullzc0zz__foreignz00(obj_t BgL_envz00_1049)
	{
		{	/* Llib/foreign.scm 135 */
			return void_star_to_obj(BGl_makezd2voidza2zd2nullza2zz__foreignz00());
		}

	}



/* imported-modules-init */
	obj_t BGl_importedzd2moduleszd2initz00zz__foreignz00(void)
	{
		{	/* Llib/foreign.scm 18 */
			return
				BGl_modulezd2initializa7ationz75zz__errorz00(88804785L,
				BSTRING_TO_STRING(BGl_string1420z00zz__foreignz00));
		}

	}

#ifdef __cplusplus
}
#endif
