📄 si_list.c
字号:
/*
* Copyright (C) Ericsson Mobile Communications AB, 2000.
* Licensed to AU-System AB.
* All rights reserved.
*
* This software is covered by the license agreement between
* the end user and AU-System AB, and may be used and copied
* only in accordance with the terms of the said agreement.
*
* Neither Ericsson Mobile Communications AB nor AU-System AB
* assumes any responsibility or liability for any errors or inaccuracies in
* this software, or any consequential, incidental or indirect damage arising
* out of the use of the Generic WAP Client software.
*/
#include "si_list.h"
/**********************************************************************
Funktioner f鰎 listhantering:
f_lh_newhead
Skapar en ny tom lista p_h
f_lh_newlink
skapar ett nytt element p_l
f_lh_out
Om elementet p_l tillh鰎 en lista tas den ur listan.
p_l 鋘dras inte i 鰒rigt
f_lh_precede
S鋞ter in p_l f鰎e p_x i listan d鋜 p_x finns
f_lh_follow
S鋞ter in p_l efter p_x i listan d鋜 p_x finns
f_lh_into
S鋞ter in p_l sist i listan p_h
f_lh_into_as_first
S鋞ter in p_l f鰎st i listan p_h
f_lh_lpred
Ger en pekare till det element som ligger f鰎e p_l i listan,
om p_l 鋜 f鰎st returneras NULL
f_lh_lsuc
Ger en pekare till det element som ligger efter p_l i listan
om p_l 鋜 sist returneras NULL
f_lh_empty
Returnerar 1 om listan 鋜 tom, annars 0
f_lh_first
Returnerar f鰎sta elementet i listan, om tom : NULL
f_lh_last
Returnerar sista elementet i listan, om tom : NULL
f_lh_cardinal
Returnerar antalet element i listan
f_lh_disposelink
Raderar ut elementet p_l
f_lh_clear
Rensar ut listan utom huvudet p_h
f_lh_disposehead
Raderar ut hela listan inklusive p_h
*************************************************************************/
/************************************************************************
VOID f_lh_newhead (t_head *p_h) {};
Purpose:
Skapar en ny tom lista p_h
Limitations:
-
Return:
-
************************************************************************/
VOID f_lh_newhead (t_head *p_h) {
*p_h = NULL;
*p_h = (t_head) OSConnectorAlloc( sizeof(t_element) );
if (*p_h != NULL) {
(*p_h)->kind = headkind;
(*p_h)->pre = *p_h;
(*p_h)->suc = *p_h;
(*p_h)->data = NULL;
}
}
/************************************************************************
VOID f_lh_newlink (t_link *p_l)
Purpose:
Skapar ett nytt element p_l
Limitations:
-
Return:
-
************************************************************************/
VOID f_lh_newlink (t_link *p_l) {
*p_l = NULL;
*p_l = (t_link) OSConnectorAlloc( sizeof(t_element) );
if (*p_l != NULL) {
(*p_l)->kind = linkkind;
(*p_l)->pre = NULL;
(*p_l)->suc = NULL;
(*p_l)->data = NULL;
}
}
/************************************************************************
VOID f_lh_out (t_link *p_l)
Purpose:
Om elementet p_l tillh鰎 en lista tas den ur listan.
p_l 鋘dras inte i 鰒rigt
Limitations:
-
Return:
-
************************************************************************/
VOID f_lh_out (t_link *p_l) {
if ( (*p_l)->pre != NULL) {
/* D
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -