• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1816 (tree)
日時2010-05-08 15:11:41
作者satofumi

ログメッセージ

add Luabind::dofile_noext()

変更サマリ

差分

--- trunk/libs/lua/LuaHandler.h (revision 1815)
+++ trunk/libs/lua/LuaHandler.h (revision 1816)
@@ -26,6 +26,7 @@
2626 static lua_State* newthread(lua_State* L);
2727 static void addPath(lua_State* L, const char* additional_path);
2828 static int dofile(lua_State* L, const char* lua_file);
29+ static int dofile_noext(lua_State* L, const char* lua_file);
2930 static int dostring(lua_State* L, const char* lua_string);
3031 static void registerValue(lua_State* L, const char* name, int value);
3132
--- trunk/libs/lua/LuaHandler.cpp (revision 1815)
+++ trunk/libs/lua/LuaHandler.cpp (revision 1816)
@@ -8,6 +8,7 @@
88 */
99
1010 #include "LuaHandler.h"
11+#include "fileExist.h"
1112 #include "log_printf.h"
1213 #include <sstream>
1314 #include <string>
@@ -99,6 +100,24 @@
99100 }
100101
101102
103+int LuaHandler::dofile_noext(lua_State* L, const char* lua_file)
104+{
105+ const char *ext[] = { ".out", ".lua" };
106+ size_t n = sizeof(ext) / sizeof(ext[0]);
107+ for (size_t i = 0; i < n; ++i) {
108+ string file = string(lua_file) + ext[i];
109+ if (fileExist(file.c_str())) {
110+ int ret = dofile(L, file.c_str());
111+ if (ret) {
112+ handleError(L);
113+ }
114+ return ret;
115+ }
116+ }
117+ return dofile(L, lua_file);
118+}
119+
120+
102121 int LuaHandler::dostring(lua_State* L, const char* lua_string)
103122 {
104123 int ret = luaL_dostring(L, lua_string);
--- trunk/libs/audio/sdl_mixer/SdlCdromInit.h (nonexistent)
+++ trunk/libs/audio/sdl_mixer/SdlCdromInit.h (revision 1816)
@@ -0,0 +1,33 @@
1+#ifndef QRK_SDL_CDROM_INIT_H
2+#define QRK_SDL_CDROM_INIT_H
3+
4+/*!
5+ \file
6+ \brief SDL_INIT_CDROM の初期化
7+
8+ \author Satofumi KAMIMURA
9+
10+ $Id$
11+*/
12+
13+#include <memory>
14+
15+
16+namespace qrk
17+{
18+ //! SDL_INIT_CDROM の初期化クラス
19+ class SdlCdromInit
20+ {
21+ SdlCdromInit(const SdlCdromInit& rhs);
22+ SdlCdromInit& operator = (const SdlCdromInit& rhs);
23+
24+ struct pImpl;
25+ const std::auto_ptr<pImpl> pimpl;
26+
27+ public:
28+ SdlCdromInit(void);
29+ ~SdlCdromInit(void);
30+ };
31+}
32+
33+#endif /* !QRK_SDL_CDROM_INIT_H */
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/audio/sdl_mixer/CdPlayer.cpp (nonexistent)
+++ trunk/libs/audio/sdl_mixer/CdPlayer.cpp (revision 1816)
@@ -0,0 +1,38 @@
1+/*!
2+ \file
3+ \brief CD-ROM 再生
4+
5+ \author Satofumi KAMIMURA
6+
7+ $Id$
8+*/
9+
10+
11+#include "CdPlayer.h"
12+#include "SdlCdromInit.h"
13+#include <SDL.h>
14+
15+using namespace qrk;
16+
17+
18+struct CdPlayer::pImpl : private SdlCdromInit
19+{
20+ static pImpl* object(void)
21+ {
22+ static pImpl pimpl_object;
23+ return &pimpl_object;
24+ }
25+
26+
27+ // !!!
28+};
29+
30+
31+CdPlayer::CdPlayer(void) : pimpl(pImpl::object())
32+{
33+}
34+
35+
36+CdPlayer::~CdPlayer(void)
37+{
38+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/audio/sdl_mixer/CdPlayer.h (nonexistent)
+++ trunk/libs/audio/sdl_mixer/CdPlayer.h (revision 1816)
@@ -0,0 +1,33 @@
1+#ifndef QRK_CD_PLAYER_H
2+#define QRK_CD_PLAYER_H
3+
4+/*!
5+ \file
6+ \brief CD-ROM 再生
7+
8+ \author Satofumi KAMIMURA
9+
10+ $Id$
11+*/
12+
13+
14+namespace qrk
15+{
16+ class CdPlayer
17+ {
18+ public:
19+ CdPlayer(void);
20+ ~CdPlayer(void);
21+
22+ // !!!
23+
24+ private:
25+ CdPlayer(const CdPlayer& rhs);
26+ CdPlayer& operator = (const CdPlayer& rhs);
27+
28+ struct pImpl;
29+ pImpl* pimpl;
30+ };
31+}
32+
33+#endif /* !QRK_CD_PLAYER_H */
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/audio/sdl_mixer/SdlCdromInit.cpp (nonexistent)
+++ trunk/libs/audio/sdl_mixer/SdlCdromInit.cpp (revision 1816)
@@ -0,0 +1,36 @@
1+/*!
2+ \file
3+ \brief SDL_INIT_CDROM の初期化
4+
5+ \author Satofumi KAMIMURA
6+
7+ $Id$
8+*/
9+
10+#include "SdlInit.h"
11+#include "SdlCdromInit.h"
12+#include <SDL.h>
13+
14+using namespace qrk;
15+
16+
17+struct SdlCdromInit::pImpl : private SdlInit
18+{
19+ static bool initialized_;
20+};
21+bool SdlCdromInit::pImpl::initialized_ = false;
22+
23+
24+SdlCdromInit::SdlCdromInit(void) : pimpl(new pImpl)
25+{
26+ if (pimpl->initialized_) {
27+ return;
28+ }
29+ pimpl->initialized_ =
30+ (SDL_InitSubSystem(SDL_INIT_CDROM) < 0) ? false : true;
31+}
32+
33+
34+SdlCdromInit::~SdlCdromInit(void)
35+{
36+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/audio/sdl_mixer/Makefile (revision 1815)
+++ trunk/libs/audio/sdl_mixer/Makefile (revision 1816)
@@ -24,16 +24,20 @@
2424 $(AUDIO_SDL_LIB) : \
2525 $(AUDIO_SDL_LIB)(SdlAudioInit.o) \
2626 $(AUDIO_SDL_LIB)(SdlMixerInit.o) \
27+ $(AUDIO_SDL_LIB)(SdlCdromInit.o) \
2728 $(AUDIO_SDL_LIB)(Audio.o) \
2829 $(AUDIO_SDL_LIB)(Volume.o) \
2930 $(AUDIO_SDL_LIB)(SoundEffect.o) \
3031 $(AUDIO_SDL_LIB)(BackMusic.o) \
32+ $(AUDIO_SDL_LIB)(CdPlayer.o) \
3133
3234 # DO NOT DELETE
3335
3436 Audio.o: ../Audio.h SdlMixerInit.h
3537 BackMusic.o: ../BackMusic.h
38+CdPlayer.o: CdPlayer.h SdlCdromInit.h
3639 SdlAudioInit.o: ../../system/sdl/SdlInit.h SdlAudioInit.h
40+SdlCdromInit.o: ../../system/sdl/SdlInit.h SdlCdromInit.h
3741 SdlMixerInit.o: SdlAudioInit.h SdlMixerInit.h
3842 SoundEffect.o: ../SoundEffect.h ../Audio.h
3943 Volume.o: ../Volume.h
--- trunk/libs/audio/sdl_mixer/SdlAudioInit.h (revision 1815)
+++ trunk/libs/audio/sdl_mixer/SdlAudioInit.h (revision 1816)
@@ -15,7 +15,7 @@
1515
1616 namespace qrk
1717 {
18- //! SDL_ttf の初期化クラス
18+ //! SDL_INIT_AUDIO の初期化クラス
1919 class SdlAudioInit
2020 {
2121 SdlAudioInit(const SdlAudioInit& rhs);
旧リポジトリブラウザで表示