Exemple #1
0
// Main
// =================================================================================================
int main (int argc, char* argv[]) {
  void* (*routine)(void*) = drink_lots_lock_block;
  // void* (*routine)(void*) = drink_lots_lock_each;
  pthread_t threads[20];

  beer();
  
  int ts;
  for (ts = 0; ts < 20; ts++) {
    if (pthread_create(&threads[ts], NULL, routine, NULL) == -1) {
      error("スレッド作成失敗");
    }
  }

  void* result;
  for (ts = 0; ts < 20; ts++) {
    if (pthread_join(threads[ts], &result) == -1) {
      error("スレッドt1ジョイン失敗");
    }
  }

  beer();
  
  return 0;
}
Exemple #2
0
void handle_input(uint8 type) 
{
	/* check click times */	
	if (ClickNum > MAX_INPUT) {
		if (type != LETTER || type != WORD)
			reset_buff();
		beer(WARN);
		return;
	}

	if (type == DOT || type ==DASH) {
		beer(type);

		/* the ascii of '\0' is equal to number zero 
	   	   it may cause some trouble */
		buff[ClickNum++] = type + 1; 

		return;
	}

	if (type == LETTER || type == WORD) {
		buff[ClickNum] = '\0';

		/* decoding*/
		for (p = &letter_a;p != NULL;p = p->next) {
			if (strcmp(buff,p->morse_mask) == 0) {
			
				/* send */	
				uart_send_byte(p->output);
				if (type == WORD) uart_send_byte(SPACE);
				reset_buff();
				return;
			}	
		}

		/* not match */
		reset_buff();
		beer(WARN);
	}
}
Exemple #3
0
int main()
{
        int x;
        int batch;

//recipe list
        printf(" What do you want to craft?\n");
        printf(" Beginner recipes:\n");
        printf(" 1. Aloe Cookie\n");
        printf(" 2. Aloe Yogurt\n");
        printf(" 3. Beer\n");
        printf(" 4. Boiled Bird Eggs\n");
        printf(" 5. Dressing\n");
        printf(" 6. Essence of Liquor\n");
        printf(" 7. Exotic Herbal Wine\n");
        printf(" 8. Fried Fish\n");
        printf(" 9. Fried Vegetables\n");
        printf(" 10. Fruit Juice\n");
        printf(" 11. Fruit Pudding\n");
        printf(" 12. Grain Soup\n");
        printf(" 13. Grilled Sausage\n");
        printf(" 14. Meat Soup\n");
        printf(" 15. Meat Stew\n");
        printf(" 16. Red Sauce\n");
        printf(" 17. Seafood Grilled Butter\n");
        printf(" 18. Seafood Mushroom Salad\n");
        printf(" 19. Steamed Fish\n");
        printf(" 20. Stir-Fried Seafood\n");
        printf(" 21. Stir-Fried Vegetables\n");
        printf(" 22. Vinegar\n");

        printf(" Apprentice recipes:\n");
        printf(" 23. Beehive Cookie (Cooking Honey) A\n");
        printf(" 24. Beehive Cookie (Wild Beehive) B\n");
        printf(" 25. Cheese Gratin\n");
        printf(" 26. Fish Fillet Salad\n");
        printf(" 27. Fish Fillet Chip\n");
        printf(" 28. Fish Soup\n");
        printf(" 29. Fried Bird\n");
        printf(" 30. Fruit and Vegetable Salad\n");
        printf(" 31. Fruit Pie\n");
        printf(" 32. Fruit Wine\n");
        printf(" 33. Good Feed\n");
        printf(" 34. High-Quality Carrot Juice\n");
        printf(" 35. Honey Wine\n");
        printf(" 36. Lizard Kebab\n");
        printf(" 37. Meat Pasta\n");
        printf(" 38. Meat Pie\n");
        printf(" 39. Oatmeal\n");
        printf(" 40. Omelet\n");
        printf(" 41. Organic Feed (Fish) A\n");
        printf(" 42. Organic Feed (Dried Fish) B\n");
        printf(" 43. Pickled Fish\n");
        printf(" 44. Pickled Vegetables\n");
        printf(" 45. Seafood Pasta\n");
        printf(" 46. Smoked Fish Steak\n");
        printf(" 47. Soft Bread\n");
        printf(" 48. Special Carrot Juice\n");
        printf(" 49. Steak\n");
        printf(" 50. Steamed Bird\n");
        printf(" 51. Steamed Seafood\n");
        printf(" 52. Stir-Fried Meat\n");
        printf(" 53. Tea With Fine scent\n");
        printf(" 54. White Sauce\n");

        scanf("%d", &x);

//batch input
        printf(" How many items would you like to craft?\n");
        scanf("%d", &batch);
        printf(" Ingredients required:\n");

//list choice
//beginner recipes
        if (x == 1)
                aloe_cookie(batch);
        else if (x == 2)
                aloe_yogurt(batch);
        else if (x == 3)
                beer(batch);
        else if (x == 4)
                boiled_bird_eggs(batch);
        else if (x == 5)
                dressing(batch);
        else if (x == 6)
                essence_liquor(batch);
        else if (x == 7)
                exotic_herbal_wine(batch);
        else if (x == 8)
                fried_fish(batch);
        else if (x == 9)
                fried_vegetables(batch);
        else if (x == 10)
                fruit_juice(batch);
        else if (x == 11)
                fruit_pudding(batch);
        else if (x == 12)
                grain_soup(batch);
        else if (x == 13)
                grilled_sausage(batch);
        else if (x == 14)
                meat_soup(batch);
        else if(x == 15)
                meat_stew(batch);
        else if (x == 16)
                red_sauce(batch);
        else if (x == 17)
                seafood_grilled_butter(batch);
        else if (x == 18)
                seafood_mushroom_salad(batch);
        else if (x == 19)
                steamed_fish(batch);
        else if (x == 20)
                stir_fried_seafood(batch);
        else if (x == 21)
                stir_fried_vegetables(batch);
        else if (x == 22)
                vinegar(batch);
//apprentice recipes
        else  if (x == 23)
                beehive_cookie_a(batch);
        else if (x == 24)
                beehive_cookie_b(batch);
        else if (x == 25)
                cheese_gratin(batch);
        else if (x == 26)
                fish_fillet_salad(batch);
        else if (x == 27)
                fish_fillet_chip(batch);
        else if (x == 28)
                fish_soup(batch);
        else if (x == 29)
                fried_bird(batch);
        else if (x == 30)
                fruit_vegetable_salad(batch);
        else if (x == 31)
                fruit_pie(batch);
        else if (x == 32)
                fruit_wine(batch);
        else if (x == 33)
                good_feed(batch);
        else if (x == 34)
                hq_carrot_juice(batch);
        else if (x == 35)
                honey_wine(batch);
        else if (x == 36)
                lizard_kebab(batch);
        else if (x == 37)
                meat_pasta(batch);
        else  if (x == 38)
                meat_pie(batch);
        else if (x == 39)
                oatmeal(batch);
        else if (x == 40)
                omelet(batch);
        else if (x == 41)
                organic_feed_a(batch);
        else if (x == 42)
                organic_feed_b(batch);
        else if (x == 43)
                pickled_fish(batch);
        else if (x == 44)
                pickled_vegetables(batch);
        else if (x == 45)
                seafood_pasta(batch);
        else if (x == 46)
                smoked_fish_steak(batch);
        else if (x == 47)
                soft_bread(batch);
        else if (x == 48)
                special_carrot_juice(batch);
        else if (x == 49)
                steak(batch);
        else if (x == 50)
                steamed_bird(batch);
        else if (x == 51)
                steamed_seafood(batch);
        else if (x == 52)
                stir_fried_meat(batch);
        else if (x == 53)
                tea_fine_scent(batch);
        else if (x == 54)
                white_sauce(batch);

        return 0;
}
Exemple #4
0
int main()
{
        while(FCGI_Accept() >=0) {
                printf("Content-Type: text/html; charset=utf-8\r\n\r\n\r\n");

        char *data;
        int x;
        int batch;

        data = getenv("QUERY_STRING");

        if(data == NULL)
                printf("<p>ERROR! Error in passing data from form to script.</p>");

        if(sscanf(data, "x=%d&batch=%d", &x,&batch)!=2)
                printf("<p>ERROR! Invalid data.</p>");
//list choice
//beginner recipes
        if (x == 1)
                aloe_cookie(batch);
        else if (x == 2)
                aloe_yogurt(batch);
        else if (x == 3)
                beer(batch);
        else if (x == 4)
                boiled_bird_eggs(batch);
        else if (x == 5)
                dressing(batch);
        else if (x == 6)
                essence_liquor(batch);
        else if (x == 7)
                exotic_herbal_wine(batch);
        else if (x == 8)
                fried_fish(batch);
        else if (x == 9)
                fried_vegetables(batch);
        else if (x == 10)
                fruit_juice(batch);
        else if (x == 11)
                fruit_pudding(batch);
        else if (x == 12)
                grain_soup(batch);
        else if (x == 13)
                grilled_sausage(batch);
        else if (x == 14)
                meat_soup(batch);
        else if(x == 15)
                meat_stew(batch);
        else if (x == 16)
                red_sauce(batch);
        else if (x == 17)
                seafood_grilled_butter(batch);
        else if (x == 18)
                seafood_mushroom_salad(batch);
        else if (x == 19)
                steamed_fish(batch);
        else if (x == 20)
                stir_fried_seafood(batch);
        else if (x == 21)
                stir_fried_vegetables(batch);
        else if (x == 22)
                vinegar(batch);
//apprentice recipes
        else  if (x == 23)
                beehive_cookie_a(batch);
        else if (x == 24)
                beehive_cookie_b(batch);
        else if (x == 25)
                cheese_gratin(batch);
        else if (x == 26)
                fish_fillet_salad(batch);
        else if (x == 27)
                fish_fillet_chip(batch);
        else if (x == 28)
                fish_soup(batch);
        else if (x == 29)
                fried_bird(batch);
        else if (x == 30)
                fruit_vegetable_salad(batch);
        else if (x == 31)
                fruit_pie(batch);
        else if (x == 32)
                fruit_wine(batch);
        else if (x == 33)
                good_feed(batch);
        else if (x == 34)
                hq_carrot_juice(batch);
        else if (x == 35)
                honey_wine(batch);
        else if (x == 36)
                lizard_kebab(batch);
        else if (x == 37)
                meat_pasta(batch);
        else  if (x == 38)
                meat_pie(batch);
        else if (x == 39)
                oatmeal(batch);
        else if (x == 40)
                omelet(batch);
        else if (x == 41)
                organic_feed_a(batch);
        else if (x == 42)
                organic_feed_b(batch);
        else if (x == 43)
                pickled_fish(batch);
        else if (x == 44)
                pickled_vegetables(batch);
        else if (x == 45)
                seafood_pasta(batch);
        else if (x == 46)
                smoked_fish_steak(batch);
        else if (x == 47)
                soft_bread(batch);
        else if (x == 48)
                special_carrot_juice(batch);
        else if (x == 49)
                steak(batch);
        else if (x == 50)
                steamed_bird(batch);
        else if (x == 51)
                steamed_seafood(batch);
        else if (x == 52)
                stir_fried_meat(batch);
        else if (x == 53)
                tea_fine_scent(batch);
        else if (x == 54)
                white_sauce(batch);
        }
        return 0;
}