51
Work in progress / Re: Undelete files
« Last post by Vortex on February 14, 2024, 10:21:16 PM »DOS used to provide the undelete command, why M$ decided to remove it?
Due to server problems the website is temporarily offline! Visit http://www.smorgasbordet.com/pellesc/ to download Pelles C.
#include <stdio.h>
#include <wchar.h>
#include "yaclrcc.h"
#define STR L"A : S;\nS : C C;\nC : 1 C;\nC : 2;\n"
size_t i, j;
const wchar_t * wc = L"ccccdddd";
P_QUEUE_L pq;
ptrdiff_t GetSymbol(void)
{
if (i < j)
{
return Lexer(pq, wc[i++]);
}
return 0;
}
int Reduce(ptrdiff_t n)
{
printf("REDUCE! %ld\n", n);
return CBF_TERMINATE;
}
void Error(void)
{
printf("ERROR!\n");
return CBF_TERMINATE;
}
int main()
{
P_MATRIX ptbl;
P_ARRAY_Z parrG = NULL;
pq = LexCompile(L"c\nd\n");
ptbl = ConstructCLRTable(STR, &parrG);
PrintCLRTable(ptbl);
j = wcslen(wc);
CLRParse(ptbl, parrG, GetSymbol, Reduce, Error);
LexDestroy(pq);
DestroyParrList(parrG);
DestroyCLRTable(ptbl);
return 0;
}
The parser reads this:include enumMacro.inc
; enum macro by mabdelouahab
; https://masm32.com/board/index.php?msg=126825
enum MACRO __vargs:VARARG
LOCAL val__
val__=0
FOR __varg,<__vargs>
__varg EQU val__
val__ = val__ +1
ENDM
ENDM
.data
format db 'test1 = %u',13,10
db 'sample = %u',13,10
db 'experiment = %u',0
.data?
buffer db 64 dup(?)
.code
start:
enum test1,sample,experiment
invoke wsprintf,ADDR buffer,\
ADDR format,test1,sample,experiment
invoke StdOut,ADDR buffer
invoke ExitProcess,0
END start
test1 = 3
sample = 3
experiment = 3
test1 = 0
sample = 1
experiment = 2
/-----------------------------------------------------------------------
// Function : Set_one_Caret
// Task : Set the dark mode edit caret cursor to usable color
// : and set it back to the std caret as required
// Note :
// Input : context on state TRUE = Dark Mode caret, FALSE = Std
//-----------------------------------------------------------------------
void Set_one_Caret( BOOL context_on, HANDLE hwnd)
{ int ans;
static HANDLE last_hwnd=NULL;
static BOOL last_context=FALSE;
DWORD err;
RECT cwin;
int h=0;
if ((last_hwnd == hwnd) && (last_context == context_on))
{ return;}
// NOT really needed just for testing
GetClientRect(text[0].hctl,&cwin);// sizes std caret to control window
h = cwin.bottom-cwin.top-2; // only useful for built in caret
HBITMAP hCaret1=NULL;// caret bitmap handles
if (context_on)
{ hCaret1 = LoadBitmap(ghInstance,MAKEINTRESOURCE(CARET_W));
if (hCaret1 == NULL)
MessageBoxA(NULL,"Failed load bitmap","Set_One_Caret",MB_OK);
// no crash with NULL though just uses system caret - so ok fall through
ans = CreateCaret(hwnd,hCaret1,0,h); // new cursor, h ignored
err = GetLastError();
if (ans == 0)
{MessageBoxA(NULL,"Failed Create New","Set_one_Caret",MB_OK);
Show_Error(err, L"Set_one_Caret- creating"); //error display
}
ans = ShowCaret(hwnd);
err = GetLastError();
if (ans == 0)
{ MessageBoxA(NULL,"Failed Show New","Set_one_Caret",MB_OK);
Show_Error(err, L"Set_one_Caret- show"); //error display
}
}
else //revert to system caret
{ // test use edit box height (h) to the set system caret height - Works
ans = CreateCaret(hwnd,(HBITMAP) 1,2,h); // std Caret
err = GetLastError();
if (ans == FALSE)
{MessageBoxA(NULL,"Failed Re-Create Old","Set_one_Caret",MB_OK);
Show_Error(err, L"Set_one_Caret- Reset,Create"); //error display
}
ans = ShowCaret(hwnd);
err = GetLastError();
if (ans == FALSE)
{ MessageBoxA(NULL,"Failed Re-Show Old","Set_one_Caret",MB_OK);
Show_Error(err, L"Set_one_Caret- Reset,Apply"); //error display
}
}
last_hwnd = hwnd;
last_context = context_on;
return;
}/* end set_one_caret */
5 Modifying symbols
It is possible to modify the names of public and external symbols in object files and libraries
in order to prevent name clashes, to fix problems with different name mangling systems,
etc.
Note that symbol names must be specified in the way they are represented in object files,
possibly including underscores and name mangling information. All names are treated as
case sensitive. Use the dump or disassembly feature to see the mangled symbol names.
To change the symbol name name1 to name2 in object file file1.obj:
objconv -nr:name1:name2 file1.obj file2.obj
The modified object file will be file2.obj. Objconv will replace name1 with name2
wherever it occurs in public, external and local symbols, as well as section names and
library member names. All names are case sensitive.