home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / fmcongen.tcl < prev    next >
Text File  |  1996-05-29  |  2KB  |  83 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Westmount Technology    1994
  4. #
  5. #      File:           @(#)fmcongen.tcl    1.4
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)fmcongen.tcl    1.4   19 Jan 1996 Copyright 1994 Westmount Technology
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14.  
  15. Class FmConGen : {Object} {
  16.     method destructor
  17.     constructor
  18.     method mif2Bin
  19.     method framePath
  20.     method openMif
  21.     attribute mifPath
  22.     attribute templatePath
  23.     attribute section
  24. }
  25.  
  26. method FmConGen::destructor {this} {
  27.     # Start destructor user section
  28.     # End destructor user section
  29. }
  30.  
  31. constructor FmConGen {class this name section} {
  32.     set this [Object::constructor $class $this $name]
  33.  
  34.     $this section $section
  35.     $this mifPath [$section docLocation]_mif
  36.     set version [[[[$this section] document] editor] version]
  37.     set type [string tolower [$section type]]
  38.     set file fm${version}${type}.mif
  39.     catch {$this templatePath [m4_path_name etc $file]}]
  40.  
  41.     return $this
  42. }
  43.  
  44. method FmConGen::mif2Bin {this} {
  45.  
  46.     # Convert the MIF-file to binary and remove it
  47.     # The MIF-file is converted to Frame binary-format using $FM_COMM.
  48.  
  49.     set section [$this section]
  50.     set fm_comm [m4_path_name bin fmcomm]
  51.     set cmnd [list \
  52.         "$fm_comm -b [$this mifPath] [$section docLocation]" \
  53.         [$section uiName] \
  54.     ]
  55.     if {! [$section execute "$cmnd"]} {
  56.         wmtkerror "Conversion to Framemaker binary format failed"
  57.     }
  58.     unlink [$this mifPath]
  59. }
  60.  
  61. method FmConGen::framePath {this path} {
  62.  
  63.     if {[string first / $path] == 0} {
  64.         set path "<r\\>$path"
  65.     }
  66.     regsub -all {/} $path {<c\\>} framePath
  67.     return $framePath
  68. }
  69.  
  70. method FmConGen::openMif {this} {
  71.  
  72.     # Open the MIF-file
  73.     if {[catch {set mif [open [$this mifPath] w]} reason]} {
  74.         wmtkerror "Error on opening '[$this mifPath]' for writing: $reason"
  75.         return ""
  76.     }
  77.  
  78.     return $mif
  79. }
  80.  
  81. # Do not delete this line -- regeneration end marker
  82.  
  83.