Changeset 214fc9d7a7c8ed9ee8fd8b8c51b19287374157e8
- Timestamp:
- 03/03/10 03:10:36 (2 years ago)
- Author:
- Philip Herron <redbrain@…>
- Parents:
- f72fb404911ac4d42b7d10d62e462db348645527
- Children:
- a6d31aec35d85c450d6b3d485dcd9b3ac9070afc
- git-committer:
- Philip Herron <redbrain@omicron.(none)> / 2010-03-03T03:10:36Z+0000
- Message:
-
basic cmake support
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rf72fb40
|
r214fc9d
|
|
| 2 | 2 | cmake_minimum_required(VERSION 2.6) |
| 3 | 3 | add_subdirectory(src) |
| 4 | | set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/") |
| 5 | | set (Crules_VERSION 0.44) |
| 6 | 4 | |
| | 5 | FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h) |
| | 6 | FIND_LIBRARY(READLINE_LIBRARY NAMES readline) |
| | 7 | |
| | 8 | IF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY) |
| | 9 | SET(READLINE_FOUND TRUE) |
| | 10 | ENDIF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY) |
| | 11 | |
| | 12 | IF (READLINE_FOUND) |
| | 13 | IF (NOT Readline_FIND_QUIETLY) |
| | 14 | MESSAGE(STATUS "Found GNU readline: ${READLINE_LIBRARY}") |
| | 15 | ENDIF (NOT Readline_FIND_QUIETLY) |
| | 16 | ELSE (READLINE_FOUND) |
| | 17 | IF (Readline_FIND_REQUIRED) |
| | 18 | MESSAGE(FATAL_ERROR "Could not find GNU readline") |
| | 19 | ENDIF (Readline_FIND_REQUIRED) |
| | 20 | ENDIF (READLINE_FOUND) |
| | 21 | |
| | 22 | set(CMAKE_MODULE_PATH "cmake/") |
| 7 | 23 | find_package(BISON) |
| 8 | 24 | find_package(FLEX) |
| 9 | 25 | |
| 10 | | BISON_TARGET(MyParser ss_parser.y src/ss_parser.c) |
| 11 | | FLEX_TARGET(MyScanner ss_lexical.l src/ss_lexical.c) |
| | 26 | BISON_TARGET(MyParser src/ss_parser.y src/ss_parser.c) |
| | 27 | FLEX_TARGET(MyScanner src/ss_lexical.l src/ss_lexical.c) |
| 12 | 28 | ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser) |
| 13 | 29 | |
| | 30 | include_directories (include) |
| | 31 | ADD_LIBRARY(parser STATIC |
| | 32 | ${BISON_MyParser_OUTPUTS} |
| | 33 | ${FLEX_MyScanner_OUTPUTS} |
| | 34 | ) |
| | 35 | |
| | 36 | set (Crules_VERSION 0.44) |
| 14 | 37 | # does this system provide the log and exp functions? |
| 15 | 38 | include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) |
-
|
r1bb5963
|
r214fc9d
|
|
| 226 | 226 | AC_HEADER_STDC |
| 227 | 227 | AC_CHECK_HEADERS([stdlib.h string.h stdarg.h unistd.h \ |
| 228 | | stdint.h stdio.h getopt.h \ |
| 229 | | assert.h sys/types.h signal.h \ |
| 230 | | fcntl.h pthread.h sys/wait.h]) |
| | 228 | stdint.h stdio.h getopt.h \ |
| | 229 | assert.h sys/types.h signal.h \ |
| | 230 | fcntl.h pthread.h sys/wait.h]) |
| 231 | 231 | |
| 232 | 232 | # Checks for typedefs, structures, and compiler characteristics. |
| … |
… |
|
| 235 | 235 | AC_TYPE_SIZE_T |
| 236 | 236 | AC_CHECK_FUNCS([popen fopen fclose sprintf fprintf strdup \ |
| 237 | | strlen strcpy strcmp getopt_long \ |
| 238 | | memcpy calloc system sysconf atoi \ |
| 239 | | getpid execl fork wait exit atof \ |
| 240 | | vfprintf memcmp getc fgets pipe \ |
| 241 | | waitpid fdopen]) |
| | 237 | strlen strcpy strcmp getopt_long \ |
| | 238 | memcpy calloc system sysconf atoi \ |
| | 239 | getpid execl fork wait exit atof \ |
| | 240 | vfprintf memcmp getc fgets pipe \ |
| | 241 | waitpid fdopen]) |
| 242 | 242 | |
| 243 | 243 | # Checks for library functions. |
| … |
… |
|
| 248 | 248 | include/Makefile |
| 249 | 249 | src/Makefile |
| 250 | | tests/Makefile |
| | 250 | tests/Makefile |
| 251 | 251 | config/pkg-config/crules.pc]) |
| 252 | 252 | AC_OUTPUT |
-
|
rf72fb40
|
r214fc9d
|
|
| 1 | 1 | include_directories (../include) |
| 2 | | add_executable( crules mm_crules.c bb_backend.c bb_signals.c builtin_call_table.c builtin_hash_table.c builtin_stack.c gg_garbage.c object_class.c object_list.c object_number.c object_string.c rr_bin_eval.c rr_context.c rr_runtime.c ss_eval.c ) |
| | 2 | add_executable( crules |
| | 3 | mm_crules.c |
| | 4 | bb_backend.c |
| | 5 | bb_signals.c |
| | 6 | builtin_call_table.c |
| | 7 | builtin_hash_table.c |
| | 8 | builtin_stack.c |
| | 9 | gg_garbage.c |
| | 10 | object_class.c |
| | 11 | object_list.c |
| | 12 | object_number.c |
| | 13 | object_string.c |
| | 14 | rr_bin_eval.c |
| | 15 | rr_context.c |
| | 16 | rr_runtime.c |
| | 17 | ss_eval.c |
| | 18 | ) |
| | 19 | |
| | 20 | TARGET_LINK_LIBRARIES( crules parser ) |
-
|
r0608895
|
r214fc9d
|
|
| 1 | 1 | // the configured options and settings for Tutorial |
| 2 | | #define VERSION @Crules_VERSION@ |
| | 2 | #define VERSION "@Crules_VERSION@" |
-
|
rf72fb40
|
r214fc9d
|
|
| 77 | 77 | //print the header messages :) |
| 78 | 78 | time_t lt= time( NULL ); |
| 79 | | #ifndef CMAKE |
| 80 | 79 | fprintf( stdout, "Crules %s - ", VERSION ); |
| 81 | 80 | fprintf( stdout, "%s", ctime( < ) ); |
| | 81 | #ifndef CMAKE |
| 82 | 82 | fprintf( stdout, "[ %s:%s ( %s:%s ) ]\n", CONFIG_CC, |
| 83 | 83 | CONFIG_CC_VER, SYSTEM_TYPE, MACHINE_TYPE ); |
| 84 | | #else |
| 85 | | fprintf( stdout, "Crules %f - ", VERSION ); |
| 86 | | fprintf( stdout, "%s", ctime( < ) ); |
| 87 | 84 | #endif |
| 88 | 85 | err= crl_parse( stdin ); |
| … |
… |
|
| 99 | 96 | void print_version( void ) |
| 100 | 97 | { |
| 101 | | #ifndef CMAKE |
| 102 | 98 | fprintf( crlout, "Crules interpreter version: %s\n", VERSION ); |
| 103 | 99 | fprintf( crlout, "Copyright (c) Philip Herron 2009-2010\n" ); |
| | 100 | #ifndef CMAKE |
| 104 | 101 | fprintf( crlout, "Compiled for: %s %s\n", SYSTEM_TYPE, MACHINE_TYPE ); |
| 105 | 102 | fprintf( crlout, "Report suggestions and bugs to: %s\n", PACKAGE_BUGREPORT ); |
| 106 | | #else |
| 107 | | fprintf( stdout, "Crules interpreter version: %f\n", VERSION ); |
| 108 | | fprintf( crlout, "Copyright (c) Philip Herron 2009-2010\n" ); |
| 109 | 103 | #endif |
| 110 | 104 | fprintf( crlout, "\nThis is free software; see the source for copying conditions. There is NO\n" ); |
-
|
r27371b7
|
r214fc9d
|
|
| 33 | 33 | #ifdef HAVE_CONFIG_H |
| 34 | 34 | # include "config.h" |
| 35 | | #endif |
| | 35 | #else |
| | 36 | # define CMAKE 1 |
| | 37 | # include "config.h.cmake" |
| | 38 | #endif |
| | 39 | |
| | 40 | #define LINE_MAX 256 |
| 36 | 41 | |
| 37 | 42 | #include <crules/crules.h> |
| … |
… |
|
| 41 | 46 | #include <crules/backend.h> |
| 42 | 47 | |
| 43 | | #include "libparser_a-ss_parser.h" |
| | 48 | #ifndef CMAKE |
| | 49 | # include "libparser_a-ss_parser.h" |
| | 50 | #else |
| | 51 | # include "ss_parser.h" |
| | 52 | #endif |
| 44 | 53 | |
| 45 | 54 | #ifdef HAVE_LIBREADLINE |
| … |
… |
|
| 216 | 225 | if( fin == stdin ) |
| 217 | 226 | { |
| 218 | | const char *prompt= ">>> "; |
| | 227 | YY_BUFFER_STATE bp; const char * prompt= ">>> "; |
| 219 | 228 | #ifdef HAVE_LIBREADLINE |
| 220 | | char *line; |
| 221 | | #else |
| 222 | | char line[256]; |
| 223 | | #endif |
| 224 | | YY_BUFFER_STATE bp; |
| | 229 | char *line= NULL; |
| 225 | 230 | while( 1 ) |
| 226 | | { |
| 227 | | #ifdef HAVE_LIBREADLINE |
| 228 | | line= readline( prompt ); |
| 229 | | #else |
| 230 | | fprintf( stdout, "%s", prompt ); |
| 231 | | fgets( line, sizeof(line), stdin ); |
| 232 | | #endif |
| 233 | | crl_lexer_mark_string( line ); |
| 234 | | |
| 235 | | if( line == 0 ) |
| | 231 | { |
| | 232 | line= readline( prompt ); |
| | 233 | crl_lexer_mark_string( line ); |
| | 234 | |
| | 235 | if( line == 0 ) |
| 236 | 236 | break; |
| 237 | 237 | else if( crl_strlen( line ) > 0 ) |
| … |
… |
|
| 245 | 245 | yy_delete_buffer( bp ); |
| 246 | 246 | } |
| 247 | | } |
| | 247 | } |
| | 248 | #else |
| | 249 | char line[LINE_MAX]; |
| | 250 | fprintf( stdout, "%s", prompt ); |
| | 251 | while( fgets(line, LINE_MAX, stdin) != NULL ) |
| | 252 | { |
| | 253 | bp= yy_scan_string( line ); |
| | 254 | yy_switch_to_buffer( bp ); |
| | 255 | err= yyparse( ); |
| | 256 | yy_delete_buffer( bp ); |
| | 257 | fprintf( stdout, "%s", prompt ); |
| | 258 | } |
| | 259 | #endif |
| 248 | 260 | } |
| 249 | 261 | else |
-
|
r07e348d
|
r214fc9d
|
|
| 32 | 32 | #ifdef HAVE_CONFIG_H |
| 33 | 33 | # include "config.h" |
| | 34 | #else |
| | 35 | # define CMAKE 1 |
| | 36 | # include "config.h.cmake" |
| 34 | 37 | #endif |
| 35 | 38 | |
| … |
… |
|
| 112 | 115 | %type<symbol> procedure |
| 113 | 116 | %type<stack> parameters |
| 114 | | %type<stack> iterators |
| 115 | 117 | %type<list> list_symbol |
| 116 | 118 | %type<stack> arguments |
| … |
… |
|
| 490 | 492 | ; |
| 491 | 493 | |
| 492 | | iterators: parameters |
| 493 | | ; |
| 494 | | |
| 495 | | loop_for: FOR '(' expression expression expression ')' '{' procedure '}' |
| | 494 | |
| | 495 | loop_for: FOR '(' ')' '{' procedure '}' |
| 496 | 496 | { |
| 497 | 497 | $$= NULL; |