[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

Re: Array implementation of Stack

luserXtrog

7/7/2011 6:53:00 AM

On Wednesday, July 6, 2011 11:59:39 PM UTC-5, io_x wrote:
> "io_x" <a@b.c.invalid> ha scritto nel messaggio
> news:4e06c256$0$15665$4fafbaef@reader2.news.tin.it...
> >
> > u32 IniStack(stack** v, u32 sz)
> > {u32 t;
> > stack *vv;
> > sele *arr;
> >
> > if(sz==0||v==0||sz>0xFFFFFF)
> > R -1;
> > vv = malloc(S(stack));
> > if(vv==0) R -1;
> > t=sz; t*=S(sele);
> > if(t<sz ||t==0||t > 0xFFFFFF)
> > {err: free(vv); *v=0; R -1;}
> > arr=malloc(t); if(t==0) G err;
> > *v=vv; vv->top=-1; vv->size=sz;
> > vv->arr=arr; vv->notUsed=0;
> > R 0;
> > }
>
> the below is one much better language
>
> << top=0, size=4, arr=8, notUsed=12
>
> ;0k,4j,8i,12ra, 16P_v, 20P_sz
> IniStack:
> <i,j,k
> i=^16 |j=^20
> i==0#.e|j<=0?#.e|D*i=0|#.1
> .e: a=-1|stc|#.z
> .1: malloc<(16)|a==0#.e|k=a
> a=j|c=8 |mul c|r#.2
> malloc<(a) |a==0!#.3
> .2: free<(k)|#.e
> .3: *i=k
> D*k+top=-1|D*k+size =j
> D*k+arr= a|D*k+notUsed=0
> a^=a ; => CF==0
> .z:
> >i,j,k
> ret 8
> etc etc
>
> >> top, size, arr, notUsed

Does this great, new language have a name?
As a convention for programming in "C",
it offers a layer of obfuscation
with no apparent benefit.
3 Answers

Ian Collins

7/7/2011 8:02:00 AM

0

On 07/ 7/11 06:53 PM, luser- -droog wrote:

Please don't use the sociopathic "new" google interface, it ruins
threading!.

--
Ian Collins

io_x

7/7/2011 9:35:00 AM

0


"luser- -droog" <mijoryx@yahoo.com> ha scritto nel messaggio
news:25752786-5b5a-41f9-a378-e159e9e9b078@glegroupsg2000goo.googlegroups.com...
> On Wednesday, July 6, 2011 11:59:39 PM UTC-5, io_x wrote:
>> "io_x" <a@b.c.invalid> ha scritto nel messaggio
>> news:4e06c256$0$15665$4fafbaef@reader2.news.tin.it...
>> >
>> > u32 IniStack(stack** v, u32 sz)
>> > {u32 t;
>> > stack *vv;
>> > sele *arr;
>> >
>> > if(sz==0||v==0||sz>0xFFFFFF)
>> > R -1;
>> > vv = malloc(S(stack));
>> > if(vv==0) R -1;
>> > t=sz; t*=S(sele);
>> > if(t<sz ||t==0||t > 0xFFFFFF)
>> > {err: free(vv); *v=0; R -1;}
>> > arr=malloc(t); if(t==0) G err;
>> > *v=vv; vv->top=-1; vv->size=sz;
>> > vv->arr=arr; vv->notUsed=0;
>> > R 0;
>> > }
>>
>> the below is one much better language
>>
>> << top=0, size=4, arr=8, notUsed=12
>>
>> ;0k,4j,8i,12ra, 16P_v, 20P_sz
>> IniStack:
>> <i,j,k
>> i=^16 |j=^20
>> i==0#.e|j<=0?#.e|D*i=0|#.1
>> .e: a=-1|stc|#.z
>> .1: malloc<(16)|a==0#.e|k=a
>> a=j|c=8 |mul c|r#.2
>> malloc<(a) |a==0!#.3
>> .2: free<(k)|#.e
>> .3: *i=k
>> D*k+top=-1|D*k+size =j
>> D*k+arr= a|D*k+notUsed=0
>> a^=a ; => CF==0
>> .z:
>> >i,j,k
>> ret 8
>> etc etc
>>
>> >> top, size, arr, notUsed
>
> Does this great, new language have a name?
> As a convention for programming in "C",

the name i call it is: macro2d

> it offers a layer of obfuscation
> with no apparent benefit.

i'm not agree;
this is the nasm traslation
i don't know if this is right i not had test it

%define top 0
%define size 4
%define arr 8
%define notUsed 12

;0k,4j,8i,12ra, 16P_v, 20P_sz
IniStack:
push esi
push edi
push ebp
mov esi, dword[esp+ 16]
mov edi, dword[esp+ 20]
cmp esi, 0
je .e
cmp edi, 0
jle .e
mov dword[esi], 0
jmp short .1
..e: mov eax, -1
stc
jmp short .z
..1: push 16
call malloc
add esp, 4
cmp eax, 0
je .e
mov ebp, eax
mov eax, edi
mov ecx, 8
mul ecx
cmp edx, 0
jne .2
push eax
call malloc
add esp, 4
cmp eax, 0
jne .3
..2: push ebp
call free
add esp, 4
jmp short .e
..3: mov [esi], ebp
mov dword[ebp+top], -1
mov dword[ebp+size], edi
mov dword[ebp+arr], eax
mov dword[ebp+notUsed], 0
xor eax, eax ; => CF==0
..z:
pop ebp
pop edi
pop esi
ret 8
etc etc

%undef top
%undef size
%undef arr
%undef notUsed




luserXtrog

7/7/2011 6:01:00 PM

0

On Jul 7, 3:02 am, Ian Collins <ian-n...@hotmail.com> wrote:
> On 07/ 7/11 06:53 PM, luser- -droog wrote:
>
> Please don't use the sociopathic "new" google interface, it ruins
> threading!.
>
> --
> Ian Collins

Sorry. I tried the new one when I wasn't seeing any new messages on
the old.
I'm glad the old interface is [working] again.