[DGD] mapping bug

chris . psych_mayo at hotmail.com
Tue Sep 30 03:57:01 CEST 2008


There is a bug in my code.  The error message is throwing me off a bit.  I can do error(describe_value(mapping[index]) ), and the result is a string.  However, when I try to do DRIVER->message(describe_value(mapping[index]) ), the resulting error says bad argument to + kfun, 361 in driver for message function.  This would happen if i tried to descibe_value to a value that does not exist.
if(!mapping[index]) is true (shows that there is no value).
describe value for the indices shows that it is actually there.
The logic doesnt make sense so im assuming something else is actually causing the bug?
updateDependents hasnt been tested/ironed out yet (due to the error im getting).  Ill get to that soon:)

The code is lengthy even when trimmed down.  

So i put it down here.
The first 2 functions are objectd hooks.



void compile(string owner, object obj, string *sources, string inherited ...) {
 int i;
 for(i = 0; i < sizeof(inherited); i++) {
  if(!filesInheritingMe[ inherited[i] ]) 
    filesInheritingMe[ inherited[i] ] = ({ object_name(obj) });
  else 
    filesInheritingMe[ inherited[i] ] += ({ object_name(obj) });
   } }

void compile_lib(string owner, string path, string *sources,
	string inherited ...) {
 int i;
 for(i = 0; i < sizeof(inherited); i++) {
   if(!filesInheritingMe[ inherited[i] ]) 
    filesInheritingMe[ inherited[i] ] = ({ path });
  else
    filesInheritingMe[ inherited[i] ] += ({ path });
   } }

void updateDependents(string filePath, varargs string callPath) {
  int i;
 
/* The Problem */

  if(!filesInheritingMe[filePath])
    error("libPath arg is not indexed in filesInheritingMe.");
  for(i = 0; i < sizeof(filesInheritingMe[filePath]); i++) {
    if(sscanf(filePath, "%*s/lib/%*s")> 0) {
      updateDependents(filesInheritingMe[filePath][i], filePath);
      }
    else {
      if(!find_object(filesInheritingMe[filePath][i]) && callPath) {
        destruct_object(callPath);
        compile_object(callPath);
        }
      else
        compile_object(filePath);
        } } }

void update_lib(string libPath) {
  destruct_object(libPath);
  compile_object(libPath);
  updateDependents(libPath);
  }
_________________________________________________________________
Stay up to date on your PC, the Web, and your mobile phone with Windows Live.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/



More information about the DGD mailing list