Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ed597a

Browse files
df7cbmsdemlei
authored andcommitted
Include stored moc order in output
1 parent3c51f93 commit1ed597a

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

‎expected/moc.out‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ SELECT '0/'::smoc; -- expected: '0/'
1212
0/
1313
(1 row)
1414

15-
SELECT '29/'::smoc; -- expected: '0/'
15+
SELECT '29/'::smoc; -- expected: '29/'
1616
smoc
1717
------
18-
0/
18+
29/
1919
(1 row)
2020

2121
SELECT '0/0-3,7'::smoc; -- expected: '0/0-3,7'
@@ -404,15 +404,15 @@ select set_smoc_output_type(0);
404404
(1 row)
405405

406406
SELECT smoc('29/32-63');
407-
smoc
408-
--------
409-
27/2-3
407+
smoc
408+
------------
409+
27/2-3 29/
410410
(1 row)
411411

412412
SELECT smoc('29/64-127');
413-
smoc
414-
------
415-
26/1
413+
smoc
414+
----------
415+
26/1 29/
416416
(1 row)
417417

418418
SELECT smoc('0/0-11');
@@ -536,9 +536,9 @@ SELECT smoc('5/1-127,999-1103');
536536
(1 row)
537537

538538
SELECT smoc('5/1024-1103');
539-
smoc
540-
-----------
541-
2/16 3/68
539+
smoc
540+
--------------
541+
2/16 3/68 5/
542542
(1 row)
543543

544544
SELECT smoc('28/1101-1103');
@@ -568,7 +568,7 @@ SELECT sum(moc) FROM (VALUES ('0/1'::smoc), ('0/2'), ('0/4')) sub(moc);
568568
SELECT smoc_intersection('1/1,4-6', '1/3-5 2/8');
569569
smoc_intersection
570570
-------------------
571-
1/4-5
571+
1/4-5 2/
572572
(1 row)
573573

574574
SELECT '0/1'::smoc & '1/3,5,7,9' AS intersection;
@@ -701,7 +701,7 @@ SELECT smoc_disc(0, 0, 0, 3.2);
701701
SELECT smoc_disc(2, 0, 0, 3.2);
702702
smoc_disc
703703
-----------
704-
0/0-11
704+
0/0-11 2/
705705
(1 row)
706706

707707
SELECT smoc(6, '(0,0)'::spoint);
@@ -743,8 +743,8 @@ SELECT smoc(3, '{(.1,.1), (.1,-1), (-1,-1), (-1, .1)}'::spoly);
743743
CREATE TABLE g (p spoly);
744744
INSERT INTO g (p) VALUES (spoly '{(1.48062434277764d , -0.112757492761271d),(1.48062583213677d , -0.0763898467955446d),(1.44427278313068d, -0.0762453395638312d),(1.44413625055362d , -0.112726631135703d)}');
745745
SELECT smoc(6, p) FROM g;
746-
smoc
747-
--------
748-
5/4522
746+
smoc
747+
-----------
748+
5/4522 6/
749749
(1 row)
750750

‎process_moc.cpp‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,15 +721,17 @@ void
721721
ascii_out(std::string & m_s,char* s, Smoc* moc, int32 begin, int32 end,
722722
int32 entry_size)
723723
{
724+
// moc output fiddling:
725+
int order = moc->order;
726+
m_s.reserve(end);// rough guess
724727

725728
if (moc->first == moc->last)
726729
{
727-
m_s ="0/";
730+
sprintf(s,"%d/", order);
731+
m_s.append(s);
728732
return;
729733
}
730-
// moc output fiddling:
731-
int order = moc->order;
732-
m_s.reserve(end);// rough guess
734+
733735
output_mapoutputs(1 + order);
734736

735737
for (int32 j = begin; j < end; j += entry_size)
@@ -743,7 +745,7 @@ ascii_out(std::string & m_s, char* s, Smoc* moc, int32 begin, int32 end,
743745
for (int k =0; k <= order; ++k)
744746
{
745747
const moc_map & output = outputs[k];
746-
if (output.size())
748+
if (output.size() || k == order)// always output "order/" to track input order
747749
{
748750
sprintf(s,"%d/", k);
749751
m_s.append(s);
@@ -761,7 +763,8 @@ ascii_out(std::string & m_s, char* s, Smoc* moc, int32 begin, int32 end,
761763
if (output.size())
762764
*m_s.rbegin() ='';
763765
}
764-
m_s.resize(m_s.size() -1);// strip trailing space
766+
if (outputs[order].size())
767+
m_s.resize(m_s.size() -1);// strip trailing space
765768
}
766769

767770
moc_out_data

‎sql/moc.sql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SET client_min_messages = 'notice';
33

44
SELECT smoc('');-- expected: '0/'
55
SELECT'0/'::smoc;-- expected: '0/'
6-
SELECT'29/'::smoc;-- expected: '0/'
6+
SELECT'29/'::smoc;-- expected: '29/'
77
SELECT'0/0-3,7'::smoc;-- expected: '0/0-3,7'
88
SELECT'0/0,1,2,3,7'::smoc;-- expected: '0/0-3,7'
99

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp