comparison harelet.c @ 4:0ed615367b10

Automated Vimcurial commmit
author VilyaemKenyaz
date Fri, 08 Sep 2023 08:16:07 -0400
parents eb7a7364994c
children 3879c1178448
comparison
equal deleted inserted replaced
3:eb7a7364994c 4:0ed615367b10
4 * Date - Sep 08 2023 4 * Date - Sep 08 2023
5 * *******************************************/ 5 * *******************************************/
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h>
9 #include "basedfilelib.h" 10 #include "basedfilelib.h"
11 #include "minibasediolib.h"
10 12
11 #define DEEPNESS 5 13 #define DEEPNESS 5
12 #define MAXPOINT 4096 14 #define MAXPOINT 4096
13 #define UNITS "G20" 15 #define UNITS "G20"
14 #define SPEED 20 16 #define SPEED 20
15 17
16 typedef struct{ 18 typedef struct{
17 unsigned int X,Y,down; 19 unsigned int X,Y,down;
18 }point; 20 }point;
19 21
20 points[MAXPOINT]; 22 point points[MAXPOINT];
21 23
22 unsigned int X,Y,step,down,numpoints; 24 unsigned int X,Y,step,down,numpoints;
23 char action; 25 char action;
24 26
25 /********************************************* 27 /*********************************************
72 scanf("%s",filename); 74 scanf("%s",filename);
73 75
74 if(choice == 1){ 76 if(choice == 1){
75 //Set the miller 77 //Set the miller
76 strcat(file,UNITS); 78 strcat(file,UNITS);
77 79
78 //Meat of instructions 80 //Meat of instructions
79 for(int i = 0;i != numpoints;i++){ 81 for(int i = 0;i != numpoints;i++){
80 //Compose 82 //Compose
81 char * instruction; 83 char * instruction;
82 strcat(instruction,"G0 X"); 84 strcat(instruction,"G0 X");
83 strcat(instruction,sprintf("%d",points[i].X)); 85 strcat(instruction,sprintf("%d",points[i].X));
84 strcat(instruction," Y"); 86 strcat(instruction," Y");
85 strcat(inustrction,sprintf("%d",points[i].Y)); 87 strcat(instruction,sprintf("%d",points[i].Y));
86 strcat(instructions," Z"); 88 strcat(instruction," Z");
87 strcat(instructions,sprintf("%d",points[i].Z)); 89 strcat(instruction,sprintf("%d",DEEPNESS));
88 //Write to string 90 //Write to string
89 strcat(file,instruction); 91 strcat(file,instruction);
90 } 92 }
91 //Finish 93 //Finish
92 strcat(file,"G0, X0, Y0, Z0"); 94 strcat(file,"G0, X0, Y0, Z0");
93 WriteFile(filename,file); 95 WriteFile(filename,file);
94 } 96 }
95 else{ 97 else{
98 puts("Superhare implementation not done");
99 exit(1);
96 //Set the miller 100 //Set the miller
97 101
98 102
99 //Meat of instructions 103 //Meat of instructions
100 104
101 105
102 //Finish 106 //Finish
103 107
104 } 108 }
105 109
136 140
137 case 's': 141 case 's':
138 puts("Enter new step:"); 142 puts("Enter new step:");
139 scanf("%d",&step); 143 scanf("%d",&step);
140 break; 144 break;
145
146 case 'c': Compile();
147 break;
141 default: 148 default:
142 break; 149 break;
143 } 150 }
144 exit(0); 151 exit(0);
145 } 152 }