dol: fix shm_t contain the shm-buffers
authorSebastian <basti@sraa.de>
Wed, 11 Dec 2013 00:13:59 +0000 (01:13 +0100)
committerSebastian <basti@sraa.de>
Wed, 11 Dec 2013 00:13:59 +0000 (01:13 +0100)
The shared.h file contained the typedefs for all buffers, but
did not include the buffers themselves in the shared shm_t structure.

dol/src/dol/visitor/epiphany/EpiphanyVisitor.java
dol/src/dol/visitor/epiphany/template/shared.h

index 2c0c642a5a0b173c44276cafaf668f9d815942e8..5a053ca424e84a289462d5bd141750dd49b7f2ee 100644 (file)
@@ -264,23 +264,29 @@ public class EpiphanyVisitor extends PNVisitor {
                File fTemplate = new File(template);
                copyFile(fTemplate, fFilename);
 
-               /* generate replacement string */
+               /* generate replacement strings */
+               String shmBufTypes = "";
                String shmBufs = "";
                for(EpiphanyBuffer buf : _buffers) {
                        if("shm".equals(buf.type)) {
-                               shmBufs +=
+                               shmBufTypes +=
                                "\ntypedef struct {\n" +
                                "\tuint32_t rp;\n" +
                                "\tuint32_t wp;\n" +
                                "\tuint32_t size;\n" +
                                "\tchar     buf[" + buf.size + "];\n" +
                                "} PACKED buf" + buf.shmIndex + "_t;\n";
+
+                               shmBufs +=
+                               "\tbuf" + buf.shmIndex + "_t" +
+                               "\tbuf" + buf.shmIndex + ";\n";
                        }
                }
 
                /* do the replace */
                Sed sed = new Sed();
-               sed.sed(filename, "@@SHM_BUF_STRUCTS@@", shmBufs);
+               sed.sed(filename, "@@SHM_BUF_STRUCTS@@", shmBufTypes);
+               sed.sed(filename, "@@SHM_BUFS@@",        shmBufs);
                System.out.println("done!");
        }
 
index 467b09fae86a08e86186a1ed136462065a08bbe4..1eb893d81dd716f441ba4238fa4e5d08e05f894e 100644 (file)
@@ -26,8 +26,7 @@ typedef struct {
 typedef struct {
        int32_t    states[NUM_CORES];
        coredata_t cores[NUM_CORES];
-       buf0_t     buf0;
-       buf1_t     buf1;
+@@SHM_BUFS@@
 } PACKED shm_t;
 
 #endif /* _SHARED_H_ */