about summary refs log tree commit diff stats
path: root/misc_checks
blob: 91384ea359c4cace7f013e644df0ae809c0b8653 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# Hackily check for certain kinds of errors.
#
# We still rely exclusively on linux/bootstrap/bootstrap for some static
# checks on bare SubX code that aren't implemented yet in the self-hosted
# translator phases.
#
# However, boot.subx uses instructions that bootstrap doesn't recognize. So we
# won't check it.

set -e

cat $* [0-9]*.mu                                      |linux/mu      > a.subx

cat misc_checks.subx mu-init.subx [0-9]*.subx a.subx  |linux/braces  > a.braces
cat a.braces                                          |linux/calls   > a.calls
cat a.calls                                           |linux/sigils  > a.sigils

CXXFLAGS=-g linux/bootstrap/bootstrap --debug translate a.sigils -o a.elf
# Translation will never succeed,
# but if we get to "missing reference to global" errors, they're expected and
# we've gotten to the end of what bootstrap can check for us.
00DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
	<meta charset='utf-8'>
	<title>C - Basic</title>
    </head>
    <body>
        <a href="index.html">C Index</a>

	<h1>C - Basic</h1>

	<h2 ="sources">Multiple Sources</h2>

	<p>To organize code in multiple files split above
	example in main.c, hello.c and hello.h. Content of
	main.c;<p>

	<pre>
	#include "hello.h"

	int main() {
	    hello("world");
	    return 0;
	}
	</pre>

	<p>Header file contains declaration of the function hello,
	content of hello.h;</p>

	<pre>
	void hello(const char* name);
	</pre>

	<p>Implementation of hello function in hello.c;</p>

	<pre>
	#include &lt;stdio.h&gt;
	#include "hello.h"

	void hello(const char* name) {
	    printf("Hello, %s!\n", name);
	}
	</pre>

	<p>Compile;</p>

	<pre>
	$ gcc -Wall main.c hello.c -o hello
	</pre>

	<a href="index.html">C Index</a>
	<p>
	This is part of the LeetIO System Documentation.
	Copyright (C) 2021
	LeetIO Team.
	See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
	for copying conditions.</p>
    </body>
</html>