
Заготовки по С / Динамические структуры / GDSL / Исходники / doc / latex / refman
.pdf
|
4.12 Permutation manipulation module |
|
147 |
|||
|
Note: |
|
|
|
|
|
|
re PComplexitondition:& Q usty: beO( valids|P| ) |
gdsl_perm_t & |
|
|
||
Parameters:gdslthePQ ThinearlinearanoniformformalQpermutationofofthePpermutationusedtoP.omputeP== Qits &linearP!=formQ into Q |
||||||
Returns: |
|
| | |
| |
| |
||
See also: |
|
|
|
|
||
|
|
_perm_linear_to_ anoni al()(p. 146) |
|
|||
4.12.3.18 |
gdsl_perm |
gdsl_perm_inverse (gdsl_perm_t P) |
||||
|
Inverse in pla e a permutation. |
|
|
|||
Note: |
|
|
|
|
|
|
Parameters:rethePComplexitondition:Theinverseustpermbey:autationevalidO(rmutationPgdsl)to invertpermofPint ase of su ess. |
|
|
||||
Returns: |
| | |
|
|
|
||
|
NULL in as of insu ient memory. |
|
|
|||
See also: |
|
|
|
|
||
|
gdsl_perm_reverse()(p. 147) |
|
|
|||
4.12.3.19 |
gdsl_ |
gdsl_perm_reverse (gdsl_perm_t P) |
||||
|
Reverse in pla e a permutation. |
|
|
|||
Note: |
|
|
|
|
|
PreGeneratedComplexitondition:ust beThuy:a JunvalidO(|22Pgdsl| 11:15:30/ 2 )perm2006t for gdsl by Doxygen

148 |
|
|
|
gdsl Module Do umentation |
|
|
Parameters: |
|
|
||
|
|
P The |
|
utation to reverse |
|
Returns: |
|
|
|
||
|
|
the mirror image of the permutation P |
|
||
See also: |
|
|
|
||
|
|
gdsl_perm_inverse()(p. 147) |
|
||
4.12.3.20 |
gdsl perm_t gdsl_perm_randomize (gdsl_perm_t P) |
||||
|
Randomize |
|
permutation. |
|
|
|
The permutation P is randomized in an e ient way, using inversions array. |
||||
Note: |
|
|
|
||
Parameters:re thePComplexity:ondition:ThemirrorustpermutationbeimageavalidO(Pgdsl)to_randomizepermt |
|
||||
Returns: |
|
| | |
|
4.12NULL.3.21 in(gdslase_ofelemeninsuP oftientthet permmeutationory. of P in ase of su ess.
_ t_e torgdsl_perm_apply_on_array Note:ApplyComplexitapermutationy:O( on to a v V. , onst gdsl_perm_t P)
re Pondition:ust be a valid|Pgdsl| ) _perm_t &
Returns:Parameters:NULLthePV Treorderedheinpvermasetor/utationarrayofrrayinsuVtoausereorderientordingtomemoryreorderatoording|theP.|V==permutationto|VP| P in ase of su ess.
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

Perm |
manipulation module |
gdsl perm_t P, |
149 |
|
4.12.3.22 v id |
|
_perm_write |
|
|
utationOUTPUTnstgdsl_FILEwrite,_voidfun ( onstWRITE_F, FILE |
|
|||
|
f theaUSERpermutationpermuationDATA toargumenPtoUSEROUTPUTle.touldDATAbeFILE,passed) usingtoWRITE__FF. |
|||
WritetionComplexity:the. AeldditionnalementsO( |
|
|
|
|
Note:fun |
|
|
|
Prearameters:WRITEFILEondition:Theust!=permutationbeNULLFa validThe|Pwrite|gdsl)to writefunperm.tiont.& WRITE_F != NULL & OUTPUT_OUTPUT FILE The le where to write P's elements.
USER DATA User's datas passed to WRITE F.
See gdslalso:_perm_writedump()xml()(p. 150)(p. 149)
4.12.3.23 void gdsl_perm_write_xml ( onst gdsl_perm_t OUTPUT, onst gdslFILEwrite,voidfun _t WRITE_F, FILE
Note:passelemguagWriteComplexity:dnts.thtoIfetoWRITEelementsOUTPUTO(ofFF.athe!=permutationFILENULL,permutation.Additionnalthento usesaPUSERtoleUSERWRITEOUTPUTintoXMLDADATAF.AFILE,fun) argumenttionintotoXMLwriteouldlanP'sbe-
Parameters:re WRITEOUTPUTPondition:Theust permutationbeaFvalidFILEThe|Pgdslwrite| )Thetowritepermfunle .tionwheret .& OUTPUTtowriteP'sFILEelements!=NULL.
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

150 |
|
|
|
gdsl Module Do umentation |
|
|
USER_DATA User's datas passed to WRITE_F. |
|
|||
See also: |
write()(p. 149) |
|
|
||
|
gdsl_perm_dump()(p. 150) |
gdsl_perm_t P, |
|||
4.12.3.24 v id |
_perm_dump |
||||
|
|
onstgdsl_FILEwrite,_voidfun _( onstWRITE_F, FILE |
|
||
|
|
OUTPUT |
|
||
|
|
|
|
tso to.WRITEIfOUTPUTWRITEF.__F- |
|
|
|
e theninternalstruy:usestureO(USERstruWRITEofthetureDATApermutationofFafunpermutationargumentionPUSERtotowriteouldOUTPUTtoaP'sbeDATAlepassedelemen.)FILE |
|
||
|
|
dditionnal |
|
|
|
|
|
th |
|
|
|
DumpNULL,Complexit.A |
|
|
|
||
Note:FILE!= |
|
|
|
Parameters:rePWRITEOUTPUTondition:Theust permutationbeaFvalidFILEThe|Pgdsl|write)Thetodumppermfunle tionwhere.t .& OUTPUTtowriteP'sFILEelements!=NULL.
USER_DATA User's datas passed to WRITE_F.
See gdslalso:_perm_write()(pxml(). 149)(p. 149)
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

.13 Queue manipulation module |
|
151 |
4.13 Queue manipulation module |
|
|
T |
|
|
Funypedefsˆˆ tgdsltionsGDSLq_euequeuegdsl_tqutypegdslue. _gdslqueuequeueallo t( o st |
har |
|
allovoidCrDestrFlushgdslateharfuoynaqueueanewt .ALLOCqueue.free.ush(F,gdsl(gdslgdslqueuequeuefree(funonstQ)Q)_t FREENAME,F) gdsl_-
|
Getgdslsthegdslk ifsizenameaqueuegdslofofa aisqueuequeueisemptyget.empty.. sizeget (nameonst gdsl_queuegdsl__queuettQ) _t Q) |
|
||||
ˆ boolulongonstChe |
|
|
|
|
||
gdsl_ |
|
|
t t gdsl_queue_get_head ( onst gdsl_queue_t |
|||
Q) |
|
element t gdsl queue_get_tail |
gdsl_queue_t Q) |
|||
Get the |
head of a queue. |
|
|
|||
|
tail of a queue. |
|
onst |
|||
ˆ gdsl |
queue_t gdsl queue_set_name( onstgdsl_queue_t Q, |
|||||
|
|
elementhe nameelementNAME)of a queuegdsl. queue_insert |
(gdsl_queue_t Q, |
void |
||
ˆ gdslharSetNEW |
|
|
|
Generatedˆ gdslVALUE)InsertRemoveonelemenThuananJun 22 11:15:30gdslinfromaquequeue2006a queue(PUT)for gdslremove(GET). by.Doxygen(gdsl_queue_t Q)

152 |
|
gdsl Module Do umentation |
ˆ |
element_ gdsl_queue |
sear h ( onst gdsl_queue_t Q, |
|
queueitsCOMPqueuepositionntinsearF,queuemapinvoidh.queuebyforwardVALUE). position( onst(onst gdslgdsl__-- |
|
ˆˆ gdslgdslqueuegdslSearSearelementelementomparehhtforforQ, anulongartielementfungdslularPOS)gdslbyelemt |
|
ˆqueuegdslqueueParseelementttaQ,Q,queuegdslgdslfromt mapgdslmheadp__tofunqueuefuntail. tt_MAPMAPmap__F,F,bavoidvoidkwardUSER(_onstDATA)gdsl_-
ˆvoidfunParseritegdslWRITEa queuefromF, writeFILEail to head( onst. gdsl_queue_tUSERQ,gdslDATA)write_-
ˆvoidwriteW gdslfunall thequeueontentlementsWRITEwriteof aF,OUTPUTqueuexmlFILEto( aonstleFILE,. gdslvoidqueueUSERt_DATA)Q, gdsl
ˆDATA)voidfunWritegdsltWRITEthequeueF,ofdumpFILEa queue( toonsta legdslintoOUTPUTXMLqueue. _FILE,t Q, voidgdsl writeUSER__--
4..13.1.1.1DumpTypedeffunypedefthetionsinternalstruDotstruumentationgdsltureOUTPUTofqueuea queue_toFILE,a levoid. USER_DATA)
GDSLThisDebut nitionbyypequtheisueatvoluntaryline54.ofGeneratedopaquethislegdslmodule.Variablesqueueon .Thu.hJun. of this22gdsl11:15:30kindqueueould'nt2006 fortbegdsldireby Doxygently used,

. |
|
|
Queue man pulati |
module |
|
153 |
||||||||||
|
. |
|
|
.2 |
|
Fun tion Do umentation |
|
|||||||||
|
|
|
|
|
|
|
gdslwquepelementsones:intersuealloqueueue.F)dataALLOCinfunthet strugdslqueuetFtALLOCandqueuere. ThesewFREEiallopointernameF,Fgdsl(ouldisonstsetouldfreebetousedharbeafunsetopytoNAMErespetooftNULLNAMEtively,, to. |
|||||||||
|
|
|
|
|
|
dtionsefaultnewfreFREE |
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fu.ate2n.a1 |
|
|
|
|
|
|
|
|
|
|
||
|
|
|
the |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alloTheACreate4.13lo |
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
use |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
ˆ the default |
ALLOC |
F simply returns its argument |
|||||||||||
|
|
|
FREE |
|
F does nothing |
|
|
|||||||||
Note: |
|
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
Complexity: O( 1 ) |
|
|
|
|
|
|||||||
|
re ondition: |
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
nothing. |
|
|
|
|
|
|
|
|
|
|||
Parameters: |
|
|
|
|
|
f the new |
reate |
|
||||||||
|
|
|
|
NAME The name |
|
|
||||||||||
|
|
|
|
FREE F Fun tion to free elemqueuent when deleting it from a queue |
||||||||||||
|
|
|
|
ALLOC |
|
F F |
|
on to allo m |
towhen insert ng it in a |
|||||||
Returns: |
|
|
llo ated |
|
|
in ase of su ess. |
|
|||||||||
|
|
|
|
the newly |
|
|
|
|
||||||||
|
|
|
|
NULL in |
ase of insuqueuei nt memory. |
|
|
|||||||||
See also: |
|
|
|
|
free()(p. 153) |
|
|
|||||||||
|
|
|
|
gdsl_queue_ ush()(p. 154) |
|
|
||||||||||
|
4.13.2.2 void gdsl_queue_free (gdsl_queue_t Q) |
|||||||||||||||
|
|
stroy |
|
queue. |
|
|
|
|
|
|
|
|||||
|
is deallo ated |
itself too. |
|
|
f the queue Q by alling |
's FREE F fun tion |
||||||||||
|
De |
|
|
|
|
|
all |
|
he elements |
|||||||
|
pass |
|
to gdsl queue |
|
allo ()(p. 153). The name of |
Q is deallo ated and Q |
||||||||||
Note: |
|
|
|
|
|
|
|
|
|
|
|
|
PreGeneratedComplexitQondition:ust beThuy:a JunO(valid|22Qgdsl|11:15:30) queue2006tfor gdsl by Doxygen

154 |
|
|
|
|
|
gdsl Module Do umentation |
|
|
Parameters: |
|
|
|
|
||
|
|
Q The |
to destroy |
|
|
||
|
|
gdsl_queue_ ush()(p.153)4 |
|
||||
See also: |
allo |
|
|
||||
|
4.13.2.3 void gdsl_queue_ ush (gdsl_queue_t Q) |
||||||
|
Flu h |
queue. |
|
|
|
|
|
|
Deallo ate all the el ments of the queue Q by alling Q's FREE_F fun tion |
||||||
|
pass |
|
to gdsl_queue |
allo (). Q is not deallo ated itself and Q's name is not |
|||
|
m di ed. |
|
|
|
|
||
Note: |
|
|
|
_t |
|
||
|
|
QComplexity:also:ondition:TheustqueuebeaO(validtofree()alloQushgdsl)()(p(p.queue153). |
|
||||
|
|
gdsl |
|
|
|
|
|
Parameters:re |
| |
| |
|
|
|||
See |
|
|
|
|
Note:4.Getsthearameters:ondition:2ondi.4nameustQonstbe)of:a aO(validqueuehar1 )gdsl.gdslqueuequeuet _get_name ( onst gdsl_queue_t |
||
ostre13Complexity:Q. |
|
|
P |
The ur ed string MUST NOT be freed. |
|
|
Q The queue to get the name from |
Returns:the name of the queue Q.
See gdslalso:_queue_set_name()(p. 156)
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

Queue manipu ation module |
155 |
||||
4.13.2.5 ulong gdsl_queue_get_size ( onst gdsl_queue_t Q) |
|
||||
Get the size of a queue. |
|
|
|||
Note: |
|
|
|
|
|
re ondition:y: O( 1 ) |
|
|
|||
Complexitust be a valid gdsl_queue_t |
|
||||
Parameters: |
|
|
|
||
Q |
The queue to get the size from |
|
|||
Note:Returns:Che4.13Complexity:the.k2.if6aumberqueueboolofgdslisO(elementsempty1)queue. of_Qis(notedempty|Q|)(. onst gdsl_queue_t Q) |
|
||||
re ondition: |
|
|
|
||
|
ust be a valid gdsl_queue_t |
|
|||
Parameters: |
|
|
|
||
Q |
The queue to he k |
|
|||
Returns: |
|
Q is empty. |
|
||
TRUE if |
|
||||
FALSE ifthequeue |
Q is not empty. |
|
|||
4.13.2.7 |
gdsl |
elem nt_t gdsl_queue_get_head ( onst |
|
||
|
|
e |
t Q) |
|
|
Get the head of a queue. |
|
|
|||
Note: |
|
|
|
|
|
re ondition:y: O( 1 ) |
|
|
|||
Complexitust be a valid gdsl_queue_t |
|
||||
Parameters: |
to get the head from |
|
|||
Q |
The |
|
|||
Generated onqueueTh Jun 22 11:15:30 2006 for gdsl by Doxygen |
|

156 |
|
|
|
|
|
gdsl Module Do umentation |
||
|
Returns: |
|
|
|
|
|
||
|
|
the elemen |
ontained at the header position f the queue Q if Q is not |
|||||
|
|
empty. The returned elemen is not removed from Q. |
||||||
|
|
NULL if the queue Q is empty. |
|
|
||||
See also: |
|
|
|
|
|
|||
|
|
gdsl_queue_get_tail()(p. 156) |
|
|
||||
4.13.2.8 |
gdsl_ |
elem nt_t gdsl_queue_get_tail ( onst |
||||||
|
|
|
|
e t Q) |
|
|
||
|
Get the tail of a queue. |
|
|
|||||
Note: |
|
|
|
|
|
|
||
|
|
Complexity: O( 1 ) |
|
|
||||
|
re ondition: |
|
|
|
|
|||
|
|
|
ust be a valid gdsl_queue_t |
|
|
|||
Parameters: |
|
|
|
|
||||
|
|
Q |
The queue to get the tail from |
|
|
|||
Returns: |
|
ontained at the footer position of the queue Q if Q is not |
||||||
|
|
the elemen |
||||||
|
|
NULL if the queue Q is empty. |
|
|
||||
|
|
empty. The returned elemen is not removed from Q. |
||||||
See also: |
|
|
|
|
|
|||
|
|
gdsl_queue_get_head()(p. 155) |
|
|
||||
|
4.13.2.9 gdsl_ |
_t gdsl_queue_set_name (gdsl_queue_t Q, |
||||||
PNote:ChangeSetretheComplexitondition:namethepreviousonstofy:aO(queuehar1name). NEWof the_queueNAMEQ )to a opy of NEW_NAME. |
||||||||
|
|
|
ust be a valid gdsl_queue_t |
|
|
|||
|
arameters: |
|
|
|
|
|||
|
|
Q |
The queue to hange the name |
|
|
|||
|
|
NEW NAME The new name of Q |
|
|
||||
|
|
|
|
|
|
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen |
|