📄 pim_list.c
字号:
if(result != SUCCESS)
{
PIM_THROW(result, "", pim_getDetailError());
KNI_ReturnInt(0);
}
KNI_StartHandles(1);
KNI_DeclareHandle(int_array);
KNI_GetParameterAsObject(4, int_array);
for( i = NUM_CONTACT_ATTR_FIELDS - 1 ;i >= 0; i--)
{
JPIM_DEBUG_1(TRACE_FUNC, JPIM_LOG_INTEGER, contactAttrs[i]);
KNI_SetIntArrayElement(int_array, i, contactAttrs[i]);
}
KNI_EndHandles();
}
break;
case EVENT_LIST:
break;
case TODO_LIST:
PIM_THROW(PIM, "", FEATURE_NOT_SUPPORTED);
break;
default:
PIM_THROW(ILLARG, "", GENERAL_ERROR);
}
KNI_ReturnInt(0);
}
/*****************************************************************************
* FUNCTION
* Java_com_ibm_oti_pim_PIMListImpl_getSupportedFieldsN2
* DESCRIPTION
* private native int getSupportedFieldsN2(int listType, int handle, int[] ret);
* PARAMETERS
* void
* RETURNS
*****************************************************************************/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_ibm_oti_pim_PIMListImpl_getSupportedFieldsN2(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_int32 listtype = KNI_GetParameterAsInt(1);
kal_int32 dbhandle = KNI_GetParameterAsInt(2);
kal_int32 getsize, result, i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
KNI_StartHandles(1);
KNI_DeclareHandle(int_array);
KNI_GetParameterAsObject(3, int_array);
getsize = KNI_IsNullHandle(int_array);
KNI_EndHandles();
JPIM_DEBUG_1(TRACE_FUNC, FUNC_J2ME_PIMLISTIMPL_GETSUPPORTEDFIELDSN2, getsize);
CHECK_FIELD_RELOAD(listtype, dbhandle, KNI_ReturnInt(0));
if (getsize)
{
result = 0;
switch (listtype)
{
case CONTACT_LIST:
result = NUM_CONTACT_FIELDS;
break;
case EVENT_LIST:
result = NUM_EVENT_FIELDS;
break;
case TODO_LIST:
PIM_THROW(PIM, "", FEATURE_NOT_SUPPORTED);
break;
default:
PIM_THROW(ILLARG, "", GENERAL_ERROR);
}
JPIM_DEBUG_1(TRACE_FUNC, JPIM_LOG_INTEGER, result);
KNI_ReturnInt(result);
}
switch (listtype)
{
case CONTACT_LIST:
KNI_StartHandles(1);
KNI_DeclareHandle(int_array);
KNI_GetParameterAsObject(3, int_array);
for (i = NUM_CONTACT_FIELDS - 1; i >= 0 ; i--)
{
JPIM_DEBUG_1(TRACE_FUNC, JPIM_LOG_INTEGER, contactFields[i]);
KNI_SetIntArrayElement(int_array, i, contactFields[i]);
}
KNI_EndHandles();
break;
case EVENT_LIST:
KNI_StartHandles(1);
KNI_DeclareHandle(int_array);
KNI_GetParameterAsObject(3, int_array);
for (i = NUM_EVENT_FIELDS - 1; i >=0 ; i--)
{
JPIM_DEBUG_1(TRACE_FUNC, JPIM_LOG_INTEGER, eventFields[i]);
KNI_SetIntArrayElement(int_array, i, eventFields[i]);
}
KNI_EndHandles();
break;
case TODO_LIST:
PIM_THROW(PIM, "", FEATURE_NOT_SUPPORTED);
break;
default:
PIM_THROW(ILLARG, "", GENERAL_ERROR);
}
KNI_ReturnInt(0);
}
/*****************************************************************************
* FUNCTION
* Java_com_ibm_oti_pim_PIMListImpl_isCategoryN
* DESCRIPTION
* private native boolean isCategoryN(int listType, int handle, String categoryName);
* PARAMETERS
* void
* RETURNS
*****************************************************************************/
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_com_ibm_oti_pim_PIMListImpl_isCategoryN(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_int32 listtype = KNI_GetParameterAsInt(1);
kal_int32 dbhandle = KNI_GetParameterAsInt(2);
kal_int32 len;
kal_char *categoryname = NULL;
kal_int32 category;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
JPIM_DEBUG_1(TRACE_FUNC, FUNC_J2ME_PIMLISTIMPL_ISCATEGORYN, -1);
if (listtype != CONTACT_LIST)
{
KNI_ReturnBoolean(KNI_FALSE);
}
KNI_StartHandles(1);
KNI_DeclareHandle(str);
KNI_GetParameterAsObject(3, str);
len = KNI_GetStringLength(str);
if (len < 0)
{
PIM_THROW(NULLP, "", GENERAL_ERROR);
}
else
{
categoryname = midpMalloc(((len + 1) << 1));
KNI_GetStringRegion(str, 0, len, (jchar*) categoryname);
categoryname[len*2] = categoryname[len*2+1] = 0;
}
KNI_EndHandles();
if (categoryname != NULL)
{
category = pim_getIndexOfCategory(dbhandle, categoryname);
midpFree(categoryname);
if (category > 0)
{
JPIM_DEBUG_1(TRACE_FUNC, FUNC_J2ME_PIMLISTIMPL_ISCATEGORYN, 1);
KNI_ReturnBoolean(KNI_TRUE);
}
}
JPIM_DEBUG_1(TRACE_FUNC, FUNC_J2ME_PIMLISTIMPL_ISCATEGORYN, 0);
KNI_ReturnBoolean(KNI_FALSE);
}
/*****************************************************************************
* FUNCTION
* Java_com_ibm_oti_pim_PIMListImpl_maxCategoriesN
* DESCRIPTION
* private native int maxCategoriesN(int listType, int handle);
* PARAMETERS
* void
* RETURNS
*****************************************************************************/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_ibm_oti_pim_PIMListImpl_maxCategoriesN(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_int32 listtype = KNI_GetParameterAsInt(1);
kal_int32 dbhandle = KNI_GetParameterAsInt(2);
// kal_int32 field = KNI_GetParameterAsInt(3);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
JPIM_DEBUG(TRACE_FUNC, FUNC_J2ME_PIMLISTIMPL_MAXCATEGORIESN);
switch (listtype)
{
case CONTACT_LIST:
KNI_ReturnInt( getMaxGroupCount(dbhandle)) ;
break;
case EVENT_LIST:
KNI_ReturnInt(0);
break;
case TODO_LIST:
KNI_ReturnInt(0);
break;
default:
PIM_THROW(ILLARG, "", GENERAL_ERROR);
KNI_ReturnInt(0);
}
}
/*****************************************************************************
* FUNCTION
* Java_com_ibm_oti_pim_PIMListImpl_maxValuesN
* DESCRIPTION
* private native int maxValuesN(int listType, int handle, int field);
* PARAMETERS
* void
* RETURNS
*****************************************************************************/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_ibm_oti_pim_PIMListImpl_maxValuesN(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_int32 listtype = KNI_GetParameterAsInt(1);
kal_int32 dbhandle = KNI_GetParameterAsInt(2);
kal_int32 field = KNI_GetParameterAsInt(3);
kal_int32 size = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
JPIM_DEBUG(TRACE_FUNC, FUNC_J2ME_PIMLISTIMPL_MAXVALUESN);
CHECK_ATTR_RELOAD(listtype, dbhandle, KNI_ReturnInt(0));
if (listtype == CONTACT_LIST)
{
if (field == C_TEL)
{
getContactAttr(dbhandle, field, &size, NULL);
KNI_ReturnInt(size);
}
}
KNI_ReturnInt(1);
}
/*****************************************************************************
* FUNCTION
* Java_com_ibm_oti_pim_PIMListImpl_nextRecordInCategoryN
* DESCRIPTION
* private native int nextRecordInCategoryN(int listType, int handle, int rechandle, String category) throws PIMException;
* PARAMETERS
* void
* RETURNS
*****************************************************************************/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_ibm_oti_pim_PIMListImpl_nextRecordInCategoryN(void)
{
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
KNI_ReturnInt(-1);
}
/*****************************************************************************
* FUNCTION
* Java_com_ibm_oti_pim_PIMListImpl_nextRecordN
* DESCRIPTION
* private native int nextRecordN(int listType, int handle, int rechandle) throws PIMException;
* PARAMETERS
* void
* RETURNS
*****************************************************************************/
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_ibm_oti_pim_PIMListImpl_nextRecordN(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_int32 listtype = KNI_GetParameterAsInt(1);
kal_int32 dbhandle = KNI_GetParameterAsInt(2);
kal_int32 rechandle = KNI_GetParameterAsInt(3);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
JPIM_DEBUG(TRACE_FUNC, FUNC_J2ME_PIMLISTIMPL_NEXTRECORDN);
//#if 0
switch (listtype)
{
case CONTACT_LIST:
pim_cntx.cdbh = 0xFFFF;
pim_cntx.contact.sort_index = 0xFF;
pim_cntx.contact.store_index = 0xFF;
KNI_ReturnInt(getNextContactRecHandle(dbhandle, rechandle));
break;
case EVENT_LIST:
pim_cntx.edbh = 0xFFFF;
pim_cntx.event.index = 0xFF;
pim_cntx.event.handle = 0xFF;
KNI_ReturnInt(getNextEventRecHandle(dbhandle, rechandle));
break;
default:
KNI_ReturnInt(-1);
}
//#endif
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -