Пример #1
0
//#include <stdio.h>
void TEvent::getKeyEvent() {
  if ( TSystemError::ctrlBreakHit == Boolean(1) ) {
    _bios_keybrd(_KEYBRD_READ);
    TSystemError::ctrlBreakHit = Boolean(2);
  }
  if ( _bios_keybrd(_KEYBRD_READY) == 0 ) {
        what = evNothing;
  } else {
        what = evKeyDown;
        keyDown.keyCode = _bios_keybrd(_KEYBRD_READ);
//printf("keyCode=%04X\n",keyDown.keyCode);
    switch (     keyDown.charScan.scanCode ) {
      case scSpaceKey:
        if ( getShiftState() & kbAltShift )     keyDown.keyCode = kbAltSpace;
        break;
      case scInsKey:
        {
          unsigned char state = getShiftState();
          if ( state & kbCtrlShift )     keyDown.keyCode = kbCtrlIns;
          else if ( state & (kbLeftShift|kbRightShift) )     keyDown.keyCode = kbShiftIns;
        }
        break;
      case scDelKey:
        {
          unsigned char state = getShiftState();
          if ( state & kbCtrlShift )     keyDown.keyCode = kbCtrlDel;
          else if ( state & (kbLeftShift|kbRightShift) )     keyDown.keyCode = kbShiftDel;
        }
        break;
    }
  }
}
Пример #2
0
Boolean wrap(bool value) {
    if (value) {
        return Boolean(kCFBooleanTrue);
    } else {
        return Boolean(kCFBooleanFalse);
    }
}
Пример #3
0
void drive_get_misc_functions()
{

    try {
        // Get function tests
        CQLValue a1(Uint64(123));
        CQLValue a2(Sint64(-123));
        CQLValue a3(Real64(25.24));
        CQLValue a4(String("Hellow"));
        CQLValue a5(Boolean(true));

        String _date("20040811105625.000000-360");
        CIMDateTime date(_date);
        CQLValue a6(date);
        String _date1("20040811105626.000000-360");
        CIMDateTime date1(_date1);
        CQLValue a61(date1);

        String opStr("MyClass.z=true,y=1234,x=\"Hello World\"");
        CIMObjectPath op(opStr);
        CQLValue a7(op);

        const CIMName _cimName(String("CIM_OperatingSystem"));
        CIMInstance _i1(_cimName);

        CQLValue a8(_i1);

        PEGASUS_TEST_ASSERT(a1.getUint() == Uint64(123));
        PEGASUS_TEST_ASSERT(a2.getSint() == Sint64(-123));
        PEGASUS_TEST_ASSERT(a3.getReal() == Real64(25.24));
        PEGASUS_TEST_ASSERT(a4.getString() == String("Hellow"));
        PEGASUS_TEST_ASSERT(a5.getBool() == Boolean(true));
        PEGASUS_TEST_ASSERT(a6.getDateTime() == CIMDateTime(_date));
        PEGASUS_TEST_ASSERT(a6 != a61);
        PEGASUS_TEST_ASSERT(a6 < a61);
        PEGASUS_TEST_ASSERT(a7.getReference() ==
                            CIMObjectPath(opStr));

        try
        {
            a1.getSint();
            PEGASUS_TEST_ASSERT(0);
        }
        catch(...)
        {
            PEGASUS_TEST_ASSERT(1);
        }
    }
    catch(Exception & e)
    {
        cout << e.getMessage() << endl;
        PEGASUS_TEST_ASSERT(0);
    }

    return;
}
Boolean TInputLine::canScroll( int delta )
{
    if( delta < 0 )
        return Boolean( firstPos > 0 );
    else
        if( delta > 0 )
            return Boolean( strlen(data) - firstPos + 2 > size.x );
        else
            return False;
}
Пример #5
0
static int WindowHint(lua_State *L)
    {
    int target = checktarget(L, 1);
    switch(target)
        {
        case GLFW_RESIZABLE:
        case GLFW_VISIBLE:
        case GLFW_DECORATED:
        case GLFW_FOCUSED:
        case GLFW_AUTO_ICONIFY:
        case GLFW_FLOATING:
        case GLFW_MAXIMIZED:
        case GLFW_CENTER_CURSOR:
        case GLFW_TRANSPARENT_FRAMEBUFFER:
        case GLFW_HOVERED:
        case GLFW_FOCUS_ON_SHOW:
        case GLFW_SCALE_TO_MONITOR: return Boolean(L, target);
        case GLFW_RED_BITS:
        case GLFW_GREEN_BITS:
        case GLFW_BLUE_BITS:
        case GLFW_ALPHA_BITS:
        case GLFW_DEPTH_BITS:
        case GLFW_STENCIL_BITS:
        case GLFW_ACCUM_RED_BITS:
        case GLFW_ACCUM_GREEN_BITS:
        case GLFW_ACCUM_BLUE_BITS:
        case GLFW_ACCUM_ALPHA_BITS:
        case GLFW_AUX_BUFFERS:
        case GLFW_SAMPLES:
        case GLFW_REFRESH_RATE: return Integer(L, target);
        case GLFW_STEREO:
        case GLFW_SRGB_CAPABLE:
        case GLFW_DOUBLEBUFFER: return Boolean(L, target);
        case GLFW_CLIENT_API: ENUM(L, target, checkapi);
        case GLFW_CONTEXT_CREATION_API: ENUM(L, target, checkcontextcreationapi);
        case GLFW_CONTEXT_VERSION_MAJOR:
        case GLFW_CONTEXT_VERSION_MINOR: return Integer(L, target);
        case GLFW_CONTEXT_ROBUSTNESS: ENUM(L, target, checkrobustness);
        case GLFW_CONTEXT_RELEASE_BEHAVIOR: ENUM(L, target, checkreleasebehavior);
        case GLFW_OPENGL_FORWARD_COMPAT:
        case GLFW_OPENGL_DEBUG_CONTEXT: return Boolean(L, target);
        case GLFW_OPENGL_PROFILE: ENUM(L, target, checkprofile);
        case GLFW_X11_CLASS_NAME:
        case GLFW_X11_INSTANCE_NAME: return String(L, target);
        default:
            return luaL_error(L, "invalid target '%s'", lua_tostring(L, 1));
        }
    return 0;
    }
void TEditor::updateCommands()
{
    setCmdState( cmUndo, Boolean( delCount != 0 || insCount != 0 ) );
    if( isClipboard() == False )
        {
        setCmdState(cmCut, hasSelection());
        setCmdState(cmCopy, hasSelection());
        setCmdState(cmPaste,
                    Boolean(clipboard != 0 && (clipboard->hasSelection())) );
        }
    setCmdState(cmClear, hasSelection());
    setCmdState(cmFind, True);
    setCmdState(cmReplace, True);
    setCmdState(cmSearchAgain, True);
}
Пример #7
0
std::ostream& HQWrappedPictureIO(std::ostream& stream, const WrappedPicture& d) {
  std::ostringstream ss;
  ss.copyfmt(stream);

  // Picture Header
  ss << Bytes(4, d.picture_number);

  // Transform Params
  ss << vlc::unbounded
     << UnsignedVLC(d.wavelet_kernel)
     << UnsignedVLC(d.depth)
     << UnsignedVLC(d.slices_x)
     << UnsignedVLC(d.slices_y)
     << UnsignedVLC(d.slice_prefix)
     << UnsignedVLC(d.slice_size_scalar)
     << Boolean(false)
     << vlc::align;

  // Transform Data
  ss << d.slices;

  stream << ParseInfoIO(HQ_PICTURE, ss.str().size());

  return (stream << ss.str());
}
TMenu *TMenuView::readMenu( ipstream& is )
{
    TMenu *menu = new TMenu;
    TMenuItem **last = &(menu->items);
    TMenuItem *item = 0;
    uchar tok;
    is >> tok;
    while( tok != 0 )
        {
        assert( tok == 0xFF );
        item = new TMenuItem( 0, 0, (void *)0 );
        *last = item;
        last = &(item->next);
        item->name = is.readString();
        int temp;
        is >> item->command >> temp
           >> item->keyCode >> item->helpCtx;
        item->disabled = Boolean( temp );
        if( item->name != 0 )
            {
            if( item->command == 0 )
                item->subMenu = readMenu( is );
            else
                item->param = is.readString();
            }
        is >> tok;
        }
    *last = 0;
    menu->deflt = menu->items;
    return menu;
}
Пример #9
0
TNode *TOutline::readNode(ipstream &ip) {
   int nChildren;
   uchar more;
   uchar expand;

   TNode *node = new TNode((char *)0);

   ip >> more;
   ip >> expand;
   ip >> nChildren;
   node->text = ip.readString();
   node->expanded = Boolean(expand);

   if (nChildren)
      node->childList = readNode(ip);
   else
      node->childList = 0;

   if (more)
      node->next = readNode(ip);
   else
      node->next = 0;

   return node;
}
Пример #10
0
void TLabel::handleEvent( TEvent& event )
{
    TStaticText::handleEvent(event);
    if( event.what == evMouseDown )
        {
        if( link != 0 )
            link->select();
        clearEvent( event );
        }
    else if( event.what == evKeyDown )
        {
        char c = hotKey( text );
        if( getAltCode(c) == event.keyDown.keyCode ||
                ( c != 0 && owner->phase == TGroup::phPostProcess &&
                toupper(event.keyDown.charScan.charCode) ==  c )
          )
            {
            if (link != 0 )
                link->select();
            clearEvent( event );
            }
        }
    else if( event.what == evBroadcast &&
            ( event.message.command == cmReceivedFocus ||
              event.message.command == cmReleasedFocus )
           )
            {
            light = Boolean( (link->state & sfFocused) != 0 );
            drawView();
            }
}
Пример #11
0
int main(int argc, char** argv)
{

    try
    {
	const String NAMESPACE = "/ggg";

	SimpleDeclContext context;

	CIMClass x(CIMName ("X"));
	x.addProperty(CIMProperty(CIMName ("one"), Uint32(111)));
	x.addProperty(CIMProperty(CIMName ("two"), Real32(222.222)));
	x.addProperty(CIMProperty(CIMName ("three"), String("Three")));
	context.addClass(NAMESPACE, x);
	Resolver::resolveClass (x, &context, NAMESPACE);

	CIMClass y(CIMName ("Y"), CIMName ("X"));
	y.addProperty(CIMProperty(CIMName ("three"), String("Three - Three")));
	y.addProperty(CIMProperty(CIMName ("four"), Boolean(false)));
	y.addProperty(CIMProperty(CIMName ("five"), Real32(555.555)));
	context.addClass(NAMESPACE, y);
	Resolver::resolveClass (y, &context, NAMESPACE);

	// y.print();
    }
    catch (Exception& e)
    {
	cout << "Exception: " << e.getMessage() << endl;
    }

    cout << argv[0] << " +++++ passed all tests" << endl;

    return 0;
}
void *TEditor::read( ipstream& is )
{
    TView::read( is );
    int temp;
    is >> hScrollBar >> vScrollBar >> indicator
       >> bufSize >> temp;
    canUndo = Boolean(temp);
    selecting = False;
    overwrite = False;
    autoIndent = False; 
    lockCount = 0;
    keyState = 0;
    initBuffer();
    if( buffer != 0 )
        isValid = True;
    else
        {
        TEditor::editorDialog( edOutOfMemory, 0 );
        bufSize = 0;
        }
    lockCount = 0; 
    lock();
    setBufLen( 0 );
    return this;
}
Boolean TEditor::search( const char *findStr, ushort opts )
{
    ushort pos = curPtr;
    ushort i;
    do  {
        if( (opts & efCaseSensitive) != 0 )
            i = scan( &buffer[bufPtr(pos)], bufLen - pos, findStr);
        else
            i = iScan( &buffer[bufPtr(pos)], bufLen - pos, findStr);

        if( i != sfSearchFailed )
            {
            i += pos;
            if( (opts & efWholeWordsOnly) == 0 ||
                !(
                    ( i != 0 && isWordChar(bufChar(i - 1)) != 0 ) ||
                    ( i + strlen(findStr) != bufLen &&
                        isWordChar(bufChar(i + strlen(findStr)))
                    )
                 ))
                {
                lock();
                setSelect(i, i + strlen(findStr), False);
                trackCursor(Boolean(!cursorVisible()));
                unlock();
                return True;
                }
            else
                pos = i + 1;
            }
        } while( i != sfSearchFailed );
    return False;
}
Пример #14
0
void *TSortedCollection::read( ipstream& is )
{
    TCollection::read( is );
    int temp;
    is >> temp;
    duplicates = Boolean(temp);
    return this;
}
Boolean TMenuView::mouseInMenus( TEvent& e )
{
    TMenuView *p =  parentMenu;
    while( p != 0 && !p->mouseInView(e.mouse.where) )
        p = p->parentMenu;

    return Boolean( p != 0 );
}
Пример #16
0
Boolean driveValid(char drive) {
   drive = toupper(drive);
#ifdef __MSDOS__
   struct diskfree_t df;
   return Boolean(_dos_getdiskfree(drive-'@',&df) == 0);
#elif defined(__OS2__)
   FSALLOCATE a;
   return Boolean(!DosQueryFSInfo(drive - '@', FSIL_ALLOC, &a, sizeof(a)));
#elif defined(__NT__)
   DWORD mask = 0x01 << (drive - 'A');
   return (Boolean)(GetLogicalDrives() & mask);
#elif defined(__QSINIT__)
   return (Boolean)(io_ismounted(drive - 'A', 0));
#else
#error Unknown platform!
#endif
}
Пример #17
0
Boolean TTerminal::canInsert( ushort amount )
{
    long T = (queFront < queBack) ?
        ( queFront +  amount ) :
        ( long(queFront) - bufSize + amount);   // cast needed so we get
                                                // signed comparison
    return Boolean( queBack > T );
}
Пример #18
0
EXPR *StringEvaluate( expr_oper op, STRING *left, STRING *right )
    {
    if( right )
	{
	switch(op)
	    {
	    case OPER_CATENATE:
		unsigned int count ;
		char *string ;
		EXPR *result ;

		count = 1 + strlen( StringValue(left) ) + strlen( StringValue(right) ) ;
		string = new char[count] ;
		(void) strcpy( string, StringValue(left) ) ;
		(void) strcat( string, StringValue(right) ) ;
		result = String( string ) ;
		delete[] string ;
		return result ;

	    case OPER_EQ:
		return Boolean( !strcmp( StringValue(left), StringValue(right) ) ) ;
	    case OPER_NEQ:
		return Boolean( strcmp( StringValue(left), StringValue(right) ) ) ;

	    default:
		IOerror( IO_WARN, "StringEvaluate",
		    "passing string values to non-string operator" ) ;
		return NULL_EXPR ;
	    }
	}
    else
	{
	switch(op)
	    {
	    case OPER_SYMBOLIC:
		return ExprParseString( StringValue(left) ) ;

	    default:
		IOerror( IO_WARN, "StringEvaluate",
		    "passing string value to non-string operator" ) ;
		return NULL_EXPR ;
	    }
	}

    return NULL_EXPR ;					// never get here
    }
Пример #19
0
void *DynamicText::read( ipstream& is )
{
  int rj;
  TView::read( is );
  text = is.readString();
  is >> rj;
  rightJustify = Boolean( rj );
  return this;
}
Пример #20
0
Файл: String.c Проект: ptII/ptII
/*** String_equals() ***/
Token String_equals(Token thisToken, ...) {
    va_list argp;
    Token otherToken;
    va_start(argp, thisToken);
    otherToken = va_arg(argp, Token);

    va_end(argp);
    return $new(Boolean(!strcmp(thisToken.payload.String, otherToken.payload.String)));
}
Пример #21
0
Boolean isDir( const char *str )
{
    Boolean result;
    finddata ff;
    intptr_t fh = findfirst( str, &ff );
    result = Boolean( fh != -1 &&
                    (ff.attrib & FA_DIREC) != 0 );
    findclose(fh);
    return result;
}
Пример #22
0
Boolean TGroup::valid(ushort command) {
   if (command == cmReleasedFocus) {
      if (current && (current->options & ofValidate))
         return current->valid(command);
      else
         return True;
   }

   return Boolean(firstThat(isInvalid, &command) == 0);
}
Пример #23
0
void ScrollDialog::handleEvent(TEvent& event)
{
	if(event.what == evKeyDown &&
		(event.keyDown.keyCode == kbTab ||
			event.keyDown.keyCode == kbShiftTab))
		{
		scrollGroup->selectNext(Boolean(event.keyDown.keyCode == kbShiftTab));
		clearEvent(event);
		}
	TDialog::handleEvent(event);
}
Пример #24
0
bool CPLJSonStreamingParser::CheckAndEmitTrueFalseOrNull(char ch)
{
    State eCurState = currentState();

    if( eCurState == STATE_TRUE )
    {
        if( m_osToken == "true" )
        {
            Boolean(true);
        }
        else
        {
            return EmitUnexpectedChar(ch);
        }
    }
    else if( eCurState == STATE_FALSE)
    {
        if( m_osToken == "false" )
        {
            Boolean(false);
        }
        else
        {
            return EmitUnexpectedChar(ch);
        }
    }
    else /* if( eCurState == STATE_NULL ) */
    {
        if( m_osToken == "null" )
        {
            Null();
        }
        else
        {
            return EmitUnexpectedChar(ch);
        }
    }
    m_aState.pop_back();
    m_osToken.clear();
    return true;
}
Пример #25
0
void *TButton::read( ipstream& is )
{
    TView::read( is );
    title = is.readString();
    int temp;
    is >> command >> flags >> temp;
    amDefault = Boolean(temp);
    if( TButton::commandEnabled( command ) )
        state &= ~sfDisabled;
    else
        state |= sfDisabled;
    return this;
}
Пример #26
0
	Number Number::clone() const {
		switch (type()) {
			case NumberType::Integer:
				return Integer(toInteger());
			case NumberType::Double:
				return Double(toDouble());
			case NumberType::Float:
				return Float(toFloat());
			case NumberType::Boolean:
				return Boolean(toBoolean());
		}
		throw std::runtime_error(MakeString()<<"Could not clone number "<<toString());
	}
Boolean UNIX_ComputerSystem::getPowerManagementSupported() const
{
	bool result = false;
	size_t ret_len;
    if (sysctlbyname("hw.acpi.supported_sleep_state", NULL, &ret_len, NULL, 0) != -1)
    {
    	char ret[ret_len];
    	if (sysctlbyname("hw.acpi.supported_sleep_state", &ret, &ret_len, NULL, 0) != -1)
    	{
	    	result = strstr(ret, "S5") != NULL;
    	}
    }
	return Boolean(result);
}
Пример #28
0
char *TOutlineViewer::createGraph(int level, long lines, ushort flags,
                                  int levWidth, int endWidth,  const char *chars)
{
   static const int
   FillerOrBar      = 0,
   YorL          = 2,
   StraightOrTee = 4,
   retracted      = 6;

   char *graph = new char[level * levWidth + endWidth + 1];
   char *p;

   Boolean expanded = Boolean((flags & ovExpanded) != 0);
   Boolean children = Boolean((flags & ovChildren) != 0);
   Boolean last       = Boolean((flags & ovLast)       != 0);

   for (p = graph; level > 0; level--, lines >>= 1) {
      *p++ = (lines & 1) ? chars[FillerOrBar + 1] : chars[FillerOrBar];
      memset(p, chars[FillerOrBar], levWidth - 1);
      p += levWidth - 1;
   }

   if (--endWidth > 0) {
      *p++ = last ? chars[YorL + 1] : chars[YorL];
      if (--endWidth > 0) {
         if (--endWidth > 0) {
            memset(p, chars[StraightOrTee], endWidth);
            p += endWidth;
         }
         *p++ = children ? chars[StraightOrTee + 1] : chars[StraightOrTee];
      }
      *p++ = expanded ? chars[retracted + 1] : chars[retracted];
   }
   *p = 0;

   return graph;
}
Пример #29
0
TButton::TButton( const TRect& bounds,
                  const char *aTitle,
                  ushort aCommand,
                  ushort aFlags) :
    TView( bounds ),
    flags( aFlags ),
    amDefault( Boolean( (aFlags & bfDefault) != 0 ) ),
    title( newStr( aTitle ) ),
    command( aCommand )
{
    options |= ofSelectable | ofFirstClick | ofPreProcess | ofPostProcess;
    eventMask |= evBroadcast;
    if( !commandEnabled(aCommand) )
        state |= sfDisabled;
}
TMenuItem::TMenuItem( const char *aName,
                      ushort aKeyCode,
                      TMenu *aSubMenu,
                      ushort aHelpCtx,
                      TMenuItem *aNext
                    )
{
    name = newStr( aName );
    command = 0;
    disabled = Boolean(!TView::commandEnabled(command));
    keyCode = aKeyCode;
    helpCtx = aHelpCtx;
    subMenu = aSubMenu;
    next = aNext;
}