9 /* Just output a reference which must be filled in on a second pass */
12 out( "($%s$ - %ld)", lab, cur_pos);
26 struct t_label label_list[ MAX_LABEL];
32 /* Record position of this label */
37 if ( n_labs >= MAX_LABEL)
38 error( "Too many labels!!\n");
40 label_list[ n_labs].lab = Salloc( lab, strlen( lab) + 1);
41 label_list[ n_labs++].position = cur_pos;
50 /* Output position-count of the label in file 'f', remove also trailing $ */
56 fscanf( f, " %[^$]$", buf);
57 for ( i = 0; i < n_labs; i++)
58 if ( strcmp( buf, label_list[i].lab) == 0) {
59 out( "%ld", label_list[i].position);
62 error( "relocate() : can't find local label %s\n", buf);
71 /* Echo the text on file '.tmp', but replace every occurence of label-
72 *reference's by its position-count. Reference of label 'foo' is '$foo$'.
80 save = fopen( ".tmp", "r");
82 while ( ( c = getc( save)) != EOF)
85 else if ( c == '/') { /* skip comments */
95 while ( !( c1 == '*' && c == '/'));
107 extern arith cur_pos;
111 if ( ! sys_open( ".tmp", OP_WRITE, &outfile))
112 fprint( STDERR, "can't open .tmp\n");