Exemple #1
0
	void PushFront(Dynamic inValue)
	{
		hx::EnterGCFreeZone();
		AutoLock lock(mSemaphore);
		hx::ExitGCFreeZone();
		unshift(inValue);
		mSemaphore.QSet();
	}
Exemple #2
0
/**
 * Get the next character from input
 *
 * @return the next input character
 *
 * If there's nothing in buffer, blocks until input is received
 */
char getchar() {
	if (uart_index == 0) {
		setNeedChar;
		enterSleep();
	}
	char result = uart_buffer[0];
	unshift();
	return result;
}
T& unshift(T value)
{
 //unshift
 
 T& result=unshift();
 
 //set
 
 result=value;
 
 return result;
}
Exemple #4
0
int cli_unshift(StudentList ** sl, int* sl_length)
{
    // TODO: unshift to return status code
    Student *s, *tmp;
    tmp = newStudentCli(&s);
    if (tmp == 0L) {
        printf("please varify your input\n");
    }else{
        unshift(sl, s);
        ++*sl_length;
    }
    return 0;
}
Exemple #5
0
bool LinkedList<T>::add(int index, T _t) {
  if(index >= _size)
    return add(_t);
  if(index == 0)
    return unshift(_t);
  ListNode<T> *tmp = new ListNode<T>(),
    *_prev = getNode(index-1);
  tmp->data = _t;
  tmp->next = _prev->next;
  _prev->next = tmp;
  _size++;
  isCached = false;
  return true;
}
List init_list_stdin () {
    List stack;
    char string[255];
    int  data;

    stack = init_list();

    while (fgets (string, 254, stdin) != NULL) {
        data = atoi (string);
        if (data != 0) unshift (stack, data);
    }

    return stack;
}
/*
 * 解密
 *
 * @param key    密钥 { a, b }
 * @param src    待解密的字符串
 * @param dest   经过解密后的字符串
 */
char * decrypt(int* key, char* src, char* dest)
{
    char *pSrc  = src;
    char *pDest = dest;
    int  arr[2] = { modInverse(key[0], WIDTH), -key[1] };

    for (int i = 0; *pSrc; ++i, ++pSrc, ++pDest)
    {
        if (!isalpha(*pSrc))
            continue;

        *pDest = unshift(arr, toupper(*pSrc));
    }

    return dest;
}
Exemple #8
0
void LinkedList<Elem>::add(int index,Elem* e)
{
  if(index > size)
    push(e);
  else if(index==0)
    unshift(e);
  //traverse into the right spot
  int i;
  ListNode<Elem>* prevNode = NULL;
  ListNode<Elem>* currentNode = head;
  for(i=0;i<index;i++)
  {
    prevNode = currentNode;
    currentNode = currentNode->next;
  }
  //do pointer magic
  prevNode->next = new ListNode<Elem>(e,currentNode);
  size++;
}
Exemple #9
0
void TokenList::unshift(TokenList* list) {
  TokenListIterator* it = list->reverseIterator();
  while (it->hasPrevious())
    unshift(it->previous()->clone());
  delete it;
}