📄 01ugl.tcl
字号:
set tmpFileList [glob -nocomplain $uglHome/$uglBmFontEngineDB(PATH)/*.c] foreach file $tmpFileList { set fd [open $file r] set line [gets $fd]] set index [lsearch $line -] set fontRef [lrange $line [expr $index + 1] end] set fontRef [lindex $fontRef 0 ] lappend fontList $fontRef close $fd } # Sort the font list set fontList [lsort $fontList] # Build the control lists foreach font $fontList { lappend uglBmFontEngineDB(REFERNCE) uglBMFFont_$font regsub -all {_} $font { } fontName set index [llength $fontName] set fontName [linsert $fontName [expr $index - 1] Pitch] lappend uglBmFontEngineDB(NAME) $fontName }}###################################################################### uglAddNewGraphics - add slot for a new graphics device in data base#proc uglAddNewGraphics {graphicsName} { global uglGraphicsChipDB global uglGraphicsAllDeviceList if { [lsearch $uglGraphicsAllDeviceList $graphicsName] == -1 } { lappend uglGraphicsAllDeviceList $graphicsName set uglGraphicsChipDB($graphicsName,ARCH) {} set uglGraphicsChipDB($graphicsName,OPTIONS) {} set uglGraphicsChipDB($graphicsName,MODES) {} set uglGraphicsChipDB($graphicsName,OUTPUT) {} } }###################################################################### uglAddGraphicsDevice - construct the device data base#proc uglAddGraphicsDevice {line fd} { global uglGraphicsChipDB set chipName {} set line [gets $fd] while {![eof $fd]} { set arg [lrange $line 1 end] switch [lindex $line 0] { "DEVICE" { set chipName $arg ; \ uglAddNewGraphics $chipName} "ARCH" { lappend uglGraphicsChipDB($chipName,ARCH) $arg } "MODE" { lappend uglGraphicsChipDB($chipName,MODES) $arg} "DIR" { set uglGraphicsChipDB($chipName,DIR) $arg } "HEADER" { set uglGraphicsChipDB($chipName,HEADER) $arg } "SELECT" { set uglGraphicsChipDB($chipName,SELECT) $arg } "OUTPUT" { lappend uglGraphicsChipDB($chipName,OUTPUT) $arg } "OPTION" { lappend uglGraphicsChipDB($chipName,OPTIONS) $arg } "END" { return } } set line [gets $fd] }}###################################################################### uglAddNewPointer - add slot for a new pointer in data base#proc uglAddNewPointer {ptrName} { global uglPointerAllDeviceList global uglPointerDB if { [lsearch $uglPointerAllDeviceList $ptrName] == -1 } { lappend uglPointerAllDeviceList $ptrName set uglPointerDB($ptrName,ARCH) {} }}###################################################################### uglAddPointerDevice - construct the pointer device data base#proc uglAddPointerDevice {line fd} { global uglPointerDB global uglPointerAllDeviceList global uglConfigInput set ptrName {} set line [gets $fd] while {![eof $fd]} { set arg [lrange $line 1 end] switch [lindex $line 0] { "DEVICE" { set ptrName $arg ; \ uglAddNewPointer $ptrName } "ARCH" { lappend uglPointerDB($ptrName,ARCH) $arg } "SELECT" { set uglPointerDB($ptrName,SELECT) $arg } "BSPHDR" { set uglPointerDB($ptrName,BSPHDR) $arg } "HEADER" { set uglPointerDB($ptrName,HEADER) $arg } "DEVNAME" { set uglPointerDB($ptrName,DEVNAME) $arg } "END" { set uglConfigInput(PTR_TYPE) [lindex $uglPointerAllDeviceList 0] ; \ return } } set line [gets $fd] }}###################################################################### uglAddKeyboardMap - add a keyboard map in data base#proc uglAddKeyboardMap {line fd} { global uglKeyboardMapDB set line [gets $fd] while {![eof $fd]} { set arg [lrange $line 1 end] switch [lindex $line 0] { "MAP" { lappend uglKeyboardMapDB(NAME) $arg} "SELECT" { lappend uglKeyboardMapDB(SELECT) $arg } "END" { return } } set line [gets $fd] }}###################################################################### uglAddNewKeyboard - add slot for a new keyboard in data base#proc uglAddNewKeyboard {kbdName} { global uglKeyboardDB global uglKeyboardAllDeviceList if { [lsearch $uglKeyboardAllDeviceList $kbdName] == -1 } { lappend uglKeyboardAllDeviceList $kbdName set uglKeyboardDB($kbdName,ARCH) {} set uglKeyboardDB($kbdName,MAP) {} }}###################################################################### uglAddKeyboardDevice - construct the keyboard device data base#proc uglAddKeyboardDevice {line fd} { global uglKeyboardDB global uglKeyboardAllDeviceList global uglConfigInput set kbdName {} set line [gets $fd] while {![eof $fd]} { set arg [lrange $line 1 end] switch [lindex $line 0] { "DEVICE" { set kbdName $arg ; \ uglAddNewKeyboard $kbdName } "ARCH" { lappend uglKeyboardDB($kbdName,ARCH) $arg } "MAP" { lappend uglKeyboardDB($kbdName,MAP) $arg } "SELECT" { set uglKeyboardDB($kbdName,SELECT) $arg } "BSPHDR" { set uglKeyboardDB($kbdName,BSPHDR) $arg } "HEADER" { set uglKeyboardDB($kbdName,HEADER) $arg } "DEVNAME" { set uglKeyboardDB($kbdName,DEVNAME) $arg } "END" { set uglConfigInput(KBD_TYPE) [lindex $uglKeyboardAllDeviceList 0] ; \ return } } set line [gets $fd] }}###################################################################### uglAddNewAudio - add slot for a new audio in data base#proc uglAddNewAudio {audioName} { global uglAudioDB global uglAudioAllDeviceList if { [lsearch $uglAudioAllDeviceList $audioName] == -1 } { lappend uglAudioAllDeviceList $audioName set uglAudioDB($audioName,ARCH) {} }}###################################################################### uglAddAudioDevice - construct the audio device data base#proc uglAddAudioDevice {line fd} { global uglAudioDB global uglAudioAllDeviceList global uglConfigAudio set audioName "" set line [gets $fd] while {![eof $fd]} { set arg [lrange $line 1 end] switch [lindex $line 0] { "DEVICE" { set audioName $arg ; \ uglAddNewAudio $audioName } "ARCH" { lappend uglAudioDB($audioName,ARCH) $arg } "SELECT" { set uglAudioDB($audioName,SELECT) $arg } "DIR" { set uglAudioDB($audioName,DIR) $arg } "HEADER" { set uglAudioDB($audioName,HEADER) $arg } "DEVNAME" { set uglAudioDB($audioName,DEVNAME) $arg } "END" { set uglConfigAudio(TYPE) [lindex $uglAudioAllDeviceList 0] ; \ return } } set line [gets $fd] }}###################################################################### uglAddOutputDevice - add an output device type#proc uglAddOutputDevice {line} { global uglOutDevList global uglOutDevInc set index [lsearch $line :] if {$index >= 0} { set name [lrange $line 0 [expr $index - 1]] set arg [lrange $line [expr $index + 1] end] lappend uglOutDevList $name lappend uglOutDevInc $arg }}###################################################################### uglAddNewTool - add slot for a new build tool in data base#proc uglAddNewTool {toolName} { global uglToolDB global uglToolAllList if { [lsearch $uglToolAllList $toolName] == -1 } { lappend uglToolAllList $toolName set uglToolDB($toolName,ARCH) {} set uglToolDB($toolName,TOOL) "" }}###################################################################### uglAddTool - add a WindML build tool #proc uglAddTool {line fd} { global uglToolDB global uglToolAllList global uglConfigMisc set toolName "" set line [gets $fd] while {![eof $fd]} { set arg [lrange $line 1 end] switch [lindex $line 0] { "NAME" { set toolName $arg ; \ uglAddNewTool $toolName } "ARCH" { lappend uglToolDB($toolName,ARCH) $arg } "TOOL" { set uglToolDB($toolName,TOOL) $arg } "END" { set uglConfigMisc(BUILD_TOOL) [lindex $uglToolAllList 0] ; \ return } } set line [gets $fd] }}###################################################################### uglWriteConfigH - generate the configuration header file#proc uglWriteConfigH {configname dateInfo} { global uglFileWarningMsg global uglConfigDir global uglArchType global uglConfigMisc global uglConfigInput global uglPointerDB global uglKeyboardDB global uglKeyboardMapDB global uglGraphics global uglGraphicsChipDB global uglOutDevList global uglOutDevInc global uglConfigAudio global uglAudioDB global uglToolDB global uglBmFontSelection global uglBmfConfig global uglBmFontEngineDB global bmfInConfig global uglAgfaFontSelection global uglAgfaConfig global uglAgfaFontEngineDB global agfaInConfig global env # Write out file configuration to uglcnfg.h file set fd [open $uglConfigDir/uglConfig.h w] puts $fd "/* uglConfig.h - WindML configuration header file */" puts $fd $uglFileWarningMsg puts $fd [format "/* File created %s from %s */" $dateInfo $configname] puts $fd "" puts $fd "#ifdef CONFIG_TOOL" # split out the processor type/BSP and set any BSP specific mode set archType [split $uglArchType - ] set bspCnt [llength $archType] if {$bspCnt > 1} { set bspType [lindex $archType 1] puts $fd [format "#define UGL_TARGET_%s" $bspType] } # Generate pointer and keyboard definition puts $fd "#ifndef BUILD_DRIVER" puts $fd [format "#define %s" $uglPointerDB($uglConfigInput(PTR_TYPE),SELECT)] puts $fd [format "#define %s" $uglKeyboardDB($uglConfigInput(KBD_TYPE),SELECT)] puts $fd "#endif /* BUILD_DRIVER */" puts $fd [format "#define SYS_POINTER_NAME \"%s\"" $uglConfigInput(PTR_DEVICE)] puts $fd [format "#define SYS_KEYBOARD_NAME \"%s\"" $uglConfigInput(KBD_DEVICE)] # Set header file if {$uglPointerDB($uglConfigInput(PTR_TYPE),HEADER) != ""} { puts $fd [format "#define WINDML_POINTER_HEADER <%s/%s>" $env(WIND_BASE) $uglPointerDB($uglConfigInput(PTR_TYPE),HEADER)] } if {$uglKeyboardDB($uglConfigInput(KBD_TYPE),HEADER) != ""} { puts $fd [format "#define WINDML_KEYBOARD_HEADER <%s/%s>" $env(WIND_BASE) $uglKeyboardDB($uglConfigInput(KBD_TYPE),HEADER)] } set kbdMapNum [lsearch $uglKeyboardMapDB(NAME) $uglConfigInput(KBD_MAP)] puts $fd [format "#define %s" [lindex $uglKeyboardMapDB(SELECT) $kbdMapNum] ] # Generate memory pool information if {$uglConfigMisc(UGL_POOL)} { puts $fd "#define INCLUDE_UGL_MEM_POOL" puts $fd [format "#define UGL_MEM_POOL_SIZE %s * 1024" $uglConfigMisc(POOL_SIZE)] } # Generate graphics device configuration puts $fd "#ifndef BUILD_DRIVER" puts $fd [format "#define %s" $uglGraphicsChipDB($uglGraphics(CHIP),SELECT)] puts $fd "#endif /* BUILD_DRIVER */" puts $fd [format "#define UGL_REFRESH_RATE %s" $uglGraphics(REFRESH)] set resolution [split $uglGraphics(RESOLUTION) x] puts $fd [format "#define UGL_DISPLAY_WIDTH %s" [lindex $resolution 0]] puts $fd [format "#define UGL_DISPLAY_HEIGHT %s" [lindex $resolution 1]] puts $fd [format "#define UGL_FB_DEPTH %s" $uglGraphics(DEPTH)] # Output device type set outDevNum [lsearch $uglOutDevList $uglGraphics(OUTPUT)] set outInc [lindex $uglOutDevInc $outDevNum] puts $fd [format "#define %s" $outInc] # Generate graphics device options foreach opt $uglGraphics(OPTS) { switch $opt { "JPEG" {puts $fd "#define INCLUDE_UGL_JPEG"} "VIDEO" {puts $fd "#define INCLUDE_UGL_VIDEO"} "DBUFF" {puts $fd "#define INCLUDE_UGL_DOUBLE_BUFFERING"} "ALPHA" {puts $fd "#define INCLUDE_UGL_ALPHA"} "OVERLAY" {puts $fd "#define INCLUDE_UGL_OVERLAY"} "SWCURS" {puts $fd "#define INCLUDE_UGL_SW_CURSOR"} } } # Set header file if {$uglGraphicsChipDB($uglGraphics(CHIP),HEADER) != ""} { puts $fd [format "#define WINDML_GRAPHICS_HEADER <%s/%s>" $env(WIND_BASE) $uglGraphicsChipDB($uglGraphics(CHIP),HEADER)] } # Generate audio configuration puts $fd "#ifndef BUILD_DRIVER" puts $fd [format "#define %s" $uglAudioDB($uglConfigAudio(TYPE),SELECT)] puts $fd "#endif /* BUILD_DRIVER */" puts $fd [format "#define UGL_SOUND_DEVICE %s" $uglConfigAudio(DEVNAME)] puts $fd [format "#define UGL_SOUND_CHAN %s" $uglConfigAudio(CHANNEL)] # Generate font options puts $fd "" set bmfInConfig 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -