Commit 8276089a authored by Ing. Miroslav Biňas PhD.'s avatar Ing. Miroslav Biňas PhD.
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request kpi/karel-the-robot!3
parents cc73ba1e 384eff64
...@@ -8,3 +8,4 @@ ...@@ -8,3 +8,4 @@
* Matej Focko * Matej Focko
* Janka Paračková * Janka Paračková
* Ján Juhár * Ján Juhár
* Emília Pietriková
This file contains: This file contains:
- Build requirements for Karel the robot - Build requirements for Karel the robot
- Installation instructions for Karel the robot - Installation instructions for Karel the robot
- Where to get more information on Karel the robot - Where to get more information on Karel the robot
- Notes about Karel the robot installation - Notes about Karel the robot installation
## Build requirements for Karel the robot ## Build requirements for Karel the robot
- gcc - gcc
- cmake - cmake
- make - make
- ncurses (pdcurses if Windows) - ncurses (pdcurses if Windows)
- gettext - gettext
## Installation instructions for Karel the robot ## Installation instructions for Karel the robot
...@@ -28,17 +27,16 @@ To compile this package: ...@@ -28,17 +27,16 @@ To compile this package:
5. Type `make install` to install library and the documentation. 5. Type `make install` to install library and the documentation.
6. You can remove the compiled library and object files from the directory by typing `make clean`. 6. You can remove the compiled library and object files from the directory by typing `make clean`.
## Notes about Karel the robot installation ## Notes about Karel the robot installation
Karel the robot has been run in the following configurations: Karel the robot has been run in the following configurations:
* amd64-*-linux - amd64-\*-linux
* i386-*-linux - i386-\*-linux
* Windows XP - Windows XP
* Windows Vista - Windows Vista
* Windows 7 - Windows 7
You will need an ANSI C Compiler (such as GCC), libc library and ncurses library to compile the source. You will need an ANSI C Compiler (such as GCC), libc library and ncurses library to compile the source.
# TODO # TODO
## NCurses alternatives ## Todo
### NCurses alternatives
- move from ncurses to s-lang - move from ncurses to s-lang
- avoid usage of movek() function for Karel's movement because of ncurses move() function - avoid usage of movek() function for Karel's movement because of ncurses move() function
...@@ -8,11 +10,35 @@ ...@@ -8,11 +10,35 @@
- SDL support for GUI - SDL support for GUI
- more interesting ;) - more interesting ;)
## Internationalization
### `_error_shut_off()` update
* make it with variable length arguments
* as the `printf()`
* use it always for shut off. not only when Karel is initialized and runnig (in GUI mode)
### Support for CI
* make the tests pass first before delivery/deployment
### Environment variable for world file
* don't need to recompile every time, when the same algorithm is used for different world
* benefit for testing purposes
## Done
### Internationalization
- gettext support for error messages - gettext support for error messages
- done in 2019.1
## Karel and Super Karel ### Karel and Super Karel
- karel should contain only the basic vocabulary: - karel should contain only the basic vocabulary:
...@@ -33,7 +59,10 @@ ...@@ -33,7 +59,10 @@
- super karel extension - super karel extension
- "batteries included" Karel - "batteries included" Karel
- done in 2019.1
## Naming Conventions ### Naming Conventions
* rewrite from Java/C++ style to C style * rewrite from Java/C++ style to C style
* done in 2019.1
\ No newline at end of file
# Changelog
## 2019.1 (30th july 2019)
* changelog added to the project ;)
* signal for `CTRL+C` is correctly handled and execution is terminated
* bug with length of command name is fixed
* coding style changed from CamelCase to snake_style
* library has been divided to two parts
* `karel.h` - only the basics commands and limited set of sensors
* `superkarel.h` - _batteries included karel_, all the sensors are available
* documentation was updated
* all internal variables and functions (private) have `_` prefix
* input file parses is much more sensitive to errors
* function `get_step_delay()` was removed
* initial support for tests
* for some sensors only from `karel.h` and `superkarel.h`
* initial support for internationalization (i18n)
* all the strings are currently enclosed in the `_()` macro
* translations are in the `po/` directory
* basic `.pot` file is extracted
* if `NULL` is given instead of `path` in the function `turn_on()`, then world file is read from `stdin`
* huge refactoring
* some _CMake_ cleanup
\ No newline at end of file
#cmake_minimum_required(VERSION 2.8.9) # set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/doc/examples)
#project (Examples C)
#SET(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Werror -pedantic -std=c11") # include_directories(../../include)
#SET(GCC_COVERAGE_LINK_FLAGS "-lm -lcurses")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/doc/examples)
#For the shared library:
#set ( PROJECT_LINK_LIBS libkarel.a )
#link_directories(../../build)
#For the static library:
#set ( PROJECT_LINK_LIBS libtestStudent.a )
#link_directories( ~/exploringBB/extras/cmake/studentlib_static/build )
include_directories(../../include)
add_executable(stairs stairs.c) add_executable(stairs stairs.c)
target_link_libraries(stairs LINK_PUBLIC karel) target_link_libraries(stairs LINK_PUBLIC karel)
......
...@@ -31,8 +31,9 @@ void turn_left(); ...@@ -31,8 +31,9 @@ void turn_left();
/** /**
* Initializes the world of Karel the Robot * Initializes the world of Karel the Robot
* Function has one parameter, which defines the location of world file. If * Function has one parameter, which defines the location of world file. If
* the file doesn't exist, program will be terminated with error message. * the file doesn't exist, program will be terminated with error message. If
* @param path location of the world file * NULL is given instead of path, then input file is read from standard input.
* @param path location of the world file or NULL if world file will be entered from stdin
*/ */
void turn_on(const char *path); void turn_on(const char *path);
......
...@@ -19,7 +19,7 @@ msgstr "" ...@@ -19,7 +19,7 @@ msgstr ""
#: karel.c:192 #: karel.c:192
msgid "Can't move this way" msgid "Can't move this way"
msgstr "" msgstr "Tymto smerom sa neda ist"
#: internals.c:203 #: internals.c:203
msgid "EAST" msgid "EAST"
...@@ -91,7 +91,7 @@ msgstr "" ...@@ -91,7 +91,7 @@ msgstr ""
#: karel.c:23 #: karel.c:23
msgid "Karel is not turned On" msgid "Karel is not turned On"
msgstr "Karel nie je zapnutý" msgstr "Karel nie je zapnuty"
#: karel.c:189 #: karel.c:189
msgid "STEP" msgid "STEP"
...@@ -103,15 +103,15 @@ msgstr "SEVER" ...@@ -103,15 +103,15 @@ msgstr "SEVER"
#: karel.c:426 #: karel.c:426
msgid "PICK BEEPER" msgid "PICK BEEPER"
msgstr "VEZMI ZNAČKU" msgstr "VEZMI ZNACKU"
#: karel.c:411 #: karel.c:411
msgid "PUT BEEPER" msgid "PUT BEEPER"
msgstr "POLOŽ ZNAČKU" msgstr "POLOZ ZNACKU"
#: internals.c:286 #: internals.c:286
msgid "Press any key to quit..." msgid "Press any key to quit..."
msgstr "" msgstr "Program ukoncite stlacenim lubovolnej klavesy..."
#: internals.c:201 #: internals.c:201
msgid "SOUTH" msgid "SOUTH"
...@@ -119,15 +119,15 @@ msgstr "JUH" ...@@ -119,15 +119,15 @@ msgstr "JUH"
#: karel.c:204 #: karel.c:204
msgid "TURN LEFT" msgid "TURN LEFT"
msgstr "" msgstr "VLAVO VBOK"
#: karel.c:212 #: karel.c:212
msgid "TURN OFF" msgid "TURN OFF"
msgstr "VYPNÚŤ" msgstr "VYPNUT"
#: karel.c:396 #: karel.c:396
msgid "TURN ON" msgid "TURN ON"
msgstr "ZAPNÚŤ" msgstr "ZAPNUT"
#: karel.c:429 #: karel.c:429
msgid "There is no beeper at the corner" msgid "There is no beeper at the corner"
...@@ -139,4 +139,4 @@ msgstr "" ...@@ -139,4 +139,4 @@ msgstr ""
#: internals.c:202 #: internals.c:202
msgid "WEST" msgid "WEST"
msgstr "ZÁPAD" msgstr "ZAPAD"
...@@ -146,10 +146,13 @@ void turn_on(const char *path) { ...@@ -146,10 +146,13 @@ void turn_on(const char *path) {
} }
// open file and read the world params // open file and read the world params
FILE *fp = fopen(path, "r"); FILE *fp = stdin;
if (fp == NULL) { if(path != NULL){
fprintf(stderr, _("Error: World file '%s' not found.\n"), path); fp = fopen(path, "r");
exit(EXIT_FAILURE); if (fp == NULL) {
fprintf(stderr, _("Error: World file '%s' not found.\n"), path);
exit(EXIT_FAILURE);
}
} }
int row, column, count; int row, column, count;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment