
Заготовки по С / Динамические структуры / GDSL / Документация
.pdf
4.10 Doubly-linked list |
|
module |
117 |
|
L ust be a valid gdslmanipulationlist |
|
|
||
Pre ondition: |
|
|
|
|
Parameters: |
|
|
|
|
L The list to destroy the tail from |
|
|
||
Returns: |
|
|
|
|
the modi ed list L in ase of su ess. |
|
|
||
NULL if L is empty. |
|
|
|
|
See also: |
(p. 109) |
|
|
|
sl_list_ |
|
|
||
gdsl_list_destroyallo ()head() |
|
|
||
4.10.2.17 |
list_ |
gdsl_list_delete (gdsl_list_t L, |
|
|
gdslitularislistO(remoLelemompareforallovthedn from()fromrst(pfun.elemenL109)aandlist.t.dealloCOMPE equatedltoFusingVALUE, onstthebyvoidFREEusing_VALUECOMPFfuntionF) . |
||||
Note:passIfSearDeleteEisComplexity:dhfound,intoatopartigdslthe |
|
|
|
|
PPrearameters:COMPLLondition:Theust listbeFatovalidThedestroy|Lgdslomparison| / 2the)listelementfu& COMPtionfromusedF to!= NULLndthe elemenwitho destroy |
|
VALUE The value used to ompare the element to destroy |
|
Returns: |
|
the modi ed list L if he element is found. |
|
NULL if he element to destroy is not found. |
|
See also: |
|
sl_list_allo ()(p. 109) |
|
gdsl_list_destroy |
head() |
tail() |
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

118 |
gdsl Module Do umen |
|
4.10.2.18 |
element_t gdsl_list_sear h ( |
gdsl_list_tation, |
Note:SearompareComplexity:h theforalla L'srstpartigdsleleO(mularenomparettelemEwithequalnt.funintotoVALUEa tlistCOMP. in the Flist, L,onstby usingvoid COMPVALUEF to)
Londition:TheustVALUElistbeFatovalidThesearLgdslomparisonh/the2)listelement fun&COMPintion usedF !=to NULLompare |
L's element with |
|||||||
Parameters:re COMP |
| | |
|
|
|
|
|
|
|
VALUE The value to ompare L's elemenst with |
|
|
|
|
||||
the rst founded element E in ase of su ess. |
|
|
|
|
||||
Returns: |
|
|
|
|
|
|
|
|
NULL in ase the sear hed elemen E was not found. |
|
|
||||||
See also: |
|
by |
position()(p. 118) |
|
|
|
|
|
|
|
ax() . |
|
|
|
|
|
|
gdsl_list_sear h_min()(p. 119) |
|
|
|
|
||||
4.10.2.19 |
gdsl_ |
element |
gdsl |
list sear h_by_position ( onst |
||||
|
t L, ulong POS) |
|
|
|
|
|||
Sear h for an elemenlistby its |
position |
in a list. |
|
|
|
|
||
Note: |
|
|
|
|
|
|
|
|
re Complexitondition:ust bey:a validO(|Lgdsl| / 2_)list_t & POS |
|
|
|
|
||||
Parameters:NULLthePOSL TheelementTheiflistPOSpositiontoatsearthe hPOSwherethe-thelementispositiontheelemenininthe0tolist&searPOSL.h |
|
= |
L |
| |
||||
Returns: |
|
|
|
> |
< |
|
| |
> |LGenerated| or POS <=Thu0. Jun 22 11:15:30 2006 for gdsl by Doxygen

|
4.10 D ubly-linked list manipulation module |
|
119 |
||||
|
See also: |
|
|
|
|
|
|
|
|
|
|
()(p. 118) |
|
|
|
|
|
|
|
ax() . |
|
|
|
|
gdsl_list_sear h min()(p. 119) |
max ( onst |
|
||||
4.10.2.20 |
gdsl_li |
t t gdsl_list sear h |
|
||||
|
|
|
t L, gdsl |
ompare fun _t COMP_F) |
|
||
|
Sear h the greatestelement of the |
list L, by using COMP_F to ompare L's |
|||||
|
|
for the atest |
ment of a . |
|
|
||
|
elements with. |
|
|
|
|
||
Note: |
|
|
|
|
|
|
Parameters:re COMPLComplexity:ondition:Theust listbeFatovalidTheO(searLgdslomparisonh)thelistelementusingtfu& COMPintionto_useF!=toNULLompare L's element with |
||||||
Returns: |
|
| | |
|
|
|
|
the highest el |
ent of L, by |
COMP_F fun tion. |
||||
NULL if L is empty. |
|
|
||||
See also: |
|
|
()(p. 118) |
|
||
gdsl_list_sear h |
|
by position()(p. 118) |
||||
|
min()(p. 119) |
|||||
4.10.2.21 |
|
element t gdsl_list sear h min ( onst |
||||
|
|
gdsl_list |
|
t L, gdsl |
ompare fun _t COMP_F) |
|
Sear h |
for the lowest element of a . |
|||||
the lowest element of the list L, by using COMP_F to ompare L's |
||||||
elements with. |
|
|
|
|
||
Note: |
|
|
|
|
|
|
LComplexitondition:TheustonlistbeThuy:atovalidJunO(sear22Lgdslh11:15:30)thelistelement2006t &forCOMPingdsl byFDoxygen!= NULL |
||||||
PGeneratedarameters:re |
| | |
|
|
|
||
|
|
|
|
|
|
|

120 |
|
|
|
|
gdsl Module Do umen |
||
|
COMP_F The omparison fun tion to use to |
ompare L's elementationwith |
|
||||
|
the lowest elemen of L, by using COMP_F fun tion. |
||||||
Returns: |
|
|
|
|
|
|
|
|
NULL if L is empty. |
|
|
|
|
||
See also: |
|
()(p. 118) |
|
|
|||
|
gdsl_list_sear h |
|
by |
position()(p. 118) |
|
|
|
|
|
max()(p. 119) |
list_t L, |
||||
4.10.2.22 |
list |
|
t gdsl list sort (gdsl |
||||
|
a list. |
gdsl_ ompare |
fun _t COMP F) |
Sort
Note:the list L using COMP_F to order L's elements.
PreParameters:ComplexitLelementsLCOMPondition:Theust listbethatFy:tovalidTheO(sortare|Lgdslequalsomparison| log(list|Lt|&fun))COMPtion usedF !=toNULLorder &L'sLelementsmustnot ontains
Returns:the sorted list L.
4.10.2.23 element_t gdsl_list_map_forward ( onst
Note:MAParselaston eaxaminatedahSTOP,llL'slistelementselementfromUSERgdslthelemenheadoflistgdslwiththeDATAto.listtUSERtaillistLL,.)gdslfrommapDATAheadmapforwatogumenttfunard()il. The.(ptIf.MAPMAP120) stopsFFfunreturns, andvoidtionreturnsGDSLis alledits-
Pre LComplexitondition:ust bey:a validO(|LGeneratedgdsl| ) list_ont &ThuMAPJun_22F !=11:15:30NULL2006 for gdsl by Doxygen

|
4.10 Doubly-linked list manipulation module |
121 |
|||
|
Parameters: |
|
|
|
|
|
L The list to parse |
|
ea h L's element |
|
|
|
MAP F |
map fun tion to apply |
|
|
|
|
the rst elemen for whi h MAP_F returns GDSL_MAP_STOP. |
|
|||
|
USER_DATheA User's datas passed |
o MAP_F |
|
||
Returns: |
|
|
|
|
|
|
NULL when the parsing is done. |
|
|
|
|
See also: |
|
|
|
|
|
|
gdsl_list_map_ba kward()(p. 121) |
|
|
||
4.10.2.24 |
element_t gdsl_list_map_ba kward ( nst |
|
|||
|
MAParseeaxaminatedahSTOPllL'slistelemenfromUSERgdslthtsenelementailofgdsllistwiththetoDATAhead.listtUSERlistLL,.)gdslfrommapDATAtailmapbatorgumentkward()headfun. The. t(pIfMAPMAP. 121)_stopsFFfunreturns, vandotionidreturnsGDSLisalledits- |
||||
Note:laston |
|
|
|
|
LComplexitondition:Theust listbeFDAy:aThetovalidO(parseAmapLUser'sgdsl)funlistdatastionttopassed&applyMAPreturnsoFMAPea!=hNULLL'sF element |
|||
Parameters:reUSERMAP |
| | |
|
|
Returns: |
for whi h MAP_F |
GDSL_MAP_STOP. |
|
the rst elemen |
|||
NULL when the parsing is done. |
|
|
|
See also: |
|
|
|
gdsl_list_map_forward()(p. 120) |
|
||
4.10.2.25 void gdsl_list_ |
( onst gdsl_list_t L, |
||
OUTPUTgdsl write__FILEfunwrite, voidWRITE_F, FILE |
|||
|
to2006OUTPUTtforle.ouldgdslUSERbeyFILE,passedDoxygenDATAusingtoWRITE) __FF. fun tion. |
||
dditionnalthealltheelemenelon USERThutsJunoftsDATA22theof11:15:30alistlistargumenL |
|
|
|
Write |
|
|
|
GeneratedA |
|
|
|
|
|
|
|

122 |
gdsl Module Do umentation |
Note: |
|
Parameters:Pre WRITEL!=LComplexitondition:TheNULLustlistbey:aFtovalidO(Thewrite|Lgdsl|write.)listfun ttion&OUTPUT._FILE != NULL & WRITE_F |
|
OUTPUT FILE The le where to write L's elements. |
|
USER |
DATA User's datas passed to WRITE F. |
See also: |
write xml()(p. 122) |
gdsl_list_dump()(p. 123) |
|
4.10.2.26 |
void gdsl_list write_xml ( onst gdsl_list_t |
LOUTPUT, gdsl writeFILEfun,voidto WRITE F, FILE Note:IfOUTPUTWRITEriteWRITEtheFelements.ontentFILE!=.ofAdditionnalNULL,aoflistthetothenlistaUSERleLusesinto OUTPUTWRITEXMLDAUSERA. argumenFFILE,DATAto writeinto) ouldL'sXMLbelemenpassednguagetsto.
Parameters:re OUTPUTWRITELComplexity:ondition:Theust listbe aFtovalidO(FILEThewrite|Lgdsl|write.)Thelistfunle tiontwhere&.OUTPUTtowrite_L'sFILEelements!=NULL.
USER_DATA User's datas passed to WRITE_F.
See gdslalso:_list_write()dump()(p(p..121)123)
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

Doubly-linked list manipulation module |
123 |
4.10.2.27 void gdsl_list dump ( onst gdsl_list_t |
|
OUTPUTL, gdsl writeFILEfun,voidtoWRITE F, FILE Note:USERthenDumpComplexity:usestheDAWRITEstruinternalAargumentureO(struFoftotheturewriteouldlistofLbeaL'stolistpassedelementsOUTPUTaUSERtoleWRITE.toFILEOUTPUTDATA. FIf.WRITE) FILE. FAdditionnal!=NULL,
Parameters:re WRITEOUTPUTLondition:Theust listbe atoFvalidFILEwriteThe|Lgdsl|write.)Thelistfunle tiontwhere&.OUTPUTtowrite_L'sFILEelements!=NULL.
USER_DATA User's datas passed to WRITE_F. |
||||||
See also: |
|
|
|
()(p. 121) |
||
gdsl_list_write |
||||||
|
xml()(p. 122) |
|||||
4.10.2.28 |
|
|
|
|
ursor_t gdsl_list_ ursor_allo ( onst |
|
|
gdsl list_t L) |
|||||
Create a new list ursor. |
|
|||||
Note: |
|
|
|
|
|
|
Complexity: O( 1 ) |
|
|||||
re ondition: |
|
|
|
|||
ust be a valid gdsl_list_t |
||||||
Parameters: |
|
|
|
|
||
L The list on wi h the ursor is positi nned. |
||||||
Returns: |
|
|
llo ated list ursor in ase of su ess. |
|||
the newly |
|
|||||
NULL in |
ase of insu ient memory. |
See gdslalso:_list_ ursor_free()(p. 124)
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

|
|
|
|
Module Do umentation |
|
124.10.2.29 void gdsl_list_ ursor_free (gdsl_list_ ursor_t C) |
|
||||
Destroy a |
ist ursor. |
|
|
|
|
omplexitust be a valid gdsl_list_ ursor_t. |
|||||
Note: |
|
|
|
|
|
re ondition:y: O( 1 ) |
|
|
|
|
|
Parameters: |
|
|
|
|
|
C The list ursor to destroy. |
|
|
|
||
See also: |
|
|
|
|
|
gdsl_list_ ursor_allo ()(p. 123) |
|||||
4.10.2.30 |
void gdsl_list |
ursor |
move_to_head |
||
|
(gdsl_list_ ursor |
t C) |
|
|
|
a ursor on the head of its list. |
|
|
|||
Put the ursor C on the head of C's list. Does nothing if C's list is empty. |
|||||
Note: |
|
|
|
|
|
re ondition:y: O( 1 ) |
|
|
|
|
|
omplexitust be a valid gdsl_list_ ursor_t |
|||||
Parameters: |
|
|
|
|
|
C The ursor to use |
|
|
|
|
|
See also: |
|
|
|
|
|
gdsl_list_ ursor_move_to_tail()(p. 124) |
|||||
4.10.2.31 |
void gdsl_list |
ursor |
move_to_tail |
||
|
(gdsl_list_ ursor |
t C) |
|
|
|
a ursor on the tail of its list. |
|
|
|
||
Put the ursor C on the tail of C's list. Does nothing if C's list is empty. |
|||||
Note: |
|
|
|
_t |
|
Complexitust be a valid gdsl list_ |
|
||||
Pre ondition:y: O( 1 ) |
|
|
Jun 22 11:15:30 2006 for gdsl by Doxygen |
|
|
|
Generated onursorTh |
|

|
4.10 Doubly-linked list manipulation module |
125 |
||
|
Parameters: |
|
|
|
|
C The ursor to use |
|
||
See also: |
|
|
|
|
|
gdsl_list_ ursor_move_to_head()(p. 124) |
value |
||
4.10.2.32 |
|
_e ement t gdsl list ursor move to |
||
|
|
(gdsl list ursor t C, gdsl ompare fun _t |
Note:PlSementsarehomplexitatoaursorpartiVALUE,COMPy:onularO(byelemenpartiusingF, ularvoidCOMPEelementintheVALUEF.ursor'sIfE) is listfound,LbyC isomparingpositionnedalllist'sonit.ele-
Condition:OMPTheust beursorFTheaThevalidtovalueeleLputgdslomparison/used2)listtheto elemenfunompareursortionEtlist'sto& COMPearelementsh forFE!=withNULL |
|||||
Parameters:reVALUE |
| | |
|
|
|
|
Returns: |
|
|
in ase it exists. |
||
the rst founded |
|||||
NULL in ase of |
ment E is not found. |
||||
See also: |
|
|
|
|
|
gdsl_list_ ursor_move_to_position()(p. 125) |
|||||
4.10.2.33 |
_e |
t t gdsl |
list ursor_move_to_position |
||
Pl e a |
(gdsl |
list |
ursor |
t C, ulong POS) |
|
on a elemement giv |
by its position. |
||||
Sear h f |
the POS-th element enthe ursor's list L. In ase this element exists, |
||||
the urs ursorC is positionned on it. |
|
|
|||
Note: |
|
|
|
|
|
Pre Condition:omplexitustbey:a validO(|Lgdsl| / 2_)list_ ursfor_t & POS |
|||||
Generated |
Thu Jun 22 11:15:30 2006 |
gdsl by Doxygen> 0 & POS <= |L| |
|||
|
|
|
|
|
|

126 |
|
|
|
|
|
|
|
|
gdsl Module Do umentation |
||
|
Parameters: |
|
|
|
|
|
|
||||
|
|
C The ursor to put on the POS-th elem nt |
|||||||||
|
|
POS The posi ion of the elemen |
to move on |
||||||||
|
|
the element at the POS-th position |
|
|
|
||||||
Returns: |
|
|
|
|
|
|
|
||||
|
Movalready4.10gdslNULLalso:.2.34ursorlistif(gdslvoidPOSoneursorgdslsteplist= 0forwardorlistmoveursorPOSursoroftoitsLClistvalue())step. _(pforward. 125) |
||||||||||
See |
|
|
|
|
< |
> | | |
|
|
|
|
|
Note: |
the ursor C one node forward (from head to tail). Does nothing if C is |
||||||||||
|
on its list's tail. |
|
|
|
|
|
|||||
|
re ondition:y: O( 1 ) |
|
|
|
|
|
|||||
|
|
omplexitust be a valid gdsl_list_ ursor_t |
|
|
|||||||
Parameters: |
|
|
|
|
|
|
|||||
|
|
C |
The ursor to use |
|
|
|
|
|
|||
See also: |
|
|
|
|
|
|
|
||||
|
|
gdsl_list_ ursor_step_ba kward()(p. 126) |
|||||||||
|
4.10.2.35 void gdsl_list |
ursor |
|
step_ba kward |
|||||||
|
|
|
|
|
(gdsl_list ursor t C) |
|
|
|
|||
|
|
|
|
ursor one step ba kw rd of its list. |
|
|
|||||
|
already on its list's head. |
|
|
|
|
|
|||||
|
Mov |
the ursor C one node ba kward (from tail to head.) Does nothing if C is |
|||||||||
Note: |
|
|
|
|
|
|
|
|
|
||
|
|
omplexity: O( 1 ) |
|
|
|
|
|
||||
|
re ondition: |
|
|
|
|
|
|
||||
Parameters:ust be a valid gdsl_list_ ursor_t |
|
|
|||||||||
|
|
C |
The ursor to use |
|
|
|
|
|
|||
See also: |
|
|
|
|
|
|
|
||||
|
|
gdsl_list_ ursor_step_forward()(p. 126) |
|||||||||
|
|
|
|
|
|
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen |
|