6.10.10.2.4. Include file/source

6.10.10.2.4. Include file/source

The include file command is a subroutine call. It pushes a new input frame associated with the file, causing input to be read from the file. The new input frame has a copy of the user dictionary from the calling frame. When the file ends, the frame is popped which destroys the dictionary; all newly created symbols are lost.

The new input frame does not inherit the parent frames lexicology. In particular, the warning character is restablished as @. This command reasserts document mode, both in the included file and the current one.

The command include_source is a generalisation of include_file which takes any source driver as the input.

Start python section to interscript/frames/inputf.py[9]
   225: #line 360 "input_frame.ipk"
   226:   def include_file(self,name):
   227:     if self.verbosity>=2:
   228:       print 'input from',name
   229:     self.pass_frame.include_files.append((self.depth+1,'interscript',name))
   230:     self.include_source(named_file_source(self.pass_frame,name, self.source.directory))
   231: 
   232:   def include_source(self,source):
   233:     self.select(None)
   234:     ho = self.head_offset
   235:     inpt = input_frame(
   236:       self.pass_frame,
   237:       source,
   238:       [],
   239:       self.weaver,
   240:       self.userdict.copy(),
   241:       self.depth+1)
   242:     inpt.head_offset = ho
   243:     inpt.set_warning_character(python='@')
   244:     inpt.file_pass()
   245:     self.weaver.set_original_filename (self.original_filename)
   246: 
End python section to interscript/frames/inputf.py[9]