Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

RADIO SHACK LEVEL II BASIC READY >_


devel / comp.lang.c / Re: what about this pattern?

SubjectAuthor
* what about this pattern?fir
+* Re: what about this pattern?fir
|`* Re: what about this pattern?Ben
| `* Re: what about this pattern?fir
|  +- Re: what about this pattern?fir
|  `* Re: what about this pattern?Ben
|   +- Re: what about this pattern?fir
|   `- Re: what about this pattern?fir
+* Re: what about this pattern?Andrey Tarasevich
|+* Re: what about this pattern?fir
||`- Re: what about this pattern?fir
|`* Re: what about this pattern?fir
| `- Re: what about this pattern?fir
`* Re: what about this pattern?fir
 +- Re: what about this pattern?fir
 `- Re: what about this pattern?fir

1
what about this pattern?

<9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21545&group=comp.lang.c#21545

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:494:b0:2f3:40ad:fe64 with SMTP id p20-20020a05622a049400b002f340adfe64mr24821543qtx.424.1651183261946;
Thu, 28 Apr 2022 15:01:01 -0700 (PDT)
X-Received: by 2002:a05:622a:14cb:b0:2e1:9fc5:424d with SMTP id
u11-20020a05622a14cb00b002e19fc5424dmr24499905qtx.543.1651183261742; Thu, 28
Apr 2022 15:01:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 28 Apr 2022 15:01:01 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.86; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.86
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
Subject: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Thu, 28 Apr 2022 22:01:01 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 44
 by: fir - Thu, 28 Apr 2022 22:01 UTC

void expression_list(unsigned command, int i, int j)
{ struct list { int x; int y; };
static list* ram = NULL;
static int size = 0;

if(command=='add') {
ram = (list*) realloc(ram, size++ * sizeof(list) );
ram[size-1] = {i,j};
}

if(command=='reset') {
ram = (list*) realloc(ram, (size=0) * sizeof(list) );
}

if(command=='dump') {
for(int i=0; i<size; i++)
printf("\n %d: %d %d ", i, ram[i].x, ram[i].y);
}
if(command=='print sum') {
int sum_x =0 ; int sum_y =0 ;
for(int i=0; i<size; i++)
{
sum_x += ram[i].x;
sum_y += ram[i].y;
}
printf("\n sum: %d %d ", sum_x, sum_y);

}

return ;
}

this may be seen childish but for some reasons i found it as probably good and worth using as it may allow me to 'streamline' my c code and even increase productivity and code clarity

you use it obviously

expression_list('add', 1,222);
expression_list('add', 2,211);
expression_list('add', 3,22);
expression_list('add', 4,133);
expression_list('dump', 0,0);
expression_list('print sum',0,0);

Re: what about this pattern?

<d9f1d699-c223-4327-bb9f-3169da950da3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21546&group=comp.lang.c#21546

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a0c:c24e:0:b0:456:4217:8cb6 with SMTP id w14-20020a0cc24e000000b0045642178cb6mr13869848qvh.12.1651187256616;
Thu, 28 Apr 2022 16:07:36 -0700 (PDT)
X-Received: by 2002:ac8:7d50:0:b0:2f1:f199:3f57 with SMTP id
h16-20020ac87d50000000b002f1f1993f57mr25134196qtb.525.1651187256446; Thu, 28
Apr 2022 16:07:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 28 Apr 2022 16:07:36 -0700 (PDT)
In-Reply-To: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.82; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.82
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d9f1d699-c223-4327-bb9f-3169da950da3n@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Thu, 28 Apr 2022 23:07:36 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 82
 by: fir - Thu, 28 Apr 2022 23:07 UTC

there is a bug above should be ++size not size++

besides the name expresion_list is here becouse i added this experimenting with code that
will give me the boundaries of expresions like 2+ 3 b/b++ siz.a.b.c* (2 + 3) when they are not separated by commas or semicolons but just spaces

void FindExpressionsBoundaries()
{ chunk txt = Chunk(" a*b + c*(f++)/size_x 100-400/c/f.a + 40 c * c * doo(a b c) -100.33");

chunks atoms = LineAtomizer4furia(txt);
int len = ChunksLength(atoms);

PrintChunks(atoms);

int expression_begin = 0;
int expression_end = -1;

expression_list('reset',-1,-1);

for(int i=0; i<len; i++)
{
if( !IsPunctuation(atoms.first[i ].end[0]) )
if( i+1<len) if(!IsPunctuation(atoms.first[i+1].beg[0]) )
{
expression_end = i;
expression_list('add', expression_begin, expression_end );
expression_begin = i+1;
}
}
expression_end = len-1;
expression_list('add', expression_begin, expression_end );
expression_list('dump', -1, -1 );

}

gives

0 a
1 *
2 b
3 +
4 c
5 *
6 (
7 f
8 +
9 +
10 )
11 /
12 size_x
13 100
14 -
15 400
16 /
17 c
18 /
19 f
20 .
21 a
22 +
23 40
24 c
25 *
26 c
27 *
28 doo
29 (
30 a
31 b
32 c
33 )
34 -
35 100
36 .
37 33
0: 0 12
1: 13 23
2: 24 30
3: 31 31
4: 32 37

the code may not look very good but its dam easy to composite use and reuse

Re: what about this pattern?

<t4f7ma$psf$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21547&group=comp.lang.c#21547

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: andreyta...@hotmail.com (Andrey Tarasevich)
Newsgroups: comp.lang.c
Subject: Re: what about this pattern?
Date: Thu, 28 Apr 2022 16:23:53 -0700
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <t4f7ma$psf$1@dont-email.me>
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Apr 2022 23:23:54 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f317a1cdae66e3fe6a14b1ad6c1b7d11";
logging-data="26511"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18523UQ+AdY4eaKUGnvEnZf"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
Cancel-Lock: sha1:HqWCzfewPeEOhOG/ZgKlyOdvd8k=
In-Reply-To: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
Content-Language: en-US
 by: Andrey Tarasevich - Thu, 28 Apr 2022 23:23 UTC

On 4/28/2022 3:01 PM, fir wrote:
> you use it obviously

Multicharacter character constants produce implementation-defined values.

On a 32-bit-int platform a 2-4 character multicharacter character
constant is indeed viable for some uses, as long as you know what you
are doing and assuming that your compiler does what compilers "normally"
do in such cases.

But more than 4? That's just asking for trouble.

The code creates an illusion of something that isn't really there. And
it is not immediately obvious how that illusion works. E.g. even if your
compiler promises to concatenate up to 4 bytes, does it keep the first 4
or the last 4?

So no, longish multicharacter character constants are not a good
pattern. "Short" multicharacter character constants are acceptable when
you know what you are doing.

--
Best regards,
Andrey Tarasevich

Re: what about this pattern?

<59cdedf9-dda3-4271-8533-28e8cf808c20n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21548&group=comp.lang.c#21548

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:a90e:0:b0:69f:9b8f:86b4 with SMTP id s14-20020a37a90e000000b0069f9b8f86b4mr5041593qke.513.1651188836598;
Thu, 28 Apr 2022 16:33:56 -0700 (PDT)
X-Received: by 2002:a05:622a:181a:b0:2f3:93ac:6859 with SMTP id
t26-20020a05622a181a00b002f393ac6859mr373613qtc.74.1651188836448; Thu, 28 Apr
2022 16:33:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 28 Apr 2022 16:33:56 -0700 (PDT)
In-Reply-To: <t4f7ma$psf$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.82; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.82
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com> <t4f7ma$psf$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <59cdedf9-dda3-4271-8533-28e8cf808c20n@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Thu, 28 Apr 2022 23:33:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 44
 by: fir - Thu, 28 Apr 2022 23:33 UTC

piątek, 29 kwietnia 2022 o 01:24:07 UTC+2 Andrey Tarasevich napisał(a):
> On 4/28/2022 3:01 PM, fir wrote:
> > you use it obviously
>
> Multicharacter character constants produce implementation-defined values.
>
> On a 32-bit-int platform a 2-4 character multicharacter character
> constant is indeed viable for some uses, as long as you know what you
> are doing and assuming that your compiler does what compilers "normally"
> do in such cases.
>
> But more than 4? That's just asking for trouble.
>
> The code creates an illusion of something that isn't really there. And
> it is not immediately obvious how that illusion works. E.g. even if your
> compiler promises to concatenate up to 4 bytes, does it keep the first 4
> or the last 4?
>
> So no, longish multicharacter character constants are not a good
> pattern. "Short" multicharacter character constants are acceptable when
> you know what you are doing.
>
i know, there was discusiion on this here back then, i think on 64 bit there can be used 64 bit unsigned and thats nice 8 characters ..
here i dont much care as tis was side for ilustrating whole pattern and this 'command' format is a
side thing ..one could eventually use enum but i prefer this 'things' which i called ad-hoc enums and find
it great, ..i would probably prefer using it as i use and dont care being just aware when it may faiul and avoiding it using a bit of my brain

yhe thread is more n this pattern...i didnt seem it used i think its generally unused and i also
never used it (though once or twice i thinked on it)...i think people find it unnefective and thus stoped
them for thinking on it (also as nobody thinking on this then nobody thinking on this too) but doing some thinking shows to me that is in fact so good it just most probably should be in wide use..it simplifies codes a lot (and im happy with that at least some new idea in my head at least)

Re: what about this pattern?

<87wnf8iwas.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21549&group=comp.lang.c#21549

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben)
Newsgroups: comp.lang.c
Subject: Re: what about this pattern?
Date: Fri, 29 Apr 2022 01:10:35 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <87wnf8iwas.fsf@bsb.me.uk>
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
<d9f1d699-c223-4327-bb9f-3169da950da3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="28a3eaa5666d04574daca2435f7f1340";
logging-data="2425"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Y8xTyhIzW0Um2a8pBb1A6tbxobcY5bds="
Cancel-Lock: sha1:spdFUFcwOeApuasOp81hg9sW8eE=
sha1:iXDPgHzJkrNI9AuqNL1Eyi8BXYE=
X-BSB-Auth: 1.49a1f7517480f2881b88.20220429011035BST.87wnf8iwas.fsf@bsb.me.uk
 by: Ben - Fri, 29 Apr 2022 00:10 UTC

fir <profesor.fir@gmail.com> writes:

> void FindExpressionsBoundaries()
> {
> chunk txt = Chunk(" a*b + c*(f++)/size_x 100-400/c/f.a + 40 c * c * doo(a b c) -100.33");
>
> chunks atoms = LineAtomizer4furia(txt);
> int len = ChunksLength(atoms);
>
> PrintChunks(atoms);
<cut>
> gives
>
> 0 a
> 1 *
> 2 b
> 3 +
> 4 c
> 5 *
> 6 (
> 7 f
> 8 +
> 9 +

How will you distinguish between "++x" and "+ +x"?

--
Ben.

Re: what about this pattern?

<ed8be5b1-280a-4b3c-8ee5-077d4398450an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21550&group=comp.lang.c#21550

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:a18:b0:69f:97af:c06f with SMTP id i24-20020a05620a0a1800b0069f97afc06fmr6003881qka.561.1651192241146;
Thu, 28 Apr 2022 17:30:41 -0700 (PDT)
X-Received: by 2002:a05:620a:424e:b0:67e:4c1b:baef with SMTP id
w14-20020a05620a424e00b0067e4c1bbaefmr21844562qko.778.1651192241013; Thu, 28
Apr 2022 17:30:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 28 Apr 2022 17:30:40 -0700 (PDT)
In-Reply-To: <87wnf8iwas.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.199; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.199
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
<d9f1d699-c223-4327-bb9f-3169da950da3n@googlegroups.com> <87wnf8iwas.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ed8be5b1-280a-4b3c-8ee5-077d4398450an@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 00:30:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 29
 by: fir - Fri, 29 Apr 2022 00:30 UTC

piątek, 29 kwietnia 2022 o 02:11:02 UTC+2 Ben napisał(a):
> fir <profes...@gmail.com> writes:
>
> > void FindExpressionsBoundaries()
> > {
> > chunk txt = Chunk(" a*b + c*(f++)/size_x 100-400/c/f.a + 40 c * c * doo(a b c) -100.33");
> >
> > chunks atoms = LineAtomizer4furia(txt);
> > int len = ChunksLength(atoms);
> >
> > PrintChunks(atoms);
> <cut>
> > gives
> >
> > 0 a
> > 1 *
> > 2 b
> > 3 +
> > 4 c
> > 5 *
> > 6 (
> > 7 f
> > 8 +
> > 9 +
> How will you distinguish between "++x" and "+ +x"?
>
i not thinked on this yet..this code is not finished (as it seen it works bad as it broke on args of nested function )... i need to invent some rule but the pattern i said simplify coding this a lot

Re: what about this pattern?

<06305aca-b4e5-40f0-9946-432671cfaf27n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21551&group=comp.lang.c#21551

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:284:b0:2f3:942e:ddb with SMTP id z4-20020a05622a028400b002f3942e0ddbmr161875qtw.557.1651192780139;
Thu, 28 Apr 2022 17:39:40 -0700 (PDT)
X-Received: by 2002:a37:b605:0:b0:69e:6d6f:aea7 with SMTP id
g5-20020a37b605000000b0069e6d6faea7mr21122205qkf.655.1651192780013; Thu, 28
Apr 2022 17:39:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 28 Apr 2022 17:39:39 -0700 (PDT)
In-Reply-To: <59cdedf9-dda3-4271-8533-28e8cf808c20n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.199; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.199
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
<t4f7ma$psf$1@dont-email.me> <59cdedf9-dda3-4271-8533-28e8cf808c20n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <06305aca-b4e5-40f0-9946-432671cfaf27n@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 00:39:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 127
 by: fir - Fri, 29 Apr 2022 00:39 UTC

piątek, 29 kwietnia 2022 o 01:34:03 UTC+2 fir napisał(a):
> a lot (and im happy with that at least some new idea in my head at least)

i dont know how to name this pattern, temporarely maybe i will name it functoid (functolist?) pattern

i made some test of efficiency out of curiiosity

inline void int_list(unsigned long long command, int i)
{ // printf("\n size of %d", sizeof(command));

struct list { int x; };
static list* ram = NULL;
static int storage = 1000;
static int size = 0;

if(command=='quick add')
{
size++;
ram[size-1].x = i;
return;

}

if(command=='prealoc')
{
storage=i;
size = 0;
ram = (list*) realloc(ram, storage * sizeof(list) );
return;
}

if(command=='add') {
size++;
if(size>=storage) storage*=4;
ram = (list*) realloc(ram, storage * sizeof(list) );
ram[size-1].x = i;
return;

}

if(command=='reset') {
storage=size=0;
ram = (list*) realloc(ram, storage * sizeof(list) );
return;

}

if(command=='dump') {
for(int i=0; i<size; i++)
printf("\n %d: %d ", i, ram[i].x);
return;

}
if(command=='print sum') {
int sum_x =0 ;
for(int i=0; i<size; i++) {
sum_x += ram[i].x;
}
printf("\n sum: %d ", sum_x);
return;

}

return ;
}

//////////

and such tests

TakeDeltaTimeNS(1);

for(int i=0; i<1000000; i++)
int_list('add', i);

int_list('print sum',-1);

double x = TakeDeltaTimeNS(1);

printf("(executed in %4.6f s)", x/1000/1000/1000);

TakeDeltaTimeNS(1);

int_list('prealoc',1000100);

for(int i=0; i<1000000; i++)
int_list('quick add', i);

int_list('print sum',-1);

x = TakeDeltaTimeNS(1);

printf("(executed in %4.6f s)", x/1000/1000/1000);

int list[1000000];

TakeDeltaTimeNS(1);

for(int i=0; i<1000000; i++)
list[i]=i;

int sum = 0;
for(int i=0; i<1000000; i++)
sum+=i;

printf("\n sum: %d", sum);

x = TakeDeltaTimeNS(1);

printf("(executed in %4.6f s)", x/1000/1000/1000);

gives :
um: 1783293664 (executed in 0.091765 s)
sum: 1783293664 (executed in 0.003252 s)
sum: 1783293664(executed in 0.000219 s)

this version that resizes on the run is slow 450x slower than native, that if is costly probably,
this with presetting size 15x slower which is sorta standable (depending how someone see things)

Re: what about this pattern?

<93802e1c-6e30-4c42-a8d8-e44a551e7b1an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21552&group=comp.lang.c#21552

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:21a7:b0:441:1434:eafd with SMTP id t7-20020a05621421a700b004411434eafdmr26293979qvc.77.1651193366556;
Thu, 28 Apr 2022 17:49:26 -0700 (PDT)
X-Received: by 2002:a05:620a:4625:b0:69f:6a9a:ccd5 with SMTP id
br37-20020a05620a462500b0069f6a9accd5mr12092098qkb.626.1651193366430; Thu, 28
Apr 2022 17:49:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 28 Apr 2022 17:49:26 -0700 (PDT)
In-Reply-To: <ed8be5b1-280a-4b3c-8ee5-077d4398450an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.199; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.199
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
<d9f1d699-c223-4327-bb9f-3169da950da3n@googlegroups.com> <87wnf8iwas.fsf@bsb.me.uk>
<ed8be5b1-280a-4b3c-8ee5-077d4398450an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <93802e1c-6e30-4c42-a8d8-e44a551e7b1an@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 00:49:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: fir - Fri, 29 Apr 2022 00:49 UTC

piątek, 29 kwietnia 2022 o 02:30:48 UTC+2 fir napisał(a):
> piątek, 29 kwietnia 2022 o 02:11:02 UTC+2 Ben napisał(a):
> > fir <profes...@gmail.com> writes:
> >
> > > void FindExpressionsBoundaries()
> > > {
> > > chunk txt = Chunk(" a*b + c*(f++)/size_x 100-400/c/f.a + 40 c * c * doo(a b c) -100.33");
> > >
> > > chunks atoms = LineAtomizer4furia(txt);
> > > int len = ChunksLength(atoms);
> > >
> > > PrintChunks(atoms);
> > <cut>
> > > gives
> > >
> > > 0 a
> > > 1 *
> > > 2 b
> > > 3 +
> > > 4 c
> > > 5 *
> > > 6 (
> > > 7 f
> > > 8 +
> > > 9 +
> > How will you distinguish between "++x" and "+ +x"?
> >
> i not thinked on this yet..this code is not finished (as it seen it works bad as it broke on args of nested function )... i need to invent some rule but the pattern i said simplify coding this a lot

you may propose some rule or code if you want... i stopped thinking on this when coding this as i began to study this mentioned pattern more than the extracting expressions task

Re: what about this pattern?

<87a6c4isop.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21553&group=comp.lang.c#21553

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben)
Newsgroups: comp.lang.c
Subject: Re: what about this pattern?
Date: Fri, 29 Apr 2022 02:28:38 +0100
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <87a6c4isop.fsf@bsb.me.uk>
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
<d9f1d699-c223-4327-bb9f-3169da950da3n@googlegroups.com>
<87wnf8iwas.fsf@bsb.me.uk>
<ed8be5b1-280a-4b3c-8ee5-077d4398450an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="28a3eaa5666d04574daca2435f7f1340";
logging-data="7502"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19C97GxkqDSV+0rRgtkfV+wPa6caPvXetU="
Cancel-Lock: sha1:qqJrD3VQ5Z6tbRm2gINR2Z8FNbg=
sha1:PmgsNAAI1WlUI/RrrL11NfCSl3g=
X-BSB-Auth: 1.0ccc8fc68126d6a5d6ac.20220429022838BST.87a6c4isop.fsf@bsb.me.uk
 by: Ben - Fri, 29 Apr 2022 01:28 UTC

fir <profesor.fir@gmail.com> writes:

> piątek, 29 kwietnia 2022 o 02:11:02 UTC+2 Ben napisał(a):
>> fir <profes...@gmail.com> writes:
>>
>> > void FindExpressionsBoundaries()
>> > {
>> > chunk txt = Chunk(" a*b + c*(f++)/size_x 100-400/c/f.a + 40 c * c * doo(a b c) -100.33");
>> >
>> > chunks atoms = LineAtomizer4furia(txt);
>> > int len = ChunksLength(atoms);
>> >
>> > PrintChunks(atoms);
>> <cut>
>> > gives
>> >
>> > 0 a
>> > 1 *
>> > 2 b
>> > 3 +
>> > 4 c
>> > 5 *
>> > 6 (
>> > 7 f
>> > 8 +
>> > 9 +
>> How will you distinguish between "++x" and "+ +x"?
>>
> i not thinked on this yet..this code is not finished (as it seen it
> works bad as it broke on args of nested function )... i need to invent
> some rule but the pattern i said simplify coding this a lot

Sometimes it helps to think about things before you code too much. Once
you have only the three 'atoms' +, + and x it's too late to be able to
tell what the expression should be.

--
Ben.

Re: what about this pattern?

<08d546a1-6821-49df-84e1-47a311bc796en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21554&group=comp.lang.c#21554

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:2f04:0:b0:663:397d:7051 with SMTP id v4-20020a372f04000000b00663397d7051mr21904988qkh.333.1651216429846;
Fri, 29 Apr 2022 00:13:49 -0700 (PDT)
X-Received: by 2002:a05:6214:212c:b0:443:cacc:ee8 with SMTP id
r12-20020a056214212c00b00443cacc0ee8mr26782279qvc.96.1651216429708; Fri, 29
Apr 2022 00:13:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 29 Apr 2022 00:13:49 -0700 (PDT)
In-Reply-To: <87a6c4isop.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.70; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.70
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
<d9f1d699-c223-4327-bb9f-3169da950da3n@googlegroups.com> <87wnf8iwas.fsf@bsb.me.uk>
<ed8be5b1-280a-4b3c-8ee5-077d4398450an@googlegroups.com> <87a6c4isop.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <08d546a1-6821-49df-84e1-47a311bc796en@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 07:13:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 44
 by: fir - Fri, 29 Apr 2022 07:13 UTC

piątek, 29 kwietnia 2022 o 03:28:51 UTC+2 Ben napisał(a):
> fir <profes...@gmail.com> writes:
>
> > piątek, 29 kwietnia 2022 o 02:11:02 UTC+2 Ben napisał(a):
> >> fir <profes...@gmail.com> writes:
> >>
> >> > void FindExpressionsBoundaries()
> >> > {
> >> > chunk txt = Chunk(" a*b + c*(f++)/size_x 100-400/c/f.a + 40 c * c * doo(a b c) -100.33");
> >> >
> >> > chunks atoms = LineAtomizer4furia(txt);
> >> > int len = ChunksLength(atoms);
> >> >
> >> > PrintChunks(atoms);
> >> <cut>
> >> > gives
> >> >
> >> > 0 a
> >> > 1 *
> >> > 2 b
> >> > 3 +
> >> > 4 c
> >> > 5 *
> >> > 6 (
> >> > 7 f
> >> > 8 +
> >> > 9 +
> >> How will you distinguish between "++x" and "+ +x"?
> >>
> > i not thinked on this yet..this code is not finished (as it seen it
> > works bad as it broke on args of nested function )... i need to invent
> > some rule but the pattern i said simplify coding this a lot
> Sometimes it helps to think about things before you code too much. Once
> you have only the three 'atoms' +, + and x it's too late to be able to
> tell what the expression should be.
>
im not sure what you re talking aboput .. in c there are rules thay says
what such thing as x++++y are and if i need to check if space is before something
i may write IsWhitespace(atom[i].beg[-1]) becouse pointers in chonks point into
pointers in oryginal text so no problem to read there

Re: what about this pattern?

<506e3e5b-0a92-401b-9303-010988c29dcan@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21556&group=comp.lang.c#21556

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:d87:b0:67b:311c:ecbd with SMTP id q7-20020a05620a0d8700b0067b311cecbdmr22136077qkl.146.1651219096914;
Fri, 29 Apr 2022 00:58:16 -0700 (PDT)
X-Received: by 2002:a37:9d82:0:b0:69f:9cc9:135d with SMTP id
g124-20020a379d82000000b0069f9cc9135dmr5648815qke.371.1651219096775; Fri, 29
Apr 2022 00:58:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 29 Apr 2022 00:58:16 -0700 (PDT)
In-Reply-To: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.70; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.70
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <506e3e5b-0a92-401b-9303-010988c29dcan@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 07:58:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 128
 by: fir - Fri, 29 Apr 2022 07:58 UTC

piątek, 29 kwietnia 2022 o 00:01:10 UTC+2 fir napisał(a):
> void expression_list(unsigned command, int i, int j)
> {
> struct list { int x; int y; };
> static list* ram = NULL;
> static int size = 0;
>
> if(command=='add') {
> ram = (list*) realloc(ram, size++ * sizeof(list) );
> ram[size-1] = {i,j};
> }
>
> if(command=='reset') {
> ram = (list*) realloc(ram, (size=0) * sizeof(list) );
> }
>
> if(command=='dump') {
> for(int i=0; i<size; i++)
> printf("\n %d: %d %d ", i, ram[i].x, ram[i].y);
> }
> if(command=='print sum') {
> int sum_x =0 ; int sum_y =0 ;
> for(int i=0; i<size; i++)
> {
> sum_x += ram[i].x;
> sum_y += ram[i].y;
> }
> printf("\n sum: %d %d ", sum_x, sum_y);
>
> }
>
> return ;
> }
>
> this may be seen childish but for some reasons i found it as probably good and worth using as it may allow me to 'streamline' my c code and even increase productivity and code clarity
>
> you use it obviously
>
> expression_list('add', 1,222);
> expression_list('add', 2,211);
> expression_list('add', 3,22);
> expression_list('add', 4,133);
> expression_list('dump', 0,0);
> expression_list('print sum',0,0);

one could ask why not use (c way)

expression_list_add(1,222);
expression_list_add'(2,211);
expression_list_add( 3,22);
expression_list_add'( 4,133);
expression_list_dump();
expression_list_print_sum();

which is faster (at least on cost of one to few if each time and also dont need to pass those unused
values and also is more general, or some c++ way like (probably as i dont use c++)

Expression_list expression_list();
expression_list.add(1,222);
expression_list.add'(2,211);
expression_list.add( 3,22);
expression_list.add'( 4,133);
expression_list.dump();
expression_list.print_sum();
~expression_list();

or micromodular c way
Expression_list expression_list
expression_list.add(1,222);
expression_list.add'(2,211);
expression_list.add( 3,22);
expression_list.add'( 4,133);
expression_list.dump();
expression_list.print_sum();

but there are some differences (and sad i feel like my head is weaker than back then is i guess i could name most important of them back then in a few seconds, now its hard to concentrate on this)

mostly in this is not only this interface form but whole pattern physically - and that whole pattern was
on static reallocked seed inside..and that is some difference, becouse that oryginal pattern is
n aturally 'narrow' ('streamlined') to be contained in one function

the minimal form was
void expression_list_collect(int i, int j)
{
struct list { int x; int y; };
static list* ram = NULL;
static int size = 0;

ram = (list*) realloc(ram, ++size * sizeof(list) );
ram[size-1] = {i,j};
}
and that was mostly what i needed just to collect data in compiler code
in improved c one can acces to static data of other functions (my invention from old times like 2005) so if i would like to print it i could

void expression_list_print()
{
for(int i=0; i<expression_list_collect.size; i++)
printf("\n %d: %d %d", i, expression_list_collect.ram[i].x, expression_list_collect.ram[i].y );
}

in c as in other languages too it is important to have consciousnes what is what
(and this what i cal 'streamlining' is aloso about that) and this consciousnes help
so whan i use expression_list('add', 1,222); and c++ expression_list.add(1,222)
the consciousnes is imo ona a side of the first.. it also beats expression_list_add(1,222);
form as here the fact of keeping this static seed in global (semiglobal, space of whole big module)
space is annoying ..it even beats conceptually micromodular way (though less) becouse its simpler,
more rooted than micromodular way (do this mean that there is more wild, more rooted c under micromodular c?) ..the shared static way i like (which is extension of oryginal) but the oryginal example is the best here (this inner pattern and this consciousness wins here, i guess)

rooted c, you see the drums?

Re: what about this pattern?

<af96ccfe-8989-4916-ac7e-ce4970a9b22an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21558&group=comp.lang.c#21558

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:5e42:0:b0:69a:eac:d843 with SMTP id s63-20020a375e42000000b0069a0eacd843mr21567773qkb.526.1651220710002;
Fri, 29 Apr 2022 01:25:10 -0700 (PDT)
X-Received: by 2002:a05:6214:e4a:b0:449:99fd:bff7 with SMTP id
o10-20020a0562140e4a00b0044999fdbff7mr26882377qvc.46.1651220709867; Fri, 29
Apr 2022 01:25:09 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 29 Apr 2022 01:25:09 -0700 (PDT)
In-Reply-To: <506e3e5b-0a92-401b-9303-010988c29dcan@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.254; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.254
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com> <506e3e5b-0a92-401b-9303-010988c29dcan@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <af96ccfe-8989-4916-ac7e-ce4970a9b22an@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 08:25:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 156
 by: fir - Fri, 29 Apr 2022 08:25 UTC

piątek, 29 kwietnia 2022 o 09:58:23 UTC+2 fir napisał(a):
> piątek, 29 kwietnia 2022 o 00:01:10 UTC+2 fir napisał(a):
> > void expression_list(unsigned command, int i, int j)
> > {
> > struct list { int x; int y; };
> > static list* ram = NULL;
> > static int size = 0;
> >
> > if(command=='add') {
> > ram = (list*) realloc(ram, size++ * sizeof(list) );
> > ram[size-1] = {i,j};
> > }
> >
> > if(command=='reset') {
> > ram = (list*) realloc(ram, (size=0) * sizeof(list) );
> > }
> >
> > if(command=='dump') {
> > for(int i=0; i<size; i++)
> > printf("\n %d: %d %d ", i, ram[i].x, ram[i].y);
> > }
> > if(command=='print sum') {
> > int sum_x =0 ; int sum_y =0 ;
> > for(int i=0; i<size; i++)
> > {
> > sum_x += ram[i].x;
> > sum_y += ram[i].y;
> > }
> > printf("\n sum: %d %d ", sum_x, sum_y);
> >
> > }
> >
> > return ;
> > }
> >
> > this may be seen childish but for some reasons i found it as probably good and worth using as it may allow me to 'streamline' my c code and even increase productivity and code clarity
> >
> > you use it obviously
> >
> > expression_list('add', 1,222);
> > expression_list('add', 2,211);
> > expression_list('add', 3,22);
> > expression_list('add', 4,133);
> > expression_list('dump', 0,0);
> > expression_list('print sum',0,0);
> one could ask why not use (c way)
>
> expression_list_add(1,222);
> expression_list_add'(2,211);
> expression_list_add( 3,22);
> expression_list_add'( 4,133);
> expression_list_dump();
> expression_list_print_sum();
>
>
> which is faster (at least on cost of one to few if each time and also dont need to pass those unused
> values and also is more general, or some c++ way like (probably as i dont use c++)
>
> Expression_list expression_list();
> expression_list.add(1,222);
> expression_list.add'(2,211);
> expression_list.add( 3,22);
> expression_list.add'( 4,133);
> expression_list.dump();
> expression_list.print_sum();
> ~expression_list();
>
> or micromodular c way
> Expression_list expression_list
> expression_list.add(1,222);
> expression_list.add'(2,211);
> expression_list.add( 3,22);
> expression_list.add'( 4,133);
> expression_list.dump();
> expression_list.print_sum();
>
> but there are some differences (and sad i feel like my head is weaker than back then is i guess i could name most important of them back then in a few seconds, now its hard to concentrate on this)
>
> mostly in this is not only this interface form but whole pattern physically - and that whole pattern was
> on static reallocked seed inside..and that is some difference, becouse that oryginal pattern is
> n aturally 'narrow' ('streamlined') to be contained in one function
>
> the minimal form was
> void expression_list_collect(int i, int j)
> {
> struct list { int x; int y; };
> static list* ram = NULL;
> static int size = 0;
> ram = (list*) realloc(ram, ++size * sizeof(list) );
> ram[size-1] = {i,j};
> }
> and that was mostly what i needed just to collect data in compiler code
> in improved c one can acces to static data of other functions (my invention from old times like 2005) so if i would like to print it i could
>
> void expression_list_print()
> {
> for(int i=0; i<expression_list_collect.size; i++)
> printf("\n %d: %d %d", i, expression_list_collect.ram[i].x, expression_list_collect.ram[i].y );
> }
>
> in c as in other languages too it is important to have consciousnes what is what
> (and this what i cal 'streamlining' is aloso about that) and this consciousnes help
> so whan i use expression_list('add', 1,222); and c++ expression_list.add(1,222)
> the consciousnes is imo ona a side of the first.. it also beats expression_list_add(1,222);
> form as here the fact of keeping this static seed in global (semiglobal, space of whole big module)
> space is annoying ..it even beats conceptually micromodular way (though less) becouse its simpler,
> more rooted than micromodular way (do this mean that there is more wild, more rooted c under micromodular c?) ..the shared static way i like (which is extension of oryginal) but the oryginal example is the best here (this inner pattern and this consciousness wins here, i guess)
>
> rooted c, you see the drums?

its also reminder how this cross acces to static is needed.. i will write my own extended c compiler giving that and the rest , but just having it in C would make this language notably stronger

the second thing of this measure (this level) is that static seeds that are not global but tied to place of call, this above example dont show this becouse if i would put
expression_list.add(1,222);
expression_list.add'(2,211);
each one would produce its own static seed seed, but there are cases when this populating static seed
is needed...like say
chunks atoms = atomize("ala ma kota");
chunks atoms2 = atomize("the mouse is climbing up the leg of the chair");
shouldnt reuse the same static internally, maybe there should be the keyword to put before atomize() im not sure (or maybe even atomize[1]("ala ma cota") ..this last seem intresting becouse the lack of cloning function in c is breaking the fractal symmetry of it which are finding by me when making micromodules, so finding the real case when its needed seem ok...though as i once said im not convinced if my rectangle seeing on c is not at all wack as oryginal c is as i said more rooted, and this impresses me , sorta gives to think if its not better than what i got (not saying micromodules are useless)

Re: what about this pattern?

<858281ee-72ca-42db-b492-9a81cc1b782cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21559&group=comp.lang.c#21559

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:6ce:0:b0:2f0:29dd:bbc5 with SMTP id j14-20020ac806ce000000b002f029ddbbc5mr26661094qth.216.1651222319553;
Fri, 29 Apr 2022 01:51:59 -0700 (PDT)
X-Received: by 2002:a05:620a:4546:b0:69f:5d27:8f2d with SMTP id
u6-20020a05620a454600b0069f5d278f2dmr13761277qkp.529.1651222319441; Fri, 29
Apr 2022 01:51:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 29 Apr 2022 01:51:59 -0700 (PDT)
In-Reply-To: <87a6c4isop.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.254; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.254
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
<d9f1d699-c223-4327-bb9f-3169da950da3n@googlegroups.com> <87wnf8iwas.fsf@bsb.me.uk>
<ed8be5b1-280a-4b3c-8ee5-077d4398450an@googlegroups.com> <87a6c4isop.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <858281ee-72ca-42db-b492-9a81cc1b782cn@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 08:51:59 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 67
 by: fir - Fri, 29 Apr 2022 08:51 UTC

piątek, 29 kwietnia 2022 o 03:28:51 UTC+2 Ben napisał(a):
> fir <profes...@gmail.com> writes:
>
> > piątek, 29 kwietnia 2022 o 02:11:02 UTC+2 Ben napisał(a):
> >> fir <profes...@gmail.com> writes:
> >>
> >> > void FindExpressionsBoundaries()
> >> > {
> >> > chunk txt = Chunk(" a*b + c*(f++)/size_x 100-400/c/f.a + 40 c * c * doo(a b c) -100.33");
> >> >
> >> > chunks atoms = LineAtomizer4furia(txt);
> >> > int len = ChunksLength(atoms);
> >> >
> >> > PrintChunks(atoms);
> >> <cut>
> >> > gives
> >> >
> >> > 0 a
> >> > 1 *
> >> > 2 b
> >> > 3 +
> >> > 4 c
> >> > 5 *
> >> > 6 (
> >> > 7 f
> >> > 8 +
> >> > 9 +
> >> How will you distinguish between "++x" and "+ +x"?
> >>
> > i not thinked on this yet..this code is not finished (as it seen it
> > works bad as it broke on args of nested function )... i need to invent
> > some rule but the pattern i said simplify coding this a lot
> Sometimes it helps to think about things before you code too much. Once
> you have only the three 'atoms' +, + and x it's too late to be able to
> tell what the expression should be.
>

this is recognized on level below atomizer and its not so hard, often the small if three suffice

if(atoms_len >= 6) // double a = 23.45
if( CCS(a0, "double") || CCS(a0, "%") )
if( CCL(a1) )
if( CCS(a2, "=") )
if( CCI(a3) )
if( CCS(a4, ".") )
if( CCI(a5) )
{
FlushOutAsmChunkPE("\n\n// compiling expression ", all.first[i], " ");
FlushOutAsm("\n ?? %.*s: %.*s.%.*sd ", ChunkLength(a1) , a1.beg, ChunkLength(a3) , a3.beg, ChunkLength(a5) , a5.beg );

}
where CCS means "compare chunk string" CCI "check chunk integer" CCL "check chunk label"
i should hovever produce tagged output in atomizer and replace it by if(a4.tag=='int') i didnt do
that becouse thoise function seemd to me looked simpler but im not sure probably tags are even simpler
and without tags its kinda runtime nonsense (though some may say not becouse if i tag whole line
i call say 40 functions, to tag it and in if i may go out after first failed...though in real case probably seems tags are more practical)

Re: what about this pattern?

<3a6db2ef-8f00-40b5-ac71-a265e7c9644dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21561&group=comp.lang.c#21561

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:2c4:b0:2f3:8743:6fc7 with SMTP id a4-20020a05622a02c400b002f387436fc7mr7419405qtx.187.1651228791689;
Fri, 29 Apr 2022 03:39:51 -0700 (PDT)
X-Received: by 2002:a05:620a:f0d:b0:67e:1c14:bc5e with SMTP id
v13-20020a05620a0f0d00b0067e1c14bc5emr22069199qkl.502.1651228791529; Fri, 29
Apr 2022 03:39:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 29 Apr 2022 03:39:51 -0700 (PDT)
In-Reply-To: <t4f7ma$psf$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.140; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.140
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com> <t4f7ma$psf$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3a6db2ef-8f00-40b5-ac71-a265e7c9644dn@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 10:39:51 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 36
 by: fir - Fri, 29 Apr 2022 10:39 UTC

piątek, 29 kwietnia 2022 o 01:24:07 UTC+2 Andrey Tarasevich napisał(a):
> On 4/28/2022 3:01 PM, fir wrote:
> > you use it obviously
>
> Multicharacter character constants produce implementation-defined values.
>
> On a 32-bit-int platform a 2-4 character multicharacter character
> constant is indeed viable for some uses, as long as you know what you
> are doing and assuming that your compiler does what compilers "normally"
> do in such cases.
>
> But more than 4? That's just asking for trouble.
>
> The code creates an illusion of something that isn't really there. And
> it is not immediately obvious how that illusion works. E.g. even if your
> compiler promises to concatenate up to 4 bytes, does it keep the first 4
> or the last 4?
>
> So no, longish multicharacter character constants are not a good
> pattern. "Short" multicharacter character constants are acceptable when
> you know what you are doing.
>
and what with using long long int command; and limit self to 8-character long comands at most? do this have serious disadvantages?

note im using gcc/mingw in 32 bit mode (i even work on 32 bit old comp becouse writing assembler
i decided to use 32 bit in 32 bit pe-environment) i do not much care from automatic compatibility
when compiling to 64-bit /other oses ..becouse i would need to revrite asembler at all (its system dependant).. i prefer binary compatibility overally

Re: what about this pattern?

<e510f0e5-f4f1-45fc-98c1-f07b6bdb05c7n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21562&group=comp.lang.c#21562

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:6206:b0:2f1:d7bc:7522 with SMTP id hj6-20020a05622a620600b002f1d7bc7522mr26563623qtb.556.1651229067876;
Fri, 29 Apr 2022 03:44:27 -0700 (PDT)
X-Received: by 2002:ac8:5b86:0:b0:2e2:72c:9e06 with SMTP id
a6-20020ac85b86000000b002e2072c9e06mr25940566qta.113.1651229067747; Fri, 29
Apr 2022 03:44:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 29 Apr 2022 03:44:27 -0700 (PDT)
In-Reply-To: <3a6db2ef-8f00-40b5-ac71-a265e7c9644dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.140; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.140
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com>
<t4f7ma$psf$1@dont-email.me> <3a6db2ef-8f00-40b5-ac71-a265e7c9644dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e510f0e5-f4f1-45fc-98c1-f07b6bdb05c7n@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 10:44:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 48
 by: fir - Fri, 29 Apr 2022 10:44 UTC

piątek, 29 kwietnia 2022 o 12:39:59 UTC+2 fir napisał(a):
> piątek, 29 kwietnia 2022 o 01:24:07 UTC+2 Andrey Tarasevich napisał(a):
> > On 4/28/2022 3:01 PM, fir wrote:
> > > you use it obviously
> >
> > Multicharacter character constants produce implementation-defined values.
> >
> > On a 32-bit-int platform a 2-4 character multicharacter character
> > constant is indeed viable for some uses, as long as you know what you
> > are doing and assuming that your compiler does what compilers "normally"
> > do in such cases.
> >
> > But more than 4? That's just asking for trouble.
> >
> > The code creates an illusion of something that isn't really there. And
> > it is not immediately obvious how that illusion works. E.g. even if your
> > compiler promises to concatenate up to 4 bytes, does it keep the first 4
> > or the last 4?
> >
> > So no, longish multicharacter character constants are not a good
> > pattern. "Short" multicharacter character constants are acceptable when
> > you know what you are doing.
> >
> and what with using long long int command; and limit self to 8-character long comands at most? do this have serious disadvantages?
>
> note im using gcc/mingw in 32 bit mode (i even work on 32 bit old comp becouse writing assembler
> i decided to use 32 bit in 32 bit pe-environment) i do not much care from automatic compatibility
> when compiling to 64-bit /other oses ..becouse i would need to revrite asembler at all (its system dependant).. i prefer binary compatibility overally

btw why bartc is so inactive here?
i once was writing he do weird thing fighting the same battles 200+ times instead of say 5 or 10
(becouse inded not much sense in this, hovever 'side effects' of that repeating could (and did) give some value) but on other side cuting activity to such low makes this group less active, and bartc generally was ablle to 'carry' some topics

Re: what about this pattern?

<da7a11b8-3df0-4251-a311-71a11cec16fdn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21564&group=comp.lang.c#21564

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:31a8:b0:69e:abdf:80cd with SMTP id bi40-20020a05620a31a800b0069eabdf80cdmr22825432qkb.685.1651240015128;
Fri, 29 Apr 2022 06:46:55 -0700 (PDT)
X-Received: by 2002:a05:622a:181a:b0:2f3:93ac:6859 with SMTP id
t26-20020a05622a181a00b002f393ac6859mr2248796qtc.74.1651240014976; Fri, 29
Apr 2022 06:46:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 29 Apr 2022 06:46:54 -0700 (PDT)
In-Reply-To: <506e3e5b-0a92-401b-9303-010988c29dcan@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.7; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.7
References: <9b852c32-8995-4b7c-811c-0b607ac2cd22n@googlegroups.com> <506e3e5b-0a92-401b-9303-010988c29dcan@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <da7a11b8-3df0-4251-a311-71a11cec16fdn@googlegroups.com>
Subject: Re: what about this pattern?
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 29 Apr 2022 13:46:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 93
 by: fir - Fri, 29 Apr 2022 13:46 UTC

piątek, 29 kwietnia 2022 o 09:58:23 UTC+2 fir napisał(a):
>
> or micromodular c way
> Expression_list expression_list
> expression_list.add(1,222);
> expression_list.add'(2,211);
> expression_list.add( 3,22);
> expression_list.add'( 4,133);
> expression_list.dump();
> expression_list.print_sum();
>
hovever i might omit dots here in micromodular/C2 way

Expression_list expression_list
expression_list add(1,222);
expression_list add'(2,211);
expression_list add( 3,22);
expression_list add'( 4,133);
expression_list dump();
expression_list print_sum();

i could also mention that in micromodular schemes one could also not instantiate expression_list
and treat those fields as a field of function (function/module), so

expression_list.add(1,222);
expression_list.add'(2,211);
expression_list.add( 3,22);
expression_list.add'( 4,133);
expression_list.dump();
expression_list.print_sum();

as to present practice i may say that writing it old c way like

struct Expression_list { int x; int y; };
static Expression_list* expression_list = NULL;
static int expression_list_size = 0;

void expression_list_AddBoundary(int i, int j)
{
expression_list_size++;
expression_list = (Expression_list*) realloc(expression_list, expression_list_size * sizeof(Expression_list)
expression_list[expression_list_size-1] = {i,j};
return ;
}
is in fact tiring - it also polutes this semiglobal space with not needed symbols

in this command attempt there are also those mentioned problems yet also there is a problem of
somethink like reading the colected list out ... some may code it this way that this collected list is passed down the tree but reading it out is also needed
standable seems to use semiglobal filds like

void* ret_list = NULL;
int ret_list_size = -1;

add comand ret

if(command=='ret')
{
ret_list = ram;
ret_list_size = size;
}

and use it something like

void TranslateCollectedExpressions(chunks arg_atoms)
{ expression_list('ret', -1, -1 );

for(int i=0; i<ret_list_size; i++)
{
struct list { int x; int y; };

int x = ((list*)ret_list)[i].x;
int y = ((list*)ret_list)[i].y;

chunks atoms = { &arg_atoms.first[x], &arg_atoms.first[y] } ;

int len = ChunksLength(atoms);
if(len==0) continue;
if(len==1) continue;
if(len==2) continue;

compile_expression(atoms);

}
}

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor