Skip to content

Commit

Permalink
masm
Browse files Browse the repository at this point in the history
  • Loading branch information
bvolpato committed May 14, 2018
1 parent 3763b40 commit 3580804
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 11 deletions.
3 changes: 1 addition & 2 deletions aliases
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ alias mvn='mvn -Djava.awt.headless=true'
alias mvnc='mvn clean install -DskipTests'
alias mvncq='mvnc -e -Dorg.slf4j.simpleLogger.defaultLogLevel=warn'

alias mvncfast='mvn -T4 clean install -DskipTests'
alias mvncfast='mvn -T4 clean install -DskipTests -Dmaven.test.skip=true'
alias mvncfastq='mvncfast -e -Dorg.slf4j.simpleLogger.defaultLogLevel=warn'

alias mvnarch='mvn archetype:generate'
Expand Down Expand Up @@ -251,4 +251,3 @@ alias gbuild='gulp build'
if hash thefuck 2> /dev/null; then
eval $(thefuck --alias)
fi

4 changes: 4 additions & 0 deletions bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ fi

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
source ~/.profile


export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
65 changes: 56 additions & 9 deletions functions
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,10 @@ import json,sys;
obj=json.load(sys.stdin);
result=obj["'"$1"'"];
if isinstance(result, unicode):
print result;
if isinstance(result, str):
print(result);
else:
print json.dumps(result, indent=4);
print(json.dumps(result, indent=4));
';
}

Expand All @@ -570,10 +570,10 @@ import json,sys;
obj=json.load(sys.stdin);
result=obj['"$1"'];
if isinstance(result, unicode):
print result;
if isinstance(result, str):
print(result);
else:
print json.dumps(result, indent=4);
print(json.dumps(result, indent=4));
';
}

Expand All @@ -587,10 +587,10 @@ obj=json.load(sys.stdin);
for inst in (item for item in obj):
if "'$1'" in inst:
result = inst["'$1'"]
if isinstance(result, unicode):
print result;
if isinstance(result, str):
print(result);
else:
print json.dumps(result, indent=4);
print(json.dumps(result, indent=4));
';
}

Expand Down Expand Up @@ -1452,4 +1452,51 @@ function ix() {
}


function masm() (
# Stop on errors
set -e

# Use the correct wine directory
export WINEPREFIX=$WINE_MASM_DIR

# Get the path to the file without a .asm extension
FILENAME="$(basename "$1")"
EXTENSION="${FILENAME##*.}"
shopt -s nocasematch # String case-insensitive comparison
if [[ "$EXTENSION" = "asm" ]]; then
FILENAME="${FILENAME%.*}" # Remove extension
fi
UNIX_PATH="$(dirname "$1")/$FILENAME"

# Convert forwards slashes into backslashes
WINDOWS_PATH=$(echo "$UNIX_PATH" | tr '/' '\')

# Assemble file
wine ml -nologo -c -coff -Zi "$WINDOWS_PATH.asm"

# Link files
# Notes: Irvine's asm32.bat script includes a /DEBUG flag. I found that
# including this flag causes a link fail:
# LINK : fatal error LNK1000: unknown error; consult documentation for
# technical support options
# Therefore, I have omitted it. Additionally, the default entry point
# for Wine or perhaps later versions of Windows appears to be
# mainCRTStartup instead of main (see http://stackoverflow.com/a/12391264),
# so we need to manually specify main as the entry point with /ENTRY.
wine link /NOLOGO /SUBSYSTEM:CONSOLE /ENTRY:main \
/LIBPATH:'C:\Irvine' \
irvine32.lib kernel32.lib user32.lib "$WINDOWS_PATH.obj"

# Run the linked executable
wine "$WINDOWS_PATH.exe"
)


function optimizejpeg() {
#convert -strip -interlace Plane -quality 80 $1 $1
convert $1 -sampling-factor 4:2:0 -strip $1

}
export -f optimizejpeg

function shuf() { perl -MList::Util=shuffle -e 'print shuffle(<>);' "$@"; }
1 change: 1 addition & 0 deletions gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
unmerge = reset --hard ORIG_HEAD
export-patch = !git format-patch --stdout $1 > ~/`git bn`.diff
rank = !git shortlog -s -n
wsf = !git commit -mTemp && git stash && git rebase HEAD~ --whitespace=fix && git reset --soft HEAD~ && git stash pop

[color]
# Use colors in Git commands that are capable of colored output when outputting to the terminal
Expand Down
6 changes: 6 additions & 0 deletions spread
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export PATH=/usr/local/bin:$PATH

export DOTFILES=$DIR

#source "$DIR/bash_profile"
source "$DIR/exports"
source "$DIR/options"
source "$DIR/aliases"
Expand All @@ -36,6 +37,11 @@ else
echo "Brew not installed. Ignoring a few sources."
fi

# MASM
export WINEPREFIX=~/wine-masm
export WINE_MASM_DIR=~/wine-masm


#if hash archey 2> /dev/null; then
#archey
#fi

0 comments on commit 3580804

Please sign in to comment.