
Заготовки по С / Динамические структуры / GDSL / Документация
.pdf
|
Sta k manipulation module |
st k_map_ba kward ( nst |
187 |
|
|
4.16.2.17 |
elemen _t |
|
|
|
|
|
|
- |
|
ParsereturpsisaaallnstasalledGDSLelementsreturnskUSERgdslfromon MAPeaitsstatopofhlastDATAtheS'stokSTOP,examinatedbottomelemenstat S),kthengdslS. withfromgdslelemenmaUSERtoppst.atofunkbottomDATAmaptMAP.argumentbaThekward()FMAP, .voIfidMAPF(p.fun187) |
|||
Note:stFtion |
|
|
|
SComplexitondition:Theust sbetaFDAy:aThekvalidO(toAmapparSUser'sgdsl)funstadatastionk_topassedt&applyMAPreturnso MAPeaF!=h_S'sNULLFelement |
||||
ParameterreUSERMAP |
| | |
|
|
|
Returns: |
|
|
GDSL_MAP_STOP. |
|
the rst elemen for whi h MAP_F |
||||
NULL when the parsing is done. |
|
|
|
|
See also: |
|
|
|
|
gdsl_sta k_map_forward()(p. 186) |
|
|
||
4.16.2.18 |
void gdsl_s a k_ |
( onst gdsl_sta k_t |
||
|
te fun,writevoid |
WRITE |
F, FILE |
|
|
OUTPUTS, gdsl wriFILE |
|
|
Note:tionWrite.Complexity:AdditionnalallthetheelemenmentstsO(USERoftheof_aDATAstastakkStoargumentoOUTPUTle.USERt ouldFILE,beDATApassedusing) toWRITE__FFfun. -
PPrearameterWRITES!=Sondition:TheNULLustbesta: akFvalidtoThewrite|gdsl|write). stafunk tiont&.OUTPUT_FILE != NULL & WRITE_F
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

188 |
|
|
|
gdsl Module Do umentation |
||
|
OUTPUT FILE The le where to write S's elements. |
|
||||
|
USER |
DATA User's datas passed to WRITE F. |
|
|
||
See also: |
write xml()(p. 188) |
|
|
|
||
|
gdsl_sta k_dump()(p. 188) |
_xml (gdsl_sta k_t |
||||
4.16.2.19 |
void gdsl_s a k_ |
|||||
|
|
te fun,writevoid |
WRITE F, FILE |
|
||
|
|
OUTPUTS, gdsl wriFILE |
|
|
Note:IfOUTPUTWRITEriteWRITEComplexity:theFelementsontentFILE!=.O(ofAdditionnalNULL,ofastathe. kstathenoakUSusesleERtointoOUTPUTWRITEDAUSERXMLA.argumenFDATAFILE,towrite)intoouldS'sXMLbelemenpassednguagetsto.
Parameterre SWRITEOUTPUTondition:Theust sbeta akFvalidtoFILEThewrite|Sgdsl|write)The.stafunlektionwheret &. OUTPUTtowriteS'sFILEelements!=NULL.
USER_DATA User's datas passed to WRITE_F.
See gdslalso:_sta k_write()dump()(p(p..187)188)
4.16.2.20 void gdsl_sta k_dump (gdsl_sta k_t S, gdslOUTPUTwrite__FILEfun , stavoidWRITE_F, FILE
Note:DumpthenUSERComplexity:usestheDAWRITEstruinternalAargumentureO(struofFtoheturewriteouldstaofkbeaS'stopassedelementsOUTPUTktoUSERtoa WRITEtole. OUTPUTFILEDATA.FIf. WRITE) FILE. FAdditionnal!=NULL,
|SGenerated| ) on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

4.16 Sta k |
|
|
|
module |
|
189 |
ust bemanipulationvalid gdsl_sta k_t & OUTPUT_FILE != NULL |
|
|||||
Parameterre ondition: |
|
|
|
|
|
|
S The sta k to write. |
|
|
|
|||
WRITE |
|
F The write fun tion. |
|
|
||
OUTPUT FILE The le where to write S's elements. |
|
|||||
USER |
DATA User's datas passed to WRITE |
F. |
|
|||
See also: |
|
|
()(p. 187) |
|
|
|
gdsl_sta k_write |
|
|
||||
|
xml()(p. 188) |
|
|
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

190 |
|
|
|
|
|
gdsl Module Do umentation |
|||
4.17 GDSL types |
|
|
|
|
|
|
|||
Typedefs |
|
|
|
|
|
|
|
|
|
ˆ typedefGDSLvoidgdslelementelementgdsltyp .elementfunttion( _t |
|
|
|
|
|||||
|
DATA) voiAllo( |
|
|
typegdsl. _allo _fun _t )(void USER_- |
|||||
ˆ |
ationf gdslFree _gdsl_freefun tionfun( type.t )(gdsl_element_t E) |
|
|
|
|||||
|
GDSL |
|
|
|
|
|
|
|
|
|
loyped |
|
|
|
|
|
|
|
|
ˆ elemenypedefGDSLint(Copyt E) |
|
typegdsl. _ opy_fun _t )( onst |
gdsl_- |
||||||
ˆ |
|
_t LOCATION,gdsl map_vfunid _t )( onst gdsl_element_t E, gdsl_- |
|||||||
|
|
|
tionomparetypUSER. _DATA) |
|
|
|
|||
|
ypedefGDSLlongMapint(element fun |
|
|
|
|
|
|||
|
E, void |
|
gdsl_ |
_fun _t )( onst gdsl_element_t |
|||||
ˆ typedefGDSLVALUE)void(Comparison element fun tion type. |
|
|
|
||||||
|
FILE |
|
gdsl_write |
_ |
)( onst gdsl_element_t E, |
||||
|
|
|
|
ulong{tion typelo ation. _ LOCATION, void |
|
USER_- |
|||
EnˆˆumerationsenDATA)ypedefGDSLgdslOUTPUTunsignedWriteonstantelementlongFILE,infuntgdsl |
|
|
|
|
|||||
|
|
ERR MEM_ALLOC = -1, GDSL MAP_STOP = 0, |
|||||||
|
|
MAP |
CONT = 1, GDSL |
INSERTED, |
|
|
|
||
|
GDSL_FOUND } |
|
|
|
|
|
|
||
|
GDSL Constan s. |
t { |
|
|
|
|
|
||
ˆ enum gdsl lo ation |
|
|
|
HEAD |
|||||
|
GDSL |
LOCATION |
U DEF = 0, GDSL LOCATION |
||||||
|
= 1, GDSL |
LOCATION |
ROOT = 1, GDSL LOCATION - |
||||||
|
TOP = 1, |
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen |
|

4.17 |
2, |
types |
|
|
|
|
191 |
|
|
|
GDSL_LOCATION BOTTOM = 2, |
|
N LEAF = |
||||
|
|
|
= 1, |
IL = 2, GDSL_LOCATI |
||||
|
|
|
|
= 2, |
GDSL_LO ATION_- |
|||
|
|
|
|
|
TION LAST |
COL = 2, |
||
|
|
FIRST_COL = 1, GD L |
|
|||||
|
|
GDSL LOCATION_LAST |
RLOCAW = 8 } |
|
||||
|
|
|
|
FIR T_R W = 4, |
|
|
||
. |
ˆ enum bool { FALSE = 0, TRUE = 1 } |
|
|
|
||||
|
.1 |
Typedef Do umen |
|
|
|
|
GDSLAll4..1717GDSLnition..11..userselemen21 atintypedefypedeftolineernaltstore130data.voidgdsltheirofstruledataelemengdslallogdslturesinatingtoelemenypestationontainsGDSLt(.h. datat eldstruof thisturesype. . This eld is for |
||||
4De |
|
|
|
|
|
|
|
gdsl_allo _fun _t)(void |
|
Returns:Parameters:USERThisGDSLUSERfunAlloDtionTAUSERelementDATAargumentypeisfunDATA)userforshouldtiondataypeusedbe.usedtoa toreatenewll-gdsltheinthenewelementnewelementelementt .variable. |
. The |
|||
the newly |
llo ated element in ase of su ess. |
|
||
NULL in |
ase of failure. |
|
|
|
See also: |
|
|
|
|
gdsl_free_fun _t(p. 191) |
|
|||
De nition line 144 of le gdsl_typ s.h. |
|
|||
|
|
|
dtfunypebNULL2006a.ationgdslfreefunforbeforeoftionelemengdslfunypeustbyofallinggdsltfreeDoxygent)(gdslt variabletheallothisressourfunelement. Thetionest.telem.alloypThet E)n.atedGDSLAmustfreeby |
|
|
|
atE free!=gdsling |
|
|
|
|
the |
|
|
|
orrespbeenfun1.Free3ationonprevatelementordingesn'typedefndingThutypeouslyJunheistoallfunvoid(allo22forkgdsltoif11:15:30tionfre |
|
||
tion. |
|
|
|
|
|
|
|
|
|
funthehaveThisGDSL4.17 |
|
|
|
|
Generated |
|
|
||
|
|
|
|
|

192 |
|
|
|
|
gdsl Module Do umentation |
Parameters:E The ement to |
. |
|
|||
|
gdsl_allo _fun deallo(p. 191)ate |
|
|||
See also: |
line 162 of le gdsl_types.h. |
|
|||
De nition |
|
||||
|
|
|
entflemenisgdslfunforttionopyingtelementvariablettypeE)gdsl._tot(elementopygdsl. __t variablesopy fun. _t)( onst |
||
Returns:Parameters:ThisGDSL4.17E.fun1.CopyThe4 tionatgdslgdslypedelemtypeelemen |
|
|
|||
|
the opied el |
t in ase of su ess. |
|
||
|
NULL in ase of failure. |
|
|||
De nition |
line 175 of le gdsl_types.h. |
|
|||
|
|
gdslef_int(loationgdsl__tmapLOCATION,fun t)(voidonst gdsl_element_t |
|||
4.17.1.5 |
atE,ype |
|
|
|
Parameters:GDSLneededThisdataif USERLOCATIONstrufunMapThe.tiontureaelementtually.typeTheTheismappedfunoptionalforlotionmappingationgdslUSERypeof. elemenEa DATAgdslthein elementdatavariableouldstrubet.usedturevariableUSER. to do_fromDATA)spe ialGDSLthing
Returns: |
_D TA User's datas. |
m |
st pped. |
|
|
STOP if |
|
||
GDSL_MAP_CONT ifthemapping mustbe ontinued. |
||||
De nition |
line 192 f le gdsl |
types.h. |
|
|
|
long eratedin (E,gdslvoid_ ompare_fun _t)( onst |
|||
4.17.1.6 |
atgdslypedeflement |
|
|
|
|
Gen fun tionThutypeJunVALUE). 22 11:15:30 2006 for gdsl by Doxygen |
|||
GDSL Comparison elem |
|
|
|
|
|
|
|
|
|

4.17 GDSL t |
|
|
193 |
|
fun ion typesis used to ompare gdsl element variable with a user |
|
|||
value. The E argument is |
ays the one in the GDSL data stru ture, VALUE |
|||
Thisalw ys he one the user alwants to ompare E wi h. |
|
|
||
Parameters: |
elemen |
t variable ontained into the data stru ture to om- |
||
E The gdsl |
||||
pare from. |
|
|
|
|
VALUE The user data to ompare E with |
|
|
||
Returns: |
|
|
|
|
<0 if E is assumedto be equallessto VALUEanVALUE. . |
|
|
||
07if atEypedefisline 213void(of tolebegdslgreatypesther.than. VALUE. |
|
|
||
4De.17nition>.1. |
|
|
|
|
E, FILE |
gdsl_write_fun t)( onst gdsl_element_t |
|||
void |
OUTPUT_FILE, gdsl_lo ation_t LOCATION, |
PGDSLarameters:ThditionalEOUTPUTfunWriteTheUSERtiongdslelementtypeDATAelementFILEUSERis forfunouldwritingThetotionDAwritebeleypassedA).wheregdsl._totoelementitwrite._Et. E to OUTPUT_FILE. Ad-
LOCATION The lo ation of E in the data stru ture. |
|
USER DATA User's datas. |
|
De nition |
line 229 of le gdsl types.h. |
4.17.1.8 ypedef unsigned long int ulong |
|
De nition |
at line 246 of le gdsl types.h. |
. .2 Enumeration Type Do umentation |
|
4.17.2.1 |
enum gdsl onstant_t |
GDSL Constants.
Enumerator:GDSL ERR_MEM_ALLOC Memory allo ation error MAP_STOP For stopping a parsing fun tion
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

194 |
|
MAP |
|
For ontin |
|
|
gdsl Module Do umentation |
||||||||||||
|
|
|
|
|
|
a parsing fun tion |
|
||||||||||||
|
GDSL_FOUNDCONTo indi atea fouuingded value |
|
|
|
|
|
|||||||||||||
|
|
INSERTED To |
|
te an inserted value |
|
|
|||||||||||||
De nition at line 48 of le gdsl |
|
ypes.h. |
|
|
|
|
|
|
|
|
|
|
|
|
|||||
4.17.2.2 enum gdsl_lo ation_t |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
Enumerator: |
|
UNDEF |
|
|
|
|
t |
|
|
|
|
|
unde ned |
||||||
|
|
|
|
R OT |
|
Element ispositionleaf |
|
|
|||||||||||
|
|
|
|
HEAD |
|
|
|
|
|
|
at head |
|
|
||||||
|
|
|
|
LEAF Element is on rootposition |
|||||||||||||||
|
|
|
|
|
OP |
|
|
|
t is at top |
|
|
|
|
||||||
|
|
|
|
TAIL |
|
|
|
|
t is at tail |
|
|
|
|
||||||
|
|
|
|
BOTTOM Elemen |
is at bottom position |
||||||||||||||
|
|
|
|
|
|
|
Element is the la rst |
||||||||||||
|
|
|
|
|
|
|
C |
L |
|
t is |
|
he |
t is on rst |
||||||
|
|
|
|
|
|
|
C |
|
L |
|
|
|
|
t is |
on last olumn |
||||
|
|
|
|
FIRST_ROW |
|
|
|
|
t is on rst row |
||||||||||
|
GDSL_LOCATION_LAST_ROW Element is on last row |
||||||||||||||||||
De nition at line 69 of le gdsl |
|
types.h. |
|
|
|
|
|
|
|
|
|
|
|
|
|||||
4.17.2.3 |
um bool |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
GDSL boolean type. De nes _NO_LIBGDSL_TYPES_ at ompilation time |
|||||||||||||||||||
if you don't want them. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
Enumerator: |
FALSE |
|
value |
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
FALSE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
TRUE |
TRUE booleanvalue |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
De nition at line 271 of le gdsl types.h. |
|
|
|
|
|
|
|
|
|
|
|
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

Chapter 5 |
|
|
||
gdsl File Do umentation |
||||
5.1 |
gdsl_bintree.h File Referen e |
|
||
Typedefs |
|
|
|
|
|
f _lowgdslint(-levelbintreebinary treegdsltyptree. bintree_t |
|
||
ˆ |
typedGDSL |
|
|
|
|
bintree_t TREE,_gdslvoid_bin _map_fun _t |
)( onst _gdsl_- |
||
ˆ |
typedGDSLf void(low-level binary treeUSERmap_funDATA)tion type. |
|
||
|
bintree_t TREE,_FILEgdsl_bintree_write_fun _t |
)( onst _gdsl_- |
||
|
|
|
|
__elementtDATA)RIGHT) t E, |
Funˆ tionsonstgdslDestrCrGDSLategdslbintreelowanew-levelbinlowtreebinary-l velgdslbinaryttreeLEFT,OUTPUTwritebintrtreefun.onsttionFILE,allogdsltype(void.onstbintreeUSERgdsl |
||||
ˆ |
void |
gdsl bin |
free ( gdsl_bintree_t T, onst gdsl_free_- |
|
|
fun _ |
FREE F) |
|
|
|
|
oy a ow-level binary tr . |
|
|
ˆ |
T, onst gdsl op |
fun COPY_F) |
_gdsl_bintree_t |
|
gdsl_bintree t |
gdsl bintree opy ( onst |
|||
ˆ |
Copy a low-level binary tree. |
|
||
bool |
gdsl bintree |
is empty ( onst _gdsl_bintree_t T) |

196 |
|
|
|
|
|
|
|
y. |
gdsl File Do umentation |
||||||
|
|
|
|
|
|
|
empdu ed to a leaf. |
|
T) |
|
|||||
|
bool |
|
|
|
leaf ( onst _gdsl |
bintree_ |
|
||||||||
ˆ |
gdsl_bintree is_root |
|
|
_gdsl |
bintree |
T) |
|||||||||
gdsl |
lement |
|
_gdsl bintree |
get_ ontent |
( onst |
_gdsl_- |
|||||||||
|
Che k if a low-level binary tree is(aonstot. |
|
|
|
|
|
|
|
|||||||
|
bintree |
t T) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Get the parentontenttr of a low-level binary tr . |
. |
|
|
|
|
|
||||||||
ˆ |
Get the root |
|
of a low-level binary tr |
parent |
( onst |
_gdsl_- |
|||||||||
gdsl_bintree |
|
_gdsl |
bintree |
|
|
|
|||||||||
ˆ |
bintree |
t T) |
|
gdsl |
bintree_ |
_left |
( onst |
|
_gdsl_- |
||||||
gdsl_bintree |
|
|
|||||||||||||
|
bintree |
t T) |
ee of a low-level binary tr . |
|
|
|
|
|
|||||||
ˆ |
Get the left sub- |
right |
( onst |
_gdsl_- |
|||||||||||
gdsl_bintree |
tr |
_gdsl |
bintree |
|
|
|
|||||||||
|
bintree |
t T) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Get the right sub-tree of a low-level binary tr e. |
|
|
|
|
ˆˆ bintreegdslgdslGet__thebintreetbintreeleftT)sub-tree referengdsle ofbintreea low-levelgetbinarylefttreref. ( onst _gdsl_-
ˆ |
|
|
|
binsubtofaT)-lowtreealow-levelreferen-levelgetgdslbinarybinaryesizeheighofbintreetenra(treelow.onst(.-levelonstgetgdslbinarygdslrightbintreetreebintree. ref t( T)onstt T) _- |
|||||||
|
|
|
gdslsizeheightrightof |
|
|
|
|
|
|
|
|
|
|
|
the |
|
|
|
|
|
|
|
|
|
Getbintree |
|
|
|
|
|
|
|
|||
|
ulonggdsl |
|
|
|
|
|
|
|
|||
|
void |
|
gdsl |
bintree_set_ on |
_gdsl_bintree_t |
T, onst |
|||||
|
gdsl_el men |
|
E) |
|
|
low-level binary tree. |
|
|
|||
|
Set the parentelementtr of |
|
|
||||||||
|
Set the oot |
|
P) |
|
of a low-level binary tree. |
|
|
||||
|
gdsl_bintree |
|
|
|
set parent ( |
gdsl_bintree_t T, |
onst _- |
||||
ˆ void |
_gdsl bintree |
|
|||||||||
|
|
|
|
|
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen |
|