当前位置: 首页>>代码示例>>C++>>正文


C++ KNI_EndHandles函数代码示例

本文整理汇总了C++中KNI_EndHandles函数的典型用法代码示例。如果您正苦于以下问题:C++ KNI_EndHandles函数的具体用法?C++ KNI_EndHandles怎么用?C++ KNI_EndHandles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了KNI_EndHandles函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Java_com_sun_midp_links_Link_init0

/**
 * private native void init0(int sender, int receiver);
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_links_Link_init0(void)
{
    int sender;
    int receiver;
    rendezvous *rp;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObj);

    sender = KNI_GetParameterAsInt(1);
    receiver = KNI_GetParameterAsInt(2);
    KNI_GetThisPointer(thisObj);

    rp = rp_create(sender, receiver);
    if (rp == NULL) {
        KNI_ThrowNew(midpOutOfMemoryError, NULL);
    } else {
        setNativePointer(thisObj, rp);
        rp_incref(rp);
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:28,代码来源:midp_link.c

示例2: KNIDECL

/*
 * Returns the number of bytes available to be read from the connection
 * without blocking.
 *
 * Note: the method gets native connection handle directly from
 * <code>handle<code> field of <code>BTSPPConnectionImpl</code> object.
 *
 * @return the number of available bytes
 * @throws IOException if any I/O error occurs
 */
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_jsr082_bluetooth_btspp_BTSPPConnectionImpl_available0) {
    javacall_handle handle;
    int count = -1;
    char* pError;

    REPORT_INFO(LC_PROTOCOL, "btspp::available");

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisHandle);
    KNI_GetThisPointer(thisHandle);
    handle = (javacall_handle)KNI_GetIntField(thisHandle, connHandleID);

    switch (javacall_bt_rfcomm_get_available(handle, &count)) {
    case JAVACALL_OK:
        REPORT_INFO(LC_PROTOCOL, "btspp::available done!");
        break;

    case JAVACALL_FAIL:
        javacall_bt_rfcomm_get_error(handle, &pError);
        JAVAME_SNPRINTF(gBtBuffer, BT_BUFFER_SIZE,
            "IO error during btspp::::available (%s)", pError);
        REPORT_ERROR(LC_PROTOCOL, gBtBuffer);
        KNI_ThrowNew(jsropIOException, EXCEPTION_MSG(gBtBuffer));
        break;
    default: /* illegal argument */
        REPORT_ERROR(LC_PROTOCOL, "Internal error in btspp::available");
    }

    KNI_EndHandles();
    KNI_ReturnInt(count);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:42,代码来源:btSPPConnectionGlue_c.c

示例3: Java_javax_microedition_khronos_egl_EGL10Impl__1eglQueryContext

/*  private native int _eglQueryContext ( int display , int ctx , int attribute , int [ ] value ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglQueryContext() {

    jint display = KNI_GetParameterAsInt(1);
    jint ctx = KNI_GetParameterAsInt(2);
    jint attribute = KNI_GetParameterAsInt(3);
    EGLint value;

    jint returnValue = EGL_FALSE;

    KNI_StartHandles(1);
    KNI_DeclareHandle(valueHandle);

    KNI_GetParameterAsObject(4, valueHandle);

    returnValue = (jint)eglQueryContext((EGLDisplay)display,
					(EGLContext)ctx,
					attribute,
					&value);
#ifdef DEBUG
    printf("eglQueryContext(0x%x, 0x%x, %d, value<-%d) = %d\n",
	   display, ctx, attribute, value, returnValue);
#endif
    if ((returnValue == EGL_TRUE) && !KNI_IsNullHandle(valueHandle)) {
        KNI_SetIntArrayElement(valueHandle, 0, value);
    }

    KNI_EndHandles();
    KNI_ReturnInt(returnValue);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:31,代码来源:JSR239-KNIEGL11Impl.c

示例4: KNIDECL

/**
 * Gets the registered MIDlet name for the given inbound connection handle.
 * <p>
 * Java declaration:
 * <pre>
 *     getMIDlet0(J[BI)I
 * </pre>
 *
 * @param handle The handle to inbound connection
 * @param midletName A byte array to store the MIDlet name
 * @param midletNameLength The size of <tt>midlet</tt>
 *
 * @return <tt>0</tt> if successful, otherwise <tt>-1</tt>
 */
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_midp_io_j2me_push_ConnectionRegistry_getMIDlet0) {
    int   midletNameLength;
    char* regentry;
    int   regentryLength;
    int   ret = -1;
    int   handle;

    midletNameLength = (int)KNI_GetParameterAsInt(3);
    handle           = (int)KNI_GetParameterAsInt(1);

    KNI_StartHandles(1);

    KNI_DeclareHandle(midletName);
    KNI_GetParameterAsObject(2, midletName);

    regentry = pushfindfd(handle);
    if (NULL != regentry) {
        regentryLength = strlen(regentry) + 1;      /* Include trailing '\0' */
        if (regentryLength < midletNameLength) {
            memcpy((char*)JavaByteArray(midletName),
                   regentry, regentryLength);
            ret = 0;
        }
        midpFree(regentry);
    }
    KNI_EndHandles();

    KNI_ReturnInt(ret);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:44,代码来源:midp_connection_registry_kni.c

示例5: KNIDECL

/**
 * Gets the total advance width of the given <tt>String</tt> in this
 * <tt>Font</tt>.
 * <p>
 * Java declaration:
 * <pre>
 *     stringWidth(Ljava/lang/String;)I
 * </pre>
 *
 * @param str the <tt>String</tt> to be measured
 *
 * @return the total advance width of the <tt>String</tt> in pixels
 */
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(javax_microedition_lcdui_Font_stringWidth) {
    int strLen;
    jint result = 0;

    KNI_StartHandles(2);

    KNI_DeclareHandle(str);
    KNI_DeclareHandle(thisObject);

    KNI_GetParameterAsObject(1, str);
    KNI_GetParameterAsObject(0, thisObject);

    if ((strLen = KNI_GetStringLength(str)) == -1) {
        KNI_ThrowNew(midpNullPointerException, NULL);
    } else {
        int      face, style, size;
        _JavaString *jstr;

        DECLARE_FONT_PARAMS(thisObject);

        SNI_BEGIN_RAW_POINTERS;
     
        jstr = GET_STRING_PTR(str);

        result = gx_get_charswidth(face, style, size, 
				   jstr->value->elements + jstr->offset,
				   strLen);

        SNI_END_RAW_POINTERS;
    }

    KNI_EndHandles();
    KNI_ReturnInt(result);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:48,代码来源:gxapi_font_kni.c

示例6: Java_com_sun_cldc_io_j2me_socket_Protocol_writeBuf

KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_cldc_io_j2me_socket_Protocol_writeBuf() {
  int result;
  int fd = KNI_GetParameterAsInt(1);
  int offset = KNI_GetParameterAsInt(3);
  int length = KNI_GetParameterAsInt(4);

  KNI_StartHandles(1);
  KNI_DeclareHandle(buffer_object);
  KNI_GetParameterAsObject(2, buffer_object);
  char *buffer = (char *) SNI_GetRawArrayPointer(buffer_object) + offset;

  result = jvm_send(fd, buffer, length, 0); // We rely on open0() for setting the socket to non-blocking
  KNI_EndHandles();

  if (result < 0) {
    int err_code = GET_LAST_ERROR();
    if (err_code == EWOULDBLOCK) {
      if (SNI_GetReentryData(NULL) == NULL) {
        BlockingSocket *socket =
            (BlockingSocket *) SNI_AllocateReentryData(sizeof(*socket));
        socket->fd = fd;
        socket->check_flags = CHECK_WRITE;
      }
      SNI_BlockThread();
    }
  }

  KNI_ReturnInt(result);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:30,代码来源:BSDSocket.cpp

示例7: Java_com_sun_midp_io_j2me_btl2cap_L2CAPNotifierImpl_listen0

/**
 * Force Bluetooth stack to listen for incoming client connections.
 *
 * Note: the method gets native connection handle directly from
 * <code>handle<code> field of <code>L2CAPNotifierImpl</code> object.
 *
 * @throws IOException if an I/O error occurs
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_io_j2me_btl2cap_L2CAPNotifierImpl_listen0(void) {
    javacall_handle handle = BT_INVALID_HANDLE;

    REPORT_INFO(LC_PROTOCOL, "btl2cap_notif::listen");

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisHandle);
    KNI_GetThisPointer(thisHandle);
    if (KNI_GetIntField(thisHandle, pushHandleID) == BT_INVALID_PUSH_HANDLE) {
        handle = (javacall_handle)KNI_GetIntField(thisHandle, notifHandleID);

        /* force listening */
        if (javacall_bt_l2cap_listen(handle) == JAVACALL_FAIL) {
            javacall_bt_l2cap_close(handle);
            REPORT_ERROR(LC_PROTOCOL,
                "L2CAP notifier listen failed in btl2cap_notif::listen");
            KNI_ThrowNew(midpIOException,
                EXCEPTION_MSG("L2CAP notifier listen failed"));
        } else {
            REPORT_INFO(LC_PROTOCOL, "btl2cap_notif::listen done!");
        }
    }
    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:34,代码来源:btL2CAPNotifierGlue.c

示例8: KNIDECL

/*  private native boolean nCheckFileExist ( String path ) ; */
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
KNIDECL(com_sun_mmedia_protocol_FileDS_nCheckFileExist) {
#define MAX_FILENAME_SIZE 100

    jboolean returnValue = KNI_FALSE;
    jsize length;
    jchar uFileName[MAX_FILENAME_SIZE + 1] = {0};

    KNI_StartHandles(1);
    KNI_DeclareHandle(pathHandle);

    /*
    KNI_GetParameterAsObject(1, pathHandle);
    length = KNI_GetStringLength(pathHandle);
    if (length < MAX_FILENAME_SIZE) {
        KNI_GetStringRegion(pathHandle, 0, length, uFileName);
        if (JAVACALL_OK == javacall_file_exist(uFileName, length)) {
            returnValue = KNI_TRUE;
        }
    } 
    */
 
    KNI_EndHandles();
    KNI_ReturnBoolean(returnValue);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:26,代码来源:KNIFileDS.c

示例9: handleFatalError

/**
 * Reports a fatal error that cannot be handled in Java.
 * Must be called from a KNI method
 *
 */
void handleFatalError(void) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(throwableObj);
    KNI_GetParameterAsObject(1, throwableObj);

    /* IMPL NOTE: Figure out what throwable class this is and log the error? */
    REPORT_CRIT1(LC_CORE, "handleFatalError: uncaught exception in "
        "isolate %d event processing thread", getCurrentIsolateId());
    
    KNI_EndHandles();

    if (getCurrentIsolateId() == midpGetAmsIsolateId()) {
        /* AMS isolate or SVM mode, terminate VM */
        midp_exitVM(-1);
    } else {
        MidpEvent event;

        /* Application isolate, notify the AMS isolate. */
        MIDP_EVENT_INITIALIZE(event);
        event.type = FATAL_ERROR_NOTIFICATION;
        event.intParam1 = getCurrentIsolateId();

        /* Send the shutdown event. */
        StoreMIDPEventInVmThread(event, midpGetAmsIsolateId());
    }

    KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:33,代码来源:midpEvents.c

示例10: Java_com_sun_midp_events_EventQueue_finalize

/**
 * Native finalizer to reset the native peer event queue when
 * the Isolate ends.
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_events_EventQueue_finalize(void) {
   jint queueId;
   EventQueue* pEventQueue;

   KNI_StartHandles(1);
   KNI_DeclareHandle(thisObject);
   KNI_GetThisPointer(thisObject);

   SNI_BEGIN_RAW_POINTERS;
   queueId = getEventQueuePtr(thisObject)->queueId;
   SNI_END_RAW_POINTERS;

   KNI_EndHandles();

   if (queueId >= 0) {
       resetEventQueue(queueId);

       /* Mark queue as inactive */
       GET_EVENT_QUEUE_BY_ID(pEventQueue, queueId);
       pEventQueue->isActive = KNI_FALSE;
   }

   KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:29,代码来源:midpEvents.c

示例11: Java_javax_microedition_khronos_egl_EGL10Impl__1eglCopyBuffers

/*  private native int _eglCopyBuffers ( int display , int surface , Graphics target ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglCopyBuffers() {
    EGLDisplay display = (EGLDisplay) KNI_GetParameterAsInt(1);
    EGLSurface surface = (EGLSurface) KNI_GetParameterAsInt(2);
    jint width = KNI_GetParameterAsInt(4);
    jint height = KNI_GetParameterAsInt(5);
    jint flip = 0;

    JSR239_Pixmap *pixmap = (JSR239_Pixmap *) 0;
    EGLBoolean returnValue = EGL_FALSE;
    
    KNI_StartHandles(1);
    KNI_DeclareHandle(graphicsHandle);
    KNI_GetParameterAsObject(3, graphicsHandle);

    returnValue = (jint)eglCopyBuffers((EGLDisplay) display,
                                       (EGLSurface) surface,
                                       (NativePixmapType) pixmap);

#ifdef DEBUG
    printf("eglCopyBuffers(0x%x, 0x%x, 0x%x) = %d\n",
           display, surface, pixmap, returnValue);
#endif
        
    /* Workaround - use glReadPixels if eglCopyBuffers fails. */
    if (returnValue == EGL_FALSE) {
    
        pixmap = JSR239_getImagePixmap(graphicsHandle,
                                   width, height,
                                   4, 8, 8, 8, 8);
        if (!pixmap) {
            KNI_ThrowNew("java.lang.OutOfMemoryException", "eglCopyBuffers");
            goto exit;
        }
    
        // Enforce RGBA order of glReadPixels
        pixmap->aOffset = 24;
        pixmap->bOffset = 16;
        pixmap->gOffset = 8;
        pixmap->rOffset = 0;
    
        returnValue = eglCopyBuffersWorkaround((EGLDisplay) display,
                                               (EGLSurface) surface,
                                               pixmap);
        flip = 1;
    }
    
    if (returnValue == EGL_TRUE) {
        JSR239_putWindowContents(graphicsHandle, pixmap, flip);
    }

    if (pixmap) {
        JSR239_destroyPixmap(pixmap);
    }

 exit:
        
    KNI_EndHandles();
    KNI_ReturnInt((jint)returnValue);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:61,代码来源:JSR239-KNIEGL11Impl.c

示例12: KNIDECL

/**
 * Initializes the native peer of this <tt>Font</tt>.
 * <p>
 * Java declaration:
 * <pre>
 *     init(III)V
 * </pre>
 *
 * @param face The face of the font to initialize
 * @param style The style of the font to initialize
 * @param size The point size of the font to initialize
 */
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(javax_microedition_lcdui_Font_init) {
    jboolean free_size = KNI_GetParameterAsBoolean(4);
    int size  = (int)KNI_GetParameterAsInt(3);
    int style = (int)KNI_GetParameterAsInt(2);
    int face  = (int)KNI_GetParameterAsInt(1);
    int ascent, descent, leading;

    KNI_StartHandles(1);
    KNI_DeclareHandle(thisObject);

    if (free_size == KNI_FALSE) {
        /* size is one of the SIZE_XXX constants */
        size = OEM_FONT_SIZE(size);
    }

    KNI_GetParameterAsObject(0, thisObject);

    gx_get_fontinfo(face, style, size, &ascent, &descent, &leading);

    SNI_BEGIN_RAW_POINTERS;

    GET_FONT_PTR(thisObject)->baseline = (jint)ascent;
    GET_FONT_PTR(thisObject)->height = (jint)(ascent + descent + leading);
    GET_FONT_PTR(thisObject)->size = (jint)size;
    GET_FONT_PTR(thisObject)->sizeRounded = (jint) LCDUI_FONT_SIZE(size);

    SNI_END_RAW_POINTERS;

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:44,代码来源:gxapi_font_kni.c

示例13: Java_com_sun_midp_links_LinkPortal_getLinks0

/**
 * private static native void getLinks0(Link[] linkarray);
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_links_LinkPortal_getLinks0(void)
{
    int targetIsolate;
    jsize len;
    int i;
    KNI_StartHandles(2);
    KNI_DeclareHandle(linkArray);
    KNI_DeclareHandle(linkObj);

    targetIsolate = JVM_CurrentIsolateID();
    KNI_GetParameterAsObject(1, linkArray);
    len = KNI_GetArrayLength(linkArray);

    if (portals != NULL) {
        if (portals[targetIsolate].count > 0) {
            rendezvous **rpp = portals[targetIsolate].rppa;
            for (i = 0; i < len; i++) {
                KNI_GetObjectArrayElement(linkArray, i, linkObj);
                setNativePointer(linkObj, rpp[i]);
                rp_incref(rpp[i]);
            }
        }
        portal_free(&portals[targetIsolate]);
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:32,代码来源:midp_link.c

示例14: Java_com_sun_kvem_jsr082_bluetooth_SDDB_readRecord

/**
 * Retrieves service record from the SDDB.
 *
 * @param handle handle of the service record to be retrieved
 * @param data byte array which will receive the data,
 *         or null for size query
 * @return size of the data read/required
 */
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_kvem_jsr082_bluetooth_SDDB_readRecord(void)
{
    jint retval;
    bt_record_t record;
    KNI_StartHandles(1);
    KNI_DeclareHandle(dataHandle);
    KNI_GetParameterAsObject(2, dataHandle);
    record.id = (bt_sddbid_t)KNI_GetParameterAsInt(1);
    if (KNI_IsNullHandle(dataHandle)) {
        record.data = NULL;
        record.size = 0;
    } else {
        record.data = JavaByteArray(dataHandle);
        record.size = KNI_GetArrayLength(dataHandle);
    }
    if (javacall_bt_sddb_read_record(record.id, &record.classes,
            record.data, &record.size) == JAVACALL_OK) {
        retval = record.size;
    } else {
        retval = 0;
    }
    KNI_EndHandles();
    KNI_ReturnInt(retval);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:33,代码来源:SDDBGlue.c

示例15: KNIDECL

/* JAVADOC COMMENT ELIDED */
KNIEXPORT KNI_RETURNTYPE_VOID
    KNIDECL(com_sun_j2me_location_LocationPersistentStorage_removeLandmarkStore) {
    
    javacall_result res;
    
    KNI_StartHandles(1);
    GET_PARAMETER_AS_UTF16_STRING(1, storeName)

    /* call provider_open to get provider handler */
    res = javacall_landmarkstore_delete(storeName);
    switch (res) {
        case JAVACALL_OK:
            /* LandmarkStore created successfully */
            break;
        case JAVACALL_FAIL:
            /* operation Failed */
            KNI_ThrowNew(jsropIOException, "I/O error");
            break;
        case JAVACALL_INVALID_ARGUMENT:
            /* operation Failed */
            KNI_ThrowNew(jsropIOException, "name is too long");
            break;
        default:
            /* operation Failed */
            KNI_ThrowNew(jsropIOException, "I/O error");
            break;
    }

    RELEASE_UTF16_STRING_PARAMETER
    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:33,代码来源:locationPersistentStorage_kni.c


注:本文中的KNI_EndHandles函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。