Advertisement
Guest User

Untitled

a guest
Jul 30th, 2013
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.24 KB | None | 0 0
  1. ///////////// BINDINGS //////////////////////////////
  2. #include <emscripten/bind.h>
  3. using namespace emscripten;
  4. #include "score.h"
  5.  
  6. Score::FileError loadScore(Score* score, char* filename, bool iv) {
  7.     QString qstr(filename);
  8.     return score->loadMsc(qstr, iv);
  9. }
  10.  
  11. EMSCRIPTEN_BINDINGS(Score_bindings) {
  12.         class_<QObject>("QObject")
  13.                 ;
  14.         class_<QString>("QString")
  15.                 .constructor<char*>()
  16.                 ;
  17.         enum_<Score::FileError>("FileError")
  18.                 .value("FILE_NO_ERROR", Score::FileError::FILE_NO_ERROR)
  19.                 .value("FILE_ERROR", Score::FileError::FILE_ERROR)
  20.                 .value("FILE_NOT_FOUND", Score::FileError::FILE_NOT_FOUND)
  21.                 .value("FILE_OPEN_ERROR", Score::FileError::FILE_OPEN_ERROR)
  22.                 .value("FILE_BAD_FORMAT", Score::FileError::FILE_BAD_FORMAT)
  23.                 .value("FILE_UNKNOWN_TYPE", Score::FileError::FILE_UNKNOWN_TYPE)
  24.                 .value("FILE_NO_ROOTFILE", Score::FileError::FILE_NO_ROOTFILE)
  25.                 .value("FILE_TOO_OLD", Score::FileError::FILE_TOO_OLD)
  26.                 .value("FILE_TOO_NEW", Score::FileError::FILE_TOO_NEW)
  27.                 .value("FILE_USER_ABORT", Score::FileError::FILE_USER_ABORT)
  28.                 ;
  29.     class_<Score, base<QObject>>("Score")
  30.         .constructor()// line: 447
  31.         //.constructor<const MStyle *>()// line: 448
  32.         //.constructor<Score *>()// line: 449
  33.         //.function("loadMsc", &Score::loadMsc)// line: 594
  34.                 .function("loadScore", &loadScore, allow_raw_pointers())
  35.         ;
  36. }
  37.  
  38. ///////////////// compile command /////////////////////
  39.  
  40. kyle@kyle-VirtualBox ~/Documents/emscripten-libmscore
  41. $ ../emscriptenqt/emscripten/emcc \
  42. >   libmscore.bc \
  43. >   QtGui.so QtCore.so \
  44. >   --bind \
  45. >   --post-js ../emscriptenqt/emscripten-qt/emscripten-stuff/pre-qt.js \
  46. >   --js-library ../emscriptenqt/emscripten-qt/emscripten-stuff/pre-qt-library.js \
  47. >   --embed-file qt-fonts \
  48. >   --embed-file scores \
  49. >   -s TOTAL_MEMORY=100108864 \
  50. >   -o libmscore.js
  51. clang: warning: argument unused during compilation: '-nostdinc++'
  52.  
  53.  
  54. /////////////////// Javascript console input/output /////////////////////////
  55.  
  56. > var score = new Module.Score()
  57. undefined
  58. > var result = score.loadScore("scores/Se_Canto.mscz", false)
  59. UnboundTypeError: Cannot call Score.loadScore due to unbound types: Pc
  60. message: "Cannot call Score.loadScore due to unbound types: Pc"
  61. name: "UnboundTypeError"
  62. stack: "UnboundTypeError: Cannot call Score.loadScore due to unbound types: Pc↵    at UnboundTypeError.<anonymous> (file:///home/kyle/Documents/emscripten-libmscore/libmscore.js:2581948:22)↵    at new UnboundTypeError (eval at createNamedFunction (file:///home/kyle/Documents/emscripten-libmscore/libmscore.js:2581969:12), <anonymous>:4:34)↵    at throwUnboundTypeError (file:///home/kyle/Documents/emscripten-libmscore/libmscore.js:2581882:11)↵    at Score.unboundTypesHandler [as loadScore] (file:///home/kyle/Documents/emscripten-libmscore/libmscore.js:2583125:13)↵    at <anonymous>:2:20↵    at Object.InjectedScript._evaluateOn (<anonymous>:562:39)↵    at Object.InjectedScript._evaluateAndWrap (<anonymous>:521:52)↵    at Object.InjectedScript.evaluate (<anonymous>:440:21)"
  63. __proto__: UnboundTypeError
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement