예제 #1
0
//stop homie
PUBLIC RETCODE HomieStop(hHOMIE homie, hGMAP map)
{
	CLEARFLAG(homie->status, HOMIE_MOVING);
	CLEARFLAG(homie->status, HOMIE_STUCK);

	//adjust to current tile
	hTILE tile = &CELL(map->tiles, homie->indY, homie->indX, map->indSizeX);

	//check if the tile is one of the arrows
	if(tile->type >= eTILE_ARROW_N && tile->type <= eTILE_ARROW_W)
	{ SETFLAG(homie->status, HOMIE_STUCK); OBJSetState(homie->obj, eHOMIESTATE_STAND); }
	//else if(tile->type == eTILE_FLOOR)
	//	OBJSetState(homie->obj, eHOMIESTATE_STAND);
	else if(tile->type == eTILE_GOAL && tile->homieType == homie->type)
		OBJSetState(homie->obj, eHOMIESTATE_CELEBRATE);
	else
		OBJSetState(homie->obj, eHOMIESTATE_STAND);
	
	float homieLoc[eMaxPt]; OBJGetLoc(homie->obj, homieLoc);
	float tileLoc[eMaxPt]; OBJGetLoc(tile->obj, tileLoc);
	
	OBJSetLoc(homie->obj, tileLoc[eX], homieLoc[eY], tileLoc[eZ]);

	SETFLAG(tile->status, TILE_OCCUPIED);

	return RETCODE_SUCCESS;
}
예제 #2
0
파일: fg.c 프로젝트: izissise/42sh
void	builtin_fg(t_cmd *cmd, UNSEDP t_fds *fd, t_sh *shell)
{
  int	pgid;
  int	i;
  int	nb;

  i = 0;
  nb = 0;
  if (shell->process_group == NULL || !shell->jobcontrol)
    return ;
  if (cmd->argv[1] != NULL)
    nb = my_getnbr(cmd->argv[1]) - 1;
  while ((shell->process_group[i] != NULL) && (i < nb))
    i++;
  if (shell->process_group[i] != NULL)
    {
      pgid = shell->process_group[i]->pid.pgid;
      if (pgid != -1)
        {
          SETFLAG(shell->process_group[i]->flags, FLAGPOS(FGRP_FORGROUND));
          SETFLAG(shell->process_group[i]->flags, FLAGPOS(FGRP_RUNNING));
          if (set_forground_pgrp(pgid) == -1)
            set_forground_pgrp(shell->pid.pgid);
          kill(-pgid, SIGCONT);
        }
    }
}
예제 #3
0
/////////////////////////////////////
// Name:	
// Purpose:	
// Output:	
// Return:	
/////////////////////////////////////
PUBLIC RETCODE OBJAddChild(hOBJ obj, hOBJ child, int parentJointInd, bool syncState)
{
	//remove child from it's refered list
	if(TESTFLAGS(child->status, OBJ_CHILD))
	{
		OBJDestroy(&child); //this will just subtract the child ref
		//OBJRemoveFromParent(child);
	}

	child->listRef->remove((unsigned int)child);

	obj->objNode->push_back((unsigned int)child);
	child->listRef = obj->objNode;

	OBJAddRef(child);

	//set flags
	SETFLAG(child->status, OBJ_CHILD);

	//set parent ID key
	child->parentKey = obj->key;

	//set parent joint
	child->parentJointInd = parentJointInd;

	if(syncState) //will the child synchronize state with parent?
	{
		SETFLAG(child->status, OBJ_SYNCSTATE);
		child->curState = obj->curState;
	}

	return RETCODE_SUCCESS;
}
예제 #4
0
파일: signal.c 프로젝트: Tastyep/42sh
void	sig_handler(int sig)
{
  t_sh	*shell;

  shell = get_sh_info(NULL);
  SETFLAG(shell->signal, FLAGPOS(sig));
  if (sig == SIGINT)
    {
      my_putstr("\n", 1, -1);
      my_putstr(shell->param.str_prompt, 1, -1);
      if (shell->param.fallback == 1)
        {
          if (shell->param.cmd != NULL)
            shell->param.cmd[0] = '\0';
          shell->param.pos = 0;
          refresh_view(&(shell->param));
          view(shell->param.cmd, &(shell->param));
        }
    }
  if (sig == SIGWINCH && shell->param.fallback == 1)
    clear_cmd(shell->param.cmd, &(shell->param));
  if ((sig == SIGHUP) || (sig == SIGTERM) || (sig == SIGQUIT))
    {
      SETFLAG(shell->beepbeepexit, FLAGPOS(EXIT_F_POS));
      close(0);
    }
  init_sig(&sig_handler);
}
예제 #5
0
파일: display.c 프로젝트: mingpen/OpenNT
/*** redraw - Mark a range of lines in file dirty
*
*  Marks a range of lines in a file as needing to be updated. Each window that
*  they occur in is marked.
*
* Input:
*  pFile	     = File handle containing dirty lines
*  linFirst, linLast = Range of lines to mark
*
* Output:
*  Returns nothing
*
*************************************************************************/
void
redraw (
    PFILE pFile,
    LINE  linFirst,
    LINE  linLast
    ) {

    LINE	  linFirstUpd, linLastUpd;
    REGISTER PINS pInsTmp;

    int                         iWinTmp;
    REGISTER struct windowType *pWinTmp;

	if (linFirst > linLast) {
	linFirstUpd = linLast;
	linLast     = linFirst;
	linFirst    = linFirstUpd;
    }

    for (iWinTmp = 0, pWinTmp = WinList; iWinTmp < cWin; iWinTmp++, pWinTmp++) {
        if (pWinTmp->pInstance) {
            if (pFile == pWinTmp->pInstance->pFile) {
                pInsTmp = pWinTmp->pInstance;
                linFirstUpd = WINYPOS(pWinTmp) + lmax (0L, linFirst-YWIN(pInsTmp)-1);
                linLastUpd  = WINYPOS(pWinTmp) + lmin ((long) (WINYSIZE(pWinTmp) - 1), linLast - YWIN(pInsTmp));
                while (linFirstUpd <= linLastUpd) {
                    SETFLAG (fChange[linFirstUpd++],FMODIFY);
                }
            }
        }
    }
	SETFLAG (fDisplay, RTEXT);
}
예제 #6
0
파일: display.c 프로젝트: mingpen/OpenNT
/*** makedirty
*
*
* Input:
*
* Output:
*
*************************************************************************/
void
makedirty (
    REGISTER PFILE pFileDirty
    ) {
    if (!TESTFLAG(FLAGS(pFileDirty),DIRTY)) {
        if (pFileDirty == pFileHead) {
            SETFLAG (fDisplay, RSTATUS);
        }
	SETFLAG (FLAGS(pFileDirty), DIRTY);
    }
}
예제 #7
0
파일: display.c 프로젝트: mingpen/OpenNT
/*** newscreen - Mark entire screen dirty
*
*  Forces entire screen to be redrawn.
*
* Input:
*  none
*
* Output:
*  Returns nothing
*
*************************************************************************/
void
newscreen (
    void
    ) {

	REGISTER int iLine = YSIZE;

	while (iLine--) {
		SETFLAG ( fChange[iLine], FMODIFY );
	}

	SETFLAG (fDisplay, RTEXT);
}
예제 #8
0
파일: z80.c 프로젝트: mattjeffery/libz80
static void doBIT (Z80Context* ctx, int b, byte val)
{
	if (val & (1 << b))
        RESFLAG(F_Z | F_PV);
    else
        SETFLAG(F_Z | F_PV);

    SETFLAG(F_H);
    RESFLAG(F_N);

    RESFLAG(F_S);
    if ((b == 7) && !GETFLAG(F_Z))
        SETFLAG(F_S);
}
예제 #9
0
//move homie
PUBLIC RETCODE HomieMove(hHOMIE homie, eDIR dir, hGMAP map)
{
	if(!TESTFLAGS(homie->status, HOMIE_MOVING) 
		&& !TESTFLAGS(homie->status, HOMIE_STUCK)
		&& !TESTFLAGS(homie->status, HOMIE_DEAD))
	{
		switch(dir)
		{
		case eDIR_SOUTH:
			OBJSetOrientation(homie->obj, 0, 0, GCFGGetHomieSpd());
			break;
		case eDIR_NORTH:
			OBJSetOrientation(homie->obj, 0, 0, -GCFGGetHomieSpd());
			break;
		case eDIR_EAST:
			OBJSetOrientation(homie->obj, -GCFGGetHomieSpd(), 0, 0);
			break;
		case eDIR_WEST:
			OBJSetOrientation(homie->obj, GCFGGetHomieSpd(), 0, 0);
			break;
		}

		OBJSetState(homie->obj, eHOMIESTATE_MOVE);
		SETFLAG(homie->status, HOMIE_MOVING);

		hTILE tile = &CELL(map->tiles, homie->indY, homie->indX, map->indSizeX);
		CLEARFLAG(tile->status, TILE_OCCUPIED);
	}

	return RETCODE_SUCCESS;
}
예제 #10
0
/////////////////////////////////////
// Name:	OBJPause
// Purpose:	pause / resume  object
//			(true)  (false)
// Output:	Obj flag is set
// Return:	none
/////////////////////////////////////
PUBLIC void OBJPause(hOBJ obj, bool bPause)
{
	if(bPause)
		SETFLAG(obj->status, OBJ_PAUSE);
	else
		CLEARFLAG(obj->status, OBJ_PAUSE);
}
예제 #11
0
/////////////////////////////////////
// Purpose:	enable/disable model
//			If disabled, model will
//			not perform collision
//			and will not be displayed
// Output:	model status set
// Return:	none
/////////////////////////////////////
void IgfxQBSP::ModelEnable(u32 modelInd, u8 bEnable)
{
    if(bEnable)
        CLEARFLAG(m_models[modelInd].status, QBSP_MODEL_FLAG_DISABLE);
    else
        SETFLAG(m_models[modelInd].status, QBSP_MODEL_FLAG_DISABLE);
}
예제 #12
0
파일: exec_process.c 프로젝트: Tastyep/42sh
int	exec_process(t_cmd *cmd, t_fds *fd, t_sh *shell,
                 int (*f)(char *cmd, char **argv, t_sh *shell))
{
  int	ret_exec;

  if ((cmd->pid.pid = check_perror("Fork", fork())) == 0)
    {
      if (cmd->pid.pgid != -1)
        {
          if (check_perror("Setpgid", setpgid(0, cmd->pid.pgid)) == -1)
            check_perror("Setpgid", setpgid(0, 0));
        }
      else
        check_perror("Setpgid", setpgid(0, 0));
      check_perror("Dup2", dup2(fd->stdin, 0));
      check_perror("Dup2", dup2(fd->stdout, 1));
      check_perror("Dup2", dup2(fd->stderr, 2));
      if ((ret_exec = f(cmd->cmd_fpath, cmd->argv, shell)) == -1)
        my_perror(cmd->cmd_fpath);
      my_exit(ret_exec);
      SETFLAG(shell->beepbeepexit, FLAGPOS(EXIT_FORK));
    }
  else if (cmd->pid.pid != -1)
    check_grp_set(cmd->pid.pid,
                  (cmd->pid.pgid == -1) ? cmd->pid.pid : cmd->pid.pgid);
  return (cmd->pid.pid);
}
예제 #13
0
파일: z80.c 프로젝트: mattjeffery/libz80
/** Puts a value in a flag */
static void valFlag(Z80Context* ctx, Z80Flags flag, int val)
{
	if (val)
		SETFLAG(flag);
	else
		RESFLAG(flag);
}
예제 #14
0
PUBLIC RETCODE OBJUpdateFrame(hOBJ obj)
{
	if(!TESTFLAGS(obj->status, OBJ_PAUSE))
	{
		if(obj->states)
		{
			//do the tick count
			if(TimerEllapse(&obj->ticker))
			{
				int & theFrame = obj->states[obj->curState].curFrame;
				theFrame++;

				if(/*theFrame < Sprite->States[Sprite->CurState].firstframe 
					||*/ theFrame > obj->states[obj->curState].endFrame)
				{
					if(TESTFLAGS(obj->status, OBJ_PAUSE_ON_END))
					{ SETFLAG(obj->status, OBJ_PAUSE); theFrame = obj->states[obj->curState].endFrame; }
					else
						theFrame = obj->states[obj->curState].startFrame;
				}

				obj->curMesh = obj->theMdl->frames[theFrame].frameMesh;
			}
		}

		for(LISTPTR::iterator i = obj->objNode->begin(); i != obj->objNode->end(); ++i)
			OBJUpdateFrame((hOBJ)(*i));
	}

	return RETCODE_SUCCESS;
}
예제 #15
0
/////////////////////////////////////
// Name:	LightEnableRender
// Purpose:	enable/disable lighting
// Output:	light enabled/disabled
// Return:	none
/////////////////////////////////////
void F_API LightEnableRender(u8 bYes)
{
	if(bYes) SETFLAG(g_FLAGS, GFX_LIGHTENABLE);
	else CLEARFLAG(g_FLAGS, GFX_LIGHTENABLE);

	g_p3DDevice->SetRenderState(D3DRS_LIGHTING,bYes);
}
예제 #16
0
/////////////////////////////////////
// Name:	
// Purpose:	
// Output:	
// Return:	
/////////////////////////////////////
PUBLIC void OBJPauseOnStateEnd(hOBJ obj, bool bPause)
{
	if(bPause)
		SETFLAG(obj->status, OBJ_PAUSE_ON_END);
	else
		CLEARFLAG(obj->status, OBJ_PAUSE_ON_END);
}
예제 #17
0
파일: rift.c 프로젝트: Fsmv/OpenHMD
static void set_coordinate_frame(rift_priv* priv, rift_coordinate_frame coordframe)
{
	priv->coordinate_frame = coordframe;

	// set the RIFT_SCF_SENSOR_COORDINATES in the sensor config to match whether coordframe is hmd or sensor
	SETFLAG(priv->sensor_config.flags, RIFT_SCF_SENSOR_COORDINATES, coordframe == RIFT_CF_SENSOR);

	// encode send the new config to the Rift 
	unsigned char buf[FEATURE_BUFFER_SIZE];
	int size = encode_sensor_config(buf, &priv->sensor_config);
	if(send_feature_report(priv, buf, size) == -1){
		ohmd_set_error(priv->base.ctx, "send_feature_report failed in set_coordinate frame");
		return;
	}

	// read the state again, set the hw_coordinate_frame to match what
	// the hardware actually is set to just incase it doesn't stick.
	size = get_feature_report(priv, RIFT_CMD_SENSOR_CONFIG, buf);
	if(size <= 0){
		LOGW("could not set coordinate frame");
		priv->hw_coordinate_frame = RIFT_CF_HMD;
		return;
	}

	decode_sensor_config(&priv->sensor_config, buf, size);
	priv->hw_coordinate_frame = (priv->sensor_config.flags & RIFT_SCF_SENSOR_COORDINATES) ? RIFT_CF_SENSOR : RIFT_CF_HMD;

	if(priv->hw_coordinate_frame != coordframe) {
		LOGW("coordinate frame didn't stick");
	}
}
예제 #18
0
/////////////////////////////////////
// Purpose:	enable/disable shadow
//			volume for given object
// Output:	set/clear shadow flag
// Return:	none
/////////////////////////////////////
void IgfxObject::EnableShadow(u8 bYes)
{
	if(bYes)
		SETFLAG(m_flag, OBJECT_SHADOW);
	else
		CLEARFLAG(m_flag, OBJECT_SHADOW);
}
예제 #19
0
/////////////////////////////////////
// Purpose:	enable/disable shadow
//			receiving
// Output:	set/clear shadow flag
// Return:	none
/////////////////////////////////////
void IgfxObject::ReceiveShadow(u8 bYes)
{
	if(bYes)
		CLEARFLAG(m_flag, OBJECT_NORECSHADOW);
	else
		SETFLAG(m_flag, OBJECT_NORECSHADOW);
}
예제 #20
0
파일: file.c 프로젝트: mingpen/OpenNT
/*  fSyncFile - Attempt to make logical file and physical file the same
 *
 *  When editing in a network or multi-tasking environment, we need to make
 *  sure that changes made underneath us are properly reflected to the
 *  user.  We do this by snapshotting the time-of-last-write and periodically
 *  comparing it with the version on disk.  When a mismatch is found, we
 *  prompt the user and give him the opportunity to reread the file
 *
 *  pFileLoc    file structure of interest
 *  fPrompt     TRUE => prompt user for permission to refresh, else just
 *              refresh.
 *
 *  returns     TRUE iff the logical file and the physical file are the same.
 */
flagType
fSyncFile (
    PFILE pFileLoc,
    flagType fPrompt
    ) {
    if (pFileLoc == NULL) {
        pFileLoc = pFileHead;
    }

    switch (FileStatus (pFileLoc, NULL)) {

    case FILECHANGED:
        if (!confirmx("%s has been changed.  Refresh? ", pFileLoc->pName)) {
            /* No, validate this edit session */
            SetModTime (pFileLoc);
            return FALSE;
        }

        FileRead (strcpy( buf, pFileLoc->pName ), pFileLoc, TRUE);
        RSETFLAG (FLAGS (pFileLoc), DIRTY);
        SETFLAG (fDisplay, RSTATUS);
        return TRUE;

    case FILEDELETED:
        domessage ("File has been deleted");
        break;

    default:
        break;

    }
    return TRUE;
}
예제 #21
0
static int pack_key2values(struct ddb_packed *pack,
                           const struct ddb_entry *keys,
                           const struct ddb_map *keys_map,
                           int unique_items)
{
    valueid_t *values = NULL;
    uint64_t values_size = 0;
    char *dbuf = NULL;
    uint64_t dbuf_size = 0;
    int i, ret = -1;
    uint32_t num = pack->head->num_keys;

    if (buffer_new_section(pack, num + 1))
        goto end;

    for (i = 0; i < num; i++){
        uintptr_t *ptr = ddb_map_lookup_str(keys_map, &keys[i]);
        uint64_t size, num_values;
        uint32_t num_written;
        int duplicates = 0;

        const struct ddb_deltalist *d = (const struct ddb_deltalist*)*ptr;
        if (ddb_deltalist_to_array(d, &num_values, &values, &values_size))
            goto end;

        if (num_values > UINT32_MAX)
            goto end;

        if (ddb_delta_encode(values,
                             (uint32_t)num_values,
                             &dbuf,
                             &dbuf_size,
                             &size,
                             &num_written,
                             &duplicates,
                             unique_items))
            goto end;

        pack->head->num_values += num_written;
        if (duplicates){
            SETFLAG(pack->head, F_MULTISET);
        }

        buffer_toc_mark(pack);
        if (buffer_write_data(pack, (const char*)&keys[i].length, 4))
            goto end;
        if (buffer_write_data(pack, keys[i].data, keys[i].length))
            goto end;
        if (buffer_write_data(pack, dbuf, size))
            goto end;
    }
    buffer_toc_mark(pack);
    ret = 0;
end:
    free(values);
    free(dbuf);
    return ret;
}
예제 #22
0
파일: exit.c 프로젝트: Tastyep/42sh
void	builtin_exit(t_cmd *cmd, UNSEDP t_fds *fd, t_sh *shell)
{
  if (cmd->argv[1] != NULL)
    shell->beepbeepexit = my_getnbr(cmd->argv[1]);
  else
    shell->beepbeepexit = 0;
  SETFLAG(shell->beepbeepexit, FLAGPOS(EXIT_F_POS));
  UNSETFLAG(shell->beepbeepexit, FLAGPOS(EXIT_FORK));
}
예제 #23
0
/////////////////////////////////////
// Name:	OBJDeactivate
// Purpose:	deactivates obj
// Output:	stuff happens
// Return:	none
/////////////////////////////////////
PUBLIC void OBJDeactivate(hOBJ obj)
{
	//remove object from previous list
	obj->listRef->remove((unsigned int)obj);

	//add object to deactivated object list
	g_OBJDEACTIVATELIST.insert(g_OBJDEACTIVATELIST.end(), (unsigned int)obj);
	obj->listRef = &g_OBJDEACTIVATELIST;

	SETFLAG(obj->status, OBJ_DEACTIVATE);
}
예제 #24
0
/**
 ******************************************************************************
 **
 **	Function Name		: LCD_WriteControl
 **
 **	Description			: Write a control instruction to the LCD
 **
 **	Passed Parameters	: data 
 **
 **	Modified Data		: None
 **
 **	Return Value		: None
 **
 ******************************************************************************
 */
static void LCD_WriteControl( uint8 line, uint8 data )
{
	uint8 localCount;
	uint8 com;

	LCD_BKLIT_ON;
	SETFLAG(LCD_BACKLIT_ON);
	BacklitTimeoutTimer = MS_TIMER + 30000;

	com = data;
	
	// RS=0, R/W=0, E=0
	LCD_RS_LOW;		LCD_RW_LOW;		
	
	if( line == 1 )	{		LCD_EN1_HIGH;		}
	else			{		LCD_EN2_HIGH;		}
	for( localCount=0; localCount<8; localCount++ )
	{
		if( com & 0x80 )
		{
			SET_PORT1_PIN_HIGH( LCD_DATA );
			SET_PORT1_PIN_HIGH( LCD_DATA );
			SET_PORT1_PIN_HIGH( LCD_DATA );
			SET_PORT1_PIN_HIGH( LCD_DATA );
		}
		else
		{
			SET_PORT1_PIN_LOW( LCD_DATA );
			SET_PORT1_PIN_LOW( LCD_DATA );
			SET_PORT1_PIN_LOW( LCD_DATA );
			SET_PORT1_PIN_LOW( LCD_DATA );
		}	
		
		LCD_CLK_LOW;	LCD_CLK_HIGH;
		com = com << 1;
	}
		
	// RS=0, R/W=0, E=1
	LCD_RS_LOW;	LCD_RW_LOW;
	if( line == 1 )	{		LCD_EN1_HIGH;		}
	else			{		LCD_EN2_HIGH;		}	
	Delay(5);
	// RS=0, R/W=0, E=0
	LCD_RS_LOW;	LCD_RW_LOW;
	if( line == 1 )	{		LCD_EN1_LOW;		}
	else			{		LCD_EN2_LOW;		}
	Delay(5);
	// RS=0, R/W=1, E=0*/
	LCD_RS_LOW;	LCD_RW_HIGH;
	if( line == 1)	{		LCD_EN1_LOW;		}
	else			{		LCD_EN2_LOW;		}
	Delay(5);
}
예제 #25
0
/////////////////////////////////////
// Name:	
// Purpose:	
// Output:	
// Return:	
/////////////////////////////////////
PUBLIC RETCODE OBJAddChild(hOBJ obj, hOBJ child, bool syncState)
{
	//remove child from it's refered list
	child->listRef->remove((unsigned int)child);

	obj->objNode->insert(obj->objNode->end(), (unsigned int)child);
	child->listRef = obj->objNode;

	OBJAddRef(child);

	//set flags
	SETFLAG(child->status, OBJ_CHILD);

	if(syncState) //will the child synchronize state with parent?
	{
		SETFLAG(child->status, OBJ_SYNCSTATE);
		child->curState = obj->curState;
	}

	return RETCODE_SUCCESS;
}
예제 #26
0
/********************************************************************
* parseServerMessage: parses the current message and 				*
* updates the values sent from the Server 							*
********************************************************************/
int parseServerMessage()
{
	// Message formatting:
	//  	<F=%d,H=%d,T=%d,P=%d,VS=%d><EOF>
	//  	Flow,Freq,Temp,Pres,State
	int id = 0;
	char valstr[32];
	memset(valstr, 0, sizeof(valstr));

	//strtok breaks up the message into tokens, delimited by commas
	char* token = strtok(messageFromServer, DELIMS);
	while(token != NULL)
	{
		if(strcmp(token, EOFSTR) != 0)
		{
			parseToken(token, &id, valstr);
			switch(id)
			{
				case ID_STATE: //Current VFD State
					update.VFDState  = atoi(valstr);
					// update flag
    				LOCK(&flagMutex);
    				SETFLAG(update.updateFlag, UPDATE_STATE);
    				UNLOCK(&flagMutex);
					break;
				case ID_DESIREDFLOW:
					update.desiredFlowRate = atof(valstr);
					// update flag
    				LOCK(&flagMutex);
					SETFLAG(update.updateFlag, UPDATE_FLOW);
    				UNLOCK(&flagMutex);
					break;
				default:
					printf("UNKNOWN TAG ENCOUNTERED, TOKEN: ""%s""\n", token);
			}
		}
		token = strtok(NULL, DELIMS);
	}
	return 1;
}
예제 #27
0
파일: display.c 프로젝트: mingpen/OpenNT
/*** SetScreen
*
* Purpose:
*   SetScreen () - Set up the editor's internal structures to match the screen
*   size described by ySize and xSize.	Set the hardware to the mode in
*   Zvideo.
*
* Input:
*
* Output:
*
*************************************************************************/
void
SetScreen (
    void
    ) {
    fChange = ZEROREALLOC (fChange, YSIZE * sizeof (*fChange));
    SETFLAG (fDisplay, RSTATUS);
    if (cWin == 1) {
	WINXSIZE(pWinCur) = XSIZE;
	WINYSIZE(pWinCur) = YSIZE;
    }
    newscreen ();
	// SetVideoState(Zvideo);
}
예제 #28
0
/********************************************************************
* updateFlowRate:													*
* determines whether to change the frequency on the VFD to 			*
* match the desired flow rate 										*
********************************************************************/
void updateFlowRate()
{
	float prevFreq = update.frequency;	// Save the previous frequency

	// Save off desired flow in case server updates while in this function
	// If this happens, it will be updated on the next pass
	float currentDesiredFlow = update.desiredFlowRate;

	// If desired flow was updated via server
	// start with frequency based on lookup table
	if(CHKFLAG(update.updateFlag, UPDATE_FLOW))
	{
		//TODO: Change/update LUT for how frequency is first determined
		update.frequency = currentDesiredFlow*(60/3.5); //TEMPORARY
		printf("Update Flow set, flow: %f, freq: %f\n", currentDesiredFlow, update.frequency);

		// clear update flow flag
		LOCK(&flagMutex);
		CLRFLAG(update.updateFlag, UPDATE_FLOW);
		UNLOCK(&flagMutex);
	}
	else //adjust flow rate based on how off it is from actual
	{
		// float difference = 0;
		// difference = data.flowRate - currentDesiredFlow;
		// if (difference > FLOW_THRESH || difference < -FLOW_THRESH)
		// {
		// 	//TODO: Change how frequency is calculated
		// 	update.frequency -=  (difference*10); //TEMPORARY

		// 	if (update.frequency > MAX_FREQ)
		// 	{
		// 		update.frequency = MAX_FREQ;
		// 		printf("frequency calculated above %d\n", MAX_FREQ);
		// 	}
		// 	else if (update.frequency < MIN_FREQ)
		// 	{
		// 		update.frequency = MIN_FREQ;
		// 		printf("frequency calculated below %d\n", MIN_FREQ);
		// 	}
		// }
	}

	// update flag if frequency changed
	if (prevFreq != update.frequency)
	{
		LOCK(&flagMutex);
		SETFLAG(update.updateFlag, UPDATE_FREQ);
		UNLOCK(&flagMutex);
	}
}
예제 #29
0
파일: mark.c 프로젝트: mingpen/OpenNT
/*** fFMtoPfile - Attach a FILEMARKS structure to a pFile.
*
* Purpose:
*
*   To attach some marks to a file.
*
* Input:
*   pFile   - File to get the marks
*   pfm     - The marks
*
* Output:
*
*   Returns TRUE if there were any marks, FALSE if not.
*
*************************************************************************/
flagType
fFMtoPfile (
    PFILE       pFile,
    FILEMARKS * pfm
    ) {

    SETFLAG (FLAGS(pFile), VALMARKS);

	if (pFile->vaMarks != NULL) {
		FREE(pFile->vaMarks);
		pFile->vaMarks = NULL;
    }
	return (flagType)((pFile->vaMarks = FMtoVM (pfm)) != NULL);
}
예제 #30
0
/////////////////////////////////////
// Name:	GFXEnableLight
// Purpose:	enable/disable light
//			also set ambient color
// Output:	light is enabled/disabled
// Return:	none
/////////////////////////////////////
PUBLIC void GFXEnableLight(bool do_you_want_light)
{
	//set light
	if(do_you_want_light)
	{
		g_p3DDevice->SetRenderState(D3DRS_LIGHTING,TRUE);
		CLEARFLAG(g_FLAGS, GFX_LIGHTDISABLE);
	}
	else
	{
		g_p3DDevice->SetRenderState(D3DRS_LIGHTING,FALSE);
		SETFLAG(g_FLAGS, GFX_LIGHTDISABLE);
	}
}