Skip to content

Commit

Permalink
added blank translate function for let command
Browse files Browse the repository at this point in the history
create 'basic' directory to hold files supporting the BASIC language
added new commands.h header file for command definitions
added let.cpp source file for holding the LET command functions
added pointer to LET translate function to table
added new source file to CMakeLists.txt
added source directory to include directory list to CMakeLists.txt
removed unnecessary list of include files from CMakeLists.txt
  • Loading branch information
thunder422 committed Jul 6, 2013
1 parent de01f48 commit 3330b28
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 16 deletions.
20 changes: 5 additions & 15 deletions CMakeLists.txt
Expand Up @@ -107,7 +107,10 @@ endif (NOT WIN32)

# add the binary tree to the search path for include files
# so that ibcp_config.h, autoenums.h, test_names.h can be found
include_directories("${PROJECT_BINARY_DIR}")
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
)


# custom target
Expand All @@ -126,21 +129,9 @@ add_custom_command(OUTPUT test_names.h
DEPENDS table.cpp token.h ibcp.h
)

# list the header files
set(ibcp_HEADERS
commandline.h
errorlist.h
ibcp.h
parser.h
rpnlist.h
table.h
test_ibcp.h
token.h
translator.h
)

# list the main program sources
set(ibcp_SOURCES
basic/let.cpp
commandhandlers.cpp
commandline.cpp
errorlist.cpp
Expand Down Expand Up @@ -185,7 +176,6 @@ qt4_add_resources(ibcp_RCC_SOURCES ${ibcp_RESOURCES})
add_executable(ibcp
autoenums.h
test_names.h
${ibcp_HEADERS}
${ibcp_SOURCES}
${ibcp_MOCS}
${ibcp_UI_HEADERS}
Expand Down
37 changes: 37 additions & 0 deletions basic/commands.h
@@ -0,0 +1,37 @@
// vim:ts=4:sw=4:
//
// Interactive BASIC Compiler Project
// File: commands.h - basic command definitions header file
// Copyright (C) 2013 Thunder422
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// For a copy of the GNU General Public License,
// see <http://www.gnu.org/licenses/>.
//
//
// Change History:
//
// 2013-07-06 initial version

#ifndef COMMANDS_H
#define COMMANDS_H

#include "ibcp.h"

class Translator;
class Token;


TokenStatus letTranslate(Translator &t, Token *commandToken, Token *&token);


#endif // COMMANDS_H
47 changes: 47 additions & 0 deletions basic/let.cpp
@@ -0,0 +1,47 @@
// vim:ts=4:sw=4:

// Interactive BASIC Compiler Project
// File: let.cpp - let command functions source file
// Copyright (C) 2013 Thunder422
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// For a copy of the GNU General Public License,
// see <http://www.gnu.org/licenses/>.
//
//
// Change History:
//
// 2013-07-06 initial version

#include "translator.h"
#include "token.h"


TokenStatus letTranslate(Translator &t, Token *commandToken, Token *&token)
{
TokenStatus status;

if (commandToken != NULL)
{
token = commandToken;
status = BUG_Debug1;
}
else
{
status = BUG_Debug2;
}
token->setSubCodeMask(UnUsed_SubCode);
return status;
}


// end: let.cpp
3 changes: 2 additions & 1 deletion table.cpp
Expand Up @@ -28,6 +28,7 @@
#include "table.h"
#include "commandhandlers.h"
#include "tokenhandlers.h"
#include "basic/commands.h"


const int MaxOperands = 3;
Expand Down Expand Up @@ -240,7 +241,7 @@ static TableEntry tableEntries[] =
{ // Let_Code
Command_TokenType, OneWord_Multiple,
"LET", NULL, Null_Flag, 4, None_DataType, NULL, NULL,
Assignment_TokenMode, Let_CmdHandler
Assignment_TokenMode, Let_CmdHandler, letTranslate
},
{ // Print_Code
Command_TokenType, OneWord_Multiple,
Expand Down

0 comments on commit 3330b28

Please sign in to comment.