Exemple #1
0
/* **************************************** */
SHORT  prompt_go_line (void)
{
static long line= 1;
struct sheet *sh= (struct sheet *)Mem::vmem_trans (active_sheet);
ULONG max_row= sh->line_count;

if (prompt_long ("Goto line:",&line,1,(long)max_row, 0)) {
   view_gotoline (line-1);
   view_gohome();
   }
}
void find_node_local(){
   uint16_t node_key;
   node_ptr search_result;
   node_key = prompt_long("which node do you wish to find:");
   search_result = (node_ptr)find_node(node_key);
   if(search_result == NULL)
      printf("Node [ %l ] not found.\n",node_key);
   else
      printf("Node [ %l ] was found.\n",node_key);
      
}
void del_node(){
   uint16_t key_to_delete;
   uint8_t result;
   key_to_delete=prompt_long("key to remove: ");
   result = delete(key_to_delete);
   if(result == TREE_NODE_NOT_FOUND){
      printf("node [%d] not found.\n",key_to_delete);
   }
   else if(result == TREE_OK){
      printf("node [%d] properly deleted.\n",key_to_delete);
   }
}
void fill_seq(){
   uint16_t min;
   uint16_t max;
   uint16_t counter;
   uint8_t keep_asking=true;
   uint8_t result;
   if(keep_asking){
      min=prompt_long("minimum value to start from:");
      max=prompt_long("maximum value to insert to:");
      if(min <= max) keep_asking=false;
   }

   for(counter=min;counter<=max;counter++)
   {
      result = insert(counter);
      if(result == TREE_OUT_OF_MEM)      {
	 printf("Not enough memory.\n");
	 break;
      }
      else if(result== TREE_OK)
	 printf("node %d properly added.\n",counter);
   }
}
static void set_cb ()
{
   uint32_t addr;
   uint32_t size;
   uint8_t reprogram;
   
   printf ("Start address? ");
   addr = prompt_longlong ("#:");
   printf ("Image size? ");
   size = prompt_longlong ("#:");
   printf ("Reprogram? ");

   reprogram = prompt_long ("#:");
   boot_control_block_t cb;
   cb.node_id = mos_node_id_get ();
   cb.byte_count = size;
   cb.start_addr = addr;
   cb.reprogram = reprogram;
   dev_ioctl (DEV_AVR_EEPROM, DEV_SEEK, CONTROL_BLOCK_ADDR);
   dev_write (DEV_AVR_EEPROM, (uint8_t *)&cb, CONTROL_BLOCK_SIZE);
}
void splay_node_local(){
   uint16_t node_key;
   node_key = prompt_long("which node do you want to splay:");
   splay_node(node_key);
}
void add_node(){
   uint16_t new_node_key;
   new_node_key = prompt_long("new node's key:");
   add_num(new_node_key);
   
}