Example #1
0
File: op_mem.c Project: anhkgg/temu
void glue(op_swr, MEMSUFFIX) (void)
{
    uint32_t tmp = glue(ldl, MEMSUFFIX)(T0 & ~3);
    tmp = CALL_FROM_TB1(glue(do_swr, MEMSUFFIX), tmp);
    glue(stl, MEMSUFFIX)(T0 & ~3, tmp);
    RETURN();
}
Example #2
0
url
glue (url u, string s) {
  if (is_atomic (u)) return as_url (tree (u->t->label * s));
  if (is_concat (u)) return u[1] * glue (u[2], s);
  if (is_or (u)) return glue (u[1], s) | glue (u[2], s);
  failed_error << "u= " << u << "\n";
  failed_error << "s= " << s << "\n";
  FAILED ("can't glue string to url");
  return u;
}
Example #3
0
void
ShowPortMonitor(SingleWindow &parent, const DialogLook &dialog_look,
                const TerminalLook &terminal_look,
                DeviceDescriptor &device)
{
  /* create the dialog */

  WindowStyle dialog_style;
  dialog_style.Hide();
  dialog_style.ControlParent();

  TCHAR buffer[64];
  StaticString<128> caption;
  caption.Format(_T("%s: %s"), _("Port monitor"),
                 device.GetConfig().GetPortName(buffer, ARRAY_SIZE(buffer)));

  WndForm dialog(dialog_look);
  dialog.Create(parent, caption, dialog_style);

  ContainerWindow &client_area = dialog.GetClientAreaWindow();

  PortMonitorGlue glue(device, terminal_look);

  ButtonPanel buttons(client_area, dialog_look);
  buttons.Add(_("Close"), dialog, mrOK);
  glue.CreateButtons(buttons);
  glue.CreateTerminal(client_area, buttons.UpdateLayout());

  /* run it */

  dialog.ShowModal();
}
Example #4
0
File: op_mem.c Project: anhkgg/temu
void glue(op_ll, MEMSUFFIX) (void)
{
    T1 = T0;
    T0 = glue(ldl, MEMSUFFIX)(T0);
    env->CP0_LLAddr = T1;
    RETURN();
}
bool LLUriParser::test() const
{
	std::string uri;
	glue(uri);

	return uri == mNormalizedUri;
}
Example #6
0
void
tm_frame_rep::choose_file (object fun, string title, string type,
			   string prompt, url name) {
  command  cb  = dialogue_command (get_server(), fun, 1);
  widget   wid = file_chooser_widget (cb, type, prompt);
  if (!is_scratch (name)) {
    set_directory (wid, as_string (head (name)));
    if ((type != "image") && (type != "")) {
      url u= tail (name);
      string old_suf= suffix (u);
      string new_suf= format_to_suffix (type);
      if ((suffix_to_format (suffix (u)) != type) &&
	  (old_suf != "") && (new_suf != ""))
	{
	  u= unglue (u, N(old_suf) + 1);
	  u= glue (u, "." * new_suf);
	}
      set_file (wid, as_string (u));
    }
  }
  else set_directory (wid, ".");
  dialogue_start (title, wid);
  if (type == "directory") send_keyboard_focus (get_directory (dialogue_wid));
  else send_keyboard_focus (get_file (dialogue_wid));
}
Example #7
0
File: op_mem.c Project: anhkgg/temu
void glue(op_sc, MEMSUFFIX) (void)
{
    CALL_FROM_TB0(dump_sc);
    if (T0 == env->CP0_LLAddr) {
        glue(stl, MEMSUFFIX)(T0, T1);
        T0 = 1;
    } else {
        T0 = 0;
    }
    RETURN();
}
Example #8
0
void increase_ticks()
{
    Tetrimino new_pos = *in_play;
    new_pos.posy++;
    if(check_collision(new_pos)) //means that there's something below, so we count down
    {
        ticks_before_glue++;
	if(ticks_before_glue >= cfg.glue_delay[level-1])
            glue();
    }

}
Example #9
0
void soft_drop()
{
 //the only difference that it adds score if the drop was successful.
    if(gravity_drop())
    {
        score++;
	if(score > high_score)
    	    high_score = score;
    }
    else if (cfg.ARS) //ARS games don't do lock delay for soft drop.
    {
	glue();
    }
}
Example #10
0
File: mkglue.c Project: Algozjb/xnu
void
mbglue(void)
{
	register FILE *fp;
	const char *name = "mbglue.s";

	fp = fopen(path(name), "w");
	if (fp == 0) {
		perror(path(name));
		exit(1);
	}
	fprintf(fp, "#include <machine/asm_linkage.h>\n\n");
	glue(fp, dump_mb_handler);
	(void) fclose(fp);
}
Example #11
0
/*
Moves the tetrimino all the way down and glues it. Also, adds score for that.
Returns - how many rows were skipped
*/
int go_all_down()
{
    Tetrimino copy = *in_play;
    int rows = -1;
    while(!check_collision(copy))
    {
        copy.posy++;
        rows++;
    }
    in_play->posy = copy.posy - 1;
    score += rows << 1; //2 points per tile dropped
    if(score > high_score)
	high_score = score;
    last_T_rotation = 0;
    if(!cfg.ARS) //sonic drop!
    	glue();
    return rows;
}
Example #12
0
/*
Each tick the piece goes down; this function does that.
Returns if a drop was successful or not.
*/
u32 gravity_drop()
{
    Tetrimino new_pos = *in_play;
    new_pos.posy++;
    if(!check_collision(new_pos)) //nothing below - just go down
    {
        in_play->posy++;
	last_T_rotation = 0;
	if(!cfg.ARS || !ARS_glue_lock)
	    ticks_before_glue = 0;
        return 1;
    }
    else
    {
	if(ticks_before_glue >= cfg.glue_delay[level-1])
            glue();
	return 0;
    }
}
Example #13
0
void glue(address_space_stq_be, SUFFIX)(ARG1_DECL,
    hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result)
{
    glue(address_space_stq_internal, SUFFIX)(ARG1, addr, val, attrs, result,
                                             DEVICE_BIG_ENDIAN);
}
Example #14
0
void glue(address_space_stw_le, SUFFIX)(ARG1_DECL,
    hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
{
    glue(address_space_stw_internal, SUFFIX)(ARG1, addr, val, attrs, result,
                                             DEVICE_LITTLE_ENDIAN);
}
Example #15
0
void glue(stl_phys_notdirty, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
{
    glue(address_space_stl_notdirty, SUFFIX)(ARG1, addr, val,
                                             MEMTXATTRS_UNSPECIFIED, NULL);
}
Example #16
0
uint64_t glue(address_space_ldq_le, SUFFIX)(ARG1_DECL,
    hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
{
    return glue(address_space_ldq_internal, SUFFIX)(ARG1, addr, attrs, result,
                                                    DEVICE_LITTLE_ENDIAN);
}
Example #17
0
void Global::createToolBars()
{
    // ----- Tool modes -----

    // Create toolbar
    toolBar_ = mainWindow()->addToolBar(tr("Toolbar"));
    toolBar_->setOrientation(Qt::Vertical);
    toolBar_->setMovable(false);
    mainWindow()->addToolBar(Qt::LeftToolBarArea, toolBar_);

    // Set toolbar size
    int iconWidth = 32;
    toolBar_->setIconSize(QSize(iconWidth,iconWidth));
    currentColor_->setIconSize(QSize(iconWidth,iconWidth));
    currentColor_->updateIcon();

    // Create actions (exclusive checkable)
    QActionGroup * actionGroup = new QActionGroup(this);
    for(int i=0; i<NUMBER_OF_TOOL_MODES; i++)
    {
        toolModeActions[i] = new ToolModeAction(static_cast<ToolMode>(i), actionGroup);
        toolModeActions[i]->setCheckable(true);
        toolModeActions[i]->setShortcutContext(Qt::ApplicationShortcut);
        toolBar_->addAction(toolModeActions[i]);
        connect(toolModeActions[i], SIGNAL(triggered(Global::ToolMode)),
                              this, SLOT(setToolMode(Global::ToolMode)));
    }

    // Select
    toolModeActions[SELECT]->setText(tr("Select and move (F1)"));
    toolModeActions[SELECT]->setIcon(QIcon(":/images/select.png"));
    toolModeActions[SELECT]->setStatusTip(tr("Select objects, move objects, glue objects together, and split curves."));
    toolModeActions[SELECT]->setShortcut(QKeySequence(Qt::Key_F1));

    // Sketch
    toolModeActions[SKETCH]->setText(tr("Sketch (F2)"));
    toolModeActions[SKETCH]->setIcon(QIcon(":/images/sketch.png"));
    toolModeActions[SKETCH]->setStatusTip(tr("Sketch curves."));
    toolModeActions[SKETCH]->setShortcut(QKeySequence(Qt::Key_F2));

    // Paint
    toolModeActions[PAINT]->setText(tr("Paint (F3)"));
    toolModeActions[PAINT]->setIcon(QIcon(":/images/paint.png"));
    toolModeActions[PAINT]->setStatusTip(tr("Paint an empty space or an existing object."));
    toolModeActions[PAINT]->setShortcut(QKeySequence(Qt::Key_F3));

    // Sculpt
    toolModeActions[SCULPT]->setText(tr("Sculpt (F4)"));
    toolModeActions[SCULPT]->setIcon(QIcon(":/images/sculpt.png"));
    toolModeActions[SCULPT]->setStatusTip(tr("Sculpt curves."));
    toolModeActions[SCULPT]->setShortcut(QKeySequence(Qt::Key_F4));

    // ----- Color selectors -----

    // Colors
    colorSelectorAction_ = toolBar_->addWidget(currentColor_);
    colorSelectorAction_->setText(tr("Color"));
    colorSelectorAction_->setToolTip(tr("Color (C)"));
    colorSelectorAction_->setStatusTip(tr("Click to open the color selector"));
    colorSelectorAction_->setShortcut(QKeySequence(Qt::Key_C));
    colorSelectorAction_->setShortcutContext(Qt::ApplicationShortcut);
    connect(colorSelectorAction_, SIGNAL(triggered()), currentColor_, SLOT(click()));

    // ----- Tool Options -----

    toolModeToolBar_ = new QToolBar("Action Bar");
    toolModeToolBar_->setIconSize(QSize(200,iconWidth));
    toolModeToolBar_->setMovable(false);
    mainWindow()->addToolBar(toolModeToolBar_);

    // ---------------------   Color   ------------------------

    actionChangeColor_ = new QAction(this);
    actionChangeColor_->setText(tr("Change color"));
    actionChangeColor_->setIcon(QIcon(":/images/change-color.png"));
    actionChangeColor_->setStatusTip(tr("Change the color of the selected cells"));
    //actionChangeColor_->setShortcut(QKeySequence(Qt::Key_C));
    actionChangeColor_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionChangeColor_);
    connect(actionChangeColor_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(changeColor()));

    // ---------------------   Edges   ------------------------

    actionChangeEdgeWidth_ = new QAction(this);
    actionChangeEdgeWidth_->setText(tr("Change edge width (W)"));
    actionChangeEdgeWidth_->setIcon(QIcon(":/images/change-width.png"));
    actionChangeEdgeWidth_->setStatusTip(tr("Change the width of the selected edges"));
    actionChangeEdgeWidth_->setShortcut(QKeySequence(Qt::Key_W));
    actionChangeEdgeWidth_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionChangeEdgeWidth_);
    connect(actionChangeEdgeWidth_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(changeEdgeWidth()));


    // ---------------------   Faces   ------------------------

    actionCreateFace_ = new QAction(this);
    actionCreateFace_->setText(tr("Create Face (F)"));
    actionCreateFace_->setIcon(QIcon(":/images/create-face.png"));
    actionCreateFace_->setStatusTip(tr("Create a face whose boundary is the selected edges"));
    actionCreateFace_->setShortcut(QKeySequence(Qt::Key_F));
    actionCreateFace_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionCreateFace_);
    connect(actionCreateFace_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(createFace()));

    actionAddCycles_ = new QAction(this);
    actionAddCycles_->setText(tr("Add Holes (H)"));
    actionAddCycles_->setIcon(QIcon(":/images/add-cycles.png"));
    actionAddCycles_->setStatusTip(tr("Add holes to the selected face, whose boundaries are the selected edges"));
    actionAddCycles_->setShortcut(QKeySequence(Qt::Key_H));
    actionAddCycles_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionAddCycles_);
    connect(actionAddCycles_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(addCyclesToFace()));

    actionRemoveCycles_ = new QAction(this);
    actionRemoveCycles_->setText(tr("Remove Holes (Ctrl+H)"));
    actionRemoveCycles_->setIcon(QIcon(":/images/remove-cycles.png"));
    actionRemoveCycles_->setStatusTip(tr("Remove holes from the selected face, whose boundaries are the selected edges"));
    actionRemoveCycles_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
    actionRemoveCycles_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionRemoveCycles_);
    connect(actionRemoveCycles_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(removeCyclesFromFace()));

    // ---------------------   Topological operations   ------------------------

    actionGlue_ = new QAction(this);
    actionGlue_->setText(tr("Glue"));
    actionGlue_->setToolTip(tr("Glue (G)"));
    actionGlue_->setIcon(QIcon(":/images/glue.png"));
    actionGlue_->setStatusTip(tr("Glue two endpoints or two curves together"));
    actionGlue_->setShortcut(QKeySequence(Qt::Key_G));
    actionGlue_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionGlue_);
    connect(actionGlue_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(glue()));

    actionUnglue_ = new QAction(this);
    actionUnglue_->setText(tr("Explode"));
    actionUnglue_->setToolTip(tr("Explode (E)"));
    actionUnglue_->setIcon(QIcon(":/images/unglue.png"));
    actionUnglue_->setStatusTip(tr("Duplicate the selected objects to disconnect adjacent curves and surfaces"));
    //actionUnglue_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
    actionUnglue_->setShortcut(QKeySequence(Qt::Key_E));
    actionUnglue_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionUnglue_);
    connect(actionUnglue_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(unglue()));

    actionUncut_ = new QAction(this);
    actionUncut_->setText(tr("Simplify"));
    actionUncut_->setToolTip(tr("Simplify (Backspace)"));
    actionUncut_->setIcon(QIcon(":/images/simplify.png"));
    actionUncut_->setStatusTip(tr("Simplify the selected objects, by merging curves and surfaces together"));
    actionUncut_->setShortcut(QKeySequence(Qt::Key_Backspace));
    actionUncut_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionUncut_);
    connect(actionUncut_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(uncut()));

    // Desired icon size
    double sideLength = 40;

    // ---------------------   Shared actions/options   ------------------------

    // None

    // ---------------------   Select options   ------------------------

    toolModeToolBar_->addAction(actionChangeColor_);
    toolModeToolBar_->addAction(actionChangeEdgeWidth_);
    separatorSelect1_ = toolModeToolBar_->addSeparator();
    toolModeToolBar_->addAction(actionCreateFace_);
    toolModeToolBar_->addAction(actionAddCycles_);
    toolModeToolBar_->addAction(actionRemoveCycles_);
    separatorSelect2_ = toolModeToolBar_->addSeparator();

    toolModeToolBar_->widgetForAction(actionChangeColor_)->setFixedSize(sideLength,sideLength);
    toolModeToolBar_->widgetForAction(actionChangeEdgeWidth_)->setFixedSize(sideLength,sideLength);
    toolModeToolBar_->widgetForAction(actionCreateFace_)->setFixedSize(sideLength,sideLength);
    toolModeToolBar_->widgetForAction(actionAddCycles_)->setFixedSize(sideLength,sideLength);
    toolModeToolBar_->widgetForAction(actionRemoveCycles_)->setFixedSize(sideLength,sideLength);

    toolModeToolBar_->addAction(actionGlue_);
    toolModeToolBar_->addAction(actionUnglue_);
    toolModeToolBar_->addAction(actionUncut_);
    toolModeToolBar_->widgetForAction(actionGlue_)->setFixedSize(sideLength+20,sideLength);
    toolModeToolBar_->widgetForAction(actionUnglue_)->setFixedSize(sideLength+20,sideLength);
    toolModeToolBar_->widgetForAction(actionUncut_)->setFixedSize(sideLength+20,sideLength);


    // ---------------------   Sketch options   ------------------------

    // Tablet pressure
    actionUseTabletPressure_ = new QAction(this);
    actionUseTabletPressure_->setCheckable(true);
    actionUseTabletPressure_->setChecked(true);
    toolModeToolBar_->addAction(actionUseTabletPressure_);
    toolModeToolBar_->widgetForAction(actionUseTabletPressure_)->setFixedSize(sideLength,sideLength);
    actionUseTabletPressure_->setText(tr("Toggle stylus pressure"));
    actionUseTabletPressure_->setIcon(QIcon(":/images/pressure.png"));
    actionUseTabletPressure_->setStatusTip(tr("Enable or disable stylus pressure (only for users with a pen tablet)"));
    //actionUseTabletPressure_->setShortcut(QKeySequence(Qt::Key_Backspace));
    actionUseTabletPressure_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionUseTabletPressure_);
    connect(actionUseTabletPressure_, SIGNAL(triggered()), this, SLOT(toggleStylusPressure()));

    // Edge width
    edgeWidth_ = new SpinBox();
    edgeWidth_->setCaption(tr(" pen width "));
    edgeWidth_->setValue(settings().edgeWidth());
    actionEdgeWidth_ = toolModeToolBar_->addWidget(edgeWidth_);
    connect(edgeWidth_, SIGNAL(valueChanged(double)), this, SLOT(setEdgeWidth_(double)));

    // Separator
    separatorSketch1_ = toolModeToolBar_->addSeparator();

    // Planar map mode
    actionPlanarMapMode_ = new QAction(this);
    actionPlanarMapMode_->setCheckable(true);
    actionPlanarMapMode_->setChecked(true);
    toolModeToolBar_->addAction(actionPlanarMapMode_);
    toolModeToolBar_->widgetForAction(actionPlanarMapMode_)->setFixedSize(110,sideLength);
    actionPlanarMapMode_->setText(tr("Toggle intersections"));
    actionPlanarMapMode_->setIcon(QIcon(":/images/planar-map-on.png"));
    actionPlanarMapMode_->setStatusTip(tr("When intersections are enabled, the sketched curve automatically splits existing curves and surfaces."));
    //actionPlanarMapMode_->setShortcut(QKeySequence(Qt::Key_Backspace));
    actionPlanarMapMode_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionPlanarMapMode_);
    connect(actionPlanarMapMode_, SIGNAL(triggered()), this, SLOT(togglePlanarMapMode()));

    // Separator
    separatorSketch2_ = toolModeToolBar_->addSeparator();

    // Snapping
    actionSnapMode_ = new QAction(this);
    actionSnapMode_->setCheckable(true);
    actionSnapMode_->setChecked(true);
    toolModeToolBar_->addAction(actionSnapMode_);
    toolModeToolBar_->widgetForAction(actionSnapMode_)->setFixedSize(110,sideLength);
    actionSnapMode_->setText(tr("Toggle snapping"));
    actionSnapMode_->setIcon(QIcon(":/images/snapping-on.png"));
    actionSnapMode_->setStatusTip(tr("When snapping is enabled, the sketched curve is automatically glued to existing curves."));
    //actionSnapMode_->setShortcut(QKeySequence(Qt::Key_Backspace));
    actionSnapMode_->setShortcutContext(Qt::ApplicationShortcut);
    mainWindow()->addAction(actionSnapMode_);
    connect(actionSnapMode_, SIGNAL(triggered()), this, SLOT(toggleSnapping()));

    // Edge width
    actionSnapThreshold_ = toolModeToolBar_->addWidget(snapThreshold_);

    // ---------------------   Sculpt options   ------------------------

    actionSculptRadius_ = toolModeToolBar_->addWidget(sculptRadius_);

    // ---------------------   Cut options   ------------------------

    // Set default Tool Mode
    setToolMode(SKETCH);
}
Example #18
0
File: op_mem.c Project: anhkgg/temu
void glue(op_lhu, MEMSUFFIX) (void)
{
    T0 = glue(lduw, MEMSUFFIX)(T0);
    RETURN();
}
Example #19
0
uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
{
    return glue(address_space_ldl, SUFFIX)(ARG1, addr,
                                           MEMTXATTRS_UNSPECIFIED, NULL);
}
bool DoDiff(DirectoryGroups& dirGroups,
            std::string rev1,
            std::string rev2,
            bool forceQuery)
{
   std::string dir = UniqueTemporaryDir();
   AutoDirectoryDeleter dirDeleter(dir);
   std::string diffFile = dir;
   std::string diffFile2 = diffFile;
   bool ok = true;
   CVSAction glue(0);

   if (rev1.empty())
      rev1 = CVSStatus::GetRevisionNumber(dirGroups.mySingleAbsolute);

   // Should we do a text diff only?
   std::string externalApp = GetExternalApplication("Diff",
                                                    dirGroups,
                                                    forceQuery);
   forceQuery = false;
   if (externalApp.empty())
   {
      // Perform a textual diff
      glue.SetProgressFinishedCaption(Printf(_("Finished diff in %s"), 
                                             wxText(dirGroups.mySingleDirectory).c_str()));
      glue.SetProgressCaption(Printf(_("Diffing in %s"), wxText(dirGroups.mySingleDirectory).c_str()));
      MakeArgs args;
      args.add_option("diff");
      args.add_option("-u");
      args.add_option("-r");
      args.add_option(rev1);
      if (!rev2.empty())
      {
         args.add_option("-r");
         args.add_option(rev2);
      }
      args.add_arg(dirGroups.mySingleRelative);

      return glue.Command(dirGroups.mySingleDirectory, args);
   }
   
   bool unixSandbox = IsUnixSandbox(StripLastPart(dirGroups.mySingleAbsolute));

   diffFile += "\\" + MakeRevFilename(ExtractLastPart(dirGroups.mySingleAbsolute), rev1);
   DeleteFileA(diffFile.c_str());
   AutoFileDeleter diffFileDeleter(diffFile);

   AutoFileDeleter diffFile2Deleter;
   if (!rev2.empty())
   {
      diffFile2 += "\\" + MakeRevFilename(ExtractLastPart(dirGroups.mySingleAbsolute), rev2);
      DeleteFileA(diffFile2.c_str());
      diffFile2Deleter.Attach(diffFile2);
   }

   glue.SetProgressFinishedCaption(Printf(_("Finished diff in %s"), 
                                          wxText(dirGroups.mySingleDirectory).c_str()));
   glue.SetProgressCaption(Printf(_("Diffing in %s"), wxText(dirGroups.mySingleDirectory).c_str()));
   std::string cvsroot = CVSStatus::CVSRootForPath(dirGroups.mySingleDirectory);

   CVSServerFeatures sf;
   if (unixSandbox)
       sf.Initialize(&glue);

   // Diffing two revisions
   if (!rev1.empty())
   {
       glue.SetCVSRoot(CVSRoot(cvsroot));
       MakeArgs args;
       std::string tempDir = UniqueTemporaryDir();
       glue.SetCloseIfOK(true);
       args.add_global_option("-f");
       args.add_option("checkout");
       if (rev1 != "HEAD")
       {
           args.add_option("-r");
           args.add_option(rev1);
       }
       args.add_option("-d");
       args.add_option("temp");
       if (unixSandbox)
           sf.AddUnixLineEndingsFlag(args);
       std::string s = EnsureTrailingUnixDelimiter(CVSStatus::CVSRepositoryForPath(dirGroups.mySingleAbsolute))
           + ExtractLastPart(dirGroups.mySingleAbsolute);
       args.add_arg(s);
      
       ok = glue.Command(tempDir, args);
       if (ok)
       {
           // Copy file to destination
           std::string file = EnsureTrailingDelimiter(tempDir) + "temp\\" + ExtractLastPart(dirGroups.mySingleAbsolute);
           SetFileReadOnly(file.c_str(), false);
           CopyFileA(file.c_str(), diffFile.c_str(), false);
           SetFileReadOnly(diffFile.c_str(), true);
       }

       // Erase temporary directory
       DeleteDirectoryRec(tempDir);
     
       if (!ok)
           return false;
       glue.CloseConsoleOutput();
   }
     
   if (!rev2.empty())
   {
       glue.SetCVSRoot(CVSRoot(cvsroot));
       MakeArgs args; 

       std::string tempDir = UniqueTemporaryDir();
       glue.SetCloseIfOK(true);
       args.add_global_option("-f");
       args.add_option("checkout");
       args.add_option("-r");
       args.add_option(rev2);
       args.add_option("-d");
       args.add_option("temp");
       if (unixSandbox)
           sf.AddUnixLineEndingsFlag(args);
       std::string s = EnsureTrailingUnixDelimiter(CVSStatus::CVSRepositoryForPath(dirGroups.mySingleAbsolute))
           + ExtractLastPart(dirGroups.mySingleAbsolute);
       args.add_arg(s);
      
       ok = glue.Command(tempDir, args);

       if (ok)
       {
           // Copy file to destination
           std::string file = EnsureTrailingDelimiter(tempDir) + "temp\\" 
               + ExtractLastPart(dirGroups.mySingleAbsolute);
           SetFileReadOnly(file.c_str(), false);
           CopyFileA(file.c_str(), diffFile2.c_str(), false);
           SetFileReadOnly(diffFile2.c_str(), true);
       }
     
       // Erase temporary directory
       DeleteDirectoryRec(tempDir);

       if (!ok)
           return false;
       glue.CloseConsoleOutput();
   }
    
   if (!FileExists(diffFile.c_str()))
   {
      DoMessageDialog(0, wxString(_("This file is new and has never been committed to the server or is an empty file on the server."))
                      + wxString(wxT("\n\n"))
                      + wxString(wxText(dirGroups.mySingleAbsolute)));
      return true;
   }
    
   do
   {
      externalApp = GetExternalApplication("Diff",
                                           dirGroups,
                                           forceQuery);
      forceQuery = false;
      if (externalApp.empty())
      {
          return false;
      }
      // Perform diff, waiting for it to finish (so we can delete file)
      glue.LockProgressDialog(true);
      if (rev2.empty())
          forceQuery = !RunExternalDiff(diffFile, dirGroups.mySingleAbsolute, dirGroups);
      else
          forceQuery = !RunExternalDiff(diffFile, diffFile2, dirGroups);
      glue.LockProgressDialog(false);
   }
   while (forceQuery);

   return true;
}
// View a revision
bool DoView(DirectoryGroups& dirGroups, std::string rev)
{
   std::string dir = UniqueTemporaryDir();
   std::string viewFile = dir;
   bool ok = true;
   CVSAction glue(0);
   std::string cvsroot;
   bool unixSandbox = IsUnixSandbox(StripLastPart(dirGroups.mySingleAbsolute));

   if (!rev.empty())
   {
      viewFile += "\\" + MakeRevFilename(ExtractLastPart(dirGroups.mySingleAbsolute), rev);
      DeleteFileA(viewFile.c_str());
   }

   glue.SetProgressFinishedCaption(Printf(_("Viewing %s"), 
                                          wxText(dirGroups.mySingleAbsolute).c_str()));
   glue.SetProgressCaption(Printf(_("Viewing %s"), wxText(dirGroups.mySingleAbsolute).c_str()));
   cvsroot = CVSStatus::CVSRootForPath(dirGroups.mySingleDirectory);

   // Viewing revision
   if (!rev.empty())
   {
      glue.SetCVSRoot(CVSRoot(cvsroot));
      MakeArgs args; 
      std::string sTempDir = UniqueTemporaryDir();
      glue.SetCloseIfOK(true);
      args.add_option("checkout");
      if (unixSandbox)
      {
          CVSServerFeatures sf;
          sf.Initialize(&glue);
          sf.AddUnixLineEndingsFlag(args);
      }
      if (rev != "HEAD")
      {
         args.add_option("-r");
         args.add_option(rev);
      }
      args.add_option("-d");
      args.add_option("temp");
      std::string s = EnsureTrailingUnixDelimiter(CVSStatus::CVSRepositoryForPath(dirGroups.mySingleAbsolute))
         + ExtractLastPart(dirGroups.mySingleAbsolute);
      args.add_arg(s);
      
      ok = glue.Command(sTempDir, args);
      if (ok)
      {
         // Copy file to destination
         std::string file = EnsureTrailingDelimiter(sTempDir) + "temp\\" +
            ExtractLastPart(dirGroups.mySingleAbsolute);
         SetFileReadOnly(file.c_str(), false);
         CopyFileA(file.c_str(), viewFile.c_str(), false);
         SetFileReadOnly(viewFile.c_str(), true);
      }

      // Erase temporary directory
      DeleteDirectoryRec(sTempDir);

      if (!ok)
         goto Cleanup;
   }
     
   if (!FileExists(viewFile.c_str()))
   {
      DoMessageDialog(0, wxString(_("This file is new and has never been committed to the server or is an empty file on the server."))
                      + wxString(wxT("\n\n")) 
                      + wxString(wxText(dirGroups.mySingleAbsolute)));
      return true;
   }
   
   // Perform view, waiting for it to finish (so we can delete file)
   glue.LockProgressDialog(true);
   if (rev.empty())
      LaunchFile(dirGroups.mySingleAbsolute, true);
   else
      LaunchFile(viewFile, true);
   glue.LockProgressDialog(false);
    
Cleanup:
   // Clean up
   if (!rev.empty())
   {
      SetFileReadOnly(viewFile.c_str(), false);
      DeleteFileA(viewFile.c_str());
   }
   DeleteDirectoryRec(dir);

   return ok;
}
Example #22
0
File: op_mem.c Project: anhkgg/temu
void glue(op_lwr, MEMSUFFIX) (void)
{
    uint32_t tmp = glue(ldl, MEMSUFFIX)(T0 & ~3);
    CALL_FROM_TB1(glue(do_lwr, MEMSUFFIX), tmp);
    RETURN();
}
Example #23
0
File: op_mem.c Project: anhkgg/temu
void glue(op_sw, MEMSUFFIX) (void)
{
    glue(stl, MEMSUFFIX)(T0, T1);
    RETURN();
}
Example #24
0
File: op_mem.c Project: anhkgg/temu
void glue(op_lwu, MEMSUFFIX) (void)
{
    T0 = glue(ldl, MEMSUFFIX)(T0);
    RETURN();
}
Example #25
0
void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
{
    glue(address_space_stq_be, SUFFIX)(ARG1, addr, val,
                                       MEMTXATTRS_UNSPECIFIED, NULL);
}
Example #26
0
void macro_test(void)
{
    printf("macro:\n");
    pf("N=%d\n", N);
    printf("aaa=%d\n", AAA);

    printf("min=%d\n", min(1, min(2, -1)));

    printf("s1=%s\n", glue(HIGH, LOW));
    printf("s2=%s\n", xglue(HIGH, LOW));
    printf("s3=%s\n", str("c"));
    printf("s4=%s\n", str(a1));
    printf("B3=%d\n", B3);

#ifdef A
    printf("A defined\n");
#endif
#ifdef B
    printf("B defined\n");
#endif
#ifdef A
    printf("A defined\n");
#else
    printf("A not defined\n");
#endif
#ifdef B
    printf("B defined\n");
#else
    printf("B not defined\n");
#endif

#ifdef A
    printf("A defined\n");
#ifdef B
    printf("B1 defined\n");
#else
    printf("B1 not defined\n");
#endif
#else
    printf("A not defined\n");
#ifdef B
    printf("B2 defined\n");
#else
    printf("B2 not defined\n");
#endif
#endif

#if 1+1
    printf("test true1\n");
#endif
#if 0
    printf("test true2\n");
#endif
#if 1-1
    printf("test true3\n");
#endif
#if defined(A)
    printf("test trueA\n");
#endif
#if defined(B)
    printf("test trueB\n");
#endif

#if 0
    printf("test 0\n");
#elif 0
    printf("test 1\n");
#elif 2
    printf("test 2\n");
#else
    printf("test 3\n");
#endif

    MACRO_NOARGS();

#ifdef __LINE__
    printf("__LINE__ defined\n");
#endif

    printf("__LINE__=%d __FILE__=%s\n",
           __LINE__, __FILE__);
#line 200
    printf("__LINE__=%d __FILE__=%s\n",
           __LINE__, __FILE__);
#line 203 "test" 
    printf("__LINE__=%d __FILE__=%s\n",
           __LINE__, __FILE__);
#line 227 "tcctest.c"

    /* not strictly preprocessor, but we test it there */
#ifdef C99_MACROS
    printf("__func__ = %s\n", __func__);
    dprintf(1, "vaarg=%d\n", 1);
#endif
    dprintf1(1, "vaarg1\n");
    dprintf1(1, "vaarg1=%d\n", 2);
    dprintf1(1, "vaarg1=%d %d\n", 1, 2);

    /* gcc extension */
    printf("func='%s'\n", __FUNCTION__);

    /* complicated macros in glibc */
    printf("INT64_MIN=%Ld\n", INT64_MIN);
    {
        int a;
        a = 1;
        glue(a+, +);
        printf("a=%d\n", a);
        glue(a <, <= 2);
        printf("a=%d\n", a);
    }
    
    /* macro function with argument outside the macro string */
#define MF_s MF_hello
#define MF_hello(msg) printf("%s\n",msg)

#define MF_t printf("tralala\n"); MF_hello

    MF_s("hi");
    MF_t("hi");
    
    /* test macro substituion inside args (should not eat stream) */
    printf("qq=%d\n", qq(qq)(2));

    /* test zero argument case. NOTE: gcc 2.95.x does not accept a
       null argument without a space. gcc 3.2 fixes that. */

#define qq1(x) 1
    printf("qq1=%d\n", qq1( ));

    /* comment with stray handling *\
/
       /* this is a valid *\/ comment */
       /* this is a valid comment *\*/
    //  this is a valid\
comment

    /* test function macro substitution when the function name is
       substituted */
    TEST2();
}
Example #27
0
uint32_t glue(address_space_ldl_be, SUFFIX)(ARG1_DECL,
    hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
{
    return glue(address_space_ldl_internal, SUFFIX)(ARG1, addr, attrs, result,
                                                    DEVICE_BIG_ENDIAN);
}
Example #28
0
/*
 * Substitute the arguments args appearing in the input sequence is
 * Result is created in the output sequence os and finally has the specified
 * hide set added to it, before getting returned.
 */
static PtokenSequence
subst(const Macro &m, dequePtoken is, const mapArgval &args, HideSet hs, bool skip_defined, const Macro *caller)
{
	PtokenSequence os;	// output sequence

	while (!is.empty()) {
		if (DP())
			cout << "subst: is=" << is << " os=" << os << endl;
		const Ptoken head(is.front());
		is.pop_front();		// is is now the tail
		dequePtoken::iterator ti, ti2;
		mapArgval::const_iterator ai;
		switch (head.get_code()) {
		case '#':		// Stringizing operator
			ti = find_nonspace(is.begin(), is.end());
			if (ti != is.end() && (ai = find_formal_argument(args, *ti)) != args.end()) {
				is.erase(is.begin(), ++ti);
				os.push_back(stringize(ai->second));
				continue;
			}
			break;
		case CPP_CONCAT:
			ti = find_nonspace(is.begin(), is.end());
			if (ti != is.end()) {
				if ((ai = find_formal_argument(args, *ti)) != args.end()) {
					is.erase(is.begin(), ++ti);
					if (ai->second.size() != 0)	// Only if actuals can be empty
						os = glue(os, ai->second);
				} else {
					PtokenSequence t(ti, ti + 1);
					is.erase(is.begin(), ++ti);
					os = glue(os, t);
				}
				continue;
			}
			break;
		default:
			ti = find_nonspace(is.begin(), is.end());
			if (ti != is.end() && ti->get_code() == CPP_CONCAT) {
				/*
				 * Implement the following gcc extension:
				 *  "`##' before a
				 *   rest argument that is empty discards the preceding sequence of
				 *   non-whitespace characters from the macro definition.  (If another macro
				 *   argument precedes, none of it is discarded.)"
				 * Otherwise, break to process a non-formal argument in the default way
				 */
				if ((ai = find_formal_argument(args, head)) == args.end()) {
					if (m.get_is_vararg()) {
						ti2 = find_nonspace(ti + 1, is.end());
						if (ti2 != is.end() && (ai = find_formal_argument(args, *ti2)) != args.end() && ai->second.size() == 0) {
							// All conditions satisfied; discard elements:
							// <non-formal> <##> <empty-formal>
							is.erase(is.begin(), ++ti2);
							continue;
						}
					}
					break;	// Non-formal arguments don't deserve special treatment
				}
				// Paste but not expand LHS, RHS
				if (ai->second.size() == 0) {	// Only if actuals can be empty
					is.erase(is.begin(), ++ti);	// Erase including ##
					ti = find_nonspace(is.begin(), is.end());
					if (ti != is.end() && (ai = find_formal_argument(args, *ti)) != args.end()) {
						is.erase(is.begin(), ++ti);	// Erase the ## RHS
						PtokenSequence actual(ai->second);
						os.splice(os.end(), actual);
					}
				} else {
					is.erase(is.begin(), ti);	// Erase up to ##
					PtokenSequence actual(ai->second);
					os.splice(os.end(), actual);
				}
				continue;
			}
			if ((ai = find_formal_argument(args, head)) == args.end())
				break;
			// Othewise expand head
			PtokenSequence expanded(macro_expand(ai->second, false, skip_defined, caller));
			os.splice(os.end(), expanded);
			continue;
		}
		os.push_back(head);
	}
	return (hsadd(hs, os));
}
Example #29
0
// Get the annotation list
CAnnotationList* AnnotateDialog::GetAnnotationList(wxWindow* parent)
{
    TDEBUG_ENTER("GetAnnotationList");
    wxBusyCursor();

   // We do not want any progress dialog here
   CVSAction glue(parent);
   glue.SetCloseIfOK(true);
   glue.SetHideStdout();
   wxString title = Printf(_("Annotate %s"), wxText(myFilename).c_str());
   glue.SetProgressCaption(title);

   MakeArgs args;
   args.add_option("annotate");
   // Avoid truncating user names
   args.add_option("-w");
   args.add_option("30");       // Ought to be enough
   // If revision is given, specify it
   if (!myRevision.empty())
   {
      args.add_option("-r");
      args.add_option(myRevision);
   }
   // If we are working on a branch, specify the branch using -r
   else if (CVSStatus::HasStickyTag(myFilename))
   {
      args.add_option("-r");
      args.add_option(CVSStatus::GetStickyTag(myFilename));
   }
   args.add_arg(ExtractLastPart(myFilename));
   bool ok = glue.Command(StripLastPart(myFilename), args);
   if (!ok)
   {
      return 0;
   }
   
   std::string out = glue.GetOutputText();
#if 0
   // Debugging
   std::ifstream in("C:\\cvs-log-output.txt");
   out.clear();
   while (true)
   {
      std::string line;
      std::getline(in, line);
      if (line.empty() && in.eof())
         break;
      out += line;
      out += "\n";
   }
   in.close();
#endif
   FindAndReplace<std::string>(out, "\r\n", "\n");

   if (out.empty())
   {
      wxString s(_("This file is new and has never been committed to the server or is an empty file on the server."));
      s += wxT("\n\n");
      s += wxText(myFilename);
      DoMessageDialog(0, s);
      return 0;
   }

   CAnnotationList* annotationList = new CAnnotationList();

   std::stringstream ifs(out.c_str());

   // Parsing the annotations
   while (true)
   {
      std::string line;
      if (!std::getline(ifs, line) && line.empty())
         break;

      // We need to skip any text which comes before the actual annotations.  A valid
      // annotation starts with the revision number, so we do a simple check to see if
      // the first character is a digit.  This may need to be revised if this assumption
      // is not valid.
      if (!isdigit(line[0]))
         continue;

      annotationList->AddAnnotation(line);
   }
   return annotationList;
}
Example #30
0
File: op_mem.c Project: anhkgg/temu
/* Standard loads and stores */
void glue(op_lb, MEMSUFFIX) (void)
{
    T0 = glue(ldsb, MEMSUFFIX)(T0);
    RETURN();
}