In the process of moving to USA all my data is scattered around. It has been almost 2 years now but still I need to re-organize most of the data which are saved in various random places for redundancy. Having a couple of HDD failures didn’t help either.

All of the pictures are organized now; I had to write few Python scripts which check the EXIF data to find duplicates though. Well, it’s another story, now I’ll talk about the SVN installation.

Few weeks ago I started to gather my personal codebase part of which was in CVS repository. I wanted to port it to Subversion. For that I installed the SVN server and setup a repository on our Windows7 computer which we use as a home server.

Note to Self 1: This is the web page that helped me to learn the main steps of the process.

Note to Self 2: Also the cvs2svn script was a life saver, which preserved all of the history of the projects. Although they say that cvs2svn does not officially support CVSNT repositories, in my case the conversion went pretty smooth.

The next step is digging out more of my old sources and adding them to the repository.

 

Here is the Python script that I use to launch Visual Studio for working on Brazil code locally. It sets the proper search paths -including 3ds max SDK folders- for the compiler and linker for the chosen target platform and 3ds max version, then launches the correct visual studio.

import os
import msvcrt
import platform
import subprocess
from winsound import *

#===============================================================================
# Machine dependent Values
#===============================================================================
MaxBins={
	3:"c:\\graphic\\3d\\3dsmax3\\",
	4:"c:\\graphic\\3d\\3dsmax4\\",
	5:"c:\\graphic\\3d\\3dsmax5\\",
	6:"c:\\graphic\\3d\\3dsmax6\\",
	7:"c:\\graphic\\3d\\3dsmax7\\",
	8:"c:\\graphic\\3d\\3dsmax8\\",
	9:"c:\\graphic\\3d\\3dsmax9\\",
	10:"c:\\graphic\\3d\\3dsmax2008\\",
	}

MaxSDKs={
	3:"C:\\dev\\SDK\\Maxsdk3\\",
	4:"C:\\dev\\SDK\\Maxsdk4\\",
	5:"C:\\dev\\SDK\\Maxsdk5\\",
	6:"C:\\dev\\SDK\\Maxsdk6\\",
	7:"C:\\dev\\SDK\\Maxsdk7\\",
	8:"C:\\dev\\SDK\\Maxsdk8\\",
	9:"C:\\dev\\SDK\\Maxsdk9\\",
	10:"C:\\dev\\SDK\\Maxsdk10\\",
}

VCExes = {
	6:"C:\\dev\\vs6\\Common\\MSDev98\\Bin\\MSDEV.EXE",
	7:"C:\\dev\\vs7\\Common7\\IDE\\devenv.exe",
	8:"C:\\dev\\vs8\\Common7\\IDE\\devenv.exe",
	}

SetVarBatchesVC8x64={  #host OS dependent batches for target platform
	"x86"  :"C:\\dev\\vs8\\VC\\bin\\x86_amd64\\vcvarsx86_amd64.bat",
	"AMD64":"C:\\dev\\vs8\\VC\\bin\\amd64\\vcvarsamd64.bat",
	}

SetVarBatches = {
	"x86":{
		6:"C:\\dev\\vs6\\VC98\\Bin\\vcvars32.bat",
		7:"C:\\dev\\vs7\\vc7\\Bin\\vcvars32.bat",
		8:"C:\\dev\\vs8\\vc\\Bin\\vcvars32.bat"
		},
	"x64":{
		8:SetVarBatchesVC8x64[os.environ["PROCESSOR_ARCHITECTURE"]]
		}
	}

BrazilProjectPaths = {
	1: "D:\\_works\\dev\\SplutterFishCVS\\B1Max\\",
	2: "D:\\_works\\dev\\SplutterFishCVS\\Daedalus_01\\"
	}

BrazilTypeDefs = {
	"P": "BRAZIL_PRO_EDITION",
	"B": "BRAZIL_BASIC_EDITION",
	"R": "BRAZIL_RIO_EDITION",
	"E": "BRAZIL_EDU_EDITION",
	"N": ""
	}	

#===============================================================================
# Generic Values
#===============================================================================
MaxSDKIncSub = "\\include"
MaxSDKLibSubs= {"x86":"\\lib", "x64":"\\x64\\lib"}

#===============================================================================
# Functions
#===============================================================================

#_______________________________________________________________________________
def choose_max():
	while True:
		print "\nMAX version        [ 3 | 4 | 5 | 6 | 7 | 8 | 9 | 1(0) | Q ]    : ",
		choice = msvcrt.getche().capitalize()
		if choice=="Q": exit()
		if choice in ["3","4","5","6","7","8","9"]:	return choice
		if choice=="0": return "10"
		print " incorrect input!",
		MessageBeep(MB_ICONHAND) 

#_______________________________________________________________________________
def choose_platform():
	while True:
		print "\nPlatform Type      [ (3) x86 | (6) x64 | (Q)uit ]              : ",
		choice = msvcrt.getche().capitalize()
		if choice == "Q": exit()
		if choice == "3": return "x86"
		if choice == "6": return "x64"
		print " incorrect input!",
		MessageBeep(MB_ICONHAND) 

#_______________________________________________________________________________
def choose_brazil_ver():
	while True:
		print "\nBrazil r/s version [ 1 | 2 | N | Q ]                           : ",
		choice = msvcrt.getche().capitalize()
		if choice=="Q":	exit()
		if choice in ["1","2","N"]:	return choice
		print " incorrect input!",
		MessageBeep(MB_ICONHAND) 

#_______________________________________________________________________________
def choose_brazil_type():
	while True:
		print "\nBuild Type         [ (P)ro | (B)asic | (R)io | (E)du | (Q)uit ]: ",
		choice = msvcrt.getche().capitalize()
		if choice=="Q":	exit()
		if choice in ["P","B","R","E"]: return choice
		print " incorrect input!",
		MessageBeep(MB_ICONHAND) 

#_______________________________________________________________________________
def choose_compiler():
	while True:
		print "\nCompiler Type      [ (M)icrosoft | (I)ntel | (Q)uit ]          : ",
		choice = msvcrt.getche().capitalize()
		if choice=="Q":	exit()
		if choice in ["M","I"]:	return choice
		print " incorrect input!",
		MessageBeep(MB_ICONHAND) 	

#_______________________________________________________________________________
def choose_asm_generation():
	while True:
		print "\nGenerate ASM code  [ (Y)es | (N)o | (Q)uit ]                   : ",
		choice = msvcrt.getche().capitalize()
		if choice=="Q":	exit()
		if choice in ["Y","N"]:	return choice
		print " incorrect input!",
		MessageBeep(MB_ICONHAND) 

#_______________________________________________________________________________
def choose_pdb_generation():
	while True:
		print "\nGenerate PDB files [ (Y)es | (N)o | (Q)uit ]                   : ",
		choice = msvcrt.getche().capitalize()
		if choice=="Q":	exit()
		if choice in ["Y","N"]:	return choice
		print " incorrect input!",
		MessageBeep(MB_ICONHAND) 

#_______________________________________________________________________________
def do_menu():
	global max_ver, platform, brazil_ver, brazil_type, compiler_type, gen_asm, gen_pdb
	# ask max version
	max_ver = int(choose_max())

	# ask target platform
	if max_ver==9:	platform = choose_platform()
	else:			platform = "x86"

	# ask Brazil version
	brazil_ver = choose_brazil_ver()

	# ask Brazil type
	if brazil_ver != "N":
		brazil_ver  = int(brazil_ver)
		brazil_type = choose_brazil_type()
	else:
		brazil_ver	= 0
		brazil_type = None

	# ask Compiler
	compiler_type = choose_compiler()

	#ask ASM and PDB generation
	gen_asm = choose_asm_generation()
	gen_pdb = choose_pdb_generation()

#_______________________________________________________________________________
def run_msvc():
	# determine vc version
	if 	 max_ver in range(3, 6):vc_ver = 6
	elif max_ver in range(6, 9):vc_ver = 7
	elif max_ver in range(9,11):vc_ver = 8
	else:
		print "unsupported max version"
		exit();

	# determine the include and lib paths
	max_sdk_inc = MaxSDKs[max_ver] + MaxSDKIncSub
	max_sdk_lib = MaxSDKs[max_ver] + MaxSDKLibSubs[platform]

	# prepare the common command strings
	call_bat_cmd= "call " + SetVarBatches[platform][vc_ver]
	vc_exe_cmd 	= VCExes[vc_ver] + " /USEENV"

	# prepare the environment variables
	lib_env	= MaxSDKs[max_ver]+MaxSDKLibSubs[platform]
	inc_env	= MaxSDKs[max_ver]+MaxSDKIncSub
	cl_env  = ""
	link_env= ""

	# do the version specific adjustments to the commands
	if compiler_type=="I":
		cl_env +=" /DUSING_INTEL_COMPILER"
	if vc_ver==6:
		vc_exe_cmd +=" /Y3" # show build time (undocumented switch)
	if vc_ver==8:
		cl_env +=" /D_CRT_SECURE_NO_DEPRECATE" 	

	# set brazil type
	if brazil_type<> None:
		cl_env += " /D" + BrazilTypeDefs[brazil_type]

	# Turn on ASM List Generation
	if gen_asm=="Y":
		cl_env	+=" /FAs"

	# Turn on PDB Generation
	if gen_pdb=="Y":
		cl_env	+=" /Zi"
		link_env+=" /DEBUG" 

	# Display the variables
	print "\n\n"
	print "========================================================================="
	print "call_bat_cmd=" , call_bat_cmd
	print "vc_exe_cmd  =" , vc_exe_cmd
	print "lib_env     =" , lib_env
	print "inc_env     =" , inc_env
	print "cl_env      =" , cl_env
	print "link_env    =" , link_env
	print "=========================================================================\n"

	# set the environment variables of the sub process
	env_vars = os.environ
	env_vars.update({
		"LIB"		: lib_env,
		"INCLUDE"	: inc_env,
		"CL"		: cl_env,
		"LINK"		: link_env,
		})

	# have sub cmd interpreter execute the commands that needs to be in the same process tree
	print "running the compiler..."
	command_str = "cmd /s /c "
	command_str+= call_bat_cmd
	command_str+= " && " + "call ListDevEnvVars.bat"
	command_str+= " && " + vc_exe_cmd
	subprocess.call(command_str, env=env_vars )

#_______________________________________________________________________________
def incremental_backup():
	print "daily backup ..."
	subprocess.call("daily_backup.bat")

#===============================================================================
# MAIN
#===============================================================================

do_menu()
run_msvc()
incremental_backup()

#exit
print "press any key to exit...\n"
MessageBeep(MB_ICONASTERISK)
msvcrt.getch()
 

Well, I need to start blogging from somewhere and in my opinion it doesn’t need to be a typical “welcome yo!” message. So this is about what I’m working at the moment. Maybe later I can add a proper first(!) post.

Currently I’m debugging a minidump file for a remote crash and since the crash was not on my computer, I needed to tell visual studio where to find corresponding binaries in my computer (if you are not familiar with postmortem debugging, here you can find a very nicely prepared article). I know that it’s the MODPATH argument that points to local module path.

But it didn’t work… After digging around a bit, I found a little information here:

In previous versions of Visual Studio, the MODPATH argument was used to specify additional module search paths. Visual Studio 2005 looks for modules in the specified symbol search paths and does not use MODPATH.

Grrr! :)

© 2012 Notes to Shelf Suffusion theme by Sayontan Sinha