remove some comments

This commit is contained in:
VaclavT 2021-02-15 00:05:33 +01:00
parent bfcefbb045
commit 4bc784ba80
2 changed files with 10 additions and 45 deletions

43
ml.cpp
View File

@ -1,8 +1,7 @@
// Comment this define out to drop support for standard library functions.
// This allows the program to run without a runtime.
#define USE_STD
// Comment this define out to drop support for libm functions
#ifdef HAS_LIBM
#include <cmath>
#else
@ -13,10 +12,6 @@
#include "ml.h"
////////////////////////////////////////////////////////////////////////////////
/// REQUIRED INCLUDES //////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#include <map>
#include <string>
#include <vector>
@ -30,7 +25,6 @@
#include <iostream>
#include <fstream>
#include <ctime>
#include <regex>
#endif
@ -39,9 +33,6 @@
#include "sslclient.h"
#include "json11.h"
////////////////////////////////////////////////////////////////////////////////
/// ERROR MESSAGES /////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#define TOO_FEW_ARGS "too few arguments to function"
#define TOO_MANY_ARGS "too many arguments to function"
@ -59,9 +50,6 @@
#define INDEX_OUT_OF_RANGE "index out of range"
#define MALFORMED_PROGRAM "malformed program"
////////////////////////////////////////////////////////////////////////////////
/// TYPE NAMES /////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#define STRING_TYPE "string"
#define INT_TYPE "int"
@ -72,9 +60,6 @@
#define QUOTE_TYPE "quote"
#define LIST_TYPE "list"
////////////////////////////////////////////////////////////////////////////////
/// HELPER FUNCTIONS ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#ifdef USE_STD
@ -118,16 +103,10 @@ bool is_symbol(char ch) {
}
////////////////////////////////////////////////////////////////////////////////
/// LISP CONSTRUCTS ////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
MlValue::MlValue() : type(UNIT) {}
MlValue::MlValue(int i) : type(INT) { stack_data.i = i; }
MlValue::MlValue(double f) : type(FLOAT) { stack_data.f = f; }
@ -187,9 +166,6 @@ MlValue::MlValue(const std::string &name, Builtin b) : type(BUILTIN) {
stack_data.b = b;
}
////////////////////////////////////////////////////////////////////////////////
/// C++ INTEROP METHODS ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Get all of the atoms used in a given MlValue
std::vector<std::string> MlValue::get_used_atoms() {
@ -296,9 +272,6 @@ MlValue MlValue::pop() {
return result;
}
////////////////////////////////////////////////////////////////////////////////
/// TYPECASTING METHODS ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Cast this to an integer value
MlValue MlValue::cast_to_int() const {
@ -326,9 +299,6 @@ MlValue MlValue::cast_to_float() const {
}
}
////////////////////////////////////////////////////////////////////////////////
/// COMPARISON OPERATIONS //////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
bool MlValue::operator==(MlValue other) const {
// If either of these values are floats, promote the
@ -368,9 +338,6 @@ bool MlValue::operator!=(const MlValue &other) const {
return !(*this == other);
}
////////////////////////////////////////////////////////////////////////////////
/// ORDERING OPERATIONS ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
bool MlValue::operator>=(const MlValue &other) const {
return !(*this < other);
@ -405,9 +372,6 @@ bool MlValue::operator<(const MlValue &other) const {
}
}
////////////////////////////////////////////////////////////////////////////////
/// ARITHMETIC OPERATIONS //////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// This function adds two lisp values, and returns the lisp value result.
MlValue MlValue::operator+(const MlValue &other) const {
@ -569,7 +533,6 @@ MlValue MlValue::operator%(const MlValue &other) const {
if (other.type == FLOAT)
return MlValue(fmod(cast_to_float().stack_data.f, other.stack_data.f));
else return MlValue(stack_data.i % other.stack_data.i);
#else
case INT:
// If we do not support libm, we have to throw errors for floating point values.
@ -1224,7 +1187,7 @@ namespace builtin {
std::string cmd = args[0].as_string();
std::string cmd_output = "";
std::string cmd_output;
int stat;
// TODO better parameter here
@ -1705,7 +1668,7 @@ bool MlEnvironment::has(std::string name) const {
if (itr != defs.end())
// If it was found
return true;
else if (parent_scope != NULL)
else if (parent_scope != nullptr)
// If it was not found in the current environment,
// try to find it in the parent environment
return parent_scope->has(name);

2
ml.h
View File

@ -4,6 +4,8 @@
// This allows the program to run without a runtime.
#define USE_STD
// Comment this define out to drop support for libm functions
#define HAS_LIBM
#include <map>
#include <string>