6.13.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 /40 ] Next Prev Last
   314: #line 438 "input_frame.ipk"
   315:   def include_file(self,name):
   316:     if self.verbosity>=2:
   317:       print 'input from',name
   318:     self.pass_frame.include_files.append((self.depth+1,'interscript',name))
   319:     self.include_source(named_file_source(
   320:       self.pass_frame,name, self.source.directory))
   321: 
   322:   def include_source(self,source):
   323:     self.select(None)
   324:     ho = self.head_offset
   325:     inpt = input_frame(
   326:       self.pass_frame,
   327:       source,
   328:       [],
   329:       self.current_weaver,
   330:       self.userdict.copy(),
   331:       self.depth+1)
   332:     inpt.head_offset = ho
   333:     inpt.set_warning_character(python='@')
   334:     inpt.file_pass()
   335:     self.current_weaver.set_original_filename (self.original_filename)
   336: 
End python section to interscript/frames/inputf.py[9]