Run through clang-format.
This commit is contained in:
parent
cca6171e55
commit
d50a6f99de
|
@ -9,26 +9,26 @@
|
|||
|
||||
/* $Id$ */
|
||||
|
||||
#include "parameters.h"
|
||||
#include "debug.h"
|
||||
#include "parameters.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <alloc.h>
|
||||
#include <assert.h>
|
||||
#include <em_arith.h>
|
||||
#include <em_label.h>
|
||||
#include <alloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "LLlex.h"
|
||||
#include "Lpars.h"
|
||||
#include "def.h"
|
||||
#include "f_info.h"
|
||||
#include "idf.h"
|
||||
#include "input.h"
|
||||
#include "scope.h"
|
||||
#include "LLlex.h"
|
||||
#include "def.h"
|
||||
#include "Lpars.h"
|
||||
#include "f_info.h"
|
||||
#include "main.h"
|
||||
#include "node.h"
|
||||
#include "type.h"
|
||||
#include "misc.h"
|
||||
#include "node.h"
|
||||
#include "scope.h"
|
||||
#include "type.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
long sys_filesize();
|
||||
|
@ -37,18 +37,19 @@ long sys_filesize();
|
|||
t_idf* DefId;
|
||||
|
||||
char*
|
||||
getwdir(fn)
|
||||
register char *fn;
|
||||
getwdir(fn) register char* fn;
|
||||
{
|
||||
register char* p;
|
||||
char* strrchr();
|
||||
|
||||
while ((p = strrchr(fn,'/')) && *(p + 1) == '\0') {
|
||||
while ((p = strrchr(fn, '/')) && *(p + 1) == '\0')
|
||||
{
|
||||
/* remove trailing /'s */
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
if (p) {
|
||||
if (p)
|
||||
{
|
||||
*p = '\0';
|
||||
fn = Salloc(fn, (unsigned)(p - &fn[0] + 1));
|
||||
*p = '/';
|
||||
|
@ -58,8 +59,7 @@ getwdir(fn)
|
|||
}
|
||||
|
||||
STATIC
|
||||
GetFile(name)
|
||||
char *name;
|
||||
GetFile(name) char* name;
|
||||
{
|
||||
/* Try to find a file with basename "name" and extension ".def",
|
||||
in the directories mentioned in "DEFPATH".
|
||||
|
@ -71,7 +71,8 @@ GetFile(name)
|
|||
buf[10] = '\0'; /* maximum length */
|
||||
strcat(buf, ".def");
|
||||
DEFPATH[0] = WorkingDir;
|
||||
if (! InsertFile(buf, DEFPATH, &(FileName))) {
|
||||
if (!InsertFile(buf, DEFPATH, &(FileName)))
|
||||
{
|
||||
error("could not find a DEFINITION MODULE for \"%s\"", name);
|
||||
return 0;
|
||||
}
|
||||
|
@ -82,8 +83,7 @@ GetFile(name)
|
|||
}
|
||||
|
||||
t_def*
|
||||
GetDefinitionModule(id, incr)
|
||||
register t_idf *id;
|
||||
GetDefinitionModule(id, incr) register t_idf* id;
|
||||
{
|
||||
/* Return a pointer to the "def" structure of the definition
|
||||
module indicated by "id".
|
||||
|
@ -99,7 +99,8 @@ GetDefinitionModule(id, incr)
|
|||
|
||||
level += incr;
|
||||
df = lookup(id, GlobalScope, D_IMPORTED, 0);
|
||||
if (!df) {
|
||||
if (!df)
|
||||
{
|
||||
/* Read definition module. Make an exception for SYSTEM.
|
||||
*/
|
||||
extern int ForeignFlag;
|
||||
|
@ -110,18 +111,21 @@ GetDefinitionModule(id, incr)
|
|||
newsc = CurrentScope;
|
||||
vis = CurrVis;
|
||||
newsc->sc_defmodule = incr;
|
||||
if (!strcmp(id->id_text, "SYSTEM")) {
|
||||
if (!strcmp(id->id_text, "SYSTEM"))
|
||||
{
|
||||
do_SYSTEM();
|
||||
df = lookup(id, GlobalScope, D_IMPORTED, 0);
|
||||
}
|
||||
else {
|
||||
if (!is_anon_idf(id) && GetFile(id->id_text)) {
|
||||
else
|
||||
{
|
||||
if (!is_anon_idf(id) && GetFile(id->id_text))
|
||||
{
|
||||
|
||||
char* f = FileName;
|
||||
DefModule();
|
||||
df = lookup(id, GlobalScope, D_IMPORTED, 0);
|
||||
if (level == 1 &&
|
||||
(df && !(df->df_flags & D_FOREIGN))) {
|
||||
if (level == 1 && (df && !(df->df_flags & D_FOREIGN)))
|
||||
{
|
||||
/* The module is directly imported by
|
||||
the currently defined module, and
|
||||
is not foreign, so we have to
|
||||
|
@ -134,29 +138,35 @@ GetDefinitionModule(id, incr)
|
|||
|
||||
n = dot2leaf(Def);
|
||||
n->nd_def = newsc->sc_definedby;
|
||||
if (nd_end) nd_end->nd_NEXT = n;
|
||||
else Modules = n;
|
||||
if (nd_end)
|
||||
nd_end->nd_NEXT = n;
|
||||
else
|
||||
Modules = n;
|
||||
nd_end = n;
|
||||
}
|
||||
free(f);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
df = lookup(id, GlobalScope, D_IMPORTED, 0);
|
||||
newsc->sc_name = id->id_text;
|
||||
}
|
||||
}
|
||||
close_scope(SC_CHKFORW);
|
||||
if (! df) {
|
||||
if (!df)
|
||||
{
|
||||
df = MkDef(id, GlobalScope, D_ERROR);
|
||||
df->mod_vis = vis;
|
||||
newsc->sc_definedby = df;
|
||||
}
|
||||
}
|
||||
else if (df->df_flags & D_BUSY) {
|
||||
else if (df->df_flags & D_BUSY)
|
||||
{
|
||||
error("definition module \"%s\" depends on itself",
|
||||
id->id_text);
|
||||
}
|
||||
else if (df == Defined && level == 1) {
|
||||
else if (df == Defined && level == 1)
|
||||
{
|
||||
error("cannot import from current module \"%s\"", id->id_text);
|
||||
df->df_kind = D_ERROR;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue