コード例 #1
0
void CFunctionCollection::Add(COHScriptObject *new_function) {
  CSLock lock(m_critsec);
  assert(new_function != NULL);
  CString name = new_function->name();
  // f$debug is a global object 
  // and must not be added to the collection
  // (to avoid deletion)
  // http://www.maxinmontreal.com/forums/viewtopic.php?f=111&t=19616
  assert(name != "f$debug");
  if (name == "") {
     write_log(preferences.debug_formula(), 
	    "[CFunctionCollection] Invalid empty name\n");
    return;
  }
  if (Exists(name)) {
     write_log(preferences.debug_formula(), 
	    "[CFunctionCollection] Name %s already exists. Deleting it\n", name);
    Delete(name);
  }
  if (CheckForOutdatedFunction(name) || CheckForMisspelledOpenPPLMainFunction(name)) {
    // Ignore it
     write_log(preferences.debug_formula(), 
      "[CFunctionCollection] Ignoring bad function %s\n", name);
    return;
  }
   write_log(preferences.debug_formula(), 
	  "[CFunctionCollection] Adding %s -> %i\n", name, new_function);
  _function_map[name] = new_function;
}
コード例 #2
0
void CFunctionCollection::Add(COHScriptObject *new_function) {
  CSLock lock(m_critsec);
  CString name = new_function->name();
  if (name == "") {
    write_log(preferences.debug_formula(), 
	  "[CFunctionCollection] Invalid empty name\n");
    return;
  }
  if (Exists(name)) {
    write_log(preferences.debug_formula(), 
	  "[CFunctionCollection] Name %s already exists. Deleting it\n", name);
    _function_map.erase(name);
  }
  if (CheckForOutdatedFunction(name) || CheckForMisspelledOpenPPLMainFunction(name)) {
    // Ignore it
    // Warning already generated
    return;
  }

  write_log(preferences.debug_formula(), 
	"[CFunctionCollection] Adding %s -> %i\n", name, new_function);
  _function_map[name] = new_function;
}