LCOV - code coverage report
Current view: top level - libreoffice/dmake/unix - rmprq.c (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 40 0.0 %
Date: 2012-12-17 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             : --
       3             : -- SYNOPSIS
       4             : --      Remove prerequisites code.
       5             : --
       6             : -- DESCRIPTION
       7             : --  This code is different for DOS and for UNIX and parallel make
       8             : --  architectures since the parallel case requires the rm's to be
       9             : --  run in parallel, whereas DOS guarantees to run them sequentially.
      10             : --
      11             : -- AUTHOR
      12             : --      Dennis Vadura, dvadura@dmake.wticorp.com
      13             : --
      14             : -- WWW
      15             : --      http://dmake.wticorp.com/
      16             : --
      17             : -- COPYRIGHT
      18             : --      Copyright (c) 1996,1997 by WTI Corp.  All rights reserved.
      19             : --
      20             : --      This program is NOT free software; you can redistribute it and/or
      21             : --      modify it under the terms of the Software License Agreement Provided
      22             : --      in the file <distribution-root>/readme/license.txt.
      23             : --
      24             : -- LOG
      25             : --      Use cvs log to obtain detailed change logs.
      26             : */
      27             : 
      28             : #include "extern.h"
      29             : 
      30             : PUBLIC void
      31           0 : Remove_prq( tcp )/*
      32             : ===================
      33             :    Removable targets (ie. an inferred intermediate node) are removed
      34             :    by this function by running Make() on the special target .REMOVE
      35             :    (pointed to by tcp).
      36             :    As this function can be called from within another Make() (for example
      37             :    like this:
      38             :      Make()->Exec_commands()->Do_cmnd()->runargv()->..->_finished_child()
      39             :      ->Update_time_stamp()->Remove_prq() )
      40             :    it is necessary to store and restore the dynamic macros when Make()
      41             :    is finished.
      42             : 
      43             :    FIXME: Another potential problem is that while building .REMOVE another
      44             :    previously started target finishes and from _finished_child() calls
      45             :    Remove_prq() again. This will delete the dynamic macros and possibly
      46             :    clear/reset the prerequisites of the previous .REMOVE target.
      47             : */
      48             : CELLPTR tcp;
      49             : {
      50             :    static  LINKPTR rlp = NIL(LINK);
      51             :    static  int flag = 0;
      52             :    static  HASHPTR m_at, m_q, m_b, m_g, m_l, m_bb, m_up;
      53             :    char    *m_at_s, *m_g_s, *m_q_s, *m_b_s, *m_l_s, *m_bb_s, *m_up_s;
      54             :    LINKPTR tlp;
      55             : 
      56             :    /* Unset F_MADE and F_VISITED. */
      57           0 :    tcp->ce_flag         &= ~(F_MADE|F_VISITED);
      58           0 :    tcp->ce_time          = 0L;
      59             : 
      60             :    /* The idea seems to be to create a target that is used to remove
      61             :     * intermediate prerequisites. Why add something to the "CeMeToo(tlp)"
      62             :     * list? I don't understand this yet.
      63             :     * FIXME! Either comment on what is going on or fix the code. */
      64           0 :    for( tlp=rlp; tlp !=NIL(LINK); tlp=tlp->cl_next )
      65             :       /* Find first target that has F_VISITED not set or F_MADE set,
      66             :        * i.e. it is not currently made or already done. */
      67           0 :       if( (tlp->cl_prq->ce_flag & (F_VISITED|F_MADE)) != F_VISITED )
      68           0 :      break;
      69             : 
      70           0 :    if( tlp == NIL(LINK) ) {
      71           0 :       TALLOC(tlp, 1, LINK);
      72           0 :       TALLOC(tlp->cl_prq, 1, CELL);
      73           0 :       tlp->cl_next = rlp;
      74           0 :       rlp = tlp;
      75             :    }
      76             : 
      77           0 :    *tlp->cl_prq = *tcp;
      78             : 
      79             :    /* We save the dynamic macro values here, as it is possible that the
      80             :     * .REMOVE recipe is getting executed for a target while some other target
      81             :     * is in the middle of executing it's list of recipe lines, in this case
      82             :     * the values of $@ etc, must be preserved so that when we return to
      83             :     * complete the other recipe we must make certain that the values of it's
      84             :     * dynamic macros are unmodified. */
      85             : 
      86           0 :    if( !flag ) {
      87             :       /* Do the getting of the macros only once. */
      88           0 :       flag = 1;
      89           0 :       m_at = Get_name("@", Macs, TRUE);
      90           0 :       m_g  = Get_name(">", Macs, TRUE);
      91           0 :       m_q  = Get_name("?", Macs, TRUE);
      92           0 :       m_b  = Get_name("<", Macs, TRUE);
      93           0 :       m_l  = Get_name("&", Macs, TRUE);
      94           0 :       m_bb = Get_name("*", Macs, TRUE);
      95           0 :       m_up = Get_name("^", Macs, TRUE);
      96             :    }
      97             : 
      98           0 :    m_at_s = m_at->ht_value; m_at->ht_value = NIL(char);
      99           0 :    m_g_s  = m_g->ht_value;  m_g->ht_value  = NIL(char);
     100           0 :    m_q_s  = m_q->ht_value;  m_q->ht_value  = NIL(char);
     101           0 :    m_b_s  = m_b->ht_value;  m_b->ht_value  = NIL(char);
     102           0 :    m_l_s  = m_l->ht_value;  m_l->ht_value  = NIL(char);
     103           0 :    m_bb_s = m_bb->ht_value; m_bb->ht_value = NIL(char);
     104           0 :    m_up_s = m_up->ht_value; m_up->ht_value = NIL(char);
     105             : 
     106           0 :    Make( tlp->cl_prq, tcp );
     107           0 :    if( tlp->cl_prq->ce_dir ){
     108           0 :       FREE(tlp->cl_prq->ce_dir);
     109           0 :       tlp->cl_prq->ce_dir=NIL(char);
     110             :    }
     111             : 
     112           0 :    m_at->ht_value = m_at_s;
     113           0 :    m_g->ht_value  = m_g_s;
     114           0 :    m_q->ht_value  = m_q_s;
     115           0 :    m_b->ht_value  = m_b_s;
     116           0 :    m_l->ht_value  = m_l_s;
     117           0 :    m_bb->ht_value = m_bb_s;
     118           0 :    m_up->ht_value = m_up_s;
     119           0 : }

Generated by: LCOV version 1.10