So I found one problem with the g10 l2 patch :
p-1 is accepted as p0 even if I check for p < 0
The reason is when the p number is converted to an integer:

 p_int = (int) (block->p_number + 0.0001);

-1 +.0001 is (rightfully) truncated to zero.
If I remove the  +0.0001 then -1 stays -1 and the error is
caught.
My question is the reason for the 0.0001 and can I remove
 it without problems ?

Here is the code snippet from my patched interp_check.cc:



int Interp::check_g_codes(block_pointer block,   //!< pointer to a block to be 
checked
                         setup_pointer settings)        //!< pointer to machine 
settings
{
  int mode0, mode1;
  int p_int;

  mode0 = block->g_modes[0];
  mode1 = block->g_modes[1];
  if (mode0 == -1) {
  } else if (mode0 == G_4) {
    CHKS((block->p_number == -1.0), NCE_DWELL_TIME_MISSING_WITH_G4);
  } else if (mode0 == G_10) {
    p_int = (int) (block->p_number + 0.0001);
    CHKS((block->l_number != 2 && block->l_number != 1 && block->l_number != 20 
&& block->l_number != 10 && block->l_number != 11), _("Line with G10 does not 
have L1, L10, L11, L2, or L20"));
    CHKS((((block->p_number + 0.0001) - p_int) > 0.0002),  _("P value not an 
integer with G10"));
    CHKS((((block->l_number == 2 || block->l_number == 20) && ((p_int < 0) || 
(p_int > 9)))), _("P value out of range (0-9) with G10 L2 or G10 L20"));
    CHKS((((block->l_number == 1 || block->l_number == 10 || block->l_number == 
11) && p_int < 1)), _("P value out of range with G10 L1 or G10 L10"));
  } else if (mode0 == G_28) {

--snip --

Chris M
                                          
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to