interp_internal.hh
来自「CNC 的开放码,EMC2 V2.2.8版」· HH 代码 · 共 526 行 · 第 1/2 页
HH
526 行
double x_number; ON_OFF y_flag; double y_number; ON_OFF z_flag; double z_number; // control (o-word) stuff long offset; // start of line in file int o_type; int o_number; double params[INTERP_SUB_PARAMS];}block;typedef block *block_pointer;#define NAMED_PARAMETERS_ALLOC_UNIT 20struct named_parameters_struct { int named_parameter_alloc_size; int named_parameter_used_size; char **named_parameters; double *named_param_values; };typedef struct context_struct { long position; // location (ftell) in file int sequence_number; // location (line number) in file char *filename; // name of file for this context double saved_params[INTERP_SUB_PARAMS]; struct named_parameters_struct named_parameters;}context;typedef struct offset_struct { int o_word; int type; char *filename; // the name of the file long offset; // the offset in the file int sequence_number;}offset;/*The current_x, current_y, and current_z are the location of the toolin the current coordinate system. current_x and current_y differ fromprogram_x and program_y when cutter radius compensation is on.current_z is the position of the tool tip in program coordinates whentool length compensation is using the actual tool length; it is theposition of the spindle when tool length is zero.In a setup, the axis_offset values are set by g92 and the origin_offsetvalues are set by g54 - g59.3. The net origin offset uses both valuesand is not represented here*/typedef struct setup_struct{ double AA_axis_offset; // A-axis g92 offset double AA_current; // current A-axis position double AA_origin_offset; // A-axis origin offset double BB_axis_offset; // B-axis g92offset double BB_current; // current B-axis position double BB_origin_offset; // B-axis origin offset double CC_axis_offset; // C-axis g92offset double CC_current; // current C-axis position double CC_origin_offset; // C-axis origin offset double u_axis_offset, u_current, u_origin_offset; double v_axis_offset, v_current, v_origin_offset; double w_axis_offset, w_current, w_origin_offset; int active_g_codes[ACTIVE_G_CODES]; // array of active G codes int active_m_codes[ACTIVE_M_CODES]; // array of active M codes double active_settings[ACTIVE_SETTINGS]; // array of feed, speed, etc. double axis_offset_x; // X-axis g92 offset double axis_offset_y; // Y-axis g92 offset double axis_offset_z; // Z-axis g92 offset block block1; // parsed next block char blocktext[LINELEN]; // linetext downcased, white space gone CANON_MOTION_MODE control_mode; // exact path or cutting mode int current_slot; // carousel slot number of current tool double current_x; // current X-axis position double current_y; // current Y-axis position double current_z; // current Z-axis position double cutter_comp_radius; // current cutter compensation radius int cutter_comp_orientation; // current cutter compensation tool orientation int cutter_comp_side; // current cutter compensation side double cycle_cc; // cc-value (normal) for canned cycles double cycle_i; // i-value for canned cycles double cycle_j; // j-value for canned cycles double cycle_k; // k-value for canned cycles int cycle_l; // l-value for canned cycles double cycle_p; // p-value (dwell) for canned cycles double cycle_q; // q-value for canned cycles double cycle_r; // r-value for canned cycles DISTANCE_MODE distance_mode; // absolute or incremental int feed_mode; // G_93 (inverse time) or G_94 units/min ON_OFF feed_override; // whether feed override is enabled double feed_rate; // feed rate in current units/min char filename[LINELEN]; // name of currently open NC code file FILE *file_pointer; // file pointer for open NC code file ON_OFF flood; // whether flood coolant is on int tool_offset_index; // for use with tool length offsets CANON_UNITS length_units; // millimeters or inches int line_length; // length of line last read char linetext[LINELEN]; // text of most recent line read ON_OFF mist; // whether mist coolant is on int motion_mode; // active G-code for motion int origin_index; // active origin (1=G54 to 9=G59.3) double origin_offset_x; // origin offset x double origin_offset_y; // origin offset y double origin_offset_z; // origin offset z double parameters[RS274NGC_MAX_PARAMETERS]; // system parameters int parameter_occurrence; // parameter buffer index int parameter_numbers[50]; // parameter number buffer double parameter_values[50]; // parameter value buffer int named_parameter_occurrence; char *named_parameters[50]; double named_parameter_values[50]; ON_OFF percent_flag; // ON means first line was percent sign CANON_PLANE plane; // active plane, XY-, YZ-, or XZ-plane ON_OFF probe_flag; // flag indicating probing done ON_OFF input_flag; // flag indicating waiting for input done ON_OFF toolchange_flag; // flag indicating we just had a tool change int input_index; // channel queried ON_OFF input_digital; // input queried was digital (OFF=analog) ON_OFF cutter_comp_firstmove; // this is the first comp move double program_x; // program x, used when cutter comp on double program_y; // program y, used when cutter comp on double program_z; // program y, used when cutter comp on RETRACT_MODE retract_mode; // for cycles, old_z or r_plane int selected_tool_slot; // tool slot selected but not active int sequence_number; // sequence number of line last read double speed; // current spindle speed in rpm or SxM SPINDLE_MODE spindle_mode; // CONSTANT_RPM or CONSTANT_SURFACE CANON_SPEED_FEED_MODE speed_feed_mode; // independent or synched ON_OFF speed_override; // whether speed override is enabled CANON_DIRECTION spindle_turning; // direction spindle is turning char stack[50][80]; // stack of calls for error reporting int stack_index; // index into the stack double tool_zoffset; // current tool Z offset (AKA tool length offset) double tool_xoffset; // current tool X offset int tool_max; // highest number tool slot in carousel CANON_TOOL_TABLE tool_table[CANON_TOOL_MAX + 1]; // index is slot number double traverse_rate; // rate for traverse motions /* stuff for subroutines and control structures */ int defining_sub; // true if in a subroutine defn int doing_continue; // true if doing a continue //int doing_break; // true if doing a break int executed_if; // true if executed in current if int skipping_o; // o_number we are skipping for (or zero) int skipping_to_sub; // o_number of sub skipping to (or zero) int skipping_start; // start of skipping (sequence) double test_value; // value for "if", "while", "elseif" int call_level; // current subroutine level context sub_context[INTERP_SUB_ROUTINE_LEVELS]; int oword_labels; offset oword_offset[INTERP_OWORD_LABELS]; ON_OFF adaptive_feed; // adaptive feed is enabled ON_OFF feed_hold; // feed hold is enabled int loggingLevel; // 0 means logging is off char log_file[PATH_MAX]; char program_prefix[PATH_MAX];}setup;typedef setup *setup_pointer;/*The _setup model includes a stack array for the names of functioncalls. This stack is written into if an error occurs. Just before eachfunction returns an error code, it writes its name in the nextavailable string, initializes the following string, and incrementsthe array index. The following four macros do the work.The size of the stack array is 50. An error in the middle of a verycomplex expression would cause the ERP and CHP macros to write past thebounds of the array if a check were not provided. No real programwould contain such a thing, but the check is included to make themacros totally crash-proof. If the function call stack is deeper than49, the top of the stack will be missing.*/#define ERS(string) if (1) { \ setError ("%s", _(string)); \ _setup.stack_index = 0; \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] = 0; \ return NCE_VARIABLE; \ } else#define ERF(error_args) if (1) { \ setError error_args; \ _setup.stack_index = 0; \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] = 0; \ return NCE_VARIABLE; \ } else#define ERM(error_code) if (1) { \ _setup.stack_index = 0; \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] = 0; \ return error_code; \ } else#define ERP(error_code) if (_setup.stack_index < 49) { \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] = 0; \ return error_code; \ } else return error_code#define CHKS(bad, string) if (bad) { \ setError ("%s", _(string)); \ _setup.stack_index = 0; \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] = 0; \ return NCE_VARIABLE; \ } else#define CHKF(bad, error_args) if (bad) { \ setError error_args; \ _setup.stack_index = 0; \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] = 0; \ return NCE_VARIABLE; \ } else#define CHK(bad, error_code) if (bad) { \ _setup.stack_index = 0; \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] = 0; \ return error_code; \ } else#define CHP(try_this) \ if ((status = (try_this)) != INTERP_OK) { \ if (_setup.stack_index < 49) \ {strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] = 0; \ return status;} \ else {return status;} \ } else#define CYCLE_MACRO(call) for (repeat = block->l_number; \ repeat > 0; \ repeat--) \ { \ aa = (aa + aa_increment); \ bb = (bb + bb_increment); \ cycle_traverse(plane, aa, bb, old_cc); \ if (old_cc != r) \ cycle_traverse(plane, aa, bb, r); \ CHP(call); \ old_cc = clear_cc; \ }#endif // INTERP_INTERNAL_HH
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?