Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #7812 > unrolled thread

Re: Array implementation of Stack

Started byluser- -droog <mijoryx@yahoo.com>
First post2011-07-06 23:53 -0700
Last post2011-07-07 11:34 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.lang.c


Contents

  Re: Array implementation of Stack luser- -droog <mijoryx@yahoo.com> - 2011-07-06 23:53 -0700
    Re: Array implementation of Stack Ian Collins <ian-news@hotmail.com> - 2011-07-07 20:02 +1200
      Re: Array implementation of Stack luser- -droog <mijoryx@yahoo.com> - 2011-07-07 11:00 -0700
    Re: Array implementation of Stack "io_x" <a@b.c.invalid> - 2011-07-07 11:34 +0200

#7812 — Re: Array implementation of Stack

Fromluser- -droog <mijoryx@yahoo.com>
Date2011-07-06 23:53 -0700
SubjectRe: Array implementation of Stack
Message-ID<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", 
it offers a layer of obfuscation 
with no apparent benefit.

[toc] | [next] | [standalone]


#7820

FromIan Collins <ian-news@hotmail.com>
Date2011-07-07 20:02 +1200
Message-ID<97l7hfFbcvU2@mid.individual.net>
In reply to#7812
On 07/ 7/11 06:53 PM, luser- -droog wrote:

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

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#7861

Fromluser- -droog <mijoryx@yahoo.com>
Date2011-07-07 11:00 -0700
Message-ID<c0fb6d98-ab8c-415d-a280-dad057abc94d@t5g2000yqj.googlegroups.com>
In reply to#7820
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.

[toc] | [prev] | [next] | [standalone]


#7822

From"io_x" <a@b.c.invalid>
Date2011-07-07 11:34 +0200
Message-ID<4e157d4f$0$44204$4fafbaef@reader1.news.tin.it>
In reply to#7812
"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



[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web