Compare commits

...

81 Commits

Author SHA1 Message Date
TDE Gitea 336cea06f3 Reset submodule main/applications/utilities/abakus/admin to latest HEAD
2 years ago
Slávek Banko 2a78b0971e
Raise the minimum required version of CMake to 3.1.
2 years ago
Slávek Banko d37c6b7901
Remove cmake submodule since it has now been replaced by cmake-trinity dependency.
3 years ago
TDE Gitea 5ec9ebf48e Reset submodule main/applications/abakus/cmake to latest HEAD
3 years ago
TDE Gitea ec3d61fa78 Reset submodule main/applications/abakus/cmake to latest HEAD
3 years ago
TDE Gitea dc1a96291d Reset submodule main/applications/abakus/cmake to latest HEAD
3 years ago
TDE Gitea d0a98f518e Reset submodule main/applications/abakus/cmake to latest HEAD
3 years ago
TDE Gitea 0954a8c1a5 Reset submodule main/applications/abakus/admin to latest HEAD
3 years ago
TDE Gitea 439e100f6b Reset submodule main/applications/abakus/cmake to latest HEAD
3 years ago
TDE Gitea 2e34a3d3bf Reset submodule main/applications/abakus/cmake to latest HEAD
3 years ago
TDE Gitea 89f42f7d9d Reset submodule main/applications/abakus/admin to latest HEAD
3 years ago
TDE Gitea ea2ac562b2 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea e246a76757 Reset submodule main/applications/abakus/admin to latest HEAD
4 years ago
TDE Gitea 709d4abc46 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 79d9fc6fab Reset submodule main/applications/abakus/admin to latest HEAD
4 years ago
TDE Gitea 41ffd2d190 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 452ce9d56d Reset submodule main/applications/abakus/admin to latest HEAD
4 years ago
TDE Gitea 1f3c19e9f7 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 35dd76c43c Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea ddf88a763b Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea ebab9b5ceb Reset submodule main/applications/abakus/admin to latest HEAD
4 years ago
TDE Gitea f4d22a3de9 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea a8098215a7 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 0004c48f99 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 693af96bce Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 044d274b3e Reset submodule main/applications/abakus/admin to latest HEAD
4 years ago
TDE Gitea cd0f7302ad Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 3103b22db9 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea c5c8c27efe Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea fe8e567c26 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea b03f732f7a Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 421a7a2021 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea f9a08e53e6 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 69ba810b96 Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
TDE Gitea 8241434bfb Reset submodule main/applications/abakus/cmake to latest HEAD
4 years ago
Slávek Banko aad18375cf
Switch all submodules to https.
4 years ago
TDE Gitea dc423b4a3f Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 0e138eb41e Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 1957a138e3 Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 386932931a Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 4175105c53 Reset submodule main/applications/abakus/admin to latest HEAD
5 years ago
TDE Gitea c8a0f86d59 Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 00a86511d9 Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea d85ec5f288 Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 0096f0868f Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 563ebd03db Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea c45101e1cc Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 4ce613c431 Reset submodule main/applications/abakus/admin to latest HEAD
5 years ago
TDE Gitea 45548ba1c4 Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea dd253bae5a Reset submodule main/applications/abakus/cmake to latest HEAD
5 years ago
TDE Gitea 628b047b7e Reset submodule main/applications/abakus/admin to latest HEAD
6 years ago
Slávek Banko effae51b39 Reset submodule main/applications/abakus/admin to latest HEAD
6 years ago
Slávek Banko f2e8983e48 Reset submodule main/applications/abakus/admin to latest HEAD
6 years ago
Slávek Banko b978d6eb74 Reset submodule main/applications/abakus/admin to latest HEAD
6 years ago
Slávek Banko 0fa7cd6c6c Reset submodule main/applications/abakus/cmake to latest HEAD
7 years ago
Slávek Banko 317cc3e392 Reset submodule main/applications/abakus/admin to latest HEAD
8 years ago
Slávek Banko 0d09789ff9 Reset submodule main/applications/abakus/cmake to latest HEAD
8 years ago
Slávek Banko 5800ffcf04 Reset submodule main/applications/abakus/admin to latest HEAD
8 years ago
Slávek Banko 5ec99b0647 Reset submodule main/applications/abakus/admin to latest HEAD
11 years ago
Slávek Banko ae2aab9f2a Reset submodule main/applications/abakus/admin to latest HEAD
11 years ago
Darrell Anderson 154cae3bc8 Fix missing application icon.
11 years ago
Slávek Banko c84f2e8b36 Reset submodule main/applications/abakus/cmake to latest HEAD
11 years ago
Slávek Banko b2b256d0ac Reset submodule main/applications/abakus/cmake to latest HEAD
11 years ago
Slávek Banko b9448846bf Reset submodule main/applications/abakus/cmake to latest HEAD
12 years ago
Slávek Banko f11bce7e90 Reset submodule main/applications/abakus/cmake to latest HEAD
12 years ago
Slávek Banko fa933fcd85 Reset submodule main/applications/abakus/admin to latest HEAD
12 years ago
Slávek Banko 27d164516c Reset submodule main/applications/abakus/cmake to latest HEAD
12 years ago
Slávek Banko 7066aa0a33 Reset submodule main/applications/abakus/cmake to latest HEAD
12 years ago
Slávek Banko d2ecd6e319 Reset submodule main/applications/abakus/admin to latest HEAD
12 years ago
Slávek Banko 7090bc800d Update final HTML install path so all modules are consistent.
12 years ago
Timothy Pearson 44ac2bccce Rename obsolete tq methods to standard names
12 years ago
Timothy Pearson 2d29e200b6 Remove additional unneeded tq method conversions
12 years ago
Timothy Pearson 87b7ae7ab9 Rename old tq methods that no longer need a unique name
12 years ago
Timothy Pearson dc2be33dfc Cleanup
12 years ago
Timothy Pearson b163211001 Fix FTBFS
12 years ago
Timothy Pearson 2016ba9b1c Add bison support
12 years ago
Timothy Pearson d145ebef56 Add missing doc CMake files
12 years ago
Timothy Pearson d2826221c8 Fix cmake
12 years ago
Timothy Pearson 8a2e76e9d0 Initial conversion to standard CMake system
12 years ago
Timothy Pearson 0350ba0db0 Fix FTBFS
12 years ago
Slávek Banko 91ee6212ab Add common directories
12 years ago

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "admin"]
path = admin
url = https://system@scm.trinitydesktop.org/scm/git/tde-common-admin

@ -0,0 +1,137 @@
# /*
# For more information, please see: http://software.sci.utah.edu
# The MIT License
# Copyright (c) 2005-2006
# Scientific Computing and Imaging Institute, University of Utah
# License for the specific language governing rights and limitations under
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# */
SET(PARSERS_FOUND FOOBAR)
# These variables need to be specified in order to get CMake not to
# barf on the IF(EXISTS ${BISON_EXECUTABLE} ..) expression even though
# the code shouldn't get called. By setting them to BISON_EXECUTABLE
SET(BISON_EXECUTABLE "BISON_EXECUTABLE-NOTFOUND" CACHE FILEPATH "bison executable")
SET(FLEX_EXECUTABLE "FLEX_EXECUTABLE-NOTFOUND" CACHE FILEPATH "flex executable")
# Mark these variables as advanced options
MARK_AS_ADVANCED(FORCE BISON_EXECUTABLE)
MARK_AS_ADVANCED(FORCE FLEX_EXECUTABLE)
# You need at least version 2.4 for this to work.
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
MESSAGE("You need at least version 2.4 for generating flex and bison parsers. Go get it from http://www.cmake.org/HTML/Download.html")
SET(PARSERS_FOUND 0)
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
FIND_PROGRAM(BISON_EXECUTABLE
NAMES bison
PATHS ${BISON_DIR} )
FIND_PROGRAM(FLEX_EXECUTABLE
NAMES flex
PATHS ${FLEX_DIR} )
IF(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
SET(PARSERS_FOUND 1)
ELSE(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
SET(PARSERS_FOUND 0)
# Print some error messages to the user
IF (NOT EXISTS ${BISON_EXECUTABLE})
MESSAGE("Couldn't find bison executable. Please check value in BISON_EXECUTABLE in advanced settings.")
ENDIF (NOT EXISTS ${BISON_EXECUTABLE})
IF (NOT EXISTS ${FLEX_EXECUTABLE})
MESSAGE("Couldn't find flex executable. Please check value in FLEX_EXECUTABLE in advanced settings.")
ENDIF (NOT EXISTS ${FLEX_EXECUTABLE})
ENDIF(EXISTS ${BISON_EXECUTABLE} AND EXISTS ${FLEX_EXECUTABLE})
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
# These are helper functions for parsers.
# parser is the parser file name like parser.y
# lexer is like lexer.l
# The names of the output files will be based on the input names.
# BF_SOURCES will be parser.cc, parser.h and lexer.cc.
MACRO(GENERATE_BISON_FLEX_SOURCES parser parser_args
lexer lexer_args)
GET_FILENAME_COMPONENT(parser_base "${parser}" NAME_WE)
SET(BISON_TAB_C "${CMAKE_CURRENT_BINARY_DIR}/${parser_base}.tab.cc")
SET(BISON_TAB_H "${CMAKE_CURRENT_BINARY_DIR}/${parser_base}.tab.hh")
SET(BISON_CC "${CMAKE_CURRENT_BINARY_DIR}/${parser_base}.cc")
SET(BISON_H "${CMAKE_CURRENT_BINARY_DIR}/${parser_base}.h")
ADD_CUSTOM_COMMAND(
OUTPUT ${BISON_TAB_C} ${BISON_TAB_H}
COMMAND ${BISON_EXECUTABLE}
ARGS "${parser}" ${parser_args} "--defines"
DEPENDS "${parser}"
COMMENT "Generating ${BISON_TAB_C} ${BISON_TAB_H} from ${parser}"
)
ADD_CUSTOM_COMMAND(
OUTPUT ${BISON_CC}
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${BISON_TAB_C} ${BISON_CC}
DEPENDS ${BISON_TAB_C}
COMMENT "Copying ${BISON_TAB_C} to ${BISON_CC}"
)
ADD_CUSTOM_COMMAND(
OUTPUT ${BISON_H}
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${BISON_TAB_H} ${BISON_H}
DEPENDS ${BISON_TAB_H}
COMMENT "Copying ${BISON_TAB_H} to ${BISON_H}"
)
GET_FILENAME_COMPONENT(lexer_base "${lexer}" NAME_WE)
SET(FLEX_C "${CMAKE_CURRENT_BINARY_DIR}/lex.yy.c")
SET(FLEX_CC "${CMAKE_CURRENT_BINARY_DIR}/${lexer_base}.cc")
ADD_CUSTOM_COMMAND(
OUTPUT ${FLEX_C}
COMMAND ${FLEX_EXECUTABLE}
ARGS "${lexer}" ${lexer_args}
DEPENDS "${lexer}" ${BISON_H}
COMMENT "Generating ${FLEX_C} from ${lexer}"
)
ADD_CUSTOM_COMMAND(
OUTPUT ${FLEX_CC}
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${FLEX_C} ${FLEX_CC}
DEPENDS ${FLEX_C}
COMMENT "Copying ${FLEX_C} to ${FLEX_CC}"
)
SET(BF_SOURCES ${BISON_CC} ${BISON_H} ${FLEX_CC})
ENDMACRO(GENERATE_BISON_FLEX_SOURCES)

@ -0,0 +1,77 @@
#################################################
#
# (C) 2011 Timothy Pearson
# kb9vqf (AT) pearsoncomputing.net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
cmake_minimum_required( VERSION 3.1 )
##### general package setup #####################
project( abakus )
##### include essential cmake modules ###########
include( CheckCXXSourceCompiles )
include( CheckFunctionExists )
include( CheckIncludeFileCXX )
include( CheckLibraryExists )
include( CheckStructHasMember )
include( CheckSymbolExists )
include( CheckTypeSize )
include( FindPkgConfig )
##### include our cmake modules #################
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
##### setup install paths #######################
include( TDESetupPaths )
tde_setup_paths( )
##### user requested modules ####################
option( BUILD_ALL "Build all" OFF )
option( BUILD_DOC "Build doc" ${BUILD_ALL} )
option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} )
##### configure checks ##########################
include( ConfigureChecks.cmake )
###### global compiler settings #################
add_definitions(
-DHAVE_CONFIG_H
)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
##### source directories ########################
add_subdirectory( icons )
add_subdirectory( src )
tde_conditional_add_subdirectory( BUILD_DOC doc )
tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po )
##### write configure files #####################
configure_file( config.h.cmake config.h @ONLY )

@ -0,0 +1,30 @@
#################################################
#
# (C) 2011 Timothy Pearson
# kb9vqf (AT) pearsoncomputing.net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
if( BUILD_TRANSLATIONS AND NOT DEFINED MSGFMT_EXECUTABLE )
find_program( MSGFMT_EXECUTABLE msgfmt )
if( NOT MSGFMT_EXECUTABLE )
tde_message_fatal( "msgfmt program is required, but was not found on your system" )
endif( )
endif( )
check_type_size( "int" SIZEOF_INT BUILTIN_TYPES_ONLY )
check_type_size( "long" SIZEOF_LONG BUILTIN_TYPES_ONLY )
check_include_file( stdint.h HAVE_STDINT_H )
check_include_file( systems.h HAVE_SYSTEMS_H )
check_include_file( linux/inotify.h HAVE_INOTIFY )
check_function_exists( statvfs HAVE_STATVFS )
# common required stuff
find_package( TQt )
find_package( TDE )

@ -1,36 +0,0 @@
#! /usr/bin/env python
###################################################################
# LOAD THE ENVIRONMENT AND SET UP THE TOOLS
###################################################################
## Load the builders in config
tools = [ 'default', 'help', 'generic', 'kde', 'abakus' ]
toolpath = [ './', './bksys' ]
# Required as part of SCons
env = Environment(tools = tools, toolpath = toolpath)
# Pull in some default settings.
env.KDEuse("environ rpath nohelp")
#env.KDEuse("environ rpath lang_qt thread nohelp")
# If we're asking for help just go ahead and exit now.
if env['HELP']:
print env.helpText()
Exit()
if env['flex'] and env['bison']:
env['PARSER_INCLUDED'] = True
# Export the environment so that SConscript files in subdirs can access it.
Export('env')
###################################################################
# SCRIPTS FOR BUILDING THE TARGETS
###################################################################
env.subdirs('src')
env.docfolder('doc/en', 'en', 'abakus/')
env.SConscript('doc/en/SConscript')

@ -0,0 +1 @@
Subproject commit 92a6d62b8f8f1836c43b54e3fb13b7ea7bb22e9f

@ -1,178 +0,0 @@
#!/usr/bin/env python
"""
Run scons -h to display the associated help, or look below ..
"""
BOLD ="\033[1m"
RED ="\033[91m"
GREEN ="\033[92m"
YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
CYAN ="\033[96m"
NORMAL ="\033[0m"
def exists(env):
return true
def printColorCoded(msg):
msg = msg.replace(']', NORMAL)
msg = msg.replace('b[', BOLD)
msg = msg.replace('g[', GREEN)
msg = msg.replace('r[', RED)
msg = msg.replace('c[', CYAN)
msg = msg.replace('y[', YELLOW)
print msg
def generate(env):
import SCons.Util, os
env.addHelpText("""b[hi]
b[*** abakus options ***
----------------------]
b[* bison=(no|yes): Enable parser support. Only needed for developers.
b[* flex=(no|yes): Enable lexer support. Only needed for developers.
b[* mpfr=(no|yes|check): Enable the MPFR library, which is faster and more
precise than abakus's high-precision code.
ie: b[scons configure]
""")
if env['HELP']:
# Don't even bother.
return env
from SCons.Options import Options, PackageOption, EnumOption
import os
def CheckFlags(context):
context.Message('Checking if ld supports --as-needed... ')
lastLINKFLAGS = context.env['LINKFLAGS']
context.env.Append(LINKFLAGS = '-Wl,--as-needed')
ret = context.TryLink("""
#include <iostream>
using namespace std;
int main()
{
cout << "Test" << endl;
}
""", ".cpp")
if not ret:
context.env.Replace(LINKFLAGS = lastLINKFLAGS)
context.Result(ret)
return ret
def CheckPath(context, prog, versionFlag = ''):
if context.env[prog] == 'yes':
context.env[prog] = prog
context.Message('Checking for %s... ' % prog)
ret = True
# If absolute path, just try this one.
if prog[0] == '/':
ret = context.TryAction('%s %s' % (context.env[prog], versionFlag))[0]
if ret:
context.Result(ret)
return True
path = context.env.WhereIs(prog)
if ret and path != None:
context.env[prog] = path
context.Result(1)
else:
context.env[prog] = False
context.Result(0)
print """
The $foo program was not found! You asked to use it so we will stop here. It
is not required, you may use $foo=no on the command line to go without it.""".replace('$foo', prog)
Exit(1)
return False
context.Result(1)
return True
cachefile = env['CACHEDIR'] + '/abakus.cache.py'
fixup = lambda x: "%s installed here (yes = search)" % x
opts = None
if env.doConfigure():
opts = Options(None, env['ARGS'])
else:
opts = Options(cachefile, env['ARGS'])
opts.AddOptions(
PackageOption('bison', fixup('use the Bison parser generator'), 'yes'),
PackageOption('flex', fixup('use the Flex scanner generator'), 'yes'),
EnumOption ('mpfr', 'use the MPFR high-precision library', 'check',
allowed_values=('yes', 'no', 'check'), map={}, ignorecase=1),
('ABAKUS_CONFIGURED', '', 0),
('HAVE_ASNEEDED', '', 0)
)
# We must manually pass the ARGS in.
opts.Update(env, env['ARGS'])
if env.doConfigure() or not env['ABAKUS_CONFIGURED']:
# Configure stuff
conf = env.Configure(custom_tests = {'CheckPath': CheckPath, 'CheckFlags' : CheckFlags})
if env['bison'] and env['bison'] != 'no':
conf.CheckPath('bison', '-V')
if env['flex'] and env['flex'] != 'no':
conf.CheckPath('flex', '-V')
if env['mpfr'] != 'no':
oldLibs = conf.env.get('LIBS', '')
conf.env.AppendUnique(LIBS = 'gmp')
if conf.CheckLibWithHeader('mpfr', 'mpfr.h', 'c++', '''
mpfr_t a;
mpfr_ptr ptr;
__mpfr_struct debug;
mpfr_init(a);
''', autoadd = True):
env['mpfr'] = 'yes'
else:
conf.env.Replace(LIBS = oldLibs)
if env['mpfr'] == 'yes':
print "Unable to find requested library mpfr!"
env.Exit(1)
else:
env['mpfr'] = 'no'
env['HAVE_ASNEEDED'] = 0
if conf.CheckFlags():
env['HAVE_ASNEEDED'] = 1
env['ABAKUS_CONFIGURED'] = 1
env = conf.Finish()
try:
f = open("config.h", "w+")
f.write("""/* config.h -- Automatically generated by abakus.py
* Any changes you make to this file will be overwritten!
*/
""")
f.write("/* HAVE_MPFR -- Defined if the MPFR library is being used. */\n")
if env['mpfr'] == 'yes':
f.write ("#define HAVE_MPFR 1\n")
else:
f.write ("/* #undef HAVE_MPFR */\n")
f.close()
except IOError:
print "Unable to write config.h!"
opts.Save(cachefile, env)
# vim: set et ts=8 sw=4:

@ -1,498 +0,0 @@
## Thomas Nagy, 2005
"""
Detect and store the most common options
* kdecxxflags : debug=1 (-g) or debug=full (-g3, slower)
else use the user CXXFLAGS if any, - or -O2 by default
* prefix : the installation path
* extraincludes : a list of paths separated by ':'
ie: scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local
"""
BOLD ="\033[1m"
RED ="\033[91m"
GREEN ="\033[92m"
YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
CYAN ="\033[96m"
NORMAL ="\033[0m"
import os, re, types, sys, string, shutil, stat
import SCons.Defaults
import SCons.Tool
import SCons.Util
from SCons.Script.SConscript import SConsEnvironment
from SCons.Options import Options, PathOption
class genobj:
def __init__(self, val, env):
if not val in "program shlib kioslave staticlib".split():
print "unknown genobj given: "+val
env.Exit(1)
self.type = val
self.orenv = env
self.env = None
self.executed = 0
self.target=''
self.src=None
self.cxxflags=''
self.cflags=''
self.includes=''
self.linkflags=''
self.libpaths=''
self.libs=''
# vars used by shlibs
self.vnum=''
self.libprefix=''
# a directory where to install the targets (optional)
self.instdir=''
# ignore the DESTDIR (optional)
self.nodestdir=''
# change the working directory before reading the targets
self.chdir=''
# these members are private
self.chdir_lock=None
self.old_os_dir=''
self.old_fs_dir=''
self.p_local_shlibs=[]
self.p_local_staticlibs=[]
self.p_global_shlibs=[]
#if not env.has_key('USE_THE_FORCE_LUKE'): env['USE_THE_FORCE_LUKE']=[self]
#else: env['USE_THE_FORCE_LUKE'].append(self)
def lockchdir(self):
if not self.chdir: return
self.chdir_lock=1
SConfFS=SCons.Node.FS.default_fs
self.old_fs_dir=SConfFS.getcwd()
self.old_os_dir=os.getcwd()
#os.chdir(old_os_dir+'/'+self.chdir)
SConfFS.chdir( SConfFS.Dir('#/'+self.chdir), change_os_dir=1)
def unlockchdir(self):
if not self.chdir: return
if self.chdir_lock:
#os.chdir(self.old_os_dir)
SCons.Node.FS.default_fs.chdir(self.old_fs_dir, change_os_dir=0)
self.chdir_lock=None
def execute(self):
if self.orenv.has_key('DUMPCONFIG'):
print self.xml()
return
self.lockchdir()
self.env = self.orenv.Copy()
if not self.src or len(self.src) == 0:
print RED+"no source file given to object - self.src"+NORMAL
self.env.Exit(1)
if not self.env.has_key('nosmart_includes'): self.env.AppendUnique(CPPPATH=['./'])
if self.type == "kioslave": self.libprefix=''
if len(self.includes)>0: self.env.AppendUnique(CPPPATH=self.env.make_list(self.includes))
if len(self.cxxflags)>0: self.env.AppendUnique(CXXFLAGS=self.env.make_list(self.cxxflags))
if len(self.cflags)>0: self.env.AppendUnique(CCFLAGS=self.env.make_list(self.cflags))
llist=self.env.make_list(self.libs)
lext='.so .la'.split()
sext='.a'.split()
for l in llist:
sal=SCons.Util.splitext(l)
if len(sal)>1:
if sal[1] in lext: self.p_local_shlibs.append(sal[0]+'.so')
elif sal[1] in sext: self.p_local_staticlibs.append(sal[0]+'.a')
else: self.p_global_shlibs.append(l)
if len(self.p_global_shlibs)>0: self.env.AppendUnique(LIBS=self.p_global_shlibs)
if len(self.libpaths)>0: self.env.PrependUnique(LIBPATH=self.env.make_list(self.libpaths))
if len(self.linkflags)>0: self.env.PrependUnique(LINKFLAGS=self.env.make_list(self.linkflags))
# the target to return
ret=None
if self.type=='shlib' or self.type=='kioslave':
ret=self.env.bksys_shlib(self.target, self.src, self.instdir,
self.libprefix, self.vnum, nodestdir=self.nodestdir)
elif self.type=='program':
ret=self.env.Program(self.target, self.src)
if not self.env.has_key('NOAUTOINSTALL'):
self.env.bksys_install(self.instdir, ret, nodestdir=self.nodestdir)
elif self.type=='staticlib':
ret=self.env.StaticLibrary(self.target, self.src)
# we link the program against a shared library made locally, add the dependency
if len(self.p_local_shlibs)>0:
self.env.link_local_shlib(self.p_local_shlibs)
if ret: self.env.Depends( ret, self.p_local_shlibs )
if len(self.p_local_staticlibs)>0:
self.env.link_local_staticlib(self.p_local_staticlibs)
if ret: self.env.Depends( ret, self.p_local_staticlibs )
self.unlockchdir()
## Copy function that honors symlinks
def copy_bksys(dest, source, env):
if os.path.islink(source):
#print "symlinking "+source+" "+dest
if os.path.islink(dest):
os.unlink(dest)
os.symlink(os.readlink(source), dest)
else:
shutil.copy2(source, dest)
st=os.stat(source)
os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
return 0
## Return a list of things
def make_list(env, s):
if type(s) is types.ListType:
return s
else:
return s.split()
def exists(env):
return true
def generate(env):
## Bksys requires scons 0.96
env.EnsureSConsVersion(0, 96)
SConsEnvironment.make_list = make_list
def doConfigure(env):
return not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('ISCONFIGURED'))
SConsEnvironment.doConfigure = doConfigure
env['HELP']=0
if '--help' in sys.argv or '-h' in sys.argv or 'help' in sys.argv:
env['HELP']=1
env.addHelpText("""
b[*** Generic options ***
-----------------------]
b[* debug ]: debug=1 (-g) or debug=full (-g3, slower), otherwise use
environment CXXFLAGS, or -O2 by default.
b[* prefix ]: the installation path
b[* extraincludes ]: a list of paths separated by ':'
ie: b[scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local]
""")
## Global cache directory
# Put all project files in it so a rm -rf cache will clean up the config
if not env.has_key('CACHEDIR'):
env['CACHEDIR'] = os.getcwd()+'/cache/'
if not os.path.isdir(env['CACHEDIR']):
os.mkdir(env['CACHEDIR'])
## SCons cache directory
# This avoids recompiling the same files over and over again:
# very handy when working with cvs
if os.getuid() != 0:
env.CacheDir(os.getcwd()+'/cache/objects')
# Avoid spreading .sconsign files everywhere - keep this line
env.SConsignFile(env['CACHEDIR']+'/scons_signatures')
def makeHashTable(args):
table = { }
for arg in args:
if len(arg) > 1:
lst=arg.split('=')
if len(lst) < 2:
continue
key=lst[0]
value=lst[1]
if len(key) > 0 and len(value) >0:
table[key] = value
return table
env['ARGS']=makeHashTable(sys.argv)
## Special trick for installing rpms ...
env['DESTDIR']=''
if 'install' in sys.argv:
dd=''
if os.environ.has_key('DESTDIR'):
dd=os.environ['DESTDIR']
if not dd:
if env['ARGS']: dd=env['ARGS']['DESTDIR']
if dd:
env['DESTDIR']=dd+'/'
print CYAN+'** Enabling DESTDIR for the project ** ' + NORMAL + env['DESTDIR']
## install symlinks for shared libraries properly
env['INSTALL'] = copy_bksys
## Use the same extension .o for all object files
env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
## load the options
cachefile=env['CACHEDIR']+'generic.cache.py'
opts = Options(cachefile)
opts.AddOptions(
( 'GENCCFLAGS', 'C flags' ),
( 'GENCXXFLAGS', 'debug level for the project : full or just anything' ),
( 'GENLINKFLAGS', 'additional link flags' ),
( 'PREFIX', 'prefix for installation' ),
( 'EXTRAINCLUDES', 'extra include paths for the project' ),
( 'ISCONFIGURED', 'is the project configured' ),
)
opts.Update(env)
# Use this to avoid an error message 'how to make target configure ?'
env.Alias('configure', None)
# Check if the following command line arguments have been given
# and set a flag in the environment to show whether or not it was
# given.
if 'install' in sys.argv:
env['_INSTALL']=1
else:
env['_INSTALL']=0
if 'configure' in sys.argv:
env['_CONFIGURE']=1
else:
env['_CONFIGURE']=0
# Configure the environment if needed
if doConfigure(env):
# be paranoid, unset existing variables
for var in "GENCXXFLAGS GENCCFLAGS GENLINKFLAGS PREFIX EXTRAINCLUDES ISCONFIGURED EXTRAINCLUDES".split():
if env.has_key(var): env.__delitem__(var)
if env['ARGS'].get('debug', None):
debuglevel = env['ARGS'].get('debug', None)
print CYAN+'** Enabling debug for the project **' + NORMAL
if (debuglevel == "full"):
env['GENCXXFLAGS'] = ['-DDEBUG', '-g3', '-Wall']
else:
env['GENCXXFLAGS'] = ['-DDEBUG', '-g', '-Wall']
else:
if os.environ.has_key('CXXFLAGS'):
# user-defined flags (gentooers will be elighted)
env['GENCXXFLAGS'] = SCons.Util.CLVar( os.environ['CXXFLAGS'] )
env.Append( GENCXXFLAGS = ['-DNDEBUG', '-DNO_DEBUG'] )
else:
env.Append(GENCXXFLAGS = ['-O2', '-DNDEBUG', '-DNO_DEBUG'])
if os.environ.has_key('CFLAGS'):
env['GENCCFLAGS'] = SCons.Util.CLVar( os.environ['CFLAGS'] )
## FreeBSD settings (contributed by will at freebsd dot org)
if os.uname()[0] == "FreeBSD":
if os.environ.has_key('PTHREAD_LIBS'):
env.AppendUnique( GENLINKFLAGS = SCons.Util.CLVar( os.environ['PTHREAD_LIBS'] ) )
else:
syspf = os.popen('/sbin/sysctl kern.osreldate')
osreldate = int(syspf.read().split()[1])
syspf.close()
if osreldate < 500016:
env.AppendUnique( GENLINKFLAGS = ['-pthread'])
env.AppendUnique( GENCXXFLAGS = ['-D_THREAD_SAFE'])
elif osreldate < 502102:
env.AppendUnique( GENLINKFLAGS = ['-lc_r'])
env.AppendUnique( GENCXXFLAGS = ['-D_THREAD_SAFE'])
else:
env.AppendUnique( GENLINKFLAGS = ['-pthread'])
# User-specified prefix
if env['ARGS'].has_key('prefix'):
env['PREFIX'] = os.path.abspath( env['ARGS'].get('prefix', '') )
print (CYAN+'** installation prefix for the project set to : ' +
env['PREFIX'] +' **'+ NORMAL)
# User-specified include paths
env['EXTRAINCLUDES'] = env['ARGS'].get('extraincludes', None)
if env['EXTRAINCLUDES']:
print (CYAN+'** extra include paths for the project set to: ' +
env['EXTRAINCLUDES'] +' **'+ NORMAL)
env['ISCONFIGURED']=1
# And finally save the options in the cache
opts.Save(cachefile, env)
def bksys_install(lenv, subdir, files, destfile=None, nodestdir=None):
""" Install files on "scons install"
If the DESTDIR env variable has been set, (e.g. by
"scons install DESTDIR=$CURDIR/debian) then install files to that
directory, regardless of where the configure stage showed that
files should be installed.
This feature is useful for packagers, and users of GNU stow.
NB. The DESTDIR will be ignored if NODESTDIR is also set, although
the same effect can be acheived by not setting DESTDIR in the first
place."""
if not env['_INSTALL']:
return
basedir = env['DESTDIR']
if nodestdir or env.has_key('NODESTDIR') : basedir = "/"
install_list = None
if not destfile:
install_list = env.Install(basedir+subdir+'/', files)
else:
if subdir:
install_list = env.InstallAs(basedir+subdir+'/'+destfile, files)
else:
install_list = env.InstallAs(basedir+'/'+destfile, files)
env.Alias('install', install_list)
return install_list
def build_la_file(target, source, env):
""" Action for building libtool files.
Writes a .la file, as used by libtool."""
dest=open(target[0].path, 'w')
sname=source[0].name
dest.write("dlname='%s'\n" % sname)
if len(env['BKSYS_VNUM'])>0:
vnum=env['BKSYS_VNUM']
nums=vnum.split('.')
src=source[0].name
name = src.split('so.')[0] + 'so'
strn = src+" "+name+"."+str(nums[0])+" "+name
dest.write("library_names='%s'\n" % (strn) )
else:
dest.write("library_names='%s %s %s'\n" % (sname, sname, sname) )
dest.write("old_library=''\ndependency_libs=''\ncurrent=0\n")
dest.write("age=0\nrevision=0\ninstalled=yes\nshouldnotlink=no\n")
dest.write("dlopen=''\ndlpreopen=''\n")
dest.write("libdir='%s'" % env['BKSYS_DESTDIR'])
dest.close()
return 0
def string_la_file(target, source, env):
print "building '%s' from '%s'" % (target[0].name, source[0].name)
la_file = env.Action(build_la_file, string_la_file, ['BKSYS_VNUM', 'BKSYS_DESTDIR'])
env['BUILDERS']['LaFile'] = env.Builder(action=la_file,suffix='.la',src_suffix=env['SHLIBSUFFIX'])
## Function for building shared libraries
def bksys_shlib(lenv, target, source, libdir, libprefix='lib', vnum='', noinst=None, nodestdir=None):
""" Install a shared library.
Installs a shared library, with or without a version number, and create a
.la file for use by libtool.
If library version numbering is to be used, the version number
should be passed as a period-delimited version number (e.g.
vnum = '1.2.3'). This causes the library to be installed
with its full version number, and with symlinks pointing to it.
For example, for libfoo version 1.2.3, install the file
libfoo.so.1.2.3, and create symlinks libfoo.so and
libfoo.so.1 that point to it.
"""
thisenv = lenv.Copy() # copying an existing environment is cheap
thisenv['BKSYS_DESTDIR']=libdir
thisenv['BKSYS_VNUM']=vnum
thisenv['SHLIBPREFIX']=libprefix
if len(vnum)>0:
thisenv['SHLIBSUFFIX']='.so.'+vnum
thisenv.Depends(target, thisenv.Value(vnum))
# Fix against a scons bug - shared libs and ordinal out of range(128)
if type(source) is types.ListType:
src2=[]
for i in source:
src2.append( str(i) )
source=src2
library_list = thisenv.SharedLibrary(target, source)
lafile_list = thisenv.LaFile(target, library_list)
## Install the libraries automatically
if not thisenv.has_key('NOAUTOINSTALL') and not noinst:
thisenv.bksys_install(libdir, library_list, nodestdir=nodestdir)
thisenv.bksys_install(libdir, lafile_list, nodestdir=nodestdir)
## Handle the versioning
if len(vnum)>0:
nums=vnum.split('.')
symlinkcom = ('cd $TARGET.dir && ' +
'rm -f $TARGET.name && ' +
'ln -s $SOURCE.name $TARGET.name')
tg = target+'.so.'+vnum
nm1 = target+'.so'
nm2 = target+'.so.'+nums[0]
thisenv.Command(nm1, tg, symlinkcom)
thisenv.Command(nm2, tg, symlinkcom)
#base=env['DESTDIR']+libdir+'/'
thisenv.bksys_install(libdir, nm1, nodestdir=nodestdir)
thisenv.bksys_install(libdir, nm2, nodestdir=nodestdir)
# Declare scons scripts to process
def subdirs(lenv, folderlist):
flist=[]
if type(folderlist) is types.ListType: flist = folderlist
else: flist = folderlist.split()
for i in flist:
lenv.SConscript(i+"/SConscript")
def link_local_shlib(lenv, str):
""" Links against a shared library made in the project """
lst = lenv.make_list(str)
for file in lst:
import re
reg = re.compile("(.*)/lib(.*).(la|so)")
result = reg.match(file)
if not result:
print "Unknown la file given "+file
continue
dir = result.group(1)
link = result.group(2)
lenv.AppendUnique(LIBS = [link])
lenv.PrependUnique(LIBPATH = [dir])
def link_local_staticlib(lenv, str):
""" Links against a shared library made in the project """
lst = lenv.make_list(str)
for file in lst:
import re
reg = re.compile("(.*)/(lib.*.a)")
result = reg.match(file)
if not result:
print "Unknown archive file given "+file
continue
f=SCons.Node.FS.default_fs.File(file)
lenv.Append(LINKFLAGS=[f.path])
#valid_targets = "program shlib kioslave staticlib".split()
SConsEnvironment.bksys_install = bksys_install
SConsEnvironment.bksys_shlib = bksys_shlib
SConsEnvironment.subdirs = subdirs
SConsEnvironment.link_local_shlib = link_local_shlib
SConsEnvironment.link_local_staticlib = link_local_staticlib
SConsEnvironment.genobj=genobj
if env.has_key('GENCXXFLAGS'):
env.PrependUnique( CXXFLAGS = env['GENCXXFLAGS'] )
if env.has_key('GENCCFLAGS'):
env.AppendUnique( CCFLAGS = env['GENCCFLAGS'] )
if env.has_key('GENLINKFLAGS'):
env.AppendUnique( LINKFLAGS = env['GENLINKFLAGS'] )
if env.has_key('EXTRAINCLUDES'):
if env['EXTRAINCLUDES']:
incpaths = []
for dir in str(env['EXTRAINCLUDES']).split(':'):
incpaths.append( dir )
env.Append(CPPPATH = incpaths)
env.Export('env')

@ -1,43 +0,0 @@
## Thomas Nagy, 2005
"""
Detect and store the most common options
* kdecxxflags : debug=1 (-g) or debug=full (-g3, slower)
else use the user CXXFLAGS if any, - or -O2 by default
* prefix : the installation path
* extraincludes : a list of paths separated by ':'
ie: scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local
"""
BOLD ="\033[1m"
RED ="\033[91m"
GREEN ="\033[92m"
YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
CYAN ="\033[96m"
NORMAL ="\033[0m"
def exists(env):
return true
def generate(env):
## Bksys requires scons 0.96
env.EnsureSConsVersion(0, 96)
env._help = ''
def addHelpText(env, text):
env._help = env._help + text
def helpText(env):
text = env._help.replace(']', NORMAL)
text = text.replace('b[', BOLD)
text = text.replace('g[', GREEN)
text = text.replace('r[', RED)
text = text.replace('y[', YELLOW)
text = text.replace('c[', CYAN)
return text
from SCons.Script.SConscript import SConsEnvironment
SConsEnvironment.addHelpText = addHelpText
SConsEnvironment.helpText = helpText

@ -1,824 +0,0 @@
# Made from scons qt.py and (heavily) modified into kde.py
# Thomas Nagy, 2004, 2005 <tnagy2^8@yahoo.fr>
"""
Run scons -h to display the associated help, or look below ..
"""
BOLD ="\033[1m"
RED ="\033[91m"
GREEN ="\033[92m"
YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
CYAN ="\033[96m"
NORMAL ="\033[0m"
import os, re, types
from SCons.Script.SConscript import SConsEnvironment
# Returns the name of the shared object (i.e. libkdeui.so.4)
# referenced by a libtool archive (like libkdeui.la)
def getSOfromLA(lafile):
contents = open(lafile, 'r').read()
match = re.search("^dlname='([^']*)'$", contents, re.M)
if match:
return match.group(1)
return None
# A helper, needed .. everywhere
def KDEuse(lenv, flags):
if lenv['HELP']: lenv.Exit(0)
_flags=lenv.make_list(flags)
if 'environ' in _flags:
## The scons developers advise against using this but it is mostly innocuous :)
lenv.AppendUnique( ENV = os.environ )
if not 'lang_qt' in _flags:
## Use this define if you are using the kde translation scheme (.po files)
lenv.Append( CPPFLAGS = '-DQT_NO_TRANSLATION' )
if 'rpath' in _flags:
## Use this to set rpath - this may cause trouble if folders are moved (chrpath)
lenv.Append( RPATH = [lenv['QTLIBPATH'], lenv['KDELIBPATH'], lenv['KDEMODULE']] )
kdelibpaths=[]
if lenv['KDELIBPATH'] == lenv['KDELIB']:
kdelibpaths = [lenv['KDELIB']]
else:
kdelibpaths = [lenv['KDELIBPATH'], lenv['KDELIB']]
lenv.Append( RPATH = [lenv['QTLIBPATH'], lenv['KDEMODULE']]+kdelibpaths )
if 'thread' in _flags:
## Uncomment the following if you need threading support
lenv.KDEaddflags_cxx( ['-DQT_THREAD_SUPPORT', '-D_REENTRANT'] )
if 'fasmoc' in _flags:
lenv['BKSYS_FASTMOC']=1
if not 'nohelp' in _flags:
if lenv['_CONFIGURE'] or lenv['HELP']:
lenv.Exit(0)
if not 'nosmart' or not lenv.has_key('nosmart_includes'):
lenv.AppendUnique(CPPPATH=['#/'])
lst=[]
if lenv.has_key('USE_THE_FORCE_LUKE'):
lst=lenv['USE_THE_FORCE_LUKE']
lenv.__delitem__('USE_THE_FORCE_LUKE')
for v in lst:
v.execute()
else:
lenv['nosmart_includes']=1
## To use kdDebug(intvalue)<<"some trace"<<endl; you need to define -DDEBUG
## it is done in admin/generic.py automatically when you do scons configure debug=1
def exists(env):
return True
def detect_kde(env):
""" Detect the qt and kde environment using kde-config mostly """
def getpath(varname):
if not env.has_key('ARGS'): return None
v=env['ARGS'].get(varname, None)
if v: v=os.path.abspath(v)
return v
prefix = getpath('prefix')
execprefix = getpath('execprefix')
datadir = getpath('datadir')
libdir = getpath('libdir')
kdeincludes = getpath('kdeincludes')
kdelibs = getpath('kdelibs')
qtincludes = getpath('qtincludes')
qtlibs = getpath('qtlibs')
libsuffix = ''
if env.has_key('ARGS'): libsuffix=env['ARGS'].get('libsuffix', '')
if libdir: libdir = libdir+libsuffix
## Detect the kde libraries
print "Checking for kde-config : ",
kde_config = os.popen("which kde-config 2>/dev/null").read().strip()
if len(kde_config):
print GREEN+"kde-config was found"+NORMAL
else:
print RED+"kde-config was NOT found in your PATH"+NORMAL
print "Make sure kde is installed properly"
print "(missing package kdebase-devel?)"
env.Exit(1)
env['KDEDIR'] = os.popen('kde-config -prefix').read().strip()
print "Checking for kde version : ",
kde_version = os.popen("kde-config --version|grep KDE").read().strip().split()[1]
if int(kde_version[0]) != 3 or int(kde_version[2]) < 2:
print RED+kde_version
print RED+"Your kde version can be too old"+NORMAL
print RED+"Please make sure kde is at least 3.2"+NORMAL
else:
print GREEN+kde_version+NORMAL
## Detect the qt library
print "Checking for the qt library : ",
qtdir = os.getenv("QTDIR")
if qtdir:
print GREEN+"qt is in "+qtdir+NORMAL
else:
try:
tmplibdir = os.popen('kde-config --expandvars --install lib').read().strip()
libkdeuiSO = tmplibdir+'/'+getSOfromLA(tmplibdir+'/libkdeui.la')
m = re.search('(.*)/lib/libqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libqt').read().strip().split()[2])
except:
m=None
if m:
qtdir = m.group(1)
print YELLOW+"qt was found as "+m.group(1)+NORMAL
else:
print RED+"qt was not found"+NORMAL
print RED+"Please set QTDIR first (/usr/lib/qt3?) or try scons -h for more options"+NORMAL
env.Exit(1)
env['QTDIR'] = qtdir.strip()
## Find the necessary programs uic-tqt and moc
print "Checking for uic-tqt : ",
uic = qtdir + "/bin/uic-tqt"
if os.path.isfile(uic):
print GREEN+"uic-tqt was found as "+uic+NORMAL
else:
uic = os.popen("which uic-tqt 2>/dev/null").read().strip()
if len(uic):
print YELLOW+"uic-tqt was found as "+uic+NORMAL
else:
uic = os.popen("which uic-tqt 2>/dev/null").read().strip()
if len(uic):
print YELLOW+"uic-tqt was found as "+uic+NORMAL
else:
print RED+"uic-tqt was not found - set QTDIR put it in your PATH ?"+NORMAL
env.Exit(1)
env['QT_UIC'] = uic
print "Checking for moc : ",
moc = qtdir + "/bin/moc"
if os.path.isfile(moc):
print GREEN + "moc was found as " + moc + NORMAL
else:
moc = os.popen("which moc 2>/dev/null").read().strip()
if len(moc):
print YELLOW + "moc was found as " + moc + NORMAL
elif os.path.isfile("/usr/share/qt3/bin/moc"):
moc = "/usr/share/qt3/bin/moc"
print YELLOW + "moc was found as " + moc + NORMAL
else:
print RED + "moc was not found - set QTDIR or put it in your PATH ?" + NORMAL
env.Exit(1)
env['QT_MOC'] = moc
## check for the qt and kde includes
print "Checking for the qt includes : ",
if qtincludes and os.path.isfile(qtincludes + "/qlayout.h"):
# The user told where to look for and it looks valid
print GREEN + "ok " + qtincludes + NORMAL
else:
if os.path.isfile(qtdir + "/include/qlayout.h"):
# Automatic detection
print GREEN + "ok " + qtdir + "/include/ " + NORMAL
qtincludes = qtdir + "/include/"
elif os.path.isfile("/usr/include/qt3/qlayout.h"):
# Debian probably
print YELLOW + "the qt headers were found in /usr/include/qt3/ " + NORMAL
qtincludes = "/usr/include/qt3"
elif os.path.isfile("/usr/include/qt4/Qt/qglobal.h"):
# Debian probably
print YELLOW + "the qt headers were found in /usr/include/qt4/ " + NORMAL
qtincludes = "/usr/include/qt4"
else:
print RED + "the qt headers were not found" + NORMAL
env.Exit(1)
print "Checking for the kde includes : ",
kdeprefix = os.popen("kde-config --prefix").read().strip()
if not kdeincludes:
kdeincludes = kdeprefix+"/include/"
if os.path.isfile(kdeincludes + "/klineedit.h"):
print GREEN + "ok " + kdeincludes + NORMAL
else:
if os.path.isfile(kdeprefix+"/include/kde/klineedit.h"):
# Debian, Fedora probably
print YELLOW + "the kde headers were found in " + kdeprefix + "/include/kde/" + NORMAL
kdeincludes = kdeprefix + "/include/kde/"
else:
print RED + "The kde includes were NOT found" + NORMAL
env.Exit(1)
# kde-config options
kdec_opts = {'KDEBIN' : 'exe', 'KDEAPPS' : 'apps',
'KDEDATA' : 'data', 'KDEICONS' : 'icon',
'KDEMODULE' : 'module', 'KDELOCALE' : 'locale',
'KDEKCFG' : 'kcfg', 'KDEDOC' : 'html',
'KDEMENU' : 'apps', 'KDEXDG' : 'xdgdata-apps',
'KDEMIME' : 'mime', 'KDEXDGDIR' : 'xdgdata-dirs',
'KDESERV' : 'services','KDESERVTYPES' : 'servicetypes',
'KDEINCLUDE': 'include'
}
if prefix:
## use the user-specified prefix
if not execprefix:
execprefix = prefix
if not datadir:
datadir=prefix+"/share"
if not libdir:
libdir=execprefix+"/lib"+libsuffix
subst_vars = lambda x: x.replace('${exec_prefix}', execprefix)\
.replace('${datadir}', datadir)\
.replace('${libdir}', libdir)
debian_fix = lambda x: x.replace('/usr/share', '${datadir}')
env['PREFIX'] = prefix
env['KDELIB'] = libdir
for (var, option) in kdec_opts.items():
dir = os.popen('kde-config --install ' + option).read().strip()
if var == 'KDEDOC': dir = debian_fix(dir)
env[var] = subst_vars(dir)
else:
env['PREFIX'] = os.popen('kde-config --expandvars --prefix').read().strip()
env['KDELIB'] = os.popen('kde-config --expandvars --install lib').read().strip()
for (var, option) in kdec_opts.items():
dir = os.popen('kde-config --expandvars --install ' + option).read().strip()
env[var] = dir
env['QTPLUGINS']=os.popen('kde-config --expandvars --install qtplugins').read().strip()
## kde libs and includes
env['KDEINCLUDEPATH']=kdeincludes
if not kdelibs:
kdelibs=os.popen('kde-config --expandvars --install lib').read().strip()
env['KDELIBPATH']=kdelibs
## qt libs and includes
env['QTINCLUDEPATH']=qtincludes
if not qtlibs:
qtlibs=qtdir+"/lib"+libsuffix
env['QTLIBPATH']=qtlibs
def generate(env):
""""Set up the qt and kde environment and builders - the moc part is difficult to understand """
# attach this function immediately
SConsEnvironment.KDEuse = KDEuse
env.addHelpText("""
b[*** KDE options ***
-------------------]
b[* prefix ]: base install path, ie: /usr/local
b[* execprefix ]: install path for binaries, ie: /usr/bin
b[* datadir ]: install path for the data, ie: /usr/local/share
b[* libdir ]: install path for the libs, ie: /usr/lib
b[* libsuffix ]: suffix of libraries on amd64, ie: 64, 32
b[* kdeincludes]: path to the kde includes (/usr/include/kde on debian, ...)
b[* qtincludes ]: path to the for qt includes (/usr/include/qt on debian, ...)
b[* kdelibs ]: path to the kde libs, for linking the programs
b[* qtlibs ]: path to the qt libs, for linking the programs
ie: b[scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt]
""")
import SCons.Defaults
import SCons.Tool
import SCons.Util
import SCons.Node
CLVar = SCons.Util.CLVar
splitext = SCons.Util.splitext
Builder = SCons.Builder.Builder
# Detect the environment - replaces ./configure implicitely and store the options into a cache
from SCons.Options import Options
cachefile=env['CACHEDIR']+'kde.cache.py'
opts = Options(cachefile)
opts.AddOptions(
('PREFIX', 'root of the program installation'),
('QTDIR', ''),
('QTLIBPATH', 'path to the qt libraries'),
('QTINCLUDEPATH', 'path to the qt includes'),
('QT_UIC', 'uic-tqt command'),
('QT_MOC', 'moc command'),
('QTPLUGINS', 'uic-tqt executable command'),
('KDEDIR', ''),
('KDELIBPATH', 'path to the installed kde libs'),
('KDEINCLUDEPATH', 'path to the installed kde includes'),
('KDEBIN', 'inst path of the kde binaries'),
('KDEINCLUDE', 'inst path of the kde include files'),
('KDELIB', 'inst path of the kde libraries'),
('KDEMODULE', 'inst path of the parts and libs'),
('KDEDATA', 'inst path of the application data'),
('KDELOCALE', ''), ('KDEDOC', ''), ('KDEKCFG', ''),
('KDEXDG', ''), ('KDEXDGDIR', ''), ('KDEMENU', ''),
('KDEMIME', ''), ('KDEICONS', ''), ('KDESERV', ''),
('KDESERVTYPES', ''), ('KDEAPPS', ''),
)
opts.Update(env)
def getInstDirForResType(lenv,restype):
if len(restype) == 0 or not lenv.has_key(restype):
print RED+"unknown resource type "+restype+NORMAL
lenv.Exit(1)
else:
instdir = lenv[restype]
basedir=lenv['DESTDIR']
## support for installing into other folders when PREFIX is set - used by gnu stow
if basedir: instdir = instdir.replace(lenv['PREFIX'], basedir)
return instdir
# reconfigure when things are missing
if not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('QTDIR') or not env.has_key('KDEDIR')):
detect_kde(env)
opts.Save(cachefile, env)
## set default variables, one can override them in sconscript files
env.Append(CXXFLAGS = ['-I'+env['KDEINCLUDEPATH'], '-I'+env['QTINCLUDEPATH'] ],
LIBPATH = [env['KDELIBPATH'], env['QTLIBPATH'] ])
env['QT_AUTOSCAN'] = 1
env['QT_DEBUG'] = 0
env['MEINPROC'] = 'meinproc'
env['MSGFMT'] = 'msgfmt'
## ui file processing
def uic_processing(target, source, env):
inc_kde ='#include <klocale.h>\n#include <kdialog.h>\n'
inc_moc ='#include "%s"\n' % target[2].name
comp_h ='$QT_UIC -L $QTPLUGINS -nounload -o %s %s' % (target[0].path, source[0].path)
comp_c ='$QT_UIC -L $QTPLUGINS -nounload -tr tr2i18n -impl %s %s' % (target[0].path, source[0].path)
comp_moc ='$QT_MOC -o %s %s' % (target[2].path, target[0].path)
if env.Execute(comp_h):
return ret
dest = open( target[1].path, "w" )
dest.write(inc_kde)
dest.close()
if env.Execute( comp_c+" >> "+target[1].path ):
return ret
dest = open( target[1].path, "a" )
dest.write(inc_moc)
dest.close()
ret = env.Execute( comp_moc )
return ret
def uicEmitter(target, source, env):
adjustixes = SCons.Util.adjustixes
bs = SCons.Util.splitext(str(source[0].name))[0]
bs = os.path.join(str(target[0].get_dir()),bs)
target.append(bs+'.cpp')
target.append(bs+'.moc')
return target, source
env['BUILDERS']['Uic']=Builder(action=uic_processing,emitter=uicEmitter,suffix='.h',src_suffix='.ui')
def kcfg_buildit(target, source, env):
comp='kconfig_compiler -d%s %s %s' % (str(source[0].get_dir()), source[1].path, source[0].path)
return env.Execute(comp)
def kcfg_stringit(target, source, env):
print "processing %s to get %s and %s" % (source[0].name, target[0].name, target[1].name)
def kcfgEmitter(target, source, env):
adjustixes = SCons.Util.adjustixes
bs = SCons.Util.splitext(str(source[0].name))[0]
bs = os.path.join(str(target[0].get_dir()),bs)
# .h file is already there
target.append(bs+'.cpp')
if not os.path.isfile(str(source[0])):
print RED+'kcfg file given '+str(source[0])+' does not exist !'+NORMAL
print os.popen('pwd').read()
return target, source
kfcgfilename=""
kcfgFileDeclRx = re.compile("^[fF]ile\s*=\s*(.+)\s*$")
for line in file(str(source[0]), "r").readlines():
match = kcfgFileDeclRx.match(line.strip())
if match:
kcfgfilename = match.group(1)
break
if not kcfgfilename:
print 'invalid kcfgc file'
return 0
source.append(str(source[0].get_dir())+'/'+kcfgfilename)
return target, source
env['BUILDERS']['Kcfg']=Builder(action=env.Action(kcfg_buildit, kcfg_stringit),
emitter=kcfgEmitter, suffix='.h', src_suffix='.kcfgc')
## MOC processing
env['BUILDERS']['Moc']=Builder(action='$QT_MOC -o $TARGET $SOURCE',suffix='.moc',src_suffix='.h')
env['BUILDERS']['Moccpp']=Builder(action='$QT_MOC -o $TARGET $SOURCE',suffix='_moc.cpp',src_suffix='.h')
## KIDL file
env['BUILDERS']['Kidl']=Builder(action= 'dcopidl $SOURCE > $TARGET || (rm -f $TARGET ; false)',
suffix='.kidl', src_suffix='.h')
## DCOP
env['BUILDERS']['Dcop']=Builder(action='dcopidl2cpp --c++-suffix cpp --no-signals --no-stub $SOURCE',
suffix='_skel.cpp', src_suffix='.kidl')
## STUB
env['BUILDERS']['Stub']=Builder(action= 'dcopidl2cpp --c++-suffix cpp --no-signals --no-skel $SOURCE',
suffix='_stub.cpp', src_suffix='.kidl')
## DOCUMENTATION
env['BUILDERS']['Meinproc']=Builder(action='$MEINPROC --check --cache $TARGET $SOURCE',suffix='.cache.bz2')
## TRANSLATIONS
env['BUILDERS']['Transfiles']=Builder(action='$MSGFMT $SOURCE -o $TARGET',suffix='.gmo',src_suffix='.po')
## Handy helpers for building kde programs
## You should not have to modify them ..
ui_ext = [".ui"]
kcfg_ext = ['.kcfgc']
header_ext = [".h", ".hxx", ".hpp", ".hh"]
cpp_ext = [".cpp", ".cxx", ".cc"]
skel_ext = [".skel", ".SKEL"]
stub_ext = [".stub", ".STUB"]
def KDEfiles(lenv, target, source):
""" Returns a list of files for scons (handles kde tricks like .skel)
It also makes custom checks against double includes like : ['file.ui', 'file.cpp']
(file.cpp is already included because of file.ui) """
q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]')
def scan_moc(bs, file_cpp):
addfile=None
# try to find the header
h_ext=''
for n_h_ext in header_ext:
if os.path.isfile(bs+n_h_ext):
h_ext=n_h_ext
break
# We have the header corresponding to the cpp file
if h_ext:
needscan=0
# User asked for fasmoc, try to avoid scanning
if env.has_key('BKSYS_FASTMOC'):
if os.path.isfile(bs+'.moc'):
lenv.Moc(bs+h_ext)
elif os.path.isfile(bs+'_moc.cpp'):
lenv.Moccpp(bs+h_ext)
addfile=bs+'_moc.cpp'
else:
#print "need scanning "+os.getcwd()+'/'+bs+".moc"
needscan=1
else:
needscan=1
# We cannot avoid scanning the files ...
if needscan:
file_h=bs+h_ext
h_contents = open(file_h, 'rb').read()
if q_object_search.search(h_contents):
# we know now there is Q_OBJECT macro
lst = bs.split('/')
val = lst[ len(lst) - 1 ]
reg = '\n\s*#include\s*("|<)'+val+'.moc("|>)'
meta_object_search = re.compile(reg)
cpp_contents = open(file_cpp, 'rb').read()
if meta_object_search.search(cpp_contents):
lenv.Moc(file_h)
else:
lenv.Moccpp(file_h)
addfile=bs+'_moc.cpp'
print "WARNING: moc.cpp for "+bs+h_ext+" consider using #include <file.moc> instead"
return addfile
src=[]
ui_files=[]
kcfg_files=[]
other_files=[]
kidl=[]
source_=lenv.make_list(source)
# For each file, check wether it is a dcop file or not, and create the complete list of sources
for file in source_:
bs = SCons.Util.splitext(file)[0]
ext = SCons.Util.splitext(file)[1]
if ext in skel_ext:
if not bs in kidl:
kidl.append(bs)
lenv.Dcop(bs+'.kidl')
src.append(bs+'_skel.cpp')
elif ext in stub_ext:
if not bs in kidl:
kidl.append(bs)
lenv.Stub(bs+'.kidl')
src.append(bs+'_stub.cpp')
elif ext == ".moch":
lenv.Moccpp(bs+'.h')
src.append(bs+'_moc.cpp')
elif ext in cpp_ext:
src.append(file)
if not env.has_key('NOMOCFILE'):
ret = scan_moc(bs, file)
if ret:
src.append( ret )
elif ext in ui_ext:
lenv.Uic(file)
src.append(bs+'.cpp')
elif ext in kcfg_ext:
lenv.Kcfg(file)
src.append(bs+'.cpp')
else:
src.append(file)
for base in kidl:
lenv.Kidl(base+'.h')
# Now check against typical newbie errors
for file in ui_files:
for ofile in other_files:
if ofile == file:
print RED+"WARNING: You have included "+file+".ui and another file of the same prefix"+NORMAL
print "Files generated by uic-tqt (file.h, file.cpp must not be included"
for file in kcfg_files:
for ofile in other_files:
if ofile == file:
print RED+"WARNING: You have included "+file+".kcfg and another file of the same prefix"+NORMAL
print "Files generated by kconfig_compiler (settings.h, settings.cpp) must not be included"
return src
""" In the future, these functions will contain the code that will dump the
configuration for re-use from an IDE """
import glob
def KDEinstall(lenv, restype, subdir, files):
if env.has_key('DUMPCONFIG'):
print "<install type=\"%s\" subdir=\"%s\">" % (restype, subdir)
for i in lenv.make_list(files):
print " <file name=\"%s\"/>" % i
print "</install>"
return
if not env['_INSTALL']:
return
dir = getInstDirForResType(lenv, restype)
install_list = lenv.bksys_install(dir+'/'+subdir, files, nodestdir=1)
return install_list
def KDEinstallas(lenv, restype, destfile, file):
if not env['_INSTALL']:
return
dir = getInstDirForResType(lenv, restype)
install_list = lenv.InstallAs(dir+'/'+destfile, file)
env.Alias('install', install_list)
return install_list
def KDEprogram(lenv, target, source,
includes='', localshlibs='', globallibs='', globalcxxflags=''):
""" Makes a kde program
The program is installed except if one sets env['NOAUTOINSTALL'] """
src = KDEfiles(lenv, target, source)
program_list = lenv.Program(target, src)
# we link the program against a shared library done locally, add the dependency
if not lenv.has_key('nosmart_includes'):
lenv.AppendUnique(CPPPATH=['./'])
if len(localshlibs)>0:
lst=lenv.make_list(localshlibs)
lenv.link_local_shlib(lst)
lenv.Depends( program_list, lst )
if len(includes)>0:
lenv.KDEaddpaths_includes(includes)
if len(globallibs)>0:
lenv.KDEaddlibs(globallibs)
if len(globalcxxflags)>0:
lenv.KDEaddflags_cxx(globalcxxflags)
if not lenv.has_key('NOAUTOINSTALL'):
KDEinstall(lenv, 'KDEBIN', '', target)
return program_list
def KDEshlib(lenv, target, source, kdelib=0, libprefix='lib',
includes='', localshlibs='', globallibs='', globalcxxflags='', vnum=''):
""" Makes a shared library for kde (.la file for klibloader)
The library is installed except if one sets env['NOAUTOINSTALL'] """
src = KDEfiles(lenv, target, source)
if not lenv.has_key('nosmart_includes'):
lenv.AppendUnique(CPPPATH=['./'])
# we link the program against a shared library done locally, add the dependency
lst=[]
if len(localshlibs)>0:
lst=lenv.make_list(localshlibs)
lenv.link_local_shlib(lst)
if len(includes)>0:
lenv.KDEaddpaths_includes(includes)
if len(globallibs)>0:
lenv.KDEaddlibs(globallibs)
if len(globalcxxflags)>0:
lenv.KDEaddflags_cxx(globalcxxflags)
restype = 'KDEMODULE'
if kdelib==1:
restype = 'KDELIB'
library_list = lenv.bksys_shlib(target, src, getInstDirForResType(lenv, restype), libprefix, vnum, nodestdir=1)
if len(lst)>0: lenv.Depends( library_list, lst )
return library_list
def KDEstaticlib(lenv, target, source):
""" Makes a static library for kde - in practice you should not use static libraries
1. they take more memory than shared ones
2. makefile.am needed it because of limitations
(cannot handle sources in separate folders - takes extra processing) """
if not lenv.has_key('nosmart_includes'):
lenv.AppendUnique(CPPPATH=['./'])
src = KDEfiles(lenv, target, source)
return lenv.StaticLibrary(target, src)
# do not install static libraries by default
def KDEaddflags_cxx(lenv, fl):
""" Compilation flags for C++ programs """
lenv.AppendUnique(CXXFLAGS = lenv.make_list(fl))
def KDEaddflags_c(lenv, fl):
""" Compilation flags for C programs """
lenv.AppendUnique(CFLAGS = lenv.make_list(fl))
def KDEaddflags_link(lenv, fl):
""" Add link flags - Use this if KDEaddlibs below is not enough """
lenv.PrependUnique(LINKFLAGS = lenv.make_list(fl))
def KDEaddlibs(lenv, libs):
""" Helper function """
lenv.AppendUnique(LIBS = lenv.make_list(libs))
def KDEaddpaths_includes(lenv, paths):
""" Add new include paths """
lenv.AppendUnique(CPPPATH = lenv.make_list(paths))
def KDEaddpaths_libs(lenv, paths):
""" Add paths to libraries """
lenv.PrependUnique(LIBPATH = lenv.make_list(paths))
def KDElang(lenv, folder, appname):
""" Process translations (.po files) in a po/ dir """
transfiles = glob.glob(folder+'/*.po')
for lang in transfiles:
result = lenv.Transfiles(lang)
country = SCons.Util.splitext(result[0].name)[0]
KDEinstallas(lenv, 'KDELOCALE', country+'/LC_MESSAGES/'+appname+'.mo', result)
def KDEicon(lenv, icname='*', path='./', restype='KDEICONS', subdir=''):
"""Contributed by: "Andrey Golovizin" <grooz()gorodok()net>
modified by "Martin Ellis" <m.a.ellis()ncl()ac()uk>
Installs icons with filenames such as cr22-action-frame.png into
KDE icon hierachy with names like icons/crystalsvg/22x22/actions/frame.png.
Global KDE icons can be installed simply using env.KDEicon('name').
The second parameter, path, is optional, and specifies the icons
location in the source, relative to the SConscript file.
To install icons that need to go under an applications directory (to
avoid name conflicts, for example), use e.g.
env.KDEicon('name', './', 'KDEDATA', 'appname/icons')"""
if env.has_key('DUMPCONFIG'):
print "<icondirent subdir=\"%s\">" % (path+subdir)
return
type_dic = { 'action' : 'actions', 'app' : 'apps', 'device' :
'devices', 'filesys' : 'filesystems', 'mime' : 'mimetypes' }
dir_dic = {
'los' :'locolor/16x16',
'lom' :'locolor/32x32',
'him' :'hicolor/32x32',
'hil' :'hicolor/48x48',
'lo16' :'locolor/16x16',
'lo22' :'locolor/22x22',
'lo32' :'locolor/32x32',
'hi16' :'hicolor/16x16',
'hi22' :'hicolor/22x22',
'hi32' :'hicolor/32x32',
'hi48' :'hicolor/48x48',
'hi64' :'hicolor/64x64',
'hi128':'hicolor/128x128',
'hisc' :'hicolor/scalable',
'cr16' :'crystalsvg/16x16',
'cr22' :'crystalsvg/22x22',
'cr32' :'crystalsvg/32x32',
'cr48' :'crystalsvg/48x48',
'cr64' :'crystalsvg/64x64',
'cr128':'crystalsvg/128x128',
'crsc' :'crystalsvg/scalable'
}
iconfiles = []
for ext in "png xpm mng svg svgz".split():
files = glob.glob(path+'/'+'*-*-%s.%s' % (icname, ext))
iconfiles += files
for iconfile in iconfiles:
lst = iconfile.split('/')
filename = lst[ len(lst) - 1 ]
tmp = filename.split('-')
if len(tmp)!=3:
print RED+'WARNING: icon filename has unknown format: '+iconfile+NORMAL
continue
[icon_dir, icon_type, icon_filename]=tmp
try:
basedir=getInstDirForResType(lenv, restype)
destfile = '%s/%s/%s/%s/%s' % (basedir, subdir, dir_dic[icon_dir], type_dic[icon_type], icon_filename)
except KeyError:
print RED+'WARNING: unknown icon type: '+iconfile+NORMAL
continue
## Do not use KDEinstallas here, as parsing from an ide will be necessary
if env['_INSTALL']:
env.Alias('install', env.InstallAs( destfile, iconfile ) )
## This function uses env imported above
def docfolder(lenv, folder, lang, destination=""):
# folder is the folder to process
# lang is the language
# destination is the subdirectory in KDEDOC
docfiles = glob.glob(folder+"/???*.*") # file files that are at least 4 chars wide :)
# warn about errors
#if len(lang) != 2:
# print "error, lang must be a two-letter string, like 'en'"
# when the destination is not given, use the folder
if len(destination) == 0:
destination=folder
docbook_list = []
for file in docfiles:
# do not process folders
if not os.path.isfile(file):
continue
# do not process the cache file
if file == 'index.cache.bz2':
continue
# ignore invalid files (TODO??)
if len( SCons.Util.splitext( file ) ) <= 1 :
continue
ext = SCons.Util.splitext( file )[1]
# docbook files are processed by meinproc
if ext != '.docbook':
continue
docbook_list.append( file )
lenv.KDEinstall('KDEDOC', lang+'/'+destination, file)
# Now process the index.docbook files ..
if len(docbook_list) == 0:
return
if not os.path.isfile( folder+'/index.docbook' ):
print "Error, index.docbook was not found in "+folder+'/index.docbook'
return
## Define this to 1 if you are writing documentation else to 0 :)
if env.has_key('i_am_a_documentation_writer'):
for file in docbook_list:
lenv.Depends( folder+'index.cache.bz2', file )
lenv.Meinproc( folder+'/index.cache.bz2', folder+'/index.docbook' )
lenv.KDEinstall( 'KDEDOC', lang+'/'+destination, folder+'/index.cache.bz2' )
#valid_targets = "program shlib kioslave staticlib".split()
import generic
class kobject(generic.genobj):
def __init__(self, val, senv=None):
if senv: generic.genobj.__init__(self, val, senv)
else: generic.genobj.__init__(self, val, env)
self.iskdelib=0
def it_is_a_kdelib(self): self.iskdelib=1
def execute(self):
self.lockchdir()
if self.orenv.has_key('DUMPCONFIG'):
print self.xml()
return
if (self.type=='shlib' or self.type=='kioslave'):
install_dir = 'KDEMODULE'
if self.iskdelib==1: install_dir = 'KDELIB'
self.instdir=getInstDirForResType(self.orenv, install_dir)
self.nodestdir=1
elif self.type=='program':
self.instdir=getInstDirForResType(self.orenv, 'KDEBIN')
self.nodestdir=1
self.src=KDEfiles(env, self.target, self.source)
generic.genobj.execute(self)
self.unlockchdir()
def xml(self):
ret= '<compile type="%s" chdir="%s" target="%s" cxxflags="%s" cflags="%s" includes="%s" linkflags="%s" libpaths="%s" libs="%s" vnum="%s" iskdelib="%s" libprefix="%s">\n' % (self.type, self.chdir, self.target, self.cxxflags, self.cflags, self.includes, self.linkflags, self.libpaths, self.libs, self.vnum, self.iskdelib, self.libprefix)
if self.source:
for i in self.orenv.make_list(self.source):
ret += ' <source file="%s"/>\n' % i
ret += "</compile>"
return ret
# Attach the functions to the environment so that SConscripts can use them
SConsEnvironment.KDEprogram = KDEprogram
SConsEnvironment.KDEshlib = KDEshlib
SConsEnvironment.KDEstaticlib = KDEstaticlib
SConsEnvironment.KDEinstall = KDEinstall
SConsEnvironment.KDEinstallas = KDEinstallas
SConsEnvironment.KDElang = KDElang
SConsEnvironment.KDEicon = KDEicon
SConsEnvironment.KDEaddflags_cxx = KDEaddflags_cxx
SConsEnvironment.KDEaddflags_c = KDEaddflags_c
SConsEnvironment.KDEaddflags_link = KDEaddflags_link
SConsEnvironment.KDEaddlibs = KDEaddlibs
SConsEnvironment.KDEaddpaths_includes = KDEaddpaths_includes
SConsEnvironment.KDEaddpaths_libs = KDEaddpaths_libs
SConsEnvironment.docfolder = docfolder
SConsEnvironment.kobject = kobject

Binary file not shown.

@ -0,0 +1,6 @@
#cmakedefine SIZEOF_INT @SIZEOF_INT@
#cmakedefine SIZEOF_LONG @SIZEOF_LONG@
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_SYSTEMS_H 1
#cmakedefine HAVE_STATVFS 1
#cmakedefine HAVE_MPFR 1

@ -0,0 +1,12 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
tde_auto_add_subdirectories()

@ -0,0 +1,12 @@
#################################################
#
# (C) 2011 Timothy Pearson
# kb9vqf (AT) pearsoncomputing.net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
tde_create_handbook( LANG en DESTINATION abakus )

@ -0,0 +1,12 @@
#################################################
#
# (C) 2011 Timothy Pearson
# kb9vqf (AT) pearsoncomputing.net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
tde_install_icons( )

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

@ -0,0 +1,17 @@
#################################################
#
# (C) 2011 Timothy Pearson
# kb9vqf (AT) pearsoncomputing.net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} abakus.po )
foreach( _po ${po_files} )
get_filename_component( _lang ${_po} PATH )
tde_create_translation( FILES ${_po} LANG ${_lang} )
endforeach( )

@ -0,0 +1,54 @@
#################################################
#
# (C) 2011 Timothy Pearson
# kb9vqf (AT) pearsoncomputing.net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
include_directories(
${TQT_INCLUDE_DIRS}
${TDE_INCLUDE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src
${CMAKE_SOURCE_DIR}/src
)
link_directories(
${TQT_LIBRARY_DIRS}
)
include( ${CMAKE_SOURCE_DIR}/BisonMacros.cmake )
##### other data ################################
install( FILES abakus.desktop DESTINATION ${APPS_INSTALL_DIR}/Utilities )
install( FILES abakusui.rc DESTINATION ${DATA_INSTALL_DIR}/abakus )
##### abakus (executable) #######################
GENERATE_BISON_FLEX_SOURCES(${CMAKE_SOURCE_DIR}/src/parser.yy "" ${CMAKE_SOURCE_DIR}/src/lexer.ll "")
if( HAVE_MPFR )
set( MPFR_SOURCES "" )
set( MPFR_LIBRARIES "mpfr gmp" )
else( HAVE_MPFR )
set( MPFR_SOURCES hmath.cpp number.c )
set( MPFR_LIBRARIES "" )
endif( HAVE_MPFR )
tde_add_executable( abakus AUTOMOC
SOURCES abakus.cpp abakuslistview.cpp
dragsupport.cpp editor.cpp
evaluator.cpp function.cpp
mainwindow.cpp node.cpp
numerictypes.cpp result.cpp
resultlistview.cpp resultlistviewtext.cpp
rpnmuncher.cpp valuemanager.cpp dcopIface.skel
${BF_SOURCES} ${MPFR_SOURCES}
LINK kio-shared kdecore-shared kdeprint-shared kdeui-shared DCOP-shared ${MPFR_LIBRARIES}
DESTINATION ${BIN_INSTALL_DIR}
)

@ -1,81 +0,0 @@
#! /usr/bin/env python
## This script demonstrates how to build and install
## a simple kde program having KconfigXT settings
## with scons
##
## Thomas Nagy, 2004, 2005
## This file can be reused freely for any project (see COPYING)
############################
## load the config
## Use the environment and the tools set in the top-level
## SConstruct file (set with 'Export') - this is very important
Import( 'env' )
myenv=env.Clone()
#############################
## the programs to build
# The sources for our program - only .ui, .skel and .cpp are accepted
abakus_sources = """
abakus.cpp
abakuslistview.cpp
dragsupport.cpp
editor.cpp
evaluator.cpp
function.cpp
lexer_lex.cpp
mainwindow.cpp
node.cpp
numerictypes.cpp
parser_yacc.cpp
result.cpp
resultlistview.cpp
resultlistviewtext.cpp
rpnmuncher.cpp
valuemanager.cpp
dcopIface.skel
"""
if myenv.get('mpfr', 'no') == 'yes':
myenv.Append(LIBS = ['mpfr', 'gmp'])
else:
abakus_sources = abakus_sources + " hmath.cpp number.c"
myenv.KDEprogram( "abakus", abakus_sources )
myenv.KDEicon( 'abakus' )
# Mark these as being created by flex and bison if it's installed.
if myenv.Dictionary().has_key('PARSER_INCLUDED'):
myenv.CXXFile( "lexer_lex.cpp", "lexer.ll" )
myenv.CXXFile( "parser_yacc.cpp", "parser.yy", YACCFLAGS="-d" )
if myenv['HAVE_ASNEEDED']:
myenv.Append(LINKFLAGS = '-Wl,--as-needed')
myenv.Append(CXXFLAGS = '-Wno-non-virtual-dtor -I/usr/include/tqt -include tqt.h -DTQT_THREAD_SUPPORT')
############################
## Customization
## Additional include paths for compiling the source files
## Always add '../' (top-level directory) because moc makes code that needs it
myenv.KDEaddpaths_includes('#/src/ #/')
## Necessary libraries to link against
myenv.KDEaddlibs( 'qt-mt tqt kio kdecore kdeprint kdeui DCOP' )
#############################
## Data to install
## The ui.rc file and the tips go into datadir/appname/
myenv.KDEinstall( 'KDEDATA', 'abakus', 'abakusui.rc' )
## Warning : there is a difference between the normal destop file used for the menu
## and the servicetype desktop file, so they go in different directories
## you will find more information in 'test3'
myenv.KDEinstall( 'KDEMENU', 'Utilities', 'abakus.desktop')

@ -132,7 +132,7 @@ ValueListViewItem::ValueListViewItem(TQListView *listView, const TQString &name,
void ValueListViewItem::valueChanged()
{
setText(1, m_value.toString());
tqrepaint();
repaint();
}
void ValueListViewItem::valueChanged(const Abakus::number_t &newValue)

@ -147,7 +147,7 @@ void ChoiceItem::paint( TQPainter* painter )
//int xPos = fm.width( item );
int xPos = TQMAX(fm.width(item), minNameWidth);
if( !isSelected() )
painter->setPen( listBox()->tqpalette().disabled().text().dark() );
painter->setPen( listBox()->palette().disabled().text().dark() );
painter->drawText( 10 + xPos, yPos, desc );
}
@ -161,7 +161,7 @@ int EditorHighlighter::highlightParagraph ( const TQString & text, int )
{
if( !editor->isSyntaxHighlightEnabled() )
{
setFormat( 0, text.length(), editor->tqcolorGroup().text() );
setFormat( 0, text.length(), editor->colorGroup().text() );
return 0;
}
@ -184,7 +184,12 @@ int EditorHighlighter::highlightParagraph ( const TQString & text, int )
case Token::Identifier:
{
color = editor->highlightColor( Editor::Variable );
#ifndef QT_NO_STL
if( binary_search( fnames.constBegin(), fnames.constEnd(), text) ) {
#else // QT_NO_STL
#warning "Not using STL libraries; performance may be degraded..."
if( fnames.find( text) != fnames.end()) {
#endif // QT_NO_STL
color = editor->highlightColor( Editor::FunctionName );
}
}
@ -219,7 +224,7 @@ Editor::Editor( TQWidget* parent, const char* name ):
d->autoCalcTimer = new TQTimer( this );
d->matchingTimer = new TQTimer( this );
tqsetSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed );
setSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed );
setWordWrap( NoWrap );
setHScrollBarMode( AlwaysOff );
setVScrollBarMode( AlwaysOff );
@ -256,14 +261,14 @@ Editor::~Editor()
delete d;
}
TQSize Editor::tqsizeHint() const
TQSize Editor::sizeHint() const
{
constPolish();
TQFontMetrics fm = fontMetrics();
int h = TQMAX(fm.lineSpacing(), 14);
int w = fm.width( 'x' ) * 20;
int m = frameWidth() * 2;
return( tqstyle().tqsizeFromContents(TQStyle::CT_LineEdit, this,
return( style().tqsizeFromContents(TQStyle::CT_LineEdit, this,
TQSize( w + m, h + m + 4 ).
expandedTo(TQApplication::globalStrut())));
}
@ -498,7 +503,7 @@ void Editor::triggerAutoComplete()
TQStringList choices;
for( unsigned i=0; i<fnames.count(); i++ )
if( fnames[i].tqstartsWith( id, false ) )
if( fnames[i].startsWith( id, false ) )
{
TQString str = fnames[i];
@ -516,13 +521,13 @@ void Editor::triggerAutoComplete()
TQStringList values = ValueManager::instance()->valueNames();
for(TQStringList::ConstIterator it = values.begin(); it != values.end(); ++it)
if( (*it).tqstartsWith( id, false ) )
if( (*it).startsWith( id, false ) )
{
TQString choice = ValueManager::description(*it);
if(choice.isEmpty())
choice = ValueManager::instance()->value(*it).toString();
vchoices.append( TQString("%1:%2").tqarg( *it, choice ) );
vchoices.append( TQString("%1:%2").arg( *it, choice ) );
}
vchoices.sort();
@ -622,7 +627,7 @@ void Editor::autoCalc()
Abakus::number_t result = parseString(str.latin1());
if( Result::lastResult()->type() == Result::Value )
{
TQString ss = TQString("Result: <b>%2</b>").tqarg(result.toString());
TQString ss = TQString("Result: <b>%2</b>").arg(result.toString());
d->autoCalcLabel->setText( ss );
d->autoCalcLabel->adjustSize();
@ -753,11 +758,11 @@ EditorCompletion::EditorCompletion( Editor* editor ): TQObject( editor )
d = new Private;
d->editor = editor;
d->completionPopup = new TQVBox( editor->tqtopLevelWidget(), 0, WType_Popup );
d->completionPopup = new TQVBox( editor->topLevelWidget(), 0, WType_Popup );
d->completionPopup->setFrameStyle( TQFrame::Box | TQFrame::Plain );
d->completionPopup->setLineWidth( 1 );
d->completionPopup->installEventFilter( this );
d->completionPopup->tqsetSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Minimum);
d->completionPopup->setSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Minimum);
d->completionListBox = new TQListBox( d->completionPopup );
d->completionPopup->setFocusProxy( d->completionListBox );
@ -838,7 +843,7 @@ void EditorCompletion::showCompletion( const TQStringList &choices )
// size of the pop-up
d->completionPopup->setMaximumHeight( 120 );
d->completionPopup->resize( d->completionListBox->tqsizeHint() +
d->completionPopup->resize( d->completionListBox->sizeHint() +
TQSize( d->completionListBox->verticalScrollBar()->width() + 4,
d->completionListBox->horizontalScrollBar()->height() + 4 ) );

@ -49,8 +49,8 @@ class Editor : public TQTextEdit
Editor( TQWidget* parent = 0, const char* name = 0 );
~Editor();
TQSize tqsizeHint() const;
TQSize xtqminimumSizeHint() const;
TQSize sizeHint() const;
TQSize xminimumSizeHint() const;
TQStringList history() const;
void setHistory( const TQStringList& history );

@ -22,7 +22,7 @@
#include "evaluator.h"
#include "function.h"
#include "node.h" // For parser_yacc.hpp below
#include "parser_yacc.hpp"
#include "parser.h"
#include <tqapplication.h>
#include <tqmap.h>
@ -140,7 +140,7 @@ static Token::Op matchOperator( const TQString& text )
if( text.length() == 1 )
{
TQChar p = text[0];
switch( p.tqunicode() )
switch( p.unicode() )
{
case '+': result = Token::Plus; break;
case '-': result = Token::Minus; break;

@ -24,7 +24,7 @@
#include "node.h"
#include "function.h"
#include "parser_yacc.hpp"
#include "parser.h"
#include "result.h"
int yyCurTokenPos;

@ -54,20 +54,20 @@ MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_in
{
m_mainSplitter = new TQSplitter(this);
TQWidget *box = new TQWidget(m_mainSplitter);
TQVBoxLayout *tqlayout = new TQVBoxLayout(box);
m_layout = tqlayout;
tqlayout->setSpacing(6);
tqlayout->setMargin(6);
TQVBoxLayout *layout = new TQVBoxLayout(box);
m_layout = layout;
layout->setSpacing(6);
layout->setMargin(6);
TQWidget *configBox = new TQWidget(box);
tqlayout->addWidget(configBox);
layout->addWidget(configBox);
TQHBoxLayout *configLayout = new TQHBoxLayout(configBox);
configLayout->addWidget(new TQWidget(configBox));
TQLabel *label = new TQLabel(i18n("History: "), configBox);
label->tqsetAlignment(AlignCenter);
label->setAlignment(AlignCenter);
configLayout->addWidget(label);
TQButtonGroup *buttonGroup = new TQButtonGroup(0);
@ -90,7 +90,7 @@ MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_in
connect(m_radians, TQT_SIGNAL(clicked()), TQT_SLOT(slotRadians()));
m_history = new TQVBox(box);
tqlayout->addWidget(m_history);
layout->addWidget(m_history);
m_history->setSpacing(6);
m_history->setMargin(0);
@ -103,10 +103,10 @@ MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_in
TQT_SLOT(slotResultSelected(const TQString &)));
m_history->setStretchFactor(m_result, 1);
tqlayout->setStretchFactor(m_history, 1);
layout->setStretchFactor(m_history, 1);
TQHBox *editBox = new TQHBox(box);
tqlayout->addWidget(editBox);
layout->addWidget(editBox);
editBox->setSpacing(6);
m_edit = new Editor(editBox);
@ -222,7 +222,7 @@ void MainWindow::slotReturnPressed()
}
else {
m_insert = false;
resultVal = i18n("Error: %1").tqarg(RPNParser::errorString());
resultVal = i18n("Error: %1").arg(RPNParser::errorString());
}
// Skip creating list view items if in compact mode.
@ -318,7 +318,7 @@ void MainWindow::slotUpdateSize()
if(m_newSize != TQSize(0, 0))
resize(m_newSize);
else
resize(width(), tqminimumSize().height());
resize(width(), minimumSize().height());
}
void MainWindow::slotDegrees()
@ -419,7 +419,7 @@ void MainWindow::loadConfig()
TQStringList fnList = config.readListEntry("FunctionList");
for(TQStringList::ConstIterator it = fnList.begin(); it != fnList.end(); ++it)
parseString(*it); // Run the function definitions through the parser
parseString((*it).ascii()); // Run the function definitions through the parser
}
populateListViews();
@ -454,8 +454,8 @@ void MainWindow::saveConfig()
continue;
list += TQString("%1=%2")
.tqarg(*it)
.tqarg(ValueManager::instance()->value(*it).toString());
.arg(*it)
.arg(ValueManager::instance()->value(*it).toString());
}
config.writeEntry("Saved Variables", list);
@ -492,7 +492,7 @@ void MainWindow::saveConfig()
TQString var = manager->function(*it)->userFn->varName;
TQString expr = fn->operand()->infixString();
saveList += TQString("set %1(%2) = %3").tqarg(*it).tqarg(var).tqarg(expr);
saveList += TQString("set %1(%2) = %3").arg(*it).arg(var).arg(expr);
}
config.writeEntry("FunctionList", saveList);
@ -631,7 +631,7 @@ void MainWindow::slotNewFunction(const TQString &name)
{
UserFunction *userFn = FunctionManager::instance()->function(name)->userFn;
UnaryFunction *fn = dynamic_cast<UnaryFunction *>(userFn->fn);
TQString fnName = TQString("%1(%2)").tqarg(name, userFn->varName);
TQString fnName = TQString("%1(%2)").arg(name, userFn->varName);
TQString expr = fn->operand()->infixString();
new KListViewItem(m_fnList, fnName, expr);
@ -640,7 +640,7 @@ void MainWindow::slotNewFunction(const TQString &name)
void MainWindow::slotRemoveFunction(const TQString &name)
{
UserFunction *userFn = FunctionManager::instance()->function(name)->userFn;
TQString fnName = TQString("%1(%2)").tqarg(name, userFn->varName);
TQString fnName = TQString("%1(%2)").arg(name, userFn->varName);
TQListViewItem *item = 0;
while((item = m_fnList->findItem(fnName, 0)) != 0)
@ -714,7 +714,7 @@ TQString MainWindow::interpolateExpression(const TQString &text, ResultListViewT
unsigned numPos = stackStr.mid(1).toUInt();
if(!m_result->getStackValue(numPos, value)) {
new ResultListViewText(m_result, text, i18n("Marker %1 isn't set").tqarg(stackStr), after, true);
new ResultListViewText(m_result, text, i18n("Marker %1 isn't set").arg(stackStr), after, true);
return TQString();
}

@ -42,7 +42,7 @@ class ResultListViewText;
class AbakusIface;
// Main window class, handles events and tqlayout and stuff
// Main window class, handles events and layout and stuff
class MainWindow : public KMainWindow
{
Q_OBJECT

@ -64,7 +64,7 @@ void UnaryFunction::applyMap(NodeFunctor &fn) const
TQString UnaryFunction::infixString() const
{
return TQString("%1(%2)").tqarg(name(), operand()->infixString());
return TQString("%1(%2)").arg(name(), operand()->infixString());
}
BuiltinFunction::BuiltinFunction(const char *name, Node *operand) :
@ -210,7 +210,7 @@ void DerivativeFunction::applyMap(NodeFunctor &fn) const
TQString DerivativeFunction::infixString() const
{
return TQString("deriv(%1, %2)").tqarg(m_operand->infixString(), m_where->infixString());
return TQString("deriv(%1, %2)").arg(m_operand->infixString(), m_where->infixString());
}
UnaryOperator::UnaryOperator(Type type, Node *operand)
@ -233,9 +233,9 @@ void UnaryOperator::applyMap(NodeFunctor &fn) const
TQString UnaryOperator::infixString() const
{
if(dynamic_cast<BinaryOperator *>(operand()))
return TQString("-(%1)").tqarg(operand()->infixString());
return TQString("-(%1)").arg(operand()->infixString());
return TQString("-%1").tqarg(operand()->infixString());
return TQString("-%1").arg(operand()->infixString());
}
Abakus::number_t UnaryOperator::derivative() const
@ -312,10 +312,10 @@ TQString BinaryOperator::infixString() const
op = "Error";
}
TQString left = TQString(isSimpleNode(leftNode()) ? "%1" : "(%1)").tqarg(leftNode()->infixString());
TQString right = TQString(isSimpleNode(rightNode()) ? "%1" : "(%1)").tqarg(rightNode()->infixString());
TQString left = TQString(isSimpleNode(leftNode()) ? "%1" : "(%1)").arg(leftNode()->infixString());
TQString right = TQString(isSimpleNode(rightNode()) ? "%1" : "(%1)").arg(rightNode()->infixString());
return TQString("%1 %2 %3").tqarg(left, op, right);
return TQString("%1 %2 %3").arg(left, op, right);
}
Abakus::number_t BinaryOperator::derivative() const

@ -31,7 +31,7 @@ typedef SharedPtr<Node> NodePtr;
/**
* A class that operates on a Node. Called recursively on a node and all
* of its tqchildren.
* of its children.
*/
class NodeFunctor
{
@ -50,7 +50,7 @@ class Node
// typically read-only.
virtual void deleteNode(Node *node);
// Calls functor() on all subtqchildren and this.
// Calls functor() on all subchildren and this.
virtual void applyMap(NodeFunctor &fn) const = 0;
// Returns an infix representation of the expression.

@ -78,7 +78,7 @@ TQString convertToString(const mpfr_ptr &number)
if(r.isEmpty())
r = "0";
r.append(TQString("e%1").tqarg(exp - 1));
r.append(TQString("e%1").arg(exp - 1));
return sign + l + decimalSymbol + r;
}
@ -190,7 +190,7 @@ TQString convertToString(const HNumber &num)
str.truncate(str.length() - 1); // Remove trailing period.
if(parts.count() > 1 && parts[1] != "0")
str += TQString("e%1").tqarg(parts[1]);
str += TQString("e%1").arg(parts[1]);
return str;
}

@ -100,7 +100,7 @@ S: error '=' {
// Can't assign to a function.
S: FUNC '=' {
TQString s(i18n("You can't assign to function %1").tqarg($1->name()));
TQString s(i18n("You can't assign to function %1").arg($1->name()));
Result::setLastResult(s);
YYABORT;
@ -116,14 +116,14 @@ ASSIGN: '(' { --gCheckIdents; } IDENT ')' '=' {
// since normally functions and variables with the same name can coexist, but
// I don't want to duplicate code all over the place.
S: SET DERIV {
TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg("deriv"));
TQString s(i18n("Function %1 is built-in and cannot be overridden.").arg("deriv"));
Result::setLastResult(s);
YYABORT;
}
S: DERIV '=' {
TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg("deriv"));
TQString s(i18n("Function %1 is built-in and cannot be overridden.").arg("deriv"));
Result::setLastResult(s);
YYABORT;
@ -139,7 +139,7 @@ S: SET FUNC ASSIGN EXP {
FunctionManager *manager = FunctionManager::instance();
if(manager->isFunction(funcName) && !manager->isFunctionUserDefined(funcName)) {
TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg(funcName));
TQString s(i18n("Function %1 is built-in and cannot be overridden.").arg(funcName));
Result::setLastResult(s);
YYABORT;
@ -148,9 +148,9 @@ S: SET FUNC ASSIGN EXP {
if(manager->isFunction(funcName))
manager->removeFunction(funcName);
BaseFunction *newFn = new UserDefinedFunction(funcName, $4);
BaseFunction *newFn = new UserDefinedFunction(funcName.ascii(), $4);
if(!manager->addFunction(newFn, ident)) {
TQString s(i18n("Unable to define function %1 because it is recursive.").tqarg(funcName));
TQString s(i18n("Unable to define function %1 because it is recursive.").arg(funcName));
Result::setLastResult(s);
YYABORT;
@ -170,7 +170,7 @@ S: SET IDENT ASSIGN EXP {
// No need to check if the function is already defined, because the
// lexer checked for us before returning the IDENT token.
BaseFunction *newFn = new UserDefinedFunction(funcName, $4);
BaseFunction *newFn = new UserDefinedFunction(funcName.ascii(), $4);
FunctionManager::instance()->addFunction(newFn, ident);
Result::setLastResult(Result::Null);
@ -188,14 +188,14 @@ S: REMOVE FUNC '(' ')' {
// Can't remove an ident using remove-func syntax.
S: REMOVE IDENT '(' ')' {
// This is an error
Result::setLastResult(Result(i18n("Function %1 is not defined.").tqarg($2->name())));
Result::setLastResult(Result(i18n("Function %1 is not defined.").arg($2->name())));
YYABORT;
}
// This happens when the user tries to remove a function that's not defined.
S: REMOVE IDENT '(' IDENT ')' {
// This is an error
Result::setLastResult(Result(i18n("Function %1 is not defined.").tqarg($2->name())));
Result::setLastResult(Result(i18n("Function %1 is not defined.").arg($2->name())));
YYABORT;
}
@ -211,9 +211,9 @@ S: REMOVE IDENT {
else {
TQString s;
if(manager->isValueSet($2->name()))
s = i18n("Can't remove predefined variable %1.").tqarg($2->name());
s = i18n("Can't remove predefined variable %1.").arg($2->name());
else
s = i18n("Can't remove undefined variable %1.").tqarg($2->name());
s = i18n("Can't remove undefined variable %1.").arg($2->name());
Result::setLastResult(s);
@ -228,7 +228,7 @@ S: SET IDENT '=' EXP {
if($2->name() == "pi" && $4->value() == Abakus::number_t("3.0"))
Result::setLastResult(i18n("This isn't Indiana, you can't just change pi"));
else
Result::setLastResult(i18n("%1 is a constant").tqarg($2->name()));
Result::setLastResult(i18n("%1 is a constant").arg($2->name()));
YYABORT;
}
@ -247,7 +247,7 @@ S: IDENT '=' EXP {
if($1->name() == "pi" && $3->value() == Abakus::number_t("3.0"))
Result::setLastResult(i18n("This isn't Indiana, you can't just change pi"));
else
Result::setLastResult(i18n("%1 is a constant").tqarg($1->name()));
Result::setLastResult(i18n("%1 is a constant").arg($1->name()));
YYABORT;
}
@ -259,13 +259,13 @@ S: IDENT '=' EXP {
}
S: NUMBER '=' {
Result::setLastResult(i18n("Can't assign to %1").tqarg($1->value().toString()));
Result::setLastResult(i18n("Can't assign to %1").arg($1->value().toString()));
YYABORT;
}
// Can't call this as a function.
TERM: IDENT '(' {
Result::setLastResult(i18n("%1 isn't a function (or operator expected)").tqarg($1->name()));
Result::setLastResult(i18n("%1 isn't a function (or operator expected)").arg($1->name()));
YYABORT;
}
@ -351,7 +351,7 @@ TERM: NUMBER '(' EXP ')' {
TERM: NUMBER IDENT {
if(gCheckIdents > 0 && !ValueManager::instance()->isValueSet($2->name())) {
Result::setLastResult(i18n("Unknown variable %1").tqarg($2->name()));
Result::setLastResult(i18n("Unknown variable %1").arg($2->name()));
YYABORT;
}
@ -362,7 +362,7 @@ VALUE: IDENT {
if(gCheckIdents <= 0 || ValueManager::instance()->isValueSet($1->name()))
$$ = $1;
else {
Result::setLastResult(i18n("Unknown variable %1").tqarg($1->name()));
Result::setLastResult(i18n("Unknown variable %1").arg($1->name()));
YYABORT;
}
}

@ -129,7 +129,7 @@ void ResultListView::slotCopyResult()
if(!m_itemRightClicked)
return;
TQClipboard *clipboard = TQApplication::tqclipboard();
TQClipboard *clipboard = TQApplication::clipboard();
clipboard->setText(m_itemRightClicked->resultText(), TQClipboard::Clipboard);
}

@ -54,7 +54,7 @@ ResultListViewText::ResultListViewText(KListView *listView,
for (; item && item != this; item = static_cast<ResultListViewText *>(item->itemBelow())) {
if(!item->wasError()) {
item->setStackPosition(item->stackPosition() + 1);
item->tqrepaint();
item->repaint();
}
}
}
@ -67,7 +67,7 @@ ResultListViewText::ResultListViewText(KListView *listView,
void ResultListViewText::setStackPosition(unsigned pos)
{
setText(ShortcutColumn, TQString("$%1").tqarg(pos));
setText(ShortcutColumn, TQString("$%1").arg(pos));
m_stackPosition = pos;
}

@ -115,7 +115,7 @@ Abakus::number_t RPNParser::rpnParseString(const TQString &text)
case Func:
if(m_stack.count() < 1) {
m_error = true;
m_errorStr = i18n("Insufficient operands for function %1").tqarg(*it);
m_errorStr = i18n("Insufficient operands for function %1").arg(*it);
return Abakus::number_t::nan();
}
@ -150,7 +150,7 @@ Abakus::number_t RPNParser::rpnParseString(const TQString &text)
case Unknown:
m_error = true;
m_errorStr = i18n("Unknown token %1").tqarg(*it);
m_errorStr = i18n("Unknown token %1").arg(*it);
return Abakus::number_t::nan();
break;

Loading…
Cancel
Save