khanat-code-old/code/nel/tools/3d/plugin_max/scripts/nel_utility.ms
StudioEtrange 91e6b23d3f ** PCH Support for NMake with VS2012
NMAKE-VS2012 Error LNK2011
while NMAKE-VS2010 does not complain
we need to link the pch.obj file
see http://msdn.microsoft.com/en-us/library/3ay26wa2(v=vs.110).aspx

** PCH Support for Ninja
Ninja need to add property
        OBJECT_DEPENDS for using PCH
        OBJECT_OUTPUTS for create PCH
see http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
2013-09-05 17:18:01 +02:00

102 lines
2.2 KiB
Text

---------------------------------------------------------
-- Some utility functions
---------------------------------------------------------
-- SUMMARY:
-- lowercase
-- uppercase
-- fileExist
-- adjustPathStringForScript
---------------------------------------------------------
fn lowercase instring =
(
local upper, lower, outstring
upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lower="abcdefghijklmnopqrstuvwxyz"
outstring = copy instring
for iii = 1 to outstring.count do
(
jjj = findString upper outstring[iii]
if (jjj != undefined) then
outstring[iii] = lower[jjj]
else
outstring[iii] = instring[iii]
)
return outstring -- value of outstring will be returned as function result
)
---------------------------------------------------------
fn uppercase instring =
(
local upper, lower, outstring
upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lower="abcdefghijklmnopqrstuvwxyz"
outstring = copy instring
for iii = 1 to outstring.count do
(
jjj = findString upper outstring[iii]
if (jjj != undefined) then
outstring[iii] = upper[jjj]
else
outstring[iii] = instring[iii]
)
return outstring -- value of outstring will be returned as function result
)
---------------------------------------------------------
-- Adjust path string to use "/" and not finish with a /
-- "c:\temp" -> "c:/temp"
-- "c:\temp\" -> "c:/temp"
-- "c:/temp" -> "c:/temp"
-- "c:/temp/" -> "c:/temp"
fn adjustPathStringForScript pathString =
(
-- Change '\' in '/'
local arrayString, output
arrayString = filterString pathString "\\"
output = ""
for fragment in arrayString do
(
output = output + fragment + "/"
)
-- Remove final "/"
while (output.count) != 0 and (output[output.count] == "/") do
(
output = substring output 1 (output.count - 1)
)
-- Return result
return output
)
---------------------------------------------------------
fn fileExist filename =
(
local file
file = openFile filename mode:"r"
if file == undefined then
(
return false
)
else
(
close file
return true
)
)
---------------------------------------------------------