本文整理汇总了C++中EVENT函数的典型用法代码示例。如果您正苦于以下问题:C++ EVENT函数的具体用法?C++ EVENT怎么用?C++ EVENT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EVENT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: apply_deltas
/** Applies delta files to create an upgraded package file.
*
* All intermediate files are deleted, leaving only the starting and
* ending package files.
*
* @param handle the context handle
*
* @return 0 if all delta files were able to be applied, 1 otherwise.
*/
static int apply_deltas(alpm_handle_t *handle)
{
alpm_list_t *i;
int ret = 0;
const char *cachedir = _alpm_filecache_setup(handle);
alpm_trans_t *trans = handle->trans;
for(i = trans->add; i; i = i->next) {
alpm_pkg_t *spkg = i->data;
alpm_list_t *delta_path = spkg->delta_path;
alpm_list_t *dlts = NULL;
if(!delta_path) {
continue;
}
for(dlts = delta_path; dlts; dlts = dlts->next) {
alpm_delta_t *d = dlts->data;
char *delta, *from, *to;
char command[PATH_MAX];
size_t len = 0;
delta = _alpm_filecache_find(handle, d->delta);
/* the initial package might be in a different cachedir */
if(dlts == delta_path) {
from = _alpm_filecache_find(handle, d->from);
} else {
/* len = cachedir len + from len + '/' + null */
len = strlen(cachedir) + strlen(d->from) + 2;
CALLOC(from, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, 1));
snprintf(from, len, "%s/%s", cachedir, d->from);
}
len = strlen(cachedir) + strlen(d->to) + 2;
CALLOC(to, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, 1));
snprintf(to, len, "%s/%s", cachedir, d->to);
/* build the patch command */
if(endswith(to, ".gz")) {
/* special handling for gzip : we disable timestamp with -n option */
snprintf(command, PATH_MAX, "xdelta3 -d -q -R -c -s %s %s | gzip -n > %s", from, delta, to);
} else {
snprintf(command, PATH_MAX, "xdelta3 -d -q -s %s %s %s", from, delta, to);
}
_alpm_log(handle, ALPM_LOG_DEBUG, "command: %s\n", command);
EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCH_START, d->to, d->delta);
int retval = system(command);
if(retval == 0) {
EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCH_DONE, NULL, NULL);
/* delete the delta file */
unlink(delta);
/* Delete the 'from' package but only if it is an intermediate
* package. The starting 'from' package should be kept, just
* as if deltas were not used. */
if(dlts != delta_path) {
unlink(from);
}
}
FREE(from);
FREE(to);
FREE(delta);
if(retval != 0) {
/* one delta failed for this package, cancel the remaining ones */
EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCH_FAILED, NULL, NULL);
handle->pm_errno = ALPM_ERR_DLT_PATCHFAILED;
ret = 1;
break;
}
}
}
return ret;
}
开发者ID:matthewbauer,项目名称:unipkg-pacman,代码行数:87,代码来源:sync.c
示例2: alpm_trans_commit
/** Commit a transaction. */
int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
{
alpm_trans_t *trans;
alpm_event_any_t event;
/* Sanity checks */
CHECK_HANDLE(handle, return -1);
trans = handle->trans;
ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_PREPARED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_PREPARED, -1));
ASSERT(!(trans->flags & ALPM_TRANS_FLAG_NOLOCK), RET_ERR(handle, ALPM_ERR_TRANS_NOT_LOCKED, -1));
/* If there's nothing to do, return without complaining */
if(trans->add == NULL && trans->remove == NULL) {
return 0;
}
if(trans->add) {
if(_alpm_sync_load(handle, data) != 0) {
/* pm_errno is set by _alpm_sync_load() */
return -1;
}
if(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY) {
return 0;
}
if(_alpm_sync_check(handle, data) != 0) {
/* pm_errno is set by _alpm_sync_check() */
return -1;
}
}
if(_alpm_hook_run(handle, ALPM_HOOK_PRE_TRANSACTION) != 0) {
RET_ERR(handle, ALPM_ERR_TRANS_HOOK_FAILED, -1);
}
trans->state = STATE_COMMITING;
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction started\n");
event.type = ALPM_EVENT_TRANSACTION_START;
EVENT(handle, (void *)&event);
if(trans->add == NULL) {
if(_alpm_remove_packages(handle, 1) == -1) {
/* pm_errno is set by _alpm_remove_packages() */
alpm_errno_t save = handle->pm_errno;
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
handle->pm_errno = save;
return -1;
}
} else {
if(_alpm_sync_commit(handle) == -1) {
/* pm_errno is set by _alpm_sync_commit() */
alpm_errno_t save = handle->pm_errno;
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
handle->pm_errno = save;
return -1;
}
}
if(trans->state == STATE_INTERRUPTED) {
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction interrupted\n");
} else {
event.type = ALPM_EVENT_TRANSACTION_DONE;
EVENT(handle, (void *)&event);
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction completed\n");
_alpm_hook_run(handle, ALPM_HOOK_POST_TRANSACTION);
}
trans->state = STATE_COMMITED;
return 0;
}
开发者ID:andrewgregory,项目名称:pacman,代码行数:76,代码来源:trans.c
示例3: _alpm_sync_prepare
int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
{
alpm_list_t *i, *j;
alpm_list_t *deps = NULL;
alpm_list_t *unresolvable = NULL;
int from_sync = 0;
int ret = 0;
alpm_trans_t *trans = handle->trans;
alpm_event_t event;
if(data) {
*data = NULL;
}
for(i = trans->add; i; i = i->next) {
alpm_pkg_t *spkg = i->data;
if (spkg->origin == ALPM_PKG_FROM_SYNCDB){
from_sync = 1;
break;
}
}
/* ensure all sync database are valid if we will be using them */
for(i = handle->dbs_sync; i; i = i->next) {
const alpm_db_t *db = i->data;
if(db->status & DB_STATUS_INVALID) {
RET_ERR(handle, ALPM_ERR_DB_INVALID, -1);
}
/* missing databases are not allowed if we have sync targets */
if(from_sync && db->status & DB_STATUS_MISSING) {
RET_ERR(handle, ALPM_ERR_DB_NOT_FOUND, -1);
}
}
if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {
alpm_list_t *resolved = NULL;
alpm_list_t *remove = alpm_list_copy(trans->remove);
alpm_list_t *localpkgs;
/* Build up list by repeatedly resolving each transaction package */
/* Resolve targets dependencies */
event.type = ALPM_EVENT_RESOLVEDEPS_START;
EVENT(handle, &event);
_alpm_log(handle, ALPM_LOG_DEBUG, "resolving target's dependencies\n");
/* build remove list for resolvedeps */
for(i = trans->add; i; i = i->next) {
alpm_pkg_t *spkg = i->data;
for(j = spkg->removes; j; j = j->next) {
remove = alpm_list_add(remove, j->data);
}
}
/* Compute the fake local database for resolvedeps (partial fix for the
* phonon/qt issue) */
localpkgs = alpm_list_diff(_alpm_db_get_pkgcache(handle->db_local),
trans->add, _alpm_pkg_cmp);
/* Resolve packages in the transaction one at a time, in addition
building up a list of packages which could not be resolved. */
for(i = trans->add; i; i = i->next) {
alpm_pkg_t *pkg = i->data;
if(_alpm_resolvedeps(handle, localpkgs, pkg, trans->add,
&resolved, remove, data) == -1) {
unresolvable = alpm_list_add(unresolvable, pkg);
}
/* Else, [resolved] now additionally contains [pkg] and all of its
dependencies not already on the list */
}
alpm_list_free(localpkgs);
alpm_list_free(remove);
/* If there were unresolvable top-level packages, prompt the user to
see if they'd like to ignore them rather than failing the sync */
if(unresolvable != NULL) {
alpm_question_remove_pkgs_t question = {
.type = ALPM_QUESTION_REMOVE_PKGS,
.skip = 0,
.packages = unresolvable
};
QUESTION(handle, &question);
if(question.skip) {
/* User wants to remove the unresolvable packages from the
transaction. The packages will be removed from the actual
transaction when the transaction packages are replaced with a
dependency-reordered list below */
handle->pm_errno = 0;
if(data) {
alpm_list_free_inner(*data,
(alpm_list_fn_free)alpm_depmissing_free);
alpm_list_free(*data);
*data = NULL;
}
} else {
/* pm_errno was set by resolvedeps, callback may have overwrote it */
handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS;
alpm_list_free(resolved);
alpm_list_free(unresolvable);
ret = -1;
goto cleanup;
//.........这里部分代码省略.........
开发者ID:danilogr,项目名称:MSYS2-pacman,代码行数:101,代码来源:sync.c
示例4: BindTexImage
// EGL 1.1
EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer);
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = static_cast<Surface*>(surface);
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
if (buffer != EGL_BACK_BUFFER)
{
SetGlobalError(Error(EGL_BAD_PARAMETER));
return EGL_FALSE;
}
if (surface == EGL_NO_SURFACE || eglSurface->getType() == EGL_WINDOW_BIT)
{
SetGlobalError(Error(EGL_BAD_SURFACE));
return EGL_FALSE;
}
if (eglSurface->getBoundTexture())
{
SetGlobalError(Error(EGL_BAD_ACCESS));
return EGL_FALSE;
}
if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
{
SetGlobalError(Error(EGL_BAD_MATCH));
return EGL_FALSE;
}
gl::Context *context = GetGlobalContext();
if (context)
{
gl::Texture *textureObject = context->getTargetTexture(GL_TEXTURE_2D);
ASSERT(textureObject != NULL);
if (textureObject->getImmutableFormat())
{
SetGlobalError(Error(EGL_BAD_MATCH));
return EGL_FALSE;
}
error = eglSurface->bindTexImage(textureObject, buffer);
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
}
SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
开发者ID:MoonchildProductions,项目名称:Pale-Moon,代码行数:62,代码来源:entry_points_egl.cpp
示例5: asylum_load
static int asylum_load(struct module_data *m, HIO_HANDLE *f, const int start)
{
struct xmp_module *mod = &m->mod;
struct xmp_event *event;
int i, j;
LOAD_INIT();
hio_seek(f, 32, SEEK_CUR); /* skip magic */
mod->spd = hio_read8(f); /* initial speed */
mod->bpm = hio_read8(f); /* initial BPM */
mod->ins = hio_read8(f); /* number of instruments */
mod->pat = hio_read8(f); /* number of patterns */
mod->len = hio_read8(f); /* module length */
hio_read8(f);
hio_read(mod->xxo, 1, mod->len, f); /* read orders */
hio_seek(f, start + 294, SEEK_SET);
mod->chn = 8;
mod->smp = mod->ins;
mod->trk = mod->pat * mod->chn;
snprintf(mod->type, XMP_NAME_SIZE, "Asylum Music Format v1.0");
MODULE_INFO();
if (instrument_init(mod) < 0)
return -1;
/* Read and convert instruments and samples */
for (i = 0; i < mod->ins; i++) {
uint8 insbuf[37];
if (subinstrument_alloc(mod, i, 1) < 0)
return -1;
hio_read(insbuf, 1, 37, f);
instrument_name(mod, i, insbuf, 22);
mod->xxi[i].sub[0].fin = (int8)(insbuf[22] << 4);
mod->xxi[i].sub[0].vol = insbuf[23];
mod->xxi[i].sub[0].xpo = (int8)insbuf[24];
mod->xxi[i].sub[0].pan = 0x80;
mod->xxi[i].sub[0].sid = i;
mod->xxs[i].len = readmem32l(insbuf + 25);
mod->xxs[i].lps = readmem32l(insbuf + 29);
mod->xxs[i].lpe = mod->xxs[i].lps + readmem32l(insbuf + 33);
mod->xxs[i].flg = mod->xxs[i].lpe > 2 ? XMP_SAMPLE_LOOP : 0;
D_(D_INFO "[%2X] %-22.22s %04x %04x %04x %c V%02x %d", i,
mod->xxi[i].name, mod->xxs[i].len, mod->xxs[i].lps,
mod->xxs[i].lpe,
mod->xxs[i].flg & XMP_SAMPLE_LOOP ? 'L' : ' ',
mod->xxi[i].sub[0].vol, mod->xxi[i].sub[0].fin);
}
hio_seek(f, 37 * (64 - mod->ins), SEEK_CUR);
D_(D_INFO "Module length: %d", mod->len);
if (pattern_init(mod) < 0)
return -1;
/* Read and convert patterns */
D_(D_INFO "Stored patterns: %d", mod->pat);
for (i = 0; i < mod->pat; i++) {
if (pattern_tracks_alloc(mod, i, 64) < 0)
return -1;
for (j = 0; j < 64 * mod->chn; j++) {
uint8 note;
event = &EVENT(i, j % mod->chn, j / mod->chn);
memset(event, 0, sizeof(struct xmp_event));
note = hio_read8(f);
if (note != 0) {
event->note = note + 13;
}
event->ins = hio_read8(f);
event->fxt = hio_read8(f);
event->fxp = hio_read8(f);
}
}
/* Read samples */
D_(D_INFO "Stored samples: %d", mod->smp);
for (i = 0; i < mod->ins; i++) {
if (mod->xxs[i].len > 1) {
if (load_sample(m, f, 0, &mod->xxs[i], NULL) < 0)
return -1;
mod->xxi[i].nsm = 1;
}
}
//.........这里部分代码省略.........
开发者ID:GCrean,项目名称:libxmp,代码行数:101,代码来源:asylum_load.c
示例6: GetProcAddress
__eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname)
{
EVENT("(const char *procname = \"%s\")", procname);
typedef std::map<std::string, __eglMustCastToProperFunctionPointerType> ProcAddressMap;
auto generateProcAddressMap = []()
{
ProcAddressMap map;
#define INSERT_PROC_ADDRESS(ns, proc) \
map[#ns #proc] = reinterpret_cast<__eglMustCastToProperFunctionPointerType>(ns::proc)
// GLES2 core
INSERT_PROC_ADDRESS(gl, ActiveTexture);
INSERT_PROC_ADDRESS(gl, AttachShader);
INSERT_PROC_ADDRESS(gl, BindAttribLocation);
INSERT_PROC_ADDRESS(gl, BindBuffer);
INSERT_PROC_ADDRESS(gl, BindFramebuffer);
INSERT_PROC_ADDRESS(gl, BindRenderbuffer);
INSERT_PROC_ADDRESS(gl, BindTexture);
INSERT_PROC_ADDRESS(gl, BlendColor);
INSERT_PROC_ADDRESS(gl, BlendEquation);
INSERT_PROC_ADDRESS(gl, BlendEquationSeparate);
INSERT_PROC_ADDRESS(gl, BlendFunc);
INSERT_PROC_ADDRESS(gl, BlendFuncSeparate);
INSERT_PROC_ADDRESS(gl, BufferData);
INSERT_PROC_ADDRESS(gl, BufferSubData);
INSERT_PROC_ADDRESS(gl, CheckFramebufferStatus);
INSERT_PROC_ADDRESS(gl, Clear);
INSERT_PROC_ADDRESS(gl, ClearColor);
INSERT_PROC_ADDRESS(gl, ClearDepthf);
INSERT_PROC_ADDRESS(gl, ClearStencil);
INSERT_PROC_ADDRESS(gl, ColorMask);
INSERT_PROC_ADDRESS(gl, CompileShader);
INSERT_PROC_ADDRESS(gl, CompressedTexImage2D);
INSERT_PROC_ADDRESS(gl, CompressedTexSubImage2D);
INSERT_PROC_ADDRESS(gl, CopyTexImage2D);
INSERT_PROC_ADDRESS(gl, CopyTexSubImage2D);
INSERT_PROC_ADDRESS(gl, CreateProgram);
INSERT_PROC_ADDRESS(gl, CreateShader);
INSERT_PROC_ADDRESS(gl, CullFace);
INSERT_PROC_ADDRESS(gl, DeleteBuffers);
INSERT_PROC_ADDRESS(gl, DeleteFramebuffers);
INSERT_PROC_ADDRESS(gl, DeleteProgram);
INSERT_PROC_ADDRESS(gl, DeleteRenderbuffers);
INSERT_PROC_ADDRESS(gl, DeleteShader);
INSERT_PROC_ADDRESS(gl, DeleteTextures);
INSERT_PROC_ADDRESS(gl, DepthFunc);
INSERT_PROC_ADDRESS(gl, DepthMask);
INSERT_PROC_ADDRESS(gl, DepthRangef);
INSERT_PROC_ADDRESS(gl, DetachShader);
INSERT_PROC_ADDRESS(gl, Disable);
INSERT_PROC_ADDRESS(gl, DisableVertexAttribArray);
INSERT_PROC_ADDRESS(gl, DrawArrays);
INSERT_PROC_ADDRESS(gl, DrawElements);
INSERT_PROC_ADDRESS(gl, Enable);
INSERT_PROC_ADDRESS(gl, EnableVertexAttribArray);
INSERT_PROC_ADDRESS(gl, Finish);
INSERT_PROC_ADDRESS(gl, Flush);
INSERT_PROC_ADDRESS(gl, FramebufferRenderbuffer);
INSERT_PROC_ADDRESS(gl, FramebufferTexture2D);
INSERT_PROC_ADDRESS(gl, FrontFace);
INSERT_PROC_ADDRESS(gl, GenBuffers);
INSERT_PROC_ADDRESS(gl, GenerateMipmap);
INSERT_PROC_ADDRESS(gl, GenFramebuffers);
INSERT_PROC_ADDRESS(gl, GenRenderbuffers);
INSERT_PROC_ADDRESS(gl, GenTextures);
INSERT_PROC_ADDRESS(gl, GetActiveAttrib);
INSERT_PROC_ADDRESS(gl, GetActiveUniform);
INSERT_PROC_ADDRESS(gl, GetAttachedShaders);
INSERT_PROC_ADDRESS(gl, GetAttribLocation);
INSERT_PROC_ADDRESS(gl, GetBooleanv);
INSERT_PROC_ADDRESS(gl, GetBufferParameteriv);
INSERT_PROC_ADDRESS(gl, GetError);
INSERT_PROC_ADDRESS(gl, GetFloatv);
INSERT_PROC_ADDRESS(gl, GetFramebufferAttachmentParameteriv);
INSERT_PROC_ADDRESS(gl, GetIntegerv);
INSERT_PROC_ADDRESS(gl, GetProgramiv);
INSERT_PROC_ADDRESS(gl, GetProgramInfoLog);
INSERT_PROC_ADDRESS(gl, GetRenderbufferParameteriv);
INSERT_PROC_ADDRESS(gl, GetShaderiv);
INSERT_PROC_ADDRESS(gl, GetShaderInfoLog);
INSERT_PROC_ADDRESS(gl, GetShaderPrecisionFormat);
INSERT_PROC_ADDRESS(gl, GetShaderSource);
INSERT_PROC_ADDRESS(gl, GetString);
INSERT_PROC_ADDRESS(gl, GetTexParameterfv);
INSERT_PROC_ADDRESS(gl, GetTexParameteriv);
INSERT_PROC_ADDRESS(gl, GetUniformfv);
INSERT_PROC_ADDRESS(gl, GetUniformiv);
INSERT_PROC_ADDRESS(gl, GetUniformLocation);
INSERT_PROC_ADDRESS(gl, GetVertexAttribfv);
INSERT_PROC_ADDRESS(gl, GetVertexAttribiv);
INSERT_PROC_ADDRESS(gl, GetVertexAttribPointerv);
INSERT_PROC_ADDRESS(gl, Hint);
INSERT_PROC_ADDRESS(gl, IsBuffer);
INSERT_PROC_ADDRESS(gl, IsEnabled);
INSERT_PROC_ADDRESS(gl, IsFramebuffer);
INSERT_PROC_ADDRESS(gl, IsProgram);
INSERT_PROC_ADDRESS(gl, IsRenderbuffer);
INSERT_PROC_ADDRESS(gl, IsShader);
INSERT_PROC_ADDRESS(gl, IsTexture);
//.........这里部分代码省略.........
开发者ID:MoonchildProductions,项目名称:Pale-Moon,代码行数:101,代码来源:entry_points_egl.cpp
示例7: GetDisplay
EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id)
{
EVENT("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id);
return Display::getDisplay(display_id, AttributeMap());
}
开发者ID:MoonchildProductions,项目名称:Pale-Moon,代码行数:6,代码来源:entry_points_egl.cpp
示例8: rtm_load
//.........这里部分代码省略.........
if (read_object_header(f, &oh, "RTND") < 0) {
D_(D_CRIT "Error reading pattern %d", i);
return -1;
}
rp.flags = hio_read16l(f);
rp.ntrack = hio_read8(f);
rp.nrows = hio_read16l(f);
rp.datasize = hio_read32l(f);
/* Sanity check */
if (rp.ntrack > rh.ntrack || rp.nrows > 256) {
return -1;
}
offset += 42 + oh.headerSize + rp.datasize;
if (libxmp_alloc_pattern_tracks(mod, i, rp.nrows) < 0)
return -1;
for (r = 0; r < rp.nrows; r++) {
for (j = 0; /*j < rp.ntrack */; j++) {
c = hio_read8(f);
if (c == 0) /* next row */
break;
/* Sanity check */
if (j >= rp.ntrack) {
return -1;
}
event = &EVENT(i, j, r);
if (c & 0x01) { /* set track */
j = hio_read8(f);
/* Sanity check */
if (j >= rp.ntrack) {
return -1;
}
event = &EVENT(i, j, r);
}
if (c & 0x02) { /* read note */
event->note = hio_read8(f) + 1;
if (event->note == 0xff) {
event->note = XMP_KEY_OFF;
} else {
event->note += 12;
}
}
if (c & 0x04) /* read instrument */
event->ins = hio_read8(f);
if (c & 0x08) /* read effect */
event->fxt = hio_read8(f);
if (c & 0x10) /* read parameter */
event->fxp = hio_read8(f);
if (c & 0x20) /* read effect 2 */
event->f2t = hio_read8(f);
if (c & 0x40) /* read parameter 2 */
event->f2p = hio_read8(f);
}
}
}
开发者ID:wothke,项目名称:libxmp-4.3.0,代码行数:67,代码来源:rtm_load.c
示例9: eglCreateWindowSurface
EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, "
"const EGLint *attrib_list = 0x%0.8p)", dpy, config, win, attrib_list);
try
{
egl::Display *display = static_cast<egl::Display*>(dpy);
if (!validate(display, config))
{
return EGL_NO_SURFACE;
}
HWND window = (HWND)win;
if (!IsWindow(window))
{
return error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
}
if (attrib_list)
{
while (*attrib_list != EGL_NONE)
{
switch (attrib_list[0])
{
case EGL_RENDER_BUFFER:
switch (attrib_list[1])
{
case EGL_BACK_BUFFER:
break;
case EGL_SINGLE_BUFFER:
return error(EGL_BAD_MATCH, EGL_NO_SURFACE); // Rendering directly to front buffer not supported
default:
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
break;
case EGL_VG_COLORSPACE:
return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
case EGL_VG_ALPHA_FORMAT:
return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
default:
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
attrib_list += 2;
}
}
if (display->hasExistingWindowSurface(window))
{
return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
EGLSurface surface = (EGLSurface)display->createWindowSurface(window, config);
return success(surface);
}
catch(std::bad_alloc&)
{
return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
return EGL_NO_SURFACE;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:66,代码来源:libEGL.cpp
示例10: ACE_NEW_THROW_EX
CUTS_CCM_Event_T <EVENT>::CUTS_CCM_Event_T (void)
{
_ptr_type ev = 0;
ACE_NEW_THROW_EX (ev, EVENT (), ::CORBA::NO_MEMORY ());
this->event_ = ev;
}
开发者ID:SEDS,项目名称:CUTS,代码行数:6,代码来源:CCM_Events_T.cpp
示例11: mod_load
//.........这里部分代码省略.........
goto skip_test;
}
/* Test for Protracker song files
*/
else if ((ptsong = (!strncmp((char *)magic, "M.K.", 4) &&
(0x43c + mod->pat * 0x400 == m->size)))) {
tracker = "Protracker";
goto skip_test;
}
/* Test Protracker-like files
*/
if (mod->chn == 4 && mh.restart == mod->pat) {
tracker = "Soundtracker";
} else if (mod->chn == 4 && mh.restart == 0x78) {
tracker = "Noisetracker" /*" (0x78)"*/;
ptkloop = 1;
} else if (mh.restart < 0x7f) {
if (mod->chn == 4) {
tracker = "Noisetracker";
ptkloop = 1;
} else {
tracker = "unknown tracker";
ptkloop = 0;
}
mod->rst = mh.restart;
}
if (mod->chn != 4 && mh.restart == 0x7f) {
tracker = "Scream Tracker 3 MOD";
ptkloop = 0;
m->quirk &= ~QUIRK_MODRNG;
m->read_event_type = READ_EVENT_ST3;
}
if (mod->chn == 4 && mh.restart == 0x7f) {
for (i = 0; i < 31; i++) {
if (mh.ins[i].loop_size == 0)
break;
}
if (i < 31) {
tracker = "Protracker clone";
ptkloop = 0;
}
}
if (mh.restart != 0x78 && mh.restart < 0x7f) {
for (i = 0; i < 31; i++) {
if (mh.ins[i].loop_size == 0)
break;
}
if (i == 31) { /* All loops are size 2 or greater */
for (i = 0; i < 31; i++) {
if (mh.ins[i].size == 1 && mh.ins[i].volume == 0) {
tracker = "Probably converted";
ptkloop = 0;
goto skip_test;
}
}
for (i = 0; i < 31; i++) {
if (is_st_ins((char *)mh.ins[i].name))
break;
}
if (i == 31) { /* No st- instruments */
开发者ID:cmatsuoka,项目名称:chiptune.js,代码行数:67,代码来源:mod_load.c
示例12: stc_load
//.........这里部分代码省略.........
stc_pat[i].ch[0] = hio_read16l(f);
stc_pat[i].ch[1] = hio_read16l(f);
stc_pat[i].ch[2] = hio_read16l(f);
}
for (i = 0; i < mod->len; i++) { /* pattern */
int src = stc_ord[i].pattern - 1;
int dest = mod->xxo[i];
int trans = stc_ord[i].height;
if (decoded[dest])
continue;
//printf("%d/%d) Read pattern %d -> %d\n", i, mod->len, src, dest);
if (pattern_tracks_alloc(mod, dest, 64) < 0)
return -1;
for (j = 0; j < 3; j++) { /* row */
int row = 0;
int x;
int rowinc = 0;
hio_seek(f, stc_pat[src].ch[j], SEEK_SET);
do {
for (;;) {
x = hio_read8(f);
if (x == 0xff)
break;
//printf("pat %d, channel %d, row %d, x = %02x\n", dest, j, row, x);
event = &EVENT(dest, j, row);
if (x <= 0x5f) {
event->note = x + 18 + trans;
row += 1 + rowinc;
break;
}
if (x <= 0x6f) {
event->ins = x - 0x5f - 1;
} else if (x <= 0x7f) {
/* ornament*/
event->fxt = FX_SYNTH_0;
event->fxp = x - 0x70;
} else if (x == 0x80) {
event->note = XMP_KEY_OFF;
row += 1 + rowinc;
break;
} else if (x == 0x81) {
/* ? */
row += 1 + rowinc;
} else if (x == 0x82) {
/* disable ornament/envelope */
event->fxt = FX_SYNTH_0;
event->fxp = 0;
event->f2t = FX_SYNTH_2;
event->f2p = 0;
} else if (x <= 0x8e) {
/* envelope */
event->fxt = FX_SYNTH_0 +
x - 0x80; /* R13 */
event->fxp = hio_read8(f); /* R11 */
event->f2t = FX_SYNTH_1;
开发者ID:rikolous,项目名称:gideros,代码行数:67,代码来源:stc_load.c
示例13: _alpm_sync_commit
int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
{
alpm_list_t *i;
alpm_list_t *deltas = NULL;
size_t numtargs, current = 0, replaces = 0;
int errors;
alpm_trans_t *trans = handle->trans;
if(download_files(handle, &deltas)) {
alpm_list_free(deltas);
return -1;
}
if(validate_deltas(handle, deltas, data)) {
alpm_list_free(deltas);
return -1;
}
alpm_list_free(deltas);
/* Check integrity of packages */
numtargs = alpm_list_count(trans->add);
EVENT(trans, ALPM_TRANS_EVT_INTEGRITY_START, NULL, NULL);
errors = 0;
for(i = trans->add; i; i = i->next, current++) {
alpm_pkg_t *spkg = i->data;
int percent = (current * 100) / numtargs;
const char *filename;
char *filepath;
alpm_siglevel_t level;
PROGRESS(trans, ALPM_TRANS_PROGRESS_INTEGRITY_START, "", percent,
numtargs, current);
if(spkg->origin == PKG_FROM_FILE) {
continue; /* pkg_load() has been already called, this package is valid */
}
filename = alpm_pkg_get_filename(spkg);
filepath = _alpm_filecache_find(handle, filename);
alpm_db_t *sdb = alpm_pkg_get_db(spkg);
level = alpm_db_get_siglevel(sdb);
/* load the package file and replace pkgcache entry with it in the target list */
/* TODO: alpm_pkg_get_db() will not work on this target anymore */
_alpm_log(handle, ALPM_LOG_DEBUG,
"replacing pkgcache entry with package file for target %s\n",
spkg->name);
alpm_pkg_t *pkgfile =_alpm_pkg_load_internal(handle, filepath, 1, spkg->md5sum,
spkg->base64_sig, level);
if(!pkgfile) {
errors++;
*data = alpm_list_add(*data, strdup(filename));
FREE(filepath);
continue;
}
FREE(filepath);
pkgfile->reason = spkg->reason; /* copy over install reason */
i->data = pkgfile;
_alpm_pkg_free_trans(spkg); /* spkg has been removed from the target list */
}
PROGRESS(trans, ALPM_TRANS_PROGRESS_INTEGRITY_START, "", 100,
numtargs, current);
EVENT(trans, ALPM_TRANS_EVT_INTEGRITY_DONE, NULL, NULL);
if(errors) {
RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1);
}
if(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY) {
return 0;
}
trans->state = STATE_COMMITING;
replaces = alpm_list_count(trans->remove);
/* fileconflict check */
if(!(trans->flags & ALPM_TRANS_FLAG_FORCE)) {
EVENT(trans, ALPM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
_alpm_log(handle, ALPM_LOG_DEBUG, "looking for file conflicts\n");
alpm_list_t *conflict = _alpm_db_find_fileconflicts(handle,
trans->add, trans->remove);
if(conflict) {
if(data) {
*data = conflict;
} else {
alpm_list_free_inner(conflict, (alpm_list_fn_free)_alpm_fileconflict_free);
alpm_list_free(conflict);
}
RET_ERR(handle, ALPM_ERR_FILE_CONFLICTS, -1);
}
EVENT(trans, ALPM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
}
/* check available disk space */
//.........这里部分代码省略.........
开发者ID:matthewbauer,项目名称:unipkg-pacman,代码行数:101,代码来源:sync.c
示例14: download_files
static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
{
const char *cachedir;
alpm_list_t *i, *j;
alpm_list_t *files = NULL;
int errors = 0;
cachedir = _alpm_filecache_setup(handle);
handle->trans->state = STATE_DOWNLOADING;
/* Total progress - figure out the total download size if required to
* pass to the callback. This function is called once, and it is up to the
* frontend to compute incremental progress. */
if(handle->totaldlcb) {
off_t total_size = (off_t)0;
/* sum up the download size for each package and store total */
for(i = handle->trans->add; i; i = i->next) {
alpm_pkg_t *spkg = i->data;
total_size += spkg->download_size;
}
handle->totaldlcb(total_size);
}
/* group sync records by repository and download */
for(i = handle->dbs_sync; i; i = i->next) {
alpm_db_t *current = i->data;
for(j = handle->trans->add; j; j = j->next) {
alpm_pkg_t *spkg = j->data;
if(spkg->origin != PKG_FROM_FILE && current == spkg->origin_data.db) {
alpm_list_t *delta_path = spkg->delta_path;
if(delta_path) {
/* using deltas */
alpm_list_t *dlts;
for(dlts = delta_path; dlts; dlts = dlts->next) {
alpm_delta_t *delta = dlts->data;
if(delta->download_size != 0) {
struct dload_payload *dpayload;
CALLOC(dpayload, 1, sizeof(*dpayload), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
STRDUP(dpayload->filename, delta->delta, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
dpayload->max_size = delta->download_size;
files = alpm_list_add(files, dpayload);
}
/* keep a list of all the delta files for md5sums */
*deltas = alpm_list_add(*deltas, delta);
}
} else if(spkg->download_size != 0) {
struct dload_payload *payload;
ASSERT(spkg->filename != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1));
CALLOC(payload, 1, sizeof(*payload), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
STRDUP(payload->filename, spkg->filename, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
payload->max_size = alpm_pkg_get_size(spkg);
files = alpm_list_add(files, payload);
}
}
}
if(files) {
EVENT(handle->trans, ALPM_TRANS_EVT_RETRIEVE_START, current->treename, NULL);
for(j = files; j; j = j->next) {
struct dload_payload *payload = j->data;
alpm_list_t *server;
int ret = -1;
for(server = current->servers; server; server = server->next) {
const char *server_url = server->data;
size_t len;
/* print server + filename into a buffer */
len = strlen(server_url) + strlen(payload->filename) + 2;
CALLOC(payload->fileurl, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
snprintf(payload->fileurl, len, "%s/%s", server_url, payload->filename);
payload->handle = handle;
payload->allow_resume = 1;
ret = _alpm_download(payload, cachedir, NULL);
if(ret != -1) {
break;
}
}
if(ret == -1) {
errors++;
}
}
alpm_list_free_inner(files, (alpm_list_fn_free)_alpm_dload_payload_free);
alpm_list_free(files);
files = NULL;
if(errors) {
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
current->treename);
if(handle->pm_errno == 0) {
handle->pm_errno = ALPM_ERR_RETRIEVE;
}
//.........这里部分代码省略.........
开发者ID:matthewbauer,项目名称:unipkg-pacman,代码行数:101,代码来源:sync.c
示例15: GetPlatformDisplayEXT
// EGL_EXT_platform_base
EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
{
EVENT("(EGLenum platform = %d, void* native_display = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)",
platform, native_display, attrib_list);
const ClientExtensions &clientExtensions = Display::getClientExtensions();
switch (platform)
{
case EGL_PLATFORM_ANGLE_ANGLE:
if (!clientExtensions.platformANGLE)
{
SetGlobalError(Error(EGL_BAD_PARAMETER));
return EGL_NO_DISPLAY;
}
break;
default:
SetGlobalError(Error(EGL_BAD_CONFIG));
return EGL_NO_DISPLAY;
}
EGLint platformType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
EGLint deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE;
bool majorVersionSpecified = false;
bool minorVersionSpecified = false;
bool enableAutoTrimSpecified = false;
bool deviceTypeSpecified = false;
bool requestedAllowRenderToBackBuffer = false;
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
requestedAllowRenderToBackBuffer = true;
#endif
if (attrib_list)
{
for (const EGLint *curAttrib = attrib_list; curAttrib[0] != EGL_NONE; curAttrib += 2)
{
switch (curAttrib[0])
{
case EGL_PLATFORM_ANGLE_TYPE_ANGLE:
switch (curAttrib[1])
{
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
break;
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
if (!clientExtensions.platformANGLED3D)
{
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
break;
case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
if (!clientExtensions.platformANGLEOpenGL)
{
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
break;
default:
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
platformType = curAttrib[1];
break;
case EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE:
if (curAttrib[1] != EGL_DONT_CARE)
{
majorVersionSpecified = true;
}
break;
case EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE:
if (curAttrib[1] != EGL_DONT_CARE)
{
minorVersionSpecified = true;
}
break;
case EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE:
switch (curAttrib[1])
{
case EGL_TRUE:
case EGL_FALSE:
break;
default:
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
enableAutoTrimSpecified = true;
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE:
//.........这里部分代码省略.........
开发者ID:dreamsxin,项目名称:bombyx3d,代码行数:101,代码来源:entry_points_egl_ext.cpp
示例16: eglCreatePbufferSurface
EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)",
dpy, config, attrib_list);
try
{
egl::Display *display = static_cast<egl::Display*>(dpy);
EGLint width = 0, height = 0;
if (!validate(display, config))
{
return EGL_NO_SURFACE;
}
if (attrib_list)
{
while (*attrib_list != EGL_NONE)
{
switch (attrib_list[0])
{
case EGL_WIDTH:
width = attrib_list[1];
break;
case EGL_HEIGHT:
height = attrib_list[1];
break;
case EGL_LARGEST_PBUFFER:
if (attrib_list[1] != EGL_FALSE)
UNIMPLEMENTED(); // FIXME
break;
case EGL_TEXTURE_FORMAT:
case EGL_TEXTURE_TARGET:
switch (attrib_list[1])
{
case EGL_NO_TEXTURE:
break;
default:
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
break;
case EGL_MIPMAP_TEXTURE:
if (attrib_list[1] != EGL_FALSE)
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
break;
case EGL_VG_COLORSPACE:
return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
case EGL_VG_ALPHA_FORMAT:
return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
default:
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
attrib_list += 2;
}
}
if (width == 0 || height == 0)
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
EGLSurface surface = (EGLSurface)display->createOffscreenSurface(width, height, config);
return success(surface);
}
catch(std::bad_alloc&)
{
return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
return EGL_NO_SURFACE;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:71,代码来源:libEGL.cpp
示例17: polly_load
static int polly_load(struct module_data *m, FILE *f, const int start)
{
struct xmp_module *mod = &m->mod;
struct xmp_event *event;
uint8 *buf;
int i, j, k;
LOAD_INIT();
read8(f); /* skip 0xae */
/*
* File is RLE-encoded, escape is 0xAE (Aleksi Eeben's initials).
* Actual 0xAE is encoded as 0xAE 0x01
*/
if ((buf = calloc(1, 0x10000)) == NULL)
return -1;
decode_rle(buf, f, 0x10000);
for (i = 0; buf[ORD_OFS + i] != 0 && i < 128; i++)
mod->xxo[i] = buf[ORD_OFS + i] - 0xe0;
mod->len = i;
memcpy(mod->name, buf + ORD_OFS + 160, 16);
/* memcpy(m->author, buf + ORD_OFS + 176, 16); */
set_type(m, "Polly Tracker");
MODULE_INFO();
mod->spd = 0x03;
mod->bpm = 0x7d * buf[ORD_OFS + 193] / 0x88;
#if 0
for (i = 0; i < 1024; i++) {
if ((i % 16) == 0) printf("\n");
printf("%02x ", buf[ORD_OFS + i]);
}
#endif
mod->pat = 0;
for (i = 0; i < mod->len; i++) {
if (mod->xxo[i] > mod->pat)
mod->pat = mod->xxo[i];
}
mod->pat++;
mod->chn = 4;
mod->trk = mod->pat * mod->chn;
PATTERN_INIT();
D_(D_INFO "Stored patterns: %d", mod->pat);
for (i = 0; i < mod->pat; i++) {
PATTERN_ALLOC(i);
mod->xxp[i]->rows = 64;
TRACK_ALLOC(i);
for (j = 0; j < 64; j++) {
for (k = 0; k < 4; k++) {
uint8 x = buf[i * PAT_SIZE + j * 4 + k];
event = &EVENT(i, k, j);
if (x == 0xf0) {
event->fxt = FX_BREAK;
event->fxp = 0;
continue;
}
event->note = LSN(x);
if (event->note)
event->note += 48;
event->ins = MSN(x);
}
}
}
mod->ins = mod->smp = 15;
INSTRUMENT_INIT();
for (i = 0; i < 15; i++) {
mod->xxi[i].sub = calloc(sizeof (struct xmp_subinstrument), 1);
mod->xxs[i].len = buf[ORD_OFS + 129 + i] < 0x10 ? 0 :
256 * buf[ORD_OFS + 145 + i];
mod->xxi[i].sub[0].fin = 0;
mod->xxi[i].sub[0].vol = 0x40;
mod->xxs[i].lps = 0;
mod->xxs[i].lpe = 0;
mod->xxs[i].flg = 0;
mod->xxi[i].sub[0].pan = 0x80;
mod->xxi[i].sub[0].sid = i;
mod->xxi[i].nsm = !!(mod->xxs[i].len);
mod->xxi[i].rls = 0xfff;
D_(D_INFO "[%2X] %04x %04x %04x %c V%02x",
i, mod->xxs[i].len, mod->xxs[i].lps,
mod->xxs[i].lpe, ' ', mod->xxi[i].sub[0].vol);
}
/* Convert samples from 6 to 8 bits */
for (i = SMP_OFS; i < 0x10000; i++)
buf[i] = buf[i] << 2;
/* Read samples */
//.........这
|
请发表评论