@@ -811,9 +811,54 @@ static bool processReset(bool rubyExc) {
811
811
return 0 ;
812
812
}
813
813
814
+ #if RAPI_FULL > 187
815
+ static VALUE newStringUTF8 (const char *string, long length) {
816
+ return rb_enc_str_new (string, length, rb_utf8_encoding ());
817
+ }
818
+ #else
819
+ #define newStringUTF8 rb_str_new
820
+ #endif
821
+
822
+ struct evalArg {
823
+ VALUE string;
824
+ VALUE filename;
825
+ };
826
+
827
+ static VALUE evalHelper (evalArg *arg) {
828
+ VALUE argv[] = {arg->string , Qnil, arg->filename };
829
+ return rb_funcall2 (Qnil, rb_intern (" eval" ), ARRAY_SIZE (argv), argv);
830
+ }
831
+
832
+ static VALUE evalString (VALUE string, VALUE filename, int *state) {
833
+ evalArg arg = {string, filename};
834
+ return rb_protect ((VALUE (*)(VALUE))evalHelper, (VALUE)&arg, state);
835
+ }
836
+
837
+ static void runCustomScript (const std::string &filename) {
838
+ std::string scriptData;
839
+
840
+ if (!readFileSDL (filename.c_str (), scriptData)) {
841
+ showMsg (std::string (" Unable to open '" ) + filename + " '" );
842
+ return ;
843
+ }
844
+
845
+ evalString (newStringUTF8 (scriptData.c_str (), scriptData.size ()),
846
+ newStringUTF8 (filename.c_str (), filename.size ()), NULL );
847
+ }
848
+
814
849
RB_METHOD_GUARD (mriRgssMain) {
815
850
RB_UNUSED_PARAM;
816
-
851
+
852
+ /* Execute postload scripts */
853
+ const Config &conf = shState->rtData ().config ;
854
+ for (std::vector<std::string>::const_iterator i = conf.postloadScripts .begin ();
855
+ i != conf.postloadScripts .end (); ++i)
856
+ {
857
+ if (shState->rtData ().rqTerm )
858
+ break ;
859
+ runCustomScript (*i);
860
+ }
861
+
817
862
while (true ) {
818
863
VALUE exc = Qnil;
819
864
#if RAPI_FULL < 270
@@ -880,41 +925,6 @@ RB_METHOD(_kernelCaller) {
880
925
return trace;
881
926
}
882
927
883
- #if RAPI_FULL > 187
884
- static VALUE newStringUTF8 (const char *string, long length) {
885
- return rb_enc_str_new (string, length, rb_utf8_encoding ());
886
- }
887
- #else
888
- #define newStringUTF8 rb_str_new
889
- #endif
890
-
891
- struct evalArg {
892
- VALUE string;
893
- VALUE filename;
894
- };
895
-
896
- static VALUE evalHelper (evalArg *arg) {
897
- VALUE argv[] = {arg->string , Qnil, arg->filename };
898
- return rb_funcall2 (Qnil, rb_intern (" eval" ), ARRAY_SIZE (argv), argv);
899
- }
900
-
901
- static VALUE evalString (VALUE string, VALUE filename, int *state) {
902
- evalArg arg = {string, filename};
903
- return rb_protect ((VALUE (*)(VALUE))evalHelper, (VALUE)&arg, state);
904
- }
905
-
906
- static void runCustomScript (const std::string &filename) {
907
- std::string scriptData;
908
-
909
- if (!readFileSDL (filename.c_str (), scriptData)) {
910
- showMsg (std::string (" Unable to open '" ) + filename + " '" );
911
- return ;
912
- }
913
-
914
- evalString (newStringUTF8 (scriptData.c_str (), scriptData.size ()),
915
- newStringUTF8 (filename.c_str (), filename.size ()), NULL );
916
- }
917
-
918
928
VALUE kernelLoadDataInt (const char *filename, bool rubyExc, bool raw);
919
929
920
930
struct BacktraceData {
0 commit comments