Follow

Rewrote the 100R website as an extremely simple wiki(200 lines of C89) with redlinks, templating and includes support.

Anyone interested in creating a static wiki, and learning a bit of C at the same time, might be interested in forking it to build their own wiki.

Lemme know if you have any question~

github.com/hundredrabbits/100r

@neauoire@merveilles.town this is the most legible code i have ever read. thank you.

@neauoire
there are some functions from stdlib you could use to avoid defining extras

from string.h : strlen, strcat, strstr, strcmp
from ctype.h : toupper, tolower

@neauoire out of curiosity have you measured them to see if they were faster/ smaller than the stdlib ones?

I was forced write some of these once because I couldn’t fit the import of strings.h in a chip and was amazed how much space I saved.

@jameschip I haven't, but I love implementing these very basic things in my projects. It demystifies a lot of the magic.

@neauoire yeah, certainly some of the string functions seem like black magic at times until you actually look at them.

@neauoire I have been looking to rewrite my site generator as something more minimalistic and maintainable than the 1000-line bash script it currently is.

I had looked at oscean a while back for inspiration but this is even better!

@nilix Oscean is not minimalist, it includes a lot more than just a wiki. This is a way better starting point :)

@neauoire Haha yes wide and deep it spans, as the name suggests :p

@neauoire other than building your own tools and learning, is it also a goal of running left, orca, etc in uxn to save battery?

@neauoire I understand this runs in a emulator/vm of sorts? I'm not technical at all so maybe it's just ignorance when I assumed that emulators and VM inflict battery penalties over non-emulated apps. How can this be? 😅

@mario Well, emulators are not as efficient as native apps, but the vm being 8-bit helps, I've done a tiny bit of benchmarking, and unless I make the SDL version of the apps super strict(casting everything as Uint8) the emulator seems to be just as fast, and sometimes even faster for drawing sprites.

@mario I would also like to port a weatherfax and various other boat utilities to it :)

@neauoire I'm having a little trouble understanding how your version of "strcmp" works.

`char *scpy(char *src, char *dst, int len) {
int i = 0;
while((dst[i] = src[i]) && i < len - 2)
i++;
dst[i + 1] = '\0';
return dst;
}`

Is dst an allocated block of memory for the string? If you're writing to the pointer, why are you returning it? Wouldn't the memory block be written in the function anyway?

@neauoire I rebuilt the site locally w/ gcc - no probs except got an Error:Orphaned message for about 20 files. Any idea what that might be about?

@dokoissho yeah we have a ton of orphans on the site right now as we migrate the content over to the new format :)

@neauoire oh ok, was just wondering if I was doing something wrong...

Sign in to participate in the conversation
Merveilles

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.