flutter: 文件重命名

This commit is contained in:
Calcitem 2020-11-07 08:02:33 +08:00
parent 538d32bc78
commit 14e15a1430
28 changed files with 73 additions and 71 deletions

View File

@ -7,10 +7,10 @@ add_library( # Sets the name of the library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/mill-engine.cpp
../../command/command-channel.cpp
../../command/command-queue.cpp
../../command/engine-main.cpp)
src/main/cpp/mill_engine.cpp
../../command/command_channel.cpp
../../command/command_queue.cpp
../../command/engine_main.cpp)
find_library( # Sets the name of the path variable.

View File

@ -9,17 +9,17 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "../../../../../command/engine-main.h"
#include "../../../../../command/engine-state.h"
#include "../../../../../command/command-channel.h"
#include "../../../../../command/engine_main.h"
#include "../../../../../command/engine_state.h"
#include "../../../../../command/command_channel.h"
extern "C" {
State state = Ready;
State state = STATE_READY;
pthread_t thread_id = 0;
void *engineThread(void *) {
void *engineThread(void *)
{
printf("Engine Think Thread enter.\n");
engineMain();
@ -36,8 +36,8 @@ JNIEXPORT jint JNICALL
Java_com_calcitem_sanmill_MillEngine_shutdown(JNIEnv *, jobject);
JNIEXPORT jint JNICALL
Java_com_calcitem_sanmill_MillEngine_startup(JNIEnv *env, jobject obj) {
Java_com_calcitem_sanmill_MillEngine_startup(JNIEnv *env, jobject obj)
{
if (thread_id) {
Java_com_calcitem_sanmill_MillEngine_shutdown(env, obj);
pthread_join(thread_id, NULL);
@ -56,11 +56,11 @@ Java_com_calcitem_sanmill_MillEngine_startup(JNIEnv *env, jobject obj) {
}
JNIEXPORT jint JNICALL
Java_com_calcitem_sanmill_MillEngine_send(JNIEnv *env, jobject, jstring command) {
Java_com_calcitem_sanmill_MillEngine_send(JNIEnv *env, jobject, jstring command)
{
const char *pCommand = env->GetStringUTFChars(command, JNI_FALSE);
if (pCommand[0] == 'g' && pCommand[1] == 'o') state = Thinking;
if (pCommand[0] == 'g' && pCommand[1] == 'o') state = STATE_THINKING;
CommandChannel *channel = CommandChannel::getInstance();
@ -74,8 +74,8 @@ Java_com_calcitem_sanmill_MillEngine_send(JNIEnv *env, jobject, jstring command)
}
JNIEXPORT jstring JNICALL
Java_com_calcitem_sanmill_MillEngine_read(JNIEnv *env, jobject) {
Java_com_calcitem_sanmill_MillEngine_read(JNIEnv *env, jobject)
{
char line[4096] = {0};
CommandChannel *channel = CommandChannel::getInstance();
@ -90,15 +90,15 @@ Java_com_calcitem_sanmill_MillEngine_read(JNIEnv *env, jobject) {
strstr(line, "bestmove") ||
strstr(line, "nobestmove")) {
state = Ready;
state = STATE_READY;
}
return env->NewStringUTF(line);
}
JNIEXPORT jint JNICALL
Java_com_calcitem_sanmill_MillEngine_shutdown(JNIEnv *env, jobject obj) {
Java_com_calcitem_sanmill_MillEngine_shutdown(JNIEnv *env, jobject obj)
{
Java_com_calcitem_sanmill_MillEngine_send(env, obj, env->NewStringUTF("quit"));
pthread_join(thread_id, NULL);
@ -109,13 +109,15 @@ Java_com_calcitem_sanmill_MillEngine_shutdown(JNIEnv *env, jobject obj) {
}
JNIEXPORT jboolean JNICALL
Java_com_calcitem_sanmill_MillEngine_isReady(JNIEnv *, jobject) {
return static_cast<jboolean>(state == Ready);
Java_com_calcitem_sanmill_MillEngine_isReady(JNIEnv *, jobject)
{
return static_cast<jboolean>(state == STATE_READY);
}
JNIEXPORT jboolean JNICALL
Java_com_calcitem_sanmill_MillEngine_isThinking(JNIEnv *, jobject) {
return static_cast<jboolean>(state == Thinking);
Java_com_calcitem_sanmill_MillEngine_isThinking(JNIEnv *, jobject)
{
return static_cast<jboolean>(state == STATE_THINKING);
}
}

View File

@ -4,8 +4,8 @@
//
#include <stdlib.h>
#include "command-queue.h"
#include "command-channel.h"
#include "command_queue.h"
#include "command_channel.h"
CommandChannel *CommandChannel::instance = NULL;

View File

@ -3,8 +3,8 @@
// Runner
//
#include <string.h>
#include "command-queue.h"
#include <cstring>
#include "command_queue.h"
CommandQueue::CommandQueue()
{

View File

@ -2,7 +2,7 @@
#include <stdarg.h>
#include "base.h"
#include "command-channel.h"
#include "command_channel.h"
void println(const char *str, ...) {
@ -17,8 +17,9 @@ void println(const char *str, ...) {
CommandChannel *channel = CommandChannel::getInstance();
while (!channel->pushResponse(buffer))
Idle();
while (!channel->pushResponse(buffer)) {
Idle();
}
}
int engineMain(void)

View File

@ -6,7 +6,7 @@
#ifndef ENGINE_MAIN_H
#define ENGINE_MAIN_H
void println(const char *sz, ...);
void println(const char *str, ...);
int engineMain();

View File

@ -8,8 +8,8 @@
typedef enum
{
Ready,
Thinking
STATE_READY,
STATE_THINKING
} State;
#endif /* ENGINE_STATE_H */

View File

@ -16,7 +16,7 @@
self = [super init];
if (self) {
state = Ready;
state = STATE_READY;
}
return self;
@ -58,7 +58,7 @@
-(int) send: (NSString *) command {
if ([command hasPrefix:@"go"]) {
state = Thinking;
state = STATE_THINKING;
}
CommandChannel *channel = CommandChannel::getInstance();
@ -87,7 +87,7 @@
[line hasPrefix:@"bestmove"] ||
[line hasPrefix:@"nobestmove"]) {
state = Ready;
state = STATE_READY;
}
return line;
@ -106,11 +106,11 @@
}
-(BOOL) isReady {
return state == Ready;
return state == STATE_READY;
}
-(BOOL) isThinking {
return state == Thinking;
return state == STATE_THINKING;
}
@end

View File

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import '../board/painter-base.dart';
import '../common/color-consts.dart';
import 'board-widget.dart';
import '../board/painter_base.dart';
import '../common/color.dart';
import 'board_widget.dart';
class BoardPainter extends PainterBase {
//

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import '../common/color-consts.dart';
import '../common/color.dart';
import '../game/battle.dart';
import 'board-painter.dart';
import 'pieces-painter.dart';
import 'words-on-board.dart';
import 'board_painter.dart';
import 'pieces_painter.dart';
import 'words_on_board.dart';
class BoardWidget extends StatelessWidget {
//

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'board-widget.dart';
import 'board_widget.dart';
abstract class PainterBase extends CustomPainter {
//

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import '../board/painter-base.dart';
import '../common/color-consts.dart';
import '../mill/mill-base.dart';
import '../board/painter_base.dart';
import '../common/color.dart';
import '../mill/mill.dart';
import '../mill/position.dart';
import 'board-widget.dart';
import 'board_widget.dart';
class PiecePaintStub {
final String piece;

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import '../common/color-consts.dart';
import '../common/color.dart';
class WordsOnBoard extends StatelessWidget {
//

View File

@ -1,6 +1,6 @@
import 'package:flutter/services.dart';
import '../mill/mill-base.dart';
import '../mill/mill.dart';
import '../mill/position.dart';
import 'engine.dart';

View File

@ -1,4 +1,4 @@
import '../mill/mill-base.dart';
import '../mill/mill.dart';
import '../mill/position.dart';
class Battle {

View File

@ -1,10 +1,9 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import './routes/main-menu.dart';
import 'package:flutter/material.dart';
import './routes/main_menu.dart';
import 'services/audios.dart';
import 'services/player.dart';

View File

@ -1,5 +1,5 @@
import '../mill/mill-recorder.dart';
import 'mill-base.dart';
import '../mill/recorder.dart';
import 'mill.dart';
class Position {
//

View File

@ -1,4 +1,4 @@
import 'mill-base.dart';
import 'mill.dart';
import 'position.dart';
class MillRecorder {

View File

@ -1,16 +1,16 @@
import 'package:flutter/material.dart';
import '../board/board-widget.dart';
import '../common/color-consts.dart';
import '../board/board_widget.dart';
import '../common/color.dart';
import '../common/toast.dart';
import '../engine/analysis.dart';
import '../engine/engine.dart';
import '../engine/native-engine.dart';
import '../engine/native_engine.dart';
import '../game/battle.dart';
import '../main.dart';
import '../mill/mill-base.dart';
import '../mill/mill.dart';
import '../services/player.dart';
import 'settings-page.dart';
import 'settings_page.dart';
class BattlePage extends StatefulWidget {
//

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import '../common/color-consts.dart';
import '../common/color.dart';
class EditPage extends StatefulWidget {
//

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import '../common/color-consts.dart';
import '../common/color.dart';
import '../engine/engine.dart';
import '../main.dart';
import 'battle-page.dart';
import 'settings-page.dart';
import 'battle_page.dart';
import 'settings_page.dart';
class MainMenu extends StatefulWidget {
@override

View File

@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:package_info/package_info.dart';
import '../common/color-consts.dart';
import '../common/color.dart';
import '../common/config.dart';
import '../common/toast.dart';
import '../services/audios.dart';
import '../services/player.dart';
import 'edit-page.dart';
import 'edit_page.dart';
class SettingsPage extends StatefulWidget {
@override