[Pntool-developers] SF.net SVN: pntool:[249]
Brought to you by:
compaqdrew,
miordache
|
From: <mio...@us...> - 2011-05-17 13:45:21
|
Revision: 249
http://pntool.svn.sourceforge.net/pntool/?rev=249&view=rev
Author: miordache
Date: 2011-05-17 13:45:15 +0000 (Tue, 17 May 2011)
Log Message:
-----------
corrections
Modified Paths:
--------------
examples/test.sp
newcodegen/plantCompiler.c
newcodegen/supervisorCompiler.c
pnheaders/pns.c
translator/main.c
Modified: examples/test.sp
===================================================================
--- examples/test.sp 2011-05-13 22:48:19 UTC (rev 248)
+++ examples/test.sp 2011-05-17 13:45:15 UTC (rev 249)
@@ -1,8 +1,12 @@
// This is a test file created in order to check the functionality of the
-// pn translator.
+// pn translator.
-process TST;
+process TST
+include: {
+ int i;
+};
+
TST.PN:
places: p0 p1 p2;
@@ -11,8 +15,8 @@
(p0, t0);
(t2, p0);
-(p1, t1, p2, p0);
-(p1, t1, p2, p0);
+(p1, t1, p2, p0); // this is not a state machine;
+(p1, t1, p2, p0); // the code generator assumes state machines.
(p2, t2, p1).{i == 3};
TST testpn(p0:2,p1:1);
Modified: newcodegen/plantCompiler.c
===================================================================
--- newcodegen/plantCompiler.c 2011-05-13 22:48:19 UTC (rev 248)
+++ newcodegen/plantCompiler.c 2011-05-17 13:45:15 UTC (rev 249)
@@ -95,7 +95,8 @@
for(i = 0; i < pn->pnum; i++) {
ins = FSInsert(ins, "\ncase %d:\n", i);
- ins = SInsert(pn->segment[i], ins);
+ if(pn->segment)
+ ins = SInsert(pn->segment[i], ins);
// Inserting/creating select functions
// The output of the select function is the ___TR list.
Modified: newcodegen/supervisorCompiler.c
===================================================================
--- newcodegen/supervisorCompiler.c 2011-05-13 22:48:19 UTC (rev 248)
+++ newcodegen/supervisorCompiler.c 2011-05-17 13:45:15 UTC (rev 249)
@@ -718,15 +718,21 @@
ins = SInsert(";\n", ins);
ins = FSInsert(ins, "#define n___in %d // Number of rows of ___in\n", j);
*/
- if(!sup->marking) { // initialize it to zero
- ip = calloc(sup->pnum, sizeof(*ip));
- updatepn(sup, "m0", ip);
- free(ip);
+ if(sup->pnum) {
+ if(!sup->marking) { // initialize it to zero
+ ip = calloc(sup->pnum, sizeof(*ip));
+ updatepn(sup, "m0", ip);
+ free(ip);
+ }
+ ins = SInsert("const int ___m0[][2] = ", ins);
+ ins = cinsert1D(sup->marking, sup->pnum, &j, ins);
+ ins = SInsert(";\n", ins);
+ ins = FSInsert(ins,"#define n___m0 %d // Number of rows of ___m0\n\n",j);
}
- ins = SInsert("const int ___m0[][2] = ", ins);
- ins = cinsert1D(sup->marking, sup->pnum, &j, ins);
- ins = SInsert(";\n", ins);
- ins = FSInsert(ins, "#define n___m0 %d // Number of rows of ___m0\n\n", j);
+ else {
+ ins = SInsert("const int ___m0[][2] = {};\n", ins);
+ ins = FSInsert(ins, "#define n___m0 0 // Number of rows of ___m0\n\n");
+ }
} // end of if(sup)
else {
ins = SInsert("#define ___pnum 0\n", ins);
Modified: pnheaders/pns.c
===================================================================
--- pnheaders/pns.c 2011-05-13 22:48:19 UTC (rev 248)
+++ pnheaders/pns.c 2011-05-17 13:45:15 UTC (rev 249)
@@ -764,6 +764,13 @@
int *lcount, np, np1, np2, nt, nt1, nt2, i, j, k, z, label;
+ if(!pn1 && !pn2) {
+ memset(&pn, 0, sizeof(pn));
+ return pn;
+ }
+ if(!pn1) return copypn(pn2);
+ if(!pn2) return copypn(pn1);
+
nt1 = pn1->tnum; /* determine the number of transitions */
nt2 = pn2->tnum;
Modified: translator/main.c
===================================================================
--- translator/main.c 2011-05-13 22:48:19 UTC (rev 248)
+++ translator/main.c 2011-05-17 13:45:15 UTC (rev 249)
@@ -264,7 +264,8 @@
if(is_verbose() >= 10) {
printf("Threads dealloced\n");
}
- nodes ->free (nodes); nodes = NULL;
+ if(errors != true) // line added by MVI
+ nodes ->free (nodes); nodes = NULL;
if(is_verbose() >= 10) {
printf("Nodes freed\n");
}
@@ -454,4 +455,4 @@
var = var->next;
}
printf(" <= \%i\n", ineq->free_term);
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|