Commits

rubenvb committed 0f0031e

Primitive inner conditional skipping. On to adding LIBS and others.
Progress, at long last!

  • Participants
  • Parent commits ba91bad

Comments (0)

Files changed (11)

Ambrosia/Source/main.cpp

     const double cleanup_time = difftime( t, time(0) );
 
     debug(0) << "main::Execution took " << exec_time << " seconds.\n"
-         << "Cleanup took " << cleanup_time << " seconds.\n"
-         << "error_status() was called " << error_status_calls << " times.\n";
-
+         << "Cleanup took " << cleanup_time << " seconds.\n";
+#ifdef AMBROSIA_DEBUG
+    debug(0) << "error_status() was called " << s_error_status_calls << " times.\n"
+         << "full_directory_name() was called " << s_full_directory_name_calls << " times.\n";
+#endif
     return 0;
 }

Ambrosia/Source/reader.cpp

 state* reader::event()
 {
     // load project files
-    debug(0) << "reader:::event::calling extract_nectar with filename: "
+    debug(1) << "reader:::event::calling extract_nectar with filename: "
              << lib::s_ambrosia_config.path_to_project_file() << "\n";
     lib::drink_nectar( lib::s_ambrosia_config.path_to_project_file(), m_targets );
     if( lib::error_status() )

libAmbrosia/Include/Ambrosia/algorithm.h

 
 libambrosia_namespace_begin
 
+#ifdef AMBROSIA_DEBUG
+extern size_t s_full_directory_name_calls;
+#endif
+
 /* Freestanding functions (libAmbrosia independent, including no untransparent error handling)
  *************************/
 // merges directory and subdirectory names to one, does the right thing if the second part is empty

libAmbrosia/Include/Ambrosia/status.h

 libambrosia_namespace_begin
 
 #ifdef AMBROSIA_DEBUG
-extern size_t error_status_calls;
+extern size_t s_error_status_calls;
 #endif
 
 // set error status with appropriate messages

libAmbrosia/Source/Ambrosia/Configuration/config_base.cpp

     m_build_directory()
 {
     initialize_config();
-    debug(0) << "\nconfig_base::config contains:\n" << m_config << "\n";
+    debug(4) << "\nconfig_base::config contains:\n" << m_config << "\n";
 }
 config_base::config_base( toolchain requested_toolchain )
 :   m_environment_PATH( get_environment_PATH() ),

libAmbrosia/Source/Ambrosia/Platform/windows.cpp

 /*
  * Mostly platform dependently implemented functions
  ****************************************************/
-/*bool directory_exists( const std::string &directory )
-{
-    DWORD attribs = GetFileAttributesW( convert_to_utf16(directory).c_str() );
-    if( attribs == INVALID_FILE_ATTRIBUTES)
-    {
-        debug(0) << "platform::directory_exists::HANDLE ERRORS\n";
-        return false;
-    }
-    return( attribs & FILE_ATTRIBUTE_DIRECTORY );
-}
-bool file_exists( const std::string &filename )
-{
-    DWORD attribs = GetFileAttributesW( convert_to_utf16(filename).c_str() );
-    if( attribs == INVALID_FILE_ATTRIBUTES )
-    {
-        debug(0) << "platform::file_exists::HANDLE ERRORS\n";
-        return false;
-    }
-    debug(0) << "platform::file_exists::TODO: FILE_ATTRIBUTES_NORMAL is not good enough for all cases\n";
-    return( attribs & FILE_ATTRIBUTE_NORMAL );
-}*/
-
 template<class output_iterator>
 void scan_directory( output_iterator it, const std::string &directory_name )
 {

libAmbrosia/Source/Ambrosia/algorithm.cpp

 
 libambrosia_namespace_begin
 
+#ifdef AMBROSIA_DEBUG
+size_t s_full_directory_name_calls = 0;
+#endif
+
 /* Freestanding functions
  *************************/
 const std::string full_directory_name( const std::string &first_directory, const std::string &second_directory )
 {
+#ifdef AMBROSIA_DEBUG
+    ++s_full_directory_name_calls;
+#endif
     if( first_directory.empty() )
         return second_directory;
     else if( second_directory.empty() )

libAmbrosia/Source/Ambrosia/file_store.cpp

         std::for_each( directories.begin(), directories.end(),
                        [&](const string & directory)
                        {
-                           const string full_dir = full_directory_name(directory, preceding_directory);
+                           const string full_dir = full_directory_name( source_directory,
+                                                                        full_directory_name(directory, preceding_directory) );
                            if( directory_exists(full_dir))
                            {
                                debug(5) << "file_store::find_source_file::Adding deduced directory to search list: "

libAmbrosia/Source/Ambrosia/nectar_loader.cpp

                 token.append( 1, c );
         }
     }
-    debug(6) << "nectar_loader::next_token:Token extracted: \'" << output_form(token) << "\'\n";
+    if( !token.empty() )
+        debug(6) << "nectar_loader::next_token:Token extracted: \'" << output_form(token) << "\'\n";
+
     return !token.empty();
 }
 bool nectar_loader::next_list_token( std::string &token )
     else
     {
         debug(4) << "nectar_loader::process_inner_conditional::conditional returned false, skipping all relevant parts.\n";
+        string token;
+        while( next_token(token, s_special_characters_newline) )
+        {
+            if( "\n" == token )
+                break; // reached the end
+            else
+                continue; // ignore anything in the list following a false conditional
+        }
     }
 
     //emit_error( "!!!Inner conditionals not fully implemented yet.\n" );

libAmbrosia/Source/Ambrosia/status.cpp

 string_vector error_list{};
 string_vector warning_list{};
 #ifdef AMBROSIA_DEBUG
-size_t error_status_calls = 0;
+size_t s_error_status_calls = 0;
 #endif
 
 bool error_status()
 {
 #ifdef AMBROSIA_DEBUG
     debug(0) << "status::error_status::Checking error status now.\n";
-    error_status_calls++;
+    ++s_error_status_calls;
 #endif
     return current_status == status::error;
 }
 {
 #ifdef AMBROSIA_DEBUG
     debug(0) << "status::error_list_status::Checking error status now.\n";
-    error_status_calls++;
+    ++s_error_status_calls;
 #endif
     return current_status == status::list;
 }

libAmbrosia/Source/Ambrosia/target.cpp

         switch( matches.size() )
         {
             case 0:
-               return emit_error("");
+                return emit_nectar_error( "No matches to file " + filename + " found.", filename, line_number );
             case 1:
                 m_source_files[type].insert( *matches.begin() );
                 break;