Everybody loves a good yearly or so update

This commit is contained in:
KholdFuzion
2025-04-25 10:11:31 -04:00
parent 02bad2cca4
commit 414a8feb8e
373 changed files with 46731 additions and 50709 deletions
+82
View File
@@ -0,0 +1,82 @@
#Only Draw PBar if NOT verbose
ifeq ($(VERBOSE),0)
# Separate "constant" drawing from variable drawing to speed up PBar rendering
# draws a box and fills it grey ready for blue bar
SetupProgressBar = \
{ \
str="$(SAVECURSOR)$(call SET_SCROLLREGION,4,0)$(call CURSOR_GOTO,2,999)$(VT_ED)$(call CURSOR_GOTO,1)";\
str=$$str"\033(0lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"; \
str=$$str"\nx$(call SET_TEXTATTRIB,$(BG_GRAY))%78s$(RESTORECOLOUR)x\n"; \
str=$$str"mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj\033(B"; \
str=$$str"$(RESTORECURSOR)"; \
printf $$str ""; \
}
#(call DrawProgressBar,Percent)
# OR
#(call DrawProgressBar,NumberOfItemsDone,TotalNumberOfItems)
# If second param is given, use it to work out a percentage.
# divide the percentage into a 80 char long bar
# paint the whole bar grey
# paint the first half, then text, then second half.
# clear colour codes
DrawProgressBar = \
{ \
$(if $(2), \
if [ "$(1)" -ne "$(2)" ]; \
then \
_pdone=`expr 100 / $(2) \* $(1)`; \
else \
_pdone=100; \
fi \
,_pdone=$(1) \
); \
pdone=`expr $$_pdone \* 74 / 100`; \
pdoneb=0; \
str="$(SAVECURSOR)$(call CURSOR_GOTO,2,2)";\
str=$$str"$(call SET_TEXTATTRIB,$(BOLD),$(FG_WHITE),$(BG_NAVY))" ; \
\
if [ "$$pdone" -lt "36" ]; \
then \
str=$$str"%$${pdone}s"; \
str=$$str"$(call SET_TEXTATTRIB,$(BG_GRAY))";\
pdoneb=`expr 36 - $$pdone`; \
str=$$str"%$${pdoneb}s%3d%%"; \
else \
pdoneb=`expr $$pdone - 36`; \
str=$$str"%1s%35s%3d%%%$${pdoneb}s"; \
fi; \
str=$$str"$(RESTORECURSOR)$(RESTORECOLOUR)"; \
printf $$str "" "" $$_pdone; \
}
# Increment Progress Bar From percentage (1), and increase by 1 every (2) seconds.
# Continue doing so until calling process ends
IncrementProgressBarFromAtRate = \
{ \
i=$(1); \
while [ -d /proc/$$! ] && [ $$i -le 100 ]; do \
$(call DrawProgressBar,$$i); \
i=$$((i+1)); \
sleep $(2); \
done; \
}
endif #Verbose No Draw PBar
# Ask to continue
# (1) Prompt,
# (2) Do if Yes,
# (3) Do if No [can be blank],
# (4) Do if anything else [can be blank]
# (5) Timeout [can be blank]
ContinuePrompt = \
{ \
echo "$1 [y/n]"; \
$(if $(5), readchr(){ old=$$(stty -g); stty raw -echo min 0 time 30; printf '%s' $$(dd bs=1 count=1 2>/dev/null); stty $$old;}; REPLY=$$(readchr) ,read REPLY ); \
echo $$REPLY; case $$REPLY in \
y|Y) $2;; \
n|N) $3;; \
*) $4;; \
esac; \
}
+83
View File
@@ -0,0 +1,83 @@
## VT100 Codes ##
SAVECURSOR := \0337\033[s
RESTORECURSOR := \0338\033[u
SET_SCROLLREGION = \033[$(1);$(2)r
RESTORESCROLLREGION := \033[r
RESTORESCROLLREGION2 = $(SAVECURSOR)$(RESTORESCROLLREGION)$(RESTORECURSOR)\033[1A
CURSOR_GOTO = \033[$(1);$(2)H
SET_TEXTATTRIB = \033[$(1)$(if $(2),;$(2))$(if $(3),;$(3))m
BELL := \007
VT_ED := \033[2J
VT_CUU = \033[$(1)A
VT_CUD = \033[$(1)B
VT_CUF = \033[$(1)C
VT_CUB = \033[$(1)D
#Attributes
RESTORECOLOUR := \033[m
BOLD := 1
DIM := 2
UNDERSCORE := 4
BLINK := 5
INVERT := 7
HIDDEN := 8
#Colours
FG_BLACK:= 30
FG_MAROON:= 31
FG_GREEN:= 32
FG_OLIVE:= 33
FG_NAVY:= 34
FG_PURPLE:= 35
FG_TEAL:= 36
FG_SILVER:= 37
FG_GRAY:= 90
FG_RED:= 91
FG_LIME:= 92
FG_YELLOW:= 93
FG_BLUE:= 94
FG_VIOLET:= 95
FG_CYAN:= 96
FG_WHITE:= 97
BG_BLACK:= 40
BG_MAROON:= 41
BG_GREEN:= 42
BG_OLIVE:= 43
BG_NAVY:= 44
BG_PURPLE:= 45
BG_TEAL:= 46
BG_SILVER:= 47
BG_GRAY:= 100
BG_RED:= 101
BG_LIME:= 102
BG_YELLOW:= 103
BG_BLUE:= 104
BG_VIOLET:= 105
BG_CYAN:= 106
BG_WHITE:= 107
# define a "newline" variable to be used in make scripts
# use with ${\n}
# https://stackoverflow.com/questions/12528637/how-do-i-execute-each-command-in-a-list
define \n
endef
#end newline.
#Colour IDO Output (GCC does this automatically)
CLR_OUT := sed -E
#colour AI errors
CLR_OUT += -e 's/\(\(\x27E\x27\,\x27R\x27\,\x27R\x27\,\x27O\x27\,\x27R\x27,\s?((\x27?,?\s?\x27.)*)\x27,\s?\x27([^x27])\x27\)/((\x27ERROR\x27,\1\3\x27\)/g; :loop s/\(\((\x27ERROR)((\x27?,?\s?\x27.)*),?\s?\x27(.)\x27([^x27]*)\x27\)/((\1\2\5\x27\)/g; tloop; '
#colour errors
CLR_OUT += -e "s/(ERROR:[^\x27]*?\x27)|(^.*[Ee]rror.*)|(Mis-Match in)|(:\sFAILED)/$$(echo "$(call SET_TEXTATTRIB,$(FG_RED))")&$$(echo "$(RESTORECOLOUR)")/g"
#colour warnings
CLR_OUT += -e "s/^.*[Ww]arning.*/$$(echo "$(call SET_TEXTATTRIB,$(FG_YELLOW))")&$$(echo "$(RESTORECOLOUR)")/g"
#colour Info Tags
CLR_OUT += -e "s/^.*(([Bb]uilding)|(:\sOK)|([Ll]inkin)).*/$$(echo "$(call SET_TEXTATTRIB,$(FG_LIME))")&$$(echo "$(RESTORECOLOUR)")/g"
#colour filenames
CLR_OUT += -e "s/((([^\/]*([^s][^t][^d][^i][^n])\.c)|([^\/]*\.o))\s)/$$(echo "$(call SET_TEXTATTRIB,$(FG_WHITE))")&$$(echo "$(RESTORECOLOUR)")/g"
+86
View File
@@ -0,0 +1,86 @@
################################################################################
# CMD Builder
################################################################################
#CMD Builder tools
AI_CMD_BUILDER := $(TOOLS_DIR)/cmdbuilder.c
AI_CMD_LIST_DEFINITIONS := src/aicommands.def
AI_CMD_LIST_TEMP := $(BUILD_DIR)/aicommands.temp
AI_CMD_LIST_H2 := src/aicommands2.h
#Pre-Format encoding newlines and tags
AI_CMD_BUILDER_PRECONVERT := sed -E
AI_CMD_BUILDER_PRECONVERT += -e 's/\x27\\n\x27/\x27\/n\x27/g;' # encode '\n' as '/n' (TEXT PRINT command)
AI_CMD_BUILDER_PRECONVERT += -e '/^\s*\*/ s/\x27/\?\?x27/g;' # encode DocBlock(/**...**/) quotes '' as x27
AI_CMD_BUILDER_PRECONVERT += -e '/\/\*\*/ , /\*\// s/([^/])$$/\1 \\n\\/g;' # encode DocBlock(/**...**/) Newlines as \n\ .
#AI_CMD_BUILDER_PRECONVERT += -e '/^\s*\*/ s/([^\/])$$/\1 \\n\\/g;' # encode DocBlock(/**...**/) Newlines as \n\ .
AI_CMD_BUILDER_PRECONVERT += -e 's/[^/\*\S]\*$$/\\n\\/g; s/^(\s*)\*[^/\*]/\1 /g;' # remove DocBlock sides (causes problems with tooltips) fixed to check for ordinary comment
#AI_CMD_BUILDER_PRECONVERT += -e '/^_AI_CMD_POLYMORPH\(CMDNAME,\n(.|\n)*?\s{19}DESCRIPTION(\)| DESCRIPTION2\))/ s/[^,]\n/\\n\\/g;' # Newlines in POLYMORPHS
AI_CMD_BUILDER_PRECONVERT += -e 's/\/\*\*/\?\?\\\*\(\*\*/g;' # encode /** as ??\*(**
AI_CMD_BUILDER_PRECONVERT += -e 's/\*\*\//\*\*\)\*\?\?\\ /g;' # encode **/ as **)*??\
#Format Newlines and Comment tags
AI_CMD_BUILDER_CONVERT := sed -E
AI_CMD_BUILDER_CONVERT += -e 's/\\n/\n/g;' # add newlines
AI_CMD_BUILDER_CONVERT += -e 's/\?{2}\=/\#/g;' # replace ??= with hash for defines
AI_CMD_BUILDER_CONVERT += -e 's/\?{2}\\/\//g;' # replace ??\ with /
AI_CMD_BUILDER_CONVERT += -e 's/DEFINE([^D])/\#define\1/g;' # replace DEFINE with #define
AI_CMD_BUILDER_CONVERT += -e 's/\\.*/\\/g;' # replace \... with \ (line continuation)
AI_CMD_BUILDER_CONVERT += -e 's/\*\(\*/\*/g;' # replace *(* with *
AI_CMD_BUILDER_CONVERT += -e 's/\*\)\*/\*/g;' # replace *)* with *
AI_CMD_BUILDER_CONVERT += -e 's/MAKE_EXPAND\(([^\n]*)MAKE_EXPAND_END\)/\1/g;' # replace MAKE_EXPAND(CONTENTS) with CONTENTS
AI_CMD_BUILDER_CONVERT += -e 's/\?{2}x27/\x27/g;' # replace ??x27 with '
AI_CMD_BUILDER_CONVERT += -e 's/\x27\/n\x27/\x27\\n\x27/g;' # replace '/n' with '\n'
AI_CMD_BUILDER_CONVERT += -e 's/AI_EndList\s*,/AI_EndList/g;' # replace AI_EndList , with AI_EndList
AI_CMD_BUILDER_CONVERT += -e 's/ *(,|;) */\1 /g; ' # remove spaces
AI_CMD_BUILDER_CONVERT += -e '/define (AICMDSIZE)|(AI.*_LENGTH)/! s/define ([^ ]*) *\( *([^ ]*)/define \1(\2/g; ' # for each command, remove the space so macro is read as a function
AI_CMD_BUILDER_CONVERT += -e '/^typedef/ s/\}/\n\}/g; /^typedef/ s/(; |\{)/\1\n /g;' # for each typedef, break into ALLMAN
AI_CMD_BUILDER_CONVERT += -e '/^typedef/ s/(\{)/\n\1/g; /^\s*AI_/ s/,/,\\\n /g' # for each command, break into a list
AI_CMD_BUILDER_CONVERT += -e '/^ *$$/d; s/ *\n/\n/g;' # remove surplus newlines
AI_CMD_LIST_H2_HEADER := \
"/******************************************************************************\n\
* *\n\
* *\n\
* Do not edit this file. It was automatically generated by \"cmdbuilder\" *\n\
* from the file \"$(AI_CMD_LIST_DEFINITIONS)\". *\n\
* To Add/Remove/Modify AI Commands please edit \"$(AI_CMD_LIST_DEFINITIONS)\" *\n\
* and then run *\n\
* make cmdbuilder *\n\
* *\n\
* *\n\
*****************************************************************************/\n\n"
cmdbuilder:
@clear
@echo
@echo Building AI Command Macros...
@echo
@$(call SetupProgressBar)
@$(call DrawProgressBar,0)
@ # copy command definitions to temp
@cp $(AI_CMD_LIST_DEFINITIONS) $(AI_CMD_LIST_TEMP)
@$(call DrawProgressBar,5)
@ # Preformat Definitions for builder (encode documentation tags)
@$(call PRINT_STATUS,"Pre Formatting",$(AI_CMD_LIST_DEFINITIONS))
@$(AI_CMD_BUILDER_PRECONVERT) $(AI_CMD_LIST_TEMP) > $(AI_CMD_LIST_DEFINITIONS)
@$(call DrawProgressBar,10)
@ # Print Header
@echo $(AI_CMD_LIST_H2_HEADER) > $(AI_CMD_LIST_H2)
@$(call DrawProgressBar,11)
@ # Execute Builder and format (re-add newlines, documentation tags etc) -C keeps /**/ comments
@$(call PRINT_STATUS,"Processing",$(AI_CMD_LIST_DEFINITIONS))
@echo This might take some time...
@$(CC) -Xcpluscomm -c $(AI_CMD_BUILDER) $(INCLUDE) -w 581 -E | $(AI_CMD_BUILDER_CONVERT) >> $(AI_CMD_LIST_H2) || (cp $(AI_CMD_LIST_TEMP) $(AI_CMD_LIST_DEFINITIONS) ; echo Error with cmdbuilder ; false) & $(call IncrementProgressBarFromAtRate,12,0.5)
@$(call DrawProgressBar,98)
@ # restore command def from temp (no encoding)
@cp $(AI_CMD_LIST_TEMP) $(AI_CMD_LIST_DEFINITIONS)
@$(call DrawProgressBar,99)
@rm $(AI_CMD_LIST_TEMP)
@$(call DrawProgressBar,100)
@echo
@echo Done!
@echo
@echo Rebuild AI Command Macros whenever changing aicommands.def.
@echo "\n$(BELL)$(RESTORESCROLLREGION2)"