Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
20
Добавлен:
15.06.2014
Размер:
652.77 Кб
Скачать

 

Doubly-linked ist manipulation module

( onst

127

 

4.10.2.36

bool gdsl

list

ursor_is_on_head

 

 

 

 

gdsl list_ ursor

t C)

 

 

 

Che k if a ursor is on the head of its list.

 

 

Note:

 

 

 

 

 

 

 

 

 

re ondition:y: O( 1 )

 

 

 

 

 

 

 

omplexitust be a valid gdsl_list_ ursor_t

 

 

Parameters:

 

 

 

 

 

 

 

C

The ursor to he k

 

 

 

 

 

Returns:

 

 

 

head.

 

 

 

TRUE if C is on its

 

 

 

 

 

FALSE if C is not onlist'slits's head.

 

 

See also:

 

 

 

 

 

 

 

 

gdsl_list_ ursor_is_on_tail()(p. 127)

 

 

4.10.2.37

bool gdsl

list

ursor_is_on_tail ( onst

 

 

 

 

gdsl list_ ursor

C)

 

 

 

Che k if a ursor is on the tail of

its list.

 

 

Note:

 

 

 

 

 

 

 

 

 

omplexity: O( 1 )

 

 

 

 

 

 

 

re ondition:

 

 

 

 

 

 

 

 

ust be a valid gdsl_list_ ursor_t

 

 

Parameters:

 

 

 

 

 

 

 

C

The ursor to he k

 

 

 

 

 

Returns:

 

 

's tail.

 

 

 

TRUE if C is on its

 

 

 

 

FALSE if C is not onlists

list's tail.

 

 

See also:

 

 

 

 

 

 

 

 

gdsl_list_ ursor_is_on_head()(p. 127)

 

 

4.10.2.38

bool gdsl

list

ursor_has_su ( onst

 

 

Che k if a

gdsl_list_ ursor

t C)

 

 

 

has a su essor.

 

 

 

 

Generated onursorTh Jun 22 11:15:30 2006 for gdsl by Doxygen

 

128

 

 

 

 

gdsl Module Do umentation

 

Note:

 

 

 

 

 

re ondition:y: O( 1 )

 

 

 

 

 

omplexitust be a valid gdsl_list_ ursor_t

 

Parameters:

 

 

 

 

 

C The ursor to he k

 

 

Returns:

 

an elemen af er the ursor C.

 

 

TRUE if

 

 

FALSE ifthereexistsno element after the ursor C.

See also:

 

 

 

 

 

 

gdsl_list_ ursor_has_pred()(p. 128)

4.10.2.39

bool gdsl

list ursor_has_pred ( onst

 

 

 

gdsl_list_ ursor

t C)

 

 

Che k if a ursor has a prede essor.

 

Note:

 

 

 

 

 

 

omplexitust be a valid gdsl_list_ ursor_t

 

 

re ondition:y: O( 1 )

 

 

 

Parameters:

 

 

 

 

 

C The ursor to he k

 

 

Returns:

 

an element before the ursor C.

 

 

TRUE if

 

 

FALSE ifthereexistsno element before the ursor C.

See also:

 

 

 

 

 

 

gdsl_list_ ursor_has_su ()(p. 127)

 

4.10.2.40

void gdsl

list ursor_set_ ontent (gdsl_list_ ursor_t

 

the ont

C, gdsl element

t E)

 

 

of the ursor.

 

 

Note:ditSetallinC'sComplexity:orderated,elemtoengdslfreet toO(itElist.before1TheGenerated) ursorp. eviousongetThulementJunontent()is22 NOT11:15:30(p. 129)deallo2006ouldforatedgdslbe.IfbyuseditDoxygenmusttogetbe

4.10 Doubly-linked list manipulation module

129

re ondition:

 

 

 

 

 

 

ust be a valid gdsl_list_ ursor_t

 

 

Parameters:

 

 

 

be modi ed.

 

C

 

ursor in whi h the ontent m

 

E

The value

sed to modify C's ontenust.

 

 

gdsl_list_ ursor_

_ ontent()(p. 129)

 

See also:

 

elemenget t gdsl list_ ursor_get_ ontent ( onst

4.10.2.41

 

 

 

gdsl_list ursor

t C)

 

 

Get the ontent of a ursor.

 

 

 

 

Note:

 

 

 

 

 

 

 

omplexitust be a valid gdsl_list_ ursor_t

 

 

re ondition:y: O( 1 )

 

 

 

 

Parameters:

 

 

 

 

 

C

The ursor to get the ontent from.

 

 

Returns:

 

ontained in the ursor C.

 

 

the element

 

 

gdsl_list_ ursor_

_ ontent()(p. 128)

 

See also:

 

_e emenset_t gdsl_list_ ursor_insert_after

 

4.10.2.42

 

 

 

 

 

treedolist1aelemengdslfterted)at theausingursorlistursorheadplALLOCa.tpositionlloedC,()aftervoid(pF.of109)thealledC'sVALUE. ursorlistIfonthe.VALUEC)returned.IfC's.ALLOClistvalueisempty,isFnotis

Note:theAInsertULL,elemenpoinwomplexitathennewrmenpassedis(gdsltheelementinsery:isnewO(

 

 

 

 

re ondition:

 

 

ursor_t

 

 

 

ust be a valid gdsl_list

 

 

Parameters:

after whi h the new element must be inserted

 

C

The

 

 

Generated on ThursorJun 22 11:15:30 2006 for gdsl by Doxygen

 

130

VALUE The value used

 

 

gdsl Module Do umentation

 

o allo ate the new element to insert

 

Returns:

 

 

 

 

 

 

 

 

the newly inserted element in ase of su ess.

 

NULL in ase of failure.

 

 

 

 

See also:

 

 

insert

after

p. 130)

 

gdsl_list_ ursor_removebefore()(p. 131)

4.10.2.43

 

_

ement_t gdsl_list_ ursor_insert_before

theAInsertULL,elemenpoinwomplexity:athennewrmenpassedis(gdsltheelemeninserisnewO(reatedo

isheadursortplaALLOCallotpositioned.C,before()void(pF.of109)thealledC'sVALUE. listursorIfonthe.VALUEC)returned.IfC's.ALLOClistvalueisempty,isFnotis

Note:

 

 

 

 

 

 

 

list1elemenbeforegdsl) theusingursoral

 

 

re ondition:

 

 

 

 

 

 

 

ust be a valid gdsl_list_ ursor_t

 

 

Parameters:

 

 

 

 

 

 

 

C The ursor before whi h the new element must be

 

VALUE The value used

o allo ate the new element insertedto

Returns:

 

 

 

 

 

 

 

 

the newly inserted element in ase of su ess.

 

NULL in ase of failure.

 

 

 

 

See also:

 

 

insert

aft

p. 129)

 

 

 

 

 

 

after() p. 131)

 

gdsl_list_ ursor_remove_before()(p. 131)

4.10.2.44

 

_e ement

t gdsl list_ ursor_remove

 

 

(gdsl

ursor

t C)

 

 

Remove the elemenlistunder a ursor.

 

 

Note:Complexity: O( 1 )

Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

4.10 Doubly-linked list manipulation module

131

re ondition:

 

 

 

 

 

 

 

 

ostCondition:must be valid gdsl_list_ ursor

 

 

on to its su essor.

 

After this operation, the ursor is

 

 

 

C The ursor to remove the ontenpositionnedfrom.

 

 

Parameters:

 

 

 

 

 

 

 

 

Returns:

 

lemen

if it

xis s.

 

 

 

 

 

the removed

 

 

 

 

 

NULL if here is not element to remov .

 

 

gdsl_list_ ursor_removebefore()(p. 131)

 

See also:

 

 

 

 

 

p. 129)

 

 

4.10.2.45

 

 

insert_after()(p. 130

(p. 130)

 

 

 

_e ement

t gdsl

list_ ursor_remove_after

 

 

 

(gdsl

ursor t C)

 

 

 

 

Remove the elemenlistafter a ursor.

 

 

 

 

 

Note:

 

 

 

 

 

 

 

 

 

 

omplexity: O( 1 )

 

 

 

 

 

 

 

re ondition:

 

 

 

 

 

 

 

 

 

ust be a valid gdsl_list_ ursor_t

 

 

 

 

Parameters:

 

 

 

 

 

from.

 

 

C

The ursor to remove the

essor

 

 

the removed

lemen

if it

xissu.

 

 

 

Returns:

 

 

 

 

 

 

 

 

 

NULL if here is not element to remov .

 

 

gdsl_list_ ursor_removebefore()(p. 131)

 

See also:

 

 

 

 

 

p. 129)

 

 

4.10.2.46

 

 

insert_after()(p. 130

(p. 130)

 

 

 

_e ement

t gdsl

list_ ursor_remove_before

 

R mov

 

(gdsl list

 

t C)

 

 

 

 

the element beforeursora sor.

 

 

 

 

 

Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

 

132

 

 

 

 

 

 

 

 

 

 

 

 

 

 

gdsl Module Do umentation

 

Note:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

re ondition:y: O( 1 )

 

 

 

 

 

 

 

 

 

 

omplexitust be a valid gdsl_list_ ursor_t

 

Parameters:

 

 

 

 

the

 

 

 

 

from.

 

 

C

The ursor to remov

 

 

 

 

See also:

 

 

 

 

 

 

 

 

prede essor. 129)

Returns:

 

 

 

 

 

insert_before

0)

 

 

 

 

 

if it

 

xis .

 

 

 

 

 

the removed lemen

 

 

 

 

 

 

NULL if

here is not elem

t to remov .

 

 

D lete

 

 

(gdslt_list a ursor.after()C

 

 

 

gdsl_list_ ursor_remove

(p. 130 (p. 131)

4.10.2.47

 

 

 

_list_

 

 

 

 

gdsl list_ ursor_delete

 

R

vthetheelementunder the ursor C. The removed element is also deallo ated

 

ComplexitThe ursor to delete

 

ontent.

 

 

 

using FREE

 

F passed to gdsl

 

list_allo ()(p. 109).

 

 

 

 

y: O( 1 )

 

 

 

 

 

 

 

 

 

 

re ondition:

 

 

 

 

 

 

 

 

 

 

 

 

 

ust be a valid gdsl_list_ ursor_t

 

Parameters:

 

 

 

 

 

 

 

 

 

 

 

Returns:

 

 

 

 

 

 

 

 

 

 

 

v

.

 

 

the ursor C if the elementhe was

 

 

 

NULL if

here is not

ment toremoved.

 

 

 

gdsl_list_ ursor_delete_after()(p. 132)

See also:

 

 

 

 

 

 

 

 

 

before )(p. 133)

4.10.2.48

 

 

 

_list_

 

 

 

 

 

 

 

 

 

 

 

t gdsl_list_ ursor_delete_after

 

D lete

 

 

(gdsl_list_

 

 

 

 

t C)

 

 

 

 

 

 

 

t after aursor .

 

 

 

 

 

R

vthetheelement after the

ursor C. The removed element is also deallo ated

 

Complexity: O( 1 )

Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

 

using FREE

 

F passed to gdsl

 

list

allo ()(p. 109).

4.10 Doubly-linked list manipulation module

133

re ondition:

 

 

 

 

 

 

 

 

ust be a valid gdsl_list_ ursor_t

 

 

Parameters:

 

 

 

 

 

from.

 

C

The ursor to delete

 

 

 

 

 

the ursor C if the

the wassu essorv .

 

Returns:

 

here is notelemenment toremoved.

 

NULL if

 

See also:

 

 

 

 

()(p. 132)

 

 

gdsl_list_ ursor_delete

 

 

 

before()(p. 133)

 

4.10.2.49

 

_list_

 

_t gdsl_list_ ursor_delete_before

 

D lete the l

(gdsl_list_ ursor

t C)

 

 

 

t before the

 

 

 

of a list.

 

R move the

element before theursoror C. The removed element is also deallo-

ated using FREE_F passed to gdsl

list allo ()(p. 109).

 

Note:

 

 

 

 

 

 

 

 

 

 

re ondition:y: O( 1 )

 

 

 

 

 

 

 

omplexitust be a valid gdsl_list_ ursor_t

 

 

Parameters:

 

 

 

 

 

 

from.

 

C

The ursor to delete

 

 

 

 

 

 

the ursor C if the

the wasprede essorv .

 

Returns:

 

here is notelemenment to removed.

 

NULL if

 

See also:

 

 

 

 

()(p. 132)

 

 

gdsl_list_ ursor_delete

 

 

 

after()(p. 132)

 

Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

134.11 Various ma ros modulegdsl Module Do umentation

De nes

ˆ #de ne GDSLgrlowestatestMINnumberAX(X,(X,ofY)Y)two(X(Xnumbers>Y?X:Y).

4..11.1.1.1GiveDe#detheneeDoGDSLnumberumentationMAX(X,of two numbers>Y?Y:X)Y) .(X

XComplexity:ondition:the& greatestYust beO(umberbasi1) ofsalartwo Cnumberstypes.

 

 

Y?X:Y)

PNote:Givarameters:re

 

>

 

First s alar variable

 

 

 

 

Y Se ond s alar variable

 

 

 

Returns:

Y

 

 

 

X

X

 

 

 

Y if

Y is greather than

X.

 

 

 

See also:

 

 

 

 

GDSL_MIN()(p. 134)

 

 

 

De nition at line 56 of le gdsl_ma ros.h.

 

 

 

 

 

alarMIN(X,numbersCtypes.Y) (X

 

Y?Y:X)

PreNote:Giv4.11XComplexit.ondition:the1.&2 lowestY#deusty: umberbeO(nebasi1GDSL) ofstwo

>

 

 

Gener ted on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

 

4.11 Various ma ros module

135

 

Parameters:

 

 

 

X First s alar variable

 

 

 

Se ond s alar variable

 

Returns:

X

 

 

Y

Y

 

 

X if X is lower than Y.

 

See GDSLalso: _MAX()(p. 134)

De nition at line 73 of le gdsl_ma ros.h.

Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

136

gdsl Module Do umentation

4.12 Permutation manipulation module

 

Typedefs

 

 

ˆ typedefGDSLgdslpermutationvoid(perm typegdsl. _permwrite

 

 

gdsl_perm_

_fun _t )(ulong E, FILE

ˆumerationsDAypedefOUTPUTGDSLA) gdslpermutationFILE,perm datagdslwrite_funlo tionationtyp_.t POSITION, void USER_-

Enˆ FIRSTen Thisgdsltype= 1,ispermGDSLfor gdsl__positionwritePERMermgdsl POSITIONperm{funGDSLt.dataPERMLASTt =POSITION2 } _-

Fun tions

ˆ gdslvoidN)gdslCopyDestrCrgdslatepermpermharoyaaermutationpermermutationnwt gdslgdslfree. permperm.(gdsl. allopermopy((onstonstP)gdslhar_permNAME,t P)onst ulong

ˆ ulongonstGetGet gdslINDIX)thethe name(INDIX+1)izegdslpermofof permermutation-getthgetelutationsizementgetelemen. .(fromnameonsta(gdslpermut(onstonstpermgdslgdsltion.___permpermtP) __tt P)P, onst

ˆ P) Get thegdslarray_elementspermGeneratedgetof ona pThermutationelementsJun 22.11:15:30array 2006( onstfor gdslgdslbypermDoxygent