+/*
+ * Check to see if a symbol is about to be defined within an unnamed block.
+ * If this happens, we create a procedure for the unnamed block, make it
+ * "inline" so that tracebacks don't associate an activation record with it,
+ * and enter it into the function table so that it will be detected
+ * by "whatblock".
+ */
+
+private unnamed_block()
+{
+ register Symbol s;
+ static int bnum = 0;
+ char buf[100];
+
+ ++bnum;
+ sprintf(buf, "$b%d", bnum);
+ s = insert(identname(buf, false));
+ s->class = PROG;
+ s->symvalue.funcv.src = false;
+ s->symvalue.funcv.inline = true;
+ s->symvalue.funcv.beginaddr = addrstk[nesting];
+ enterblock(s);
+ newfunc(s, addrstk[nesting]);
+ addrstk[nesting] = NOADDR;
+}
+
+/*
+ * Compilation unit. C associates scope with filenames
+ * so we treat them as "modules". The filename without
+ * the suffix is used for the module name.
+ *
+ * Because there is no explicit "end-of-block" mark in
+ * the object file, we must exit blocks for the current
+ * procedure and module.
+ */
+
+private enterSourceModule(n, addr)
+Name n;
+Address addr;
+{
+ register Symbol s;
+ Name nn;
+ String mname, suffix;
+
+ mname = strdup(ident(n));
+ if (rindex(mname, '/') != nil) {
+ mname = rindex(mname, '/') + 1;
+ }
+ suffix = rindex(mname, '.');
+ curlang = findlanguage(suffix);
+ if (curlang == findlanguage(".f")) {
+ strip_ = true;
+ }
+ if (suffix != nil) {
+ *suffix = '\0';
+ }
+ if (curblock->class != PROG) {
+ exitblock();
+ if (curblock->class != PROG) {
+ exitblock();
+ }
+ }
+ nn = identname(mname, true);
+ if (curmodule == nil or curmodule->name != nn) {
+ s = insert(nn);
+ s->class = MODULE;
+ s->symvalue.funcv.beginaddr = 0;
+ findbeginning(s);
+ } else {
+ s = curmodule;
+ }
+ s->language = curlang;
+ enterblock(s);
+ curmodule = s;
+ if (program->language == nil) {
+ program->language = curlang;
+ }
+ warned = false;
+ enterfile(ident(n), addr);
+ bzero(typetable, sizeof(typetable));
+}
+