Skip to content
Snippets Groups Projects
Commit 2d194b41 authored by Peter Matta's avatar Peter Matta
Browse files

[STDLIB] Added standart library

parent 84b8efb2
No related branches found
No related tags found
No related merge requests found
set(STDLIB_TARGET stddusk)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(runtime)
set(RUNTIME_HEADERS
${RUNTIME_HEADERS}
PARENT_SCOPE
)
set(RUNTIME_SOURCE
${RUNTIME_SOURCE}
PARENT_SCOPE
)
add_library(${STDLIB_TARGET} SHARED ${RUNTIME_SOURCE} ${RUNTIME_HEADERS})
set_target_properties(${STDLIB_TARGET} PROPERTIES
VERSION 1.0.0
SOVERSION 1
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin
)
target_include_directories(${STDLIB_TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set(RUNTIME_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/io.h
${RUNTIME_HEADERS}
PARENT_SCOPE
)
set(RUNTIME_SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/io.cpp
${RUNTIME_SOURCE}
PARENT_SCOPE
)
//===--- io.cpp -----------------------------------------------------------===//
//
// dusk-lang
// This source file is part of a dusk-lang project, which is a semestral
// assignement for BI-PJP course at Czech Technical University in Prague.
// The software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND.
//
//===----------------------------------------------------------------------===//
#include "io.h"
void println(int64_t Value) {
fprintf(stdout, "%lld\n", Value);
return;
}
int64_t readln() {
int64_t Value;
fscanf(stdin, "%lld", &Value);
return Value;
}
//===--- io.h - Dusk runtime io operations ----------------------*- C++ -*-===//
//
// dusk-lang
// This source file is part of a dusk-lang project, which is a semestral
// assignement for BI-PJP course at Czech Technical University in Prague.
// The software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND.
//
//===----------------------------------------------------------------------===//
#ifndef DUSK_STDLIB_RUNTIME_IO
#define DUSK_STDLIB_RUNTIME_IO
#include <iostream>
#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
/// Prints a single integer into standart output.
extern "C" DLLEXPORT void println(int64_t);
/// Reads a single integer from the standart input and returns it.
extern "C" DLLEXPORT int64_t readln();
#endif /* DUSK_STDLIB_RUNTIME_IO */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment