473,809 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FILE Access

Hello,

This might be a tad off topic. The c-programming groups
I found appear to be unused...

The problem is simple...

I need to create a listing file from an assembler source file.
The listing file is just a copy of the source file with line numbers
along with a list of syntax errors (e.g. multiply or undefined symbols).

I'm not really sure how to approach this. I figure I can
create an error file and put errors there until the entire source
is processed then copy that into the end of the listing. That doesn't
seem like a great way and I haven't thought of anything better.

Any suggestions are greatly appreciated.

Thanks,
Grant
Nov 14 '05 #1
4 1539
Grant Austin <ga*****@foo.fo o.bar.net> writes:
I need to create a listing file from an assembler source file.
The listing file is just a copy of the source file with line numbers
along with a list of syntax errors (e.g. multiply or undefined symbols).


Your question is outside the domain of comp.lang.c, which discusses
only the standard C programming language, including the standard C
library. This is a remarkably narrow topic compared to what many
people expect.

For your convenience, the list below contains topics that are not
on-topic for comp.lang.c, and suggests newsgroups for you to explore
if you have questions about these topics. Please do observe proper
netiquette before posting to any of these newsgroups. In particular,
you should read the group's charter and FAQ, if any (FAQs are
available from www.faqs.org and other sources). If those fail to
answer your question then you should browse through at least two weeks
of recent articles to make sure that your question has not already
been answered.

* OS-specific questions, such as how to clear the screen,
access the network, list the files in a directory, or read
"piped" output from a subprocess. These questions should be
directed to OS-specific newsgroups, such as
comp.os.ms-windows.program mer.misc, comp.unix.progr ammer, or
comp.os.linux.d evelopment.apps .

* Compiler-specific questions, such as installation issues and
locations of header files. Ask about these in
compiler-specific newsgroups, such as gnu.gcc.help or
comp.os.ms-windows.program mer.misc. Questions about writing
compilers are appropriate in comp.compilers.

* Processor-specific questions, such as questions about
assembly and machine code. x86 questions are appropriate in
comp.lang.asm.x 86, embedded system processor questions may
be appropriate in comp.arch.embed ded.

* ABI-specific questions, such as how to interface assembly
code to C. These questions are both processor- and
OS-specific and should typically be asked in OS-specific
newsgroups.

* Algorithms, except questions about C implementations of
algorithms. "How do I implement algorithm X in C?" is not a
question about a C implementation of an algorithm, it is a
request for source code. Newsgroups comp.programmin g and
comp.theory may be appropriate.

* Making C interoperate with other languages. C has no
facilities for such interoperation. These questions should
be directed to system- or compiler-specific newsgroups. C++
has features for interoperating with C, so consider
comp.lang.c++ for such questions.

* The C standard, as opposed to standard C. Questions about
the C standard are best asked in comp.std.c.

* C++. Please do not post or cross-post questions about C++
to comp.lang.c. Ask C++ questions in C++ newsgroups, such
as comp.lang.c++ or comp.lang.c++.m oderated.

* Test posts. Please test in a newsgroup meant for testing,
such as alt.test.

news.groups.que stions is a good place to ask about the appropriate
newsgroup for a given topic.

--
Ben Pfaff
email: bl*@cs.stanford .edu
web: http://benpfaff.org
Nov 14 '05 #2

"Grant Austin" <ga*****@foo.fo o.bar.net> wrote in message
I need to create a listing file from an assembler source file.
The listing file is just a copy of the source file with line numbers
along with a list of syntax errors (e.g. multiply or undefined
symbols).

It's more a programming issue than a C one. C is a reasonable choice of
language to write this program in.
Presumably you already have an assembler. You can evoke it using the
system() function, and direct the output somewhere appropriate (this is
rather platform-specific).
Then you need to run through the assembly listing line by line adding line
numbers and errors. Just call fgets() to read a line, keep a counter going
for the line number, and write a function to change the line into a tagged
line. Presumably the error file contains line numbers and is in numerical
order, so you need to keep track of the topmost error line.

The difficult bit might come if you have several different error formats,
for instance "syntax error line 1" but "line 2, jump label out of range"
Nov 14 '05 #3
# I need to create a listing file from an assembler source file.
# The listing file is just a copy of the source file with line numbers
# along with a list of syntax errors (e.g. multiply or undefined symbols).
#
# I'm not really sure how to approach this. I figure I can
# create an error file and put errors there until the entire source
# is processed then copy that into the end of the listing. That doesn't
# seem like a great way and I haven't thought of anything better.

It's a perfectly satisfactory solution, and the norm for many years. You can
probably use tmpname or its variants to get the file name.

Most modern computers you are likely to use have large virtual memories. It's
likely that you can also store the entire listing in memory, either as a
linked list or a reallocced string (or string array).

Assuming you have enough memory, which you choose is a style question.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
The whole world's against us.
Nov 14 '05 #4
Grant Austin <ga*****@foo.fo o.bar.net> wrote:
I need to create a listing file from an assembler source file.
The listing file is just a copy of the source file with line numbers
along with a list of syntax errors (e.g. multiply or undefined symbols).

I'm not really sure how to approach this. I figure I can
create an error file and put errors there until the entire source
is processed then copy that into the end of the listing. That doesn't
seem like a great way and I haven't thought of anything better.


Well, the one thing about this problem that _is_ relevant to C is that,
like most other languages, C doesn't have any features for inserting a
line in the middle of a file, only for appending lines or overwriting,
and perhaps not even the latter for text files.
So if you do want to insert the error message at the first significant
line, then no matter what you do, you will end up reading the file
twice, once to find the errors, once to insert messages about them in
the proper place.

Richard
Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
9121
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the data, imports it into a mySQL database and deletes the .csv-file after the import. so far, so good. but in some cases the cronjobs starts running when the file is not completely
2
3941
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company 1&1 with only limited server configuration via a web based control panel. My query relates to the ASP security model and how it relates to FrontPage options for setting file access on a database file. If you know of any online documentation...
3
2817
by: Joe Costa | last post by:
I have written the following code to search for the right file depending on the startup file for "Client Access". The menu database that I made will load the correct config file specific for each "Thin Client". The problem is that we also use PC's to run the "Client Access" program and under the following script it will create a match and load the wrong WS file. I read that you should not use the DIR function but that's that only way I...
4
47549
by: Bill | last post by:
I need help closing a CMD window when it is executed from Access. 1) The batch file is called from Access. 2) Access closes, 3) the batch runs a copy of the access database (creating a backup) 4) Once the copy is complete, the batch file opens the Access database again 5) EXIT should close out the cmd window but it does not execute that line
1
2535
by: raydelex | last post by:
I am new to securing a database with logins. My questions is: I want only one database to use a new Workgroup file that I have created, not all the Access databases that I bring up under my system login. Can this be done? Thanks
11
9605
by: sur | last post by:
Hello, My problem is that File.Exists works fine if my file is on my local drive but returns false if its on any other drive. I think that the issue is probably file permissions and so I have tried the following: FileIOPermision permFileIO = new FileIOPermission(FileIOPermissionAccess.Read, filepath.Value.ToString());
0
3946
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
13
11161
by: George | last post by:
Hi, I am re-writing part of my application using C#. This application starts another process which execute a "legacy" program. This legacy program writes to a log file and before it ends, it writes a specific string to the log file. My original program (MKS Toolkit shell program) which keeps running "grep" checking the "exit string" on the "log files". There are no file sharing problem.
16
2415
by: Eran.Yasso | last post by:
Hi, I have a mdb file shared in the LAN. I want to write app that verifies if it's open. If the file is not open, then my app can open the file. if the file is used, then the app won't open it. I also want this app to have handle to this file, then when the user stops editting this file, he can close it using this app.
5
17775
by: =?Utf-8?B?QWRyaWFuTW9ycmlz?= | last post by:
Hello! I'm trying to copy a file from another computer on the network that I do not have permission with my current logon details to access. If I open the folder using the Windows file manager with the path "\\ 192.168.2.2\temp" (where temp is a shared directory on server \\192.168.2.2), windows prompts for a User Name and password of a user who has permission on that computer to access that directory. If I enter valid details, the...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10635
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10378
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.