| 107 | } |
| 108 | |
| 109 | BOOLEAN intersect_set (leftv result, leftv arg) |
| 110 | { |
| 111 | if ((arg==NULL) |
| 112 | ||(arg->next==NULL) |
| 113 | ||(arg->Typ()!=si_intset_type_id) |
| 114 | ||(arg->next->Typ()!=si_intset_type_id) |
| 115 | ||(arg->next->next->Typ()!=si_intset_type_id)) |
| 116 | { |
| 117 | WerrorS("syntax: intersect_set(<intset>,<intset>,<intset>)"); |
| 118 | return TRUE; |
| 119 | } |
| 120 | si_intset *a=(si_intset*)arg->Data(); |
| 121 | si_intset *b=(si_intset*)arg->next->Data(); |
| 122 | si_intset *c=(si_intset*)arg->next->next->Data(); |
| 123 | c->clear(); |
| 124 | if (b->size() < a->size()) |
| 125 | { |
| 126 | for (si_intset::const_iterator it = b->begin(); it != b->end(); it++) |
| 127 | { |
| 128 | if (a->find(*it) != a->end()) |
| 129 | c->insert(*it); |
| 130 | } |
| 131 | } |
| 132 | else |
| 133 | { |
| 134 | for (si_intset::const_iterator it = a->begin(); it != a->end(); it++) |
| 135 | { |
| 136 | if (b->find(*it) != b->end()) |
| 137 | c->insert(*it); |
| 138 | } |
| 139 | } |
| 140 | result->rtyp=NONE; |
| 141 | result->data= NULL; |
| 142 | return FALSE; |
| 143 | } |
| 144 | |
| 145 | BOOLEAN insert_set (leftv result, leftv arg) |
| 146 | { |