Changeset 91 for trunk/src/xmlmodel.c


Ignore:
Timestamp:
Apr 8, 2008, 8:52:18 AM (12 years ago)
Author:
cameron
Message:

ATTLIST semantics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/xmlmodel.c

    r67 r91  
    99#include "multiliteral.h"
    1010#include "xmlmodel.h"
     11
     12Model_Info::Model_Info() {
     13        ElementAttributeData.push_back(vector<ATT_info *>());
     14        globalElementCount = 0;
     15        globalAttributeCount = 0;
     16}
    1117
    1218Model_Info::~Model_Info() {
     
    7985                BOM_units = B;
    8086 }
     87int Model_Info::getOrInsertGlobalElement(unsigned char * elem_name, int lgth) {
     88        int elemID;
     89        char *s = new char[lgth+1];
     90        memcpy(s, elem_name, lgth);
     91        s[lgth] = '\0';
     92        elemID = GlobalElementTable[s];
     93        if(elemID==0){ 
     94                GlobalElementTable[s]=++(globalElementCount);
     95                elemID = globalElementCount;
     96               
     97                ElementAttributeData.push_back(vector<ATT_info *>());
     98        }
     99        return elemID;
     100}
     101
     102int Model_Info::getOrInsertGlobalAttName(unsigned char * att_name, int lgth){
     103       
     104        char *s = new char[lgth+1];
     105        memcpy(s, att_name, lgth);
     106        s[lgth] = '\0';
     107       
     108        int attID = GlobalAttributeTable[s];
     109        if(attID==0){   
     110                GlobalAttributeTable[s]=++(globalAttributeCount);
     111                attID = globalAttributeCount;
     112        }
     113        return attID;
     114}
Note: See TracChangeset for help on using the changeset viewer.