if [ ! "$(FORMAT)" = "NO" ]; then rm -rf install-workdir ; fi
if [ ! "$(FORMAT)" = "NO" ]; then rm -f install-dosbox.conf ; fi
$(MAKE) clean
+
+./install.exe: no-doc
+ convert -size 150x57 xc:white canvas.bmp
+ convert Binary/dataworks-black.png dw.bmp
+ convert canvas.bmp dw.bmp -geometry +97+5 -composite dataworks.bmp
+ rm canvas.bmp dw.bmp
+ echo "!include MUI2.nsh" > install.nsi
+ echo "!define MUI_ABORTWARNING" >> install.nsi
+ echo "!define MUI_ICON \"Binary/dataworks.ico\"" >> install.nsi
+ echo "!define MUI_HEADERIMAGE" >> install.nsi
+ echo "!define MUI_HEADERIMAGE_BITMAP \"dataworks.bmp\"" >> install.nsi
+ echo "!define MUI_HEADERIMAGE_RIGHT" >> install.nsi
+ echo "!include nsDialogs.nsh" >> install.nsi
+ echo "!include LogicLib.nsh" >> install.nsi
+ echo "Name \"DataWorks\"" >> install.nsi
+ echo "OutFile \"$@\"" >> install.nsi
+ echo "SetCompressor lzma" >> install.nsi
+ echo "InstallDir \"\$$$(TO)\\DataWorks\"" >> install.nsi
+ echo "XPStyle on" >> install.nsi
+ echo "!insertmacro MUI_PAGE_WELCOME" >> install.nsi
+ echo "!insertmacro MUI_PAGE_DIRECTORY" >> install.nsi
+ echo "!insertmacro MUI_PAGE_INSTFILES" >> install.nsi
+ echo "!insertmacro MUI_PAGE_FINISH" >> install.nsi
+ echo "!insertmacro MUI_UNPAGE_WELCOME" >> install.nsi
+ echo "!insertmacro MUI_UNPAGE_CONFIRM" >> install.nsi
+ echo "!insertmacro MUI_UNPAGE_INSTFILES" >> install.nsi
+ echo "!insertmacro MUI_UNPAGE_FINISH" >> install.nsi
+ echo "!insertmacro MUI_LANGUAGE \"English\"" >> install.nsi
+ echo "Section" >> install.nsi
+ echo " SetOutPath \"\$$INSTDIR\"" >> install.nsi
+ echo " File \"Client/dataworks.exe\"" >> install.nsi
+ echo " File \"Server/dataworks_server.exe\"" >> install.nsi
+ echo " File \"RemoteClient/dataworks_remote_client.exe\"" >> install.nsi
+ echo " CreateDirectory \"\$$SMPROGRAMS\\DataWorks\"" >> install.nsi
+ echo " SetOutPath \"\$$INSTDIR\"" >> install.nsi
+ echo " CreateShortcut \"\$$SMPROGRAMS\\DataWorks\\DataWorks Client.lnk\" \"\$$INSTDIR\\dataworks.exe\" \"\"" >> install.nsi
+ echo " CreateShortcut \"\$$SMPROGRAMS\\DataWorks\\DataWorks Remote Client.lnk\" \"\$$INSTDIR\\dataworks_remote_client.exe\" \"\"" >> install.nsi
+ echo " CreateShortcut \"\$$SMPROGRAMS\\DataWorks\\DataWorks Server.lnk\" \"\$$INSTDIR\\dataworks_server.exe\" \"\"" >> install.nsi
+ echo " WriteUninstaller \"\$$INSTDIR\\Uninstall.exe\"" >> install.nsi
+ echo " WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DataWorks\" \"DisplayName\" \"Dataworks\""
+ echo " WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DataWorks\" \"UninstallString\" \"\$$INSTDIR\\Uninstall.exe\""
+ echo "SectionEnd" >> install.nsi
+ echo "Section Uninsatll" >> install.nsi
+ echo " SetAutoClose false" >> install.nsi
+ echo " Delete \"\$$INSTDIR\\dataworks.exe\"" >> install.nsi
+ echo " Delete \"\$$INSTDIR\\dataworks_server.exe\"" >> install.nsi
+ echo " Delete \"\$$INSTDIR\\dataworks_remote_client.exe\"" >> install.nsi
+ echo " RMDir \"\$$INSTDIR\"" >> install.nsi
+ echo "SectionEnd" >> install.nsi
+ makensis install.nsi
+ rm install.nsi dataworks.bmp
FILE* in;
FILE* out;
+#define MAX 128
+
int process_doc(void) {
char cbuf[2];
cbuf[1] = 0;
str = malloc(1);
str[0] = 0;
fseek(in, 0, SEEK_SET);
+ int cincr = 0;
while(1) {
int len = fread(cbuf, 1, 1, in);
if(len <= 0) break;
if(strcmp(cmd, "\\hline") == 0) {
} else if(strcmp(cmd, "\\indent") == 0) {
} else if(strcmp(cmd, "\\list") == 0) {
+ } else if(strcmp(cmd, "\\list+") == 0) {
+ cincr++;
+ if(cincr >= MAX){
+ free(str);
+ free(full);
+ fprintf(stderr, "List index stack overflow. Aborted\n");
+ return 1;
+ }
+ } else if(strcmp(cmd, "\\list-") == 0) {
+ cincr--;
+ if(cincr < 0){
+ free(str);
+ free(full);
+ fprintf(stderr, "List index stack underflow. Aborted\n");
+ return 1;
+ }
} else if(str[1] == '"') {
} else {
fprintf(stderr, "Invalid command. Aborted\n");
free(str);
+ free(full);
return 1;
}
}
}
free(str);
- int list = 1;
+ int* list = malloc(MAX * sizeof(*list));
+ int listi = 0;
+ for(listi = 0; listi < MAX; listi++) list[listi] = 1;
str = malloc(1);
str[0] = 0;
indent = atoi(val);
}
}
+ } else if(strcmp(cmd, "\\list+") == 0) {
+ list++;
+ } else if(strcmp(cmd, "\\list-") == 0) {
+ list--;
} else if(strcmp(cmd, "\\list") == 0) {
if(val == NULL) {
- list = 1;
+ *list = 1;
} else {
for(i = 0; i < indent; i++) fprintf(out, " ");
- fprintf(out, "%d. %s\n", list++, val);
+ fprintf(out, "%d. %s\n", (*list)++, val);
}
} else if(str[1] == '"') {
- } else {
- fprintf(stderr, "Invalid command. Aborted\n");
- free(str);
- return 1;
}
} else {
int i;