This commit is contained in:
Valk Richard Li 2020-04-10 04:27:19 -07:00 committed by GitHub
parent 240670ca85
commit c186d3b030
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View File

@ -20,6 +20,10 @@ nasal_runtime runtime;
std::string command;
int main()
{
#ifdef _WIN32
// use chcp 65001 to use unicode io
system("chcp 65001");
#endif
// this curve looks really cool
std::cout<<" __ _ "<<std::endl;
std::cout<<" /\\ \\ \\__ _ ___ __ _| | "<<std::endl;
@ -27,13 +31,13 @@ int main()
std::cout<<" / /\\ / (_| \\__ \\ (_| | | "<<std::endl;
std::cout<<" \\_\\ \\/ \\__,_|___/\\__,_|_|"<<std::endl;
#ifdef _WIN32
std::cout<<">> [system] Windows system."<<std::endl;
std::cout<<">> [system] Windows system."<<std::endl;
#endif
#ifdef _linux_
std::cout<<">> [system] Linux system."<<std::endl;
std::cout<<">> [system] Linux system."<<std::endl;
#endif
#ifdef TARGET_OS_MAC
std::cout<<">> [system] MacOS system."<<std::endl;
std::cout<<">> [system] MacOS system."<<std::endl;
#endif
std::cout<<">> Nasal interpreter ver 2.0 ."<<std::endl;
std::cout<<">> Code: https://github.com/ValKmjolnir/Nasal-Interpreter"<<std::endl;

View File

@ -158,7 +158,8 @@ void resource_file::input_file(std::string filename)
c=fin.get();
if(fin.eof())
break;
source_code.push_back(c<0? '?':c);
//source_code.push_back(c<0? '?':c);
source_code.push_back(c);
}
fin.close();
return;
@ -198,6 +199,17 @@ void resource_file::print_resource()
{
if(32<=source_code[i])
std::cout<<source_code[i];
else if(source_code[i]<0)
{
std::string tmp="";
for(;i<source_code.size();++i)
{
if(source_code[i]>=0)
break;
tmp.push_back(source_code[i]);
}
std::cout<<tmp;--i;
}
else
std::cout<<" ";
if(source_code[i]=='\n')

View File

@ -4786,7 +4786,7 @@ void nasal_runtime::main_proc(abstract_syntax_tree& root)
break;
}
end_time=std::time(NULL);
std::cout<<">> [Runtime] process exited after "<<end_time-begin_time<<" s ."<<std::endl;
std::cout<<std::endl<<">> [Runtime] process exited after "<<end_time-begin_time<<" s ."<<std::endl;
global_scope.clear();
main_local_scope.clear();
nasal_gc.gc_init();