file compression functions where did they come from [closed] - file

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
This code uses: TArchiveEntry;
So, I really doubt this is not from Zlib Unit? because TArchiveEntry can be used without declaring the Zlib Unit.
var AE : TArchiveEntry;
AE.EntryType := aeFile;
AE.FileNameLen := Length(sr.Name);
AE.FileLength := sr.Size;
OutStream.Write(AE, SizeOf(AE));
OutStream.Write(sr.Name[1], Length(sr.Name));
// Write the file itself
TmpStream := TFileStream.Create(ADir + sr.Name, fmOpenRead or fmShareDenyWrite);
OutStream.CopyFrom(TmpStream, TmpStream.Size);
TmpStream.Free;
This is from Zlib Unit, without doubt.
var compr : TZCompressionStream;
for i := 0 to zFiles.Count-1 do
begin
compr := TZCompressionStream.Create(mStream, zcDefault);
compr.CopyFrom(infile,c);
compr.Free;
end;
I wonder why, what there differences? I can't figure it out, there almost have the same performance.

There is no TArchiveEntry type in the System.ZLib unit (or the System.Zip unit, for that matter). The first code snippet you show is a direct copy/paste of code from an old newsgroup posting that defines its own TArchiveEntry type above the snippet you copied:
Re: How to use ZLib to zip up a folder in Delphi 2005???

This question appears to be:
How do I determine which unit a symbol is defined in?
Once you have compiled the project, hover the cursor over the symbol and the IDE will display a hint which names the unit where the symbol is defined.
Or, use CTRL+click to open the unit that declares the symbol in the editor.

Related

Running C program in Ubuntu [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a set of C code files named as: hmc.c hopping.c phi4.c and I have an 'infile' which contains value of parameters and a 'Makefile'. How do I run these set of files in Ubuntu?
Previously in Windows I used gcc compiler with command 'gcc hmc.c hopping.c phi4.c' and then press Enter and then 'a infile' and that did the expected job but on Ubunut it isn't working..
Running the makefile should compile and give you an executable. You can do so by entering make in the command line. Make sure you have it installed first.

How do i clear this issue? unable to compile? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
got this error
11.43.36 JOB05184 $HASP165 IBMUSERX ENDED AT N1 MAXCC=12 CN(INTERNAL)
IEW2735S DA0F OUTPUT DATA SET FOR DDNAME SYSLMOD HAS INVALID RECORD FORMAT. R
IEW2008I 0F03 PROCESSING COMPLETED. RETURN CODE = 12.
THIS IS MY CODE TO COMPILE:-
//IBMUSERX JOB '285','POLSANI',NOTIFY=&SYSUID,REGION=6M
//JOBPROC JCLLIB ORDER=S1304.ANIL.PROC
//COBCL EXEC COBCL,MEM=HELLPGM1
//COMPILE.SYSIN DD DSN=IBMUSER.RKSH.COBOL(&MEM),DISP=SHR
//LKED.SYSLMOD DD DSN=IBMUSER.RKSH.LOAD(&MEM),DISP=SHR
PLEASE SOLVE THIS.
No one here can see what program is really being executed in the LKED step for which you have the SYSLMOD override, but it's probably IEWL (the binder, known in ancient times as the Linkage Editor).
No one here can see what the attributes of your IBMUSER.RKSH.LOAD dataset are, but it must have RECFM=U.
No one here can see which compiler you are using, but from your dataset names it appears you are compiling a COBOL program. If you are using a COBOL compiler version later than 4.2.1 your IBMUSER.RKSH.LOAD dataset must be a PDSE (not a PDS). If you are using a version of IBM Enterprise COBOL 4.2.1 or earlier, then your IBMUSER.RKSH.LOAD dataset can be either a PDS or a PDSE. Your compile listing includes which version of the compiler is being invoked.
Your override...
//LKED.SYSLMOD DD DSN=IBMUSER.RKSH.LOAD(&MEM),DISP=SHR
...should not specify a member name. It should look like this...
//LKED.SYSLMOD DD DSN=IBMUSER.RKSH.LOAD,DISP=SHR
Documentation for IBM Enterprise COBOL is available here. Documentation for the binder is available here.

Is it possible to use the C API of lua in embedded systems? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to add some lua scripts to a firmware project writen in C. For now, the script is a config table, from which I'm trying to get the value of the num variable, all of this using the C API in the main.c file.
I'm testing this code including the standard source files of Lua for Desktop in my project (I have read about eLua, but the I don't need to implement the full code in Lua, I need to have Lua and C files coexisting in my project).
It works fine when I test this in the computer with the gcc compiler, but when I try to pass the same idea to my microcontroller with the cross compiler it compiles and there are no erros, but it seems to have problems getting the value from the lua file, because the variable valueFromLua always equals to 1.
My project folder tree has the following structure:
Source
main.c
Tools
lua
scripts
config_table.lua
config_table.lua
config_table = {
num = 10
}
main.c
lua_State *L = luaL_newstate();
uint8_t valueFromLua;
if(luaL_dofile(L, "./Tools/lua/scripts/config_table.lua") == LUA_OK)
{
lua_getglobal(L, "config_table");
if(lua_istable(L, -1))
{
lua_getfield(L, -1, "num");
valueFromLua = lua_tointeger(L, -1);
}
}
else
{
valueFromLua = 1;
}
I would appreciate your comments, thanks in advance.

Locate root cause of preprocessor errors - gcc [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to build a big project step by step. I'm working on Linux and using qt-creator and gcc compiler. I include a set of related files in the .pri file and then build, test functionality and then add a new set of existing files and so on.
The project compiled successfully then I included a folder containing some header files then when compiled I got many errors in libc-header-start.h, string.h, cpu-set.h, time.h and many other stdlib and system files. Errors like missing binary operator before token (, unknown type name __cpu_mask, expected ';', ',' or ')' before '*' token.
I think these are likely to be preprocessor errors that are caused, for example, if I forget a semicolumn or so, right?
My question is, how can I locate the exact location in the header/source files where all these errors started, for example, the line of code where the semicolumn is missing.
This answer is just collecting the comments on my question.
Here is what can help locating what is the root cause of preprocessor errors:
Make sure that the names of your header files don't conflict with standard header files.
Check the first file in the errors list. Check where this file is included. If this file is included by another standard header file, check where the parent header file is included in your code. The root cause of the errors may be in the lines before that #include statement in your code. For example, you may have forgetten a semi-column before this #include.
Use gcc -H file.c to check all the header files included with file.c.
Use gcc -E file.c to generate a preprocessed version of file.c, then you will have the full end picture of your file which you can then investigate.

How can I read a line from a file and check if that row contains an #include for call an header file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to read all the content of a .c file and print out in another .o file all the source code of the first file, replacing all the #include <....> in this way:
Input: #include<string.h>
Ouput: "string.h"
I have to work in pure C, without the chance to use any C++ libraries
Can someone please help me with this issue?
A simple sed on your file maybe?
sed 's/.*#include *\(<|"\)\(.*\)\(>|"\).*/"\2"/' < input.c > output.o

Resources