Thread: HyperC

  1. #31
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,926
    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.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #32
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302
    your ink functionality really provides practically nothing over printf
    ink is something you can use, you don't have to.

    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.

    you could have tweaked it to do easier printing that doesn't require format strings.
    interesting...

    Type this 100 times:
    Code:
    for (x=1;x<=5;x++) { };
    or this 100 times:
    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"

  3. #33
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,926
    Quote Originally Posted by Structure
    ink is something you can use, you don't have to.
    That's poor justification for limiting a feature that could have been useful.

    Quote Originally Posted by Structure
    HyperC is for the developer to have freedom to structure their code how they want
    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 require
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #34
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Cool HyperC tips...

    Import File As String:
    Code:
    $*string = ":$>test.txt;";
    Compile with @Entry function as winMain:
    Code:
    hcc file.hcc file.c -w
    For Loop example:
    Code:
    loop 1 to 10 as i {
      ink "%i \n", i;
    };
    such that I don't have to use semi-colons in places that C does not require
    not going to happen.
    Last edited by Structure; 09-13-2019 at 01:35 PM.
    "without goto we would be wtf'd"

  5. #35
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Post HyperC Update Version 4.1

    I want to structure my code such that I can use ink for printing unsigned long variables
    Ok. You can now use any type with ink.

    Code:
      ink [lu]variable;
    Also valid:
    Code:
      ink "int: " [i]value " char: " ^chr;
    Also valid:
    Code:
      ink "string1: " + [s]one + "\n string2: " + [s]two;
    That's poor justification for limiting a feature that could have been useful.
    true.

    furthermore it becomes confusing
    I assumed the more options available then in return you can pick what works for you was less confusing.
    Last edited by Structure; 09-13-2019 at 02:40 PM.
    "without goto we would be wtf'd"

  6. #36
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Red face HyperC tips...

    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"

  7. #37
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Post example...

    base.hed
    Code:
    #include <stdio.h>
    #define ON 1
    #define OFF 0
    program.hcc
    Code:
    @{ ink "Hello World"; };
    command:
    Code:
    hcc program.hcc program.c
    Last edited by Structure; 09-13-2019 at 04:39 PM.
    "without goto we would be wtf'd"

  8. #38
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Cool HyperC Update Version 4.2

    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.
    Code:
    ink "string1: " one "\n string2: " two;
    I prefer to be able to see the type of variable with a quick look.
    i.e:
    Code:
    ink "string1: " [s]one "\n string2: " [s]two;
    I can quickly see that those are strings versus having to determine.


    "Microsoft Windows Operating System" as a requirement
    HyperC is currently only available as a windows executable.
    Last edited by Structure; 09-14-2019 at 06:33 AM.
    "without goto we would be wtf'd"

  9. #39
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Cool HyperC tips...

    Creating file structures using hyperC compiler:
    The compiler has many features...

    Use the -x option in hyperC.

    website.hcc
    Code:
    <!DOCTYPE html>
    <html lang="en">
        <head>
            :>head.file;
        </head>
        <body>
            :>body.file;
        </body>
    </html>
    compile:
    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"

  10. #40
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Lightbulb example...

    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"

  11. #41
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Post example...

    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"

  12. #42
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Thumbs up example...

    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"

  13. #43
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Post Beta Feature !

    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
    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";
      });
    };
    argc is the amount of arguments passed.
    argv[] is the array passed from the command line.

    i.e:
    Code:
    program 5
    Code:
    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"

  14. #44
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    302

    Thumbs up Hello World Example...

    program.hcc
    Code:
    <stdio.h>; @{ ink "Hello World"; };
    "without goto we would be wtf'd"

  15. #45
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,926
    Quote Originally Posted by Structure
    This function will take input from stdin and put the input in a string.
    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?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HyperC Pre Process File Injection
    By Structure in forum Tech Board
    Replies: 2
    Last Post: 08-06-2019, 06:13 AM
  2. The future of the C language is HyperC
    By Structure in forum Projects and Job Recruitment
    Replies: 6
    Last Post: 05-14-2019, 08:55 AM

Tags for this Thread