VOID Style(PSPAWNINFO pChar, PCHAR szLine) { if (!szLine || !szLine[0]) { char out[256] = { 0 }; sprintf_s(out,"Style 0x%X",MQChatWnd->WindowStyle); WriteChatColor(out); return; } if (szLine[0]=='!') { int TurnOff = 0; if(sscanf_s(&szLine[1],"%x",&TurnOff)) { //well we set it anyway i guess... } BitOff(MQChatWnd->WindowStyle, TurnOff); } else { int TurnOn = 0; if(sscanf_s(&szLine[0],"%x",&TurnOn)) { //hmm can error handle i guess } BitOn(MQChatWnd->WindowStyle,TurnOn); } char out[256]; sprintf_s(out,"Style 0x%X",MQChatWnd->WindowStyle); WriteChatColor(out); }
int main(void) { char array[64]; memset(array, '\0', sizeof(array)); BitOn(array, 5); BitOn(array, 12); BitOn(array, 500); if (IsBit(array, 5) && IsBit(array, 12) && IsBit(array, 500)) puts("These functions seem to work!"); else puts("Something's broken here!"); BitFlip(array, 12); BitOff(array, 5); if (!IsBit(array, 5) && !IsBit(array, 12) && IsBit(array, 500)) puts("These functions still seem to work!"); else puts("Something's broken here!"); return 0; }
sym_id CkAssignOk( void ) { //============================ // Check if operand is allowed to be assigned a value. sym_id sym; switch( CITNode->opn.us & USOPN_WHAT ) { case USOPN_NNL: case USOPN_ASS: case USOPN_NWL: case USOPN_ARR: if( ClassIs( SY_VARIABLE ) ) { if( BitOn( SY_DO_PARM ) ) { Error( DO_PARM_REDEFINED ); return( NULL ); } sym = CITNode->sym_ptr; // Consider: READ *, CH(I:J) // GFiniSS() sets the symbol table entry in the I.T. node // to the temporary SCB so we need to get the actual symbol // we are substringing elsewhere if( CITNode->opn.us & USOPN_ASY ) { sym = CITNode->value.st.ss_id; } sym->u.ns.u1.s.xflags |= SY_DEFINED; return( sym ); } else { ClassErr( EQ_CANNOT_ASSIGN, CITNode->sym_ptr ); return( NULL ); } break; default: Error( EQ_BAD_TARGET ); return( NULL ); } }
ba->alloc = size; ba->length = size * CHAR_BIT; ba->data = g_new(guchar, ba->alloc); fread(ba->data, sizeof(guchar), size, fp); return ba; } void BitArray_append_bit(BitArray *ba, gboolean bit){ register gint64 word = ba->length / CHAR_BIT, pos = ba->length & (CHAR_BIT-1); if(ba->length == (ba->alloc*CHAR_BIT)){ ba->alloc <<= 1; ba->data = g_realloc(ba->data, ba->alloc); memset(ba->data+(ba->alloc>>1), 0, (ba->alloc>>1)); } ba->data[word] = bit?BitOn(ba->data[word], pos) :BitOff(ba->data[word], pos); ba->length++; return; } void BitArray_append(BitArray *ba, guint64 data, guchar width){ register gint64 word = ba->length/ CHAR_BIT, input; register guchar todo = width, bit = ba->length & (CHAR_BIT-1), taken = CHAR_BIT-bit, done = 0; ba->length += width; if(ba->length >= (ba->alloc*CHAR_BIT)){ ba->alloc <<= 1; ba->data = g_realloc(ba->data, ba->alloc);