libwolfssl ported
[henge/webcc.git] / src / core / main.c
index f067df7..6da2201 100644 (file)
 #define TRIGGERS quit_trigger
 #include <core/trigger.h>
 #include <core/engine.h>
-
-/* private functions */
-static int main_init(void);
+#include <wolfssl/wolfcrypt/sha256.h>
 
 /* exposed functions */
 void main_loop(void);
 
+/* private functions */
+static int main_init(void);
+
 /* unexposed externs *
 extern int         state_init(void);
 extern void        state_tick(uint32_t delta_ticks);
@@ -43,27 +44,34 @@ extern void        state_handle_event(SDL_Event event);
 extern int         io_init(void);
 extern const char* io_get_error(void);
 extern void        io_quit(void);*/
+
 /* main jump buffer */
 jmp_buf jmp_main;
 
-/* Main Entry
-
-   initializes subsystems and calls main_loop(void)
+/*@
+  initializes subsystems and calls main_loop(void)
 
-   main sets a jump buffer for its primary switch, which may be jumped to
-   at any time.  Jumping with a 0 return value is equivalent to calling
-   setjmp directly, which initializes the system and begins the main loop.
-   Jumping with any other value will process one of the directives associated
-   with the exit codes in core.h
-*******************************************************************************/
+  main sets a jump buffer for its primary switch, which may be jumped to
+  at any time.  Jumping with a 0 return value is equivalent to calling
+  setjmp directly, which initializes the system and begins the main loop.
+  Jumping with any other value will process one of the directives associated
+  with the exit codes in core.h
+*/
 #ifdef __EMSCRIPTEN__
 #define main_loop()\
   emscripten_set_main_loop(main_loop,0,0);\
   TRIGGER_SET(quit_trigger, emscripten_cancel_main_loop);\
   return 0;
+#endif
+
 int
 main (int argc, char** argv)
-{ switch(setjmp(jmp_main))
+{ Sha256 shstr = {0};
+  wc_InitSha256(&shstr);
+
+  printf("%d %d\n", sizeof(long), sizeof(long long));
+
+  switch(setjmp(jmp_main))
     { case 0:
         if (main_init())
           return -1;
@@ -79,8 +87,9 @@ main (int argc, char** argv)
   return 0;
 }
 
+#ifdef __EMSCRIPTEN__
 #undef main_loop
-#endif //EMSCRIPTEN
+#endif
 
 /** subsystem initializer
     Calling main_init() bootstraps the system, and may be called multiple