/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
/*    PUPS C/C++ text processed by pc2c version 1.00                 */
/*    (C) M.A. O'Neill, Digital Vision, Didcot                       */


#include <tad.h>

/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

/*------------------------------------------------------------------------------------
    This is an example of source code written in the Dynamic C (or D) language
    which has been designed to facilitate writing PUPS/PSRP applications which
    are both threadsafe and dynamically loadable.

    (C) M.A. O'Neill, 2000
    E-mail: mao@ermine.ox.ac.uk
------------------------------------------------------------------------------------*/





/* Use a mutex called mutex_1 to make functions threadsafe */
_USE_FMUTEX(mutex_1)   

_PRIVATE int ag[3] = {123};

_PRIVATE int a = (-1);
_PROTOTYPE _PRIVATE char *socketof(char *) = (void *)NULL;



/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
/* Inserted automatically by pc2c */
_PUBLIC _BOOLEAN connect_is_orifice = FALSE;
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

_PUBLIC char *connect(char *addr,
                      int  t1,     /* A test line   
                      int  t2,
                      int  t3)

#ifdef HAVE_ARM


/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

{   /* Inserted automatically by pc2c */
    _LOCK_THREAD_FMUTEX(default)
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

     char *arm = (char *)NULL;

     /* Create key context called 'arm' for current thread */


/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
/* Transformed automatically by pc2c                                 */
    _TKEY(arm_tkey)
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/


     /* Bind character string 'arm' into thread key context '
     /* Remove character string 'arm' from key context 'arm' 'arm' */



/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
/* Transformed automatically by pc2c                                 */
    _TKEY_bind(arm,arm_tkey)
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

     if(addr == (char *)NULL) // crap
     {  printf("no address\n");


/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
    {   /* Inserted automatically by pc2c */
        _UNLOCK_THREAD_FMUTEX(default)
        return((char *)NULL);
    }
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

     }

     /* Remove character string 'arm' from key context 'arm' */


/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
/* Transformed automatically by pc2c                                 */
    _TKEY_FREE(arm_tkey)
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/


     if(addr == (char *)1)


/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
    {   /* Inserted automatically by pc2c */
        _UNLOCK_THREAD_FMUTEX(default)
        return;
    }
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

     else /* b = 1;   



/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

    {   /* Inserted automatically by pc2c */
        _UNLOCK_THREAD_FMUTEX(default)
        return(1);
    }
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

}


{
  a = 1;

}
{
}


/* This is an orifice function which may be attached */
/* to a running PUPS/PSRP applications                 


/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

/* Inserted automatically by pc2c */
_PUBLIC _BOOLEAN portal_is_orifice = TRUE;
_PUBLIC char portal_name[256]      = "portal";
_PUBLIC char portal_prototype[256] = "_PUBLIC _DLL_ORIFICE _BOOLEAN portal(char *f1, char *f2)";
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

_PUBLIC _DLL_ORIFICE _BOOLEAN portal(char *f1, char *f2)



/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
{   /* Inserted automatically by pc2c */
    _LOCK_THREAD_FMUTEX(default)
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/

    fprintf(stderr,"{\n");
    fflush(stderr);


/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
    /* Inserted automatically by pc2c */
    _UNLOCK_THREAD_FMUTEX(default)
}
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/