Example #1
0
TInt E32Main()
	{
	TInt r;

	 // Turn off lazy dll unloading
	RLoader l;
	if ((r=l.Connect())!=KErrNone)
		return r;
	r = l.CancelLazyDllUnload();
	l.Close();
	if (r!=KErrNone)
		return r;
	
	r = ParseCommandLine();
	if(r!=KErrNone)
		return r;
	r = Fs.Connect();
	if(r!=KErrNone)
		return r;
	r = Fs.MkDirAll(DestinationName.FullName());
	if(r==KErrNone || r==KErrAlreadyExists)
		r = DoIt();
	Fs.Close();
	return r;
	}
void BTree::_inOrderWalk(ostream &stream, Node *r, void DoIt(ostream&, Node*))
{
    if(r == NULL) return;
    DoIt(stream, r);
    _inOrderWalk(stream, r->left, DoIt);
    _inOrderWalk(stream, r->right, DoIt);
}
void EasySplitMainFrame::OnButton(wxCommandEvent& event)
{
    if (event.GetEventObject() == m_pButtonSize170k)
    {
        m_pSliderSize1->SetValue(FILE_SIZE_1_1541);
        m_pSliderSizeN->SetValue(FILE_SIZE_N_1541);
    }
    else if (event.GetEventObject() == m_pButtonSize800k)
    {
        m_pSliderSize1->SetValue(FILE_SIZE_1_1581);
        m_pSliderSizeN->SetValue(FILE_SIZE_N_1581);
    }
    else if (event.GetEventObject() == m_pButtonStart)
    {
        if (m_pInputFilePicker->GetPath().size())
            DoIt();
    }
    else if (event.GetEventObject() == m_pButtonQuit)
    {
        if (m_pWorkerThread)
        {
            m_pWorkerThread->Kill();
            delete m_pWorkerThread;
            m_pWorkerThread = NULL;
        }
        Close();
    }
}
Example #4
0
int main(int argc, char* argv[])
{

   MPI_Init(&argc,&argv);
   int iproc=0;
   MPI_Comm_rank(MPI_COMM_WORLD,&iproc);
    
   const bool very_verbose = false;
   time_t start_time_main;
   if( iproc==0 )
   {
      if( very_verbose )
      {
         std::cout << "cmdline:";
         for(int i=0; i<argc; i++) std::cout << " " << argv[i];
         std::cout << std::endl;
      }
      time(&start_time_main);
      struct tm * timeinfo = localtime(&start_time_main);
      std::cout << "start time = " << asctime(timeinfo); // << std::endl;
      int pid = 0;
      if(true) pid = getpid();
      std::cout << "process id = " << pid << std::endl;
   }

   DoIt(argc,argv);

   MPI_Finalize();

}
    // Generic method implementing fake blocking call requests
    int  RequestBlockingCall(int                     callerFrameworkId,
                             int                     producerBindKey,
                             int                     requestId,
                             unsigned int &          streamSize,
                             uvm_ml_stream_t         stream,
                             bool &                  useTrueBlocking,
                             uvm_ml_time_unit &      timeUnit,
                             double           &      timeValue,
                             unsigned int *          respstreamSize = NULL,
                             uvm_ml_stream_t         respstream = NULL,
                             uvm_ml_time *           delay = NULL)
  {
      BpConnectionClass * provider = BpInterconnect::GetSingleProvider(callerFrameworkId, producerBindKey);

      // Meantime implemented only the preepmptive blocking call
      assert (BpInterconnect::FrameworksCompatibleBlocking(*BpInterconnect::GetFramework(callerFrameworkId), *(provider->GetFrmw())));
      // TBD: issue a proper error

      if (BpInterconnect::GetFramework(callerFrameworkId)->SupportsTrueBlocking() && provider->GetFrmw()->SupportsTrueBlocking()) 
      {
          useTrueBlocking = true;
          return DoIt(*provider, streamSize, stream, respstreamSize, respstream, delay, timeUnit, timeValue);
      }
      else 
      {
          useTrueBlocking = false;
          return RequestIt(*provider, requestId, callerFrameworkId, streamSize, stream, respstreamSize, respstream, delay, timeUnit, timeValue);
      }
  }
///////////////////////////////////////////////////////////////////////////////////////////////////
//	Perform just the direction search using parameters in the default db and the ini file
//	Called when started with /IMPORT
///////////////////////////////////////////////////////////////////////////////////////////////////
BOOL DataIntegrityDoIt()	   
{
	ReadDefaultDbParameters();
	GetReviewPeriodParameters(&glldReviewPeriodStart, &glldReviewPeriodEnd, &gllulInterval);
	glliUserUnits = 0;
	return(DoIt());
}                                  
void BTree::_inOrderWalk(Node *r, void DoIt(Node*))
{
    if(r == NULL) return;
    DoIt(r);
    _inOrderWalk(r->left, DoIt);
    _inOrderWalk(r->right, DoIt);
}
void CalcSqrDifferenceAndTakeBest( int *mCurrFiltersImg, int *mCurrFiltersImgTarget,
                                   unsigned int **pCurrBestError32u, unsigned int **pCurrBestMapping32u, unsigned int nCurrCandMapping32u,
                                   unsigned int nCurIterOffset32u , unsigned int nKernels)
{
    ///// declarations
    unsigned int nCurError32u , ReminderBestError;
    int nDiffSqr32s;
    int k;
    unsigned int A_FiltersPtr , B_FiltersPtr;

    if (*pCurrBestMapping32u[0] == nCurrCandMapping32u)
        return;

    A_FiltersPtr = nKernels * nCurIterOffset32u;
    B_FiltersPtr = nKernels * nCurrCandMapping32u;
    ReminderBestError = *pCurrBestError32u[0];
    // first WH kernel (DC)
    nCurError32u = DoIt(mCurrFiltersImg,mCurrFiltersImgTarget,A_FiltersPtr, B_FiltersPtr);
    if (nCurError32u > ReminderBestError)
        return;

    A_FiltersPtr++;
    B_FiltersPtr++;
    ReminderBestError -= nCurError32u;
    // all the rest (in pairs)
    for (k = 1; (k < nKernels-1); k = k + 2)
    {
        nCurError32u = DoIt(mCurrFiltersImg,mCurrFiltersImgTarget,A_FiltersPtr, B_FiltersPtr);
        A_FiltersPtr++;
        B_FiltersPtr++;
        nCurError32u += DoIt(mCurrFiltersImg,mCurrFiltersImgTarget,A_FiltersPtr, B_FiltersPtr);
        A_FiltersPtr++;
        B_FiltersPtr++;
        if (nCurError32u > ReminderBestError)
            return;
        ReminderBestError -= nCurError32u;
    }
    if ((nKernels & 1) == 0) //Even number of kernels, check lust o
    {
        nCurError32u = DoIt(mCurrFiltersImg,mCurrFiltersImgTarget,A_FiltersPtr, B_FiltersPtr);
        if (nCurError32u > ReminderBestError)
            return;
    }

    *pCurrBestError32u[0]   = (*pCurrBestError32u[0] - ReminderBestError);
    *pCurrBestMapping32u[0] = nCurrCandMapping32u;
}
Example #9
0
int main(int argc, STRING *argv)
{
    Boolean namenotgiven = TRUE;

    /* main driver program.  Define the input file
       from either standard input or a name on the
       command line.  Process all arguments. */

    while (argc > 1)
        {
            argc--, argv++;
            if (**argv == '-')
                scanargs(*argv);
            else
                {
                    namenotgiven = FALSE;
                    input = fopen(*argv,"r");
                    if (input == NULL)
                        {
                            fprintf (stderr, "Can't open %s\n",*argv);
                        }
                    else
                        {
                            DoIt(*argv);
                            fclose(input);
                        }
                }
        }

    if (namenotgiven)
        {
            input = stdin;
            DoIt(NULL);
        }

    exit(0);
}
Example #10
0
void PecoApp::MessageReceived(BMessage *msg) {
	switch( msg->what ) {
		case B_SIMPLE_DATA:			RefsReceived (msg); break;
		case MSG_MENU_NEW:			New(); NoRenamer(); break;
		case MSG_SELECT_FILES: 		fFilePanel->Show(); break;
		case MSG_DO_IT: 			MakeList(); DoIt(); break;
		case MSG_RENAMER: 			ChangeRenamer(); break;
		case MSG_RENAME_SETTINGS:	MakeList(); break;
		case MSG_MENU_SCRIPT:		if (!NothingToDo()) fScriptFilePanel->Show(); break;
		case B_SAVE_REQUESTED:		CreateScript(msg); break;
		
	   	default:
	   		BApplication::MessageReceived(msg);
	}
};
Example #11
0
//-------------------------------------------------------------------------------
//
//	AutoPluginMain / main
//
//	All calls to the plug-in module come through this routine.
//	It must be placed first in the resource.  To achieve this,
//	most development systems require this be the first routine
//	in the source.
//
//	The entrypoint will be "pascal void" for Macintosh,
//	"void" for Windows.
//
//-------------------------------------------------------------------------------
DLLExport SPAPI SPErr AutoPluginMain(const char* caller, const char* selector, void* message)
{

	SPErr error = kSPNoError;

	try {

	SPMessageData * basicMessage = (SPMessageData *) message;

	sSPBasic = basicMessage->basic;
	
	if (sSPBasic->IsEqual(caller, kSPInterfaceCaller))
	{
		if (sSPBasic->IsEqual(selector, kSPInterfaceAboutSelector))
		{
			DoAbout(basicMessage->self, AboutID);
		}
	}

	// Photoshop is calling
	if (sSPBasic->IsEqual((char*)caller, kPSPhotoshopCaller))
	{
		// the one and only message 
		if (sSPBasic->IsEqual((char*)selector, kPSDoIt))
		{
			//pop a dialog to show plug-in works
			PSActionsPlugInMessage * actionsMessage = (PSActionsPlugInMessage *) message;
			DoIt(actionsMessage);
		}
	}

	
	PIUSuitesRelease();

	}

	catch (...)
	{
		if (error == 0)
			error = kSPBadParameterError;
	}

	return error;
}
void	WED_AptImportDialog::ReceiveMessage(
							GUI_Broadcaster *		inSrc,
							intptr_t    			inMsg,
							intptr_t				inParam)
{
	switch(inMsg) {
	case kMsg_FilterChanged:	
		mAptTable.SetFilter(mFilter->GetText());
		break;
	case kMsgImport:
		DoIt();
		this->AsyncDestroy();
		break;
	case msg_DocumentDestroyed:
	case kMsgCancel:
		this->AsyncDestroy();
		break;
	}
}
Example #13
0
void GoToTown(char pre)
{
   FILENODE *fptr, **bp;
   int n, *ix, *iy, *ia, *ib;

   fptr = GetSumm(pre, &n, &ix, &iy, &ia, &ib, &bp);
   if (!fptr)
   {
      DoIt(pre);
      fptr = GetSumm(pre, &n, &ix, &iy, &ia, &ib, &bp);
      assert(fptr);
   }
   fprintf(stdout, "%d:\n", __LINE__);
   PrintTable(n, ix, iy, ia, ib, bp);
   GenFiles(pre, n, ix, iy, ia, ib, bp);

   KillAllFN(fptr);
   free(bp);
   free(ix);
}
Example #14
0
	/**
	 *  @glsymbols
	 *  @glfunref{Clear}
	 */
	inline ~ClrBits(void)
	{
		try{ DoIt(); }
		catch(...){ }
	}
Example #15
0
	void operator()(bool dismiss)
	{
		DoIt();
		if(dismiss) Dismiss();
	}
Example #16
0
	void operator()(void) const
	{
		DoIt();
	}
Example #17
0
File: PclArc.c Project: aosm/X11
static void
PclDoArc(
     DrawablePtr pDrawable,
     GCPtr pGC,
     int nArcs,
     xArc *pArcs,
     void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc))
{
    char t[80];
    FILE *outFile;
    int nbox, i;
    BoxPtr pbox;
    BoxRec r;
    RegionPtr drawRegion, region, transClip;
    short fudge;
    int xoffset, yoffset;
    XpContextPtr pCon;
    PclContextPrivPtr pConPriv;
    xRectangle repro;
    
    if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
      return;
    
    fudge = 3 * pGC->lineWidth;

    pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
    pConPriv = (PclContextPrivPtr)
			pCon->devPrivates[PclContextPrivateIndex].ptr;
    XpGetReproductionArea( pCon, &repro );
    
    /* 
     * Generate the PCL code to draw the collection of arcs, by
     * defining it as a macro which uses the HP-GL/2 arc drawing
     * function.
     */

    xoffset = pDrawable->x;
    yoffset = pDrawable->y;
    
    for( i = 0; i < nArcs; i++ )
      {
	  xArc Arc = pArcs[i];
	  double b, X, Y, ratio;
	  double angle1;

	  MACRO_START( outFile, pConPriv );
	  SAVE_PCL( outFile, pConPriv, "\033%0B" );

	  /* Calculate the start of the arc */
	  if( ( Arc.angle1 / 64 ) % 360 == 90 )
	    {
		X = 0;
		Y = -Arc.height / 2.0;
	    }
	  else if( ( Arc.angle1 / 64 ) % 360 == 270 )
	    {
		X = 0;
		Y = Arc.height / 2.0;
	    }
	  else
	    {
		/* Convert the angle to radians */
		angle1 = ( Arc.angle1 / 64.0 ) * 3.141592654 / 180.0;
	  
		b = (Arc.height / 2.0);
		X = b * cos( angle1 );
		Y = -b * sin( angle1 );
	    }
	  
	  /* Change the coordinate system to scale the ellipse */
	  ratio = (double)Arc.height / (double)Arc.width;
	  
	  sprintf( t, "SC%.2f,%.2f,%d,%d;", 
		  (repro.x - Arc.width / 2 - xoffset - Arc.x) * ratio,
		  (repro.x - Arc.width / 2 - xoffset - Arc.x +
		   repro.width) * ratio,
		  repro.y - Arc.height / 2 - yoffset - Arc.y + repro.height,
		  repro.y - Arc.height / 2 - yoffset - Arc.y);
	  SAVE_PCL( outFile, pConPriv, t );

	  DoIt( outFile, pConPriv, X, Y, Arc );
	  
	  /* Build the bounding box */
	  r.x1 = -Arc.width / 2 - fudge;
	  r.y1 = -Arc.height / 2 - fudge;
	  r.x2 = Arc.width / 2 + fudge;
	  r.y2 = Arc.height / 2 + fudge;
	  drawRegion = REGION_CREATE( pGC->pScreen, &r, 0 );

	  SAVE_PCL( outFile, pConPriv, "\033%0A" );
	  MACRO_END( outFile );
    
	  /*
	   * Intersect the bounding box with the clip region.
	   */
	  region = REGION_CREATE( pGC->pScreen, NULL, 0 );
    	  transClip = REGION_CREATE( pGC->pScreen, NULL, 0 );
	  REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip );
	  REGION_TRANSLATE( pGC->pScreen, transClip,
			    -(xoffset + Arc.x + Arc.width / 2),
			    -(yoffset + Arc.y + Arc.height / 2) );
	  REGION_INTERSECT( pGC->pScreen, region, drawRegion, transClip );

	  /*
	   * For each rectangle in the clip region, set the HP-GL/2 "input
	   * window" and render the collection of arcs to it.
	   */
	  pbox = REGION_RECTS( region );
	  nbox = REGION_NUM_RECTS( region );
    
	  PclSendData(outFile, pConPriv, pbox, nbox, ratio);

	  /*
	   * Restore the coordinate system
	   */
	  sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, 
		  repro.x + repro.width, repro.y + repro.height, 
		  repro.y );
	  SEND_PCL( outFile, t );
	  
	  /*
	   * Clean up the temporary regions
	   */
	  REGION_DESTROY( pGC->pScreen, drawRegion );
	  REGION_DESTROY( pGC->pScreen, region );
	  REGION_DESTROY( pGC->pScreen, transClip );
      }
}
Example #18
0
int main()
{
	DoIt();
	system("pause");
	return 0;
}
Example #19
0
int main(){
    DoIt();
    DoNew();

    return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////
//	Perform both the dialog box setup and the actual search
////////////////////////////////////////////////////////////////////////////////////////////////
void DataIntegrityMenuOption()	                                     
{
	if (OnlyDialogBox(FALSE))
		DoIt();
}		
BOOL ImportAllDoIt(BOOL bClearIfRequested)	                      
{

	ReadINI_Parms();	// read the parameters to use this time		
	return(DoIt(FALSE, bClearIfRequested));          // do the import
}	
void __fastcall TJvShFileOperationMainForm::btnMoveClick(TObject *Sender)
{
  DoIt(foMove,"Move finished");
}
Example #23
0
bool PerigeeMove::Run()
{
	if ( m_options.debug_prompt )
	{
		DlgConfirmDelete dcd(m_files);
		CString csCaption;
		CString csTempl;
		CString csPrompt;

		csCaption.LoadString(IDS_CONFIRM_MOVE);
		csTempl.LoadString(IDS_CONFIRM_MOVE_PROMPT_TEMPL);
		csPrompt.Format(csTempl, (LPCTSTR)m_files[0].dest);

		dcd.ChangeCaption(csCaption, csPrompt);

		if ( IDCANCEL == dcd.DoModal() )
		{
			return false;
		}
	}
	
	m_progress.ShowWindow(SW_SHOW);


	// On Windows Vista, verify the user has permission to create files
	// in the destination folder, and prompt for elevation otherwise
	if (!m_files.empty() && EnableElevatePrompt() &&
		!VistaHelper::CheckAccess(m_files[0].dest, GENERIC_WRITE, m_token))
	{
		CString message;
		message.Format(IDS_ELEVATION_REQUIRED_TO_CREATE_FILES_IN_FOLDER, m_files[0].dest);
		DoElevatePrompt(message);
		if (m_cancel)
			return false;
	}

	PostPrompt();

	Reset();
	if (!InitIt())
		return false;

	for(;;)
	{
		Reset();
		if ( DoIt() )
		{
			return true;
		}

		if ( m_cancel )
			return false;

		bool retry = false;

		// if we're in "postpone" mode, enable prompting now
		if (m_options.overwrite == CPerigeeCopyOptions::overwrite_postpone) {
			retry = true;
			m_options.overwrite = CPerigeeCopyOptions::overwrite_prompt;
		}

		// show skipped files dialog
		if (!retry) {
			PrePrompt(false);
			CDialogFailedFiles dff(NULL, m_error_files);
			retry = IDOK == dff.DoModal();
			PostPrompt();
		}

		if ( retry )
		{
			// move failed files back to source list and try again
			m_files.clear();
			for(file_list::iterator it = m_error_files.begin(); 
				it != m_error_files.end(); ++it)
			{
				if ( it->error_type < warn_first )
				{
					m_files.push_back(*it);
				}
			}
		}
		else
		{
			return false;
		}
	}
}
void __fastcall TJvShFileOperationMainForm::btnRenameClick(TObject *Sender)
{
  DoIt(foRename,"Rename finished");
}
void __fastcall TJvShFileOperationMainForm::btnCopyClick(TObject *Sender)
{
  DoIt(foCopy,"Copy finished");
}
Example #26
0
bool EncodingDetector::DetectEncoding(const wxByte* buffer, size_t size, bool ConvertToWxString)
{
    ConfigManager* cfgMgr = Manager::Get()->GetConfigManager(_T("editor"));
    wxString encname = cfgMgr->Read(_T("/default_encoding"));

    if (cfgMgr->ReadInt(_T("/default_encoding/use_option"), 0) == 1)
    {
        // Bypass C::B's auto-detection
        m_Encoding = wxFontMapper::Get()->CharsetToEncoding(encname, false);

        if(m_UseLog)
        {
            wxString msg;
            msg.Printf(_T("Warning: bypassing E::B's auto-detection!\n"
                          "Encoding requested is: %s (ID: %d)"),
                       wxFontMapper::Get()->GetEncodingDescription(m_Encoding).c_str(),
                       m_Encoding);
            Manager::Get()->GetLogManager()->DebugLog(msg);
        }
    }
    else
    {
        if (!buffer)
            return false;
        if (size >= 4)
        {
            // BOM is max 4 bytes
            char buff[4] = {'\0'};
            memcpy(buff, buffer, 4);

            if (memcmp(buff, "\xEF\xBB\xBF", 3) == 0)
            {
                m_UseBOM = true;
                m_BOMSizeInBytes = 3;
                m_Encoding = wxFONTENCODING_UTF8;
            }
            else if (memcmp(buff, "\x00\x00\xFE\xFF", 4) == 0)
            {
                m_UseBOM = true;
                m_BOMSizeInBytes = 4;
                m_Encoding = wxFONTENCODING_UTF32BE;
            }
            else if (memcmp(buff, "\x00\x00\xFF\xFE", 4) == 0)
            {
            // 00 00 FF FE  UCS-4, unusual octet order BOM (2143)
            // X-ISO-10646-UCS-4-2143 can not (yet) be handled by wxWidgets
                m_Encoding = (wxFontEncoding)-1;
            }
            else if (memcmp(buff, "\xFF\xFE\x00\x00", 4) == 0)
            {
                m_UseBOM = true;
                m_BOMSizeInBytes = 4;
                m_Encoding = wxFONTENCODING_UTF32LE;
            }
            else if (memcmp(buff, "\xFE\xFF\x00\x00", 4) == 0)
            {
            // FE FF 00 00  UCS-4, unusual octet order BOM (3412)
            // X-ISO-10646-UCS-4-3412 can not (yet) be handled by wxWidgets
                m_Encoding = (wxFontEncoding)-1;
            }
            else if (memcmp(buff, "\xFE\xFF", 2) == 0)
            {
                m_UseBOM = true;
                m_BOMSizeInBytes = 2;
                m_Encoding = wxFONTENCODING_UTF16BE;
            }
            else if (memcmp(buff, "\xFF\xFE", 2) == 0)
            {
                m_UseBOM = true;
                m_BOMSizeInBytes = 2;
                m_Encoding = wxFONTENCODING_UTF16LE;
            }
        }


        if (m_UseBOM)
        {
            if(m_UseLog)
            {
                wxString msg;
                msg.Printf(_T("Detected encoding via BOM: %s (ID: %d)"),
                           wxFontMapper::Get()->GetEncodingDescription(m_Encoding).c_str(),
                           m_Encoding);
                Manager::Get()->GetLogManager()->DebugLog(msg);
            }
        }
        // Try our own detection for UTF-16 and UTF-32, the mozilla-version does not work without BOM
        else if ( !DetectUTF16((wxByte*)buffer, size) &&
                  !DetectUTF32((wxByte*)buffer, size) )
            {
            // if we still have no results try mozilla's detection
            m_Encoding = wxFontMapper::Get()->CharsetToEncoding(DoIt((char*)buffer, size), false);
            if(m_Encoding == wxFONTENCODING_DEFAULT)
            {
                wxString enc_name = Manager::Get()->GetConfigManager(_T("editor"))->Read(_T("/default_encoding"), wxLocale::GetSystemEncodingName());
                m_Encoding = wxFontMapper::GetEncodingFromName(enc_name);
                if(m_UseLog)
                {
                    wxString msg;
                    msg.Printf(_T("Text seems to be pure ASCII!\n"
                                  "We use user specified encoding: %s (ID: %d)"),
                               wxFontMapper::Get()->GetEncodingDescription(m_Encoding).c_str(),
                               m_Encoding);
                    Manager::Get()->GetLogManager()->DebugLog(msg);
                }
            }
            if (m_Encoding < 0)
            {
                // Use user-specified one; as a fallback
                m_Encoding = wxFontMapper::Get()->CharsetToEncoding(encname, false);

                if(m_UseLog)
                {
                    wxString msg;
                    msg.Printf(_T("Warning: Using user specified encoding as fallback!\n"
                                  "Encoding fallback is: %s (ID: %d)"),
                               wxFontMapper::Get()->GetEncodingDescription(m_Encoding).c_str(),
                               m_Encoding);
                    Manager::Get()->GetLogManager()->DebugLog(msg);
                }
            }

            m_UseBOM = false;
            m_BOMSizeInBytes = 0;
        }
    }

    if(m_UseLog)
    {
        wxString msg;
        msg.Printf(_T("Final encoding detected: %s (ID: %d)"),
                   wxFontMapper::Get()->GetEncodingDescription(m_Encoding).c_str(),
                   m_Encoding);
        Manager::Get()->GetLogManager()->DebugLog(msg);
    }

    if (ConvertToWxString)
    {
        ConvertToWxStr(buffer, size);
    }

    return true;
} // end of DetectEncoding
Example #27
0
int main ( int argc, char *argv[] )
{
    int     opt = 0;
    int     vg_class;
    int     vg_type;
    int     obj_type;
    int     action;
    int     result;
    int     match;
    char    *arg;
    char    *sep;

    action = 0;
    vg_class = vg_type = obj_type = -1;                
    optind = 1;
    while (optind < argc) {
        opt = getopt(argc, argv, ":o:h");
        switch (opt) {
            case 'o':
                vg_class = vg_type = obj_type = -1;                
                arg = optarg;

                sep = strchr(arg, ':');
                if (sep) *sep = '\0';
                sscanf(arg, "%d", &vg_class);
                if (sep) {
                    arg = sep+1;
                    sep = strchr(arg, ':');
                    if (sep) *sep = '\0';
                    sscanf(arg, "%d", &vg_type);
                }
                if (sep) {
                    arg = sep+1;
                    sscanf(arg, "%d", &obj_type);
                }
            break;

            case ':':
                fprintf(stderr, "ERROR: Missing argument for -%c\n", optopt);
                Usage();
                exit (-1);
            break;

            case 'h':
                Usage();
                exit (-1);
            break;

            default:
                action = 1;
                result = DoIt(
                        argv[optind],
                        vg_class,
                        vg_type,
                        obj_type,
                        &match
                    );
                if (result) {
                    fprintf(stderr, 
                        "ERROR: Received GEMPAK error %d processing %s, exiting...\n", 
                        result, argv[optind]
                    );

                    exit (-1);
                }
                printf("%d\n", match);
               optind++;

            break;
        }
    }

    if (!action) {
        Usage();
    }

    return(0);
}
Example #28
0
File: rltkRegs.c Project: OTiZ/osx
int main( int argc, char **argv )
{
    UInt32	regNum, regValue;
    int		rc;


    gInUCRequest.reqID		= 0;
    gInUCRequest.pBuffer	= 0;
    gInUCRequest.bufferSz	= 0;

    if ( argc == 1 )
        return DoIt( kRltkUserCmd_GetRegs );

    if ( argc == 2 && strcmp( argv[1], "-r" ) == 0 )
        return DoIt( kRltkUserCmd_GetRegs );

    if ( argc == 3 && strcmp( argv[1], "-r" ) == 0 )
    {
        rc = sscanf( argv[2], "%lx", &regNum );
        if ( rc == 1 && regNum < 0x9060 )
        {
            gInUCRequest.pBuffer = (UInt8*)regNum;
            //	printf( "Reading Rltk register %04lx\n", regNum );
            return DoIt( kRltkUserCmd_GetOneReg );
        }
        else
            printf( "Bad register number?\n" );
        return 0;
    }

    if ( argc == 4 && strcmp( argv[1], "-w" ) == 0 )
    {
        if ( strncmp( argv[2], "0x", 2) == 0 )		// skip over any leading 0x
            argv[2] += 2;
        rc = sscanf( argv[2], "%lx", &regNum );
        if ( rc == 1 && regNum < 0x9060 )
        {
            if ( strncmp( argv[3], "0x", 2) == 0 )		// skip over any leading 0x
                argv[3] += 2;
            rc = sscanf( argv[3], "%lx", &regValue );
            if ( rc == 1 )
            {
                gInUCRequest.pBuffer	= (UInt8*)regNum;
                gInUCRequest.bufferSz	= regValue;
                //	printf( "Writing Rltk register %04lx with 0x%lx\n", regNum, regValue );
                return DoIt( kRltkUserCmd_WriteOneReg );
            }
            else
                printf( "Bad value?\n" );
        }
        else
            printf( "Bad register number?\n" );
        return 0;
    }

    printf( "\n\t\t\tUsage:\n" );
    printf( "%s\t\tto dump all Rltk registers.\n", argv[0] );
    printf( "%s -r\t\t\t\tditto.\n", argv[0] );
    printf( "%s -r 0xAAAA \t\tto dump  Rltk register AAAA.\n", argv[0] );
    printf( "%s -w 0xAAAA VVVVVVVV\tto write Rltk register AAAA with VVVVVVVVV.\n", argv[0] );
    return 1;
}/* end main */
///////////////////////////////////////////////////////////////////////////////////////////////////
//	Perform both the dialog box and import with option to save to default.  Called from Main Menu selection
///////////////////////////////////////////////////////////////////////////////////////////////////
void ImportAllMenuOption()
{

	if (OnlyDialogBox(FALSE))	// display the dialog box and get inputs
		DoIt(TRUE, TRUE);		// import the specified files
}	
void __fastcall TJvShFileOperationMainForm::btnDeleteClick(TObject *Sender)
{
  DoIt(foDelete,"Delete finished");
}