コード例 #1
0
void KeyboardEvent::GetInitDict(KeyboardEventInit& aParam)
{
  GetKey(aParam.mKey);
  GetCode(aParam.mCode);
  aParam.mLocation = Location();
  aParam.mRepeat = Repeat();
  aParam.mIsComposing = IsComposing();

  // legacy attributes
  aParam.mKeyCode = KeyCode();
  aParam.mCharCode = CharCode();
  aParam.mWhich = Which();

  // modifiers from EventModifierInit
  aParam.mCtrlKey = CtrlKey();
  aParam.mShiftKey = ShiftKey();
  aParam.mAltKey = AltKey();
  aParam.mMetaKey = MetaKey();

  WidgetKeyboardEvent* internalEvent = mEvent->AsKeyboardEvent();
  aParam.mModifierAltGraph = internalEvent->IsAltGraph();
  aParam.mModifierCapsLock = internalEvent->IsCapsLocked();
  aParam.mModifierFn = internalEvent->IsFn();
  aParam.mModifierFnLock = internalEvent->IsFnLocked();
  aParam.mModifierNumLock = internalEvent->IsNumLocked();
  aParam.mModifierOS = internalEvent->IsOS();
  aParam.mModifierScrollLock = internalEvent->IsScrollLocked();
  aParam.mModifierSymbol = internalEvent->IsSymbol();
  aParam.mModifierSymbolLock = internalEvent->IsSymbolLocked();

  // EventInit
  aParam.mBubbles =  internalEvent->mFlags.mBubbles;
  aParam.mCancelable = internalEvent->mFlags.mCancelable;
}
コード例 #2
0
bool CSeqTable_sparse_index::HasValueAt(size_t row) const
{
    switch ( Which() ) {
    case e_Indexes:
    {
        const TIndexes& indexes = GetIndexes();
        TIndexes::const_iterator iter =
            lower_bound(indexes.begin(), indexes.end(), row);
        return iter != indexes.end() && *iter == row;
    }
    case e_Indexes_delta:
        return x_FindDeltaSum(row) != kInvalidRow;
    case e_Bit_set:
    {
        const TBit_set& bits = GetBit_set();
        size_t i = row/8, j = row%8;
        return i < bits.size() && ((bits[i]<<j)&0x80) != 0;
    }
    case e_Bit_set_bvector:
    {
        const bm::bvector<>& bv = GetBit_set_bvector().GetBitVector();
        return row < bv.size() && bv.get_bit(row);
    }
    default:
        return false;
    }
}
コード例 #3
0
NS_IMETHODIMP
UIEvent::GetWhich(uint32_t* aWhich)
{
  NS_ENSURE_ARG_POINTER(aWhich);
  *aWhich = Which();
  return NS_OK;
}
コード例 #4
0
// Determines the type of set and calls the appropriately instantiated
// s_GetLabel
bool CPub_set::GetLabel(string* label, TLabelFlags flags,
                        ELabelVersion version) const
{
    // Ensure label exists
    if (!label) {
        return false;
    }
    
    switch (Which()) {
    case e_Pub:
        return s_GetLabel<CPub>(label, GetPub(), flags, version);
    case e_Medline:
        return s_GetLabel<CMedline_entry>(label, GetMedline(), flags, version);
    case e_Article:
        return s_GetLabel<CCit_art>(label, GetArticle(), flags, version);
    case e_Journal:
        return s_GetLabel<CCit_jour>(label, GetJournal(), flags, version);
    case e_Book:
        return s_GetLabel<CCit_book>(label, GetBook(), flags, version);
    case e_Proc:
        return s_GetLabel<CCit_proc>(label, GetProc(), flags, version);
    case e_Patent:
        return s_GetLabel<CCit_pat>(label, GetPatent(), flags, version);
    default:
        return false;
    }
}
コード例 #5
0
size_t CSeqTable_sparse_index::x_GetFirstRowWithValue(void) const
{
    switch ( Which() ) {
    case e_Indexes:
    {
        const TIndexes& indexes = GetIndexes();
        return indexes.empty()? kInvalidRow: indexes.front();
    }
    case e_Indexes_delta:
    {
        const TIndexes_delta& deltas = GetIndexes_delta();
        return deltas.empty()? kInvalidRow: deltas.front();
    }
    case e_Bit_set:
    {
        const TBit_set& bytes = GetBit_set();
        size_t byte_index = sx_FindFirstNonZeroByte(bytes, 0);
        if ( byte_index == kInvalidRow ) {
            return kInvalidRow;
        }
        return byte_index*8 + sx_FindFirstNonZeroBit(Uint1(bytes[byte_index]));
    }
    case e_Bit_set_bvector:
        return GetBit_set_bvector().GetBitVector().get_first();
    default:
        return kInvalidRow;
    }
}
コード例 #6
0
int CSeq_id_Handle::CompareOrdered(const CSeq_id_Handle& id) const
{
    // small optimization to avoid creation of temporary CSeq_id objects
    if ( int diff = Which() - id.Which() ) {
        return diff;
    }
    if ( IsGi() && id.IsGi() ) {
        return GetGi() - id.GetGi();
    }
    return GetSeqId()->CompareOrdered(*id.GetSeqId());
}
コード例 #7
0
ファイル: Date.cpp プロジェクト: swuecho/igblast
CTime CDate::AsCTime(CTime::ETimeZone tz) const
{
    switch (Which()) {
    case e_Std:
        return GetStd().AsCTime(tz);
    case e_Str:
        return CTime(GetStr()); // attempt to parse
    default:
        return CTime(CTime::eEmpty);
    }
}
コード例 #8
0
ファイル: Search_func.cpp プロジェクト: swuecho/igblast
bool CSearch_func :: Empty() const
{
   switch (Which()) {
      case e_String_constraint:
          return GetString_constraint().Empty();
      case  e_Prefix_and_numbers:
          return (GetPrefix_and_numbers().empty());
      default: return false;
   }
   return false;
};
コード例 #9
0
ファイル: which.c プロジェクト: amanuel2/IMPORTED_OS_MIRROR
int main(int argc, char* argv[])
{
	const char* argv0 = argv[0];
	bool all = false;
	for ( int i = 1; i < argc; i++ )
	{
		const char* arg = argv[i];
		if ( arg[0] != '-' || !arg[1] )
			continue;
		argv[i] = NULL;
		if ( !strcmp(arg, "--") )
			break;
		if ( arg[1] != '-' )
		{
			char c;
			while ( (c = *++arg) ) switch ( c )
			{
			case 'a': all = true; break;
			default:
				fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
				help(stderr, argv0);
				exit(1);
			}
		}
		else if ( !strcmp(arg, "--help") )
			help(stdout, argv0), exit(0);
		else if ( !strcmp(arg, "--version") )
			version(stdout, argv0), exit(0);
		else
		{
			fprintf(stderr, "%s: unknown option: %s\n", argv0, arg);
			help(stderr, argv0);
			exit(1);
		}
	}

	compact_arguments(&argc, &argv);

	if ( argc < 2 )
		error(1, 0, "missing operand");

	const char* path = getenv("PATH");

	bool success = true;
	for ( int i = 1; i < argc; i++ )
	{
		const char* arg = argv[i];
		if ( !Which(arg, path, all) )
			success = false;
	}

	return success ? 0 : 1;
}
コード例 #10
0
 virtual OutType* next(int n = 1) const
 {
   if(mTree->empty())
     return NULL;
   typename TreeType::iterator iter = mIter;
   while(n--)
   {
     if(++iter == mTree->end())
       iter = mTree->begin();
   }
   return Which()(*iter);
 }
コード例 #11
0
ファイル: Date.cpp プロジェクト: swuecho/igblast
void CDate::SetToTime(const CTime& time, CDate::EPrecision prec)
{
    switch (Which()) {
    case e_not_set:
    case e_Std:
        SetStd().SetToTime(time, prec);
        break;
    case e_Str:
        SetStr(time.AsString());
        break;
    }
}
コード例 #12
0
ファイル: Pub.cpp プロジェクト: swuecho/igblast
const CAuth_list& CPub::GetAuthors (void) const
{
  switch (Which()) {
    case CPub::e_Gen :
        return (GetGen().GetAuthors());
    case CPub::e_Sub :
        return (GetSub().GetAuthors());
    case CPub::e_Article :
        return (GetArticle().GetAuthors());
    case CPub::e_Book :
        return (GetBook().GetAuthors());
    case CPub::e_Proc :
        return (GetProc().GetBook().GetAuthors());
    case CPub::e_Patent :
        return (GetPatent().GetAuthors());
    case CPub::e_Man :
        return (GetMan().GetCit().GetAuthors());
    default :
        NCBI_THROW(CSerialException, eNotImplemented,
                   "CPub::GetAuthors: unsupported entry type "
                   + SelectionName(Which()));
  }
}
コード例 #13
0
// format contents into a stream
ostream& CObject_id::AsString(ostream &s) const
{
    switch ( Which() ) {
    case e_Id:
        s << GetId();
        break;
    case e_Str:
        s << GetStr(); // no Upcase() on output as per Ostell 7/2001 - Karl
        break;
    default:
        break;
    }
    return s;
}
コード例 #14
0
ファイル: Product_pos.cpp プロジェクト: swuecho/igblast
TSeqPos CProduct_pos::AsSeqPos() const
{
    switch (Which()) {
    case CProduct_pos::e_Nucpos:
        return GetNucpos();

    case CProduct_pos::e_Protpos:
        return GetProtpos().GetAmin() * 3 + GetProtpos().GetFrame() -1;

    default:
        NCBI_THROW(CException, eUnknown, "Bad product pos");
        return 0;
    }
}
コード例 #15
0
// match for identity
bool CObject_id::Match(const CObject_id& oid2) const
{
    E_Choice type = Which();

    if ( type != oid2.Which() )
        return false;

    switch ( type ) {
    case e_Id:
        return GetId() == oid2.GetId();
    case e_Str:
        return PNocase().Equals(GetStr(), oid2.GetStr());
    default:
        return this == &oid2;
    }
}
コード例 #16
0
size_t CSeqTable_sparse_index::GetIndexAt(size_t row) const
{
    switch ( Which() ) {
    case e_Indexes:
    {
        const TIndexes& indexes = GetIndexes();
        TIndexes::const_iterator iter =
            lower_bound(indexes.begin(), indexes.end(), row);
        if ( iter != indexes.end() && *iter == row ) {
            return iter - indexes.begin();
        }
        else {
            return kSkipped;
        }
    }
    case e_Indexes_delta:
        return x_FindDeltaSum(row);
    case e_Bit_set:
    {
        const TBit_set& bytes = GetBit_set();
        size_t byte_index = row/8;
        if ( byte_index >= bytes.size() ) {
            return kSkipped;
        }
        Uint1 byte = bytes[byte_index];
        size_t bit_index = row%8; // most significant bit has index 0
        if ( !((byte<<bit_index)&0x80) ) {
            return kSkipped;
        }
        size_t count = sx_CalcByteBitCount(Uint1(byte>>(8-bit_index)));
        if ( byte_index ) {
            count += x_GetBitSetCache(byte_index);
        }
        return count;
    }
    case e_Bit_set_bvector:
    {
        const bm::bvector<>& bv = GetBit_set_bvector().GetBitVector();
        if ( row >= bv.size() || !bv.get_bit(row) ) {
            return kSkipped;
        }
        return row == 0? 0: bv.count_range(0, row-1);
    }
    default:
        return kSkipped;
    }
}
コード例 #17
0
ファイル: Date.cpp プロジェクト: swuecho/igblast
void CDate::GetDate(string* label, const string& format) const
{
    // Ensure that date exists
    if (!label) {
        return;
    }
    
    switch (Which()) {
    case e_Str:
        *label += GetStr();
        return;
    case e_Std:
        GetStd().GetDate(label, format);
        return;
    default:
        return;
    }
}
コード例 #18
0
ファイル: strcnv.cpp プロジェクト: theranger/vabamorf
void CONV_HTML_UC2::Start(
    const FSTCHAR* path,
    const bool _ignoramp_,
    const bool _autosgml_
)
{
    ignoramp=_ignoramp_;
    autosgml=_autosgml_;
    if(path!=NULL) // v�tame loendi failist
    {
        CFSString tabeliFailiNimi(FSTSTR("sgml-uc-cnv.txt"));
        CFSString tabeliFailiPikkNimi;
        CFSString p(path);
        // Otsime �les, millises kataloogis teisendustabel
        if(Which(&tabeliFailiPikkNimi, &p, &tabeliFailiNimi)==false)
            throw VEAD(ERR_X_TYKK, ERR_OPN, __FILE__,__LINE__, "$Revision: 557 $",
                       "Ei leia SGML olemite faili sgml-uc-cnv.txt");
        // Avame teisenustabelit sisaldaa faili
        CPFSFile tabeliFail;
        if(tabeliFail.Open(tabeliFailiPikkNimi, FSTSTR("rb"))==false)
            throw VEAD(ERR_X_TYKK, ERR_OPN, __FILE__,__LINE__, "$Revision: 557 $"
                       "Ei suuda avada SGML olemite faili"
#if !defined( _UNICODE )
                       ,(const char*)tabeliFailiPikkNimi
#endif
                      );
        // Loeme failist teisendustabeli m�llu
        SGML_UC* rec;
        sgml2uc.Start(100,10);
        uc2sgml.Start(100,10);
        sgml_stringi_max_pikkus=0;
        int n;
        while((rec=sgml2uc.AddPlaceHolder())->Start(tabeliFail)==true)
        {
            uc2sgml.AddPtr(rec); // sellesse massiivi panema ainult viida
            if((n=(int)strlen(rec->sgml))>sgml_stringi_max_pikkus)
                sgml_stringi_max_pikkus=n;
        }
        sgml2uc.Del(); // kustutame  viimase, sest sinna ei �nnestunud lugeda
        sgml2uc.Sort(SGML_UC::sortBySGMLStr);   // selle massiivi j�rjestame SGML olemite j�rgi
        uc2sgml.Sort(SGML_UC::sortByUCchar);    // selle massiivi j�rjestame UNICODEi s�mbolite j�rgi
    }
}
コード例 #19
0
size_t CSeqTable_sparse_index::GetSize(void) const
{
    switch ( Which() ) {
    case e_Indexes:
    {
        const TIndexes& indexes = GetIndexes();
        return indexes.empty()? 0: indexes.back()+1;
    }
    case e_Indexes_delta:
    {
        const TIndexes_delta& deltas = GetIndexes_delta();
        return deltas.empty()? 0: x_GetDeltaSum(deltas.size()-1)+1;
    }
    case e_Bit_set:
        return GetBit_set().size()*8;
    case e_Bit_set_bvector:
        return GetBit_set_bvector().GetSize();
    default:
        return 0;
    }
}
コード例 #20
0
size_t CSeqTable_sparse_index::x_GetNextRowWithValue(size_t row,
                                                     size_t value_index) const
{
    switch ( Which() ) {
    case e_Indexes:
    {
        const TIndexes& indexes = GetIndexes();
        return ++value_index >= indexes.size()?
            kInvalidRow: indexes[value_index];
    }
    case e_Indexes_delta:
    {
        const TIndexes_delta& deltas = GetIndexes_delta();
        return ++value_index >= deltas.size()?
            kInvalidRow: row + deltas[value_index];
    }
    case e_Bit_set:
    {
        const TBit_set& bytes = GetBit_set();
        size_t byte_index = row / 8;
        size_t bit_index = row % 8;
        bit_index = sx_FindNextNonZeroBit(Uint1(bytes[byte_index]), bit_index);
        if ( bit_index != kInvalidRow ) {
            return byte_index*8 + bit_index;
        }
        byte_index = sx_FindFirstNonZeroByte(bytes, byte_index + 1);
        if ( byte_index == kInvalidRow ) {
            return kInvalidRow;
        }
        return byte_index*8 + sx_FindFirstNonZeroBit(Uint1(bytes[byte_index]));
    }
    case e_Bit_set_bvector:
    {
        row = GetBit_set_bvector().GetBitVector().get_next(row);
        return row == 0? kInvalidRow: row;
    }
    default:
        return kInvalidRow;
    };
}
コード例 #21
0
ファイル: Pub.cpp プロジェクト: swuecho/igblast
bool CPub::IsSetAuthors(void) const
{
    switch (Which()) {
    case CPub::e_Gen :
        return (GetGen().IsSetAuthors());
    case CPub::e_Sub :
        return (GetSub().IsSetAuthors());
    case CPub::e_Article :
        return (GetArticle().IsSetAuthors());
    case CPub::e_Book :
        return (GetBook().IsSetAuthors());
    case CPub::e_Proc :
        return (GetProc().IsSetBook() && GetProc().GetBook().IsSetAuthors());
    case CPub::e_Patent :
        return (GetPatent().IsSetAuthors());
    case CPub::e_Man :
        return (GetMan().IsSetCit() && GetMan().GetCit().IsSetAuthors());
    default :
      break;
  }
  
  return false;
}
コード例 #22
0
void CSeqTable_sparse_index::ChangeTo(E_Choice type)
{
    if ( Which() == type ) {
        return;
    }
    switch ( type ) {
    case e_Indexes:
        ChangeToIndexes();
        break;
    case e_Indexes_delta:
        ChangeToIndexes_delta();
        break;
    case e_Bit_set:
        ChangeToBit_set();
        break;
    case e_Bit_set_bvector:
        ChangeToBit_set_bvector();
        break;
    default:
        NCBI_THROW(CSeqTableException, eIncompatibleRowType,
                   "CSeqTable_sparse_index::ChangeTo(): "
                   "requested sparse index type is invalid");
    }
}
コード例 #23
0
ファイル: Pub.cpp プロジェクト: swuecho/igblast
void CPub::GetTitles(
    TOneTitleRefVec & out_title,
    size_t iMaxToGet ) const
{
    // this "if" lets us assume below this point that 
    // we have room for at least one 
    if( iMaxToGet <= 0 ) {
        return;
    }

    switch( Which() ) {
    case CPub::e_not_set:
    case CPub::e_Medline:
    case CPub::e_Pmid:
    case CPub::e_Pat_id:
        // these types don't have titles, so nothing to do
        break;
    case CPub::e_Gen:
        if( GetGen().IsSetTitle() ) {
            out_title.push_back( 
                xs_GetTitleFromPlainString(
                GetGen().GetTitle()) );
        }
        break;
    case CPub::e_Sub:
        if( GetSub().IsSetDescr() ) {
            out_title.push_back( 
                xs_GetTitleFromPlainString(
                GetSub().GetDescr()) );
        }
        break;
    case CPub::e_Article:
        if( GetArticle().IsSetTitle() && GetArticle().GetTitle().IsSet() ) {
            xs_AppendTitles( out_title, iMaxToGet, GetArticle().GetTitle() );
        }
        break;
    case CPub::e_Journal:
        if( GetJournal().IsSetTitle() ) {
            xs_AppendTitles( out_title, iMaxToGet, GetJournal().GetTitle() );
        }
        break;
    case CPub::e_Book:
        if( GetBook().IsSetTitle() ) {
            xs_AppendTitles( out_title, iMaxToGet, GetBook().GetTitle() );
        }
        break;
    case CPub::e_Proc:
        // what to do here?  It has a book and meeting
        // It's not entirely clear if this is the best course of action
        if( FIELD_CHAIN_OF_2_IS_SET(GetProc(), Book, Title) ) {
            xs_AppendTitles( out_title, iMaxToGet, 
                GetProc().GetBook().GetTitle() );
        }
        break;
    case CPub::e_Patent:
        if( GetPatent().IsSetTitle() ) {
            out_title.push_back( 
                xs_GetTitleFromPlainString(
                GetPatent().GetTitle()) );
        }
        break;
    case CPub::e_Man:
        if( FIELD_CHAIN_OF_2_IS_SET(GetMan(), Cit, Title) ) {
            xs_AppendTitles( out_title, iMaxToGet, 
                GetMan().GetCit().GetTitle() );
        }
        break;
    case CPub::e_Equiv:
        {
            size_t iMaxTitleSizeAllowed = ( out_title.size() + iMaxToGet );
            if( iMaxTitleSizeAllowed < out_title.size() ) {
                // integer overflowed
                iMaxTitleSizeAllowed = 
                    std::numeric_limits<std::size_t>::max();
            }
            FOR_EACH_PUB_ON_PUBEQUIV(pub_it, GetEquiv()) {
                if( out_title.size() >= iMaxTitleSizeAllowed ) {
                    break;
                }

                // dig down recursively
                (*pub_it)->GetTitles(out_title, 
                    (iMaxTitleSizeAllowed - out_title.size()) );
            }
        }
        break;
    default:
        NCBI_THROW(CException, eUnknown, "unhandled pub type");
    }
}
コード例 #24
0
 virtual OutType* get() const
 {
   if(mTree->empty())
     return NULL;
   return Which()(*mIter);
 }
コード例 #25
0
 bool operator()(const typename TreeType::value_type& comp) const
 {
   return mToFind == Which()(comp);
 }
コード例 #26
0
ファイル: plus_node.hpp プロジェクト: headmyshoulder/taylor
	Value operator()( const State &x , const Derivs &derivs , Which )
	{
		return m_left( x , derivs , Which() ) + m_right( x , derivs , Which() );
	}
コード例 #27
0
ファイル: shell_misc.cpp プロジェクト: Eluchel/adosbox
bool DOS_Shell::Execute(char * name,char * args) {
/* return true  => don't check for hardware changes in do_command
 * return false =>       check for hardware changes in do_command */
	char fullname[DOS_PATHLENGTH+4]; //stores results from Which
	char* p_fullname;
	char line[CMD_MAXLINE];
	if(strlen(args)!= 0){
		if(*args != ' '){ //put a space in front
			line[0]=' ';line[1]=0;
			strncat(line,args,CMD_MAXLINE-2);
			line[CMD_MAXLINE-1]=0;
		}
		else
		{
			safe_strncpy(line,args,CMD_MAXLINE);
		}
	}else{
		line[0]=0;
	};

	/* check for a drive change */
	if (((strcmp(name + 1, ":") == 0) || (strcmp(name + 1, ":\\") == 0)) && isalpha(*name))
	{
		if (!DOS_SetDrive(toupper(name[0])-'A')) {
			WriteOut(MSG_Get("SHELL_EXECUTE_DRIVE_NOT_FOUND"),toupper(name[0]));
		}
		return true;
	}
	/* Check for a full name */
	p_fullname = Which(name);
	if (!p_fullname) return false;
	strcpy(fullname,p_fullname);
	const char* extension = strrchr(fullname,'.');

  __android_log_print(ANDROID_LOG_INFO, "dosbox", "command fullname:%s", fullname);
	/*always disallow files without extension from being executed. */
	/*only internal commands can be run this way and they never get in this handler */
	if(extension == 0)
	{
		//Check if the result will fit in the parameters. Else abort
		if(strlen(fullname) >( DOS_PATHLENGTH - 1) ) return false;
		char temp_name[DOS_PATHLENGTH+4],* temp_fullname;
		//try to add .com, .exe and .bat extensions to filename

		strcpy(temp_name,fullname);
		strcat(temp_name,".COM");
		temp_fullname=Which(temp_name);
		if (temp_fullname) { extension=".com";strcpy(fullname,temp_fullname); }

		else
		{
			strcpy(temp_name,fullname);
			strcat(temp_name,".EXE");
			temp_fullname=Which(temp_name);
		 	if (temp_fullname) { extension=".exe";strcpy(fullname,temp_fullname);}

			else
			{
				strcpy(temp_name,fullname);
				strcat(temp_name,".BAT");
				temp_fullname=Which(temp_name);
		 		if (temp_fullname) { extension=".bat";strcpy(fullname,temp_fullname);}

				else
				{
		 			return false;
				}

			}
		}
	}

	if (strcasecmp(extension, ".bat") == 0)
	{	/* Run the .bat file */
		/* delete old batch file if call is not active*/
		bool temp_echo=echo; /*keep the current echostate (as delete bf might change it )*/
		if(bf && !call) delete bf;
		bf=new BatchFile(this,fullname,name,line);
		echo=temp_echo; //restore it.
	}
	else
	{	/* only .bat .exe .com extensions maybe be executed by the shell */
		if(strcasecmp(extension, ".com") !=0)
		{
			if(strcasecmp(extension, ".exe") !=0) return false;
		}
		/* Run the .exe or .com file from the shell */
		/* Allocate some stack space for tables in physical memory */
		reg_sp-=0x200;
		//Add Parameter block
		DOS_ParamBlock block(SegPhys(ss)+reg_sp);
		block.Clear();
		//Add a filename
		RealPt file_name=RealMakeSeg(ss,reg_sp+0x20);
		MEM_BlockWrite(Real2Phys(file_name),fullname,(Bitu)(strlen(fullname)+1));

		/* HACK: Store full commandline for mount and imgmount */
		full_arguments.assign(line);

		/* Fill the command line */
		CommandTail cmdtail;
		cmdtail.count = 0;
		memset(&cmdtail.buffer,0,126); //Else some part of the string is unitialized (valgrind)
		if (strlen(line)>126) line[126]=0;
		cmdtail.count=(Bit8u)strlen(line);
		memcpy(cmdtail.buffer,line,strlen(line));
		cmdtail.buffer[strlen(line)]=0xd;
		/* Copy command line in stack block too */
		MEM_BlockWrite(SegPhys(ss)+reg_sp+0x100,&cmdtail,128);
		/* Parse FCB (first two parameters) and put them into the current DOS_PSP */
		Bit8u add;
		FCB_Parsename(dos.psp(),0x5C,0x00,cmdtail.buffer,&add);
		FCB_Parsename(dos.psp(),0x6C,0x00,&cmdtail.buffer[add],&add);
		block.exec.fcb1=RealMake(dos.psp(),0x5C);
		block.exec.fcb2=RealMake(dos.psp(),0x6C);
		/* Set the command line in the block and save it */
		block.exec.cmdtail=RealMakeSeg(ss,reg_sp+0x100);
		block.SaveData();
#if 0
		/* Save CS:IP to some point where i can return them from */
		Bit32u oldeip=reg_eip;
		Bit16u oldcs=SegValue(cs);
		RealPt newcsip=CALLBACK_RealPointer(call_shellstop);
		SegSet16(cs,RealSeg(newcsip));
		reg_ip=RealOff(newcsip);
#endif
		/* Start up a dos execute interrupt */
		reg_ax=0x4b00;
		//Filename pointer
		SegSet16(ds,SegValue(ss));
		reg_dx=RealOff(file_name);
		//Paramblock
		SegSet16(es,SegValue(ss));
		reg_bx=reg_sp;
		SETFLAGBIT(IF,false);
		CALLBACK_RunRealInt(0x21);
		/* Restore CS:IP and the stack */
		reg_sp+=0x200;
#if 0
		reg_eip=oldeip;
		SegSet16(cs,oldcs);
#endif
	}
	return true; //Executable started
}
コード例 #28
0
ファイル: AsmJsTypes.cpp プロジェクト: zrzppp/ChakraCore
    AsmJsVarType::AsmJsVarType() : which_(Which(-1))
    {

    }
コード例 #29
0
ファイル: AsmJsTypes.cpp プロジェクト: zrzppp/ChakraCore
    AsmJsRetType::AsmJsRetType() : which_(Which(-1))
    {

    }
コード例 #30
0
ファイル: Pub.cpp プロジェクト: swuecho/igblast
// Appends a label to "label"
bool CPub::GetLabel(string*        label,
                    ELabelType     type,
                    TLabelFlags    flags,
                    ELabelVersion  version) const
{
    static const char* s_PubTypes[14] = {
        "Unknown",
        "Generic",
        "Submit",
        "Medline",
        "MUID",
        "Article",
        "Journal",
        "Book",
        "Proceedings",
        "Patent",
        "PatID",
        "Manuscript",
        "Equiv",
        "PMID" };

    // Check that label exists
    if (!label) {
        return false;
    }

    // Get the index into the s_PubTypes array corresponding to pub type
    int idx = static_cast<int>(Which());
    idx = idx >= 0 && idx < 14 ? idx : 0;

    if (type == eType) {
        // Append pub type to label and return
        *label += s_PubTypes[idx];
        return true;
    }

    if (type == eBoth) {
        // Append pub type to label
        *label += string(s_PubTypes[idx]) + ": ";
    }

    switch (Which()) {
    case e_Muid:
        *label += "NLM" + NStr::IntToString(GetMuid());
        return true;
    case e_Pmid:
        *label += "PM" + NStr::IntToString(GetPmid().Get());
        return true;
    case e_Equiv:
        return GetEquiv().GetLabel(label, flags, version);
    case e_Medline:
        return GetMedline().GetLabel(label, flags, version);
    case e_Article:
        return GetArticle().GetLabel(label, flags, version);
    case e_Journal:
        return GetJournal().GetLabel(label, flags, version);
    case e_Book:
        return GetBook().GetLabel(label, flags, version);
    case e_Proc:
        return GetProc().GetLabel(label, flags, version);
    case e_Man:
        return GetMan().GetLabel(label, flags, version);
    case e_Sub:
        return GetSub().GetLabel(label, flags, version);
    case e_Patent:
        return GetPatent().GetLabel(label, flags, version);
    case e_Pat_id:
        return GetPat_id().GetLabel(label, flags, version);
    case e_Gen:
        return GetGen().GetLabel(label, flags, version);
    default:
        return false;
    }
}