Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

Tag.c

Go to the documentation of this file.
00001 /*
00002  *    gui - [gega user interface] the flexible solution for user interface problems
00003  *    Copyright (C) 2002  Gergely Gati
00004  *
00005  *    This program is free software; you can redistribute it and/or modify
00006  *    it under the terms of the GNU General Public License as published by
00007  *    the Free Software Foundation; version 2 of the License.
00008  *
00009  *    This program is distributed in the hope that it will be useful,
00010  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *    GNU General Public License for more details.
00013  *
00014  *    You should have received a copy of the GNU General Public License
00015  *    along with this program; if not, write to the Free Software
00016  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  *
00018  *    Gergely Gati
00019  *      email:           g.gati@freemail.hu
00020  *      AIM screenname:  GatiGergely
00021  *      ICQ number:      93131690
00022  *
00023  */
00024 #include "debug.h"
00025 #include "macros.h"
00026 #include "Tag.h"
00027 
00028 tag *tag_GetNextTag(tag *TagList)
00029 {
00030     tag *Tag = TagList;
00031 
00032   debug_Begin();
00033 
00034   if(Tag!=NULL)
00035   {
00036     if(Tag->Name<16)
00037     {
00038         while ((Tag != NULL) && (Tag->Name < 16))
00039         {
00040             switch (Tag->Name)
00041             {
00042                 case TAG_END:
00043                 {
00044                     Tag = NULL;
00045                 }
00046                 break;
00047 
00048                 case TAG_MORE:
00049                 {
00050                     Tag = (tag *)Tag->Data;
00051                 }
00052                 break;
00053 
00054                 case TAG_SKIP:
00055                 {
00056                     Tag += Tag->Data + 1;
00057                 }
00058                 break;
00059 
00060                 case TAG_IGNORE:
00061                 {
00062                     Tag++;
00063                 }
00064                 break;
00065 
00066                 default:
00067                 {
00068                   Tag++;
00069               }
00070               break;
00071             }
00072         }
00073     }
00074     else Tag++;
00075   }
00076 
00077   debug_End();
00078 
00079     return (Tag);
00080 }
00081 
00082 tag *tag_FindTag(tag *TagList, u32 TagName)
00083 {
00084     tag *Tag;
00085 
00086   debug_Begin();
00087 
00088     for (Tag = TagList; Tag != NULL; Tag = tag_GetNextTag(Tag))
00089     {
00090         if (Tag->Name == TagName) break;
00091     }
00092 
00093   debug_End();
00094 
00095     return (Tag);
00096 }
00097 
00098 u32 tag_GetTagData(tag *TagList, u32 TagName, u32 DefaultTagData)
00099 {
00100     tag *Tag;
00101     u32 ret=0L;
00102 
00103   debug_Begin();
00104 
00105     if (TagList!=NULL && (Tag = tag_FindTag(TagList, TagName)))
00106     {
00107         ret = Tag->Data;
00108     }
00109     else
00110     {
00111         ret = DefaultTagData;
00112     }
00113 
00114   debug_End();
00115 
00116   return (ret);
00117 }
00118 
00119 u32 tag_GetTagDataChg(tag *TagList, u32 TagName, u32 DefaultTagData)
00120 {
00121     tag *Tag;
00122     u32 ret=0L;
00123 
00124   debug_Begin();
00125 
00126     if (TagList!=NULL && (Tag = tag_FindTag(TagList, TagName)))
00127     {
00128       Tag->Name=TAG_IGNORE;
00129         ret = Tag->Data;
00130     }
00131     else
00132     {
00133         ret = DefaultTagData;
00134     }
00135 
00136   debug_End();
00137 
00138   return (ret);
00139 }
00140 
00141 
00142 int tag_CountTags(tag *TagList)
00143 {
00144     tag *Tag;
00145     int TagCount;
00146 
00147   debug_Begin();
00148 
00149     for (TagCount=0, Tag = TagList; Tag != NULL; Tag = tag_GetNextTag(Tag), TagCount++);
00150 
00151   debug_End();
00152 
00153     return (TagCount);
00154 }

Generated on Tue Jan 7 12:11:24 2003 for THEGUI by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002