CS ( ver 0.27.2 ) atualizada.

1. CS ( ver 0.27.2 ) atualizada.

???
gokernel

(usa Linux Mint)

Enviado em 05/12/2013 - 20:12h


Olá !!!

Hoje disponibilizei o CS(Compiled Script) para download ...

Para quem não conhece o CS, é um compilador ( x86 32 bits ) que executa como um script ...

Aqui:
http://code.google.com/p/microasm/downloads/list

WORDS:
static char *words [] = {
"float",
"for",
"function",
"if",
"import",
"int",
"library",
"pchar",
"pvoid",
"while",
NULL
};

Para compilar leia o arquivo ( README.txt ) .

Para testar:
cs script/file.cs


E somente para windows coloquei o modulo ( campus.dll ) da Campus Framework Native for Windows... para testar:

cs campus.cs

[code]

/*
**-------------------------------------------------------------------
**
** Example using the CAMPUS FRAMEWORK(native) for windows.
**
** BY: gokernel - gokernel@hotmail.com
**
**-------------------------------------------------------------------
*/

library campus; // file: campus.dll
import
camInit,
camRun,
camNewWindow,
camNewContainer,
camNewTab,
camNewButton,
camNewEdit,
campusTabNewPage
;

library user32; // file: user32.dll
import
ShowWindow,
GetWindowTextA
;

int count;
pchar string;
pvoid win, tab, container, edit;

string = malloc (100); // <<<<<<<<<< alloc memory to buffer

function call_button1 (o, ev, c)
{
printf("ID: %d - count: %d", c, count);
count++;
}

function call_button2 (o, ev, c)
{
func();
}

function call_edit (o, ev, c)
{
GetWindowTextA (o, string, 99);
printf("Edit Text: '%s'", string);
}

//-----------------------------------------------

camInit();

win = camNewWindow (
300,200,500,400, // x, y, w, h
0, // id
13565952, // flags: WS_OVERLAPPEDWINDOW
0, // parent
"MainWindow", // text
0 // call
);
tab = camNewTab (
10,10,400,300, // x, y, w, h
0, // id
0, // flags:
win, // parent
"SECOND WINDOW", // text
0 // call
);
campusTabNewPage (tab, "Page Zero");
campusTabNewPage (tab, "Page 01");
campusTabNewPage (tab, "Page 02");

camNewButton (
100,100,150,30, // x, y, w, h
100, // id
1342177280, // flags: WS_VISIBLE | WS_CHILD
tab, // parent
"Button 01", // text
call_button1 // call
);

camNewButton (
100,150,150,30, // x, y, w, h
200, // id
1342177280, // flags: WS_VISIBLE | WS_CHILD
tab, // parent
"List func()", // text
call_button2 // call
);

container = camNewContainer (
10,25,250,250, // x, y, w, h
200, // id
0, // flags:
tab, // parent
0, // text
0 // call
);
camNewButton (
50,50,150,30, // x, y, w, h
200, // id
1342177280, // flags: WS_VISIBLE | WS_CHILD
container, // parent
"Get Text", // text
0 // call
);
edit = camNewEdit (
50,100,150,22, // x, y, w, h
200, // id
1350566016, // flags: WS_VISIBLE | WS_CHILD | WS_BORDER | ES_AUTOHSCROLL
container, // parent
"Edit Text", // text
call_edit // call
);


ShowWindow (win,1);

camRun (); // main loop

//-----------------------------------------------

[code]


Abraço !




  


2. Re: CS ( ver 0.27.2 ) atualizada.

???
gokernel

(usa Linux Mint)

Enviado em 12/12/2013 - 20:49h



Atualizada com ( struct e ponteiro de struct ) - BETA.

Um pequeno exemplo:



int i;

struct _data
{
int x;
int y;
int z;
};

struct _data win[10];
struct _data *p;

win[0].x=100;
win[0].y=200;
win[0].z=300;

win[1].x=400;
win[1].y=500;
win[1].z=600;

win[2].x=777;
win[2].y=888;
win[2].z=999;

p = win;

for (i = 0; i < 3; i++)
{
printf ("win [ %d ] = %d, %d, %d", i, p->x, p->y, p->z );

p += 12; // increment from sizeof ( _data ): 12
}

p = win;

p->x = 55; // NOW ( win[0].x ) = 55
p->y = 1500; // NOW ( win[0].y ) = 1500

printf("win[ 0 ].x: %d, win[ 0 ].y: %d", win[0].x, win[0].y );





3. Re: CS ( ver 0.27.2 ) atualizada.

???
gokernel

(usa Linux Mint)

Enviado em 19/12/2013 - 12:19h


CS(Compiled Script) atulizada:

Aqui:
http://code.google.com/p/microasm/downloads/list

WORDS:
static char *words [] = {
"asm",
"char", // char *str;
"float",
"for",
"function",
"if",
"import",
"int",
"library",
"loop",
"pvoid",
"struct",
"while",
NULL
};

exemplo usando word loop:



int i;

function display ()
{
printf("Value: %d\n",i);
}

loop (30)
{
asm ("mov %ecx, i");

asm ("push %ecx"); // save %ecx
display ();
asm ("pop %ecx"); // restore %ecx
}






4. Re: CS ( ver 0.27.2 ) atualizada.

???
gokernel

(usa Linux Mint)

Enviado em 26/12/2013 - 09:48h


Atualizada 0.28.9:

WORDS:

static char *words [] = {
"asm",
"char", // char *str;
"float",
"for",
"function",
"goto",
"if",
"import",
"include",
"int",
"library",
"loop",
"pvoid",
"short",
"struct",
"while",
NULL
};

"#define"




Um pequeno exemplo em SDL PURO:



//-------------------------------------------------------------------
//
// DESC:
// A complet program using PURE SDL only...
//
// FILE: sdl_pure.cs
//
// USAGE: cs sdl_pure.cs
//
// BY: gokernel - gokernel@hotmail.com
//
//-------------------------------------------------------------------

library
SDL // on windows file ( SDL.dll )
libSDL // on linux file ( libSDL.so )
;

import
SDL_Init
SDL_putenv
SDL_PollEvent
SDL_SetVideoMode
SDL_FillRect
SDL_Flip
SDL_Delay
SDL_Quit
;

#define SDL_KEYUP 3
#define SDL_MOUSEMOTION 4
#define SDL_MOUSEBUTTONDOWN 5

struct SDL_Rect
{
short x;
short y;
short w;
short h;
};
struct SDL_Rect *r;

struct SDL_Surface
{
// Uint32 flags;

// SDL_PixelFormat *format;

// int w, h;

int flags; // 0:

int format; // 4: this is a *pointer

int w; // 8:
int h; // 12:
};
struct SDL_Surface *screen;

struct event
{
char type;

char a;
char b;
char c;

short x; // 4: mouse_x
short y; // mouse_y

//
// ... bla bla bla
//
};
struct event *ev;

int count;

function main()
{
SDL_Init (32); // 32 = SDL_INIT_VIDEO
SDL_putenv ("SDL_VIDEO_CENTERED=center");
screen = SDL_SetVideoMode (800,600,32,0);

ev = malloc (200); // nao sei o tamanho rarsa , pressa ;)

r = malloc (8);

r->x = 100;
r->y = 100;
r->w = 300;
r->h = 400;
SDL_FillRect (screen, r, 16744990); // orange
r->x = 10;
r->y = 10;
r->w = 150;
r->h = 30;
SDL_FillRect (screen, r, 15657694); // rectangle in top: quit ;)

SDL_Flip (screen);

for (;;) //<<<<<<<<<< MAIN LOOP >>>>>>>>>>
{
if (SDL_PollEvent(ev))
{
if (ev->type == SDL_MOUSEMOTION) {
printf ("MOTION: %d %d\n", ev->x, ev->y);
}

if (ev->type == SDL_MOUSEBUTTONDOWN)
{
printf ("CLICK ON SCREEN: %d %d\n", ev->x, ev->y);

// QUIT: click in rectangle in the top
//
if (ev->x > r->x && ev->y > r->y && ev->x < r->x+r->w && ev->y < r->y+r->h)
{
goto label_end;
}
}

if (ev->type == SDL_KEYUP) {
goto label_end;
}

}

SDL_Delay (10);
}

label_end:

SDL_Quit ();
}

main();










Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts