Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Applications dir to snake case #46

Merged
merged 7 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ endif()
add_library(${PROJECT_NAME} OBJECT ${C2A_SRCS})

if(USE_ALL_C2A_CORE_APPS)
add_subdirectory(Applications)
add_subdirectory(applications)
target_sources(${PROJECT_NAME} PUBLIC $<TARGET_OBJECTS:C2A_CORE_APPS>)
endif()

if(USE_ALL_C2A_CORE_TEST_APPS)
add_subdirectory(Applications/TestApp)
add_subdirectory(applications/test_app)
target_sources(${PROJECT_NAME} PUBLIC $<TARGET_OBJECTS:C2A_CORE_TEST_APPS>)
endif()

Expand Down
2 changes: 1 addition & 1 deletion System/ApplicationManager/app_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <src_user/Settings/sils_define.h>

#include <string.h>
#include "../../Applications/nop.h"
#include "../../applications/nop.h"
#include "../EventManager/event_logger.h"
#include "../TimeManager/time_manager.h"
#include "../WatchdogTimer/watchdog_timer.h"
Expand Down
2 changes: 1 addition & 1 deletion System/EventManager/event_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <string.h>
#include <stdlib.h>
#include "../../TlmCmd/common_cmd_packet_util.h"
#include "../../Applications/timeline_command_dispatcher_id_define.h"
#include "../../applications/timeline_command_dispatcher_id_define.h"
#include "../TimeManager/time_manager.h"

#ifdef EL_IS_ENABLE_TLOG
Expand Down
2 changes: 1 addition & 1 deletion System/ModeManager/mode_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "../../TlmCmd/common_cmd_packet_util.h"
#include <src_user/TlmCmd/command_definitions.h>
#include "../../TlmCmd/packet_handler.h"
#include "../../Applications/timeline_command_dispatcher_id_define.h"
#include "../../applications/timeline_command_dispatcher_id_define.h"
#include "../../Library/endian.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion TlmCmd/block_command_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <string.h>
#include "block_command_loader.h"
#include "../Applications/timeline_command_dispatcher_id_define.h"
#include "../applications/timeline_command_dispatcher_id_define.h"
#include "block_command_executor.h"
#include <src_user/TlmCmd/command_definitions.h> // for rotate/combine block
#include "common_cmd_packet_util.h"
Expand Down
4 changes: 2 additions & 2 deletions TlmCmd/block_command_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#define BLOCK_COMMAND_LOADER_H_

#include "./block_command_table.h"
#include "../Applications/timeline_command_dispatcher_id_define.h"
#include "../applications/timeline_command_dispatcher_id_define.h"
#include "../System/TimeManager/obc_time.h"
#include <src_user/Applications/app_registry.h>
#include <src_user/applications/app_registry.h>


/**
Expand Down
2 changes: 1 addition & 1 deletion TlmCmd/common_cmd_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef enum
#include <src_user/Settings/TlmCmd/Ccsds/apid_define.h>

// TL_MIS を有効にするかどうか
#include <src_user/Settings/Applications/timeline_command_dispatcher_define.h>
#include <src_user/Settings/applications/timeline_command_dispatcher_define.h>

/**
* @enum CCP_EXEC_STS
Expand Down
4 changes: 2 additions & 2 deletions TlmCmd/common_cmd_packet_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#include "common_cmd_packet.h"
#include "packet_handler.h"
#include "../Applications/timeline_command_dispatcher_id_define.h"
#include "../applications/timeline_command_dispatcher_id_define.h"
#include "block_command_table.h" // for bct_id
#include <src_user/Applications/app_registry.h>
#include <src_user/applications/app_registry.h>

/**
* @enum CCP_UTIL_ACK
Expand Down
2 changes: 1 addition & 1 deletion TlmCmd/packet_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "common_tlm_cmd_packet.h"
#include "packet_list.h"
#include "../Applications/timeline_command_dispatcher_id_define.h"
#include "../applications/timeline_command_dispatcher_id_define.h"

#define TL_TLM_PAGE_SIZE (32)
#define TL_TLM_PAGE_MAX (8)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define DCU_LOG_MAX (16) //!< 保存するログの最大数

// DCU_LOG_MAX の user オーバーライド
#include <src_user/Settings/Applications/divided_cmd_utility_params.h>
#include <src_user/Settings/applications/divided_cmd_utility_params.h>

// key が uint8_t なので,それ以下を要請する
#if DCU_LOG_MAX > 255
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#define TLM_MGR_BC_ROLE_AT_BC_9 (TLM_MGR_BC_ROLE_LOW_FREQ_TLM) // TLM_MGR_BC_ROLE_HIGH_FREQ_TLM が固まらないようにここに入れている

// user 設定
#include <src_user/Settings/Applications/telemetry_manager_define.h>
#include <src_user/Settings/Applications/telemetry_manager_params.h>
#include <src_user/Settings/applications/telemetry_manager_define.h>
#include <src_user/Settings/applications/telemetry_manager_params.h>

// 現状, BC#9 は low ではないとだめ (deploy と combine するため)
#if !(TLM_MGR_BC_ROLE_AT_BC_9 == TLM_MGR_BC_ROLE_LOW_FREQ_TLM)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef TIMELINE_COMMAND_DISPATCHER_ID_DEFINE_H_
#define TIMELINE_COMMAND_DISPATCHER_ID_DEFINE_H_

#include <src_user/Settings/Applications/timeline_command_dispatcher_define.h>
#include <src_user/Settings/applications/timeline_command_dispatcher_define.h>

/**
* @enum TLCD_ID
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion c2a_core_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "./TlmCmd/command_analyze.h"
#include "./TlmCmd/telemetry_frame.h"

#include <src_user/Applications/app_registry.h>
#include <src_user/applications/app_registry.h>

// git revisionをコードに埋め込む
const char GIT_REV_CORE[41] = GIT_REVISION_C2A_CORE;
Expand Down
16 changes: 8 additions & 8 deletions docs/general/coding_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ typedef uint32_t flash_block_t;


## 個別箇所についての命名など [M]
### Applications/UserDefined
### applications/user_defined
- ファイル名と AppInfo 構造体名を一致させる(スタイルを除く)
- AppInfo 構造体名とそのインスタンス名を一致させる(スタイルを除く)
- 接頭辞は, `APP_HOGE` で `HOGE` 部分はケースバイケース.

例:

Applications/UserDefined/data_recorder.c
applications/user_defined/data_recorder.c
```cpp
static DataRecorder data_recorder_;
const DataRecorder* const data_recorder = &data_recorder_;
Expand All @@ -232,7 +232,7 @@ AppInfo APP_DR_create_app(void)
}
```

Applications/UserDefined/data_recorder.h
applications/user_defined/data_recorder.h
```cpp
#ifndef DATA_RECORDER_H_
#define DATA_RECORDER_H_
Expand All @@ -253,7 +253,7 @@ int Cmd_APP_DR_SET_PARAMS(const CommonCmdPacket* packet);
```


### Applications/DriverInstances
### applications/driver_instances
- ファイル名は `di_${IFやデバイス名}`
- Driver 構造体名とそのインスタンス名を一致させる(スタイルを除く)
- 特定のドライバ構造体のインスタンスが複数ある場合は,配列にまとめる.
Expand Down Expand Up @@ -292,7 +292,7 @@ RM3100_Driver rm3100_driver[RM3100_IDX_MAX];
```


### Applications/Middleware
### applications/middleware
- ファイル名は `mw_${IFやデバイス名}`
- 接頭辞は `MW_${IFやデバイス名}`

Expand All @@ -312,7 +312,7 @@ const MwFlash* const mw_flash = &mw_flash_;
```


### Applications その他
### applications その他
`AR_APP_ID` enumの接頭辞は,
- `AR_NOP`: NOP
- `AR_APP_HOGE`: UserDefined
Expand All @@ -322,8 +322,8 @@ const MwFlash* const mw_flash = &mw_flash_;
とし,基本的には `HOGE` は ファイル名にする.

つまり,
- Applications/UserDefined/data_recorder.h → `AR_APP_DATA_RECORDER`
- Applications/DriverInstances/di_pcdu.h → `AR_DI_PCDU`
- applications/user_defined/data_recorder.h → `AR_APP_DATA_RECORDER`
- applications/driver_instances/di_pcdu.h → `AR_DI_PCDU`

となる.

Expand Down
2 changes: 1 addition & 1 deletion script/add_section/settings.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sub GetSetting {
$SETTING{'FILE_ENCODING'} = 'utf8';
$SETTING{'LOG_FILE'} = './log.log';
$SETTING{'SEARCH_PATH'} = [
'Applications',
'applications',
'Drivers',
'hal',
'Library',
Expand Down
2 changes: 1 addition & 1 deletion script/ci/check_encoding.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
]
},
"target_dirs" : [
"Applications/",
"applications/",
"Drivers/",
"hal/",
"Library/",
Expand Down
49 changes: 49 additions & 0 deletions script/migration/v4-rename-applications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
# Script -> script

## c2a-core ref
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#src_core/Applications/TestApp#src_core/applications/test_app#g"
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#src_core\\\Applications\\\TestApp#src_core\\\applications\\\test_app#g"

find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#src_core/Applications#src_core/applications#g"
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#src_core\\\Applications#src_core\\\applications#g"

find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#\${C2A_CORE_DIR}/Applications#\${C2A_CORE_DIR}/applications#g"

# C2A user code
mv src/src_user/Applications src/src_user/applications

mv src/src_user/applications/DriverInstances src/src_user/applications/driver_instances
mv src/src_user/applications/Middleware src/src_user/applications/middleware
mv src/src_user/applications/UserDefined src/src_user/applications/user_defined

find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Applications/DriverInstances#applications/driver_instances#g"
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Applications\\\DriverInstances#applications\\\driver_instances#g"

find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Applications/Middleware#applications/middleware#g"
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Applications\\\Middleware#applications\\\middleware#g"

find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Applications/UserDefined#applications/user_defined#g"
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Applications\\\UserDefined#applications\\\user_defined#g"

find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#/Applications#/applications#g"
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#\\\Applications#\\\applications#g"

# CMake
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#DriverInstances/#driver_instances/#g"
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Middleware/#middleware/#g"
find . -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#UserDefined/#user_defined/#g"

# Settings
mv src/src_user/Settings/Applications src/src_user/Settings/applications

# Test
mv src/src_user/Test/test/src_core/Applications src/src_user/Test/test/src_core/applications

mv src/src_user/Test/test/src_user/Applications src/src_user/Test/test/src_user/applications
mv src/src_user/Test/test/src_user/Applications/DriverInstances src/src_user/Test/test/src_user/applications/driver_instances
mv src/src_user/Test/test/src_user/Applications/Middleware src/src_user/Test/test/src_user/applications/middleware
mv src/src_user/Test/test/src_user/Applications/UserDefined src/src_user/Test/test/src_user/applications/user_defined

# Script
find src/src_user/script -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Applications#applications#g"