Z / libzlang 0.29.0
C99 runtime library and the Zlang 0.29 source-to-source compiler
Loading...
Searching...
No Matches
main.c File Reference

Command line driver that emits C or builds a native binary. More...

#include "zlang/compiler/diagnostics.h"
#include "zlang/compiler/emitter.h"
#include "zlang/compiler/optimizer.h"
#include "zlang/compiler/parser.h"
#include "zlang/compiler/planner.h"
#include "zlang/compiler/semantics.h"
#include "modules.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Macros

#define ZLANG_CLI_SOURCE_CAPACITY   65536U
#define ZLANG_CLI_OUTPUT_CAPACITY   262144U
#define ZLANG_CLI_PATH_CAPACITY   4096U
#define ZLANG_CLI_COMMAND_CAPACITY   8192U
#define ZLANG_CLI_TOKEN_CAPACITY   1024U
#define ZLANG_CLI_COMMENT_CAPACITY   128U
#define ZLANG_CLI_EXPRESSION_CAPACITY   256U
#define ZLANG_CLI_STATEMENT_CAPACITY   256U
#define ZLANG_CLI_PARAMETER_CAPACITY   128U
#define ZLANG_CLI_SYMBOL_CAPACITY   256U
#define ZLANG_CLI_DIAGNOSTIC_CAPACITY   64U
#define ZLANG_CLI_PLAN_CAPACITY   256U
#define ZLANG_RUNTIME_INCLUDE_DIR   "include"
#define ZLANG_EXECUTABLE_SUFFIX   ""

Functions

static void zlang_cli_usage (void)
static size_t zlang_cli_stem_length (const char *path)
static bool zlang_cli_append (char *buffer, size_t capacity, size_t *length, const char *text)
static bool zlang_cli_make_output_path (const char *source_path, const char *suffix, char *buffer, size_t capacity)
static bool zlang_cli_write_output (const char *path, const char *content)
static bool zlang_cli_report_diagnostics (const zlang_diagnostics_t *diagnostics, const char *source_path)
static bool zlang_cli_equals_ignore_case (const char *left, const char *right)
static const char * zlang_cli_base_name (const char *path)
static bool zlang_cli_compiler_uses_msvc_style (const char *compiler)
static bool zlang_cli_quote (const char *path, char *buffer, size_t capacity)
static int zlang_cli_run_compiler (char *command)
static bool zlang_cli_compile_c (const char *c_path, const char *executable_path)
int main (int argc, char **argv)

Detailed Description

Command line driver that emits C or builds a native binary.

Macro Definition Documentation

◆ ZLANG_CLI_COMMAND_CAPACITY

#define ZLANG_CLI_COMMAND_CAPACITY   8192U

◆ ZLANG_CLI_COMMENT_CAPACITY

#define ZLANG_CLI_COMMENT_CAPACITY   128U

◆ ZLANG_CLI_DIAGNOSTIC_CAPACITY

#define ZLANG_CLI_DIAGNOSTIC_CAPACITY   64U

◆ ZLANG_CLI_EXPRESSION_CAPACITY

#define ZLANG_CLI_EXPRESSION_CAPACITY   256U

◆ ZLANG_CLI_OUTPUT_CAPACITY

#define ZLANG_CLI_OUTPUT_CAPACITY   262144U

◆ ZLANG_CLI_PARAMETER_CAPACITY

#define ZLANG_CLI_PARAMETER_CAPACITY   128U

◆ ZLANG_CLI_PATH_CAPACITY

#define ZLANG_CLI_PATH_CAPACITY   4096U

◆ ZLANG_CLI_PLAN_CAPACITY

#define ZLANG_CLI_PLAN_CAPACITY   256U

◆ ZLANG_CLI_SOURCE_CAPACITY

#define ZLANG_CLI_SOURCE_CAPACITY   65536U

◆ ZLANG_CLI_STATEMENT_CAPACITY

#define ZLANG_CLI_STATEMENT_CAPACITY   256U

◆ ZLANG_CLI_SYMBOL_CAPACITY

#define ZLANG_CLI_SYMBOL_CAPACITY   256U

◆ ZLANG_CLI_TOKEN_CAPACITY

#define ZLANG_CLI_TOKEN_CAPACITY   1024U

◆ ZLANG_EXECUTABLE_SUFFIX

#define ZLANG_EXECUTABLE_SUFFIX   ""

◆ ZLANG_RUNTIME_INCLUDE_DIR

#define ZLANG_RUNTIME_INCLUDE_DIR   "include"

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

◆ zlang_cli_append()

bool zlang_cli_append ( char * buffer,
size_t capacity,
size_t * length,
const char * text )
static

◆ zlang_cli_base_name()

const char * zlang_cli_base_name ( const char * path)
static

◆ zlang_cli_compile_c()

bool zlang_cli_compile_c ( const char * c_path,
const char * executable_path )
static

◆ zlang_cli_compiler_uses_msvc_style()

bool zlang_cli_compiler_uses_msvc_style ( const char * compiler)
static

◆ zlang_cli_equals_ignore_case()

bool zlang_cli_equals_ignore_case ( const char * left,
const char * right )
static

◆ zlang_cli_make_output_path()

bool zlang_cli_make_output_path ( const char * source_path,
const char * suffix,
char * buffer,
size_t capacity )
static

◆ zlang_cli_quote()

bool zlang_cli_quote ( const char * path,
char * buffer,
size_t capacity )
static

◆ zlang_cli_report_diagnostics()

bool zlang_cli_report_diagnostics ( const zlang_diagnostics_t * diagnostics,
const char * source_path )
static

◆ zlang_cli_run_compiler()

int zlang_cli_run_compiler ( char * command)
static

◆ zlang_cli_stem_length()

size_t zlang_cli_stem_length ( const char * path)
static

◆ zlang_cli_usage()

void zlang_cli_usage ( void )
static

◆ zlang_cli_write_output()

bool zlang_cli_write_output ( const char * path,
const char * content )
static