home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / language / asxsrc / lkhead.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-25  |  1.2 KB  |  78 lines

  1. /* lkhead.c */
  2.  
  3. /*
  4.  * (C) Copyright 1989
  5.  * All Rights Reserved
  6.  *
  7.  * Alan R. Baldwin
  8.  * 721 Berkeley St.
  9.  * Kent, Ohio  44240
  10.  */
  11.  
  12. #include <stdio.h>
  13. #include "aslink.h"
  14.  
  15. /*
  16.  * Create a new header entry.
  17.  *
  18.  * H n areas n global symbols
  19.  *   |       |
  20.  *   |       `---- hp->h_nglob
  21.  *   `------------ hp->h_narea
  22.  *
  23.  */
  24. VOID
  25. newhead()
  26. {
  27.     register i;
  28.     struct head *thp;
  29.  
  30.     hp = (struct head *) new (sizeof(struct head));
  31.     if (headp == NULL) {
  32.         headp = hp;
  33.     } else {
  34.         thp = headp;
  35.         while (thp->h_hp)
  36.             thp = thp->h_hp;
  37.         thp->h_hp = hp;
  38.     }
  39.     /*
  40.      * Set file pointer
  41.      */
  42.     hp->h_lfile = cfp;
  43.     /*
  44.      * Evaluate and build Area pointer list
  45.      */
  46.     i = hp->h_narea = eval();
  47.     if (i)
  48.         hp->a_list = (VOID **) new (i*sizeof(struct area *));
  49.     /*
  50.      * Evaluate and build Global symbol pointer list
  51.      */
  52.     skip(-1);
  53.     i = hp->h_nglob = eval();
  54.     if (i)
  55.         hp->s_list = (VOID **) new (i*sizeof(struct sym *));
  56.     /*
  57.      * Setup Absolute DEF linkage.
  58.      */
  59.     lkparea(_abs_);
  60.     ap->a_flag = A_ABS|A_OVR;
  61. }
  62.  
  63. /*
  64.  * Module Name
  65.  */
  66. VOID
  67. module()
  68. {
  69.     char id[NCPS];
  70.  
  71.     if (headp) {
  72.         getid(id, -1);
  73.         strncpy(hp->m_id, id, NCPS);
  74.     } else {
  75.         fprintf(stderr, "No header defined\n");
  76.     }
  77. }
  78.