changeset 8:c60e4315cb7e

Automated Vimcurial commmit
author VilyaemKenyaz
date Tue, 12 Sep 2023 06:46:45 -0400
parents 1bb981516d87
children 4eb02dffc00f
files .harelet.c.swp HARELET.MAN c.ksh harelet.c minibasediolib.h
diffstat 5 files changed, 52 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
Binary file .harelet.c.swp has changed
--- a/HARELET.MAN	Sat Sep 09 17:11:20 2023 -0400
+++ b/HARELET.MAN	Tue Sep 12 06:46:45 2023 -0400
@@ -11,3 +11,12 @@
 DESC
 .PP
 CAD program for CNC machines
+
+Vim keys (HJKL), or arrow keys.
+
+A to add a point at the current cursor's position
+
+C to compile GCODE
+
+S to change step size
+
--- a/c.ksh	Sat Sep 09 17:11:20 2023 -0400
+++ b/c.ksh	Tue Sep 12 06:46:45 2023 -0400
@@ -3,4 +3,4 @@
 rm harelet 
 cc harelet.c -g -o harelet 
 doas cp harelet /usr/bin/ 
-gdb -ex run harelet
+gdb harelet
--- a/harelet.c	Sat Sep 09 17:11:20 2023 -0400
+++ b/harelet.c	Tue Sep 12 06:46:45 2023 -0400
@@ -7,6 +7,7 @@
 #include <stdio.h> 
 #include <stdlib.h>
 #include <string.h>
+
 #include "basedfilelib.h"
 
 #ifdef __linux__
@@ -31,8 +32,8 @@
 
 point points[MAXPOINT];
 
-unsigned int X = 0;
-unsigned int Y = 0;
+unsigned int X = 100;
+unsigned int Y = 100;
 unsigned int step = 5;
 unsigned int down = 0;
 unsigned int numpoints = 0;
@@ -43,31 +44,15 @@
  * Author - William King
  * Date - Sep 08 2023
  * *******************************************/
-void Render(){
+void Render(){	
 	clrscr();
-	gotoxy(0,0);
+	gotoxy(0,30);
 	puts("HARELET A CAD PROGRAM BY VILYAEM KENYAZ, PEEP SOFTWARE 2023");
 	printf("Number of Points: %d X: %d Y: %d STEPSIZE: %d DWN?: %d\n",numpoints,X,Y,step,down);
 
 	//Render points
 	for(int i = 0;i != MAXPOINT;i++){
-		gotoxy(0,10);
-		/*
-		//Move X
-		for(int j = 0;j != points[i].X;j++){
-
-			printf("");
-
-		}
-
-		//Move Y
-		for(int k = 0;k != points[i].Y;k++){
-
-			puts("");
-
-
-		}
-		*/
+		gotoxy(0,50);
 
 		gotoxy(points[i].X,points[i].Y);
 
@@ -82,16 +67,6 @@
 	}
 
 	//Render cursor
-	/*
-	DocTop();
-	for(int i = 0;i != X;i++){
-		printf("");
-
-	}
-	for(int i = 0;i != Y;i++){
-		puts("");
-	}
-	*/
 
 	gotoxy(X,Y);
 
@@ -109,6 +84,7 @@
 void Compile(){
 	char * filename;
 	char * file;
+	char buffer[sizeof(int)*8+1];
 	int choice;
 
 	puts("Select your format\n1. RAW GCODE");
@@ -127,11 +103,14 @@
 			//Compose
 			char * instruction;
 			strcat(instruction,"G0 X");
-			strcat(instruction,itoa(points[i].X));
+			itoa(points[i].X,buffer);
+			strcat(instruction,buffer);
 			strcat(instruction," Y");
-			strcat(instruction,itoa(points[i].Y));
+			itoa(points[i].Y,buffer);
+			strcat(instruction,buffer);
 			strcat(instruction," Z");
-			strcat(instruction,itoa(DEEPNESS));
+			itoa(DEEPNESS,buffer);
+			strcat(instruction,buffer);
 			//Write to string
 			strcat(file,instruction);
 		}
@@ -152,46 +131,37 @@
  * *******************************************/
 void main(int argc, char* argv[]){
 	while(1){
-	Render();
-	scanf("%c",&action);
-	switch(action){
-		case 'a':		points[numpoints].X = X;
-					points[numpoints].Y = Y;
-					points[numpoints].down = down;
-					numpoints++;
-					break;
-		case 'h': 
+		Render();
+		scanf("%c",&action);
+		switch(action){
+			case 'a':		points[numpoints].X = X;
+						points[numpoints].Y = Y;
+						points[numpoints].down = down;
+						numpoints++;
+						break;
+			case 'h': 
 
-					if(X < 200 - step){
-					X += step;
-					}
-					break;
-		case 'j': 
-					if(X > step){
-					Y += step;
-					}
-					break;
-		case 'k': 
-					if(Y < 0){
-					Y -= step;
-					}
-					break;
-		case 'l': 
-					if(Y > 200){
-					X -= step;
-					}
-					break;
+						X += step;
+						break;
+			case 'j': 
+						Y += step;
+						break;
+			case 'k': 
+						Y -= step;
+						break;
+			case 'l': 
+						X -= step;
+						break;
+			case 's':		
+						puts("Enter new step:");
+						scanf("%d",&step);
+						break;
 
-		case 's':		
-					puts("Enter new step:");
-					scanf("%d",&step);
-					break;
-
-		case 'c':		Compile();
-					break;
-		default:
-					break;
-	}
+			case 'c':		Compile();
+						break;
+			default:
+						break;
+		}
 	}
 
 	exit(0);
--- a/minibasediolib.h	Sat Sep 09 17:11:20 2023 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-//BasedIOLib without *nix conio implementation
-
-//Clear the screen like in the Temple!
-void DocClear(){
-
-puts("\x1b[H\x1b[J");
-
-}
-
-
-//Mova the cursor to the top of the screen like in the temple!
-void DocTop(){
-
-puts("\033[2J");
-
-}
-
-//Move the cursor to this line and column
-void SetCursor(int line, int column){
-
-printf("\033[<%d>;<%d>f",line,column);
-
-}
-
-//Print the rest of a string given an indice
-void PutRest(char* ptr, int index){
-
-ptr += index;
-
-puts(ptr);
-
-}
-
-
-