small change
[cdsspec-compiler.git] / notes / generated_code_examples.txt
index 506c5af7cf3cc33d2c68071e596ab87c2cad379d..1b5f486480e5291b033afaf142b7e36a080c24ca 100644 (file)
@@ -1,15 +1,6 @@
 ******    Example1:    ******
 Global Variable Declaration
 
-/* Include the header files first
-** This declaration will be written into a header file
-*/
-/* @file _spec_sequential_generated.h */
-/* @brief automatically generated file */
-#ifndef __SPEC_SEQUENTIAL_GENERATED_H
-#define __SPEC_SEQUENTIAL_GENERATED_H
-#include <specannotation.h>
-#include <spec_tag.h>
 
 /* Include all the header files that contains the interface declaration */
 #include <iostream>
@@ -17,6 +8,10 @@ Global Variable Declaration
 #include <memory>
 #include <assert.h>
 
+/* Other necessary header files */
+#include <specannotation.h>
+#include <spec_tag.h>
+
 /* All other user-defined functions */
 ALL_USER_DEFINED_FUNCTIONS
 
@@ -33,15 +28,34 @@ typedef struct Get_info {
 } Get_info;
 /* End of info struct definition */
 
+/* ID functions of interface */
+static id_t Put_id() {
+       id_t id = PUT_ID;
+       return id;
+}
 
-/* All function of action and check of interfaces */
-bool Put_check_action(void *info) {
+static id_t Get_id() {
+       id_t id = GET_ID;
+       return id;
+}
+/* End of ID functions */
+
+/* Initialization of interface<->function_ptr table */
+#define INTERFACE_SIZE 2
+void* func_ptr_table[INTERFACE_SIZE * 2] = {
+       CLASS
+
+/* Check_action function of interfaces */
+bool Put_check_action(void *info, id_t __ID__) {
        bool check_passed;
        Put_info *theInfo = (Put_info) info;
        shared_ptr<TypeV> __RET__ = theInfo->__RET__;
        TypeK & key = theInfo->key;
        TypeV & value = theInfo->value;
 
+       // __COND_SAT__
+       bool __COND_SAT__ = PUT_CONDITION;
+
        // Check
        check_passed = PUT_CHECK_EXPRESSION;
        if (!check_passed)
@@ -62,10 +76,11 @@ bool Put_check_action(void *info) {
        PUT_POST_ACTION
 }
 
-id_t Put_id() {
-       id_t id = PUT_ID;
-       return id;
+
+bool Get_check_action(void *info, id_t __ID__) {
+       //...
 }
+/* End of check_action function definitions */ 
 
 
 /* Beginning of other user-defined variables */
@@ -93,8 +108,7 @@ void __sequential_init() {
        cdsannotate(SPEC_ANALYSIS, &hb_init0);
 }
 
-#endif
-
+#endif /* End of 
 
 
 ******    Example2:    ******