home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OBJASM.ZIP
/
OUSTRUCT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-03
|
996b
|
44 lines
#include <stdio.h>
#include <string.h>
#include "o.h"
int struc_compare( STRUC_T *, STRUC_T * );
int struc_compare( rec_1, rec_2 )
STRUC_T *rec_1;
STRUC_T *rec_2;
{
int result;
result = strcmp(rec_1->form, rec_2->form);
if ( result == 1 ) {
result = LEFT;
} else {
if ( result == 0 ) {
return( EQUAL );
} else {
return( RIGHT );
}
}
}
STRUC_T *struc_insert( form )
char *form;
{
STRUC_T *struc_rec;
NODE_T *struc_node;
char *form_copy;
int length;
struc_rec = (STRUC_T *)o_malloc( sizeof(STRUC_T) );
length = strlen(form) + 1;
form_copy = (char *)o_malloc( length );
strcpy( form_copy, form );
struc_rec->form = form_copy;
struc_rec->index = 0; /* Not determined yet */
struc_node = insert( (char *)struc_rec, struc_tree, struc_compare );
return( (STRUC_T *)struc_node->data );
}