target/scratch3.c
static int scr3_set_block_info(enum scr3_block_type type,
                               const char **opcode_str_p, bool *is_toplevel_p,
                               bool *is_shadow_p) {
#define GEN_CASE(type_case, opcode, toplevel, shadow) \
  case type_case: {                                   \
    *opcode_str_p = opcode;                           \
    *is_toplevel_p = toplevel;                        \
    *is_shadow_p = shadow;                            \
    return 0;                                         \
  }

  switch (type) {
    GEN_CASE(SCR3_BLK_WHEN_FLAG_CLICKED, "event_whenflagclicked", true, false);
    GEN_CASE(SCR3_BLK_SET_VAR, "data_setvariableto", false, false);
    GEN_CASE(SCR3_BLK_CHANGE_VAR, "data_changevariableby", false, false);
    GEN_CASE(SCR3_BLK_ADD, "operator_add", false, false);
    GEN_CASE(SCR3_BLK_SUB, "operator_subtract", false, false);
    GEN_CASE(SCR3_BLK_MUL, "operator_multiply", false, false);
    GEN_CASE(SCR3_BLK_DIV, "operator_divide", false, false);
    GEN_CASE(SCR3_BLK_MOD, "operator_mod", false, false);
    GEN_CASE(SCR3_BLK_DEFINE, "procedures_definition", true, false);
    GEN_CASE(SCR3_BLK_PROTO, "procedures_prototype", false, true);
    GEN_CASE(SCR3_BLK_CALL, "procedures_call", false, false);
    GEN_CASE(SCR3_BLK_ARG_REPORTER, "argument_reporter_string_number", false,
             false);
    GEN_CASE(SCR3_BLK_IF, "control_if", false, false);
    GEN_CASE(SCR3_BLK_IF_ELSE, "control_if_else", false, false);
    GEN_CASE(SCR3_BLK_FOREVER, "control_forever", false, false);
    GEN_CASE(SCR3_BLK_REPEAT, "control_repeat", false, false);
    GEN_CASE(SCR3_BLK_REPEAT_UNTIL, "control_repeat_until", false, false);
    GEN_CASE(SCR3_BLK_WAIT_UNTIL, "control_wait_until", false, false);
    GEN_CASE(SCR3_BLK_EQUAL, "operator_equals", false, false);
    GEN_CASE(SCR3_BLK_NOT, "operator_not", false, false);
    GEN_CASE(SCR3_BLK_LOR, "operator_or", false, false);
    GEN_CASE(SCR3_BLK_LAND, "operator_and", false, false);
    GEN_CASE(SCR3_BLK_GREATER_THAN, "operator_gt", false, false);
    GEN_CASE(SCR3_BLK_LESS_THAN, "operator_lt", false, false);
    GEN_CASE(SCR3_BLK_JOIN, "operator_join", false, false);
    GEN_CASE(SCR3_BLK_LENGTH, "operator_length", false, false);
    GEN_CASE(SCR3_BLK_LETTER_OF, "operator_letter_of", false, false);
    GEN_CASE(SCR3_BLK_MATHOP, "operator_mathop", false, false);
    GEN_CASE(SCR3_BLK_SWITCH_BACKDROP, "looks_switchbackdropto", false, false);
    GEN_CASE(SCR3_BLK_BACKDROP_NUM_NAME, "looks_backdropnumbername", false,
             false);
    GEN_CASE(SCR3_BLK_ADD_TO_LIST, "data_addtolist", false, false);
    GEN_CASE(SCR3_BLK_DELETE_ALL_LIST, "data_deletealloflist", false, false);
    GEN_CASE(SCR3_BLK_DELETE_ITEM, "data_deleteoflist", false, false);
    GEN_CASE(SCR3_BLK_REPLACE_ITEM, "data_replaceitemoflist", false, false);
    GEN_CASE(SCR3_BLK_LIST_LENGTH, "data_lengthoflist", false, false);
    GEN_CASE(SCR3_BLK_LIST_ITEM, "data_itemoflist", false, false);
    GEN_CASE(SCR3_BLK_ASK_AND_WAIT, "sensing_askandwait", false, false);
    GEN_CASE(SCR3_BLK_ANSWER_REPORTER, "sensing_answer", false, false);
    GEN_CASE(SCR3_BLK_STOPALL, "control_stop", false, false);
    case SCR3_BLK_DUMMY:
      return 0;
  }
#undef GEN_CASE
  return 1;
}
// set type-specific data
// return 0 for success
set type-specific data
return 0 for success
set type - specific data return 0 for success
static int scr3_set_block_info(enum scr3_block_type type,
                               const char **opcode_str_p, bool *is_toplevel_p,
                               bool *is_shadow_p) {
#define GEN_CASE(type_case, opcode, toplevel, shadow) \
  case type_case: {                                   \
    *opcode_str_p = opcode;                           \
    *is_toplevel_p = toplevel;                        \
    *is_shadow_p = shadow;                            \
    return 0;                                         \
  }
  switch (type) {
    GEN_CASE(SCR3_BLK_WHEN_FLAG_CLICKED, "event_whenflagclicked", true, false);
    GEN_CASE(SCR3_BLK_SET_VAR, "data_setvariableto", false, false);
    GEN_CASE(SCR3_BLK_CHANGE_VAR, "data_changevariableby", false, false);
    GEN_CASE(SCR3_BLK_ADD, "operator_add", false, false);
    GEN_CASE(SCR3_BLK_SUB, "operator_subtract", false, false);
    GEN_CASE(SCR3_BLK_MUL, "operator_multiply", false, false);
    GEN_CASE(SCR3_BLK_DIV, "operator_divide", false, false);
    GEN_CASE(SCR3_BLK_MOD, "operator_mod", false, false);
    GEN_CASE(SCR3_BLK_DEFINE, "procedures_definition", true, false);
    GEN_CASE(SCR3_BLK_PROTO, "procedures_prototype", false, true);
    GEN_CASE(SCR3_BLK_CALL, "procedures_call", false, false);
    GEN_CASE(SCR3_BLK_ARG_REPORTER, "argument_reporter_string_number", false,
             false);
    GEN_CASE(SCR3_BLK_IF, "control_if", false, false);
    GEN_CASE(SCR3_BLK_IF_ELSE, "control_if_else", false, false);
    GEN_CASE(SCR3_BLK_FOREVER, "control_forever", false, false);
    GEN_CASE(SCR3_BLK_REPEAT, "control_repeat", false, false);
    GEN_CASE(SCR3_BLK_REPEAT_UNTIL, "control_repeat_until", false, false);
    GEN_CASE(SCR3_BLK_WAIT_UNTIL, "control_wait_until", false, false);
    GEN_CASE(SCR3_BLK_EQUAL, "operator_equals", false, false);
    GEN_CASE(SCR3_BLK_NOT, "operator_not", false, false);
    GEN_CASE(SCR3_BLK_LOR, "operator_or", false, false);
    GEN_CASE(SCR3_BLK_LAND, "operator_and", false, false);
    GEN_CASE(SCR3_BLK_GREATER_THAN, "operator_gt", false, false);
    GEN_CASE(SCR3_BLK_LESS_THAN, "operator_lt", false, false);
    GEN_CASE(SCR3_BLK_JOIN, "operator_join", false, false);
    GEN_CASE(SCR3_BLK_LENGTH, "operator_length", false, false);
    GEN_CASE(SCR3_BLK_LETTER_OF, "operator_letter_of", false, false);
    GEN_CASE(SCR3_BLK_MATHOP, "operator_mathop", false, false);
    GEN_CASE(SCR3_BLK_SWITCH_BACKDROP, "looks_switchbackdropto", false, false);
    GEN_CASE(SCR3_BLK_BACKDROP_NUM_NAME, "looks_backdropnumbername", false,
             false);
    GEN_CASE(SCR3_BLK_ADD_TO_LIST, "data_addtolist", false, false);
    GEN_CASE(SCR3_BLK_DELETE_ALL_LIST, "data_deletealloflist", false, false);
    GEN_CASE(SCR3_BLK_DELETE_ITEM, "data_deleteoflist", false, false);
    GEN_CASE(SCR3_BLK_REPLACE_ITEM, "data_replaceitemoflist", false, false);
    GEN_CASE(SCR3_BLK_LIST_LENGTH, "data_lengthoflist", false, false);
    GEN_CASE(SCR3_BLK_LIST_ITEM, "data_itemoflist", false, false);
    GEN_CASE(SCR3_BLK_ASK_AND_WAIT, "sensing_askandwait", false, false);
    GEN_CASE(SCR3_BLK_ANSWER_REPORTER, "sensing_answer", false, false);
    GEN_CASE(SCR3_BLK_STOPALL, "control_stop", false, false);
    case SCR3_BLK_DUMMY:
      return 0;
  }
#undef GEN_CASE
  return 1;
}
static int scr3_set_block_info ( enum scr3_block_type type , const char * * opcode_str_p , bool * is_toplevel_p , bool * is_shadow_p ) { #define GEN_CASE ( type_case , opcode , toplevel , shadow )  \
  case type_case: {                                   \
    *opcode_str_p = opcode;                           \
    *is_toplevel_p = toplevel;                        \
    *is_shadow_p = shadow;                            \
    return 0;                                         \
  } switch ( type ) { GEN_CASE ( SCR3_BLK_WHEN_FLAG_CLICKED , " " , true , false ) ; GEN_CASE ( SCR3_BLK_SET_VAR , " " , false , false ) ; GEN_CASE ( SCR3_BLK_CHANGE_VAR , " " , false , false ) ; GEN_CASE ( SCR3_BLK_ADD , " " , false , false ) ; GEN_CASE ( SCR3_BLK_SUB , " " , false , false ) ; GEN_CASE ( SCR3_BLK_MUL , " " , false , false ) ; GEN_CASE ( SCR3_BLK_DIV , " " , false , false ) ; GEN_CASE ( SCR3_BLK_MOD , " " , false , false ) ; GEN_CASE ( SCR3_BLK_DEFINE , " " , true , false ) ; GEN_CASE ( SCR3_BLK_PROTO , " " , false , true ) ; GEN_CASE ( SCR3_BLK_CALL , " " , false , false ) ; GEN_CASE ( SCR3_BLK_ARG_REPORTER , " " , false , false ) ; GEN_CASE ( SCR3_BLK_IF , " " , false , false ) ; GEN_CASE ( SCR3_BLK_IF_ELSE , " " , false , false ) ; GEN_CASE ( SCR3_BLK_FOREVER , " " , false , false ) ; GEN_CASE ( SCR3_BLK_REPEAT , " " , false , false ) ; GEN_CASE ( SCR3_BLK_REPEAT_UNTIL , " " , false , false ) ; GEN_CASE ( SCR3_BLK_WAIT_UNTIL , " " , false , false ) ; GEN_CASE ( SCR3_BLK_EQUAL , " " , false , false ) ; GEN_CASE ( SCR3_BLK_NOT , " " , false , false ) ; GEN_CASE ( SCR3_BLK_LOR , " " , false , false ) ; GEN_CASE ( SCR3_BLK_LAND , " " , false , false ) ; GEN_CASE ( SCR3_BLK_GREATER_THAN , " " , false , false ) ; GEN_CASE ( SCR3_BLK_LESS_THAN , " " , false , false ) ; GEN_CASE ( SCR3_BLK_JOIN , " " , false , false ) ; GEN_CASE ( SCR3_BLK_LENGTH , " " , false , false ) ; GEN_CASE ( SCR3_BLK_LETTER_OF , " " , false , false ) ; GEN_CASE ( SCR3_BLK_MATHOP , " " , false , false ) ; GEN_CASE ( SCR3_BLK_SWITCH_BACKDROP , " " , false , false ) ; GEN_CASE ( SCR3_BLK_BACKDROP_NUM_NAME , " " , false , false ) ; GEN_CASE ( SCR3_BLK_ADD_TO_LIST , " " , false , false ) ; GEN_CASE ( SCR3_BLK_DELETE_ALL_LIST , " " , false , false ) ; GEN_CASE ( SCR3_BLK_DELETE_ITEM , " " , false , false ) ; GEN_CASE ( SCR3_BLK_REPLACE_ITEM , " " , false , false ) ; GEN_CASE ( SCR3_BLK_LIST_LENGTH , " " , false , false ) ; GEN_CASE ( SCR3_BLK_LIST_ITEM , " " , false , false ) ; GEN_CASE ( SCR3_BLK_ASK_AND_WAIT , " " , false , false ) ; GEN_CASE ( SCR3_BLK_ANSWER_REPORTER , " " , false , false ) ; GEN_CASE ( SCR3_BLK_STOPALL , " " , false , false ) ; case SCR3_BLK_DUMMY : return 0 ; } #undef  GEN_CASE return 1 ; }
set type-specific data
return 0 for success
set type - specific data return 0 for success