version 1.16, 1994/03/08 10:26:13
|
version 1.17, 1994/05/16 14:59:19
|
Line 72 struct _HTStream {
|
Line 72 struct _HTStream {
|
#define PUTC(ch) ((*context->actions->put_character)(context->target, ch)) |
#define PUTC(ch) ((*context->actions->put_character)(context->target, ch)) |
|
|
|
|
|
/* Find Attribute Number |
|
** --------------------- |
|
*/ |
|
|
|
PUBLIC int SGMLFindAttribute ARGS2 (HTTag*, tag, CONST char *, s) |
|
{ |
|
attr* attributes = tag->attributes; |
|
|
|
int high, low, i, diff; /* Binary search for attribute name */ |
|
for(low=0, high=tag->number_of_attributes; |
|
high > low ; |
|
diff < 0 ? (low = i+1) : (high = i) ) { |
|
i = (low + (high-low)/2); |
|
diff = strcasecomp(attributes[i].name, s); |
|
if (diff==0) return i; /* success: found it */ |
|
} /* for */ |
|
|
|
return -1; |
|
} |
|
|
|
|
/* Handle Attribute |
/* Handle Attribute |
** ---------------- |
** ---------------- |
Line 79 struct _HTStream {
|
Line 99 struct _HTStream {
|
/* PUBLIC CONST char * SGML_default = ""; ?? */ |
/* PUBLIC CONST char * SGML_default = ""; ?? */ |
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
PRIVATE void handle_attribute_name(HTStream * context, const char * s) |
PRIVATE void handle_attribute_name(HTStream * context, CONST char * s) |
#else |
#else |
PRIVATE void handle_attribute_name(context, s) |
PRIVATE void handle_attribute_name(context, s) |
HTStream * context; |
HTStream * context; |
Line 88 PRIVATE void handle_attribute_name(conte
|
Line 108 PRIVATE void handle_attribute_name(conte
|
{ |
{ |
|
|
HTTag * tag = context->current_tag; |
HTTag * tag = context->current_tag; |
attr* attributes = tag->attributes; |
|
|
|
int high, low, i, diff; /* Binary search for attribute name */ |
int i = SGMLFindAttribute(tag, s); |
for(low=0, high=tag->number_of_attributes; |
if (i>=0) { |
high > low ; |
context->current_attribute_number = i; |
diff < 0 ? (low = i+1) : (high = i) ) { |
context->present[i] = YES; |
i = (low + (high-low)/2); |
if (context->value[i]) { |
diff = strcasecomp(attributes[i].name, s); |
free(context->value[i]); |
if (diff==0) { /* success: found it */ |
context->value[i] = NULL; |
context->current_attribute_number = i; |
} |
context->present[i] = YES; |
return; |
if (context->value[i]) { |
} /* if */ |
free(context->value[i]); |
|
context->value[i] = NULL; |
|
} |
|
return; |
|
} /* if */ |
|
|
|
} /* for */ |
|
|
|
if (TRACE) |
if (TRACE) |
fprintf(stderr, "SGML: Unknown attribute %s for tag %s\n", |
fprintf(stderr, "SGML: Unknown attribute %s for tag %s\n", |
s, context->current_tag->name); |
s, context->current_tag->name); |
Line 229 PRIVATE void end_element(context, old_ta
|
Line 241 PRIVATE void end_element(context, old_ta
|
} |
} |
|
|
|
|
/* Start a element |
/* Start an element |
|
** ---------------- |
*/ |
*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
PRIVATE void start_element(HTStream * context) |
PRIVATE void start_element(HTStream * context) |