Ejemplo n.º 1
0
	 */
	signals[NEED_LOCATIONS] = g_signal_new ("need-locations",
						G_TYPE_FROM_CLASS (g_obj_class),
						G_SIGNAL_RUN_LAST,
						G_STRUCT_OFFSET (ClockMapClass, need_locations),
						NULL,
						NULL,
						_clock_marshal_POINTER__VOID,
						G_TYPE_POINTER, 0);
}

static void
clock_map_init (ClockMap *this)
{
        int i;
        ClockMapPrivate *priv = PRIVATE (this);

        gtk_widget_set_has_window (GTK_WIDGET (this), FALSE);

	priv->last_refresh = 0;
	priv->width = 0;
	priv->height = 0;
	priv->highlight_timeout_id = 0;
        priv->stock_map_pixbuf = NULL;

        g_assert (sizeof (marker_files)/sizeof (char *) == MARKER_NB);

        for (i = 0; i < MARKER_NB; i++) {
                priv->location_marker_pixbuf[i] = gdk_pixbuf_new_from_file
                                                  (marker_files[i], NULL);
        }
Ejemplo n.º 2
0
void network_client_win(NetworkClient * client) {
	PRIVATE(client)->score++;
}
Ejemplo n.º 3
0
gboolean network_client_get_state(NetworkClient * client) {
	return PRIVATE(client)->state;
}
Ejemplo n.º 4
0
EcInt *EcArgcp( void )
{
	return &PRIVATE(argc);
}
Ejemplo n.º 5
0
NetworkMessageHandler * network_client_get_handler(NetworkClient * client) 
{
	g_assert(NETWORK_IS_CLIENT(client));

	return PRIVATE(client)->handler;
}
Ejemplo n.º 6
0
/**
 * cr_prop_list_unlink:
 *@a_this: the current list of prop/decl pairs
 *@a_pair: the prop/decl pair to unlink.
 *
 *Unlinks a prop/decl pair from the list
 *
 *Returns the new list or NULL in case of an error.
 */
CRPropList *
cr_prop_list_unlink (CRPropList * a_this, CRPropList * a_pair)
{
        CRPropList *prev = NULL,
                *next = NULL;

        g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pair, NULL);

        /*some sanity checks */
        if (PRIVATE (a_pair)->next) {
                next = PRIVATE (a_pair)->next;
                g_return_val_if_fail (PRIVATE (next), NULL);
                g_return_val_if_fail (PRIVATE (next)->prev == a_pair, NULL);
        }
        if (PRIVATE (a_pair)->prev) {
                prev = PRIVATE (a_pair)->prev;
                g_return_val_if_fail (PRIVATE (prev), NULL);
                g_return_val_if_fail (PRIVATE (prev)->next == a_pair, NULL);
        }
        if (prev) {
                PRIVATE (prev)->next = next;
        }
        if (next) {
                PRIVATE (next)->prev = prev;
        }
        PRIVATE (a_pair)->prev = PRIVATE (a_pair)->next = NULL;
        if (a_this == a_pair) {
                if (next)
                        return next;
                return NULL;
        }
        return a_this;
}
Ejemplo n.º 7
0
EC_API void EcCleanup( void )
{
	void _ec_releaseOT( void );
	EcInt i;

	PRIVATE(in_cleanup) = TRUE;

#if MEM_STATS
	fprintf( stderr, "\nTYPE                   ALLOCATED    MARKINGS\n" );
	fprintf( stderr, "============================================\n" );
	for (i = 0; i <= PRIVATE(usertypes); i++)
		fprintf( stderr, "%-20s    %8ld    %8ld\n", EcTypeName( i ), _ec_make_stats[i], _ec_mark_stats[i] );
#endif

	_ec_packageio_cleanup();

	if (PRIVATE(builtin_name))
		ec_hash_destroy( PRIVATE(builtin_name) );
	PRIVATE(builtin_name) = NULL;

	ec_free( PRIVATE(cpointer) );
	PRIVATE(ncpointers) = 0;
	PRIVATE(cpointer)   = NULL;

	EcGCUnprotectAll();

	PRIVATE(patchmap) = NULL;

	/* BREAK THE LINKS between toplevel and objects ! */
	PRIVATE(rt.activeFrame) = EC_NIL;
	PRIVATE(globalFrame)    = EC_NIL;
	PRIVATE(mainTarget)     = EC_NIL;
	for (i = 0; i < PRIVATE(nglobals); i++)
		PRIVATE(global[i]) = EC_NIL;
	for (i = 0; i < PRIVATE(npackages); i++)
		PRIVATE(package[i].obj) = EC_NIL;
#if EC_STACK_RECYCLE
	{
		EcInt j;

#if EC_STACK_RECYCLE_STATS
		fprintf( stderr, "\n== Stack statistics =================\n" );
		fprintf( stderr, "Calls to EcMakeStack()   : %ld\n", (long)PRIVATE(n_makestack) );
		fprintf( stderr, "# stores in recycle bin  : %ld\n", (long)PRIVATE(n_recycle_put) );
		fprintf( stderr, "# failed stores          : %ld\n", (long)(PRIVATE(n_recycle_put_attempts) - PRIVATE(n_recycle_put)) );
		fprintf( stderr, "# fetched from rec. bin  : %ld\n", (long)PRIVATE(n_recycle_get) );
		fprintf( stderr, "# failed fetches         : %ld\n", (long)(PRIVATE(n_recycle_get_attempts) - PRIVATE(n_recycle_get)) );
		fprintf( stderr, "# times the bin was empty: %ld\n", (long)PRIVATE(n_pool_empty) );
		fprintf( stderr, "# times the bin was full : %ld\n", (long)PRIVATE(n_pool_full) );
		/* fprintf( stderr, "bin max fill             : %ld\n", (long)PRIVATE(pool_max_fill) ); */
		fprintf( stderr, "# refcount increments    : %ld\n", (long)PRIVATE(n_ref_inc) );
		fprintf( stderr, "# refcount decrements    : %ld\n", (long)PRIVATE(n_ref_dec) );
		fprintf( stderr, "\n" );
#endif

		for (j = 0; j < EC_STACK_POOL_SIZE; j++)
			PRIVATE(stack_pool)[j] = EC_NIL;
		ec_bit_nclear(PRIVATE(stack_pool_bmap), 0, EC_STACK_POOL_SIZE-1);
	}
#endif
	for (i = 0; i < GC_FINAL_PASSES; i++) EcGC();

	/* Release all objects in a linear fashion */
	_ec_releaseOT();

	for (i = 0; i < PRIVATE(npackages); i++)
	{
		if (PRIVATE(package)[i].dlhandle)
		{
			if (PRIVATE(package)[i].dlcleanup_fcn)
				(*(PRIVATE(package)[i].dlcleanup_fcn))();
			EcDLClose( PRIVATE(package)[i].dlhandle );
		}
		ec_string_destroy( PRIVATE(package)[i].name );
		PRIVATE(package)[i].name          = NULL;
		PRIVATE(package)[i].dlhandle      = NULL;
		PRIVATE(package)[i].dlinit_fcn    = NULL;
		PRIVATE(package)[i].dlcleanup_fcn = NULL;
	}
	ec_free( PRIVATE(package) );
	PRIVATE(package)   = NULL;
	PRIVATE(npackages) = 0;

	for (i = tc_userbase; i <= PRIVATE(usertypes); i++)
	{
		ec_free( USERTYPE(i).name );
		USERTYPE(i).name = NULL;

		ec_free( USERTYPE(i).sequence_cb );
		ec_free( USERTYPE(i).numeric_cb );
	}
	ec_free( PRIVATE(typespec) );
	PRIVATE(typespec)  = NULL;
	PRIVATE(usertypes) = 0;

	EcTrueObject        = EC_NIL;
	EcFalseObject       = EC_NIL;
	Ec_ERROR            = EC_NIL;
	EcUndefinedObject   = EC_NIL;
	EcMemoryErrorObject = EC_NIL;

	PRIVATE(rt).exc         = EC_NIL;
	PRIVATE(rt).activeFrame = EC_NIL;
	PRIVATE(globalFrame)    = EC_NIL;
	PRIVATE(rt).vm_level    = -1;

	/* CloseScope( PRIVATE(currentScope) ); */
	PRIVATE(currentScope) = NULL;
	PRIVATE(globalScope)  = NULL;

	ec_freepool( PRIVATE(nodePool) );
	PRIVATE(nodePool) = NULL;

	if (PRIVATE(symName))
	{
		EcUInt i;

		for (i = 1; i <= PRIVATE(currentId); i++)
		{
			ec_free( PRIVATE(symName)[i] );
			PRIVATE(symName)[i] = NULL;
		}

		ec_freeblock( PRIVATE(symName) );
		PRIVATE(symName) = NULL;
		PRIVATE(symNameSize) = 0;
	}
	if (PRIVATE(symTable)) ec_strtable_destroy( PRIVATE(symTable) );
	PRIVATE(symTable) = NULL;
	PRIVATE(currentId) = 0;

	ec_free( PRIVATE(fileOutput) );
	ec_free( PRIVATE(fileSource) );
	ec_free( PRIVATE(sourceOrigin) );
	PRIVATE(sourceOrigin) = NULL;
	PRIVATE(fileSource)   = NULL;
	PRIVATE(fileOutput)   = NULL;
	PRIVATE(startLine)    = 0;
	PRIVATE(startColumn)  = 0;
	PRIVATE(endLine)      = 0;
	PRIVATE(endColumn)    = 0;

#if 0
	for (i = 0; i < PRIVATE(argc); i++)
		ec_free( PRIVATE(argv)[i] );
	ec_free( PRIVATE(argv) );
	PRIVATE(argc) = 0;
	PRIVATE(argv) = NULL;
#endif

	_ec_list_cleanup();
	_ec_hash_cleanup();
	_ec_object_cleanup();
	_ec_class_cleanup();
	_ec_package_cleanup();
	_ec_handler_cleanup();
	_ec_compiled_cleanup();
	_ec_stack_cleanup();
	_ec_string_cleanup();
	_ec_char_cleanup();
	_ec_array_cleanup();

	EcDLCleanup();

	PRIVATE(in_cleanup) = FALSE;
}
Ejemplo n.º 8
0
/*!
  Returns rendering color of the highlighted boxes.
*/
const SbColor &
SoBoxHighlightRenderAction::getColor(void)
{
  return PRIVATE(this)->basecolor->rgb[0];
}
Ejemplo n.º 9
0
/*!
  Sets the line \a pattern used for the highlighted boxes. Defaults to
  \c 0xffff (i.e. drawn with no stipples).
*/
void
SoBoxHighlightRenderAction::setLinePattern(unsigned short pattern)
{
  PRIVATE(this)->drawstyle->linePattern = pattern;
}
Ejemplo n.º 10
0
EC_API EcUInt EcInternSymbol( const char *string )
{
	EcUInt id;

	id = EcSymbolId( string );
	if (id) return id;

	ec_strtable_set( PRIVATE(symTable), string, ++PRIVATE(currentId) );

	if (PRIVATE(currentId) >= PRIVATE(symNameSize))
	{
		EcUInt newsize;

		newsize = PRIVATE(symNameSize) + SYMNAMEQUANTUM;
		newsize /= SYMNAMEQUANTUM;
		newsize *= SYMNAMEQUANTUM;

		if (ec_resizeblock( &PRIVATE(symName), newsize, sizeof(char *) ))
		{
			PRIVATE(symNameSize) = newsize;
		}
	}

	ASSERT( PRIVATE(symNameSize) > PRIVATE(currentId) );

	PRIVATE(symName)[PRIVATE(currentId)] = (char *)ec_stringdup( string );
	ASSERT( PRIVATE(symName)[PRIVATE(currentId)] );
	if (! PRIVATE(symName)[PRIVATE(currentId)])
		return 0;

	/*fprintf( stderr, "EcInternSymbol %3d <- %s\n", PRIVATE(currentId), string );*/
	return PRIVATE(currentId);
}
Ejemplo n.º 11
0
/*!
  Sets the \a color for the highlighted boxes. Defaults to completely
  red.
*/
void
SoBoxHighlightRenderAction::setColor(const SbColor & color)
{
  PRIVATE(this)->basecolor->rgb = color;
}
Ejemplo n.º 12
0
EC_API const char *EcSymbolAt( EcUInt symbolid )
{
	return (const char *) PRIVATE(symName)[symbolid];
}
Ejemplo n.º 13
0
/**
 * cr_input_read_char:
 *@a_this: the current instance of CRInput.
 *@a_char: out parameter. The read character.
 *
 *Reads an unicode character from the current instance of
 *#CRInput.
 *
 *Returns CR_OK upon successful completion, an error code
 *otherwise.
 */
enum CRStatus
cr_input_read_char (CRInput * a_this, guint32 * a_char)
{
        enum CRStatus status = CR_OK;
        gulong consumed = 0,
                nb_bytes_left = 0;

        g_return_val_if_fail (a_this && PRIVATE (a_this) && a_char,
                              CR_BAD_PARAM_ERROR);

        if (PRIVATE (a_this)->end_of_input == TRUE)
                return CR_END_OF_INPUT_ERROR;

        nb_bytes_left = cr_input_get_nb_bytes_left (a_this);

        if (nb_bytes_left < 1) {
                return CR_END_OF_INPUT_ERROR;
        }

        status = cr_utils_read_char_from_utf8_buf
                (PRIVATE (a_this)->in_buf
                 +
                 PRIVATE (a_this)->next_byte_index,
                 nb_bytes_left, a_char, &consumed);

        if (status == CR_OK) {
                /*update next byte index */
                PRIVATE (a_this)->next_byte_index += consumed;

                /*update line and column number */
                if (PRIVATE (a_this)->end_of_line == TRUE) {
                        PRIVATE (a_this)->col = 1;
                        PRIVATE (a_this)->line++;
                        PRIVATE (a_this)->end_of_line = FALSE;
                } else if (*a_char != '\n') {
                        PRIVATE (a_this)->col++;
                }

                if (*a_char == '\n') {
                        PRIVATE (a_this)->end_of_line = TRUE;
                }

        }

        return status;
}
Ejemplo n.º 14
0
/**
 * cr_input_new_from_buf:
 *@a_buf: the memory buffer to create the input stream from.
 *The #CRInput keeps this pointer so user should not free it !.
 *@a_len: the size of the input buffer.
 *@a_enc: the buffer's encoding.
 *@a_free_buf: if set to TRUE, this a_buf will be freed
 *at the destruction of this instance. If set to false, it is up
 *to the caller to free it.
 *
 *Creates a new input stream from a memory buffer.
 *Returns the newly built instance of #CRInput.
 */
CRInput *
cr_input_new_from_buf (guchar * a_buf,
                       gulong a_len,
                       enum CREncoding a_enc,
                       gboolean a_free_buf)
{
        CRInput *result = NULL;
        enum CRStatus status = CR_OK;
        CREncHandler *enc_handler = NULL;
        gulong len = a_len;

        g_return_val_if_fail (a_buf, NULL);

        result = cr_input_new_real ();
        g_return_val_if_fail (result, NULL);

        /*transform the encoding in utf8 */
        if (a_enc != CR_UTF_8) {
                enc_handler = cr_enc_handler_get_instance (a_enc);
                if (!enc_handler) {
                        goto error;
                }

                status = cr_enc_handler_convert_input
                        (enc_handler, a_buf, &len,
                         &PRIVATE (result)->in_buf,
                         &PRIVATE (result)->in_buf_size);
                if (status != CR_OK)
                        goto error;
                PRIVATE (result)->free_in_buf = TRUE;
                if (a_free_buf == TRUE && a_buf) {
                        g_free (a_buf) ;
                        a_buf = NULL ;
                }                
                PRIVATE (result)->nb_bytes = PRIVATE (result)->in_buf_size;
        } else {
                PRIVATE (result)->in_buf = (guchar *) a_buf;
                PRIVATE (result)->in_buf_size = a_len;
                PRIVATE (result)->nb_bytes = a_len;
                PRIVATE (result)->free_in_buf = a_free_buf;
        }
        PRIVATE (result)->line = 1;
        PRIVATE (result)->col =  0;
        return result;

 error:
        if (result) {
                cr_input_destroy (result);
                result = NULL;
        }

        return NULL;
}
Ejemplo n.º 15
0
// Documented in superclass.
void
SoXtPlaneViewer::setCamera(SoCamera * camera)
{
  Pixmap pixmap, pixmap_ins;
  if (camera == NULL) {
    // find better pixmaps for this...
    pixmap = PRIVATE(this)->pixmaps.ortho;
    pixmap_ins = PRIVATE(this)->pixmaps.ortho_ins;
  } else if (camera->isOfType(SoPerspectiveCamera::getClassTypeId())) {
    pixmap = PRIVATE(this)->pixmaps.perspective;
    pixmap_ins = PRIVATE(this)->pixmaps.perspective_ins;
    SoXtResource rsc(this->getRightWheelLabelWidget());
    char * dollyString = NULL;
    char * zoomString = NULL;
    if (
        (rsc.getResource("dollyString", XmRString, dollyString) && dollyString != NULL)
        &&
        (rsc.getResource("zoomString", XmRString, zoomString) && zoomString != NULL)
        && strcmp(zoomString,this->getRightWheelString())== 0
        )
      this->setRightWheelString(dollyString);
  } else if (camera->isOfType(SoOrthographicCamera::getClassTypeId())) {
    pixmap = PRIVATE(this)->pixmaps.ortho;
    pixmap_ins = PRIVATE(this)->pixmaps.ortho_ins;
    SoXtResource rsc(this->getRightWheelLabelWidget());
    char * dollyString = NULL;
    char * zoomString = NULL;
    if (
        (rsc.getResource("dollyString", XmRString, dollyString) && dollyString != NULL)
        &&
        (rsc.getResource("zoomString", XmRString, zoomString) && zoomString != NULL)
        && strcmp(dollyString,this->getRightWheelString())== 0
        )
      this->setRightWheelString(zoomString);
  } else {
    SoDebugError::postWarning("SoXtExaminerViewer::setCamera",
      "unknown camera type - got no pixmap");
    // find better pixmaps for this...
    pixmap = PRIVATE(this)->pixmaps.ortho;
    pixmap_ins = PRIVATE(this)->pixmaps.ortho_ins;
  }

#if HAVE_LIBXPM
  XtUnmanageChild(PRIVATE(this)->buttons[3].bwidget);
  XtVaSetValues(PRIVATE(this)->buttons[3].bwidget,
    XmNlabelType, XmPIXMAP,
    XmNlabelPixmap, pixmap,
    XmNselectPixmap, pixmap,
    XmNlabelInsensitivePixmap, pixmap_ins,
    XmNselectInsensitivePixmap, pixmap_ins,
    NULL);
  XtVaSetValues(PRIVATE(this)->buttons[3].bwidget,
    XmNwidth, 30, XmNheight, 30, NULL);
  XtManageChild(PRIVATE(this)->buttons[3].bwidget);
#endif // HAVE_LIBXPM

  inherited::setCamera(camera);
}
Ejemplo n.º 16
0
/*!
  Returns line pattern used when drawing boxes.
*/
unsigned short
SoBoxHighlightRenderAction::getLinePattern(void) const
{
  return PRIVATE(this)->drawstyle->linePattern.getValue();
}
Ejemplo n.º 17
0
// Documented in superclass. Overridden to add the x, y, z, and
// camera-toggle buttons to the list of viewer buttons.
void
SoXtPlaneViewer::createViewerButtons(Widget parent,
                                     SbPList * buttonlist)
{
  inherited::createViewerButtons(parent, buttonlist);

  const int buttons =
    sizeof(SoXtPlaneViewerP::SoXtPlaneViewerButtons) / sizeof(SoXtViewerButton);

  for (int button = 0; button < buttons; button++) {
    Widget widget =
      XtVaCreateManagedWidget(PRIVATE(this)->buttons[button].keyword,
                              xmPushButtonWidgetClass, parent,
                              XmNshadowType, XmSHADOW_OUT,
                              XmNhighlightThickness, 0,
                              XmNshadowThickness, 2,
                              XmNtraversalOn, False,
                              XmNwidth, 30,
                              XmNheight, 30,
                              XtVaTypedArg,
                              XmNlabelString, XmRString,
                              PRIVATE(this)->buttons[button].label, strlen(PRIVATE(this)->buttons[button].label) + 1,
                              NULL);
    PRIVATE(this)->buttons[button].bwidget = widget;

#if HAVE_LIBXPM
    Pixmap pixmap = SoXtInternal::createPixmapFromXpm(widget, PRIVATE(this)->buttons[button].xpm_data);
    if (pixmap) {
      XtVaSetValues(widget,
                    XmNlabelType, XmPIXMAP,
                    XmNlabelPixmap, pixmap,
                    NULL);
    }
#endif

    buttonlist->append(widget);

    XtAddCallback(widget, XmNactivateCallback,
                  SoXtPlaneViewerP::buttonCB, (XtPointer) this);
  } // for (button < buttons)

#if HAVE_LIBXPM
  PRIVATE(this)->pixmaps.ortho =
    SoXtInternal::createPixmapFromXpm(PRIVATE(this)->buttons[3].bwidget, ortho_xpm);
  PRIVATE(this)->pixmaps.ortho_ins =
    SoXtInternal::createPixmapFromXpm(PRIVATE(this)->buttons[3].bwidget, ortho_xpm, TRUE);
  PRIVATE(this)->pixmaps.perspective =
    SoXtInternal::createPixmapFromXpm(PRIVATE(this)->buttons[3].bwidget, perspective_xpm);
  PRIVATE(this)->pixmaps.perspective_ins =
    SoXtInternal::createPixmapFromXpm(PRIVATE(this)->buttons[3].bwidget, perspective_xpm, TRUE);
#endif // HAVE_LIBXPM
}
Ejemplo n.º 18
0
/*!
  Sets the line \a width used when drawing boxes, in screen pixels (as
  for all OpenGL rendering). Defaults to 3.
*/
void
SoBoxHighlightRenderAction::setLineWidth(const float width)
{
  PRIVATE(this)->drawstyle->lineWidth = width;
}
Ejemplo n.º 19
0
EC_API EcBool EcInit( void )
{
#if MEM_STATS
	EcInt i;
#endif
	void _ec_initializeOT( void );

	if (! EcDLInit())
	{
		fprintf( stderr, "DL error: %s\n", EcDLError() );
		return FALSE;
	}

	PRIVATE(in_cleanup) = FALSE;

#if 0
	PRIVATE(argc) = 0;
	PRIVATE(argv) = NULL;
#endif

#ifdef EC_DEBUG
	PRIVATE(debug_enable) = TRUE;
#else
	PRIVATE(debug_enable) = FALSE;
#endif

	PRIVATE(sourceOrigin) = NULL;
	PRIVATE(fileSource)   = NULL;
	PRIVATE(fileOutput)   = NULL;
	PRIVATE(startLine)    = 0;
	PRIVATE(startColumn)  = 0;
	PRIVATE(endLine)      = 0;
	PRIVATE(endColumn)    = 0;

	PRIVATE(parse_result) = NULL;

	PRIVATE(symTable)     = ec_strtable_create( STRTABLESLOTS );
	if (! PRIVATE(symTable))
		return FALSE;
	PRIVATE(currentId)    = 0;
	PRIVATE(symName)      = NULL;
	PRIVATE(symNameSize)  = 0;

	PRIVATE(nodePool)     = NULL;

	PRIVATE(globalScope)  = NULL;
	PRIVATE(currentScope) = NULL;

	PRIVATE(globalFrame)     = EC_NIL;
	PRIVATE(rt).activeFrame  = EC_NIL;
	PRIVATE(rt).exc          = EC_NIL;
	PRIVATE(rt).vm_level     = -1;
	PRIVATE(rt).line_num     = 0;
	PRIVATE(rt).exc_line_num = -1;

#if MEM_STATS
	for (i = 0; i < EC_MAX_TYPES; i++)
	{
		_ec_mark_stats[i] = 0;
		_ec_make_stats[i] = 0;
	}
#endif

#if 0
	ASSERT( argc >= 0 );
	if (argc > 0)
	{
		EcInt i;

		/* Duplicate args */
		PRIVATE(argv) = (char **) ec_malloc( argc * sizeof(char *) );
		if (! argv)
			return FALSE;
		memset( PRIVATE(argv), 0x00, argc * sizeof(char *) );
		PRIVATE(argc) = argc;

		for (i = 0; i < argc; i++)
		{
			PRIVATE(argv)[i] = ec_stringdup( argv[i] );
			if (! PRIVATE(argv)[i])
				return FALSE;
		}
	}
#endif

	/* Register symbols */
	PRIVATE(selfID)              = EcInternSymbol( "self" );
	PRIVATE(at_classID)          = EcInternSymbol( "at_class" );
	PRIVATE(initID)              = EcInternSymbol( "init" );
	PRIVATE(newID)               = EcInternSymbol( "new" );
	PRIVATE(copyID)              = EcInternSymbol( "_copy" );
	PRIVATE(compareID)           = EcInternSymbol( "_compare" );
	PRIVATE(hashID)              = EcInternSymbol( "_hash" );
	PRIVATE(getitemID)           = EcInternSymbol( "_getitem" );
	PRIVATE(setitemID)           = EcInternSymbol( "_setitem" );
	PRIVATE(delitemID)           = EcInternSymbol( "_delitem" );
	PRIVATE(lengthID)            = EcInternSymbol( "_length" );
	PRIVATE(gcmarkID)            = EcInternSymbol( "_gcmark" );
	PRIVATE(gcfreeID)            = EcInternSymbol( "_gcfree" );
	PRIVATE(printID)             = EcInternSymbol( "_print" );
	PRIVATE(doesNotUnderstandID) = EcInternSymbol( "doesNotUnderstand" );
	PRIVATE(promoteID)           = EcInternSymbol( "_promote" );
	PRIVATE(addID)               = EcInternSymbol( "_add" );
	PRIVATE(raddID)              = EcInternSymbol( "_radd" );
	PRIVATE(subID)               = EcInternSymbol( "_sub" );
	PRIVATE(rsubID)              = EcInternSymbol( "_rsub" );
	PRIVATE(mulID)               = EcInternSymbol( "_mul" );
	PRIVATE(rmulID)              = EcInternSymbol( "_rmul" );
	PRIVATE(divID)               = EcInternSymbol( "_div" );
	PRIVATE(rdivID)              = EcInternSymbol( "_rdiv" );
	PRIVATE(modID)               = EcInternSymbol( "_mod" );
	PRIVATE(rmodID)              = EcInternSymbol( "_rmod" );
	PRIVATE(powID)               = EcInternSymbol( "_pow" );
	PRIVATE(rpowID)              = EcInternSymbol( "_rpow" );
	PRIVATE(lshiftID)            = EcInternSymbol( "_lshift" );
	PRIVATE(rlshiftID)           = EcInternSymbol( "_rlshift" );
	PRIVATE(rshiftID)            = EcInternSymbol( "_rshift" );
	PRIVATE(rrshiftID)           = EcInternSymbol( "_rrshift" );
	PRIVATE(andID)               = EcInternSymbol( "_and" );
	PRIVATE(randID)              = EcInternSymbol( "_rand" );
	PRIVATE(orID)                = EcInternSymbol( "_or" );
	PRIVATE(rorID)               = EcInternSymbol( "_ror" );
	PRIVATE(xorID)               = EcInternSymbol( "_xor" );
	PRIVATE(rxorID)              = EcInternSymbol( "_rxor" );
	PRIVATE(negID)               = EcInternSymbol( "_neg" );
	PRIVATE(posID)               = EcInternSymbol( "_pos" );
	PRIVATE(absID)               = EcInternSymbol( "_abs" );
	PRIVATE(invertID)            = EcInternSymbol( "_invert" );
	PRIVATE(intID)               = EcInternSymbol( "_int" );
	PRIVATE(floatID)             = EcInternSymbol( "_float" );
	PRIVATE(trueID)              = EcInternSymbol( "_true" );
	PRIVATE(cmpID)               = EcInternSymbol( "_cmp" );
	PRIVATE(rcmpID)              = EcInternSymbol( "_rcmp" );

	PRIVATE(lineID)              = EcInternSymbol( "line" );

	_ec_initializeOT();

	PRIVATE(global)       = NULL;
	PRIVATE(nglobals)     = 0;
	PRIVATE(ncoreglobals) = 0;

#if EC_STACK_RECYCLE
	{
		EcInt j;

		for (j = 0; j < EC_STACK_POOL_SIZE; j++)
			PRIVATE(stack_pool)[j] = EC_NIL;
		ec_bit_nclear(PRIVATE(stack_pool_bmap), 0, EC_STACK_POOL_SIZE-1);

#if EC_STACK_RECYCLE_STATS
		PRIVATE(n_makestack)            = 0;
		PRIVATE(n_recycle_put_attempts) = 0;
		PRIVATE(n_recycle_put)          = 0;
		PRIVATE(n_recycle_get_attempts) = 0;
		PRIVATE(n_recycle_get)          = 0;
		PRIVATE(n_pool_empty)           = 0;
		PRIVATE(n_pool_full)            = 0;
		PRIVATE(pool_max_fill)          = 0;
		PRIVATE(n_ref_inc)              = 0;
		PRIVATE(n_ref_dec)              = 0;
#endif
	}
#endif

	EcCheckForGC();

	PRIVATE(usertypes) = tc_userbase - 1;
	PRIVATE(typespec)  = NULL;

	PRIVATE(package)   = NULL;
	PRIVATE(npackages) = 0;

	PRIVATE(patchmap)  = NULL;

	PRIVATE(ncpointers) = 0;
	PRIVATE(cpointer)   = NULL;

	PRIVATE(builtin_name) = ec_hash_create( 0, 0, 0, &ec_hash_obj2string );

	/* Built-ins */

	if (EC_NULLP(EcFalseObject))
	{
		EcFalseObject = EcMakeBool( FALSE );
		EcTrueObject  = EcMakeBool( TRUE );

		Ec_ERROR = EcAllocObject();
		EC_OBJTYPE(Ec_ERROR) = tc_error;

		EcUndefinedObject = EcMakeUndefined();
	}

	/* Register built-in packages, types, primitives & classes */
	if (! _ec_register_builtin())
		return FALSE;

	/* Preallocate a MemoryError object */
	if (EC_NULLP(EcMemoryErrorObject))
	{
		EcMemoryError();										/* create one ...            */
		PRIVATE(rt).exc = EC_NIL;								/* ... but don't assert it ! */
	}

	/* Save global forever-living objects from GC */
	EcGCProtect( EcFalseObject );
	EcGCProtect( EcTrueObject );
	EcGCProtect( Ec_ERROR );
	EcGCProtect( EcUndefinedObject );
	EcGCProtect( EcMemoryErrorObject );

	PRIVATE(ncoreglobals) = PRIVATE(nglobals);

	_ec_packageio_init();

	return TRUE;
}
Ejemplo n.º 20
0
/*!
  Returns the line width used when drawing highlight boxes.
*/
float
SoBoxHighlightRenderAction::getLineWidth(void) const
{
  return PRIVATE(this)->drawstyle->lineWidth.getValue();
}
Ejemplo n.º 21
0
EcInt EcArgc( void )
{
	return PRIVATE(argc);
}
Ejemplo n.º 22
0
/*!
  Destructor. Frees up internal resources used to store texture image
  data.
*/
SoSceneTextureCubeMap::~SoSceneTextureCubeMap()
{
  delete PRIVATE(this);
}
Ejemplo n.º 23
0
EC_API void EcRegisterBuiltin( const char *name, EC_OBJ builtin )
{
	ec_hash_set( PRIVATE(builtin_name), builtin, (EcAny)name );
}
Ejemplo n.º 24
0
// Documented in superclass.
void
SoSceneTextureCubeMap::GLRender(SoGLRenderAction * action)
{
  SoState * state = action->getState();

  if (SoTextureOverrideElement::getImageOverride(state))
    return;

  float quality = SoTextureQualityElement::get(state);

  const cc_glglue * glue = cc_glglue_instance(SoGLCacheContextElement::get(state));
  SoNode * root = this->scene.getValue();

  LOCK_GLIMAGE(this);

  if (root && (!PRIVATE(this)->glimagevalid || !PRIVATE(this)->pbuffervalid)) {
    PRIVATE(this)->updatePBuffer(state, quality);
    
    // don't cache when we change the glimage
    SoCacheElement::setInvalid(TRUE);
    if (state->isCacheOpen()) {
      SoCacheElement::invalidate(state);
    }
  }  
  UNLOCK_GLIMAGE(this);
  
  SoMultiTextureImageElement::Model glmodel = (SoMultiTextureImageElement::Model) 
    this->model.getValue();
  
  if (glmodel == SoMultiTextureImageElement::REPLACE) {
    if (!cc_glglue_glversion_matches_at_least(glue, 1, 1, 0)) {
      static int didwarn = 0;
      if (!didwarn) {
        SoDebugError::postWarning("SoSceneTextureCubeMap::GLRender",
                                  "Unable to use the GL_REPLACE texture model. "
                                  "Your OpenGL version is < 1.1. "
                                  "Using GL_MODULATE instead.");
        didwarn = 1;
      }
      // use MODULATE and not DECAL, since DECAL only works for RGB
      // and RGBA textures
      glmodel = SoMultiTextureImageElement::MODULATE;
    }
  }
  
  int unit = SoTextureUnitElement::get(state);
  int maxunits = cc_glglue_max_texture_units(glue);
  if (unit < maxunits) {
    SoGLMultiTextureImageElement::set(state, this, unit,
                                      PRIVATE(this)->glimage,
                                      glmodel,
                                      this->blendColor.getValue());
    if (quality > 0.0f && PRIVATE(this)->glimagevalid) {
      SoGLMultiTextureEnabledElement::enableCubeMap(state, this, unit);
    }
  }
  else {
    // we already warned in SoTextureUnit. I think it's best to just
    // ignore the texture here so that all texture for non-supported
    // units will be ignored. pederb, 2003-11-04
  }
}
Ejemplo n.º 25
0
guint network_client_get_score(NetworkClient * client) {
	return PRIVATE(client)->score;
}
Ejemplo n.º 26
0
EC_API EC_OBJ EcLibExceptionClass_NewWith( EC_OBJ self, EC_OBJ in_class, EC_OBJ stack )
{
	EC_OBJ obj;
	EC_OBJ arg;
#if 0
	ec_string ds;
#endif

	EC_CHECKNARGS_CM( self, "new:", 1 );

	if ((PRIVATE(rt.line_num) > 0) &&							/* set only if we have a line number and we */
		(PRIVATE(rt.exc_line_num) < 0))							/* don't have the original exception source */
		PRIVATE(rt.exc_line_num) = PRIVATE(rt.line_num);

	/*
	 * This is a class method, so self is the class
	 */
	arg = EC_STACKPOP( stack );
	obj = EcLibObjectClass_New( self, in_class, stack );

	EcSetInstanceVariable( obj, EcExceptionClass,
						   "source",
						   (EC_NNULLP(PRIVATE(rt.compiled)) ?
							EC_PACKAGESOURCE(EC_COMPILEDPACKAGE(PRIVATE(rt.compiled))) : EC_NIL) );
	EcSetInstanceVariable( obj, EcExceptionClass,
						   "in", PRIVATE(rt.compiled) );
	EcSetInstanceVariable( obj, EcExceptionClass,
						   "line", EcMakeInt( PRIVATE(rt.exc_line_num) ) );

#if 0
	ec_string_init( &ds, NULL );
	if (EC_NNULLP(PRIVATE(rt.compiled)))
		ec_sprintf( &ds, "(%w: %ld  IN: \"%w\")\n\t%w",
					EC_PACKAGESOURCE(EC_COMPILEDPACKAGE(PRIVATE(rt.compiled))),
					(long) PRIVATE(rt.exc_line_num),
					EC_COMPILEDNAME(PRIVATE(rt.compiled)),
					arg );
	else
		ec_sprintf( &ds, "(--: %ld  IN: --)\n\t%w",
					(long) PRIVATE(rt.exc_line_num),
					arg );
	EcSendMessageVA( obj, EcInternSymbol( "setMessage" ),
					 1, EcMakeString( ec_strdata( &ds ), ec_strlen( &ds ) ) );
	ec_string_cleanup( &ds );
#endif
	EcSendMessageVA( obj, EcInternSymbol( "setMessage" ),
					 1, arg );
/*	EcSetInstanceVariable( obj, EcExceptionClass,
						   "msg",
						   arg );*/
	return obj;
}
Ejemplo n.º 27
0
NetworkPlayer * network_client_get_player(NetworkClient * client) 
{
	g_assert(NETWORK_IS_CLIENT(client));

	return PRIVATE(client)->player;
}
	location_signals[SET_CURRENT] = 
		g_signal_new ("set-current",
			      G_OBJECT_CLASS_TYPE (g_obj_class),
			      G_SIGNAL_RUN_FIRST,
			      G_STRUCT_OFFSET (ClockLocationClass, set_current),
			      NULL, NULL,
			      g_cclosure_marshal_VOID__VOID,
			      G_TYPE_NONE, 0);

        g_type_class_add_private (this_class, sizeof (ClockLocationPrivate));
}

static void
clock_location_init (ClockLocation *this)
{
        ClockLocationPrivate *priv = PRIVATE (this);

        priv->name = NULL;

        priv->systz = system_timezone_new ();

        priv->timezone = NULL;

        priv->tzname = NULL;

        priv->latitude = 0;
        priv->longitude = 0;

	priv->temperature_unit = TEMP_UNIT_CENTIGRADE;
	priv->speed_unit = SPEED_UNIT_MS;
}
Ejemplo n.º 29
0
	g_return_val_if_fail (type < BOOKMARK_STORE_N_TYPES, NULL);

	if (! instances [type]) {
		instances [type] = bookmark_agent_new (type);
		g_object_weak_ref (G_OBJECT (instances [type]), weak_destroy_cb, GINT_TO_POINTER (type));
	}
	else
		g_object_ref (G_OBJECT (instances [type]));

	return instances [type];
}

gboolean
bookmark_agent_has_item (BookmarkAgent *this, const gchar *uri)
{
	return g_bookmark_file_has_item (PRIVATE (this)->store, uri);
}

void
bookmark_agent_add_item (BookmarkAgent *this, const BookmarkItem *item)
{
	BookmarkAgentPrivate *priv = PRIVATE (this);

	if (! item)
		return;

	g_return_if_fail (priv->user_modifiable);
	g_return_if_fail (item->uri);
	g_return_if_fail (item->mime_type);

	g_bookmark_file_set_mime_type (priv->store, item->uri, item->mime_type);
Ejemplo n.º 30
0
const char /*@observer@*/ *gps_data(const struct gps_data_t *gpsdata)
/* return the contents of the client data buffer */
{
    return PRIVATE(gpsdata)->buffer;
}