本文整理汇总了C++中Main函数的典型用法代码示例。如果您正苦于以下问题:C++ Main函数的具体用法?C++ Main怎么用?C++ Main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Main函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
std::vector<option> options;
for (auto it = options_plus.begin(); it != options_plus.end(); ++it) {
option op = {it->name, it->has_arg, it->flag, it->val};
options.push_back(op);
}
Config config;
std::string train_file;
std::string save_vectors;
std::string save_vectors_bin;
while (1) {
int option_index = 0;
int opt = getopt_long(argc, argv, "hv", options.data(), &option_index);
if (opt == -1) break;
switch (opt) {
case 0: break;
case 'h': print_usage(); return 0;
case 'v': config.verbose = true; break;
case 'a': config.dimension = atoi(optarg); break;
case 'b': config.min_count = atoi(optarg); break;
case 'c': config.window_size = atoi(optarg); break;
case 'd': config.n_threads = atoi(optarg); break;
case 'e': config.max_iterations = atoi(optarg); break;
case 'f': config.negative = atoi(optarg); break;
case 'g': config.starting_alpha = atof(optarg); break;
case 'i': config.subsampling = atof(optarg); break;
case 'j': config.skip_gram = true; break;
case 'k': config.hierarchical_softmax = true; break;
case 'l': config.sent_vector = true; break;
case 'm': train_file = std::string(optarg); break;
case 'n': save_vectors = std::string(optarg); break;
case 'o': save_vectors_bin = std::string(optarg); break;
default: abort();
}
}
if (!train_file.empty()) {
if (!save_vectors.empty()) {
Main(train_file, save_vectors, config);
return 0;
}
else if (!save_vectors_bin.empty()) {
config.binary = true;
Main(train_file, save_vectors_bin, config);
return 0;
}
}
print_usage();
return 0;
}
开发者ID:Turbo-wang,项目名称:multivec,代码行数:54,代码来源:word2vec-main.cpp
示例2: _set_thread_local_invalid_parameter_handler
int OverlappedCall::TryMain()
{
int ret;
__try
{
_set_thread_local_invalid_parameter_handler(InvalidCrtParameterHandler);
ret = Main();
}
__except(MainExceptionFilter(GetExceptionInformation()))
{
#if TRACING == 1
{
TRACELOCK();
TRACESTREAM << std::hex << GetCurrentThreadId()<< L": Terminating; " << *this << std::endl;
}
#endif
NotifyInterpreterOfTermination();
ret = 0;
}
Term(); // Thread is terminating, so don't want handles (also lets Complete() know we have terminated)
return ret;
}
开发者ID:brunobuzzi,项目名称:Dolphin,代码行数:25,代码来源:thrdcall.cpp
示例3: WinMain
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow )
{
App::hInstance = hInstance;
App::hPrevInstance = hPrevInstance;
App::CmdLine = lpszCmdLine;
App::nCmdShow = nCmdShow;
int ret=Main();
// TextWindow open
if (App::TextWindow && (App::TextWindow->StayOpen))
{
App::TextWindow->Parent=NULL;
App::MainWindow=(Object *) App::TextWindow;
String S(GetWindowTextLength(App::MainWindow->hWnd)+1);
GetWindowText(App::MainWindow->hWnd,S,S.Size());
S.Update();
S << " (finished)";
SetWindowText(App::MainWindow->hWnd,S);
ShowWindow(App::MainWindow->hWnd, SW_SHOW );
// wait until closed
return App::MessageLoop();
// delete App::TextWindow; ??
}
return ret;
}
开发者ID:DavidKinder,项目名称:Level9,代码行数:26,代码来源:main.cpp
示例4: ResetISR
//*****************************************************************************
//
// This is the code that gets called when the processor first starts execution
// following a reset event. Only the absolutely necessary set is performed,
// after which the application supplied entry() routine is called. Any fancy
// actions (such as making decisions based on the reset cause register, and
// resetting the bits in that register) are left solely in the hands of the
// application.
//
//*****************************************************************************
void
ResetISR(void)
{
unsigned long *pulSrc, *pulDest;
//
// Copy the data segment initializers from flash to SRAM.
//
pulSrc = &_etext;
for(pulDest = &_data; pulDest < &_edata; ) {
*pulDest++ = *pulSrc++;
}
//
// Zero fill the bss segment.
//
for(pulDest = &_bss; pulDest < &_ebss; ) {
*pulDest++ = 0;
}
//
// Call the application's entry point.
//
Main();
}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:35,代码来源:startup.c
示例5: lock
bool TaskQueue::ProcessOneMainTask() { // static
std_::unique_ptr<Task> task;
{
QMutexLocker lock(&Main().tasks_mutex_);
auto &tasks = Main().tasks_;
if (tasks.empty()) {
return false;
}
task.reset(tasks.front());
tasks.pop_front();
}
(*task)();
return true;
}
开发者ID:Drru97,项目名称:tdesktop,代码行数:16,代码来源:task_queue.cpp
示例6: main
int main(int argc, char **argv)
{
while (true) {
int action = Main();
switch (action) {
case LAUNCH_NICKEL:
KoboExecNickel();
return EXIT_FAILURE;
case SimulatorPromptWindow::FLY:
KoboRunXCSoar("-fly");
/* return to menu after XCSoar quits */
break;
case SimulatorPromptWindow::SIMULATOR:
KoboRunXCSoar("-simulator");
/* return to menu after XCSoar quits */
break;
case POWEROFF:
KoboPowerOff();
return EXIT_SUCCESS;
default:
return EXIT_SUCCESS;
}
}
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:29,代码来源:KoboMenu.cpp
示例7: Main
static int
Main()
{
dialog_settings.SetDefaults();
ScreenGlobalInit screen_init;
Layout::Initialize({600, 800});
InitialiseFonts();
DialogLook dialog_look;
dialog_look.Initialise();
TopWindowStyle main_style;
main_style.Resizable();
SingleWindow main_window;
main_window.Create(_T("XCSoar/KoboMenu"), {600, 800}, main_style);
main_window.Show();
global_dialog_look = &dialog_look;
global_main_window = &main_window;
int action = Main(main_window, dialog_look);
main_window.Destroy();
DeinitialiseFonts();
return action;
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:30,代码来源:KoboMenu.cpp
示例8: main
int main( int argc, char* argv[] )
{
Allocator::Enable( true );
Allocator::GetDefault().Initialize( g_MainMemorySize );
Main( argc, argv );
#if DO_PROFILING
#if BUILD_DEBUG // I ship Release ContentSyncer, not Final.
Profiler::GetInstance()->Dump( FileStream( "profiler.txt", FileStream::EFM_Write ) );
#endif
Profiler::DeleteInstance();
#endif
#if BUILD_DEBUG
Allocator::GetDefault().Report( FileStream( "content-syncer-memory-exit-report.txt", FileStream::EFM_Write ) );
#endif
DEBUGASSERT( Allocator::GetDefault().CheckForLeaks() );
Allocator::GetDefault().ShutDown();
DEBUGASSERT( _CrtCheckMemory() );
DEBUGASSERT( !_CrtDumpMemoryLeaks() );
return 0;
}
开发者ID:MinorKeyGames,项目名称:Eldritch,代码行数:25,代码来源:main.cpp
示例9: Main
void BaseTask::Run()
{
if (_cancelled) {
return;
}
Main();
}
开发者ID:melode11,项目名称:TaskQueue,代码行数:7,代码来源:BaseTask.cpp
示例10: WinMain
int APIENTRY WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
{
char **argv= NULL;
int argc;
win_command_line = GetCommandLine();
argc = makeargv(win_command_line, " \t\n", &argv);
Main(argc, (char **) argv);
freemakeargv(argv);
// attempt to restart if requested
if(restart_required > 0){
STARTUPINFO si;
PROCESS_INFORMATION pi;
LOG_INFO("Restarting %s", win_command_line);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
CreateProcess(NULL, win_command_line,
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
DETACHED_PROCESS, // Keep this separate
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi); // Pointer to PROCESS_INFORMATION structure
}
return 0;
}
开发者ID:bobbylovin26,项目名称:Eternal-Lands,代码行数:34,代码来源:main.c
示例11: WinMain
/*
WinMain()
*/
int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int nCmdShow)
{
Main();
return (int)0;
}
开发者ID:erio-nk,项目名称:MyCxxProgram2011,代码行数:10,代码来源:Main.cpp
示例12: Prog
void Prog() {
MatchString("PROGRAM");
Header();
TopDecls();
Main();
Match('.');
}
开发者ID:A-deLuna,项目名称:crenshaw-c-x86_64-compiler,代码行数:7,代码来源:main.c
示例13: Boot
int Boot(){
if (!RegisterClassEx(&WndClassEx_Properties.Get_WndClass_Ex()))return -1;
WinMain_Properties.Set_hWnd(CreateWindowEx(WinMain_Properties, WndClassEx_Properties, Window_Properties));
ShowWindow(WinMain_Properties.Get_hWnd(), WinMain_Properties.Get_nCmdShow());
UpdateWindow(WinMain_Properties.Get_hWnd());
SetWindowLong(WinMain_Properties.Get_hWnd(), GWL_USERDATA, (LONG)this);
MSG msg;
DrawClass_Init();
unsigned int STime, PedTime, RTime = timeGetTime(), FCounter = 0;
while (!EndFlag){
STime = timeGetTime();
if (PeekMessage(&msg, WinMain_Properties.Get_hWnd(), 0, 0, PM_REMOVE)){
if (msg.message != WM_QUIT){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else break;
}
Main();
PedTime = timeGetTime() - STime;
Wait((1000 / Window_Properties.Get_Set_Fps() > PedTime) ? (1000 / Window_Properties.Get_Set_Fps() - PedTime) : 0);
if (timeGetTime() - RTime >= 1000){
RTime = timeGetTime();
Window_Properties.Set_Measured_Fps(FCounter);
FCounter = 0;
}
++FCounter;
}
return 0;
}
开发者ID:ArkBeer7,项目名称:ArkLib,代码行数:33,代码来源:ArkLib.hpp
示例14: main
int main()
{
while (scanf("%d%d%d",&A,&B,&N),N)
{
Main();
}
}
开发者ID:linmx0130,项目名称:OJCode,代码行数:7,代码来源:main.cpp
示例15: Main
inline int Main( int argc, char* const argv[] ) {
Config config;
// !TBD: This doesn't always work, for some reason
// if( isDebuggerActive() )
// config.useStream( "debug" );
return Main( argc, argv, config );
}
开发者ID:audioplastic,项目名称:Catch,代码行数:7,代码来源:catch_runner.hpp
示例16: _tWinMain
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
return Main(hInstance);
}
开发者ID:andantissimo,项目名称:Apple-Keyboard-Bridge,代码行数:8,代码来源:akb.c
示例17: EveryAction
void CSoldierBase::SeqMain()
{
EveryAction();
Main();
}
开发者ID:programmerMOT,项目名称:gunhound,代码行数:8,代码来源:CSoldierBase.cpp
示例18: main
int main()
{
while (scanf("%d",&N),N)
{
Main();
}
return 0;
}
开发者ID:linmx0130,项目名称:OJCode,代码行数:8,代码来源:la4670.cpp
示例19: main
int main()
{
while (scanf("%d%d",&N,&R),N!=0)
{
Main();
}
return 0;
}
开发者ID:linmx0130,项目名称:OJCode,代码行数:8,代码来源:main.cpp
示例20: sAltonaMain
int sAltonaMain()
{
sAltonaInit();
sLog("sys","calling Main()");
Main();
sLog("sys","Main() returned");
return sAltonaExit();
}
开发者ID:CaineQT,项目名称:fr_public,代码行数:8,代码来源:Machine.cpp
注:本文中的Main函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论