                                Source Listing                  24-APR-1996 13:22:46    DEC C T4.1-FT2                      Page   1
                                                                 6-DEC-1995 09:57:25    WORK$:[DAVENPORT.RTL]LIST.C;1

	      1 
	      2 /******************************************************************************
	      3  *
	      4  * List.C
	      5  *
	      6  ******************************************************************************/
	      7 
	      8 /******************************************************************************
	      9  *
	     10  * Headers
	     11  *
	     12  ******************************************************************************/
	     13 
	     14 #include <stdio.h>
	    396 
	    397 #include "intrinsic.h"
	    428 #include "list.h"
	    465 #include "mem.h"
	    480 
	    481 /******************************************************************************
	    482  *
	    483  * Local Constants and Macros
	    484  *
	    485  ******************************************************************************/
	    486 
	    487 /******************************************************************************
	    488  *
	    489  * Local Declarations
	    490  *
	    491  ******************************************************************************/
	    492 
	    493 /******************************************************************************
	    494  *
	    495  * Local Prototypes
	    496  *
	    497  ******************************************************************************/
	    498 
	    499 /******************************************************************************
	    500  *
	    501  * ListAlloc
	    502  *
	    503  ******************************************************************************/
	    504 
	    505 #ifdef VMS
	    506 extern List ListAlloc (void)
	    507 #else
       X    508 extern List ListAlloc ()
       X    509 #endif
	    510 {
	    511   List list;
	    512 
	    513   /* allocate */
	    514   list = (List) MemAlloc (sizeof(_List), Initialize);
	    515 
	    516   /* return */
	    517   return (list);
	    518 }

                                Source Listing                  24-APR-1996 13:22:46    DEC C T4.1-FT2                      Page   2
                                                                 6-DEC-1995 09:57:25    WORK$:[DAVENPORT.RTL]LIST.C;1

	    519 
	    520 /******************************************************************************
	    521  *
	    522  * ListDealloc
	    523  *
	    524  ******************************************************************************/
	    525 
	    526 #ifdef VMS
	    527 extern Status ListDealloc (List list)
	    528 #else
       X    529 extern Status ListDealloc (list)
       X    530 
       X    531   List list;
       X    532 #endif
	    533 
	    534 {
	    535   /* free */
	    536   MemDealloc (list);
	    537 
	    538   /* done */
	    539   return (Success);
	    540 }
	    541 
	    542 /******************************************************************************
	    543  *
	    544  * ListNodeAlloc
	    545  *
	    546  ******************************************************************************/
	    547 
	    548 #ifdef VMS
	    549 extern ListNode ListNodeAlloc (void)
	    550 #else
       X    551 extern ListNode ListNodeAlloc ()
       X    552 #endif
	    553 
	    554 {
	    555   ListNode node;
	    556 
	    557 
	    558   /* allocate a node */
	    559   node = (ListNode) MemAlloc (sizeof(_ListNode), NoInitialize);
	    560 
	    561   /* done */
	    562   return (node);
	    563 }
	    564 
	    565 /******************************************************************************
	    566  *
	    567  * ListNodeDealloc
	    568  *
	    569  ******************************************************************************/
	    570 
	    571 #ifdef VMS
	    572 extern Status ListNodeDealloc (ListNode node)
	    573 #else
       X    574 extern Status ListNodeDealloc (node)
       X    575 

                                Source Listing                  24-APR-1996 13:22:46    DEC C T4.1-FT2                      Page   3
                                                                 6-DEC-1995 09:57:25    WORK$:[DAVENPORT.RTL]LIST.C;1

       X    576   ListNode node;
       X    577 #endif
	    578 
	    579 {
	    580   /* free */
	    581   MemDealloc (node);
	    582 
	    583   /* done */
	    584   return (Success);
	    585 }
	    586 
	    587 /******************************************************************************
	    588  *
	    589  * ListNodesDealloc
	    590  *
	    591  ******************************************************************************/
	    592 
	    593 #ifdef VMS
	    594 extern Status ListNodesDealloc (List list)
	    595 #else
       X    596 extern Status ListNodesDealloc (list)
       X    597 
       X    598   List list;
       X    599 #endif
	    600 
	    601 {
	    602   /* TBD */
	    603 
	    604   /* free list nodes */
	    605 
	    606   /* done */
	    607   return (Failure);
	    608 }
	    609 
	    610 /******************************************************************************
	    611  *
	    612  * ListInit
	    613  *
	    614  ******************************************************************************/
	    615 
	    616 #ifdef VMS
	    617 extern Status ListInit (List list)
	    618 #else
       X    619 extern Status ListInit (list)
       X    620 
       X    621   List list;
       X    622 #endif
	    623 
	    624 {
	    625   /* initialize */
	    626   list->head = NULL;
	    627   list->tail = NULL;
	    628 
	    629   /* done */
	    630   return (Success);
	    631 }
	    632 

                                Source Listing                  24-APR-1996 13:22:46    DEC C T4.1-FT2                      Page   4
                                                                 6-DEC-1995 09:57:25    WORK$:[DAVENPORT.RTL]LIST.C;1

	    633 /******************************************************************************
	    634  *
	    635  * ListAppend
	    636  *
	    637  ******************************************************************************/
	    638 
	    639 #ifdef VMS
	    640 extern ListNode ListAppend (List list, Pointer data)
	    641 #else
       X    642 extern ListNode ListAppend (list, data)
       X    643 
       X    644   List    list;
       X    645   Pointer data;
       X    646 #endif
	    647 
	    648 {
	    649   ListNode node;
	    650 
	    651   /* allocate a node */
	    652   node = (ListNode) MemAlloc (sizeof(_ListNode), NoInitialize);
	    653 
	    654   /* save data */
	    655   node->data = data;
	    656 
	    657   /* append to list */
	    658   if (! list->head) {
	    659     node->previous = NULL;
	    660     node->next     = NULL;
	    661     list->head     = node;
	    662     list->tail     = node;
	    663   }
	    664   else {
	    665     node->previous   = list->tail;
	    666     node->next       = NULL;
	    667     list->tail->next = node;
	    668     list->tail       = node;
	    669   }
	    670 
	    671   /* done */
	    672   return (node);
	    673 }
	    674 
	    675 /******************************************************************************
	    676  *
	    677  * ListPreface
	    678  *
	    679  ******************************************************************************/
	    680 
	    681 #ifdef VMS
	    682 extern ListNode ListPreface (List list, Pointer data)
	    683 #else
       X    684 extern ListNode ListPreface (list, data)
       X    685 
       X    686   List    list;
       X    687   Pointer data;
       X    688 #endif
	    689 

                                Source Listing                  24-APR-1996 13:22:46    DEC C T4.1-FT2                      Page   5
                                                                 6-DEC-1995 09:57:25    WORK$:[DAVENPORT.RTL]LIST.C;1

	    690 {
	    691   ListNode node;
	    692 
	    693   /* allocate a node */
	    694   node = (ListNode) MemAlloc (sizeof(_ListNode), NoInitialize);
	    695 
	    696   /* save data */
	    697   node->data = data;
	    698 
	    699   /* append to list */
	    700   if (! list->head) {
	    701     node->previous = NULL;
	    702     node->next     = NULL;
	    703     list->head     = node;
	    704     list->tail     = node;
	    705   }
	    706   else {
	    707     node->previous       = NULL;
	    708     node->next           = list->head;
	    709     list->head->previous = node;
	    710     list->head           = node;
	    711   }
	    712 
	    713   /* done */
	    714   return (node);
	    715 }


Command Line
------- ----

CC /NOANSI_ALIAS/ASSUME=(ACCURACY_SENSITIVE,ALIGNED_OBJECTS,WRITABLE_STRING_LITERALS)
/DEBUG=(SYMBOLS,TRACEBACK)/ENDIAN=LITTLE/EXTERN_MODEL=RELAXED_REFDEF/FLOAT=(
G_FLOAT)/GRANULARITY=QUADWORD/INSTRUCTION_SET=FLOATING_POINT/L_DOUBLE_SIZE=128
/LIST/NOMACHINE_CODE/MEMBER_ALIGNMENT/NAMES=UPPERCASE/NESTED_INCLUDE_DIRECTORY=INCLUDE_FILE
/OBJECT/NOOPTIMIZE/PREFIX=(ALL_ENTRIES)/PSECT_MODEL=NOMULTILANGUAGE/ROUNDING_MODE=NEAREST
/SHOW=(HEADER,SOURCE)/SIGNED_CHAR/STANDARD=VAXC/REENTRANCY=TOLERANT/WARNINGS
