資源簡介
G代碼解釋器,包含.NC格式測試用例,編譯環境為VS2010

代碼片段和文件信息
#include?
#include?
#include?“G_FileDeal.h“
//========================函數聲明===============================
void?get_line_num(FILE?*fp);
void?get_g_code(FILE?*fp);
void?get_m_code(FILE?*fp);
void?get_f_code(FILE?*fp);
void?get_s_code(FILE?*fp);
void?get_t_code(FILE?*fp);
void?get_x_pos(FILE?*fp?float?x_readpos);
void?get_y_pos(FILE?*fp?float?y_readpos);
void?get_z_pos(FILE?*fp?float?z_readpos);
void?get_i_pos(FILE?*fp?float?i_readpos);
void?get_j_pos(FILE?*fp?float?j_readpos);
void?get_k_pos(FILE?*fp?float?k_readpos);
void?get_r_pos(FILE?*fp?float?R_readPos);
void?InsertElement(ListNode?*h);
void?PrintList(ListNode?*h);
//=========================主函數================================
void?main()
{
char?ch;
FILE?*fp;
ListNode?*h; //鏈表表頭
h?=?CreateList(); //創建空鏈表
G_dealStruct.read_end?=?FALSE;
float???X_readPos?=?0;
float???X_finalPos?=?0;
float???Y_readPos?=?0;
float???Y_finalPos?=?0;
float???Z_readPos?=?0;
float???Z_finalPos?=?0;
float???I_readPos?=?0;
float???I_finalPos=0?;
float???J_readPos?=?0;
float???J_finalPos=0?;
float???K_readPos?=?0;
float???K_finalPos=0?;
float???R_readPos?=?0;
if?((fp?=?fopen(“000.NC“?“r“))?==?NULL)
{
printf(“File?open?error!\n“);
exit(0);
}
while?(((ch=?getc(fp))!=‘%‘)&&(!G_dealStruct.read_end))
{
switch?(ch)
{
case?‘N‘:
get_line_num(fp);
InsertElement(h);?
break;
case?‘G‘:
get_g_code(fp);?
InsertElement(h);?
break;
case?‘M‘:
get_m_code(fp);?
InsertElement(h);?
break;
case?‘F‘:
get_f_code(fp);?
InsertElement(h);
break;
case?‘S‘:
get_s_code(fp);
InsertElement(h);?
break;
case?‘X‘:
get_x_pos(fp?X_readPos);?
InsertElement(h);?
break;
case?‘Y‘:
get_y_pos(fp?Y_readPos);?
InsertElement(h);?
break;
case?‘Z‘:
get_z_pos(fp?Z_readPos);?
InsertElement(h);?
break;
case?‘I‘:
get_i_pos(fp?I_readPos);?
InsertElement(h);?
break;
case?‘J‘:
get_j_pos(fp?J_readPos);?
InsertElement(h);?
break;
case?‘K‘:
get_k_pos(fp?K_readPos);?
InsertElement(h);?
break;
case?‘R‘:
get_r_pos(fp?R_readPos);
InsertElement(h);
break;
case?‘T‘:?
get_t_code(fp);
InsertElement(h);
break;
case‘E‘:
case‘L‘:
case‘O‘:
case‘Q‘:
case‘P‘:
G_dealStruct.read_end?=?TRUE;
printf(“Error!?第%d行?語法錯誤:出現非法功能字\n“?G_dealStruct.line_no);
break;
case?‘(‘:
case?‘)‘:
break;
case?‘;‘:
G_dealStruct.read_end?=?TRUE;
printf(“Error!?第%d行?語法錯誤:出現分號\n“?G_dealStruct.line_no);?
break;
case?‘?‘:
G_dealStruct.read_end?=?TRUE;
printf(“Error!?第%d行?語法錯誤:出現空格\n“?G_dealStruct.line_no);?
break;
}
}
PrintList(h);
if?(fclose(fp))
{
printf(“Can?not?close?the?file!\n“);
exit(0);
}
}
//=======================行號掃描函數============================
void?get_line_num(FILE?*p)
{
char?temp_x[16]?=?{?‘0‘‘0‘‘0‘?};
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-07-18?09:10??G-code-Interpreter\
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\
?????文件????????2581??2016-04-25?17:41??G-code-Interpreter\.gitattributes
?????文件????????4077??2016-04-25?17:41??G-code-Interpreter\.gitignore
?????文件?????????691??2016-04-25?17:41??G-code-Interpreter\.git\config
?????文件??????????73??2016-04-25?17:41??G-code-Interpreter\.git\desc
?????文件??????????23??2016-04-25?17:41??G-code-Interpreter\.git\HEAD
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\hooks\
?????文件?????????177??2016-04-25?17:41??G-code-Interpreter\.git\hooks\README.sample
?????文件????????1080??2016-04-25?17:41??G-code-Interpreter\.git\index
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\info\
?????文件?????????113??2016-04-25?17:41??G-code-Interpreter\.git\info\exclude
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\logs\
?????文件?????????334??2016-04-25?17:41??G-code-Interpreter\.git\logs\HEAD
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\logs\refs\
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\logs\refs\heads\
?????文件?????????334??2016-04-25?17:41??G-code-Interpreter\.git\logs\refs\heads\master
?????文件?????????150??2016-04-25?17:41??G-code-Interpreter\.git\ms-persist.xm
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????文件?????????164??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????文件????????1320??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????文件?????????751??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????文件??????484800??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????文件????????1883??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????文件??????????85??2016-04-25?17:41??G-code-Interpreter\.git\ob
?????目錄???????????0??2016-04-25?17:41??G-code-Interpreter\.git\ob
............此處省略76個文件信息
- 上一篇:覺悟郵箱密碼破解軟件
- 下一篇:同濟大學線性代數答案詳解
評論
共有 條評論