Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Symta v0.2

Name: Anonymous 2012-12-08 11:36

Ok. I put out the second release of Symta: http://sym.at.ua/load

Also the SymCraft/LispCraft sources are under 1100 lines (http://sym.at.ua/photo), including UI and a simple AI.

Name: Anonymous 2012-12-13 15:29

>>125
Sorry, I'm terrible at writing anything or communicating any information to others. That is why I'm still unemployed at my 30 years.

>>122>>121
Symta:

<[X@Xs]=[@Xs,r X]>


C/C++:

char * reverse(const char * in, char * out, size_t out_len){
    out[out_len - 1] = 0;
    int i = 0;
    while(!(out[out_len - 1 - i] = in_str[i]))
        ++i;
    return &(out[out_len - 1 - i]);
}


Symta:

get FileName |c:[T:@4.utf8 L:@4.ul D:@L.y @Xs] [[T D] @Xs,r]


C/C++:

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

typedef struct chunk {
  uint8_t Tag[5];
  uint32_t Len;
  uint8_t *Data;
  struct chunk *Next;
} chunk;

chunk *loadChunks(char *FileName) {
  int I, L;
  uint8_t *D, *P, *E;
  chunk *C=0, *T, *N;
  FILE *F = fopen(FileName, "r");
  fseek(F, 0, SEEK_END);
  L = ftell(F);
  D = P = (uint8_t *)malloc(L);
  E = P+L;
  fseek(F, 0, SEEK_SET);
  fread(D, 1, L, F);
  fclose(F);

  while (P < E) {
    T = (chunk *)malloc(sizeof(chunk));
    memcpy(T->Tag, P, 4);
    T->Tag[4] = 0;
    P += 4;
    T->Len = *(uint32_t *)P;
    P += 4;
    T->Data = (uint8_t *)malloc(T->Len);
    memcpy(T->Data, P, T->Len);
    P += T->Len;
    T->Next = C;
    C = T;
  }

  for (T = 0; C; C = N) {
    N = C->Next;
    C->Next = T;
    T = C;
  }

  free(D);
  return T;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List