コード例 #1
0
void
QueryEditor::receive (ScopeDeleted &msg, void* /*client_data*/)
{
  // find the associated button and nuke it
  ON_DEBUG (puts ("QueryEdit: handling delete message"));
  // First find renamed button in our list.
  WidgetList kids = WComposite(f_scope_option.SubMenuId()).Children();
  int num_kids = WComposite(f_scope_option.SubMenuId()).NumChildren();
  int separator_pos = -1;
  for (int i = 0; i < num_kids; i++)
    {
      if (XmIsSeparator (kids[i]))
	separator_pos = i + 1;
      if (msg.f_search_scope ==
	  ((UAS_SearchScope *) WXmPushButton (kids[i]).UserData()))
	break;
    }

  // It had better be in the list! 
  Xassert (i != num_kids);
  ON_DEBUG (printf ("  widget #%d is the button\n", i));

  // if it is selected, select first w/ callback called
  if (kids[i] == f_scope_option.MenuHistory())
    f_scope_option.MenuHistory (kids[1]);
  XtDestroyWidget (kids[i]);

  ON_DEBUG (printf ("QueryEditor: sep pos = %d, kids = %d (%d)\n",
		    separator_pos, num_kids, num_kids - 1));
  if (separator_pos == num_kids - 1)
    {
      ON_DEBUG (puts ("   destroying separator"));
      XtDestroyWidget (kids[separator_pos-1]);
    }
}
コード例 #2
0
ファイル: QueryGroupView.C プロジェクト: juddy/edcde
void
QueryGroupView::resize (Widget, Widget w,
			XConfigureEvent *event)
{
  if (event->type != ConfigureNotify)
    return;

  WRestraint restraint (w);
  Dimension min_width = (Dimension) (size_t) restraint.UserData();

  ON_DEBUG(printf ("Group Form Resized: (event %d)\n", event->type));

  ON_DEBUG(printf ("min_width = %d -- sized to %d\n", min_width, event->width));
  /* Width shouldn't be zero, but for some reason it is... */
  if (event->width == 0)
    return;

  // If the parent is bigger than the min size, grow to match it.
  if (event->width >= min_width)
    {
      ON_DEBUG(printf ("  resizing group to event size: %d\n", event->width));
      restraint.Width (event->width);
    }
  // If the parent is smaller, make it the min_width.
  else if (event->width < min_width)
    {
      /* This shouldn't happen now because the editor sets the min shell
	 width not to allow sizes this small. */
      ON_DEBUG(printf ("  resizing group to min width: %d\n", min_width));
      ON_DEBUG(printf ("  ^^^ THIS SHOULDN'T BE HAPPENING!\n"));
      restraint.Width (min_width);
    }
}
コード例 #3
0
ファイル: ScopeMenu.C プロジェクト: juddy/edcde
void
ScopeMenu::receive (ScopeRenamed &msg, void *client_data)
{
  ON_DEBUG (puts ("ScopeMenu: handling rename message"));
  // First find renamed button in our list.
  Arg args[2];
  int n;
  Cardinal num_kids;
  WidgetList kids;

  n = 0;
  XtSetArg(args[n], XmNnumChildren, &num_kids); n++;
  XtSetArg(args[n], XmNchildren, &kids); n++;
  XtGetValues(f_pull_menu, args, n);

  unsigned int i;
  for (i = 0; i < num_kids; i++)
    {
      if (XmIsPushButtonGadget (kids[i]) &&
	  msg.f_search_scope ==
	  ((UAS_SearchScope *) WXmPushButtonGadget (kids[i]).UserData()))
	break;
    }

  // It had better be in the list! 
  Xassert (i != num_kids);
  ON_DEBUG (printf ("ScopeMenu: widget #%d is the button\n", i));

  // Now find the new insertion position in the list.
  int position = 0, old_position = i;
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);

  // find the new position in the list
  for (; s != 0; s++)
    {
      if (s.item() == msg.f_search_scope)
	continue;
      position++;
      if (s.item()->read_only())
	continue;
      ON_DEBUG (printf ("ScopeMenu: strcmp <%s>\n", s.item()->name()));
      if (strcmp (msg.f_search_scope->name(), s.item()->name()) < 0)
	break;
    }

  if (s == NULL)
    position++;

  ON_DEBUG (printf ("ScopeMenu: Rename position = %d, old = %d\n",
		    position, old_position));
  WXmPushButtonGadget scope_btn (kids[i]);
  scope_btn.LabelString (msg.f_search_scope->name());
  if (position != old_position)
    scope_btn.PositionIndex (position);
}
コード例 #4
0
void
QueryEditor::receive (ScopeCreated &msg, void* /*client_data*/)
{
  int position = 0;
  const char *scope_name = msg.f_search_scope->name();
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);
  bool need_sep = TRUE;

  if (msg.f_search_scope->read_only())
  {
    // insert read-only scopes at the start; reserve position 0
    // for "Current Section" scope and position 1 for
    // the "All Libraries" scope
    position = 2;
    need_sep = FALSE;
  }
  else
  {
    // Scan the current menu to find the correct insertion position. 
    UAS_SearchScope *scope;
    for (; s != NULL; s++, position++)
    {
      scope = s.item();
      if (scope->read_only() != need_sep)
      {
        position++;  // skip separator
        need_sep = FALSE;
      }
      if (scope->read_only())
	continue;
      // Find the first item that the new entry belongs after.
      ON_DEBUG (printf ("Scope Edit strcmp to <%s>\n", s.item()->name()));
      if (strcmp (scope_name, scope->name()) < 0)
	break;
    }
  }

  ON_DEBUG (printf ("Final SE position = %d\n", position));

  // Add a separator if this is the first user-defined entry. 
  if (need_sep == TRUE)
  {
    DECLM (WXmSeparator, separator, f_scope_option.SubMenuId(), "separator");
    separator.PositionIndex (position);
    position++;
  }

  // Create the new toggle button. 
  DECLM (WXmPushButton, scope, f_scope_option.SubMenuId(), scope_name);
  scope.PositionIndex (position);
  scope.UserData (msg.f_search_scope);
}
コード例 #5
0
ファイル: MapAgentMotif.C プロジェクト: juddy/edcde
MapButton::MapButton (WComposite &parent,
                      const UAS_Pointer<UAS_Common> &doc_ptr,
		      MapButton *ancestor)
: f_form (parent, "form"),
  f_doc_ptr (doc_ptr),
  f_expanded (FALSE)
{
  ON_DEBUG (printf ("MapButton::MapButton (%s)\n", (char*)f_doc_ptr->title()));
  static bool expandable_tree =
    window_system().get_boolean_default ("ExpandableMap");
  UAS_List<UAS_Common> kids (f_doc_ptr->children());
  UAS_String t = f_doc_ptr->title();
  if (kids.length() > 0 && expandable_tree)
    {
      f_arrow = WXmArrowButton (f_form, "expand", WAutoManage);
      ON_ACTIVATE (f_arrow,expand);
      f_button =
	WXmPushButton (f_form, t, WAutoManage,
		       WArgList (XmNrightWidget, (XtArgVal) ((Widget) f_arrow),
				 XmNrightAttachment, XmATTACH_WIDGET,
				 NULL));
    }
  else
    {
      f_button = WXmPushButton (f_form, t, WAutoManage);
    }

  ON_ACTIVATE (f_button,activate);
  SET_CALLBACK (f_form,Destroy,destroy);

  f_form.ShadowThickness (0);
  // f_form.Realize();

  // Add to the list so that we can manage 'em all at once. 
  if (f_num_kids + 1 > f_kids_size)
    {
      f_kids_size *= 2;
      f_kids = (Widget *) realloc (f_kids, sizeof (Widget) * f_kids_size);
    }
  f_kids[f_num_kids++] = (Widget) f_form;
  ON_DEBUG (printf ("Form managed = %d\n", XtIsManaged (f_form)));
    
  if (ancestor != NULL)
    {
      CXawTree form (f_form);
      WArgList args;

      form.TreeParent (ancestor->f_form, args);
      form.Set (args.Args(), args.NumArgs());
    }
}
コード例 #6
0
ファイル: AnchorCanvas.C プロジェクト: juddy/edcde
Position
AnchorCanvas::yposition (ViewportAgent *vpa)
{
  // First make sure that the Anchor is in the expected format. 
  if (strcmp (format(), CURRENT_FORMAT) != 0)
    throw (Exception());

  // Snag the information: TML-1 format is locator,offset,length.
  char *locator = new char[strlen(location())];
  int offset, length;
  ON_DEBUG (printf ("Stored mark anchor = <%s>\n", location()));
  int count;
  count = sscanf (location(), "%[^,],%d,%d", locator, &offset, &length);
  if (count != 3)
    {
      delete [] locator;
      ON_DEBUG (printf ("Only got %d args\n", count));
      throw (Exception());
    }

  // Find the TML node associated with the locator in the anchor.
  // NOTE: This table should be replaced with template classes.
  bnode *bn;
  if (*locator != '\0')
    {
      ON_DEBUG (printf ("AnchorCanvas: looking up locator <%s>\n", locator));
      NamedData *tml_node_data = (NamedData *)
	vpa->node_view_info()->locator_table().
	find (OString (locator, OString::NO_COPY));
      delete [] locator;

      if (tml_node_data == NULL)
	throw (Exception());

      bn = (bnode *) tml_node_data->data();
    }
  else
    {
      delete [] locator;
      bn = (bnode *) vpa->node_view_info()->get_model()->get_root();
    }

  // Get the y position
  view_pos *vpos =
    vpa->tml_viewport().mpos_2_vpos (bn->get_span().get_start() + offset);

  if (vpos == NULL)
    throw (Exception());

  return (vpos->get_y());
}
コード例 #7
0
void 
IntegerPref::restore()
{
  ON_DEBUG (printf ("Getting Integer <%s>\n", key()));
  // If no data, fetch default from resource db.
  if (*(UserPreference::value()) == '\0')
    {
      ON_DEBUG (puts ("  Getting from X Resource"));
      f_value = window_system().get_int_default (key());
    }
  else
    {
      ON_DEBUG (puts ("  Getting from preferences"));
      sscanf (UserPreference::value(), "%d", &f_value);
    }
}
コード例 #8
0
void
LibraryNotify::receive (UAS_CollectionRetrievedMsg &message, void *client_data)
{
  ON_DEBUG (printf ("Got Library Notify message!\n"));
  UAS_Pointer<UAS_Common> lib(message.fCol->root());
  search_scope_mgr().insert (lib);
}
コード例 #9
0
static void
ChangeManaged (RestraintWidget w)
{
  Widget child = NULL;
  int i;
  /* Find the child, if any. */
  for (i = 0; i < w->composite.num_children; i++)
    if (XtIsManaged (w->composite.children[i]))
      {
	child = w->composite.children[i];
	/* There can only be one! */
	break;
      }

  ON_DEBUG(printf ("Restraint::ChangeManaged: my size = %d x %d\n",
		   w->core.width, w->core.height));
  ON_DEBUG(printf ("  Num children = %d, child = 0x%p\n",
		   w->composite.num_children, child));

  /* If this is our first child, compute initial sizing. */
  /* Tried using !XtIsRealized (w) to do this stuff when were
     are being realized, but this doesn't handle the case of this
     widget being realized before it has a child.  This code will
     handle both cases correctly. */
  ON_DEBUG(printf ("  Checking for width calc\n    child = 0x%p, first = %d\n",
		   child, w->restraint.had_child));
  if (child != NULL && w->restraint.had_child == False)
    {
      compute_width (w, child);
      /* Q: Should this be reset when last child is deleted, so next new
	 child causes another width computation? 14:54 02/03/93 DJB */
      w->restraint.had_child = True;
    }

  /* Force child to take on my width. */
  if (child != NULL)
    {
      compute_height (w, child);
      ON_DEBUG(printf ("Restraint::ChangeManaged: sizing child to %d x %d\n",
		       w->core.width, w->core.height));
      XtResizeWidget (child, w->core.width, w->core.height, 0);
    }

  ON_DEBUG(printf ("----\n"));
  /* Do Motif bookkeeping. */
  _XmNavigChangeManaged ((Widget) w);
}
コード例 #10
0
static void
Realize (Widget w, XtValueMask *value_mask, XSetWindowAttributes *attrs)
{
  /* Might eventually need to try set up a reasonable size before realizing. */
  ON_DEBUG(printf ("Restraint::Realize\n"));
  (*restraintWidgetClass->core_class.superclass->core_class.realize)
    (w, value_mask, attrs);
}
コード例 #11
0
inline void
Dependent::release()
{
    ON_DEBUG(printf ("@** assigning: f_dependent = %p\n", f_next));
    *f_pre_next = f_next;
    if (f_next) f_next->f_pre_next = f_pre_next;
    delete this;
}
コード例 #12
0
ファイル: Pointer.C プロジェクト: juddy/edcde
Pointer<T> &
Pointer<T>::operator= (const Pointer<T> &pointer)
{
  if (f_pointer) f_pointer->unreference();
  f_pointer = pointer.f_pointer;
  ON_DEBUG (printf ("Pointer<T> = 0x%p @ 0x%p\n", f_pointer, this));
  if (f_pointer) f_pointer->reference();
  return (*this);
}
コード例 #13
0
ファイル: MapAgentMotif.C プロジェクト: juddy/edcde
void 
MapAgent::lock_toggle (WCallback *wcb)
{
  ON_DEBUG(cerr << "lock toggle callback" << endl);

  XmToggleButtonCallbackStruct &cbs =
    *(XmToggleButtonCallbackStruct*) wcb->CallData();

  f_locked = cbs.set;
}
コード例 #14
0
ファイル: ServiceMgrX.C プロジェクト: juddy/edcde
void
ServiceMgr::establish_server()
{
  create_atoms();

  // Operations in this routine must be atomic to avoid race conditions,
  // hence the server grab.

  XGrabServer (window_system().display());

  Window current_server =
    XGetSelectionOwner (window_system().display(), _XA_OLIAS_WINDOW_ID);

  ON_DEBUG(printf ("Current OLIAS server is window 0x%lx\n", current_server));

  // If no current server, we'll become the server.
  if (current_server == None)
    {
      ON_DEBUG(printf ("Attempting to become OLIAS server..."));
      ON_DEBUG(fflush (stdout));
      current_server = XtWindow (window_system().toplevel());

      // OK to use CurrentTime because there is no chance of contention.
      XSetSelectionOwner (window_system().display(), _XA_OLIAS_WINDOW_ID,
			  current_server, CurrentTime);

      // Make sure it worked.
      current_server = XGetSelectionOwner (window_system().display(),
					   _XA_OLIAS_WINDOW_ID);

      if (current_server == XtWindow (window_system().toplevel()))
	{
	  client_event_manager().register_handler(this, window_system().toplevel());
	  ON_DEBUG(puts ("successful!"));
	}
      else
	{
	  ON_DEBUG(puts ("failed!"));
	}
    }

  XUngrabServer (window_system().display());
}
コード例 #15
0
ファイル: PrefAgentMotif.C プロジェクト: juddy/edcde
void
PrefAgent::apply()
{
  // Save browse preferences.
  bool update_fs = False;
  if (IS_CHANGED (f_fs_field))
    update_fs = True;
  APPLY_VALUE (f_browse_geo, WindowGeometry, PrefMgr::BrowseGeometry);
  APPLY_VALUE (f_fs_field, Integer, PrefMgr::FontScale);
  APPLY_VALUE (f_lock_toggle, Boolean, PrefMgr::BrowseLock);

  // Save map preferences.
  APPLY_VALUE (f_map_geo, WindowGeometry, PrefMgr::MapGeometry);
  APPLY_VALUE (f_update_toggle, Boolean, PrefMgr::MapAutoUpdate);
  map_mgr().set_auto_update(f_update_toggle.Set());

  // Save history preferences.
  ON_DEBUG (printf ("Section hist changed = %d\n", IS_CHANGED (f_nh_field)));
  if (IS_CHANGED (f_nh_field))
    global_history_mgr().set_max_length (CURRENT_VALUE (f_nh_field, Integer));
  APPLY_VALUE (f_nh_field, Integer, PrefMgr::NodeHistSize);
  ON_DEBUG (printf ("Search hist changed = %d\n", IS_CHANGED (f_nh_field)));
  if (IS_CHANGED (f_sh_field))
    search_mgr().set_history_length (CURRENT_VALUE (f_sh_field, Integer));
  APPLY_VALUE (f_sh_field, Integer, PrefMgr::SearchHistSize);

  // Save search preferences. 
  APPLY_VALUE (f_max_hits_field, Integer, PrefMgr::MaxSearchHits);
  APPLY_VALUE (f_adisplay_toggle, Boolean, PrefMgr::DisplayFirstHit);

  // Desensitize appropriate controls. 
  f_ok.SetSensitive (False);
  f_apply.SetSensitive (False);
  f_reset.SetSensitive (False);

  pref_mgr().sync();

  if (update_fs)
    {
      Wait_Cursor bob;
      style_sheet_mgr().font_preference_modified();
    }
}
コード例 #16
0
void drop_nonexclusive_access(struct unix_file_info * uf_info)
{
	assert("vs-1718", uf_info->ea_owner == NULL);
	assert("vs-1719", atomic_read(&uf_info->nr_neas) > 0);
	ON_DEBUG(atomic_dec(&uf_info->nr_neas));

	up_read(&uf_info->latch);

	LOCK_CNT_DEC(inode_sem_r);
	reiser4_txn_restart_current();
}
コード例 #17
0
ファイル: ServiceMgrX.C プロジェクト: juddy/edcde
void
ServiceMgr::process_olias_event (Window client,
				 unsigned char *stream, unsigned long)
{
  /* Return immediately if the selection couldn't be converted. */
  if (stream == NULL)
    return;

  unsigned char event_type = *stream++;
  int len, bufferlen;
  char *locator;		// NOTE: make fixed width and add "mmdb:" to
				// front ? Should eventually go into calling
				// program to determine doc type.

  if (event_type != 1)
    {
      ON_DEBUG(fprintf (stderr, "received unknown event"));
      return;
    }

  // Skip over the defunct infobase name.
  // NOTE:  It should be removed from the olias api.  DJB 
  while (*stream != '\0')
    stream++;
  stream++;
  locator = (char *) stream;

  UAS_Pointer<UAS_Common> d;
  mtry
    {
      if (strchr (locator, ':'))
	{
	  d = UAS_Common::create(locator);
	}
      else
	{
	  bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
	  char *buffer = new char[bufferlen];
	  snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
	  d = UAS_Common::create (buffer);
	  if (d != (const int)0)
	    {
	      // (evil hack alert) 
	      g_scroll_to_locator = TRUE;
	      len = MIN(strlen(locator), 4096 - 1);
	      *((char *) memcpy(g_top_locator, locator, len) + len) = '\0';
	    }
	  delete [] buffer;
	}
    }
  mcatch (demoException&, demo)
    {
      message_mgr().demo_failure(demo);
    }
コード例 #18
0
void
QueryEditor::receive (ScopeRenamed &msg, void* /*client_data*/)
{
  ON_DEBUG (puts ("QueryEdit: handling rename message"));
  // First find renamed button in our list.
  WidgetList kids = WComposite(f_scope_option.SubMenuId()).Children();
  int num_kids = WComposite(f_scope_option.SubMenuId()).NumChildren();
  for (int i = 0; i < num_kids; i++)
    {
      if (msg.f_search_scope ==
	  ((UAS_SearchScope *) WXmPushButton (kids[i]).UserData()))
	break;
    }

  // It had better be in the list! 
  Xassert (i != num_kids);
  ON_DEBUG (printf ("QueryEdit: widget #%d is the button\n", i));

  // Now find the new insertion position in the list.
  int position = 0;
  xList<UAS_SearchScope *> &scope_list = search_scope_mgr().scope_list();
  List_Iterator<UAS_SearchScope *> s (scope_list);

  // find the new position in the list
  for (; s != NULL; s++)
    {
      if (s.item() == msg.f_search_scope)
	continue;
      position++;
      if (s.item()->read_only())
	continue;
      ON_DEBUG (printf ("QueryEdit: strcmp <%s>\n", s.item()->name()));
      if (strcmp (msg.f_search_scope->name(), s.item()->name()) < 0)
	break;
    }

  ON_DEBUG (printf ("QueryEdit: Rename position = %d\n", position));
  WXmPushButton scope_btn (kids[i]);
  scope_btn.LabelString (msg.f_search_scope->name());
  scope_btn.PositionIndex (position);
}
コード例 #19
0
void drop_exclusive_access(struct unix_file_info * uf_info)
{
	assert("vs-1714", uf_info->ea_owner == current);
	assert("vs-1715", atomic_read(&uf_info->nr_neas) == 0);
	ON_DEBUG(uf_info->ea_owner = NULL);
	uf_info->exclusive_use = 0;
	up_write(&uf_info->latch);
	assert("nikita-3049", LOCK_CNT_NIL(inode_sem_r));
	assert("nikita-3049", LOCK_CNT_GTZ(inode_sem_w));
	LOCK_CNT_DEC(inode_sem_w);
	reiser4_txn_restart_current();
}
コード例 #20
0
ファイル: MapAgentMotif.C プロジェクト: juddy/edcde
void
MapAgent::receive (UAS_DocumentRetrievedMsg &message, void* /*client_data*/)
{
  extern bool g_style_sheet_update ;
  ON_DEBUG (printf ("MapAgent::receive - updating the map!\n"));
  if (f_locked && f_onscreen && !g_style_sheet_update)
    {
      // MapAgent::receive is just for automatic self-update, so
      // there's no need for mapping/raising the window.
      display (message.fDoc, FALSE);
    }
}
コード例 #21
0
ファイル: NodeDisplayDataTml.C プロジェクト: juddy/edcde
NodeDisplayData::~NodeDisplayData()
{
#ifdef BOGUS
  printf ("~~~ NodeDisplayData Destructed ~~~\n");
  delete f_model;
  f_locator_table.remove_all (TRUE);

  ON_DEBUG(cerr << f_node_object.locator() << endl);

  graphics_mgr().remove(f_node_object);
#endif
}
コード例 #22
0
ファイル: item.c プロジェクト: mgross029/android_kernel
/* return pointer to item body */
void item_body_by_coord_hard(coord_t * coord /* coord to query */ )
{
	assert("nikita-324", coord != NULL);
	assert("nikita-325", coord->node != NULL);
	assert("nikita-326", znode_is_loaded(coord->node));
	assert("nikita-3200", coord->offset == INVALID_OFFSET);

	coord->offset =
	    node_plugin_by_node(coord->node)->item_by_coord(coord) -
	    zdata(coord->node);
	ON_DEBUG(coord->body_v = coord->node->times_locked);
}
コード例 #23
0
static void
compute_height (RestraintWidget w, Widget child)
{
  XtGeometryResult result;
  XtWidgetGeometry reply, intended;
  XtWidgetGeometry my_request, my_reply;

  /* -------- See how big the kid wants to be. -------- */
  /* Let it know we plan to change his width. */
  intended.request_mode = CWWidth;
  intended.width = w->core.width;
  XtQueryGeometry (child, &intended, &reply);
  ON_DEBUG(printf ("In Restraint::compute_height, child wants to be:\n"));
  ON_DEBUG(printf ("  Width: %d,  Height: %d\n", reply.width, reply.height));

  /* -------- Check with my parent for the change. -------- */
  if (reply.height != 0)
    {
      my_request.request_mode = CWHeight;
      my_request.height = reply.height;
      ON_DEBUG(printf ("Restraint: Asking parent for height %d\n", reply.height));
      result = XtMakeGeometryRequest ((Widget) w, &my_request, &my_reply);

      if (result == XtGeometryAlmost)
	{
	  ON_DEBUG(printf ("  Parent said Almost\n"));
	  /* Go with suggestion if we can get taller. */
	  if (my_reply.height > w->core.height)
	    {
	      ON_DEBUG(printf ("  Asking again for %d\n", my_reply.height));
	      my_request.height = my_reply.height;
	      /* Parent must say Yes. */
	      XtMakeGeometryRequest ((Widget) w, &my_request, NULL);
	    }
	}
      else if (result == XtGeometryYes)
	ON_DEBUG(printf ("  Parent said Yes.\n"));
      else if (result == XtGeometryNo)
	ON_DEBUG(printf ("  Parent said No.\n"));
      else
	ON_DEBUG(printf ("  *** Impossible Reply = %d ***\n", result));
    }

  ON_DEBUG(printf ("Restraint: compute_height = %d\n", w->core.height));
}
コード例 #24
0
ファイル: ServiceMgrX.C プロジェクト: juddy/edcde
ServiceMgr::~ServiceMgr()
{
  // Need to stop being the OLIAS server if it's us.

  //  XGrabServer (window_system().display());

  Window current_server =
    XGetSelectionOwner (window_system().display(), _XA_OLIAS_WINDOW_ID);

  ON_DEBUG(printf ("Current OLIAS server is window 0x%lx\n", current_server));
  if (current_server == XtWindow (window_system().toplevel()))
    {
      ON_DEBUG(printf ("Done being the OLIAS server...\n"));
      ON_DEBUG(fflush (stdout));

      // OK to use CurrentTime because there is no chance of contention.
      XSetSelectionOwner (window_system().display(), _XA_OLIAS_WINDOW_ID,
			  None, CurrentTime);
    }
      
  //  XUngrabServer (window_system().display());
}
コード例 #25
0
static void
compute_width (RestraintWidget w, Widget child)
{
  XtGeometryResult result;
  XtWidgetGeometry reply;
  XtWidgetGeometry my_request, my_reply;

  /* Let's see how big the kid wants to be. */
  XtQueryGeometry (child, NULL, &reply);

  ON_DEBUG(printf ("In Restraint::compute_width, child wants to be:\n"));
  ON_DEBUG(printf ("  Width: %d,  Height: %d\n", reply.width, reply.height));
  
  /* Try to grow if the child wants to be wider. */
  if (reply.width > w->core.width)
    {
      my_request.request_mode = CWWidth;
      my_request.width = reply.width;

      ON_DEBUG(printf ("Restraint: Asking parent width = %d\n", reply.width));
      result = XtMakeGeometryRequest ((Widget) w, &my_request, &my_reply);

      /* Go with parent suggestion on almost. */
      if (result == XtGeometryAlmost)
	{
	  ON_DEBUG(printf ("  Parent said Almost.\n"));
	  ON_DEBUG(printf ("  Using suggested width of %d\n", my_reply.width));
	  my_request.width = my_reply.width;

	  /* Parent must say Yes. */
	  XtMakeGeometryRequest ((Widget) w, &my_request, NULL);
	}
      else if (result == XtGeometryYes)
	ON_DEBUG(printf ("  Parent said Yes\n"));
      else if (result == XtGeometryNo)
	ON_DEBUG(printf ("  Parent said No\n"));
      else
	ON_DEBUG(printf ("  *** Impossible Reply = %d ***\n", result));
    }

  ON_DEBUG(printf ("Restraint: compute_width = %d\n", w->core.width));
}
コード例 #26
0
ファイル: CFI.cpp プロジェクト: ANSSI-FR/picon
void ControlFlowIntegrity::IdentifyFunctions(void) {
  std::string is_defined;
  std::string fctName;
  uint32_t id, iid;

  ON_DEBUG(true, "IdentifyFunctions: " << _fun_id_file << "\n");
  std::ifstream fs(_fun_id_file);
  if (fs) {
    while (fs >> fctName >> iid >> is_defined) {
      (void)AddIdentifiedFunction(fctName,iid);
    }
    if (fs.peek()!=EOF) {
      report_fatal_error("IdentifyFunctions: bad input file", false);
      assert(0 && "IdentifyFunctions: bad input file");
    }
  }
  fs.close();

  for (auto &F : _M) {
    if (isIgnoredFunction(F.getName()))
      continue;

    if (F.getIntrinsicID() != Intrinsic::not_intrinsic)
      continue;

    id = IdentifyFunction(F);

    std::map<llvm::BasicBlock*, uint32_t> bb_map;
    uint32_t bb_id = 0;
    for (auto &BB : F) {
      bb_map[&BB] = bb_id++;
    }

    _FunctionMap[F.getName()] = {.fun=&F, .id=id, .bb_map=bb_map};
    ON_DEBUG(true, F.getName() << " with identifier " << id << "\n");
  }
}
コード例 #27
0
ファイル: BitField.C プロジェクト: juddy/edcde
bool
BitField::i_set(BitHandle handle)
{
  assert(handle);
  unsigned long word = handle / bits_per_word ;
  check_allocation (word);

  unsigned long mask = 1 << (handle % bits_per_word) ;

  ON_DEBUG (printf ("BitField: setting bit %ld (in word %ld)\n", handle, word));

  f_words[word] |= mask ;

  return 1 ;
}
コード例 #28
0
ファイル: MapAgentMotif.C プロジェクト: juddy/edcde
void
MapButton::expand()
{
  if (f_expanded)
    {
      f_arrow.ArrowDirection (XmARROW_RIGHT);
      f_expanded = FALSE;
    }
  else
    {
      f_arrow.ArrowDirection (XmARROW_DOWN);
      f_expanded = TRUE;
      // Create a button for each child.
      UAS_List<UAS_Common> kids (f_doc_ptr->children());
      WXawTree tree (XtParent (f_form));
      for (unsigned int i = 0; i < kids.length(); i++)
	new MapButton (tree, kids[i], this);
      ON_DEBUG (puts ("managing kids"));
      MapButton::ManageKids();
      ON_DEBUG (puts ("calling force layout"));
      tree.ForceLayout();
      ON_DEBUG (puts ("called force layout"));
    }
}
コード例 #29
0
void
LocalHistoryMgr::append (UAS_Pointer<UAS_Common> &doc_ptr)
{
    ON_DEBUG (printf ("&&&&& APPENDING <%s> to history\n", doc_ptr->title()));
    LocalHistoryEntry *entry = new LocalHistoryEntry (doc_ptr);
    truncate();
    entry->f_previous = f_current;
    if (f_current != NULL)
        f_current = f_current->f_next = entry;
    else
    {
        // Once the first element is set it can never be truncated.
        f_first = f_current = entry;
    }
    entry->f_next = NULL;
}
コード例 #30
0
ファイル: BitField.C プロジェクト: juddy/edcde
BitField::BitField(unsigned long initial_bits)
{
  f_num_words = (initial_bits - 1)/(bytes_per_word * bits_per_byte) + 1 ;
  ON_DEBUG (printf ("BitField allocated %ld words for %ld bits\n",
		    f_num_words, initial_bits));

  f_words = new unsigned long [ f_num_words ] ;
  f_bits_in_use = new unsigned long [ f_num_words ] ;

  // zero bit arrays 
  for (unsigned int i = 0 ; i < f_num_words; i++){
    f_words[i] = 0 ;
  }
  // reserve first (0) bit
  //  - a handle of zero is a likely source of errors - jbm 
  f_bits_in_use[0] = 1 ;
}