Lib/tlist.c File Reference

Tiny List 構造ライブラリ. More...

#include "tlist.h"
#include "jbxl_state.h"
Include dependency graph for tlist.c:

Go to the source code of this file.

Functions

tList_data init_tList_data (void)
 空のノードデータを静的に作成.データを初期化するのに使用する.
tList_data make_tList_data (int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
 データを指定してノードデータを作成
tList_data make_tList_data_bystr (int id, int lv, const char *key, const char *val, void *ptr, int sz)
 文字列データを指定してノードデータを作成
void free_tList_data (tList_data *ldat)
 ノードデータのバッファ部をクリアする.データ自身は削除しない.
void del_tList_data (tList_data **ldat)
 ノードデータを削除する.
tList_data dup_tList_data (tList_data ldat)
 ノードデータの複製を作成する
tListnew_tList_node (void)
 リスト用の空ノードを動的に生成する.
tList make_tList_node (tList_data ldat)
 リスト用ノードを静的に作成する.
tListfree_tList_node (tList *node)
 リスト用ノードのバッファ部(データ)の解放.
tListdel_tList_node (tList **node)
 リスト用のノードを削除.
tListdup_tList_node (tList *node)
 ノードデータを複製する (new).ノードのポインタは複製しない.
tListmove_tList_node (tList *pp, tList *node)
 nodeを現在のリストから切り離し,ppへ移動する.
tListswap_tList_node (tList *pp1, tList *pp2)
 pp1ノード と pp2ノードを入れ替える.
tListnew_tList_anchor_node (void)
 リスト用の ANCHORノードを動的に生成.
tListdel_tList_anchor_node (tList *node)
 ANCHORノードを削除して,TOPのポインターを返す..
tListadd_tList_node_bydata (tList *pp, tList_data ldat)
 データ(ldat)からリスト用ノードを生成し(new),それを指定したリストの後ろに追加.
tListadd_tList_node_bystr (tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
 文字列データからリスト用ノードを生成し(new),それをリストに追加.
tListadd_tList_node_byBuffer (tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
 Buffer データからリスト用ノードを生成し(new),それをリストに追加..
void set_tList_node_bydata (tList *node, tList_data dat)
 リストのノードに値を設定する.
void set_tList_node_bystr (tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
 文字列データからリストのノードに値を設定する.それぞれのデータは複製されて設定される.
void set_tList_node_byBuffer (tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
 リストのノードに値を設定する.それぞれのデータは複製されて設定される.
tListupdate_tList_node (tList *pp, tList *pt)
 pt->keyで検索し,ノードがあればノードをコピーする.無ければ最後にノードを追加する(new).
tListupdate_tList_node_bydata (tList *pp, char *srch, tList_data ldat)
 keyで検索し,ノードがあればノードをコピーする.無ければ最後にノードを追加する(new).
tListupdate_tList_node_bystr (tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
 keyで検索し,ノードがあればノードをコピーする.無ければ最後に追加する(new)
tListupdate_tList_node_byBuffer (tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
 key.bufで検索し,ノードがあれば設定する.無ければ最後に追加する(new).
tListdel_tList (tList **pp)
 指定したリストノード以降のリストを削除.
void del_all_tList (tList **pp)
 リストの全ノードの削除.ポインタ ppのノードを含むリスト全体を削除する.
int del_tList_key (tList **pl, const char *key, int no)
 plからサーチして,no番目の keyのノードを削除する.
tListdup_tList (tList *pp)
 リストを複製する.
tListadd_tList_end (tList *pp, tList *pt)
 リストppの最後に リストptを追加する.
tListinsert_tList (tList *pp, tList *pt)
 ノードppの直ぐ後ろに ptを挿入する.
void print_tList (FILE *fp, tList *pp)
 リストの表示.ポインタ pp以降の全てのノードを fpに表示する.
void dump_tList (FILE *fp, tList *pp)
 val.buf を 16進ダンプする.他のデータは通常通り表示する.
int count_tList (tList *pp)
 リストの ppノード以降のノードの数を数える.
tListfind_tList_top (tList *pl)
 リストの最初のノードを探す.
tListfind_tList_end (tList *pl)
 リストの最後のノードを探す.
tListstrncmp_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードのサーチ.
tListstrncasecmp_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードのサーチ.大文字小文字を無視する
tListstrnrvscmp_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードのサーチ.文字の後方から比べる
tListstrncaservscmp_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードのサーチ.文字の後方から比べる.大文字小文字を無視.
tListstrstr_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードの部分文字列サーチ.
tListstrstrcase_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードの部分文字列サーチ.大文字小文字を無視.
tListstrncmp_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードのサーチ.
tListstrncasecmp_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードのサーチ.大文字小文字を無視.
tListstrnrvscmp_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードのサーチ.文字も後方から比べる.
tListstrncaservscmp_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードのサーチ.文字も後方から比べる.大文字小文字を無視.
tListstrstr_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードの部分文字列サーチ.
tListstrstrcase_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数による後方からのノードの部分文字列サーチ.大文字小文字を無視.
tListsearch_id_tList (tList *pl, int id, int no)
 リストの中から no番目の idノード(ldat.id)を探し出し,tListのポインタを返す.
tListsearch_key_tList (tList *pl, const char *key, int no)
 リストの中から no番目の keyノード(ldat.key)を探し出し,tListへのポインタを返す.大文字小文字を無視.
Buffer buffer_key_tList (tList *list, const char *key, int no)
 リストの中から no番目の keyノード(ldat.key)を探し出し,ldat.valのコピーを返す.
Buffer buffer_key_value_tList (tList *list, const char *key, char *data, int no)
 リストの中から no番目の keyノードを探し出し,ノード値が data で始まる場合,そのノード値を返す.
int set_value_tList (tList *list, const char *key, int no, const char *value, int add_mode)
 リスト(lt)中の no番目の keyノードの値に valueを設定する.
int set_value_tList_node (tList *lp, const char *value)
 lt->ldat.val に文字列を設定する(置き換える).
int replace_value_tList (tList *list, const char *key, int no, const char *srcval, char *value)
 リスト(lt)中の no番目の keyノードの値の srcvalの部分を value に置き換える.
int replace_value_tList_node (tList *lp, const char *srcval, const char *value)
 lt->ldat.val のsrcval部分を value に置き換える.
tListawk_tList (char *str, char cc)
 文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
tListcawk_tList (char *str, char cc)
 文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.連続文字列対応.
tListawk_Buffer_tList (Buffer buf, char cc)
 Buffer 中の文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す..
tListcawk_Buffer_tList (Buffer buf, char cc)
 Buffer 中の文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.連続文字列対応..
char * get_str_join_tList (tList *lp, const char *deli)
 リストの一連のキー部を deliを区切りにして結合して,その文字列を返す. 要 free
Buffer get_Buffer_join_tList (tList *lp, const char *deli)
 リストの一連のキー部を deliを区切りにして結合して返す.
char * get_str_param_tList (tList *lt, const char *key, const char *dflt)
 keyに対応する値を 文字列として読み出す.キーがない場合は,デフォルト値 dflt を返す.要 free().
int get_int_param_tList (tList *lt, const char *key, int dflt)
 keyに対応する値を 整数として読み出す.キーがない場合は,デフォルト値 dflt を返す..
double get_double_param_tList (tList *lt, const char *key, double dflt)
 keyに対応する値を double型実数として読み出す.キーがない場合は,デフォルト値 dflt を返す.
float get_float_param_tList (tList *lt, const char *key, float dflt)
 keyに対応する値を float型実数として読み出す.キーがない場合は,デフォルト値 dflt を返す.
int get_bool_param_tList (tList *lt, const char *key, int dflt)
 keyに対応する値を 論理値(実際は整数)として読み出す.キーがない場合は,デフォルト値 dflt を返す.
tListread_tList_file (const char *fname, int mode)
 ファイルから一行ずつ読み込んでリストのキー部に格納.空行はリストに加えない.
tListread_tList_fp (FILE *fp, int mode)
 ファイルポインタが示すファイルから一行ずつ読み込んでリストのキー部に格納.
tListread_index_tList_file (const char *fname, char deli)
 ファイルから一行ずつ読み込んで,deliを区切り文字にしてリストのキー部とデータ部に格納.
tListread_index_tList_fp (FILE *fp, char deli)
 ファイルポインタが示すファイルから一行ずつ読み込んで,deliを区切り文字にしてリストのキー部とデータ部に格納.
tListread_Buffer_tList_file (const char *fname)
 ファイルから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す.
tListread_Buffer_tList_fp (FILE *fp)
 ファイルポインタから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す.
int save_Buffer_tList_file (const char *fname, tList *lp)
 リストのキー部とバッファ部の Buffer型変数をファイルへ書き込む.
int save_Buffer_tList_fp (FILE *fp, tList *lp)
 リストのキー部とバッファ部の Buffer型変数をファイルポンタが指すファイルへ書き込む.

Detailed Description

Version:
Author:
Fumi.Iseki (C)
Date:
2008 2/1
See also:
_tList

Definition in file tlist.c.


Function Documentation

tList* add_tList_end ( tList pp,
tList pt 
)

tList* add_tList_end(tList* pp, tList* pt)

リストppの最後に リストptを追加する.

Parameters:
pp 先頭のリストへのポインタ
pt 追加するリストへのポインタ
Returns:
リストの先頭へのポインタ
pp->1->2->3, pt->4->5 => pp->1->2->3->pt->4->5 

Definition at line 897 of file tlist.c.

References find_tList_end().

Referenced by add_xml_attr(), get_dir_files_rcsv(), and read_ldap_config().

00898 {
00899     if (pt==NULL) return pp;
00900     if (pp==NULL) return pt;
00901 
00902     tList* pe = find_tList_end(pp);
00903     pe->next = pt;
00904     pt->prev = pe;
00905 
00906     return pp;
00907 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* add_tList_node_byBuffer ( tList pp,
int  id,
int  lv,
Buffer  key,
Buffer  val,
void *  ptr,
int  sz 
)

tList* add_tList_node_byBuffer(tList* pp, int id, int lv, Buffer key, Buffer val, void* ptr, int sz)

Buffer データからリスト用ノードを生成し(new),それをリストに追加.

リストポインタ ppが指すノードの後につくり出した ノードを挿入する. sz>0 で ptr==NULL の場合は ptrの領域を確保し,0クリアする.

Parameters:
pp 追加する場所の手前のノードへのポインタ.
id 追加するデータ.
lv 追加するデータ.
key 追加するデータ. 複製
val 追加するデータ. 複製
*ptr 汎用データへのポインタ 複製
sz *ptr のサイズ
Returns:
追加したノードへのポインタ.

Definition at line 501 of file tlist.c.

References add_tList_node_bydata(), and make_tList_data().

Referenced by read_index_tList_fp(), and update_tList_node_byBuffer().

00502 {
00503     tList* pt;
00504     tList_data ldat;
00505 
00506     ldat = make_tList_data(id, lv, key, val, ptr, sz);
00507     pt   = add_tList_node_bydata(pp, ldat);
00508 
00509     return pt;
00510 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* add_tList_node_bydata ( tList pp,
tList_data  ldat 
)

tList* add_tList_node_bydata(tList* pp, tList_data ldat)

データ(ldat)からリスト用ノードを生成し(new),それを指定したリストの後ろに追加.

リストポインタ ppが指すノードの後につくり出した ノードを挿入する. ldat は指定されたものがそのまま使用される.

Parameters:
pp 追加する場所の手前のノードへのポインタ.
ldat 追加するノードデータ.このデータがそのまま使用される.
Returns:
追加したノードへのポインタ.

Definition at line 433 of file tlist.c.

References new_tList_node().

Referenced by add_resource_list(), add_tList_node_byBuffer(), add_tList_node_bystr(), and update_tList_node_bydata().

00434 {
00435     tList* pt;
00436 
00437     pt = new_tList_node();
00438     pt->ldat = ldat;
00439 
00440     if (pp==NULL) return pt;
00441 
00442     pt->next = pp->next;
00443     pt->prev = pp;
00444     pp->next = pt;
00445     if (pt->next!=NULL) (pt->next)->prev = pt;    
00446 
00447     return pt;
00448 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* add_tList_node_bystr ( tList pp,
int  id,
int  lv,
const char *  key,
const char *  val,
void *  ptr,
int  sz 
)

tList* add_tList_node_bystr(tList* pp, int id, int lv, const char* key, const char* val, void* ptr, int sz)

文字列データからリスト用ノードを生成し(new),それをリストに追加.

リストポインタ ppが指すノードの後につくり出した ノードを挿入する. sz>0 で ptr==NULL の場合は ptrの領域を確保し,0クリアする.

Parameters:
pp 追加する場所の手前のノードへのポインタ.
id 追加するデータ.
lv 追加するデータ.
key 追加するデータ. 複製
val 追加するデータ. 複製
ptr 汎用データへのポインタ 複製
sz *ptr のサイズ
Returns:
追加したノードへのポインタ.

Definition at line 470 of file tlist.c.

References add_tList_node_bydata(), and make_tList_data_bystr().

Referenced by awk_Buffer_tList(), awk_tList(), cawk_Buffer_tList(), cawk_tList(), jbxl_add_state(), and update_tList_node_bystr().

00471 {
00472     tList* pt;
00473     tList_data ldat;
00474 
00475     ldat = make_tList_data_bystr(id, lv, key, val, ptr, sz);
00476     pt   = add_tList_node_bydata(pp, ldat);
00477 
00478     return pt;
00479 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* awk_Buffer_tList ( Buffer  buf,
char  cc 
)

tList* awk_Buffer_tList(Buffer buf, char cc)

Buffer 中の文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
項目が存在しない場合でもリストは返す(キー部の bufが NULL).

Parameters:
buf 処理する Buffer変数
cc 項目の区切り文字
Returns:
項目をキー部に入れたリスト.項目が存在しない場合でもリストは返す.
See also:
cawk_Buffer_tList

Definition at line 1931 of file tlist.c.

References add_tList_node_bystr(), awk_Buffer(), Buffer::buf, find_tList_top(), and free_Buffer().

Referenced by awk_Buffer_dim().

01932 {
01933     int  nn = 1;
01934     Buffer item;
01935     tList* lp = NULL;
01936 
01937     if (buf.buf==NULL) return NULL;
01938 
01939     item = awk_Buffer(buf, cc, nn);
01940     while (item.buf!=NULL) {
01941         lp = add_tList_node_bystr(lp, nn, 0, (char*)item.buf, NULL, NULL, 0);
01942         free_Buffer(&item);
01943         item = awk_Buffer(buf, cc, ++nn);
01944     }
01945 
01946     if (lp!=NULL) lp = find_tList_top(lp);
01947     return lp;
01948 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* awk_tList ( char *  str,
char  cc 
)

tList* awk_tList(char* str, char cc)

文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
項目が存在しない場合でもリストは返す(キー部の bufが NULL).

Parameters:
str 処理する文字列
cc 項目の区切り文字
Returns:
項目をキー部に入れたリスト.項目が存在しない場合でもリストは返す.
See also:
cawk_tList

Definition at line 1851 of file tlist.c.

References add_tList_node_bystr(), awk(), find_tList_top(), and make_Buffer_bystr.

Referenced by bvh_get_seq_data(), get_tList_line_Buffer(), and get_tList_seq_data_Buffer().

01852 {
01853     int  nn = 1;
01854     char*  item;
01855     tList* lp = NULL;
01856 
01857     if (str==NULL) return NULL;
01858 
01859     lp = add_tList_node_bystr(NULL, 1, 0, NULL, NULL, NULL, 0);
01860 
01861     // first item
01862     item = awk(str, cc, nn);
01863     if (item==NULL) return lp;
01864     lp->ldat.key = make_Buffer_bystr(item);
01865 
01866     //
01867     item = awk(str, cc, ++nn);
01868     while (item!=NULL) {
01869         lp = add_tList_node_bystr(lp, nn, 0, item, NULL, NULL, 0);
01870         free(item);
01871         item = awk(str, cc, ++nn);
01872     }
01873 
01874     if (lp!=NULL) lp = find_tList_top(lp);
01875     return lp;
01876 }

Here is the call graph for this function:

Here is the caller graph for this function:

Buffer buffer_key_tList ( tList list,
const char *  key,
int  no 
)

Buffer buffer_key_tList(tList* list, const char* key, int no)

リストの中から no番目の keyノード(ldat.key)を探し出し,ldat.valのコピーを返す.
key はケースインセンシティブ.

Parameters:
list 検索を行うリストへのポインタ.
key ヘッダ種別.大文字,小文字を区別しない.
no 何番目のノードを取り出すか指定する.1から数える.
Returns:
ldat.val データのコピー.

Definition at line 1635 of file tlist.c.

References dup_Buffer(), init_Buffer(), and strncasecmp_tList().

Referenced by buffer_key_value_tList(), get_double_param_tList(), get_float_param_tList(), get_int_param_tList(), get_str_param_tList(), and read_ldap_config().

01636 {
01637     tList* pp;
01638     Buffer buf;
01639 
01640     buf = init_Buffer();
01641     if (list==NULL || key==NULL) return buf;
01642     if (no<=0) no = 1;
01643     
01644     pp = strncasecmp_tList(list, key, 0, no);        // 完全一致
01645     if (pp!=NULL) {
01646         buf = dup_Buffer(pp->ldat.val);
01647     }
01648     
01649     return buf;
01650 }

Here is the call graph for this function:

Here is the caller graph for this function:

Buffer buffer_key_value_tList ( tList list,
const char *  key,
char *  data,
int  no 
)

Buffer buffer_key_value_tList(tList* list, const char* key, char* data, int no)

リストの中から no番目の keyノードを探し出し,ノード値が data で始まる場合,そのノード値を返す.
key, dataはケースインセンシティブ.

Parameters:
list 検索を行うリストへのポインタ.
key ヘッダ種別. 大文字,小文字を区別しない.
data チェックするノード値の最初の文字.
no 何番目のノードを取り出すか指定する.1から数える.
Returns:
ノード値の格納された Buffer型変数.

Definition at line 1667 of file tlist.c.

References buffer_key_tList(), init_Buffer(), make_Buffer_bystr, and strncasecmp_tList().

01668 {
01669     tList* pp;
01670     Buffer buf;
01671     char*  str;
01672     int    len;
01673 
01674     buf = init_Buffer();
01675     if (list==NULL || key==NULL) return buf;
01676     if (no<=0) no = 1;
01677 
01678     if (data==NULL) {
01679         buf = buffer_key_tList(list, key, no);
01680         return buf;
01681     }
01682 
01683     buf = init_Buffer();
01684     len = (int)strlen(data); 
01685     
01686     pp = strncasecmp_tList(list, key, 0, no);
01687     if (pp!=NULL) {
01688         str = (char*)pp->ldat.val.buf;
01689         if (str!=NULL && !strncasecmp(str, data, len)) {
01690             buf = make_Buffer_bystr(str);
01691             return buf;
01692         }
01693     }
01694 
01695     return buf;
01696 }

Here is the call graph for this function:

tList* cawk_Buffer_tList ( Buffer  buf,
char  cc 
)

tList* cawk_Buffer_tList(Buffer buf, char cc)

Buffer 中の文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
複数の区切り文字も1個と見なす.
項目が存在しない場合でもリストは返す(キー部の bufが NULL).

Parameters:
buf 処理する Buffer変数
cc 項目の区切り文字
Returns:
項目をキー部に入れたリスト.項目が存在しない場合でもリストは返す.

Definition at line 1963 of file tlist.c.

References add_tList_node_bystr(), Buffer::buf, cawk_Buffer(), find_tList_top(), and free_Buffer().

Referenced by cawk_Buffer_dim().

01964 {
01965     int  nn = 1;
01966     Buffer item;
01967     tList* lp = NULL;
01968 
01969     if (buf.buf==NULL) return NULL;
01970 
01971     item = cawk_Buffer(buf, cc, nn);
01972     while (item.buf!=NULL) {
01973         lp = add_tList_node_bystr(lp, nn, 0, (char*)item.buf, NULL, NULL, 0);
01974         free_Buffer(&item);
01975         item = cawk_Buffer(buf, cc, ++nn);
01976     }
01977 
01978     if (lp!=NULL) lp = find_tList_top(lp);
01979     return lp;
01980 
01981 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* cawk_tList ( char *  str,
char  cc 
)

tList* cawk_tList(char* str, char cc)

文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
複数の区切り文字も1個と見なす.
項目が存在しない場合でもリストは返す(キー部の bufが NULL).

Parameters:
str 処理する文字列
cc 項目の区切り文字
Returns:
項目をキー部に入れたリスト.項目が存在しない場合でもリストは返す.

Definition at line 1891 of file tlist.c.

References add_tList_node_bystr(), cawk(), find_tList_top(), and make_Buffer_bystr.

01892 {
01893     int  nn = 1;
01894     char*  item;
01895     tList* lp = NULL;
01896 
01897     if (str==NULL) return NULL;
01898 
01899     lp = add_tList_node_bystr(NULL, 1, 0, NULL, NULL, NULL, 0);
01900 
01901     // first item
01902     item = cawk(str, cc, nn);
01903     if (item==NULL) return lp;
01904     lp->ldat.key = make_Buffer_bystr(item);
01905 
01906     //
01907     item = cawk(str, cc, ++nn);
01908     while (item!=NULL) {
01909         lp = add_tList_node_bystr(lp, nn, 0, item, NULL, NULL, 0);
01910         free(item);
01911         item = cawk(str, cc, ++nn);
01912     }
01913 
01914     if (lp!=NULL) lp = find_tList_top(lp);
01915     return lp;
01916 }

Here is the call graph for this function:

int count_tList ( tList pp  ) 

int count_tList(tList* pp)

リストの ppノード以降のノードの数を数える.

Parameters:
pp 数え始めるノードへのポインタ.
Returns:
ノードの数.

Definition at line 1002 of file tlist.c.

Referenced by print_sister_xml_tree(), and print_xml_node().

01003 {
01004     int cnt = 0;
01005 
01006     while (pp!=NULL) {
01007         cnt++;
01008         pp = pp->next;
01009     }    
01010     return cnt;
01011 }

Here is the caller graph for this function:

void del_all_tList ( tList **  pp  ) 

void del_all_tList(tList** pp)

リストの全ノードの削除.ポインタ ppのノードを含むリスト全体を削除する.
但し altp のリンク先は削除しない. pp はりスト中であれば,どこを指していても良い.

Parameters:
[in] *pp 削除を開始するノードへのポインタ.
[out] *pp NULL

Definition at line 786 of file tlist.c.

References del_tList_node().

Referenced by awk_Buffer_dim(), cawk_Buffer_dim(), copy_tTree_byctrl(), free_tList_data(), get_mime_filename(), read_index_tList_fp(), read_ipaddr_file(), read_ipaddr_fp(), read_ldap_config(), and set_xml_attr().

00787 {
00788     tList* pm;
00789     tList* pv;
00790 
00791     if (pp==NULL || *pp==NULL) return;
00792 
00793     pm = *pp;
00794     pv = (*pp)->prev;
00795 
00796     do {
00797         pm = del_tList_node(&pm);
00798     } while (pm!=NULL);
00799 
00800     pm = pv;
00801     while (pm!=NULL) {
00802         pv = pm->prev;
00803         del_tList_node(&pm);
00804         pm = pv;
00805     }
00806 
00807     *pp = NULL;
00808 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* del_tList ( tList **  pp  ) 

tList* del_tList(tList** pp)

指定したリストノード以降のリストを削除.

Parameters:
[in] *pp 削除するノードへのポインタ.
[out] *pp NULL
Returns:
削除したノード(s)の親ノードへのポインタ.

Definition at line 752 of file tlist.c.

References free_tList_data().

Referenced by bvh_find_line(), bvh_parse_data(), bvh_parse_hierarchy(), bvh_parse_motion(), get_dir_files_rcsv(), jbxl_init_state_info(), recv_http_Buffer(), recv_https_Buffer(), replace_sdp_invite_addr(), set_xml_content_list(), simple_web_proxy(), and www2browser_relay().

00753 {    
00754     tList* pt;
00755     tList* pm;
00756     tList* pw;
00757 
00758     if (pp==NULL || *pp==NULL) return NULL;
00759 
00760     pt = (*pp)->prev;
00761     if (pt!=NULL) pt->next = NULL;
00762 
00763     pm = *pp;
00764     while (pm!=NULL) {
00765         pw = pm;
00766         pm = pm->next;
00767         free_tList_data(&(pw->ldat));
00768         free(pw);
00769     }
00770     *pp = NULL;
00771 
00772     return pt;
00773 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* del_tList_anchor_node ( tList node  ) 

Definition at line 403 of file tlist.c.

References free_tList_node(), and TLIST_ANCHOR_NODE.

00404 {
00405     tList* pp = node;
00406 
00407     if (node!=NULL && node->ldat.id==TLIST_ANCHOR_NODE) {
00408         pp = node->next;
00409         free_tList_node(node);
00410         free(node);
00411     }
00412 
00413     return pp;
00414 }

Here is the call graph for this function:

void del_tList_data ( tList_data **  ldat  ) 

void del_tList_data(tList_data** ldat)

ノードデータを削除する.

Parameters:
ldat クリアするノードデータ

Definition at line 155 of file tlist.c.

References free_tList_data().

00156 {
00157     if (ldat==NULL || *ldat==NULL) return;
00158 
00159     free_tList_data(*ldat);
00160     *ldat = NULL;
00161 
00162     return;
00163 }

Here is the call graph for this function:

int del_tList_key ( tList **  pl,
const char *  key,
int  no 
)

int del_tList_key(tList* pl, const char* key, int no)

plからサーチして,no番目の keyのノードを削除する.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列).大文字,小文字を区別しない.
no 一致した物の中で何番目の物を削除するか指定する.1から数える.0の場合は全て削除する.
Returns:
削除したノードの数.

Definition at line 823 of file tlist.c.

References del_tList_node(), and ex_strncasecmp().

00824 {       
00825     int dl = 0;
00826     int nn = 0;
00827     if (no<0) no = 0;
00828 
00829     tList* pp = *pl;
00830 
00831     while (pp!=NULL) {
00832         if (ex_strncasecmp((char*)(pp->ldat).key.buf, key, 0)) {
00833             nn++;
00834             if (no==0 || no==nn) {
00835                 if (pp->prev==NULL) *pl = pp->next;
00836                 pp = del_tList_node(&pp);    
00837                 dl++;
00838                 if (no!=0) break;
00839             }
00840             else {
00841                 pp = pp->next;
00842             }
00843         }
00844         else {
00845             pp = pp->next;
00846         }
00847     }
00848 
00849     return dl;
00850 }

Here is the call graph for this function:

tList* del_tList_node ( tList **  node  ) 

tList* del_tList_node(tList** node)

リスト用のノードを削除. リストポインタ nodeが指すノードを削除し,リスト構造を詰める.

Parameters:
[in] *node 削除ノードへのポインタ.
[out] *node NULL
Returns:
削除したノードの直後のノードへのポインタ.

Definition at line 281 of file tlist.c.

References free_tList_node().

Referenced by del_all_tList(), del_sip_record_route(), del_sip_record_route_all(), del_sip_via(), del_tList_key(), http_proxy_header_analyze(), replace_sdp_invite_addr(), and set_protocol_contents().

00282 {
00283     if (node==NULL || *node==NULL) return NULL;
00284 
00285     tList* pp = free_tList_node(*node);
00286     free(*node);
00287     *node = NULL;
00288 
00289     return pp;
00290 }    

Here is the call graph for this function:

Here is the caller graph for this function:

void dump_tList ( FILE *  fp,
tList pp 
)

void dump_tList(FILE* fp, tList* pp)

val.buf を 16進ダンプする.他のデータは通常通り表示する.

Definition at line 974 of file tlist.c.

References fdump().

00975 {
00976     if (fp==NULL) fp = stderr;
00977 
00978     if (pp!=NULL) {
00979         while(pp!=NULL) {
00980             tList_data ld = pp->ldat;
00981             fprintf(fp, "[%d] [%d] [%s] [%d]\n", ld.id, ld.lv, ld.key.buf, ld.val.vldsz);
00982             fdump(fp, (unsigned char*)ld.val.buf, ld.val.vldsz);
00983             pp = pp->next;
00984         }
00985     }
00986     else {
00987         fprintf(fp, "(List is NULL)\n");
00988     }
00989     return;
00990 }

Here is the call graph for this function:

tList* dup_tList ( tList pp  ) 

tList* dup_tList(tList* pp)

リストを複製する.

Parameters:
pp 複製元のリストへのポインタ.
Returns:
複製されたリストへのポインタ.

Definition at line 862 of file tlist.c.

References dup_tList_node(), and insert_tList().

Referenced by copy_tTree_byctrl(), dup_tList_data(), get_dir_files_rcsv(), and set_xml_attr().

00863 {
00864     tList* pt;
00865     tList* pl;
00866     tList* tt;
00867 
00868     if (pp==NULL) return NULL;
00869 
00870     pt = pl = dup_tList_node(pp);
00871     pp = pp->next;
00872 
00873     while(pp!=NULL) {
00874         tt = dup_tList_node(pp);
00875         pl = insert_tList(pl, tt);
00876         pp = pp->next;
00877     }
00878 
00879     return pt;
00880 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList_data dup_tList_data ( tList_data  ldat  ) 

tList_data dup_tList_data(tList_data ldat)

ノードデータの複製を作成する.
ldat.ptr にデータがあるなら,ldat.sz には正確にldat.ptrのサイズが設定されている必要がある.

Parameters:
ldat 複製するノードデータ
Returns:
複製したノードデータへのポインタ.

Definition at line 176 of file tlist.c.

References dup_Buffer(), and dup_tList().

Referenced by dup_tList_node().

00177 {
00178     tList_data dup;    
00179 
00180     memcpy(&dup, &ldat, sizeof(tList_data));
00181     dup.key = dup_Buffer(ldat.key);
00182     dup.val = dup_Buffer(ldat.val);
00183     if (ldat.ptr!=NULL && ldat.sz>0) {
00184         dup.ptr = (void*)malloc(ldat.sz);
00185         if (dup.ptr!=NULL) memcpy(dup.ptr, ldat.ptr, ldat.sz);
00186     }
00187     dup.lst = dup_tList(ldat.lst);
00188     
00189     return dup;
00190 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* dup_tList_node ( tList node  ) 

tList* dup_tList_node(tList* node)

ノードデータを複製する (new).ノードのポインタは複製しない.

Definition at line 299 of file tlist.c.

References dup_tList_data().

Referenced by dup_merge_tTree(), and dup_tList().

00300 {
00301     tList* pp;
00302     int  sz;
00303 
00304     if (node==NULL) return NULL;
00305 
00306     sz = sizeof(tList);
00307     pp = (tList*)malloc(sz);
00308     if (pp==NULL) return NULL;
00309 
00310     memcpy(pp, node, sz);
00311     pp->ldat = dup_tList_data(node->ldat);
00312     pp->next = NULL;
00313     pp->prev = NULL;
00314     pp->altp = NULL;
00315     pp->yngr = NULL;
00316     pp->esis = NULL;
00317     pp->ysis = NULL;
00318 
00319     return pp;
00320 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* find_tList_end ( tList pl  ) 

tList* find_tList_end(tList* pl)

リストの最後のノードを探す.

Attention:
リスト構造の最後のノードを探す関数なので,tTree 構造に適用しても正しいノードを見つけることは出来ない.
tTreeに対しては find_tTree_end()を使うこと.
Parameters:
pl サーチを開始するノードへのポインタ.
Returns:
リストの最後のノードへのポインタ.

Definition at line 1048 of file tlist.c.

Referenced by add_resource_list(), add_tList_end(), check_match_tTree(), check_match_xml(), find_protocol_end(), insert_tList(), strncasecmp_back_tList(), strncaservscmp_back_tList(), strncmp_back_tList(), strnrvscmp_back_tList(), strstr_back_tList(), strstrcase_back_tList(), update_tList_node_byBuffer(), update_tList_node_bydata(), and update_tList_node_bystr().

01049 {
01050     if (pl==NULL) return NULL;
01051 
01052     while (pl->next!=NULL) pl = pl->next;
01053     return pl;
01054 }

Here is the caller graph for this function:

tList* find_tList_top ( tList pl  ) 

tList* find_tList_top(tList* pl)

リストの最初のノードを探す.

Parameters:
pl サーチを開始するノードへのポインタ.
Returns:
リストの最初のノードへのポインタ.

Definition at line 1026 of file tlist.c.

Referenced by awk_Buffer_tList(), awk_tList(), cawk_Buffer_tList(), cawk_tList(), get_mime_filename(), get_protocol_header_list(), recv_http_header(), and recv_https_header().

01027 {
01028     if (pl==NULL) return NULL;
01029 
01030     while (pl->prev!=NULL) pl = pl->prev;
01031     return pl;
01032 }

Here is the caller graph for this function:

void free_tList_data ( tList_data ldat  ) 

void free_tList_data(tList_data* ldat)

ノードデータのバッファ部をクリアする.データ自身は削除しない.

Parameters:
ldat クリアするノードデータ

Definition at line 125 of file tlist.c.

References del_all_tList(), free_Buffer(), and init_Buffer().

Referenced by del_sisters_children_tTree(), del_tList(), del_tList_data(), del_tTree(), free_tList_node(), free_tTree_node(), insert_json_nodes(), and set_tList_node_bydata().

00126 {
00127     if (ldat==NULL) return;
00128 
00129     ldat->id = 0;
00130     ldat->lv = 0;
00131     ldat->sz = 0;
00132 
00133     free_Buffer(&(ldat->key));    
00134     free_Buffer(&(ldat->val));
00135     if (ldat->ptr!=NULL) free(ldat->ptr);
00136     del_all_tList(&(ldat->lst));
00137 
00138     ldat->key = init_Buffer();
00139     ldat->val = init_Buffer();
00140     ldat->ptr = NULL;
00141     ldat->lst = NULL;
00142 
00143     return;
00144 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* free_tList_node ( tList node  ) 

tList* free_tList_node(tList* node)

リスト用ノードのバッファ部(データ)の解放.

Parameters:
node 解放するノードへのポインタ.
Returns:
削除したノードの直後のノードへのポインタ.

Definition at line 253 of file tlist.c.

References free_tList_data().

Referenced by del_tList_anchor_node(), and del_tList_node().

00254 {    
00255     if (node==NULL) return NULL;
00256 
00257     free_tList_data(&(node->ldat));
00258 
00259     tList* pp = NULL;
00260     if (node->prev!=NULL) node->prev->next = node->next;
00261     if (node->next!=NULL) {
00262         node->next->prev = node->prev;
00263         pp = node->next;
00264     }
00265 
00266     return pp;
00267 }

Here is the call graph for this function:

Here is the caller graph for this function:

int get_bool_param_tList ( tList lt,
const char *  key,
int  dflt 
)

int get_bool_param_tList(tList* lt, const char* key, int dflt)

リストから keyに対応するデータ部を 論理値(実際は整数)として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.

Parameters:
lt ファイルから read_index_tList_file() を使用して読み込んだリスト.
key 検索キー
dflt デフォルト値
Returns:
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2141 of file tlist.c.

References get_str_param_tList().

02142 {
02143     int  ret = dflt;
02144     char* val = NULL;
02145 
02146     if (dflt) val = get_str_param_tList(lt, key, "true");
02147     else      val = get_str_param_tList(lt, key, "false");
02148 
02149     if (val!=NULL) {
02150         if (!strcasecmp("true", val)) ret = 1;       // TRUE
02151         else ret = 0;                                // FALSE
02152         free(val);
02153     }
02154 
02155     return ret;
02156 }

Here is the call graph for this function:

Buffer get_Buffer_join_tList ( tList lp,
const char *  deli 
)

Buffer get_Buffer_join_tList(tList* lp, const char* deli)

リストの一連のキー部を deliを区切りにして結合する.

Definition at line 2002 of file tlist.c.

References cat_s2Buffer, init_Buffer(), LBUF, and make_Buffer().

Referenced by get_str_join_tList().

02003 {
02004     Buffer buf;
02005     
02006     buf = init_Buffer();
02007     if (lp==NULL) return buf;
02008 
02009     buf = make_Buffer(LBUF);
02010 
02011     if (lp!=NULL && lp->ldat.key.buf!=NULL) {
02012         cat_s2Buffer((char*)lp->ldat.key.buf, &buf);
02013         lp = lp->next;
02014 
02015         while (lp!=NULL && lp->ldat.key.buf!=NULL) {
02016             if (deli!=NULL) cat_s2Buffer(deli, &buf);
02017             cat_s2Buffer((char*)lp->ldat.key.buf, &buf);
02018             lp = lp->next;
02019         }
02020     }
02021 
02022     return buf;
02023 }

Here is the call graph for this function:

Here is the caller graph for this function:

double get_double_param_tList ( tList lt,
const char *  key,
double  dflt 
)

double get_double_param_tList(tList* lt, const char* key, double dflt)

リストから keyに対応するデータ部を double型実数として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.

Parameters:
lt ファイルから read_index_tList_file() を使用して読み込んだリスト.
key 検索キー
dflt デフォルト値
Returns:
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2091 of file tlist.c.

References Buffer::buf, buffer_key_tList(), and free_Buffer().

02092 {
02093     Buffer buf;
02094 
02095     buf = buffer_key_tList(lt, key, 1);
02096     if (buf.buf!=NULL) {
02097         double ret = atof((char*)buf.buf);
02098         free_Buffer(&buf);
02099         return ret;
02100     }
02101     return dflt;
02102 }

Here is the call graph for this function:

float get_float_param_tList ( tList lt,
const char *  key,
float  dflt 
)

float get_float_param_tList(tList* lt, const char* key, float dflt)

リストから keyに対応するデータ部を floate型実数として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.

Parameters:
lt ファイルから read_index_tList_file() を使用して読み込んだリスト.
key 検索キー
dflt デフォルト値
Returns:
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2116 of file tlist.c.

References Buffer::buf, buffer_key_tList(), and free_Buffer().

02117 {
02118     Buffer buf;
02119 
02120     buf = buffer_key_tList(lt, key, 1);
02121     if (buf.buf!=NULL) {
02122         float ret = (float)atof((char*)buf.buf);
02123         free_Buffer(&buf);
02124         return ret;
02125     }
02126     return dflt;
02127 }

Here is the call graph for this function:

int get_int_param_tList ( tList lt,
const char *  key,
int  dflt 
)

int get_int_param_tList(tList* lt, const char* key, int dflt)

リストから keyに対応するデータ部を 整数として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.

Parameters:
lt ファイルから read_index_tList_file() を使用して読み込んだリスト.
key 検索キー
dflt デフォルト値
Returns:
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2066 of file tlist.c.

References Buffer::buf, buffer_key_tList(), and free_Buffer().

02067 {
02068     Buffer buf;
02069 
02070     buf = buffer_key_tList(lt, key, 1);
02071     if (buf.buf!=NULL) {
02072         int ret = atoi((char*)buf.buf);
02073         free_Buffer(&buf);
02074         return ret;
02075     }
02076     return dflt;
02077 }

Here is the call graph for this function:

char* get_str_join_tList ( tList lp,
const char *  deli 
)

char* get_str_join_tList(tList* lp, const char* deli)

リストの一連のキー部を deliを区切りにして結合して,その文字列を返す.
要 free()

Definition at line 1990 of file tlist.c.

References Buffer::buf, and get_Buffer_join_tList().

01991 {
01992     Buffer buf = get_Buffer_join_tList(lp, deli);
01993     return (char*)buf.buf;
01994 }

Here is the call graph for this function:

char* get_str_param_tList ( tList lt,
const char *  key,
const char *  dflt 
)

char* get_str_param_tList(tList* lt, const char* key, const char* dflt)

リストから keyに対応するデータ部を 文字列として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.
要 free()

Parameters:
lt ファイルから read_index_tList_file() を使用して読み込んだリスト.
key 検索キー
dflt デフォルト値
Returns:
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2044 of file tlist.c.

References Buffer::buf, buffer_key_tList(), and make_Buffer_bystr.

Referenced by get_bool_param_tList().

02045 {
02046     Buffer buf;
02047 
02048     buf = buffer_key_tList(lt, key, 1);
02049     if (buf.buf==NULL) buf = make_Buffer_bystr(dflt);
02050         
02051     return (char*)buf.buf;
02052 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList_data init_tList_data ( void   ) 

tList_data init_tList_data(void)

空のノードデータを静的に作成.データを初期化するのに使用する.

Returns:
作られたノードデータ.

Definition at line 28 of file tlist.c.

Referenced by new_tList_anchor_node(), new_tList_node(), new_tTree_anchor_node(), and new_tTree_node().

00029 {
00030     tList_data pp;
00031 
00032     memset(&pp, 0, sizeof(tList_data));
00033     return pp;
00034 }

Here is the caller graph for this function:

tList* insert_tList ( tList pp,
tList pt 
)

tList* insert_tList(tList* pp, tList* pt)

ノードppの直ぐ後ろに ptを挿入する.

Parameters:
pp 先頭のリストへのポインタ
pt 挿入するリストへのポインタ
Returns:
挿入した先頭のリストへのアドレス.
pp->1->2->3, pt->4->5 => pp->pt->4->5->1->2->3

Definition at line 924 of file tlist.c.

References find_tList_end().

Referenced by dup_tList(), find_match_tTree_endlist_rcsv(), and find_match_xml_endlist_rcsv().

00925 {
00926     tList* pe;
00927     
00928     if (pt==NULL) return pp;
00929     if (pp==NULL) return pt;
00930 
00931     pe = find_tList_end(pt);
00932     if (pp->next!=NULL) pp->next->prev = pe;
00933     pe->next = pp->next;
00934     pp->next = pt;
00935     pt->prev = pp;
00936     
00937     return pt;
00938 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList_data make_tList_data ( int  id,
int  lv,
Buffer  key,
Buffer  val,
void *  ptr,
int  sz 
)

tList_data make_tList_data(int id, int lv, Buffer key, Buffer val, void* ptr, int sz)

データを指定してノードデータを作成
sz>0 で ptr==NULL の場合は ptrの領域を確保し,0クリアする.

Parameters:
id ノードのID
lv ノードのデータ
key ノードのキー (Buffer) 複製
val ノードのデータ (Buffer) 複製
ptr 汎用データへのポインタ 複製
sz *ptr のサイズ
Returns:
作られたノードデータ.

Definition at line 53 of file tlist.c.

References dup_Buffer().

Referenced by add_tList_node_byBuffer(), add_tTree_node_byBuffer(), and insert_tTree_node_byBuffer().

00054 {
00055     tList_data pp;
00056 
00057     memset(&pp, 0, sizeof(tList_data));
00058 
00059     pp.id  = id;
00060     pp.lv  = lv;
00061     pp.sz  = sz;
00062     pp.key = dup_Buffer(key);    
00063     pp.val = dup_Buffer(val);
00064 
00065     if (sz>0) {
00066         pp.ptr = (void*)malloc(sz);
00067         if (pp.ptr!=NULL) {
00068             if (ptr!=NULL) memcpy(pp.ptr, ptr, sz);
00069             else           memset(pp.ptr, 0,   sz);
00070         }
00071     }
00072     
00073     return pp;
00074 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList_data make_tList_data_bystr ( int  id,
int  lv,
const char *  key,
const char *  val,
void *  ptr,
int  sz 
)

tList_data make_tList_data_bystr(int id, int lv, const char* key, const char* val, void* ptr, int sz)

文字列データを指定してノードデータを作成
sz>0 で ptr==NULL の場合は ptrの領域を確保し,0クリアする.

Parameters:
id ノードのID
lv ノードのデータ
key ノードのキー 複製
val ノードのデータ 複製
ptr 汎用データへのポインタ 複製
sz *ptr のサイズ
Returns:
作られたノードデータ.

Definition at line 93 of file tlist.c.

References make_Buffer_bystr.

Referenced by add_tList_node_bystr(), add_tTree_node_bystr(), and insert_tTree_node_bystr().

00094 {
00095     tList_data pp;
00096     
00097     memset(&pp, 0, sizeof(tList_data));
00098 
00099     pp.id  = id;
00100     pp.lv  = lv;
00101     pp.sz  = sz;
00102     pp.key = make_Buffer_bystr(key);    // key==NULLなら init_Buffer()
00103     pp.val = make_Buffer_bystr(val);
00104 
00105     if (sz>0) {
00106         pp.ptr = (void*)malloc(sz);
00107         if (pp.ptr!=NULL) {
00108             if (ptr!=NULL) memcpy(pp.ptr, ptr, sz);
00109             else           memset(pp.ptr, 0,   sz);
00110         }
00111     }
00112 
00113     return pp;
00114 }

Here is the caller graph for this function:

tList make_tList_node ( tList_data  ldat  ) 

tList make_tList_node(tList_data ldat)

リスト用ノードを静的に作成する.
ldat はそのまま新しい変数内で使用される.(単純に代入される)

この関数で生成したノードを del_*_tList()関数で削除してはいけない.

Parameters:
ldat ノードデータ
Returns:
作られたノード.

Definition at line 232 of file tlist.c.

References JBXL_NORMAL.

00233 {
00234     tList pp;
00235 
00236     memset(&pp, 0, sizeof(tList));
00237     pp.ldat  = ldat;    
00238     pp.state = JBXL_NORMAL;
00239 
00240     return pp;
00241 }

tList* move_tList_node ( tList pp,
tList node 
)

tList* move_tList_node(tList* pp, tList* node)

nodeを現在のリストから切り離し,ppへ移動する.
nodeを削除しないで del_tList_node(), add_tList_node() を実行するようなもの.

Parameters:
pp 移動先で親となるノードへのポインタ.
node 移動するノードへのポインタ.
Returns:
移動したノードノードへのポインタ.

Definition at line 334 of file tlist.c.

00335 {
00336     if (pp==NULL || node==NULL) return NULL;
00337     
00338     if (node->prev!=NULL) node->prev->next = node->next;
00339     if (node->next!=NULL) node->next->prev = node->prev;
00340 
00341     node->prev = pp;
00342     node->next = pp->next;
00343     if (pp->next!=NULL) pp->next->prev = node;
00344     pp->next   = node;
00345     
00346     return node;
00347 }

tList* new_tList_anchor_node ( void   ) 

Definition at line 386 of file tlist.c.

References init_tList_data(), JBXL_STATE_ANCHOR, and TLIST_ANCHOR_NODE.

00387 {
00388     tList* pp;
00389 
00390     pp = (tList*)malloc(sizeof(tList));
00391     if (pp==NULL) return NULL;
00392     memset(pp, 0, sizeof(tList));
00393     pp->ldat    = init_tList_data();
00394     pp->ldat.id = TLIST_ANCHOR_NODE;
00395     pp->depth   = -1;
00396     pp->state   = JBXL_STATE_ANCHOR;    // TLIST_ANCHOR_NODE と同じ
00397 
00398     return pp;
00399 }

Here is the call graph for this function:

tList* new_tList_node ( void   ) 

tList* new_tList_node(void)

リスト用の空ノードを動的に生成する.

Returns:
生成されたノードへのポインタ.

Definition at line 206 of file tlist.c.

References init_tList_data(), and JBXL_NORMAL.

Referenced by _search_all_node_strval_json(), add_tList_node_bydata(), find_match_tTree_endlist_rcsv(), and find_match_xml_endlist_rcsv().

00207 {
00208     tList* pp;
00209 
00210     pp = (tList*)malloc(sizeof(tList));
00211     if (pp==NULL) return NULL;
00212     memset(pp, 0, sizeof(tList));
00213     pp->ldat  = init_tList_data();
00214     pp->state = JBXL_NORMAL;
00215 
00216     return pp;
00217 }

Here is the call graph for this function:

Here is the caller graph for this function:

void print_tList ( FILE *  fp,
tList pp 
)

void print_tList(File* fp, tList* pp)

リストの表示.ポインタ pp以降の全てのノードを fpに表示する.

Parameters:
fp 出力するファイルへのポインタ.NULLの場合は stderr
pp 表示を開始するノードへのポインタ.

Definition at line 950 of file tlist.c.

00951 {
00952     if (fp==NULL) fp = stderr;
00953 
00954     if (pp!=NULL) {
00955         while(pp!=NULL) {
00956             tList_data ld = pp->ldat;
00957             fprintf(fp, "[%d] [%d] [%s] [%s]\n", ld.id, ld.lv, ld.key.buf, ld.val.buf);
00958             //if (pp->next!=NULL) print_tList(pp->next);
00959             pp = pp->next;
00960         }
00961     }
00962     else {
00963         fprintf(fp, "(List is NULL)\n");
00964     }
00965     return;
00966 }

tList* read_Buffer_tList_file ( const char *  fname  ) 

tList* read_Buffer_tList_file(const char* fname)

ファイルから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す.

Parameters:
fname ファイル名.
Returns:
格納したリストへのポインタ.

Definition at line 2334 of file tlist.c.

References read_Buffer_tList_fp().

02335 {
02336     tList* lp = NULL;
02337     FILE* fp;
02338 
02339     fp = fopen(fname, "rb");
02340     if (fp!=NULL) {
02341         lp = read_Buffer_tList_fp(fp);
02342         fclose(fp);
02343     }
02344     return lp;
02345 }

Here is the call graph for this function:

tList* read_Buffer_tList_fp ( FILE *  fp  ) 

tList* read_Buffer_tList_fp(FILE* fp)

ファイルポインタから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す.

Parameters:
fp ファイルポインタ.
Returns:
格納したリストへのポインタ.

Definition at line 2357 of file tlist.c.

References add_tList_node_Buffer, free_Buffer(), and read_Buffer2_fp().

Referenced by read_Buffer_tList_file().

02358 {
02359     int  cc;
02360     tList*  lp = NULL;
02361     tList*  lt = NULL;
02362     Buffer key, val;
02363 
02364     if (fp==NULL) return NULL;
02365 
02366     cc = read_Buffer2_fp(&key, &val, fp);
02367     while (!feof(fp) && cc) {
02368         lt = add_tList_node_Buffer(lt, key, val);
02369         if (lp==NULL) lp = lt;
02370         free_Buffer(&key);    
02371         free_Buffer(&val);    
02372         cc = read_Buffer2_fp(&key, &val, fp);
02373     }
02374     
02375     free_Buffer(&key);    
02376     free_Buffer(&val);    
02377     return lp;
02378 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* read_index_tList_file ( const char *  fname,
char  deli 
)

tList* read_index_tList_file(const char* fname, char deli)

ファイルから一行ずつ読み込んで,deliを区切り文字にしてリストのキー部とデータ部に格納.
キー部とデータ部の前後の空白,TAB, CR, LF は削除する.
空行はリストに加えない.#で始まる行はリストに加えない

Parameters:
fname ファイル名.
deli 区切り文字
Returns:
格納したリストへのポインタ.

Definition at line 2268 of file tlist.c.

References read_index_tList_fp().

Referenced by read_ldap_config().

02269 {
02270     tList* lp = NULL;
02271     FILE* fp;
02272 
02273     fp = fopen(fname, "rb");
02274     if (fp!=NULL) {
02275         lp = read_index_tList_fp(fp, deli);
02276         fclose(fp);
02277     }
02278     return lp;
02279 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* read_index_tList_fp ( FILE *  fp,
char  deli 
)

tList* read_index_tList_fp(FILE* fp, char deli)

ファイルポインタが示すファイルから一行ずつ読み込んで,deliを区切り文字にしてリストのキー部とデータ部に格納.
キー部とデータ部の前後の空白,TAB, CR, LF は削除する.
空行はリストに加えない.#で始まる行はリストに加えない

Parameters:
fp ファイルポインタ.
deli 区切り文字
Returns:
格納したリストへのポインタ.

Definition at line 2295 of file tlist.c.

References add_tList_node_byBuffer(), awk_Buffer(), del_all_tList(), free_Buffer(), pack_Buffer(), and read_tList_fp().

Referenced by read_index_tList_file().

02296 {
02297     Buffer key, val;
02298     Buffer fst, snd;
02299     tList* pl;
02300     tList* pp;
02301     tList* lt = NULL;
02302 
02303     pp = pl = read_tList_fp(fp, 1);
02304     while (pp!=NULL) {
02305         fst = awk_Buffer(pp->ldat.key, deli, 1);
02306         snd = awk_Buffer(pp->ldat.key, deli, 2);
02307         key = pack_Buffer(fst, ' ');
02308         val = pack_Buffer(snd, ' ');
02309         if (lt==NULL) lt = add_tList_node_byBuffer(NULL, 0, 0, key, val, NULL, 0);
02310         else               add_tList_node_byBuffer(lt,   0, 0, key, val, NULL, 0);
02311     
02312         free_Buffer(&key);
02313         free_Buffer(&val);
02314         free_Buffer(&fst);
02315         free_Buffer(&snd);
02316         
02317         pp = pp->next;
02318     }
02319     del_all_tList(&pl);
02320 
02321     return lt;
02322 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* read_tList_file ( const char *  fname,
int  mode 
)

tList* read_tList_file(const char* fname, int mode)

ファイルから一行ずつ読み込んでリストのキー部に格納.空行はリストに加えない.

Parameters:
fname ファイル名.
mode 0: ファイルをそのまま読み込む.
mode 1: 先頭が # の行はリストに加えない.また前後の空白を削除し,その他の連続する空白も1つの空白に変換する.
さらにタブは一個の空白として処理される.
mode 2: 1の場合に加えて,途中の # 以降も無視する
Returns:
格納したリストへのポインタ.

Definition at line 2178 of file tlist.c.

References read_tList_fp().

Referenced by read_ipaddr_file().

02179 {
02180     tList* lp = NULL;
02181     FILE* fp;
02182 
02183     fp = fopen(fname, "rb");
02184     if (fp!=NULL) {
02185         lp = read_tList_fp(fp, mode);
02186         fclose(fp);
02187     }
02188 
02189     return lp;
02190 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* read_tList_fp ( FILE *  fp,
int  mode 
)

tList* read_tList_fp(FILE* fp, int mode)

ファイルポインタが示すファイルから一行ずつ読み込んでリストのキー部に格納.
空行はリストに加えない.

Parameters:
fp ファイルポインタ.
mode 0: ファイルをそのまま読み込む.
mode 1: 先頭が # の行はリストに加えない.また前後の空白を削除し,その他の連続する空白も1つの空白に変換する.
また,タブは一個の空白として処理される.
mode 2: 1の場合に加えて,途中の # 以降も無視する
Returns:
格納したリストへのポインタ.
Bug:
ディレクトリを読ませると,戻ってこない.

Definition at line 2210 of file tlist.c.

References add_tList_node_str, LBUF, and pack_char.

Referenced by read_index_tList_fp(), read_ipaddr_fp(), and read_tList_file().

02211 {
02212     char    val[LBUF+1];
02213     char*   str;
02214     tList*  lp = NULL;
02215     tList*  lt = NULL;
02216 
02217     if (fp==NULL) return NULL;
02218 
02219     str = fgets(val, LBUF, fp);     // str is unused
02220     while (!feof(fp)) {
02221         if (mode>0) {
02222             if (mode>1) {
02223                 int i;
02224                 for (i=0; i<(int)strlen(val); i++) {
02225                     if (val[i]=='#') {
02226                         val[i] = '\0';
02227                         break;
02228                     }
02229                     if (i>=LBUF) break;
02230                 }
02231             }
02232             str = pack_char(val, ' ');
02233         }
02234         else {
02235             str = (char*)malloc(LBUF+1);
02236             if (str!=NULL) strncpy(val, str, LBUF);
02237         }
02238 
02239         if (str!=NULL) {
02240             if (strlen(str)>0) {    // 空行のチェック
02241                 if (mode==0 || str[0]!='#') {
02242                     lt = add_tList_node_str(lt, str, NULL);
02243                     if (lp==NULL) lp = lt;
02244                 }
02245             }
02246             free(str);
02247         }
02248         str = fgets(val, LBUF, fp);     // str is unused
02249     }
02250     
02251     return lp;
02252 }

Here is the caller graph for this function:

int replace_value_tList ( tList list,
const char *  key,
int  no,
const char *  srcval,
char *  value 
)

int replace_value_tList(tList* list, const char* key, int no, const char* srcval, char* value)

リスト(lt)中の no番目の keyノードの値の srcvalの部分を value に置き換える.

no が 0以下の場合は,全ての keyノードの値に対して置き換えが行われる.

Parameters:
list 処理対象のリスト
key 置き換えを行うノードのキー部.大文字,小文字を区別しない.
srcval 置き換え対象の文字列.NULLなら指定した項目の文字列全体.
value 置き換えを行う文字列.
no 何個目のノードを置き換えるか.1から数える.0以下の場合はkeyが一致する全てのノードを置き換える
Return values:
設定されたノードの数 指定されたノードが存在しない場合は(追加された場合も)0
負数 エラー

Definition at line 1786 of file tlist.c.

References JBXL_ARGS_ERROR, OFF, replace_value_tList_node(), set_value_tList(), and strncasecmp_tList().

01787 {
01788     int  cn = 0;
01789     tList* pm;
01790 
01791     if (list==NULL || key==NULL || value==NULL) return JBXL_ARGS_ERROR;
01792     if (srcval==NULL) {
01793         return set_value_tList(list, key, no, value, OFF);
01794     }
01795 
01796     if (no>0) {
01797         pm = strncasecmp_tList(list, key, 0, no);
01798         if (pm!=NULL) {
01799             int rep = replace_value_tList_node(pm, srcval, value);
01800             if (rep) cn = 1;
01801         }
01802     }
01803     else {      // no<=0
01804         int nn = 1;
01805         cn = 0;
01806         pm = strncasecmp_tList(list, key, 0, nn);
01807         while (pm!=NULL) {
01808             int rep = replace_value_tList_node(pm, srcval, value);
01809             if (rep) cn++;
01810             pm = strncasecmp_tList(list, key, 0, ++nn);
01811         }
01812     }
01813     
01814     return cn;
01815 }

Here is the call graph for this function:

int replace_value_tList_node ( tList lp,
const char *  srcval,
const char *  value 
)

int replace_value_tList_node(tList* lp, const char* srcval, const char* value)

lt->ldat.val のsrcval部分を value に置き換える.

Definition at line 1824 of file tlist.c.

References FALSE, free_Buffer(), replace_sBuffer, set_value_tList_node(), and TRUE.

Referenced by replace_value_tList().

01825 {
01826     if (lp==NULL || value==NULL) return FALSE;
01827     if (srcval==NULL) {
01828         return set_value_tList_node(lp, value);
01829     }
01830 
01831     Buffer buf = replace_sBuffer(lp->ldat.val, srcval, value);
01832     free_Buffer(&lp->ldat.val);
01833     lp->ldat.val = buf;
01834     
01835     return TRUE;
01836 }

Here is the call graph for this function:

Here is the caller graph for this function:

int save_Buffer_tList_file ( const char *  fname,
tList lp 
)

int save_Buffer_tList_file(const char* fname, tList* lp)

リストのキー部とバッファ部の Buffer型変数をファイルへ書き込む.
ファイルが既にある場合は,追加書き込みされる.

Parameters:
fname ファイル名.
lp 書き込みを行うリストデータへのポインタ.
Return values:
TRUE 書き込み成功.
FALSE 書き込み失敗

Definition at line 2394 of file tlist.c.

References FALSE, and save_Buffer_tList_fp().

02395 {
02396     int  ret=FALSE;
02397     FILE* fp;
02398 
02399     fp = fopen(fname, "ab");
02400     if (fp!=NULL) {
02401         ret = save_Buffer_tList_fp(fp, lp);
02402         fclose(fp);
02403     }
02404     return ret;
02405 }

Here is the call graph for this function:

int save_Buffer_tList_fp ( FILE *  fp,
tList lp 
)

int save_Buffer_tList_fp(FILE* fp, tList* lp)

リストのキー部とバッファ部の Buffer型変数をファイルポンタが指すファイルへ書き込む.
ファイルが既にある場合は,追加書き込みされる.

Parameters:
fp ファイルポインタ.
lp 書き込みを行うリストデータへのポインタ.
Return values:
TRUE 書き込み成功.
FALSE 書き込み失敗

Definition at line 2421 of file tlist.c.

References FALSE, save_Buffer2_fp(), and TRUE.

Referenced by save_Buffer_tList_file().

02422 {
02423     int cc=TRUE;
02424 
02425     if (fp==NULL) return FALSE;
02426 
02427     while (lp!=NULL && cc) {
02428         cc = save_Buffer2_fp(lp->ldat.key, lp->ldat.val, fp);    
02429         lp = lp->next;
02430     }
02431 
02432     if (!cc) return FALSE;
02433     return TRUE;
02434 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* search_id_tList ( tList pl,
int  id,
int  no 
)

tList* search_id_tList(tList* pl, int id, int no)

リストの中から no番目の idノード(ldat.id)を探し出し,tListのポインタを返す.
key はケースインセンシティブ.

Parameters:
pl 検索を行うリストへのポインタ.
id ノードのid値.
no 何番目のノードを取り出すか指定する.1から数える.
Returns:
tList へのポインタ

Definition at line 1579 of file tlist.c.

Referenced by jbxl_fprint_state(), and jbxl_fprint_state_jp().

01580 {
01581     int nn = 0;
01582 
01583     if (pl==NULL) return NULL;
01584     if (no<=0) no = 1;
01585 
01586     while (pl!=NULL) {
01587         if (pl->ldat.id == id) {
01588             nn++;
01589             if (no==nn) return pl;
01590         }
01591         pl = pl->next;
01592     }
01593     return NULL;
01594 }

Here is the caller graph for this function:

tList* search_key_tList ( tList pl,
const char *  key,
int  no 
)

tList* search_key_tList(tList* pl, const char* key, int no)

リストの中から no番目の keyノード(ldat.key)を探し出し,tListへのポインタを返す.
key はケースインセンシティブ.

Parameters:
pl 検索を行うリストへのポインタ.
key ノードキー.大文字,小文字を区別しない.
no 何番目のノードを取り出すか指定する.1から数える.
Returns:
tList へのポインタ

Definition at line 1610 of file tlist.c.

References strncasecmp_tList().

Referenced by find_protocol_end().

01611 {
01612     tList* pp;
01613     if (pl==NULL || key==NULL) return NULL;
01614     if (no<=0) no = 1;
01615     
01616     pp = strncasecmp_tList(pl, key, 0, no);        // 完全一致
01617     
01618     return pp;
01619 }

Here is the call graph for this function:

Here is the caller graph for this function:

void set_tList_node_byBuffer ( tList pp,
int  id,
int  lv,
Buffer  key,
Buffer  val,
void *  ptr,
int  sz 
)

void set_tList_node_byBuffer(tList* pp, int id, int lv, Buffer key, Buffer val, void* ptr, int sz)

リストのノードに値を設定する.それぞれのデータは複製されて設定される.
key.buf, val.bufが NULLの場合は,その値はノードには設定されない.

Parameters:
pp ノード値を設定するノードへのポインタ
id ノードのID
lv ノードのデータ
key ノードのキー (Buffer) 複製
val ノードのデータ (Buffer) 複製
ptr 汎用データへのポインタ 複製
sz *ptr のサイズ

Definition at line 587 of file tlist.c.

References dup_Buffer(), and free_Buffer().

Referenced by update_tList_node_byBuffer().

00588 {
00589     if (pp==NULL) return;
00590 
00591     pp->ldat.id = id;
00592     pp->ldat.lv = lv;
00593 
00594     if (pp->ldat.key.buf!=NULL) {
00595         free_Buffer(&(pp->ldat.key));
00596         pp->ldat.key = dup_Buffer(key);
00597     }
00598 
00599     if (pp->ldat.val.buf!=NULL) {
00600         free_Buffer(&(pp->ldat.val));
00601         pp->ldat.val = dup_Buffer(val);
00602     }
00603 
00604     if (sz>0 && ptr!=NULL) {
00605         if (pp->ldat.ptr!=NULL) free(pp->ldat.ptr);
00606         pp->ldat.ptr = (void*)malloc(sz);
00607         if (pp->ldat.ptr!=NULL) memcpy(pp->ldat.ptr, ptr, sz);
00608     }
00609 }

Here is the call graph for this function:

Here is the caller graph for this function:

void set_tList_node_bydata ( tList node,
tList_data  dat 
)

void set_tList_node_bydata(tList* node, tList_data dat)

リストのノードに値を設定する.
ldat は指定されたものがそのまま使用される.

Parameters:
node 設定するノードへのポインタ.
dat 設定するノードデータ.このデータがそのまま使用される.

Definition at line 523 of file tlist.c.

References free_tList_data().

Referenced by update_tList_node_bydata().

00524 {
00525     if (node==NULL) return;
00526 
00527     free_tList_data(&(node->ldat));
00528     node->ldat = dat;
00529 }

Here is the call graph for this function:

Here is the caller graph for this function:

void set_tList_node_bystr ( tList pp,
int  id,
int  lv,
const char *  key,
const char *  val,
void *  ptr,
int  sz 
)

void set_tList_node_bystr(tList* pp, int id, int lv, const char* key, const char* val, void* ptr, int sz)

文字列データから リストのノードに値を設定する.それぞれのデータは複製されて設定される.
key, valが NULLの場合は,その値はノードは設定されない.

Parameters:
pp ノード値を設定するノードへのポインタ
id ノードのID
lv ノードのデータ
key ノードのキー 複製
val ノードのデータ 複製
ptr 汎用データへのポインタ 複製
sz *ptr のサイズ

Definition at line 547 of file tlist.c.

References free_Buffer(), and make_Buffer_bystr.

Referenced by update_tList_node_bystr().

00548 {
00549     if (pp==NULL) return;
00550 
00551     pp->ldat.id = id;
00552     pp->ldat.lv = lv;
00553     pp->ldat.sz = sz;
00554 
00555     if (key!=NULL) {
00556         free_Buffer(&(pp->ldat.key));
00557         pp->ldat.key = make_Buffer_bystr(key);
00558     }
00559     if (val!=NULL) {
00560         free_Buffer(&(pp->ldat.val));
00561         pp->ldat.val = make_Buffer_bystr(val);
00562     }
00563 
00564     if (sz>0 && ptr!=NULL) {
00565         if (pp->ldat.ptr!=NULL) free(pp->ldat.ptr);
00566         pp->ldat.ptr = (void*)malloc(sz);
00567         if (pp->ldat.ptr!=NULL) memcpy(pp->ldat.ptr, ptr, sz);
00568     }
00569 }

Here is the call graph for this function:

Here is the caller graph for this function:

int set_value_tList ( tList list,
const char *  key,
int  no,
const char *  value,
int  add_mode 
)

Definition at line 1717 of file tlist.c.

References add_tList_node_str, JBXL_ARGS_ERROR, ON, set_value_tList_node(), and strncasecmp_tList().

Referenced by replace_value_tList(), and set_protocol_header().

01718 {
01719     int  cn = 0;
01720     tList* pm;
01721 
01722     if (list==NULL || key==NULL || value==NULL) return JBXL_ARGS_ERROR;
01723 
01724     if (no>0) {
01725         pm = strncasecmp_tList(list, key, 0, no);
01726         if (pm!=NULL) {
01727             int rep = set_value_tList_node(pm, value);
01728             if (rep) cn = 1;
01729         }
01730     }
01731     else {        // no<=0
01732         int nn = 1;
01733         cn = 0;
01734         pm = strncasecmp_tList(list, key, 0, nn);
01735         while (pm!=NULL) {
01736             int rep = set_value_tList_node(pm, value);
01737             if (rep) cn++;
01738             pm = strncasecmp_tList(list, key, 0, ++nn);
01739         }
01740     }
01741 
01742     // Not Found
01743     if (add_mode==ON && cn==0) {
01744         add_tList_node_str(list, key, value);
01745     }
01746 
01747     return cn;
01748 }

Here is the call graph for this function:

Here is the caller graph for this function:

int set_value_tList_node ( tList lp,
const char *  value 
)

int set_value_tList_node(tList* lp, const char* value)

lp->ldat.val に文字列を設定する(置き換える).

Definition at line 1757 of file tlist.c.

References FALSE, free_Buffer(), make_Buffer_bystr, and TRUE.

Referenced by replace_value_tList_node(), and set_value_tList().

01758 {
01759     if (lp==NULL || value==NULL) return FALSE;
01760     
01761     Buffer buf = make_Buffer_bystr(value);
01762     free_Buffer(&lp->ldat.val);
01763     lp->ldat.val = buf;
01764 
01765     return TRUE;
01766 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* strncasecmp_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncasecmp_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードのサーチ.大文字小文字を無視する.
ポインタ pl以降のノードで,キー部の文字列が keyと前方一致(部分的も可)するノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列)
len 1以上: 一致させる長さ.
len TLIST_MATCH_COMPLETE (0): 完全一致.
len TLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
len TLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no 一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1370 of file tlist.c.

References ex_strncasecmp(), and find_tList_end().

01371 {
01372     int nn = 0;
01373 
01374     if (pl==NULL || key==NULL) return NULL;
01375     if (len<=-3) return NULL;
01376     if (no<=0) no = 1;
01377 
01378     pl = find_tList_end(pl);
01379 
01380     while (pl!=NULL) {
01381         if (ex_strncasecmp((char*)(pl->ldat).key.buf, key, len)) {
01382             nn++;
01383             if (no==nn) return pl;
01384         }
01385         pl = pl->prev;
01386     }
01387     return NULL;
01388 }

Here is the call graph for this function:

tList* strncasecmp_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncasecmp_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードのサーチ.大文字小文字を無視する.

ポインタ pl以降のノードで,キー部の文字列が keyと前方一致(部分的も可)するノードの内, no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列)
len 1以上: 一致させる長さ.
len TLIST_MATCH_COMPLETE (0): 完全一致.
len TLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
len TLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no 一致した物の中で何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1121 of file tlist.c.

References ex_strncasecmp().

Referenced by add_resource_list(), buffer_key_tList(), buffer_key_value_tList(), get_max_forwards(), http_proxy_header_analyze(), insert_sip_record_route(), insert_sip_via(), recv_http_header(), recv_https_header(), replace_item_tList(), replace_sip_contact(), replace_sip_contact_dstipport(), replace_value_tList(), search_key_tList(), search_protocol_header(), set_item_tList(), set_max_forwards(), set_value_tList(), and www2browser_relay().

01122 {
01123     int nn = 0;
01124 
01125     if (pl==NULL || key==NULL) return NULL;
01126     if (len<=-3) return NULL;
01127     if (no<=0) no = 1;
01128 
01129     while (pl!=NULL) {
01130         if (ex_strncasecmp((char*)(pl->ldat).key.buf, key, len)) {
01131             nn++;
01132             if (no==nn) return pl;
01133         }
01134         pl = pl->next;
01135     }
01136     return NULL;
01137 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* strncaservscmp_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncaservscmp_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードのサーチ.文字も後方から比べる.大文字小文字を無視.
ポインタ pl以降のノードで,キー部の文字列が keyと後方一致(部分的も可)するノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列)
len 1以上: 一致させる長さ.
len TLIST_MATCH_COMPLETE (0): 完全一致.
len TLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
len TLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no 一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1448 of file tlist.c.

References ex_strncaservscmp(), and find_tList_end().

01449 {
01450     int nn = 0;
01451 
01452     if (pl==NULL || key==NULL) return NULL;
01453     if (len<=-3) return NULL;
01454     if (no<=0) no = 1;
01455 
01456     pl = find_tList_end(pl);
01457 
01458     while (pl!=NULL) {
01459         if (ex_strncaservscmp((char*)(pl->ldat).key.buf, key, len)) {
01460             nn++;
01461             if (no==nn) return pl;
01462         }
01463         pl = pl->prev;
01464     }
01465     return NULL;
01466 }

Here is the call graph for this function:

tList* strncaservscmp_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncaservscmp_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードのサーチ.文字の後方から比べる.大文字小文字を無視.

ポインタ pl以降のノードで,キー部の文字列が keyと後方一致(部分的も可)するノードの内, no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列)
len 1以上: 一致させる長さ.
len TLIST_MATCH_COMPLETE (0): 完全一致.
len TLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
len TLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no 一致した物の中で何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1199 of file tlist.c.

References ex_strncaservscmp().

01200 {
01201     int nn = 0;
01202 
01203     if (pl==NULL || key==NULL) return NULL;
01204     if (len<=-3) return NULL;
01205     if (no<=0) no = 1;
01206 
01207     while (pl!=NULL) {
01208         if (ex_strncaservscmp((char*)(pl->ldat).key.buf, key, len)) {
01209             nn++;
01210             if (no==nn) return pl;
01211         }
01212         pl = pl->next;
01213     }
01214     return NULL;
01215 }

Here is the call graph for this function:

tList* strncmp_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncmp_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードのサーチ.
ポインタ pl以降のノードで,キー部の文字列が keyと前方一致(部分的も可)するノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列)
len 1以上: 一致させる長さ.
len TLIST_MATCH_COMPLETE (0): 完全一致.
len TLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
len TLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no 一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1331 of file tlist.c.

References ex_strncmp(), and find_tList_end().

01332 {
01333     int nn = 0;
01334 
01335     if (pl==NULL || key==NULL) return NULL;
01336     if (len<=-3) return NULL;
01337     if (no<=0) no = 1;
01338 
01339     pl = find_tList_end(pl);
01340     
01341     while (pl!=NULL) {
01342         if (ex_strncmp((char*)(pl->ldat).key.buf, key, len)) {
01343             nn++;
01344             if (no==nn) return pl;
01345         }
01346         pl = pl->prev;
01347     }
01348     return NULL;
01349 }

Here is the call graph for this function:

tList* strncmp_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncmp_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードのサーチ.

ポインタ pl以降のノードで,キー部の文字列が keyと前方一致(部分的も可)するノードの内, no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列)
len 1以上: 一致させる長さ.
len TLIST_MATCH_COMPLETE (0): 完全一致.
len TLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
len TLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no 一致した物の中で何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1082 of file tlist.c.

References ex_strncmp().

Referenced by insert_sip_record_route(), insert_sip_via(), restore_protocol_contents(), restore_protocol_header(), set_protocol_header(), update_tList_node_byBuffer(), update_tList_node_bydata(), and update_tList_node_bystr().

01083 {
01084     int nn = 0;
01085 
01086     if (pl==NULL || key==NULL) return NULL;
01087     if (len<=-3) return NULL;
01088     if (no<=0) no = 1;
01089 
01090     while (pl!=NULL) {
01091         if (ex_strncmp((char*)pl->ldat.key.buf, key, len)) {
01092             nn++;
01093             if (no==nn) return pl;
01094         }
01095         pl = pl->next;
01096     }
01097     return NULL;
01098 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* strnrvscmp_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strnrvscmp_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードのサーチ.文字も後方から比べる.
ポインタ pl以降のノードで,キー部の文字列が keyと後方一致(部分的も可)するノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列)
len 1以上: 一致させる長さ.
len TLIST_MATCH_COMPLETE (0): 完全一致.
len TLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
len TLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no 一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1409 of file tlist.c.

References ex_strnrvscmp(), and find_tList_end().

01410 {
01411     int nn = 0;
01412 
01413     if (pl==NULL || key==NULL) return NULL;
01414     if (len<=-3) return NULL;
01415     if (no<=0) no = 1;
01416 
01417     pl = find_tList_end(pl);
01418 
01419     while (pl!=NULL) {
01420         if (ex_strnrvscmp((char*)(pl->ldat).key.buf, key, len)) {
01421             nn++;
01422             if (no==nn) return pl;
01423         }
01424         pl = pl->prev;
01425     }
01426     return NULL;
01427 }

Here is the call graph for this function:

tList* strnrvscmp_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strnrvscmp_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードのサーチ.文字の後方から比べる.

ポインタ pl以降のノードで,キー部の文字列が keyと後方一致(部分的も可)するノードの内, no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー(文字列)
len 1以上: 一致させる長さ.
len TLIST_MATCH_COMPLETE (0): 完全一致.
len TLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
len TLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no 一致した物の中で何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1160 of file tlist.c.

References ex_strnrvscmp().

01161 {
01162     int nn = 0;
01163 
01164     if (pl==NULL || key==NULL) return NULL;
01165     if (len<=-3) return NULL;
01166     if (no<=0) no = 1;
01167 
01168     while (pl!=NULL) {
01169         if (ex_strnrvscmp((char*)(pl->ldat).key.buf, key, len)) {
01170             nn++;
01171             if (no==nn) return pl;
01172         }
01173         pl = pl->next;
01174     }
01175     return NULL;
01176 }

Here is the call graph for this function:

tList* strstr_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strstr_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードの部分文字列サーチ.

ポインタ pl以降のノードで,キー部の文字列または keyの文字列が相手の文字列に含まれる.
ノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー.
len 0以上: key が plのキーに含まれるかどうか検査する.
len 負数: plのキーが Keyに含まれるかどうか検査する.
no 一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1487 of file tlist.c.

References find_tList_end().

01488 {
01489     int nn = 0;
01490 
01491     if (pl==NULL || key==NULL) return NULL;
01492     if (no<=0) no = 1;
01493 
01494     pl = find_tList_end(pl);
01495 
01496     while (pl!=NULL) {
01497         if (len>=0) {
01498             if (strstr((char*)(pl->ldat).key.buf, key)!=NULL) {
01499                 nn++;
01500                 if (no==nn) return pl;
01501             }
01502         }
01503         else if (len<0) {
01504             if (strstr(key, (char*)(pl->ldat).key.buf)!=NULL) {
01505                 nn++;
01506                 if (no==nn) return pl;
01507             }
01508         }
01509 
01510         pl = pl->prev;
01511     }
01512     return NULL;
01513 }

Here is the call graph for this function:

tList* strstr_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strstr_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードの部分文字列サーチ.

ポインタ pl以降のノードで,キー部の文字列または keyの文字列が相手の文字列に含まれるノードの内, no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー.
len 0以上: key が plのキーに含まれるかどうか検査する.
len 負数: plのキーが Keyに含まれるかどうか検査する.
no 一致した物の中で何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1236 of file tlist.c.

01237 {
01238     int nn = 0;
01239 
01240     if (pl==NULL || key==NULL) return NULL;
01241     if (no<=0) no = 1;
01242 
01243     while (pl!=NULL) {
01244         if (len>=0) {
01245             if (strstr((char*)(pl->ldat).key.buf, key)!=NULL) {
01246                 nn++;
01247                 if (no==nn) return pl;
01248             }
01249         }
01250         else if (len<0) {
01251             if (strstr(key, (char*)(pl->ldat).key.buf)!=NULL) {
01252                 nn++;
01253                 if (no==nn) return pl;
01254             }
01255         }
01256 
01257         pl = pl->next;
01258     }
01259     return NULL;
01260 }

tList* strstrcase_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strstrcase_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数による後方からのノードの部分文字列サーチ.大文字小文字を無視.

ポインタ pl以降のノードで,キー部の文字列または keyの文字列が相手の文字列に含まれる.
ノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー.
len 0以上: key が plのキーに含まれるかどうか検査する.
len 負数: plのキーが Keyに含まれるかどうか検査する.
no 一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1534 of file tlist.c.

References find_tList_end(), and strstrcase().

01535 {
01536     int nn = 0;
01537 
01538     if (pl==NULL || key==NULL) return NULL;
01539     if (no<=0) no = 1;
01540 
01541     pl = find_tList_end(pl);
01542 
01543     while (pl!=NULL) {
01544         if (len>=0) {
01545             if (strstrcase((char*)(pl->ldat).key.buf, key)!=NULL) {
01546                 nn++;
01547                 if (no==nn) return pl;
01548             }
01549         }
01550         else if (len<0) {
01551             if (strstrcase(key, (char*)(pl->ldat).key.buf)!=NULL) {
01552                 nn++;
01553                 if (no==nn) return pl;
01554             }
01555         }
01556 
01557         pl = pl->prev;
01558     }
01559     return NULL;
01560 }

Here is the call graph for this function:

tList* strstrcase_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strstrcase_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードの部分文字列サーチ.大文字小文字を無視.

ポインタ pl以降のノードで,キー部の文字列または keyの文字列が相手の文字列に含まれるノードの内, no番目にあるのを捜し出す.

Parameters:
pl サーチを開始するノードへのポインタ.
key サーチキー.
len 0以上: key が plのキーに含まれるかどうか検査する.
len 負数: plのキーが Keyに含まれるかどうか検査する.
no 一致した物の中で何番目の物を返すか指定する.1から数える.
Returns:
一致したノードへのポインタ
Return values:
NULL 一致したものが無い

Definition at line 1281 of file tlist.c.

References strstrcase().

01282 {
01283     int nn = 0;
01284 
01285     if (pl==NULL || key==NULL) return NULL;
01286     if (no<=0) no = 1;
01287 
01288     while (pl!=NULL) {
01289         if (len>=0) {
01290             if (strstrcase((char*)(pl->ldat).key.buf, key)!=NULL) {
01291                 nn++;
01292                 if (no==nn) return pl;
01293             }
01294         }
01295         else if (len<0) {
01296             if (strstrcase(key, (char*)(pl->ldat).key.buf)!=NULL) {
01297                 nn++;
01298                 if (no==nn) return pl;
01299             }
01300         }
01301 
01302         pl = pl->next;
01303     }
01304     return NULL;
01305 }

Here is the call graph for this function:

tList* swap_tList_node ( tList pp1,
tList pp2 
)

tList* swap_tList_node(tList* pp1, tList* pp2)

pp1ノード と pp2ノード のノードデータを入れ替える.

Definition at line 356 of file tlist.c.

Referenced by get_dir_files().

00357 {
00358     if (pp1==NULL || pp2==NULL) return NULL;
00359 
00360     tList_data swp = pp1->ldat;
00361     pp1->ldat = pp2->ldat;
00362     pp2->ldat = swp;
00363 
00364     return pp1;
00365 /*
00366     if (*pp1==NULL || *pp2==NULL) return NULL;
00367 
00368     tList* p1 = dup_tList_node(*pp1);
00369     tList* p2 = dup_tList_node(*pp2);
00370 
00371     insert_tList(*pp1, p2);
00372     insert_tList(*pp2, p1);
00373 
00374     del_tList_node(pp1);
00375     del_tList_node(pp2);
00376 
00377     *pp1 = p2;
00378     *pp2 = p1;
00379 
00380     return p2;
00381 */
00382 }

Here is the caller graph for this function:

tList* update_tList_node ( tList pp,
tList pt 
)

tList* update_tList_node(tList* pp, tList* pt)

ppを pt->keyで検索し,該当ノードがあればノードをコピーする.無ければ最後にノードを追加する(new).

Parameters:
pp 検索を開始するノードへのポインタ.
pt 設定するノードへのポインタ.検索キーは pt->key
Returns:
設定または追加したノードへのポインタ

Definition at line 622 of file tlist.c.

References update_tList_node_byBuffer().

00623 {
00624     tList* pm;
00625     tList_data ldat;
00626 
00627     if (pt==NULL) return pp;
00628     
00629     ldat = pp->ldat;
00630     pm = update_tList_node_byBuffer(pp, ldat.id, ldat.lv, ldat.key, ldat.val, ldat.ptr, ldat.sz);
00631     
00632     return pm;
00633 }

Here is the call graph for this function:

tList* update_tList_node_byBuffer ( tList pp,
int  id,
int  lv,
Buffer  key,
Buffer  val,
void *  ptr,
int  sz 
)

tList* update_tList_node_byBuffer(tList* pp, int id, int lv, Buffer key, Buffer val, void* ptr, int sz)

ppを key.bufで検索し,該当ノードがあればノードを設定する.無ければ最後にノードを追加する(new).
それぞれのデータは複製される.

Parameters:
pp 検索を開始するノードへのポインタ.
id ノードのID
lv ノードのデータ
key ノードのキー (Buffer) 複製
val ノードのデータ (Buffer) 複製
ptr 汎用データへのポインタ 複製
sz *ptr のサイズ
Returns:
設定または追加したノードへのポインタ

Definition at line 719 of file tlist.c.

References add_tList_node_byBuffer(), Buffer::buf, find_tList_end(), set_tList_node_byBuffer(), and strncmp_tList().

Referenced by update_tList_node().

00720 {
00721     tList* pm = NULL;
00722 
00723     if (pp==NULL || key.buf==NULL) return NULL;
00724 
00725     pm = strncmp_tList(pp, (char*)key.buf, 0, 1);
00726     if (pm!=NULL) set_tList_node_byBuffer(pm, id, lv, key, val, ptr, sz);
00727     else {
00728         pm = find_tList_end(pp);
00729         pm = add_tList_node_byBuffer(pm, id, lv, key, val, ptr, sz);
00730     }
00731     
00732     return pm;
00733 }

Here is the call graph for this function:

Here is the caller graph for this function:

tList* update_tList_node_bydata ( tList pp,
char *  srch,
tList_data  ldat 
)

tList* update_tList_node_bydata(tList* pp, char* srch, tList_data ldat)

ppを srchで検索し,該当ノードがあればノードを設定する.無ければ最後にノードを追加する(new).
ldat は指定されたものがそのまま使用される.

Parameters:
pp 検索を開始するノードへのポインタ.
srch 検索キー
ldat 追加するノードデータ.このデータがそのまま使用される.
Returns:
設定または追加したノードへのポインタ

Definition at line 649 of file tlist.c.

References add_tList_node_bydata(), find_tList_end(), set_tList_node_bydata(), and strncmp_tList().

00650 {
00651     tList* pm = NULL;
00652 
00653     if (pp==NULL || srch==NULL) return NULL;
00654 
00655     pm = strncmp_tList(pp, srch, 0, 1);
00656     if (pm!=NULL) set_tList_node_bydata(pm, ldat);
00657     else {
00658         pm = find_tList_end(pp);
00659         pm = add_tList_node_bydata(pm, ldat);
00660     }
00661     
00662     return pm;
00663 }

Here is the call graph for this function:

tList* update_tList_node_bystr ( tList pp,
int  id,
int  lv,
const char *  key,
const char *  val,
void *  ptr,
int  sz 
)

tList* update_tList_node_bystr(tList* pp, int id, int lv, const char* key, const char* val, void* ptr, int sz)

ppを keyで検索し,該当ノードがあればノードを設定する.無ければ最後にノードを追加する(new).
それぞれのデータは複製される.

Parameters:
pp 検索を開始するノードへのポインタ.
id ノードのID
lv ノードのデータ
key ノードのキー.検索キー 複製
val ノードのデータ (Buffer) 複製
ptr 汎用データへのポインタ 複製
sz *ptr のサイズ
Returns:
設定または追加したノードへのポインタ

Definition at line 683 of file tlist.c.

References add_tList_node_bystr(), find_tList_end(), set_tList_node_bystr(), and strncmp_tList().

00684 {
00685     tList* pm = NULL;
00686 
00687     if (pp==NULL || key==NULL) return NULL;
00688 
00689     pm = strncmp_tList(pp, key, 0, 1);
00690     if (pm!=NULL) {
00691         set_tList_node_bystr(pm, id, lv, NULL, val, ptr, sz);
00692     }
00693     else {
00694         pm = find_tList_end(pp);
00695         pm = add_tList_node_bystr(pm, id, lv, key, val, ptr, sz);
00696     }
00697     
00698     return pm;
00699 }

Here is the call graph for this function:


Generated on 15 Nov 2023 for JunkBox_Lib by  doxygen 1.6.1