original_string: private function _buildDirectory()
      {
          // Vars
          $fields = array();
          $directory = array();
          $data_end = 0;
  
          foreach ($this->fields as $field) {
              // No empty fields allowed
              if (!$field->isEmpty()) {
                  // Get data in raw format
                  $str = $field->toRaw();
                  $fields[] = $str;
  
                  // Create directory entry
                  $len = strlen($str);
                  $direntry = sprintf("%03s%04d%05d", $field->getTag(), $len, $data_end);
                  $directory[] = $direntry;
                  $data_end += $len;
              }
          }
  
          /**
           * Rules from MARC::Record::USMARC
           */
          $base_address
              = File_MARC::LEADER_LEN +    // better be 24
                  (count($directory) * File_MARC::DIRECTORY_ENTRY_LEN) +
                                  // all the directory entries
                  1;              // end-of-field marker
  
  
          $total
              = $base_address +  // stuff before first field
                  $data_end +      // Length of the fields
                  1;              // End-of-record marker
  
  
          return array($fields, $directory, $total, $base_address);
      }
code: private function _buildDirectory()
      {
          // Vars
          $fields = array();
          $directory = array();
          $data_end = 0;
  
          foreach ($this->fields as $field) {
              // No empty fields allowed
              if (!$field->isEmpty()) {
                  // Get data in raw format
                  $str = $field->toRaw();
                  $fields[] = $str;
  
                  // Create directory entry
                  $len = strlen($str);
                  $direntry = sprintf("%03s%04d%05d", $field->getTag(), $len, $data_end);
                  $directory[] = $direntry;
                  $data_end += $len;
              }
          }
  
          /**
           * Rules from MARC::Record::USMARC
           */
          $base_address
              = File_MARC::LEADER_LEN +    // better be 24
                  (count($directory) * File_MARC::DIRECTORY_ENTRY_LEN) +
                                  // all the directory entries
                  1;              // end-of-field marker
  
  
          $total
              = $base_address +  // stuff before first field
                  $data_end +      // Length of the fields
                  1;              // End-of-record marker
  
  
          return array($fields, $directory, $total, $base_address);
      }
code_tokens: private function _buildDirectory ( ) { // Vars $ fields = array ( ) ; $ directory = array ( ) ; $ data_end = 0 ; foreach ( $ this -> fields as $ field ) { // No empty fields allowed if ( ! $ field -> isEmpty ( ) ) { // Get data in raw format $ str = $ field -> toRaw ( ) ; $ fields [ ] = $ str ; // Create directory entry $ len = strlen ( $ str ) ; $ direntry = sprintf ( "%03s%04d%05d" , $ field -> getTag ( ) , $ len , $ data_end ) ; $ directory [ ] = $ direntry ; $ data_end += $ len ; } } /**
           * Rules from MARC::Record::USMARC
           */ $ base_address = File_MARC :: LEADER_LEN + // better be 24 ( count ( $ directory ) * File_MARC :: DIRECTORY_ENTRY_LEN ) + // all the directory entries 1 ; // end-of-field marker $ total = $ base_address + // stuff before first field $ data_end + // Length of the fields 1 ; // End-of-record marker return array ( $ fields , $ directory , $ total , $ base_address ) ; }
docstring: Build record directory
  
  Generate the directory of the record according to the current contents
  of the record.
  
  @return array Array ($fields, $directory, $total, $base_address)
docstring_tokens: Build record directory