IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 27, 2018, 3:20:35 PM (8 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/czw_branch/20170908/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20170908/Ohana

  • branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/evaluate_stack.c

    r40207 r40477  
    8989      }
    9090      if (tmp_stack.type == ST_SCALAR_INT) {
    91         gprint (GP_ERR, "---> %d ", tmp_stack.IntValue);
     91        gprint (GP_ERR, "---> "OPIHI_INT_FMT" ", tmp_stack.IntValue);
    9292      }
    9393      if (tmp_stack.type == ST_SCALAR_FLT) {
     
    110110
    111111        if (i < 3) {  /* need two variables to operate on */
    112           snprintf (line, 512, "syntax error: trinary operator without three operands: %s\n", stack[i].name);
     112          snprintf (line, 512, "syntax error: trinary operator without three operands: %s\n(Note that the : in a trinary operation must be protected by spaces", stack[i].name);
    113113          push_error (line);
    114114          clear_stack (&tmp_stack);
     
    124124
    125125        /* there are no valid unary string operators */
    126         snprintf (line, 512, "invalid operands for trinary operator %s (mismatch types?)", stack[i].name);
     126        snprintf (line, 512, "invalid operands for trinary operator %s (mismatch types?)\n(Note that the : in a trinary operation must be protected by spaces)", stack[i].name);
    127127        push_error (line);
    128128        clear_stack (&tmp_stack);
     
    131131      got_three_op:
    132132        if (!status) {
    133           snprintf (line, 512, "syntax error: invalid operand for trinary operation: %s or %s or %s\n", stack[i-1].name, stack[i-2].name, stack[i-3].name);
     133          snprintf (line, 512, "syntax error: invalid operand for trinary operation: %s or %s or %s\n(Note that the : in a trinary operation must be protected by spaces)", stack[i-1].name, stack[i-2].name, stack[i-3].name);
    134134          push_error (line);
    135135          clear_stack (&tmp_stack);
     
    186186      got_two_op:
    187187        if (!status) {
    188           snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n", stack[i-1].name, stack[i-2].name);
     188          // we are guaranteed to have stack[i-1] and stack[i-2] since i >= 2 (above)
     189          char tmpvector[] = "Temporary Vector";
     190          char tmpmatrix[] = "Temporary Matrix";
     191         
     192          char *name1 = NULL;
     193          if (stack[i-1].name) {
     194            name1 = stack[i-1].name;
     195          } else {
     196            if (stack[i-1].type == ST_VECTOR_TMP) name1 = tmpvector;
     197            if (stack[i-1].type == ST_MATRIX_TMP) name1 = tmpmatrix;
     198          }
     199          char *name2 = NULL;
     200          if (stack[i-2].name) {
     201            name2 = stack[i-2].name;
     202          } else {
     203            if (stack[i-2].type == ST_VECTOR_TMP) name2 = tmpvector;
     204            if (stack[i-2].type == ST_MATRIX_TMP) name2 = tmpmatrix;
     205          }
     206
     207          snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n", name1, name2);
    189208          push_error (line);
     209
    190210          int isTrinary = TRUE;
    191211          isTrinary = isTrinary && (i >= 2);
     
    199219            push_error (line);
    200220          }
     221
    201222          clear_stack (&tmp_stack);
    202223          return (FALSE);
Note: See TracChangeset for help on using the changeset viewer.