ugh, gen deps working again
authorFred T. Hamster <fred@feistymeow.org>
Wed, 11 Feb 2026 21:06:33 +0000 (16:06 -0500)
committerFred T. Hamster <fred@feistymeow.org>
Wed, 11 Feb 2026 21:06:33 +0000 (16:06 -0500)
at least it seems to be.  lots of severe tire damage after moving to associative arrays, but the speed is ideal.
just have to get out of the numerically indexed array mindset.

nucleus/tools/clam_tools/value_tagger.cpp
scripts/clam/cpp/buildor_gen_deps.sh

index 1f9ca2c78b4aae6d0306c95f544f2b0f50223483..0265c67b6220a9146dc1dd4ec9958f7d08e5600d 100644 (file)
@@ -960,12 +960,52 @@ HOOPLE_MAIN(value_tagger, )
 #ifdef __BUILD_STATIC_APPLICATION__
   // static dependencies found by buildor_gen_deps.sh:
   #include <algorithms/sorts.cpp>
+  #include <algorithms/sorts.cpp>
+  #include <application/application_shell.cpp>
+  #include <application/callstack_tracker.cpp>
   #include <application/command_line.cpp>
   #include <application/windoze_helper.cpp>
+  #include <basis/astring.cpp>
+  #include <basis/common_outcomes.cpp>
   #include <basis/environment.cpp>
+  #include <basis/guards.cpp>
+  #include <basis/mutex.cpp>
   #include <basis/utf_conversion.cpp>
+  #include <configuration/application_configuration.cpp>
+  #include <configuration/configurator.cpp>
+  #include <configuration/ini_configurator.cpp>
+  #include <configuration/ini_parser.cpp>
+  #include <configuration/table_configurator.cpp>
+  #include <configuration/variable_tokenizer.cpp>
+  #include <filesystem/byte_filer.cpp>
+  #include <filesystem/directory.cpp>
+  #include <filesystem/directory_tree.cpp>
+  #include <filesystem/file_info.cpp>
   #include <filesystem/filename.cpp>
+  #include <filesystem/filename_list.cpp>
+  #include <filesystem/filename_tree.cpp>
+  #include <filesystem/file_time.cpp>
+  #include <filesystem/huge_file.cpp>
+  #include <loggers/combo_logger.cpp>
+  #include <loggers/console_logger.cpp>
   #include <loggers/critical_events.cpp>
+  #include <loggers/file_logger.cpp>
+  #include <loggers/program_wide_logger.cpp>
+  #include <nodes/node.cpp>
+  #include <nodes/packable_tree.cpp>
+  #include <nodes/path.cpp>
+  #include <nodes/tree.cpp>
+  #include <structures/bit_vector.cpp>
+  #include <structures/checksums.cpp>
+  #include <structures/object_packers.cpp>
+  #include <structures/static_memory_gremlin.cpp>
+  #include <structures/string_hasher.cpp>
   #include <structures/string_table.cpp>
+  #include <structures/version_record.cpp>
+  #include <textual/byte_formatter.cpp>
+  #include <textual/parser_bits.cpp>
+  #include <textual/string_manipulation.cpp>
+  #include <timely/earth_time.cpp>
+  #include <timely/time_stamp.cpp>
 #endif // __BUILD_STATIC_APPLICATION__
 
index d1f03e7624c7c70f3cfa2c8f86abaae2080d8483..31a0a3b0298a7b7efb405d081e791b9fb04aac01 100644 (file)
@@ -74,7 +74,7 @@ function seen_already {
 function add_new_dep {
   # make sure we haven't already processed this.
   local dep="$1"; shift
-log_it "looking for dep='$dep'"
+#log_it "looking for dep='$dep'"
   if seen_already "$dep"; then
     if [ ! -z "$DEBUG_BUILDOR_GEN_DEPS" ]; then
       log_it "bailing since seen: $dep"
@@ -167,11 +167,14 @@ declare -A resolve_target_array
 # to be reset between runs on different files because the source hierarchy
 # is not supposed to be getting files deleted or added while the deps are
 # being geneated.
-declare -A resolve_matches_src
-declare -A resolve_matches_dest
+declare -A resolve_matches
 #
 # tries to find a filename in the library hierarchy.
-function resolve_filename {
+function resolve_filename() {
+  # wipe out prior contents from resolved paths.
+  unset resolve_target_array
+  declare -gA resolve_target_array
+
   local code_file=$1
   if [ ! -z "$DEBUG_BUILDOR_GEN_DEPS" ]; then
     log_it "resolving: $code_file"
@@ -186,18 +189,27 @@ function resolve_filename {
   fi
 
   local dir=$(dirname "$code_file")
+  if [ "$dir" == "." ]; then
+    # we plan to behave as if there was no directory for this case.
+    # we can't include a simple dot in our searches below.
+    unset dir
+  fi
   local base=$(basename "$code_file")
   local src_key="$dir/$base"
+  if [ -z "$dir" ]; then
+    # with no directory, or current directory, this just has to be keyed by the basename.
+    src_key="$base"
+  fi
   if [ ! -z "$DEBUG_BUILDOR_GEN_DEPS" ]; then
     log_it "src_key: $src_key"
   fi
 
   # see if we can find that element in the previously resolved items.
-  if [ ! -z "${resolve_matches_src[$src_key]}" ]; then
-#    local found_indy=$__finders_indy
-    local flounder="${resolve_matches_dest[$src_key]}"
-log_it flounder is $flounder
-    resolve_target_array[$flounder]=um
+#log_it "looking for '$src_key' in this list: '${!resolve_matches[@]}'"
+  if [ ! -z "${resolve_matches[$src_key]}" ]; then
+    local flounder="${resolve_matches[$src_key]}"
+#log_it flounder is $flounder
+    resolve_target_array[$flounder]=blup
     if [ ! -z "$DEBUG_BUILDOR_GEN_DEPS" ]; then
       log_it "FOUND \"$src_key\" AT $flounder"
     fi
@@ -205,23 +217,26 @@ log_it flounder is $flounder
   fi
 
   # reset our global list.
-  unset resolve_target_array
-  declare -gA resolve_target_array
+#  unset resolve_target_array
+#  declare -gA resolve_target_array
 
   if [ ! -z "$DEBUG_BUILDOR_GEN_DEPS" ]; then
-    log_it "HAVING TO FIND: $dir and $base"
+    log_it "HAVING TO FIND: dir='$dir' and base='$base'"
   fi
   if [ -z "$dir" ]; then
-    local -a init_list="$(find "$BUILD_TOP" -iname "$base" -exec echo "[{}]=\"o\" " ';')"
-log_it "init list is: ${init_list}"
+    local -a init_list="$(find "$BUILD_TOP" -iname "$base" | sed -e "s%\\(.*\\)%[\1]=lop %")"
+#log_it "no dir case, init list is: ${init_list}"
     if [ ${#init_list} -gt 0 ]; then
       eval resolve_target_array=(${init_list})
+#log_it "after no dir case addition, resolve targets are: " ${!resolve_target_array[@]}
     fi
   else
-    local -a init_list="$(find "$BUILD_TOP" -iname "$base" -exec echo "[{}]=\"j\" " ';' | grep "$dir.$base")"
-log_it "init list is: ${init_list}"
+    # a little tricky here, since we can't emit the associative array init line too early, or it will match for the grep.
+    local -a init_list="$(find "$BUILD_TOP" -iname "$base" | grep "$dir.$base" | sed -e "s%\\(.*\\)%[\1]=oof %")"
+#log_it "with dir case, init list is: ${init_list}"
     if [ ${#init_list} -gt 0 ]; then
       eval resolve_target_array=(${init_list})
+log_it "after dir case addition, resolve targets are: " ${!resolve_target_array[@]}
     fi
   fi
   if [ ! -z "$DEBUG_BUILDOR_GEN_DEPS" ]; then
@@ -232,13 +247,15 @@ log_it "init list is: ${init_list}"
     local -a indies=( ${!resolve_target_array[@]} )
     local first_item=${indies[0]}
     if [ ! -z "$DEBUG_BUILDOR_GEN_DEPS" ]; then
-      log_it ADDING a match: $src_key $first_item
+      log_it ADDING a match: [$src_key]=$first_item
     fi
-    # for unique matches, we will store the correspondence so we can look
-    # it up very quickly later.
-    resolve_matches_src[$src_key]=sup
-    resolve_matches_dest[$first_item]=nada
+    # for unique matches, we will store the correspondence so we can find it very quickly later.
+    resolve_matches[$src_key]="$first_item"
+#log_it "resolve_matches list names now has: " ${!resolve_matches[@]}
+#log_it "resolve_matches list values now has: " ${resolve_matches[@]}
+    return $RET_OKAY
   fi
+  return $RET_FAIL
 }
 #
 ############################################################################
@@ -250,28 +267,34 @@ log_it "init list is: ${init_list}"
 function recurse_on_deps {
   # snag arguments into a list of dependencies to crawl.
   local -a active_deps=($@)
-log_it "active deps passed as $@"
+log_it "active deps passed as: " ${active_deps[@]}
 
   # pull off the first dependency so we can get all of its includes.
   local first_element="${active_deps[0]}"
-  active_deps=(${active_deps[*]:1})
-log_it "first_element is $first_element"
+#log_it "first_element is $first_element"
+#log_it "active_deps before truncate ${active_deps[@]}"
+  active_deps=(${active_deps[@]:1})
+#log_it "active_deps is now ${active_deps[@]}"
 
   # make the best guess we can at the real path.
-  resolve_filename $first_element
+  if ! resolve_filename $first_element; then
+    log_it "** FAILED to resolve the filename for '$first_element'"
+    return $RET_FAIL
+  fi
   local -a indies=( ${!resolve_target_array[@]} )
-  local first_item=${indies[0]}
-log_it "first_item is '$first_item' "
-  local to_examine="$first_item"
+  local to_examine=${indies[0]}
 
   # we didn't already have a failure (due to it being a bad file already
   # or other problems).  and once we execute the below code to grab the
   # file's dependencies, it really is boring and we never want to see it
   # again.
-log_it "assocarray index to use is '$to_examine'"
+log_it "resolved path to examine is '$to_examine'"
   if [ -z "$to_examine" ]; then
+#this shouldn't happen.
     log_it "hit the resolve_target_array list being empty; are we done?"
-    return $RET_OKAY
+echo "really think this shouldn't happen; if we got to here, it means we should have a non-empty to examine string."
+exit 1
+    return $RET_FAIL
   fi
   boring_files[$to_examine]=yawn
 
@@ -382,15 +405,17 @@ log_it "assocarray index to use is '$to_examine'"
     # make sure we can see this file already, or we will need to seek it out.
     if [ ! -f "$chew_toy" ]; then
       # not an obvious filename yet.  try resolving it.
+log_it "ARGH resolving this now: $chew_toy"
       resolve_filename $chew_toy
       declare -a found_odd=(${!resolve_target_array[@]})
       local odd_len=${#found_odd[*]}
       if [ $odd_len -eq 0 ]; then
         # whoops.  we couldn't find it.  probably a system header, so toss it.
-        log_it "** ignoring: $chew_toy"
+        log_it "** ignoring missing file: $chew_toy"
         bad_files[$chew_toy]=yup
         chew_toy=""
       elif [ $odd_len -eq 1 ]; then
+log_it "says this worked: '$chew_toy' found as '{found_odd[0]}'"
         # there's exactly one match, which is very good.
         chew_toy="${found_odd[0]}"
         if [ ! -z "$DEBUG_BUILDOR_GEN_DEPS" ]; then
@@ -406,7 +431,7 @@ log_it "assocarray index to use is '$to_examine'"
     fi
 
     if [ ! -z "$chew_toy" -a ! -f "$chew_toy" ]; then
-      log_it "** failed to compute a real path for: $chew_toy"
+      log_it "** FAILED to compute a real path for: $chew_toy"
       bad_files[$chew_toy]=meh
       chew_toy=""
       continue
@@ -437,7 +462,6 @@ log_it "point Q1: about to add new dep: $chew_toy"
       # there's no point in adding it if the name didn't change.
       if [ "$cpp_toy" != "$chew_toy" ]; then
         resolve_filename $cpp_toy
-#wrong        local found_it="${!resolve_target_array[@]}[0]"
         local -a indies=( ${!resolve_target_array[@]} )
         local found_it="${indies[0]}"
 #hmmm: what if too many matches occur?