/*===========================================================================*/
/*   (Llib/weakptr.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/weakptr.scm -indent -o objs/obj_u/Llib/weakptr.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___WEAKPTR_TYPE_DEFINITIONS
#define BGL___WEAKPTR_TYPE_DEFINITIONS
#endif													// BGL___WEAKPTR_TYPE_DEFINITIONS
#endif													// BGL_MODULE_TYPE_DEFINITIONS

	static obj_t BGl_z62weakptrzd2datazb0zz__weakptrz00(obj_t, obj_t);
	static obj_t BGl__makezd2weakptrzd2zz__weakptrz00(obj_t, obj_t);
	static obj_t BGl_requirezd2initializa7ationz75zz__weakptrz00 = BUNSPEC;
	BGL_EXPORTED_DECL obj_t BGl_weakptrzd2datazd2zz__weakptrz00(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__weakptrz00(long,
		char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__threadz00(long, char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__objectz00(long, char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__bexitz00(long, char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__paramz00(long, char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__readerz00(long, char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__hashz00(long, char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__errorz00(long, char *);
	BGL_EXPORTED_DECL bool_t BGl_weakptrzf3zf3zz__weakptrz00(obj_t);
	extern void bgl_weakptr_ref_set(obj_t, obj_t);
	static obj_t BGl_z62weakptrzd2refzd2setz12z70zz__weakptrz00(obj_t, obj_t,
		obj_t);
	BGL_EXPORTED_DECL obj_t BGl_makezd2weakptrzd2zz__weakptrz00(obj_t, obj_t);
	static obj_t BGl_genericzd2initzd2zz__weakptrz00(void);
	extern void bgl_weakptr_data_set(obj_t, obj_t);
	BGL_EXPORTED_DECL obj_t BGl_weakptrzd2refzd2zz__weakptrz00(obj_t);
	static obj_t BGl_importedzd2moduleszd2initz00zz__weakptrz00(void);
	static obj_t BGl_gczd2rootszd2initz00zz__weakptrz00(void);
	static obj_t BGl_objectzd2initzd2zz__weakptrz00(void);
	static obj_t BGl_z62weakptrzd2datazd2setz12z70zz__weakptrz00(obj_t, obj_t,
		obj_t);
	extern obj_t bgl_weakptr_data(obj_t);
	extern obj_t bgl_weakptr_ref(obj_t);
	static obj_t BGl_z62weakptrzf3z91zz__weakptrz00(obj_t, obj_t);
	static obj_t BGl_methodzd2initzd2zz__weakptrz00(void);
	extern obj_t bgl_make_weakptr(obj_t, obj_t);
	BGL_EXPORTED_DECL obj_t BGl_weakptrzd2datazd2setz12z12zz__weakptrz00(obj_t,
		obj_t);
	static obj_t BGl_z62weakptrzd2refzb0zz__weakptrz00(obj_t, obj_t);
	BGL_EXPORTED_DECL obj_t BGl_weakptrzd2refzd2setz12z12zz__weakptrz00(obj_t,
		obj_t);
	static obj_t *__cnst;


	   
		 
		DEFINE_EXPORT_BGL_PROCEDURE(BGl_weakptrzd2datazd2envz00zz__weakptrz00,
		BgL_bgl_za762weakptrza7d2dat1611z00, BGl_z62weakptrzd2datazb0zz__weakptrz00,
		0L, BUNSPEC, 1);
	      DEFINE_EXPORT_BGL_PROCEDURE(BGl_weakptrzd2refzd2envz00zz__weakptrz00,
		BgL_bgl_za762weakptrza7d2ref1612z00, BGl_z62weakptrzd2refzb0zz__weakptrz00,
		0L, BUNSPEC, 1);
	      BGL_DEFINE_STRING(BGl_string1602z00zz__weakptrz00,
		BgL_bgl_string1602za700za7za7_1613za7,
		"/tmp/bigloo/runtime/Llib/weakptr.scm", 36);
	      BGL_DEFINE_STRING(BGl_string1603z00zz__weakptrz00,
		BgL_bgl_string1603za700za7za7_1614za7, "&weakptr-data", 13);
	      BGL_DEFINE_STRING(BGl_string1604z00zz__weakptrz00,
		BgL_bgl_string1604za700za7za7_1615za7, "weakptr", 7);
	      BGL_DEFINE_STRING(BGl_string1605z00zz__weakptrz00,
		BgL_bgl_string1605za700za7za7_1616za7, "&weakptr-data-set!", 18);
	      BGL_DEFINE_STRING(BGl_string1606z00zz__weakptrz00,
		BgL_bgl_string1606za700za7za7_1617za7, "&weakptr-ref", 12);
	      BGL_DEFINE_STRING(BGl_string1607z00zz__weakptrz00,
		BgL_bgl_string1607za700za7za7_1618za7, "&weakptr-ref-set!", 17);
	      BGL_DEFINE_STRING(BGl_string1608z00zz__weakptrz00,
		BgL_bgl_string1608za700za7za7_1619za7, "_make-weakptr", 13);
	      BGL_DEFINE_STRING(BGl_string1609z00zz__weakptrz00,
		BgL_bgl_string1609za700za7za7_1620za7, "vector", 6);
	     
		DEFINE_EXPORT_BGL_PROCEDURE
		(BGl_weakptrzd2refzd2setz12zd2envzc0zz__weakptrz00,
		BgL_bgl_za762weakptrza7d2ref1621z00,
		BGl_z62weakptrzd2refzd2setz12z70zz__weakptrz00, 0L, BUNSPEC, 2);
	      BGL_DEFINE_STRING(BGl_string1610z00zz__weakptrz00,
		BgL_bgl_string1610za700za7za7_1622za7, "__weakptr", 9);
	      DEFINE_EXPORT_BGL_PROCEDURE(BGl_weakptrzf3zd2envz21zz__weakptrz00,
		BgL_bgl_za762weakptrza7f3za7911623za7, BGl_z62weakptrzf3z91zz__weakptrz00,
		0L, BUNSPEC, 1);
	     
		DEFINE_EXPORT_BGL_PROCEDURE
		(BGl_weakptrzd2datazd2setz12zd2envzc0zz__weakptrz00,
		BgL_bgl_za762weakptrza7d2dat1624z00,
		BGl_z62weakptrzd2datazd2setz12z70zz__weakptrz00, 0L, BUNSPEC, 2);
	      DEFINE_EXPORT_BGL_PROCEDURE(BGl_makezd2weakptrzd2envz00zz__weakptrz00,
		BgL_bgl__makeza7d2weakptrza71625z00, opt_generic_entry,
		BGl__makezd2weakptrzd2zz__weakptrz00, BFALSE, -1);

/* contant bindings */
	static void bgl_constant_bindings()
	{
		BGL_BIND_PROCEDURE(BGl_makezd2weakptrzd2envz00zz__weakptrz00,
			BgL_bgl__makeza7d2weakptrza71625z00);
		BGL_BIND_PROCEDURE(BGl_weakptrzd2datazd2setz12zd2envzc0zz__weakptrz00,
			BgL_bgl_za762weakptrza7d2dat1624z00);
		BGL_BIND_PROCEDURE(BGl_weakptrzf3zd2envz21zz__weakptrz00,
			BgL_bgl_za762weakptrza7f3za7911623za7);
		BGL_BIND_STRING(BGl_string1610z00zz__weakptrz00,
			BgL_bgl_string1610za700za7za7_1622za7);
		BGL_BIND_PROCEDURE(BGl_weakptrzd2refzd2setz12zd2envzc0zz__weakptrz00,
			BgL_bgl_za762weakptrza7d2ref1621z00);
		BGL_BIND_STRING(BGl_string1609z00zz__weakptrz00,
			BgL_bgl_string1609za700za7za7_1620za7);
		BGL_BIND_STRING(BGl_string1608z00zz__weakptrz00,
			BgL_bgl_string1608za700za7za7_1619za7);
		BGL_BIND_STRING(BGl_string1607z00zz__weakptrz00,
			BgL_bgl_string1607za700za7za7_1618za7);
		BGL_BIND_STRING(BGl_string1606z00zz__weakptrz00,
			BgL_bgl_string1606za700za7za7_1617za7);
		BGL_BIND_STRING(BGl_string1605z00zz__weakptrz00,
			BgL_bgl_string1605za700za7za7_1616za7);
		BGL_BIND_STRING(BGl_string1604z00zz__weakptrz00,
			BgL_bgl_string1604za700za7za7_1615za7);
		BGL_BIND_STRING(BGl_string1603z00zz__weakptrz00,
			BgL_bgl_string1603za700za7za7_1614za7);
		BGL_BIND_STRING(BGl_string1602z00zz__weakptrz00,
			BgL_bgl_string1602za700za7za7_1613za7);
		BGL_BIND_PROCEDURE(BGl_weakptrzd2refzd2envz00zz__weakptrz00,
			BgL_bgl_za762weakptrza7d2ref1612z00);
		BGL_BIND_PROCEDURE(BGl_weakptrzd2datazd2envz00zz__weakptrz00,
			BgL_bgl_za762weakptrza7d2dat1611z00);
	}

/* 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__weakptrz00));
#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__weakptrz00(long
		BgL_checksumz00_1732, char *BgL_fromz00_1733)
	{
		{
			if (CBOOL(BGl_requirezd2initializa7ationz75zz__weakptrz00))
				{
					BGl_requirezd2initializa7ationz75zz__weakptrz00 = BBOOL(((bool_t) 0));
					bgl_constant_bindings();
					BGl_gczd2rootszd2initz00zz__weakptrz00();
					BGl_importedzd2moduleszd2initz00zz__weakptrz00();
					return BGl_methodzd2initzd2zz__weakptrz00();
				}
			else
				{
					return BUNSPEC;
				}
		}

	}



/* gc-roots-init */
	obj_t BGl_gczd2rootszd2initz00zz__weakptrz00(void)
	{
		{	/* Llib/weakptr.scm 14 */
			return bgl_gc_roots_register();
		}

	}



/* weakptr? */
	BGL_EXPORTED_DEF bool_t BGl_weakptrzf3zf3zz__weakptrz00(obj_t BgL_objz00_3)
	{
		{	/* Llib/weakptr.scm 84 */
			return BGL_WEAKPTRP(BgL_objz00_3);
		}

	}



/* &weakptr? */
	obj_t BGl_z62weakptrzf3z91zz__weakptrz00(obj_t BgL_envz00_1703,
		obj_t BgL_objz00_1704)
	{
		{	/* Llib/weakptr.scm 84 */
			return BBOOL(BGl_weakptrzf3zf3zz__weakptrz00(BgL_objz00_1704));
		}

	}



/* weakptr-data */
	BGL_EXPORTED_DEF obj_t BGl_weakptrzd2datazd2zz__weakptrz00(obj_t BgL_objz00_4)
	{
		{	/* Llib/weakptr.scm 90 */
			BGL_TAIL return bgl_weakptr_data(BgL_objz00_4);
		}

	}



/* &weakptr-data */
	obj_t BGl_z62weakptrzd2datazb0zz__weakptrz00(obj_t BgL_envz00_1705,
		obj_t BgL_objz00_1706)
	{
		{	/* Llib/weakptr.scm 90 */
			{	/* Llib/weakptr.scm 91 */
				obj_t BgL_auxz00_1746;

				if (BGL_WEAKPTRP(BgL_objz00_1706))
					{	/* Llib/weakptr.scm 91 */
						BgL_auxz00_1746 = BgL_objz00_1706;
					}
				else
					{
						obj_t BgL_auxz00_1749;

						BgL_auxz00_1749 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1602z00zz__weakptrz00,
							BINT(3417L), BGl_string1603z00zz__weakptrz00,
							BGl_string1604z00zz__weakptrz00, BgL_objz00_1706);
						FAILURE(BgL_auxz00_1749, BFALSE, BFALSE);
					}
				return BGl_weakptrzd2datazd2zz__weakptrz00(BgL_auxz00_1746);
			}
		}

	}



/* weakptr-data-set! */
	BGL_EXPORTED_DEF obj_t BGl_weakptrzd2datazd2setz12z12zz__weakptrz00(obj_t
		BgL_ptrz00_5, obj_t BgL_objz00_6)
	{
		{	/* Llib/weakptr.scm 96 */
			bgl_weakptr_data_set(BgL_ptrz00_5, BgL_objz00_6);
			BUNSPEC;
			return BUNSPEC;
		}

	}



/* &weakptr-data-set! */
	obj_t BGl_z62weakptrzd2datazd2setz12z70zz__weakptrz00(obj_t BgL_envz00_1707,
		obj_t BgL_ptrz00_1708, obj_t BgL_objz00_1709)
	{
		{	/* Llib/weakptr.scm 96 */
			{	/* Llib/weakptr.scm 97 */
				obj_t BgL_auxz00_1755;

				if (BGL_WEAKPTRP(BgL_ptrz00_1708))
					{	/* Llib/weakptr.scm 97 */
						BgL_auxz00_1755 = BgL_ptrz00_1708;
					}
				else
					{
						obj_t BgL_auxz00_1758;

						BgL_auxz00_1758 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1602z00zz__weakptrz00,
							BINT(3734L), BGl_string1605z00zz__weakptrz00,
							BGl_string1604z00zz__weakptrz00, BgL_ptrz00_1708);
						FAILURE(BgL_auxz00_1758, BFALSE, BFALSE);
					}
				return
					BGl_weakptrzd2datazd2setz12z12zz__weakptrz00(BgL_auxz00_1755,
					BgL_objz00_1709);
			}
		}

	}



/* weakptr-ref */
	BGL_EXPORTED_DEF obj_t BGl_weakptrzd2refzd2zz__weakptrz00(obj_t BgL_objz00_7)
	{
		{	/* Llib/weakptr.scm 103 */
			BGL_TAIL return bgl_weakptr_ref(BgL_objz00_7);
		}

	}



/* &weakptr-ref */
	obj_t BGl_z62weakptrzd2refzb0zz__weakptrz00(obj_t BgL_envz00_1710,
		obj_t BgL_objz00_1711)
	{
		{	/* Llib/weakptr.scm 103 */
			{	/* Llib/weakptr.scm 104 */
				obj_t BgL_auxz00_1764;

				if (BGL_WEAKPTRP(BgL_objz00_1711))
					{	/* Llib/weakptr.scm 104 */
						BgL_auxz00_1764 = BgL_objz00_1711;
					}
				else
					{
						obj_t BgL_auxz00_1767;

						BgL_auxz00_1767 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1602z00zz__weakptrz00,
							BINT(4012L), BGl_string1606z00zz__weakptrz00,
							BGl_string1604z00zz__weakptrz00, BgL_objz00_1711);
						FAILURE(BgL_auxz00_1767, BFALSE, BFALSE);
					}
				return BGl_weakptrzd2refzd2zz__weakptrz00(BgL_auxz00_1764);
			}
		}

	}



/* weakptr-ref-set! */
	BGL_EXPORTED_DEF obj_t BGl_weakptrzd2refzd2setz12z12zz__weakptrz00(obj_t
		BgL_ptrz00_8, obj_t BgL_objz00_9)
	{
		{	/* Llib/weakptr.scm 109 */
			bgl_weakptr_ref_set(BgL_ptrz00_8, BgL_objz00_9);
			BUNSPEC;
			return BUNSPEC;
		}

	}



/* &weakptr-ref-set! */
	obj_t BGl_z62weakptrzd2refzd2setz12z70zz__weakptrz00(obj_t BgL_envz00_1712,
		obj_t BgL_ptrz00_1713, obj_t BgL_objz00_1714)
	{
		{	/* Llib/weakptr.scm 109 */
			{	/* Llib/weakptr.scm 110 */
				obj_t BgL_auxz00_1773;

				if (BGL_WEAKPTRP(BgL_ptrz00_1713))
					{	/* Llib/weakptr.scm 110 */
						BgL_auxz00_1773 = BgL_ptrz00_1713;
					}
				else
					{
						obj_t BgL_auxz00_1776;

						BgL_auxz00_1776 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1602z00zz__weakptrz00,
							BINT(4326L), BGl_string1607z00zz__weakptrz00,
							BGl_string1604z00zz__weakptrz00, BgL_ptrz00_1713);
						FAILURE(BgL_auxz00_1776, BFALSE, BFALSE);
					}
				return
					BGl_weakptrzd2refzd2setz12z12zz__weakptrz00(BgL_auxz00_1773,
					BgL_objz00_1714);
			}
		}

	}



/* _make-weakptr */
	obj_t BGl__makezd2weakptrzd2zz__weakptrz00(obj_t BgL_env1086z00_13,
		obj_t BgL_opt1085z00_12)
	{
		{	/* Llib/weakptr.scm 116 */
			{	/* Llib/weakptr.scm 116 */
				obj_t BgL_g1087z00_1729;

				{
					obj_t BgL_auxz00_1781;

					if (VECTORP(BgL_opt1085z00_12))
						{	/* Llib/weakptr.scm 116 */
							BgL_auxz00_1781 = BgL_opt1085z00_12;
						}
					else
						{
							obj_t BgL_auxz00_1784;

							BgL_auxz00_1784 =
								BGl_typezd2errorzd2zz__errorz00(BGl_string1602z00zz__weakptrz00,
								BINT(4568L), BGl_string1608z00zz__weakptrz00,
								BGl_string1609z00zz__weakptrz00, BgL_opt1085z00_12);
							FAILURE(BgL_auxz00_1784, BFALSE, BFALSE);
						}
					BgL_g1087z00_1729 = VECTOR_REF(BgL_auxz00_1781, 0L);
				}
				{	/* Llib/weakptr.scm 116 */
					long BgL_aux1089z00_1730;

					{
						obj_t BgL_auxz00_1789;

						if (VECTORP(BgL_opt1085z00_12))
							{	/* Llib/weakptr.scm 116 */
								BgL_auxz00_1789 = BgL_opt1085z00_12;
							}
						else
							{
								obj_t BgL_auxz00_1792;

								BgL_auxz00_1792 =
									BGl_typezd2errorzd2zz__errorz00
									(BGl_string1602z00zz__weakptrz00, BINT(4568L),
									BGl_string1608z00zz__weakptrz00,
									BGl_string1609z00zz__weakptrz00, BgL_opt1085z00_12);
								FAILURE(BgL_auxz00_1792, BFALSE, BFALSE);
							}
						BgL_aux1089z00_1730 = VECTOR_LENGTH(BgL_auxz00_1789);
					}
					switch (BgL_aux1089z00_1730)
						{
						case 1L:

							{	/* Llib/weakptr.scm 116 */

								return bgl_make_weakptr(BgL_g1087z00_1729, BFALSE);
							}
							break;
						case 2L:

							{	/* Llib/weakptr.scm 116 */
								obj_t BgL_refz00_1731;

								{
									obj_t BgL_auxz00_1798;

									if (VECTORP(BgL_opt1085z00_12))
										{	/* Llib/weakptr.scm 116 */
											BgL_auxz00_1798 = BgL_opt1085z00_12;
										}
									else
										{
											obj_t BgL_auxz00_1801;

											BgL_auxz00_1801 =
												BGl_typezd2errorzd2zz__errorz00
												(BGl_string1602z00zz__weakptrz00, BINT(4568L),
												BGl_string1608z00zz__weakptrz00,
												BGl_string1609z00zz__weakptrz00, BgL_opt1085z00_12);
											FAILURE(BgL_auxz00_1801, BFALSE, BFALSE);
										}
									BgL_refz00_1731 = VECTOR_REF(BgL_auxz00_1798, 1L);
								}
								{	/* Llib/weakptr.scm 116 */

									return bgl_make_weakptr(BgL_g1087z00_1729, BgL_refz00_1731);
								}
							}
							break;
						default:
							return BUNSPEC;
						}
				}
			}
		}

	}



/* make-weakptr */
	BGL_EXPORTED_DEF obj_t BGl_makezd2weakptrzd2zz__weakptrz00(obj_t
		BgL_objz00_10, obj_t BgL_refz00_11)
	{
		{	/* Llib/weakptr.scm 116 */
			BGL_TAIL return bgl_make_weakptr(BgL_objz00_10, BgL_refz00_11);
		}

	}



/* object-init */
	obj_t BGl_objectzd2initzd2zz__weakptrz00(void)
	{
		{	/* Llib/weakptr.scm 14 */
			return BUNSPEC;
		}

	}



/* generic-init */
	obj_t BGl_genericzd2initzd2zz__weakptrz00(void)
	{
		{	/* Llib/weakptr.scm 14 */
			return BUNSPEC;
		}

	}



/* method-init */
	obj_t BGl_methodzd2initzd2zz__weakptrz00(void)
	{
		{	/* Llib/weakptr.scm 14 */
			return BUNSPEC;
		}

	}



/* imported-modules-init */
	obj_t BGl_importedzd2moduleszd2initz00zz__weakptrz00(void)
	{
		{	/* Llib/weakptr.scm 14 */
			BGl_modulezd2initializa7ationz75zz__errorz00(88804785L,
				BSTRING_TO_STRING(BGl_string1610z00zz__weakptrz00));
			BGl_modulezd2initializa7ationz75zz__hashz00(254893342L,
				BSTRING_TO_STRING(BGl_string1610z00zz__weakptrz00));
			BGl_modulezd2initializa7ationz75zz__readerz00(220648206L,
				BSTRING_TO_STRING(BGl_string1610z00zz__weakptrz00));
			BGl_modulezd2initializa7ationz75zz__paramz00(453939141L,
				BSTRING_TO_STRING(BGl_string1610z00zz__weakptrz00));
			BGl_modulezd2initializa7ationz75zz__bexitz00(443005284L,
				BSTRING_TO_STRING(BGl_string1610z00zz__weakptrz00));
			BGl_modulezd2initializa7ationz75zz__objectz00(475449627L,
				BSTRING_TO_STRING(BGl_string1610z00zz__weakptrz00));
			return
				BGl_modulezd2initializa7ationz75zz__threadz00(149516032L,
				BSTRING_TO_STRING(BGl_string1610z00zz__weakptrz00));
		}

	}

#ifdef __cplusplus
}
#endif
