Yep, that's inconsistent, and furthermore it becomes confusing: your ink functionality really provides practically nothing over printf, whereas you could have tweaked it to do easier printing that doesn't require format strings.
Yep, that's inconsistent, and furthermore it becomes confusing: your ink functionality really provides practically nothing over printf, whereas you could have tweaked it to do easier printing that doesn't require format strings.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
ink is something you can use, you don't have to.your ink functionality really provides practically nothing over printf
HyperC is for the developer to have freedom to structure their code how they want, as well as have options for faster coding of frequently used functions/statements.
$ and # , are quick access to char and int which are used commonly imo.
with and and, are prepend/appends for less redundancy.
interesting...you could have tweaked it to do easier printing that doesn't require format strings.
Type this 100 times:
or this 100 times:Code:for (x=1;x<=5;x++) { };
Code:loop 1 to 5 as x { };
Last edited by Structure; 09-13-2019 at 01:18 PM.
"without goto we would be wtf'd"
That's poor justification for limiting a feature that could have been useful.Originally Posted by Structure
I want to structure my code such that I can use ink for printing unsigned long variables without a format string, and such that I don't have to use semi-colons in places that C does not requireOriginally Posted by Structure
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Import File As String:
Compile with @Entry function as winMain:Code:$*string = ":$>test.txt;";
For Loop example:Code:hcc file.hcc file.c -w
Code:loop 1 to 10 as i { ink "%i \n", i; };not going to happen.such that I don't have to use semi-colons in places that C does not require
Last edited by Structure; 09-13-2019 at 01:35 PM.
"without goto we would be wtf'd"
Ok. You can now use any type with ink.I want to structure my code such that I can use ink for printing unsigned long variables
Also valid:Code:ink [lu]variable;
Also valid:Code:ink "int: " [i]value " char: " ^chr;
Code:ink "string1: " + [s]one + "\n string2: " + [s]two;true.That's poor justification for limiting a feature that could have been useful.
I assumed the more options available then in return you can pick what works for you was less confusing.furthermore it becomes confusing
Last edited by Structure; 09-13-2019 at 02:40 PM.
"without goto we would be wtf'd"
When compiling there is a file you can use called: base.hed
in the same directory as hcc.exe create the file base.hed
This file is a header included in every hcc compilation at the top of the file.
HyperC does not compile this file it is imported as raw data.
"without goto we would be wtf'd"
base.hed
program.hccCode:#include <stdio.h> #define ON 1 #define OFF 0
command:Code:@{ ink "Hello World"; };
Code:hcc program.hcc program.c
Last edited by Structure; 09-13-2019 at 04:39 PM.
"without goto we would be wtf'd"
HyperC functionality: get *string*
This function will take input from stdin and put the input in a string.
example:
Code:<stdio.h>;<string.h>; @{ ink "Enter Your Name: "; get val; ink "Hello " [s]val "."; };
side note:
I understand the concept of not have the types, also why this would be geared toward my design premise.
I prefer to be able to see the type of variable with a quick look.Code:ink "string1: " one "\n string2: " two;
i.e:
I can quickly see that those are strings versus having to determine.Code:ink "string1: " [s]one "\n string2: " [s]two;
HyperC is currently only available as a windows executable."Microsoft Windows Operating System" as a requirement
Last edited by Structure; 09-14-2019 at 06:33 AM.
"without goto we would be wtf'd"
Creating file structures using hyperC compiler:
The compiler has many features...
Use the -x option in hyperC.
website.hcc
compile:Code:<!DOCTYPE html> <html lang="en"> <head> :>head.file; </head> <body> :>body.file; </body> </html>
Code:hcc website.hcc index.html -x
Last edited by Structure; 09-14-2019 at 07:25 AM.
"without goto we would be wtf'd"
Code:<stdio.h>; <string.h>; @{ ink "Name: "; get name; loop 0 to strlen(name) as i { ink ^name[i]; }; };
"without goto we would be wtf'd"
Distance between location1 and location2:
Code:<stdio.h>; <string.h>; <math.h>; vector! { float x, y, z, w; }; float distance( float x1, float y1, float z1, float x2, float y2, float z2 ) { float x,y,z,w; x = pow(x2 - x1,2); y = pow(y2 - y1,2); z = pow(z2 - z1,2); return sqrt(x + y + z); }; @{ and = !vector; location1; location2; and; with location1.; x = 0; y = 0; z = 0; with location2.; x = 1; y = 1; z = 1; with ink ; "The distance \n from: "; [f]location1.x "," [f]location1.y "," [f]location1.z "\n to: "; [f]location2.x "," [f]location2.y "," [f]location2.z "\n is: "; [f]distance(location1.x,location1.y,location1.z,location2.x,location2.y,location2.z); with; };
"without goto we would be wtf'd"
command prompt:
Code:<stdio.h>; <string.h>; <stdlib.h>; with #define ; _TRUE 1; _FALSE 0; with; int compare($*string1,$*string2) { int response = _TRUE; loop 0 to strlen(string1) as i { case string1[i] != string2[i] { response = _FALSE; }; }; return response; }; @{ menu: { ink "Enter command: "; get command; case compare(command,"exit") == _TRUE { exit(1); } || compare(command,"cls") == _TRUE { shell "cls"; }; run menu; }; };
"without goto we would be wtf'd"
This is a beta feature that is still being developed.
Passing functions to functions as callBacks:
You can currently pass 1 function only...
Code:<stdio.h>; <string.h>; @call(int times,@callBack) { loop 1 to times as i { callBack(i); }; }; @{ call(10, @(int x){ ink "Number: " [i]x "\n"; }); };
extended example:
program.hcc
argc is the amount of arguments passed.Code:<stdio.h>; <string.h>; @call(int times,@callBack) { loop 1 to times as i { callBack(i); }; }; @{ call(atoi(argv[1]), @(int x){ ink [i]x "\n"; }); };
argv[] is the array passed from the command line.
i.e:
Code:program 5Code:program 10
BUILD.BAT
Code:@echo off hcc %1.hcc %1.c echo compiling... gcc %1.c -o %1.exe echo done.
Last edited by Structure; 09-14-2019 at 12:15 PM.
"without goto we would be wtf'd"
program.hcc
Code:<stdio.h>; @{ ink "Hello World"; };
"without goto we would be wtf'd"
It looks like get implicitly declares the string, which leads to the question: what is the type of this string? Is it an array of char, and if so, what is its size? Is it a pointer to char with dynamically allocated memory? If so, should free be called?Originally Posted by Structure
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)