示例#1
0
文件: tags.c 项目: hackalog/mg
/* ARGSUSED */
int
poptag(int f, int n)
{
	struct line *dotp;
	struct tagpos *s;
	
	if (SLIST_EMPTY(&shead)) {
		dobeep();
		ewprintf("No previous location for find-tag invocation");
		return (FALSE);
	}
	s = SLIST_FIRST(&shead);
	SLIST_REMOVE_HEAD(&shead, entry);
	if (loadbuffer(s->bname) == FALSE)
		return (FALSE);
	curwp->w_dotline = s->dotline;
	curwp->w_doto = s->doto;
	
	/* storing of dotp in tagpos wouldn't work out in cases when
	 * that buffer is killed by user(dangling pointer). Explicitly
	 * traverse till dotline for correct handling. 
	 */
	dotp = curwp->w_bufp->b_headp;
	while (s->dotline--)
		dotp = dotp->l_fp;
	
	curwp->w_dotp = dotp;
	free(s->bname);
	free(s);
	return (TRUE);
}
int RecvTask(   int sockfd/* server's socket fd */  )
{
	/*int i,j;*/
        while(1) 
        {
            /*nRead = read(newFd, adNauseam, sizeof (adNauseam));
            if ( nRead < 0 )
            {
                perror ("read");
                close (sFd);
                return (ERROR);
	    }*/
        static int kk=0;
        kk++;
            semTake(SEM_DMA_Playback, WAIT_FOREVER);
           /* semTake(SEM_Sample, WAIT_FOREVER);*/
            loadbuffer(saved_samples, DAC_BUFFER_SIZE);
	    	if(DTC_DMA_Playback)
	    	{
	    		printf("\e[1;1H task0=%d     %d \n", kk);
                memmove(DAC_BUFFER+(DAC_BUFFER_SIZE/2),saved_samples/*adNauseam*/, (DAC_BUFFER_SIZE/2));
	    	}
            else
            {
            	printf("\e[1;40H task1=%d    [%d]  \n", kk );
                memmove(DAC_BUFFER,/*adNauseam*/saved_samples, (DAC_BUFFER_SIZE/2));
            }
	   

        } /* end while awaiting frames */
示例#3
0
文件: tags.c 项目: hackalog/mg
/*ARGSUSED */
int
pushtag(char *tok)
{
	struct ctag *res;
	struct tagpos *s;
	char bname[NFILEN];
	int doto, dotline;
	
	if ((res = searchtag(tok)) == NULL)
		return (FALSE);
		
	doto = curwp->w_doto;
	dotline = curwp->w_dotline;
	/* record absolute filenames. Fixes issues when mg's cwd is not the
	 * same as buffer's directory.
	 */
	if (strlcpy(bname, curbp->b_cwd, sizeof(bname)) >= sizeof(bname)) {
		dobeep();
		ewprintf("filename too long");
		return (FALSE);
	}
	if (strlcat(bname, curbp->b_bname, sizeof(bname)) >= sizeof(bname)) {
		dobeep();
		ewprintf("filename too long");
		return (FALSE);
	}	

	if (loadbuffer(res->fname) == FALSE)
		return (FALSE);
	
	if (searchpat(res->pat) == TRUE) {
		if ((s = malloc(sizeof(struct tagpos))) == NULL) {
			dobeep();
			ewprintf("Out of memory");
			return (FALSE);
		}
		if ((s->bname = strdup(bname)) == NULL) {
			dobeep();
			ewprintf("Out of memory");
			free(s);
			return (FALSE);
		}
		s->doto = doto;
		s->dotline = dotline;
		SLIST_INSERT_HEAD(&shead, s, entry);
		return (TRUE);
	} else {
		dobeep();
		ewprintf("%s: pattern not found", res->tag);
		return (FALSE);
	}
	/* NOTREACHED */
	return (FALSE);
}
示例#4
0
//! Main method.  Maybe abstract this a bit?
int main(int argc, char **argv){
  //Allocate the buffers.
  mallocbuffers();
  
  if(argc<3){
    printf("Usage: %s D002.032.img D013.014.img "
	   "<symbols_D002.032 >symbols_D013.014\n",
	   argv[0]);
    return 1;
  }
  
  //Load the source and destination buffers.
  loadbuffer(Src,argv[1]);
  loadbuffer(Dst,argv[2]);
  
  printf("/* Symbols for %s imported from %s. */\n",
	 argv[2],
	 argv[1]);
  
  parseloop();
}