/** * Called when the current state has finished and is ready to transition * into the next state */ void StateComplete(int state = -1) { _round->BeforeStateTransition(); Log tmp = _next_state_log; _next_state_log = Log(); if((_cycle_state == GetCurrentState()->GetState()) && (state == -1)) { qDebug() << "In" << _round->ToString() << "ending phase"; if(!_round->CycleComplete()) { return; } _log = Log(); IncrementPhase(); } if(state == -1) { qDebug() << "In" << _round->ToString() << "ending:" << StateToString(GetCurrentState()->GetState()) << "starting:" << StateToString(GetNextState()->GetState()); _current_sm_state = GetNextState(); } else { qDebug() << "In" << _round->ToString() << "ending:" << StateToString(GetCurrentState()->GetState()) << "starting:" << StateToString(_states[state]->GetState()); _current_sm_state = _states[state]; } (_round->*GetCurrentState()->GetTransitionCallback())(); for(int idx = 0; idx < tmp.Count(); idx++) { QPair<QByteArray, Id> entry = tmp.At(idx); ProcessData(entry.second, entry.first); } }
void UpdatePause(void) { while(pause) { StartFoxFrame(); AESysFrameStart(); PlayAudio(&BackgroundSnd); if(FoxInput_KeyTriggered(VK_ESCAPE)) { pause = FALSE; } if(GetNextState() == GS_Quit || GetNextState() == GS_Restart) { pause = FALSE; } DrawPause(); EventPause(); FoxInput_Update(); SaveSettings(); SetChannelGroupVolume(EffectType, SFXVolume); SetChannelGroupVolume(MusicType, BGMVolume); UpdateSoundSystem(); AESysFrameEnd(); EndFoxFrame(); } SaveSettings(); FreePause(); }
/* * * Retorna o proximo estado da maquina de estados * */ void PrintStateMachine(StateMachine* machine) { int i; for(i = 0; i < machine->numOfStates; i++) { int j; State* s = &(machine->states[i]); State* s1 = NULL; printf("State %d", i); if(machine->states[i].isAcceptionState) { printf(" -> accepting state! Returns %s", machine->states[i].name); } printf("\n"); printf("Accepts transitions with: "); for(j = 0; j < 128; j++) { s1 = GetNextState(machine, s, j); if(s1 != NULL) { printf("%c", j); } } printf("\n"); } }
/*! State Machine function */ void emberAfPluginSimpleCommissioningInitiatorStateMachineEventHandler(void) { emberEventControlSetInactive(StateMachineEvent); // That might happened that ZigBee state machine changed current network // So, it is important to switch to the proper network before commissioning // state machine might start EmberStatus status = emberAfPushNetworkIndex(dev_comm_session.network_index); if (status != EMBER_SUCCESS) { // TODO: Handle unavailability of switching network } emberAfDebugPrintln("DEBUG: State Machine"); // Get state previously set by some handler CommissioningState_t cur_state = GetNextState(); CommissioningEvent_t cur_event = GetNextEvent(); for (size_t i = 0; i < TRANSIT_TABLE_SIZE(); ++i) { if ((cur_state == sm_transition_table[i].state || SC_EZ_UNKNOWN == sm_transition_table[i].state) && ((cur_event == sm_transition_table[i].event) || SC_EZEV_UNKNOWN == sm_transition_table[i].event)) { // call handler which set the next_state on return and // next_event inside itself SetNextState((sm_transition_table[i].handler)()); break; } } // Don't forget to pop Network Index status = emberAfPopNetworkIndex(); // sanity check that network switched back properly EMBER_TEST_ASSERT(status == EMBER_SUCCESS); }
void CWeaponMagazined::OnMagazineEmpty() { //попытка стрелять когда нет патронов if (GetState() == eIdle) { OnEmptyClick(); return; } if (GetNextState() != eMagEmpty && GetNextState() != eReload) { SwitchState(eMagEmpty); } inherited::OnMagazineEmpty(); }
IZ_BOOL StateChangeView::OnKeyDown(izanagi::sys::E_KEYBOARD_BUTTON key) { if (!m_IsAnimating) { switch (key) { case izanagi::sys::E_KEYBOARD_BUTTON_UP: m_NextState = GetNextState(IZ_TRUE); break; case izanagi::sys::E_KEYBOARD_BUTTON_DOWN: m_NextState = GetNextState(IZ_FALSE); break; default: break; } } return IZ_TRUE; }
void RubiksCube::GetSuccessors(const RubiksState &nodeID, std::vector<RubiksState> &neighbors) const { neighbors.resize(18); for (int x = 0; x < 18; x++) { GetNextState(nodeID, x, neighbors[x]); } }
void CWeapon::UpdateCL () { inherited::UpdateCL (); UpdateHUDAddonsVisibility(); //подсветка от выстрела UpdateLight (); //нарисовать партиклы UpdateFlameParticles (); UpdateFlameParticles2 (); if(!IsGameTypeSingle()) make_Interpolation (); if( (GetNextState()==GetState()) && IsGameTypeSingle() && H_Parent()==Level().CurrentEntity()) { CActor* pActor = smart_cast<CActor*>(H_Parent()); if(pActor && !pActor->AnyMove() && this==pActor->inventory().ActiveItem()) { if (hud_adj_mode==0 && GetState()==eIdle && (Device.dwTimeGlobal-m_dw_curr_substate_time>20000) && !IsZoomed()&& g_player_hud->attached_item(1)==NULL) { if(AllowBore()) SwitchState (eBore); ResetSubStateTime (); } } } if(m_zoom_params.m_pNight_vision && !need_renderable()) { if(!m_zoom_params.m_pNight_vision->IsActive()) { CActor *pA = smart_cast<CActor *>(H_Parent()); R_ASSERT(pA); CTorch* pTorch = smart_cast<CTorch*>( pA->inventory().ItemFromSlot(TORCH_SLOT) ); if ( pTorch && pTorch->GetNightVisionStatus() ) { m_bRememberActorNVisnStatus = pTorch->GetNightVisionStatus(); pTorch->SwitchNightVision(false, false); } m_zoom_params.m_pNight_vision->Start(m_zoom_params.m_sUseZoomPostprocess, pA, false); } } else if(m_bRememberActorNVisnStatus) { m_bRememberActorNVisnStatus = false; EnableActorNVisnAfterZoom(); } if(m_zoom_params.m_pVision) m_zoom_params.m_pVision->Update(); }
void CWeaponMagazined::state_Fire(float dt) { VERIFY(fTimeToFire > 0.f); Fvector p1, d; p1.set(get_LastFP()); d.set(get_LastFD()); if (!H_Parent()) return; CInventoryOwner* io = smart_cast<CInventoryOwner*>(H_Parent()); if (NULL == io->inventory().ActiveItem()) { Log("current_state", GetState()); Log("next_state", GetNextState()); Log("state_time", m_dwStateTime); Log("item_sect", cNameSect().c_str()); Log("H_Parent", H_Parent()->cNameSect().c_str()); } smart_cast<CEntity*> (H_Parent())->g_fireParams(this, p1, d); if (m_iShotNum == 0) { m_vStartPos = p1; m_vStartDir = d; }; VERIFY(!m_magazine.empty()); // Msg("%d && %d && (%d || %d) && (%d || %d)", !m_magazine.empty(), fTime<=0, IsWorking(), m_bFireSingleShot, m_iQueueSize < 0, m_iShotNum < m_iQueueSize); while (!m_magazine.empty() && fTime <= 0 && (IsWorking() || m_bFireSingleShot) && (m_iQueueSize < 0 || m_iShotNum < m_iQueueSize)) { m_bFireSingleShot = false; VERIFY(fTimeToFire > 0.f); fTime += fTimeToFire; ++m_iShotNum; OnShot(); static int i = 0; if (i || m_iShotNum > m_iShootEffectorStart) { // Do Weapon Callback. (Cribbledirge) StateSwitchCallback(GameObject::eOnActorWeaponFire, GameObject::eOnNPCWeaponFire); FireTrace(p1, d); } else { FireTrace(m_vStartPos, m_vStartDir); } } if (m_iShotNum == m_iQueueSize) m_bStopedAfterQueueFired = true; UpdateSounds(); }
static CommissioningState_t UnknownState(void) { emberAfDebugPrintln("DEBUG: Unknown operation requested on stage 0x%X", GetNextState()); // don't want to do anything here, just clean up to the initial state // {EZ_STOP, EZEV_IDLE} SetNextEvent(SC_EZEV_IDLE); return SC_EZ_STOP; }
static CommissioningState_t StopCommissioning(void) { emberAfDebugPrintln("DEBUG: Stop commissioning"); emberAfDebugPrintln("Current state is 0x%X", GetNextState()); SetNextEvent(SC_EZEV_IDLE); // clean up globals ClearNetworkTries(); return SC_EZ_STOP; }
void FreeMainMenu(void) { //Keep the sound playing if were only going to the options menu if(GetNextState() != GS_Options) ReleaseSound(MenuBackSnd.Sound); // Freeing the objects and textures FreeAllLists(); }
/** * Erzeugt eine Zufallszahl. * * @param[in] max @p max-1 ist die maximale Zufallszahl welche geliefert werden soll. * * @return liefert eine Zufallszahl. * * @author OLiver */ int Random::Rand(const char* const src_name, const unsigned src_line, const unsigned obj_id, const int max) { rngState_ = GetNextState(rngState_, max); async_log[counter % async_log.size()] = RandomEntry(counter, max, rngState_, src_name, src_line, obj_id); ++counter; return GetValueFromState(rngState_, max); }
RubiksAction RubiksCube::GetAction(const RubiksState &s1, const RubiksState &s2) const { //std::vector<RubiksAction> succ; //GetActions(s1, succ); RubiksState tmp; for (int x = 0; x < 18; x++) { GetNextState(s1, x, tmp); if (tmp == s2) return x; } assert(false); return 0; }
void CWeaponMagazined::UpdateCL () { inherited::UpdateCL (); float dt = Device.fTimeDelta; //когда происходит апдейт состояния оружия //ничего другого не делать if(GetNextState() == GetState()) { switch (GetState()) { case eShowing: case eHiding: case eReload: case eIdle: fTime -= dt; if (fTime<0) fTime = 0; break; case eFire: if(iAmmoElapsed>0) state_Fire (dt); if(fTime<=0) { if(iAmmoElapsed == 0) OnMagazineEmpty(); StopShooting(); } else { fTime -= dt; } break; case eMisfire: state_Misfire (dt); break; case eMagEmpty: state_MagEmpty (dt); break; case eHidden: break; } } UpdateSounds (); }
IZ_BOOL StateChangeView::Enter( izanagi::IMemoryAllocator* allocator, izanagi::graph::CGraphicsDevice* device, izanagi::CValue& arg) { ChangeViewMode mode = (ChangeViewMode)arg.GetValueAsInt32(); if (mode == ChangeViewModeNone) { m_NextState = m_State; } else { m_NextState = GetNextState(mode == ChangeViewModeUp); } m_IsAnimating = IZ_FALSE; m_Timeline.Reset(); return IZ_TRUE; }
void AudioRendererImpl::InitAudioRendererFlow(bool result) { if (!result) { init_cb_(AUDIO_RENDERER_INIT_FAILED);; } AudioRendererSink::InitCB sub_object_init_cb = boost::bind(&AudioRendererImpl::InitAudioRendererFlow, this, _1); state_ = GetNextState(); switch (state_) { case STATE_INIT_DECODER: audio_frame_stream_->Initialize(demuxer_stream_, sub_object_init_cb); break; case STATE_INIT_SINKER: { AudioDecoderConfig audio_decoder_config = demuxer_stream_->audio_decoder_config(); InitAudioRenderSink(audio_decoder_config, sub_object_init_cb); } break; case STATE_PLAYING: init_cb_(PIPELINE_OK); break; default: return; } }
void DPSprite::SetState(FState *newstate, bool pending) { if (ID == PSP_WEAPON) { // A_WeaponReady will re-set these as needed Owner->WeaponState &= ~(WF_WEAPONREADY | WF_WEAPONREADYALT | WF_WEAPONBOBBING | WF_WEAPONSWITCHOK | WF_WEAPONRELOADOK | WF_WEAPONZOOMOK | WF_USER1OK | WF_USER2OK | WF_USER3OK | WF_USER4OK); } processPending = pending; do { if (newstate == nullptr) { // Object removed itself. Destroy(); return; } if (!(newstate->UseFlags & (SUF_OVERLAY|SUF_WEAPON))) // Weapon and overlay are mostly the same, the main difference is that weapon states restrict the self pointer to class Actor. { Printf(TEXTCOLOR_RED "State %s not flagged for use in overlays or weapons\n", FState::StaticGetStateName(newstate).GetChars()); State = nullptr; Destroy(); return; } else if (!(newstate->UseFlags & SUF_WEAPON)) { if (Caller->IsKindOf(NAME_Weapon)) { Printf(TEXTCOLOR_RED "State %s not flagged for use in weapons\n", FState::StaticGetStateName(newstate).GetChars()); State = nullptr; Destroy(); return; } } State = newstate; if (newstate->sprite != SPR_FIXED) { // okay to change sprite and/or frame if (!newstate->GetSameFrame()) { // okay to change frame Frame = newstate->GetFrame(); } if (newstate->sprite != SPR_NOCHANGE) { // okay to change sprite Sprite = newstate->sprite; } } Tics = newstate->GetTics(); // could be 0 if (Flags & PSPF_CVARFAST) { if (sv_fastweapons == 2 && ID == PSP_WEAPON) Tics = newstate->ActionFunc == nullptr ? 0 : 1; else if (sv_fastweapons == 3) Tics = (newstate->GetTics() != 0); else if (sv_fastweapons) Tics = 1; // great for producing decals :) } if (ID != PSP_FLASH) { // It's still possible to set the flash layer's offsets with the action function. // Anything going through here cannot be reliably interpolated so this has to reset the interpolation coordinates if it changes the values. if (newstate->GetMisc1()) { // Set coordinates. oldx = x = newstate->GetMisc1(); } if (newstate->GetMisc2()) { oldy = y = newstate->GetMisc2(); } } if (Owner->mo != nullptr) { FState *nextstate; FStateParamInfo stp = { newstate, STATE_Psprite, ID }; if (newstate->ActionFunc != nullptr && newstate->ActionFunc->Unsafe) { // If an unsafe function (i.e. one that accesses user variables) is being detected, print a warning once and remove the bogus function. We may not call it because that would inevitably crash. Printf(TEXTCOLOR_RED "Unsafe state call in state %sd to %s which accesses user variables. The action function has been removed from this state\n", FState::StaticGetStateName(newstate).GetChars(), newstate->ActionFunc->PrintableName.GetChars()); newstate->ActionFunc = nullptr; } if (newstate->CallAction(Owner->mo, Caller, &stp, &nextstate)) { // It's possible this call resulted in this very layer being replaced. if (ObjectFlags & OF_EuthanizeMe) { return; } if (nextstate != nullptr) { newstate = nextstate; Tics = 0; continue; } if (State == nullptr) { Destroy(); return; } } } newstate = State->GetNextState(); } while (!Tics); // An initial state of 0 could cycle through. return; }
CommissioningState_t CommissioningStateMachineStatus(void) { return GetNextState(); }
/********************************************************************* * Function: FormatManPage * * FormatManPage is the top entry point for formating man pages * into a form understood by a display area. * *********************************************************************/ static int FormatManPage( VarHandle my_vars, BufFilePtr in_file, char *in_buf, int in_size, _DtHelpFontHints *font_attr, char **out_buf, int *out_size, int *out_max ) { int italicCnt = 0; int result = 0; int cread; int lastLen; int checkLen; int retWCLen; wchar_t lastWC; wchar_t retWC; char *rloc = in_buf; char *retStrPtr; char c; char retC; Boolean flag = False; enum State newState; enum State state = Char; cread = strlen (rloc); do { /* * while I can read information process; loop. */ while (result != -1 && cread > 0) { /** * check for the size of the character **/ checkLen = mblen(rloc, MB_CUR_MAX); /* * if we hit a null character before we've run out of characters, * we've got corrupt data. */ if (checkLen == 0) return -1; if (checkLen > 0) { /* * check for end of line */ if (checkLen == 1 && *rloc == '\n') { cread--; if (state == Bold || state == Italic) result = WriteToken(EndToken, EndTokenSize, out_buf, out_size, out_max); if (result != -1) result = _DtHelpCeAddCharToBuf (&rloc, out_buf, out_size, out_max, 128); if (result != -1) { result = __DtHelpCeProcessString( my_vars, NULL, _DtCvLITERAL, ScanString, *out_buf, *out_size, 0, False, font_attr); *out_size = 0; (*out_buf)[0] = '\0'; state = Char; } } else { switch (state) { case Char: case BoldDone: case BoldItalicDone: /* * get the character and wide character * representation of the next character. */ c = *rloc; lastLen = mbtowc (&lastWC, rloc, MB_CUR_MAX); /* * skip past this character. */ rloc = rloc + lastLen; cread = cread - lastLen; /* * Check ahead for bold or italic sequences */ newState = GetNextState (c, lastWC, lastLen, rloc, &retC, &retWC, &retWCLen, &retStrPtr, &flag); if (newState == Bold) { if (state == BoldDone) RemoveToken(EndTokenSize, out_buf, out_size); else result = WriteToken(BoldToken, BoldTokenSize, out_buf, out_size, out_max); /* * skip the backspaces and the extra * copy of the character. */ cread = cread - (retStrPtr - rloc); rloc = retStrPtr; } else if (newState == Italic) { if (state != BoldItalicDone) result = WriteToken(ItalicToken, ItalicTokenSize, out_buf, out_size, out_max); /* * skip the blanks after the current * character plus the character after * that. The returned wide character * is the character that is to be * italicized. */ cread = cread - (retStrPtr - rloc); rloc = retStrPtr; c = retC; lastWC = retWC; lastLen = retWCLen; italicCnt = 1; if (state == BoldItalicDone && GetNextState (c, lastWC, lastLen, rloc, &retC, &retWC, &retWCLen, &retStrPtr, &flag) == Bold) { RemoveToken(EndTokenSize, out_buf, out_size); newState = BoldItalic; } } else if (state == BoldItalicDone) result = WriteToken(EndToken, EndTokenSize, out_buf, out_size, out_max); state = newState; result = WriteOutChar(lastLen, lastWC, c, out_buf, out_size, out_max, flag); break; case BoldItalic: case Bold: if (GetNextState (c, lastWC, lastLen, rloc, &retC, &retWC, &retWCLen, &retStrPtr, &flag) == Bold) { /* skip backspaces and copy characters */ cread = cread - (retStrPtr - rloc); rloc = retStrPtr; } else { result = WriteToken(EndToken, EndTokenSize, out_buf, out_size, out_max); if (state == BoldItalic) state = BoldItalicDone; else state = BoldDone; } break; case Italic: c = *rloc; newState = GetNextState (c, lastWC, lastLen, rloc, &retC, &retWC, &retWCLen, &retStrPtr, &flag); if (newState == Italic) { italicCnt++; cread = cread - (retStrPtr - rloc); rloc = retStrPtr; c = retC; lastWC = retWC; lastLen = retWCLen; result = WriteOutChar(lastLen, lastWC, c, out_buf, out_size, out_max, flag); } else if (italicCnt == 1 && lastWC == retWC && newState == Bold) { RemoveToken(lastLen, out_buf, out_size); result = WriteToken(BoldToken, BoldTokenSize, out_buf, out_size, out_max); cread = cread - (retStrPtr - rloc); rloc = retStrPtr; c = retC; lastWC = retWC; lastLen = retWCLen; result = WriteOutChar(lastLen, lastWC, c, out_buf, out_size, out_max, flag); state = BoldItalic; } else { result = WriteToken(EndToken, EndTokenSize, out_buf, out_size, out_max); state = Char; italicCnt = 0; } break; } } if (cread < (3 * ((int) MB_CUR_MAX)) && !feof (FileStream(in_file))) cread = 0; } else { /** * if it is an invalid character - skip. * But be careful. * If this is the start of a multi-byte character, * I must save it and try again on the next read. **/ if (cread < ((int) MB_CUR_MAX)) cread = 0; else { /* * otherwise we've got corrupt data. */ return -1; } } } if (result != -1 && !feof(FileStream(in_file))) { if (_DtHelpCeGetNxtBuf (in_file, in_buf, &rloc, in_size) == -1) result = -1; if (result != -1) cread = strlen (rloc); } } while (result != -1 && cread > 0); return(result); } /* End FormatManPage */
void CWeaponMagazinedWGrenade::LaunchGrenade() { if(!getRocketCount()) return; R_ASSERT (m_bGrenadeMode); { Fvector p1, d; p1.set (get_LastFP2()); d.set (get_LastFD()); CEntity* E = smart_cast<CEntity*>(H_Parent()); if (E){ CInventoryOwner* io = smart_cast<CInventoryOwner*>(H_Parent()); if(NULL == io->inventory().ActiveItem()) { Log("current_state", GetState() ); Log("next_state", GetNextState()); Log("item_sect", cNameSect().c_str()); Log("H_Parent", H_Parent()->cNameSect().c_str()); } E->g_fireParams (this, p1,d); } if (IsGameTypeSingle()) p1.set (get_LastFP2()); Fmatrix launch_matrix; launch_matrix.identity (); launch_matrix.k.set (d); Fvector::generate_orthonormal_basis(launch_matrix.k, launch_matrix.j, launch_matrix.i); launch_matrix.c.set (p1); if(IsZoomed() && smart_cast<CActor*>(H_Parent())) { H_Parent()->setEnabled (FALSE); setEnabled (FALSE); collide::rq_result RQ; BOOL HasPick = Level().ObjectSpace.RayPick(p1, d, 300.0f, collide::rqtStatic, RQ, this); setEnabled (TRUE); H_Parent()->setEnabled (TRUE); if(HasPick) { Fvector Transference; Transference.mul (d, RQ.range); Fvector res[2]; #ifdef DEBUG //. DBG_OpenCashedDraw(); //. DBG_DrawLine(p1,Fvector().add(p1,d),D3DCOLOR_XRGB(255,0,0)); #endif u8 canfire0 = TransferenceAndThrowVelToThrowDir(Transference, CRocketLauncher::m_fLaunchSpeed, EffectiveGravity(), res); #ifdef DEBUG //. if(canfire0>0)DBG_DrawLine(p1,Fvector().add(p1,res[0]),D3DCOLOR_XRGB(0,255,0)); //. if(canfire0>1)DBG_DrawLine(p1,Fvector().add(p1,res[1]),D3DCOLOR_XRGB(0,0,255)); //. DBG_ClosedCashedDraw(30000); #endif if (canfire0 != 0) { d = res[0]; }; } }; d.normalize (); d.mul (CRocketLauncher::m_fLaunchSpeed); VERIFY2 (_valid(launch_matrix),"CWeaponMagazinedWGrenade::SwitchState. Invalid launch_matrix!"); CRocketLauncher::LaunchRocket (launch_matrix, d, zero_vel); CExplosiveRocket* pGrenade = smart_cast<CExplosiveRocket*>(getCurrentRocket()); VERIFY (pGrenade); pGrenade->SetInitiator (H_Parent()->ID()); if (Local() && OnServer()) { VERIFY (m_magazine.size()); m_magazine.pop_back (); --iAmmoElapsed; VERIFY((u32)iAmmoElapsed == m_magazine.size()); NET_Packet P; u_EventGen (P,GE_LAUNCH_ROCKET,ID()); P.w_u16 (getCurrentRocket()->ID()); u_EventSend (P); }; } }
/* * * Retorna o token * */ Token* getToken() { Token* token; char* buffer; token = (Token*) malloc(sizeof(Token)); buffer = (char*) malloc(sizeof(char)); buffer[0] = '\0'; // We start the machine State* current_state; State* next_state; current_state = NULL; next_state = getFirstState(STATEMACHINE); // We iterate while the next_state isn't NULL int token_noted = 0; while(next_state != NULL) { // We get the next state current_state = next_state; if(CURRENT_CHAR != EOF) { next_state = GetNextState(STATEMACHINE, current_state, CURRENT_CHAR); } else { next_state = NULL; } // If the next state is NULL, the state machine has finished reading the string if(next_state != NULL) { // We write the contents on the buffer: // If it is in a ignoring state, ignore the buffer (commentary and blank characters if(!(next_state->isIgnoringState)) { // Append the char to the buffer append_char(&buffer, CURRENT_CHAR); // Write the first line and column of the token, if it wasn't if(!token_noted) { token->line = LINE; token->column = COLUMN; token_noted = 1; } } // We get the next char LAST_CHAR = CURRENT_CHAR; CURRENT_CHAR = fgetc(SOURCE_CODE); update_line_column(); } } // We complete the token using the information from the state where we are if(current_state != NULL && !(current_state->isIgnoringState)) // If the current state is not null and not a ignoring state { token->tokenClass = get_class(current_state->name, buffer); token->value = (char*) malloc((strlen(buffer) + 1) * sizeof(char)); strcpy(token->value, buffer); } else { if(CURRENT_CHAR == EOF) { FILE_ENDED = 1; token->tokenClass = EOA; token->value = NULL; } else { token->tokenClass = ERR; token->value = (char*) malloc((strlen(buffer) + 1) * sizeof(char)); strcpy(token->value, buffer); token->line = LINE; token->column = COLUMN; } } return token; }