Example #1
0
bool
cct_check_args_eq(const char *file, int line, const char *expression,
                  struct args *expected, struct args *actual,
                  bool free1, bool free2)
{
	bool result;

	if (expected && actual && args_equal(actual, expected)) {
		cct_check_passed(file, line, expression);
		result = true;
	} else {
		char *exp_str = expected ? args_to_string(expected) : x_strdup("(null)");
		char *act_str = actual ? args_to_string(actual) : x_strdup("(null)");
		cct_check_failed(file, line, expression, exp_str, act_str);
		free(exp_str);
		free(act_str);
		result = false;
	}

	if (free1) {
		args_free(expected);
	}
	if (free2) {
		args_free(actual);
	}
	return result;
}
Example #2
0
DFBResult
ILayerRegion_Requestor::FlipUpdateStereo(
                    const DFBRegion                           *left,
                    const DFBRegion                           *right,
                    DFBSurfaceFlipFlags                        flags
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreLayerRegionFlipUpdateStereo       *args = (CoreLayerRegionFlipUpdateStereo*) args_alloc( args_static, sizeof(CoreLayerRegionFlipUpdateStereo) );
    CoreLayerRegionFlipUpdateStereoReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreLayerRegionFlipUpdateStereoReturn*) args_alloc( return_args_static, sizeof(CoreLayerRegionFlipUpdateStereoReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreLayerRegion, "ILayerRegion_Requestor::%s()\n", __FUNCTION__ );


  if (left) {
    args->left = *left;
    args->left_set = true;
  }
  else
    args->left_set = false;
  if (right) {
    args->right = *right;
    args->right_set = true;
  }
  else
    args->right_set = false;
    args->flags = flags;

    ret = (DFBResult) CoreLayerRegion_Call( obj, FCEF_NONE, CoreLayerRegion_FlipUpdateStereo, args, sizeof(CoreLayerRegionFlipUpdateStereo), return_args, sizeof(CoreLayerRegionFlipUpdateStereoReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreLayerRegion_Call( CoreLayerRegion_FlipUpdateStereo ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreLayerRegion_FlipUpdateStereo failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
DFBResult
ILayer_Requestor::GetPrimaryContext(
                    bool                                       activate,
                    CoreLayerContext                         **ret_context
)
{
    DFBResult           ret = DFB_OK;
    CoreLayerContext *context = NULL;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreLayerGetPrimaryContext       *args = (CoreLayerGetPrimaryContext*) args_alloc( args_static, sizeof(CoreLayerGetPrimaryContext) );
    CoreLayerGetPrimaryContextReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreLayerGetPrimaryContextReturn*) args_alloc( return_args_static, sizeof(CoreLayerGetPrimaryContextReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreLayer, "ILayer_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( ret_context != NULL );

    args->activate = activate;

    ret = (DFBResult) CoreLayer_Call( obj, FCEF_NONE, CoreLayer_GetPrimaryContext, args, sizeof(CoreLayerGetPrimaryContext), return_args, sizeof(CoreLayerGetPrimaryContextReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreLayer_Call( CoreLayer_GetPrimaryContext ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreLayer_GetPrimaryContext failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }


    ret = (DFBResult) CoreLayerContext_Catch( core, return_args->context_ptr, &context );
    if (ret) {
         D_DERROR( ret, "%s: Catching context by ID %u failed!\n", __FUNCTION__, return_args->context_id );
         goto out;
    }

    *ret_context = context;


out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #4
0
DFBResult
ICore_Requestor::GetSurface(
                    u32                                        surface_id,
                    CoreSurface                              **ret_surface
)
{
    DFBResult           ret = DFB_OK;
    CoreSurface *surface = NULL;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreDFBGetSurface       *args = (CoreDFBGetSurface*) args_alloc( args_static, sizeof(CoreDFBGetSurface) );
    CoreDFBGetSurfaceReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreDFBGetSurfaceReturn*) args_alloc( return_args_static, sizeof(CoreDFBGetSurfaceReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreDFB, "ICore_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( ret_surface != NULL );

    args->surface_id = surface_id;

    ret = (DFBResult) CoreDFB_Call( obj, FCEF_NONE, CoreDFB_GetSurface, args, sizeof(CoreDFBGetSurface), return_args, sizeof(CoreDFBGetSurfaceReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreDFB_Call( CoreDFB_GetSurface ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreDFB_GetSurface failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }


    ret = (DFBResult) CoreSurface_Catch( core, return_args->surface_ptr, &surface );
    if (ret) {
         D_DERROR( ret, "%s: Catching surface by ID %u failed!\n", __FUNCTION__, return_args->surface_id );
         goto out;
    }

    *ret_surface = surface;


out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #5
0
/* Insert all arguments in src into dest at position index.
 * If replace is true, the element at dest->argv[index] is replaced
 * with the contents of src and everything past it is shifted.
 * Otherwise, dest->argv[index] is also shifted.
 *
 * src is consumed by this operation and should not be freed or used
 * again by the caller */
void
args_insert(struct args *dest, int index, struct args *src, bool replace)
{
	int offset;
	int i;

	/* Adjustments made if we are replacing or shifting the element
	 * currently at dest->argv[index] */
	offset = replace ? 1 : 0;

	if (replace) {
		free(dest->argv[index]);
	}

	if (src->argc == 0) {
		if (replace) {
			/* Have to shift everything down by 1 since
			 * we replaced with an empty list */
			for (i = index; i < dest->argc; i++) {
				dest->argv[i] = dest->argv[i + 1];
			}
			dest->argc--;
		}
		args_free(src);
		return;
	}

	if (src->argc == 1 && replace) {
		/* Trivial case; replace with 1 element */
		dest->argv[index] = src->argv[0];
		src->argc = 0;
		args_free(src);
		return;
	}

	dest->argv = (char **)x_realloc(
		dest->argv,
		(src->argc + dest->argc + 1 - offset) *
		sizeof(char *));

	/* Shift arguments over */
	for (i = dest->argc; i >= index + offset; i--) {
		dest->argv[i + src->argc - offset] = dest->argv[i];
	}

	/* Copy the new arguments into place */
	for (i = 0; i < src->argc; i++) {
		dest->argv[i + index] = src->argv[i];
	}

	dest->argc += src->argc - offset;
	src->argc = 0;
	args_free(src);
}
Example #6
0
DFBResult
ICore_Requestor::ClipboardSet(
                    const char                                *mime_type,
                    u32                                        mime_type_size,
                    const char                                *data,
                    u32                                        data_size,
                    u64                                        timestamp_us
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreDFBClipboardSet       *args = (CoreDFBClipboardSet*) args_alloc( args_static, sizeof(CoreDFBClipboardSet) + mime_type_size * sizeof(char) + data_size * sizeof(char) );
    CoreDFBClipboardSetReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreDFBClipboardSetReturn*) args_alloc( return_args_static, sizeof(CoreDFBClipboardSetReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreDFB, "ICore_Requestor::%s()\n", __FUNCTION__ );


    args->mime_type_size = mime_type_size;
    args->data_size = data_size;
    args->timestamp_us = timestamp_us;
    direct_memcpy( (char*) (args + 1), mime_type, mime_type_size * sizeof(char) );
    direct_memcpy( (char*) (args + 1) + mime_type_size * sizeof(char), data, data_size * sizeof(char) );

    ret = (DFBResult) CoreDFB_Call( obj, FCEF_NONE, CoreDFB_ClipboardSet, args, sizeof(CoreDFBClipboardSet) + mime_type_size * sizeof(char) + data_size * sizeof(char), return_args, sizeof(CoreDFBClipboardSetReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreDFB_Call( CoreDFB_ClipboardSet ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreDFB_ClipboardSet failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
DFBResult
IImageProvider_Requestor::RenderTo(
                    CoreSurface                               *destination,
                    const DFBRectangle                        *rect
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    ImageProviderRenderTo       *args = (ImageProviderRenderTo*) args_alloc( args_static, sizeof(ImageProviderRenderTo) );
    ImageProviderRenderToReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (ImageProviderRenderToReturn*) args_alloc( return_args_static, sizeof(ImageProviderRenderToReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_ImageProvider, "IImageProvider_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( destination != NULL );

    args->destination_id = CoreSurface_GetID( destination );
  if (rect) {
    args->rect = *rect;
    args->rect_set = true;
  }
  else
    args->rect_set = false;

    ret = (DFBResult) ImageProvider_Call( obj, FCEF_NONE, ImageProvider_RenderTo, args, sizeof(ImageProviderRenderTo), return_args, sizeof(ImageProviderRenderToReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: ImageProvider_Call( ImageProvider_RenderTo ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: ImageProvider_RenderTo failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #8
0
DFBResult
ICore_Requestor::ClipboardGet(
                    char                                      *ret_mime_type,
                    u32                                       *ret_mime_type_size,
                    char                                      *ret_data,
                    u32                                       *ret_data_size
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreDFBClipboardGet       *args = (CoreDFBClipboardGet*) args_alloc( args_static, sizeof(CoreDFBClipboardGet) );
    CoreDFBClipboardGetReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreDFBClipboardGetReturn*) args_alloc( return_args_static, sizeof(CoreDFBClipboardGetReturn) + MAX_CLIPBOARD_MIME_TYPE_SIZE * sizeof(char) + MAX_CLIPBOARD_DATA_SIZE * sizeof(char) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreDFB, "ICore_Requestor::%s()\n", __FUNCTION__ );



    ret = (DFBResult) CoreDFB_Call( obj, FCEF_NONE, CoreDFB_ClipboardGet, args, sizeof(CoreDFBClipboardGet), return_args, sizeof(CoreDFBClipboardGetReturn) + MAX_CLIPBOARD_MIME_TYPE_SIZE * sizeof(char) + MAX_CLIPBOARD_DATA_SIZE * sizeof(char), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreDFB_Call( CoreDFB_ClipboardGet ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreDFB_ClipboardGet failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }

    *ret_mime_type_size = return_args->mime_type_size;
    *ret_data_size = return_args->data_size;
    direct_memcpy( ret_mime_type, (char*) (return_args + 1), return_args->mime_type_size * sizeof(char) );
    direct_memcpy( ret_data, (char*) (return_args + 1) + return_args->mime_type_size * sizeof(char), return_args->data_size * sizeof(char) );


out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
DFBResult
IPalette_Requestor::SetEntriesYUV(
                    const DFBColorYUV                         *colors,
                    u32                                        num,
                    u32                                        offset
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CorePaletteSetEntriesYUV       *args = (CorePaletteSetEntriesYUV*) args_alloc( args_static, sizeof(CorePaletteSetEntriesYUV) + num * sizeof(DFBColorYUV) );
    CorePaletteSetEntriesYUVReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CorePaletteSetEntriesYUVReturn*) args_alloc( return_args_static, sizeof(CorePaletteSetEntriesYUVReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CorePalette, "IPalette_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( colors != NULL );

    args->num = num;
    args->offset = offset;
    direct_memcpy( (char*) (args + 1), colors, num * sizeof(DFBColorYUV) );

    ret = (DFBResult) CorePalette_Call( obj, FCEF_NONE, CorePalette_SetEntriesYUV, args, sizeof(CorePaletteSetEntriesYUV) + num * sizeof(DFBColorYUV), return_args, sizeof(CorePaletteSetEntriesYUVReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CorePalette_Call( CorePalette_SetEntriesYUV ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CorePalette_SetEntriesYUV failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #10
0
DFBResult
ICore_Requestor::AllowSurface(
                    CoreSurface                               *surface,
                    const char                                *executable,
                    u32                                        executable_length
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreDFBAllowSurface       *args = (CoreDFBAllowSurface*) args_alloc( args_static, sizeof(CoreDFBAllowSurface) + executable_length * sizeof(char) );
    CoreDFBAllowSurfaceReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreDFBAllowSurfaceReturn*) args_alloc( return_args_static, sizeof(CoreDFBAllowSurfaceReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreDFB, "ICore_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( surface != NULL );

    args->surface_id = CoreSurface_GetID( surface );
    args->executable_length = executable_length;
    direct_memcpy( (char*) (args + 1), executable, executable_length * sizeof(char) );

    ret = (DFBResult) CoreDFB_Call( obj, FCEF_NONE, CoreDFB_AllowSurface, args, sizeof(CoreDFBAllowSurface) + executable_length * sizeof(char), return_args, sizeof(CoreDFBAllowSurfaceReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreDFB_Call( CoreDFB_AllowSurface ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreDFB_AllowSurface failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #11
0
DFBResult
IInputDevice_Requestor::SetKeymapEntry(
                    s32                                        key_code,
                    const DFBInputDeviceKeymapEntry           *entry
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreInputDeviceSetKeymapEntry       *args = (CoreInputDeviceSetKeymapEntry*) args_alloc( args_static, sizeof(CoreInputDeviceSetKeymapEntry) );
    CoreInputDeviceSetKeymapEntryReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreInputDeviceSetKeymapEntryReturn*) args_alloc( return_args_static, sizeof(CoreInputDeviceSetKeymapEntryReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreInputDevice, "IInputDevice_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( entry != NULL );

    args->key_code = key_code;
    args->entry = *entry;

    ret = (DFBResult) CoreInputDevice_Call( obj, FCEF_NONE, CoreInputDevice_SetKeymapEntry, args, sizeof(CoreInputDeviceSetKeymapEntry), return_args, sizeof(CoreInputDeviceSetKeymapEntryReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreInputDevice_Call( CoreInputDevice_SetKeymapEntry ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreInputDevice_SetKeymapEntry failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #12
0
DFBResult
ICore_Requestor::CreateImageProvider(
                    u32                                        buffer_call,
                    u32                                       *ret_call
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreDFBCreateImageProvider       *args = (CoreDFBCreateImageProvider*) args_alloc( args_static, sizeof(CoreDFBCreateImageProvider) );
    CoreDFBCreateImageProviderReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreDFBCreateImageProviderReturn*) args_alloc( return_args_static, sizeof(CoreDFBCreateImageProviderReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreDFB, "ICore_Requestor::%s()\n", __FUNCTION__ );


    args->buffer_call = buffer_call;

    ret = (DFBResult) CoreDFB_Call( obj, FCEF_NONE, CoreDFB_CreateImageProvider, args, sizeof(CoreDFBCreateImageProvider), return_args, sizeof(CoreDFBCreateImageProviderReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreDFB_Call( CoreDFB_CreateImageProvider ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreDFB_CreateImageProvider failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }

    *ret_call = return_args->call;


out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
DFBResult
IImageProvider_Requestor::GetImageDescription(
                    DFBImageDescription                       *ret_description
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    ImageProviderGetImageDescription       *args = (ImageProviderGetImageDescription*) args_alloc( args_static, sizeof(ImageProviderGetImageDescription) );
    ImageProviderGetImageDescriptionReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (ImageProviderGetImageDescriptionReturn*) args_alloc( return_args_static, sizeof(ImageProviderGetImageDescriptionReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_ImageProvider, "IImageProvider_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( ret_description != NULL );


    ret = (DFBResult) ImageProvider_Call( obj, FCEF_NONE, ImageProvider_GetImageDescription, args, sizeof(ImageProviderGetImageDescription), return_args, sizeof(ImageProviderGetImageDescriptionReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: ImageProvider_Call( ImageProvider_GetImageDescription ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: ImageProvider_GetImageDescription failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }

    *ret_description = return_args->description;


out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #14
0
DFBResult
IInputDevice_Requestor::SetConfiguration(
                    const DFBInputDeviceConfig                *config
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreInputDeviceSetConfiguration       *args = (CoreInputDeviceSetConfiguration*) args_alloc( args_static, sizeof(CoreInputDeviceSetConfiguration) );
    CoreInputDeviceSetConfigurationReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreInputDeviceSetConfigurationReturn*) args_alloc( return_args_static, sizeof(CoreInputDeviceSetConfigurationReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreInputDevice, "IInputDevice_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( config != NULL );

    args->config = *config;

    ret = (DFBResult) CoreInputDevice_Call( obj, FCEF_NONE, CoreInputDevice_SetConfiguration, args, sizeof(CoreInputDeviceSetConfiguration), return_args, sizeof(CoreInputDeviceSetConfigurationReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreInputDevice_Call( CoreInputDevice_SetConfiguration ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreInputDevice_SetConfiguration failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #15
0
DFBResult
ILayer_Requestor::ActivateContext(
                    CoreLayerContext                          *context
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreLayerActivateContext       *args = (CoreLayerActivateContext*) args_alloc( args_static, sizeof(CoreLayerActivateContext) );
    CoreLayerActivateContextReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreLayerActivateContextReturn*) args_alloc( return_args_static, sizeof(CoreLayerActivateContextReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreLayer, "ILayer_Requestor::%s()\n", __FUNCTION__ );

    D_ASSERT( context != NULL );

    args->context_id = CoreLayerContext_GetID( context );

    ret = (DFBResult) CoreLayer_Call( obj, FCEF_NONE, CoreLayer_ActivateContext, args, sizeof(CoreLayerActivateContext), return_args, sizeof(CoreLayerActivateContextReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreLayer_Call( CoreLayer_ActivateContext ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreLayer_ActivateContext failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #16
0
DFBResult
ICore_Requestor::ClipboardGetTimestamp(
                    u64                                       *ret_timestamp_us
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreDFBClipboardGetTimestamp       *args = (CoreDFBClipboardGetTimestamp*) args_alloc( args_static, sizeof(CoreDFBClipboardGetTimestamp) );
    CoreDFBClipboardGetTimestampReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreDFBClipboardGetTimestampReturn*) args_alloc( return_args_static, sizeof(CoreDFBClipboardGetTimestampReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreDFB, "ICore_Requestor::%s()\n", __FUNCTION__ );



    ret = (DFBResult) CoreDFB_Call( obj, FCEF_NONE, CoreDFB_ClipboardGetTimestamp, args, sizeof(CoreDFBClipboardGetTimestamp), return_args, sizeof(CoreDFBClipboardGetTimestampReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreDFB_Call( CoreDFB_ClipboardGetTimestamp ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreDFB_ClipboardGetTimestamp failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }

    *ret_timestamp_us = return_args->timestamp_us;


out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #17
0
DFBResult
ILayer_Requestor::SetLevel(
                    s32                                        level
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreLayerSetLevel       *args = (CoreLayerSetLevel*) args_alloc( args_static, sizeof(CoreLayerSetLevel) );
    CoreLayerSetLevelReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreLayerSetLevelReturn*) args_alloc( return_args_static, sizeof(CoreLayerSetLevelReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreLayer, "ILayer_Requestor::%s()\n", __FUNCTION__ );


    args->level = level;

    ret = (DFBResult) CoreLayer_Call( obj, FCEF_NONE, CoreLayer_SetLevel, args, sizeof(CoreLayerSetLevel), return_args, sizeof(CoreLayerSetLevelReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreLayer_Call( CoreLayer_SetLevel ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreLayer_SetLevel failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #18
0
DFBResult
ILayer_Requestor::GetCurrentOutputField(
                    s32                                       *ret_field
)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreLayerGetCurrentOutputField       *args = (CoreLayerGetCurrentOutputField*) args_alloc( args_static, sizeof(CoreLayerGetCurrentOutputField) );
    CoreLayerGetCurrentOutputFieldReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreLayerGetCurrentOutputFieldReturn*) args_alloc( return_args_static, sizeof(CoreLayerGetCurrentOutputFieldReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreLayer, "ILayer_Requestor::%s()\n", __FUNCTION__ );



    ret = (DFBResult) CoreLayer_Call( obj, FCEF_NONE, CoreLayer_GetCurrentOutputField, args, sizeof(CoreLayerGetCurrentOutputField), return_args, sizeof(CoreLayerGetCurrentOutputFieldReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreLayer_Call( CoreLayer_GetCurrentOutputField ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreLayer_GetCurrentOutputField failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }

    *ret_field = return_args->field;


out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #19
0
static void delete_native_rule( void * xrule, void * data )
{
    native_rule_t * rule = (native_rule_t *)xrule;
    if ( rule->arguments )
        args_free( rule->arguments );
    object_free( rule->name );
    if ( rule->procedure )
        function_free( rule->procedure );
}
DFBResult
IImageProvider_Requestor::Dispose(

)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    ImageProviderDispose       *args = (ImageProviderDispose*) args_alloc( args_static, sizeof(ImageProviderDispose) );
    ImageProviderDisposeReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (ImageProviderDisposeReturn*) args_alloc( return_args_static, sizeof(ImageProviderDisposeReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_ImageProvider, "IImageProvider_Requestor::%s()\n", __FUNCTION__ );



    ret = (DFBResult) ImageProvider_Call( obj, FCEF_NONE, ImageProvider_Dispose, args, sizeof(ImageProviderDispose), return_args, sizeof(ImageProviderDisposeReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: ImageProvider_Call( ImageProvider_Dispose ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: ImageProvider_Dispose failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #21
0
DFBResult
ICore_Requestor::WaitIdle(

)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreDFBWaitIdle       *args = (CoreDFBWaitIdle*) args_alloc( args_static, sizeof(CoreDFBWaitIdle) );
    CoreDFBWaitIdleReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreDFBWaitIdleReturn*) args_alloc( return_args_static, sizeof(CoreDFBWaitIdleReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreDFB, "ICore_Requestor::%s()\n", __FUNCTION__ );



    ret = (DFBResult) CoreDFB_Call( obj, FCEF_NONE, CoreDFB_WaitIdle, args, sizeof(CoreDFBWaitIdle), return_args, sizeof(CoreDFBWaitIdleReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreDFB_Call( CoreDFB_WaitIdle ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreDFB_WaitIdle failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #22
0
DFBResult
IInputDevice_Requestor::ReloadKeymap(

)
{
    DFBResult           ret = DFB_OK;
    char        args_static[FLUXED_ARGS_BYTES];
    char        return_args_static[FLUXED_ARGS_BYTES];
    CoreInputDeviceReloadKeymap       *args = (CoreInputDeviceReloadKeymap*) args_alloc( args_static, sizeof(CoreInputDeviceReloadKeymap) );
    CoreInputDeviceReloadKeymapReturn *return_args;

    if (!args)
        return (DFBResult) D_OOM();

    return_args = (CoreInputDeviceReloadKeymapReturn*) args_alloc( return_args_static, sizeof(CoreInputDeviceReloadKeymapReturn) );

    if (!return_args) {
        args_free( args_static, args );
        return (DFBResult) D_OOM();
    }

    D_DEBUG_AT( DirectFB_CoreInputDevice, "IInputDevice_Requestor::%s()\n", __FUNCTION__ );



    ret = (DFBResult) CoreInputDevice_Call( obj, FCEF_NONE, CoreInputDevice_ReloadKeymap, args, sizeof(CoreInputDeviceReloadKeymap), return_args, sizeof(CoreInputDeviceReloadKeymapReturn), NULL );
    if (ret) {
        D_DERROR( ret, "%s: CoreInputDevice_Call( CoreInputDevice_ReloadKeymap ) failed!\n", __FUNCTION__ );
        goto out;
    }

    if (return_args->result) {
        /*D_DERROR( return_args->result, "%s: CoreInputDevice_ReloadKeymap failed!\n", __FUNCTION__ );*/
        ret = return_args->result;
        goto out;
    }



out:
    args_free( return_args_static, return_args );
    args_free( args_static, args );
    return ret;
}
Example #23
0
int		main(int argc, char **argv)
{
  t_application	app;
  t_args	args;

  (void)argc;
  if (!args_init(&args, argv + 1))
    {
      if (!application_init(&app, &args))
	{
	  args_free(&args);
	  application_run(&app);
	}
      else
	args_free(&args);
      application_free(&app);
    }
  return (0);
}
Example #24
0
static void in_pop(void)
{
	struct inbuf *old = buf;
	buf = buf->prev;
	if (old->args)
		args_free(old->args);
	if (old->fin && old->fin != stdin)
		fclose(old->fin);
	free(old->buf);
	free(old);
}
Example #25
0
static enum cmd_retval
cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
{
	struct args		*args = self->args, *new_args;
	struct window_pane	*wp = item->target.wp;
	const char		*s = args->argv[0];
	char			*filter, *argv = { NULL };
	int			 C, N, T;

	C = args_has(args, 'C');
	N = args_has(args, 'N');
	T = args_has(args, 'T');

	if (!C && !N && !T)
		C = N = T = 1;

	if (C && N && T) {
		xasprintf(&filter,
		    "#{||:"
		    "#{C:%s},#{||:#{m:*%s*,#{window_name}},"
		    "#{m:*%s*,#{pane_title}}}}",
		    s, s, s);
	} else if (C && N) {
		xasprintf(&filter,
		    "#{||:#{C:%s},#{m:*%s*,#{window_name}}}",
		    s, s);
	} else if (C && T) {
		xasprintf(&filter,
		    "#{||:#{C:%s},#{m:*%s*,#{pane_title}}}",
		    s, s);
	} else if (N && T) {
		xasprintf(&filter,
		    "#{||:#{m:*%s*,#{window_name}},#{m:*%s*,#{pane_title}}}",
		    s, s);
	} else if (C)
		xasprintf(&filter, "#{C:%s}", s);
	else if (N)
		xasprintf(&filter, "#{m:*%s*,#{window_name}}", s);
	else
		xasprintf(&filter, "#{m:*%s*,#{pane_title}}", s);

	new_args = args_parse("", 1, &argv);
	args_set(new_args, 'f', filter);

	window_pane_set_mode(wp, &window_tree_mode, &item->target, new_args);

	args_free(new_args);
	free(filter);

	return (CMD_RETURN_NORMAL);
}
Example #26
0
/*
 * set_rule_body() - set the argument list and procedure of the given rule
 */
static void set_rule_body( RULE* rule, argument_list* args, PARSE* procedure )
{
    if ( args )
        args_refer( args );
    if ( rule->arguments )
        args_free( rule->arguments );
    rule->arguments = args;
    
    if ( procedure )
        parse_refer( procedure );
    if ( rule->procedure )
        parse_free( rule->procedure );
    rule->procedure = procedure;
}
Example #27
0
void
rule_free( RULE* r )
{
    freestr( r->name );
    r->name = "";
    parse_free( r->procedure );
    r->procedure = 0;
	if ( r->arguments )
	    args_free( r->arguments );
    r->arguments = 0;
    if ( r->actions )
		actions_free( r->actions );
    r->actions = 0;
}
Example #28
0
static void set_rule_body( RULE * rule, argument_list * args, FUNCTION * procedure )
{
    if ( args )
        args_refer( args );
    if ( rule->arguments )
        args_free( rule->arguments );
    rule->arguments = args;

    if ( procedure )
        function_refer( procedure );
    if ( rule->procedure )
        function_free( rule->procedure );
    rule->procedure = procedure;
}
Example #29
0
/* Handles arguments received from remote instance. */
static void
parse_received_arguments(char *argv[])
{
	int argc = 0;
	args_t args = {};

	while(argv[argc] != NULL)
	{
		argc++;
	}

	(void)vifm_chdir(argv[0]);
	opterr = 0;
	args_parse(&args, argc, argv, argv[0]);
	args_process(&args, 0);

	exec_startup_commands(&args);
	args_free(&args);

	if(NONE(vle_mode_is, NORMAL_MODE, VIEW_MODE))
	{
		return;
	}

#ifdef _WIN32
	SwitchToThisWindow(GetConsoleWindow(), TRUE);
	BringWindowToTop(GetConsoleWindow());
	SetForegroundWindow(GetConsoleWindow());
#endif

	if(view_needs_cd(&lwin, args.lwin_path))
	{
		remote_cd(&lwin, args.lwin_path, args.lwin_handle);
	}

	if(view_needs_cd(&rwin, args.rwin_path))
	{
		remote_cd(&rwin, args.rwin_path, args.rwin_handle);
	}

	if(need_to_switch_active_pane(args.lwin_path, args.rwin_path))
	{
		change_window();
	}

	ui_sb_clear();
	curr_stats.save_msg = 0;
}
int
main(int argc, char *argv[])
{
    char *program_name, *compiler_name, *other_wrappers, *sysroot;
    struct args *compiler_args, *cmd;

    compiler_args = args_init(argc, argv);

    /* check if we were called directly. */
    program_name = basename(compiler_args->argv[0]);
    args_remove_first(compiler_args);
    if (str_eq(program_name, MYNAME)) {
        /* the first argument should be a compiler */
        if (compiler_args->argc < 1 || compiler_args->argv[0][0] == '-') {
            fprintf(stderr, "%s", USAGE_TEXT);
            exit(1);
        }

        compiler_name = x_strdup(compiler_args->argv[0]);
        args_remove_first(compiler_args);
    } else {
        compiler_name = x_strdup(program_name);
    }
    free(program_name);

    other_wrappers = getenv(MYNAME "_OTHER_WRAPPERS");
    if (!other_wrappers) {
        other_wrappers = "ccache distcc";
    }

    cmd = find_all_executables(compiler_name, MYNAME, other_wrappers);
    if (!cmd) {
        fatal("No valid executables named %s found!", compiler_name);
    }
    free(compiler_name);

    sysroot = getenv("SYSROOT");
    if (sysroot) {
        args_add(cmd, "--sysroot");
        args_add(cmd, sysroot);
    }

    args_extend(cmd, compiler_args);
    args_free(compiler_args);

    execute(cmd->argv);
    return 1;
}