profile
viewpoint
Neil Henning sheredom @Unity-Technologies Scotland http://www.duskborn.com Compiler Warlock on Burst @ Unity

sheredom/utf8.h 813

single header utf8 string functions for C and C++

sheredom/subprocess.h 482

single header process launching solution for C and C++

sheredom/json.h 335

single header json parser for C and C++

sheredom/utest.h 278

single header unit testing framework for C and C++

sheredom/hashmap.h 128

single header hashmap implementation for C and C++

sheredom/ubench.h 74

single header benchmark framework for C and C++

sheredom/llvm_bc_parsing_example 40

An LLVM bitcode parsing example

sheredom/yari-v 30

Single header SPIR-V compressor for C and C++

sheredom/git-hooks 16

Useful git hooks to combat develop stupidity.

sheredom/neil 10

Neil (Not Exactly an Intermediate Language), using MPC with LLVM

startedsheredom/hashmap.h

started time in 4 hours

startedsheredom/subprocess.h

started time in 11 hours

startedsheredom/ubench.h

started time in 11 hours

startedsheredom/hashmap.h

started time in 11 hours

startedsheredom/utest.h

started time in 11 hours

startedMiSTer-devel/ao486_MiSTer

started time in 11 hours

startedfreecores/rtf8088

started time in 13 hours

issue closedsheredom/hashmap.h

Integers as keys in the hashmap.

Hey @sheredom

If I want to make this hashmap take integers instead of char*. Can I just use the Robert Jenkins' 32 bit Mix Function and Knuth's multiplicative method on the integer key element? would that be enough ?

    /* Robert Jenkins' 32 bit Mix Function */
    key += (key << 12);
    key ^= (key >> 22);
    key += (key << 4);
    key ^= (key >> 9);
    key += (key << 10);
    key ^= (key >> 2);
    key += (key << 7);
    key ^= (key >> 12);

    /* Knuth's Multiplicative Method *
    key = (key >> 3) * 2654435761;

    return key % m->table_size;

Cheers.

closed time in 19 hours

LordNoteworthy

issue commentsheredom/hashmap.h

Integers as keys in the hashmap.

Thank you ! It does the job.

LordNoteworthy

comment created time in 19 hours

issue commentsheredom/subprocess.h

Subprocess does not have internet access?

Fixed this. Had to add the inherit environment option.

result = subprocess_create(command_line, subprocess_option_combined_stdout_stderr | subprocess_option_inherit_environment, &process);`

I still think this is an issue just based off the description for the subprocess_option_inherit_environment option.

Feel free to close this if it's expected behavior.

Jonatino

comment created time in a day

issue openedsheredom/subprocess.h

Subprocess does not have internet access?

I've got a really weird bug that I cant seem to figure out. I'm using your library to spawn a child java process for my game client.

The problem is when I start the client using a subprocess via your library, it does not have any internet access at all and throws a bunch of exceptions.

java.net.UnknownHostException: No such host is known (js5.pvpherodev.com)
        at java.base/java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:932)
        at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1505)
        at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:851)
        at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1495)
        at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1354)
        at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1288)
        at java.base/java.net.InetAddress.getByName(InetAddress.java:1238)
        at pvphero/com.pvphero.client.Signlink.run(Signlink.java:165)
        at java.base/java.lang.Thread.run(Thread.java:832)

Here is the C++ code which spawns that process

void Updater::LaunchClient() {
    auto dev = true;

    struct subprocess_s process{};
    int result = -1;

    if (dev) {
        const char *command_line[] = {"java.exe", "-p",
                                      R"(E:\Sync\Insignia\hd-client\out\production\classes;E:\Sync\Insignia\hd-client\out\production\resources)",
                                      "-m", "pvphero/com.pvphero.PvpHero", /*"-hidden",*/ "-live", NULL};
        result = subprocess_create(command_line, subprocess_option_combined_stdout_stderr, &process);
    } else {
        const char *command_line[] = {getJavaPath().c_str(), "-m", "pvphero/com.pvphero.PvpHero",
                                      "-live", /*"-hidden",*/ NULL};
        result = subprocess_create(command_line, 0, &process);
    }

    if (0 != result) {
        std::cout << "Failed" << std::endl;
    }
}

If I run my client from command line with the exact same params as in the C++ code it works.

Screenshot of running the process spawned manually from command line: https://dl.dropboxusercontent.com/s/1566obcus51qxsy/ProcessHacker_iHNItCSlU1.png

Screenshot of the running process spawned via C++/subprocess.h: https://dl.dropboxusercontent.com/s/tazv5eaykbeomvj/ProcessHacker_8pD2audHMF.png

Any idea what could be causing this?

created time in a day

startedbastion-rs/agnostik

started time in a day

startedsheredom/subprocess.h

started time in a day

startednickmqb/wyre

started time in 2 days

issue closedsheredom/ubench.h

WIN + CLANG

closed time in 2 days

DBJDBJ

startedsheredom/hashmap.h

started time in 2 days

startedsheredom/subprocess.h

started time in 2 days

startedsheredom/subprocess.h

started time in 3 days

startedsheredom/subprocess.h

started time in 3 days

issue openedsheredom/subprocess.h

Permanently redirect stdin on child process

I have the following go code that I'm converting to c++


	cmd := exec.Command(javaPath, "-m", "pvphero/com.pvphero.PvpHero", "-live", "-hidden")

	if dev {
		cmd = exec.Command(javaPath, "-p", "E:\\Sync\\Insignia\\hd-client\\out\\production\\classes;E:\\Sync\\Insignia\\hd-client\\out\\production\\resources", "-m", "pvphero/com.pvphero.PvpHero", "-hidden", "-live")
		cmd.Stdout = os.Stdout
		cmd.Stderr = os.Stderr
	}

	fmt.Println("Launching client", cmd)

	_ = cmd.Start()```

I was wondering is there any way to redirect the stdout of my child process to share the same one as its parent process? Or will I just need to make another thread that loops/polls for stdout mesages?

created time in 3 days

startedlunatic-lang/lunatic

started time in 3 days

startedzeux/microprofile

started time in 3 days

startedsheredom/hashmap.h

started time in 4 days

startedsheredom/json.h

started time in 4 days

startedsheredom/utest.h

started time in 4 days

PR opened sheredom/utf8.h

Add travis jobs on ppc64le

Hi, I had added ppc64le(Linux on Power) support on travis-ci in the branch and looks like its been successfully added. I believe it is ready for the final review and merge. The travis ci build logs can be verified from the link below.

https://travis-ci.com/github/manish364824/utf8.h/builds/202988466

Please have a look.

Regards, Manish

+4 -0

0 comment

1 changed file

pr created time in 4 days

fork manish364824/utf8.h

single header utf8 string functions for C and C++

fork in 4 days

startedpoliorcetics/cargo-intraconv

started time in 4 days

startedrune-rs/rune

started time in 4 days

startedsheredom/subprocess.h

started time in 4 days

more